1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/vf_v360: move some local variables to private filter context

This commit is contained in:
Paul B Mahol 2019-09-16 17:53:58 +02:00
parent d87db83e1c
commit c271d88257
2 changed files with 7 additions and 6 deletions

View File

@ -115,7 +115,10 @@ typedef struct V360Context {
float h_fov, v_fov, d_fov; float h_fov, v_fov, d_fov;
float flat_range[3]; float flat_range[3];
float rot_mat[3][3];
float input_mirror_modifier[2]; float input_mirror_modifier[2];
float output_mirror_modifier[3];
int pr_width[4], pr_height[4]; int pr_width[4], pr_height[4];

View File

@ -2182,7 +2182,6 @@ static int config_output(AVFilterLink *outlink)
int in_offset_h, in_offset_w; int in_offset_h, in_offset_w;
int out_offset_h, out_offset_w; int out_offset_h, out_offset_w;
float hf, wf; float hf, wf;
float output_mirror_modifier[3];
void (*in_transform)(const V360Context *s, void (*in_transform)(const V360Context *s,
const float *vec, int width, int height, const float *vec, int width, int height,
uint16_t us[4][4], uint16_t vs[4][4], float *du, float *dv); uint16_t us[4][4], uint16_t vs[4][4], float *du, float *dv);
@ -2192,7 +2191,6 @@ static int config_output(AVFilterLink *outlink)
void (*calculate_kernel)(float du, float dv, const XYRemap *rmap, void (*calculate_kernel)(float du, float dv, const XYRemap *rmap,
uint16_t *u, uint16_t *v, int16_t *ker); uint16_t *u, uint16_t *v, int16_t *ker);
int (*prepare_out)(AVFilterContext *ctx); int (*prepare_out)(AVFilterContext *ctx);
float rot_mat[3][3];
s->input_mirror_modifier[0] = s->ih_flip ? -1.f : 1.f; s->input_mirror_modifier[0] = s->ih_flip ? -1.f : 1.f;
s->input_mirror_modifier[1] = s->iv_flip ? -1.f : 1.f; s->input_mirror_modifier[1] = s->iv_flip ? -1.f : 1.f;
@ -2466,8 +2464,8 @@ static int config_output(AVFilterLink *outlink)
allocate_plane(s, sizeof_uv, sizeof_ker, 1); allocate_plane(s, sizeof_uv, sizeof_ker, 1);
} }
calculate_rotation_matrix(s->yaw, s->pitch, s->roll, rot_mat, s->rotation_order); calculate_rotation_matrix(s->yaw, s->pitch, s->roll, s->rot_mat, s->rotation_order);
set_mirror_modifier(s->h_flip, s->v_flip, s->d_flip, output_mirror_modifier); set_mirror_modifier(s->h_flip, s->v_flip, s->d_flip, s->output_mirror_modifier);
// Calculate remap data // Calculate remap data
for (int p = 0; p < s->nb_allocated; p++) { for (int p = 0; p < s->nb_allocated; p++) {
@ -2491,10 +2489,10 @@ static int config_output(AVFilterLink *outlink)
else else
out_transform(s, i, j, width, height, vec); out_transform(s, i, j, width, height, vec);
av_assert1(!isnan(vec[0]) && !isnan(vec[1]) && !isnan(vec[2])); av_assert1(!isnan(vec[0]) && !isnan(vec[1]) && !isnan(vec[2]));
rotate(rot_mat, vec); rotate(s->rot_mat, vec);
av_assert1(!isnan(vec[0]) && !isnan(vec[1]) && !isnan(vec[2])); av_assert1(!isnan(vec[0]) && !isnan(vec[1]) && !isnan(vec[2]));
normalize_vector(vec); normalize_vector(vec);
mirror(output_mirror_modifier, vec); mirror(s->output_mirror_modifier, vec);
if (s->in_transpose) if (s->in_transpose)
in_transform(s, vec, in_height, in_width, rmap.v, rmap.u, &du, &dv); in_transform(s, vec, in_height, in_width, rmap.v, rmap.u, &du, &dv);
else else