diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2005-02-12 22:29:00 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2005-02-12 22:29:00 +0000 |
commit | c89562b61a13c95036bd661a988e4c6b9b2cfbdb (patch) | |
tree | ca0bcbbe1e53b90f905135d2efb647eb0f198615 | |
parent | 4aa7bf75d6261c41dbdbbd2bae13f9098bf46183 (diff) | |
download | gstreamer-plugins-base-c89562b61a13c95036bd661a988e4c6b9b2cfbdb.tar.gz |
Convert to and from YV12 (fixes #156379)
Original commit message from CVS:
Convert to and from YV12 (fixes #156379)
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gst/ffmpegcolorspace/avcodec.h | 3 | ||||
-rw-r--r-- | gst/ffmpegcolorspace/gstffmpegcodecmap.c | 22 | ||||
-rw-r--r-- | gst/ffmpegcolorspace/imgconvert.c | 11 |
4 files changed, 44 insertions, 1 deletions
@@ -1,3 +1,12 @@ +2005-02-12 Tim-Philipp Müller <tim at centricular dot net> + + * 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: + Convert to and from YV12 (fixes #156379). + 2005-02-12 Julien MOUTTE <julien@moutte.net> * sys/ximage/ximagesink.c: (gst_ximagesink_xwindow_new), diff --git a/gst/ffmpegcolorspace/avcodec.h b/gst/ffmpegcolorspace/avcodec.h index b6f94d753..f9a39f9ac 100644 --- a/gst/ffmpegcolorspace/avcodec.h +++ b/gst/ffmpegcolorspace/avcodec.h @@ -52,7 +52,8 @@ enum CodecType { * to run on the IBM VGA graphics adapter use 6-bit palette components. */ enum PixelFormat { - PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUV420P, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) (I420) + PIX_FMT_YVU420P, ///< Planar YUV 4:2:0 (1 Cb & Cr sample per 2x2 Y samples) (YV12) PIX_FMT_YUV422, ///< Packed pixel, Y0 Cb Y1 Cr PIX_FMT_RGB24, ///< Packed pixel, 3 bytes per pixel, RGBRGB... PIX_FMT_BGR24, ///< Packed pixel, 3 bytes per pixel, BGRBGR... diff --git a/gst/ffmpegcolorspace/gstffmpegcodecmap.c b/gst/ffmpegcolorspace/gstffmpegcodecmap.c index 0b2fbed2a..e0b91f66b 100644 --- a/gst/ffmpegcolorspace/gstffmpegcodecmap.c +++ b/gst/ffmpegcolorspace/gstffmpegcodecmap.c @@ -124,6 +124,9 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context) case PIX_FMT_YUV420P: fmt = GST_MAKE_FOURCC ('I', '4', '2', '0'); break; + case PIX_FMT_YVU420P: + fmt = GST_MAKE_FOURCC ('Y', 'V', '1', '2'); + break; case PIX_FMT_YUV422: fmt = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); break; @@ -461,6 +464,9 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, case GST_MAKE_FOURCC ('I', '4', '2', '0'): context->pix_fmt = PIX_FMT_YUV420P; break; + case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): + context->pix_fmt = PIX_FMT_YVU420P; + break; case GST_MAKE_FOURCC ('Y', '4', '1', 'B'): context->pix_fmt = PIX_FMT_YUV411P; break; @@ -622,6 +628,22 @@ gst_ffmpegcsp_avpicture_fill (AVPicture * picture, picture->linesize[1] = stride2; picture->linesize[2] = stride2; 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_YVU420P: + stride = ROUND_UP_4 (width); + h2 = ROUND_UP_2 (height); + size = stride * h2; + stride2 = ROUND_UP_8 (stride) / 2; + h2 = ROUND_UP_2 (height) / 2; + 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] = ROUND_UP_8 (stride) / 2; + picture->linesize[2] = ROUND_UP_8 (stride) / 2; + return size + 2 * size2; case PIX_FMT_RGB24: case PIX_FMT_BGR24: stride = ROUND_UP_4 (width * 3); diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c index 0dea17f70..64e7a1184 100644 --- a/gst/ffmpegcolorspace/imgconvert.c +++ b/gst/ffmpegcolorspace/imgconvert.c @@ -53,6 +53,17 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { /* .y_chroma_shift = */ 1, /* .depth = */ 8, }, + /* [PIX_FMT_YVU420P] = */ { + /* .format = */ PIX_FMT_YVU420P, + /* .name = */ "yvu420p", + /* .nb_channels = */ 3, + /* .color_type = */ FF_COLOR_YUV, + /* .pixel_type = */ FF_PIXEL_PLANAR, + /* .is_alpha = */ 0, + /* .x_chroma_shift = */ 1, + /* .y_chroma_shift = */ 1, + /* .depth = */ 8, + }, /* [PIX_FMT_YUV422P] = */ { /* .format = */ PIX_FMT_YUV422P, /* .name = */ "yuv422p", |