From 9d6eb19453e54cb1783cb642663f8e7e59f2885c Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 23 Sep 2009 11:03:57 +0200 Subject: [PATCH] [ffmpegcolorspace] Fix NV12 and NV21 with odd width and height --- gst/ffmpegcolorspace/imgconvert_template.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gst/ffmpegcolorspace/imgconvert_template.h b/gst/ffmpegcolorspace/imgconvert_template.h index 3e6a18b42b..4076625efd 100644 --- a/gst/ffmpegcolorspace/imgconvert_template.h +++ b/gst/ffmpegcolorspace/imgconvert_template.h @@ -590,13 +590,12 @@ static void glue (RGB_NAME, _to_nv12) (AVPicture * dst, const AVPicture * src, lum[0] = RGB_TO_Y_CCIR (r, g, b); c[0] = RGB_TO_U_CCIR (r1, g1, b1, 1); c[1] = RGB_TO_V_CCIR (r1, g1, b1, 1); - c += 2; p += -wrap3 + BPP; lum += -wrap + 1; } p += wrap3 + (wrap3 - width * BPP); lum += wrap + (wrap - width); - c += dst->linesize[1] - width; + c += dst->linesize[1] - (width & ~1); } /* handle odd height */ if (height) { @@ -694,13 +693,12 @@ static void glue (RGB_NAME, _to_nv21) (AVPicture * dst, const AVPicture * src, lum[0] = RGB_TO_Y_CCIR (r, g, b); c[1] = RGB_TO_U_CCIR (r1, g1, b1, 1); c[0] = RGB_TO_V_CCIR (r1, g1, b1, 1); - c += 2; p += -wrap3 + BPP; lum += -wrap + 1; } p += wrap3 + (wrap3 - width * BPP); lum += wrap + (wrap - width); - c += dst->linesize[1] - width; + c += dst->linesize[1] - (width & ~1); } /* handle odd height */ if (height) {