diff mbox

[FFmpeg-devel] avfilter/crop: avoid premature eval error

Message ID 93818cad-46f2-f5ee-9b0b-ae40c2986d16@gyani.pro
State Accepted
Commit b66a800877d6f97fa94b41533e3d6a6273f7fb9f
Headers show

Commit Message

Gyan Doshi Dec. 4, 2019, 10:39 a.m. UTC
Valid width expressions were being rejected.

Regards,
Gyan
From be3aacc114a0b2b6c8ec9e8b73be38f414ecbb3d Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg@gyani.pro>
Date: Wed, 4 Dec 2019 16:03:11 +0530
Subject: [PATCH] avfilter/crop: avoid premature eval error

Width and height expressions can refer to each other. Width is
evaluated twice to allow for reference to output height. So we
should not error out upon failure of first evaluation of width.
---
 libavfilter/vf_crop.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Gyan Doshi Dec. 5, 2019, 6:01 p.m. UTC | #1
On 04-12-2019 04:09 pm, Gyan wrote:
> Valid width expressions were being rejected.

Plan to push in the morning.

Gyan
Gyan Doshi Dec. 6, 2019, 4:51 a.m. UTC | #2
On 05-12-2019 11:31 pm, Gyan wrote:
>
>
> On 04-12-2019 04:09 pm, Gyan wrote:
>> Valid width expressions were being rejected.
>
> Plan to push in the morning.

Pushed as b66a800877d6f97fa94b41533e3d6a6273f7fb9f

Gyan
diff mbox

Patch

diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index d6b4feb513..9bf4077c5d 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -174,10 +174,9 @@  static int config_input(AVFilterLink *link)
         s->vsub = pix_desc->log2_chroma_h;
     }
 
-    if ((ret = av_expr_parse_and_eval(&res, (expr = s->w_expr),
-                                      var_names, s->var_values,
-                                      NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0)
-        goto fail_expr;
+    av_expr_parse_and_eval(&res, (expr = s->w_expr),
+                           var_names, s->var_values,
+                           NULL, NULL, NULL, NULL, NULL, 0, ctx);
     s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = res;
     if ((ret = av_expr_parse_and_eval(&res, (expr = s->h_expr),
                                       var_names, s->var_values,