]> git.sesse.net Git - ffmpeg/commitdiff
vf_interlace: better handling of odd video size
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 9 Jul 2013 15:57:49 +0000 (17:57 +0200)
committerMartin Storsjö <martin@martin.st>
Fri, 12 Jul 2013 08:40:56 +0000 (11:40 +0300)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavfilter/vf_interlace.c

index ff54896be0311df9ca4a94624526bff5b9e796bc..d65473967f21c1091abd000ad9812a162cf12a09 100755 (executable)
@@ -126,14 +126,14 @@ static void copy_picture_field(AVFrame *src_frame, AVFrame *dst_frame,
     int plane, i, j;
 
     for (plane = 0; plane < desc->nb_components; plane++) {
-        int lines = (plane == 1 || plane == 2) ? inlink->h >> vsub : inlink->h;
+        int lines = (plane == 1 || plane == 2) ? -(-inlink->h) >> vsub : inlink->h;
         int linesize = av_image_get_linesize(inlink->format, inlink->w, plane);
         uint8_t *dstp = dst_frame->data[plane];
         const uint8_t *srcp = src_frame->data[plane];
 
         av_assert0(linesize >= 0);
 
-        lines /= 2;
+        lines = (lines + (field_type == FIELD_UPPER)) / 2;
         if (field_type == FIELD_LOWER)
             srcp += src_frame->linesize[plane];
         if (field_type == FIELD_LOWER)