Browse code

avfilter/vf_maskedmerge: fix bug when copying >8bit plane(s)

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2017/04/24 01:31:05
Showing 2 changed files
... ...
@@ -27,6 +27,7 @@
27 27
 typedef struct MaskedMergeContext {
28 28
     const AVClass *class;
29 29
     int width[4], height[4];
30
+    int linesize[4];
30 31
     int nb_planes;
31 32
     int planes;
32 33
     int half, depth;
... ...
@@ -91,7 +91,7 @@ static int process_frame(FFFrameSync *fs)
91 91
         for (p = 0; p < s->nb_planes; p++) {
92 92
             if (!((1 << p) & s->planes)) {
93 93
                 av_image_copy_plane(out->data[p], out->linesize[p], base->data[p], base->linesize[p],
94
-                                    s->width[p], s->height[p]);
94
+                                    s->linesize[p], s->height[p]);
95 95
                 continue;
96 96
             }
97 97
 
... ...
@@ -229,6 +229,9 @@ static int config_output(AVFilterLink *outlink)
229 229
     outlink->sample_aspect_ratio = base->sample_aspect_ratio;
230 230
     outlink->frame_rate = base->frame_rate;
231 231
 
232
+    if ((ret = av_image_fill_linesizes(s->linesize, outlink->format, outlink->w)) < 0)
233
+        return ret;
234
+
232 235
     if ((ret = ff_framesync_init(&s->fs, ctx, 3)) < 0)
233 236
         return ret;
234 237