[FFmpeg-devel] [PATCH v3] avfilter/vf_zoompan: fix shaking when zooming

Moritz Barsnick barsnick at gmx.net
Mon Jan 27 18:16:27 EET 2020


On Mon, Jan 27, 2020 at 15:17:29 +0100, Robert Deibel wrote:

> + * Used to scale the width and height of a frame to fit with the subsampling grid.
> + * @param n The number to be scaled.
> + * @param log_grid_size log 2 of the gridsize.
> + * @return The next number divisible by 2 * 2^log_grid_size but minimally n + 2 * 2^log_grid_size

With this modified explanation, my observations probably make sense.

> -    w = in->width * (1.0 / *zoom);
> -    h = in->height * (1.0 / *zoom);
>
> -    *dx = av_expr_eval(s->x_expr, var_values, NULL);
> +    w = dw = (double) in->width * (1 / *zoom);
> +    h = dh = (double) in->height * (1 / *zoom);

Actually, I meant
    w = dw = (double)in->width / *zoom;
    h = dh = (double)in->height / *zoom;

But the original lines were fine, as:
    int / double
is automatically promoted/cast to
    double / double
(and were therefore technically identical to my proposal and your
slightly too complex implementation).

Cheers,
Moritz


More information about the ffmpeg-devel mailing list