From 0a90994b990fc80b5ee187924942cf717ad28746 Mon Sep 17 00:00:00 2001 From: Chen Jie Date: Fri, 17 May 2013 20:17:31 +0800 Subject: [PATCH] androidmedia: fix a minor error in COLOR_FormatYUV420Planar converting https://bugzilla.gnome.org/show_bug.cgi?id=700521 --- sys/androidmedia/gstamcvideodec.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/androidmedia/gstamcvideodec.c b/sys/androidmedia/gstamcvideodec.c index 250f951..cffc179 100644 --- a/sys/androidmedia/gstamcvideodec.c +++ b/sys/androidmedia/gstamcvideodec.c @@ -841,13 +841,20 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx, src += self->crop_left; row_length = self->width; } else if (i > 0) { + /* skip the Y plane */ src += slice_height * stride; - src += self->crop_top * src_stride; + + /* crop_top/crop_left divided by two + * because one byte of the U/V planes + * corresponds to two pixels horizontally/vertically */ + src += self->crop_top / 2 * src_stride; src += self->crop_left / 2; row_length = (self->width + 1) / 2; } - if (i == 2) + if (i == 2) { + /* skip the U plane */ src += ((slice_height + 1) / 2) * ((stride + 1) / 2); + } dest = GST_VIDEO_FRAME_COMP_DATA (&vframe, i); height = GST_VIDEO_FRAME_COMP_HEIGHT (&vframe, i); -- 2.7.4