[FFmpeg-devel] [PATCH] lavfi/scale: allocate interleaved scalers only if needed.

Nicolas George nicolas.george at normalesup.org
Wed Jul 17 20:03:44 CEST 2013


Fix "42x0 -> 42x0 is invalid scaling dimension" failure
when source or destination height is 1.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavfilter/vf_scale.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 056f540..5ecfb0c 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -266,6 +266,10 @@ static int config_props(AVFilterLink *outlink)
         scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format,
                                     outlink->w, outlink->h, outfmt,
                                     scale->flags, NULL, NULL, NULL);
+        if (!scale->sws)
+            return AVERROR(EINVAL);
+        if (scale->interlaced) {
+            /* TODO reindent */
         if (scale->isws[0])
             sws_freeContext(scale->isws[0]);
         scale->isws[0] = sws_getContext(inlink ->w, inlink ->h/2, inlink ->format,
@@ -276,8 +280,9 @@ static int config_props(AVFilterLink *outlink)
         scale->isws[1] = sws_getContext(inlink ->w, inlink ->h/2, inlink ->format,
                                         outlink->w, outlink->h/2, outfmt,
                                         scale->flags, NULL, NULL, NULL);
-        if (!scale->sws || !scale->isws[0] || !scale->isws[1])
+        if (!scale->isws[0] || !scale->isws[1])
             return AVERROR(EINVAL);
+        }
     }
 
     if (inlink->sample_aspect_ratio.num){
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list