[FFmpeg-devel] [PATCH] lavfi: remove the duplicate expression evaluation.

Jun Zhao mypopydev at gmail.com
Mon Jan 9 02:53:34 EET 2017



On 2017/1/9 8:21, Mark Thompson wrote:
> On 09/01/17 00:12, Jun Zhao wrote:
>> From 80ea322e8bd634dbf93291f7a4d78bc87834c0a8 Mon Sep 17 00:00:00 2001
>> From: Jun Zhao <mypopydev at gmail.com>
>> Date: Sun, 8 Jan 2017 14:26:39 +0800
>> Subject: [PATCH] lavfi: remove the duplicate expression evaluation.
>>
>> remove the duplicate expression evaluation in crop/drawtext/overlay.
>>
>> Signed-off-by: Jun Zhao <jun.zhao at intel.com>
>> ---
>>  libavfilter/vf_crop.c     | 1 -
>>  libavfilter/vf_drawtext.c | 1 -
>>  libavfilter/vf_overlay.c  | 1 -
>>  3 files changed, 3 deletions(-)
>>
>> diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
>> index 85ea892..4a032d1 100644
>> --- a/libavfilter/vf_crop.c
>> +++ b/libavfilter/vf_crop.c
>> @@ -262,7 +262,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
>>          NAN : av_frame_get_pkt_pos(frame);
>>      s->var_values[VAR_X] = av_expr_eval(s->x_pexpr, s->var_values, NULL);
>>      s->var_values[VAR_Y] = av_expr_eval(s->y_pexpr, s->var_values, NULL);
>> -    s->var_values[VAR_X] = av_expr_eval(s->x_pexpr, s->var_values, NULL);
>>  
>>      normalize_double(&s->x, s->var_values[VAR_X]);
>>      normalize_double(&s->y, s->var_values[VAR_Y]);
>> diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
>> index 649240b..a485362 100644
>> --- a/libavfilter/vf_drawtext.c
>> +++ b/libavfilter/vf_drawtext.c
>> @@ -1288,7 +1288,6 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame,
>>  
>>      s->x = s->var_values[VAR_X] = av_expr_eval(s->x_pexpr, s->var_values, &s->prng);
>>      s->y = s->var_values[VAR_Y] = av_expr_eval(s->y_pexpr, s->var_values, &s->prng);
>> -    s->x = s->var_values[VAR_X] = av_expr_eval(s->x_pexpr, s->var_values, &s->prng);
>>  
>>      update_alpha(s);
>>      update_color_with_alpha(s, &fontcolor  , s->fontcolor  );
>> diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
>> index 108a6fc..ea5889e 100644
>> --- a/libavfilter/vf_overlay.c
>> +++ b/libavfilter/vf_overlay.c
>> @@ -159,7 +159,6 @@ static void eval_expr(AVFilterContext *ctx)
>>  
>>      s->var_values[VAR_X] = av_expr_eval(s->x_pexpr, s->var_values, NULL);
>>      s->var_values[VAR_Y] = av_expr_eval(s->y_pexpr, s->var_values, NULL);
>> -    s->var_values[VAR_X] = av_expr_eval(s->x_pexpr, s->var_values, NULL);
>>      s->x = normalize_xy(s->var_values[VAR_X], s->hsub);
>>      s->y = normalize_xy(s->var_values[VAR_Y], s->vsub);
>>  }
>> -- 
>> 2.1.4
> 
> Isn't the point of this that you can have an expression for x which depends on y, or an expression for y which depends on x, working either way around?
> 
> - Mark

I didn't find any case about x depends on y or y depends y.

If have this dependency relationship , why the code don't handle out_w/out_h in 
crop?

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 


More information about the ffmpeg-devel mailing list