[FFmpeg-cvslog] lavfi/fieldmatch: fix fields copy when plane height is odd

Clément Bœsch git at videolan.org
Sun Feb 7 15:52:05 CET 2016


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Sun Feb  7 15:49:20 2016 +0100| [6c0318c4ba8e749911324d96e7c04fcc04661c97] | committer: Clément Bœsch

lavfi/fieldmatch: fix fields copy when plane height is odd

Fixes Ticket 5187

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c0318c4ba8e749911324d96e7c04fcc04661c97
---

 libavfilter/vf_fieldmatch.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c
index 7e27762..e155712 100644
--- a/libavfilter/vf_fieldmatch.c
+++ b/libavfilter/vf_fieldmatch.c
@@ -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,



More information about the ffmpeg-cvslog mailing list