]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_fieldmatch.c
Merge commit 'f9fbd474676e903e12efe83203697d60a9d28cf9'
[ffmpeg] / libavfilter / vf_fieldmatch.c
index 7e277626f780edc7dab966202f749df1a77851ae..e155712caa0c2bdea669aa57cf210f8928b683af 100644 (file)
@@ -608,10 +608,13 @@ static void copy_fields(const FieldMatchContext *fm, AVFrame *dst,
                         const AVFrame *src, int field)
 {
     int plane;
-    for (plane = 0; plane < 4 && src->data[plane] && src->linesize[plane]; plane++)
+    for (plane = 0; plane < 4 && src->data[plane] && src->linesize[plane]; plane++) {
+        const int plane_h = get_height(fm, src, plane);
+        const int nb_copy_fields = (plane_h >> 1) + (field ? 0 : (plane_h & 1));
         av_image_copy_plane(dst->data[plane] + field*dst->linesize[plane], dst->linesize[plane] << 1,
                             src->data[plane] + field*src->linesize[plane], src->linesize[plane] << 1,
-                            get_width(fm, src, plane), get_height(fm, src, plane) / 2);
+                            get_width(fm, src, plane), nb_copy_fields);
+    }
 }
 
 static AVFrame *create_weave_frame(AVFilterContext *ctx, int match, int field,