From: Fabrizio Gennari Date: Thu, 23 Mar 2006 09:38:59 +0000 (+0000) Subject: gst/: Patch for support of YVU9 AVI files (#334822) X-Git-Tag: RELEASE-0_10_6~72 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f9a8224f4a4306cc048d9326b3401824c312777;p=platform%2Fupstream%2Fgst-plugins-base.git gst/: Patch for support of YVU9 AVI files (#334822) Original commit message from CVS: Patch by: Fabrizio Gennari * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps), (gst_riff_create_video_template_caps): * gst/ffmpegcolorspace/avcodec.h: * gst/ffmpegcolorspace/gstffmpegcodecmap.c: (gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_pixfmt), (gst_ffmpegcsp_avpicture_fill): * gst/ffmpegcolorspace/imgconvert.c: Patch for support of YVU9 AVI files (#334822) --- diff --git a/ChangeLog b/ChangeLog index 83a44f0..1335bc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-03-23 Wim Taymans + + Patch by: Fabrizio Gennari + + * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps), + (gst_riff_create_video_template_caps): + * gst/ffmpegcolorspace/avcodec.h: + * gst/ffmpegcolorspace/gstffmpegcodecmap.c: + (gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_to_pixfmt), + (gst_ffmpegcsp_avpicture_fill): + * gst/ffmpegcolorspace/imgconvert.c: + Patch for support of YVU9 AVI files (#334822) + 2006-03-22 Edward Hervey * docs/design/design-decodebin.txt: diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c index f9bf20c..a6f9336 100644 --- a/gst-libs/gst/riff/riff-media.c +++ b/gst-libs/gst/riff/riff-media.c @@ -99,6 +99,13 @@ gst_riff_create_video_caps (guint32 codec_fcc, *codec_name = g_strdup ("Uncompressed packed YUV 4:2:2"); break; + case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'): + caps = gst_caps_new_simple ("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, codec_fcc, NULL); + if (codec_name) + *codec_name = g_strdup ("Uncompressed packed YVU 4:1:0"); + break; + case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */ case GST_MAKE_FOURCC ('A', 'V', 'R', 'n'): case GST_MAKE_FOURCC ('I', 'J', 'P', 'G'): @@ -1005,6 +1012,7 @@ gst_riff_create_video_template_caps (void) guint32 tags[] = { GST_MAKE_FOURCC ('I', '4', '2', '0'), GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), + GST_MAKE_FOURCC ('Y', 'V', 'U', '9'), GST_MAKE_FOURCC ('M', 'J', 'P', 'G'), GST_MAKE_FOURCC ('D', 'V', 'S', 'D'), GST_MAKE_FOURCC ('W', 'M', 'V', '1'), diff --git a/gst/ffmpegcolorspace/avcodec.h b/gst/ffmpegcolorspace/avcodec.h index 37c8d79..e1b2cdf 100644 --- a/gst/ffmpegcolorspace/avcodec.h +++ b/gst/ffmpegcolorspace/avcodec.h @@ -64,6 +64,7 @@ enum PixelFormat { PIX_FMT_RGB32, ///< Packed pixel, 4 bytes per pixel, BGRXBGRX..., stored in cpu endianness PIX_FMT_BGR32, ///< Packed pixel, 4 bytes per pixel, XRGBXRGB... PIX_FMT_YUV410P, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YVU410P, ///< Planar YVU 4:1:0 (1 Cr & Cb sample per 4x4 Y samples) PIX_FMT_YUV411P, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples) PIX_FMT_RGB565, ///< always stored in cpu endianness PIX_FMT_RGB555, ///< always stored in cpu endianness, most significant bit to 1 diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c index d74af5a..8436f8b 100644 --- a/gst/ffmpegcolorspace/gstffmpegcodecmap.c +++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.c @@ -260,6 +260,9 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context) case PIX_FMT_YUV410P: fmt = GST_MAKE_FOURCC ('Y', 'U', 'V', '9'); break; + case PIX_FMT_YVU410P: + fmt = GST_MAKE_FOURCC ('Y', 'V', 'U', '9'); + break; case PIX_FMT_YUV411P: fmt = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); break; @@ -537,6 +540,9 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'): context->pix_fmt = PIX_FMT_YUV410P; break; + case GST_MAKE_FOURCC ('Y', 'V', 'U', '9'): + context->pix_fmt = PIX_FMT_YVU410P; + break; case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'): context->pix_fmt = PIX_FMT_AYUV4444; break; @@ -695,19 +701,21 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, return size + 2 * size2; /* PIX_FMT_YVU420P = YV12: same as PIX_FMT_YUV420P, but * with U and V plane swapped. Strides as in videotestsrc */ + case PIX_FMT_YVU410P: case PIX_FMT_YVU420P: stride = GST_ROUND_UP_4 (width); - h2 = GST_ROUND_UP_2 (height); + h2 = ROUND_UP_X (height, pinfo->y_chroma_shift); size = stride * h2; - stride2 = GST_ROUND_UP_8 (stride) / 2; - h2 = GST_ROUND_UP_2 (height) / 2; + w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift); + stride2 = GST_ROUND_UP_4 (w2); + h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift); size2 = stride2 * h2; picture->data[0] = ptr; picture->data[2] = picture->data[0] + size; picture->data[1] = picture->data[2] + size2; picture->linesize[0] = stride; - picture->linesize[1] = GST_ROUND_UP_8 (stride) / 2; - picture->linesize[2] = GST_ROUND_UP_8 (stride) / 2; + picture->linesize[1] = stride2; + picture->linesize[2] = stride2; return size + 2 * size2; case PIX_FMT_RGB24: case PIX_FMT_BGR24: diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c index 6d90433..4fb4efb 100644 --- a/gst/ffmpegcolorspace/imgconvert.c +++ b/gst/ffmpegcolorspace/imgconvert.c @@ -119,6 +119,17 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { /* .y_chroma_shift = */ 2, /* .depth = */ 8, }, + /* [PIX_FMT_YVU410P] = */ { + /* .format = */ PIX_FMT_YVU410P, + /* .name = */ "yvu410p", + /* .nb_channels = */ 3, + /* .color_type = */ FF_COLOR_YUV, + /* .pixel_type = */ FF_PIXEL_PLANAR, + /* .is_alpha = */ 0, + /* .x_chroma_shift = */ 2, + /* .y_chroma_shift = */ 2, + /* .depth = */ 8, + }, /* [PIX_FMT_YUV411P] = */ { /* .format = */ PIX_FMT_YUV411P, /* .name = */ "yuv411p",