[FFmpeg-devel] [PATCH] avfilter/vf_vignette: force per frame evaluation if per frame variables are used

Clément Bœsch u at pkh.me
Sat Apr 4 11:42:34 CEST 2015


On Mon, Mar 30, 2015 at 09:57:35PM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavfilter/vf_vignette.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c
> index 806bd72..9a05651 100644
> --- a/libavfilter/vf_vignette.c
> +++ b/libavfilter/vf_vignette.c
> @@ -161,15 +161,20 @@ static void update_context(VignetteContext *s, AVFilterLink *inlink, AVFrame *fr
>          s->var_values[VAR_T]   = TS2T(frame->pts, inlink->time_base);
>          s->var_values[VAR_PTS] = TS2D(frame->pts);
>      } else {
> -        s->var_values[VAR_N]   = 0;
> +        s->var_values[VAR_N]   = NAN;

Why?

>          s->var_values[VAR_T]   = NAN;
>          s->var_values[VAR_PTS] = NAN;
>      }
>  
> -    s->angle = av_clipf(av_expr_eval(s->angle_pexpr, s->var_values, NULL), 0, M_PI_2);
> +    s->angle = av_expr_eval(s->angle_pexpr, s->var_values, NULL);
>      s->x0 = av_expr_eval(s->x0_pexpr, s->var_values, NULL);
>      s->y0 = av_expr_eval(s->y0_pexpr, s->var_values, NULL);
>  
> +    if (isnan(s->x0) || isnan(s->y0) || isnan(s->angle))
> +        s->eval_mode = EVAL_MODE_FRAME;
> +
> +    s->angle = av_clipf(s->angle, 0, M_PI_2);
> +
>      if (s->backward) {
>          for (y = 0; y < inlink->h; y++) {
>              for (x = 0; x < inlink->w; x++)

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150404/76dfab91/attachment.asc>


More information about the ffmpeg-devel mailing list