From cff70878b66a980037868d72ca0e0fb9e9b52397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 17 Jun 2010 17:07:39 +0200 Subject: [PATCH] ffmpegcolorspace: Add YUY2/YVYU to all RGB formats conversions --- gst/ffmpegcolorspace/imgconvert.c | 26 ++++++++- gst/ffmpegcolorspace/imgconvert_template.h | 62 ++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c index 9bf43b33cd..84e8ceb1bb 100644 --- a/gst/ffmpegcolorspace/imgconvert.c +++ b/gst/ffmpegcolorspace/imgconvert.c @@ -1019,7 +1019,6 @@ yvyu422_to_gray (AVPicture * dst, const AVPicture * src, int width, int height) } } - static void yvyu422_to_yuv420p (AVPicture * dst, const AVPicture * src, int width, int height) @@ -2777,6 +2776,19 @@ static ConvertEntry convert_table[] = { {PIX_FMT_YUV422, PIX_FMT_YUV420P, yuv422_to_yuv420p}, {PIX_FMT_YUV422, PIX_FMT_YUV422P, yuv422_to_yuv422p}, + {PIX_FMT_YUV422, PIX_FMT_GRAY8, yvyu422_to_gray}, + {PIX_FMT_YUV422, PIX_FMT_RGB555, yuv422_to_rgb555}, + {PIX_FMT_YUV422, PIX_FMT_RGB565, yuv422_to_rgb565}, + {PIX_FMT_YUV422, PIX_FMT_BGR24, yuv422_to_bgr24}, + {PIX_FMT_YUV422, PIX_FMT_RGB24, yuv422_to_rgb24}, + {PIX_FMT_YUV422, PIX_FMT_BGR32, yuv422_to_bgr32}, + {PIX_FMT_YUV422, PIX_FMT_RGB32, yuv422_to_rgb32}, + {PIX_FMT_YUV422, PIX_FMT_xRGB32, yuv422_to_xrgb32}, + {PIX_FMT_YUV422, PIX_FMT_BGRx32, yuv422_to_bgrx32}, + {PIX_FMT_YUV422, PIX_FMT_BGRA32, yuv422_to_bgra32}, + {PIX_FMT_YUV422, PIX_FMT_RGBA32, yuv422_to_rgba32}, + {PIX_FMT_YUV422, PIX_FMT_ABGR32, yuv422_to_abgr32}, + {PIX_FMT_YUV422, PIX_FMT_ARGB32, yuv422_to_argb32}, {PIX_FMT_UYVY422, PIX_FMT_YUV420P, uyvy422_to_yuv420p}, {PIX_FMT_UYVY422, PIX_FMT_YUV422P, uyvy422_to_yuv422p}, @@ -2797,6 +2809,18 @@ static ConvertEntry convert_table[] = { {PIX_FMT_YVYU422, PIX_FMT_YUV420P, yvyu422_to_yuv420p}, {PIX_FMT_YVYU422, PIX_FMT_YUV422P, yvyu422_to_yuv422p}, {PIX_FMT_YVYU422, PIX_FMT_GRAY8, yvyu422_to_gray}, + {PIX_FMT_YVYU422, PIX_FMT_RGB555, yvyu422_to_rgb555}, + {PIX_FMT_YVYU422, PIX_FMT_RGB565, yvyu422_to_rgb565}, + {PIX_FMT_YVYU422, PIX_FMT_BGR24, yvyu422_to_bgr24}, + {PIX_FMT_YVYU422, PIX_FMT_RGB24, yvyu422_to_rgb24}, + {PIX_FMT_YVYU422, PIX_FMT_BGR32, yvyu422_to_bgr32}, + {PIX_FMT_YVYU422, PIX_FMT_RGB32, yvyu422_to_rgb32}, + {PIX_FMT_YVYU422, PIX_FMT_xRGB32, yvyu422_to_xrgb32}, + {PIX_FMT_YVYU422, PIX_FMT_BGRx32, yvyu422_to_bgrx32}, + {PIX_FMT_YVYU422, PIX_FMT_BGRA32, yvyu422_to_bgra32}, + {PIX_FMT_YVYU422, PIX_FMT_RGBA32, yvyu422_to_rgba32}, + {PIX_FMT_YVYU422, PIX_FMT_ABGR32, yvyu422_to_abgr32}, + {PIX_FMT_YVYU422, PIX_FMT_ARGB32, yvyu422_to_argb32}, {PIX_FMT_RGB24, PIX_FMT_YUV420P, rgb24_to_yuv420p}, {PIX_FMT_RGB24, PIX_FMT_NV12, rgb24_to_nv12}, diff --git a/gst/ffmpegcolorspace/imgconvert_template.h b/gst/ffmpegcolorspace/imgconvert_template.h index 14f4ca1c54..4928601087 100644 --- a/gst/ffmpegcolorspace/imgconvert_template.h +++ b/gst/ffmpegcolorspace/imgconvert_template.h @@ -52,6 +52,68 @@ static void glue (uyvy422_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, } } +static void glue (yuv422_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + uint8_t *s, *d, *d1, *s1; + int w, y, cb, cr, r_add, g_add, b_add; + uint8_t *cm = cropTbl + MAX_NEG_CROP; + unsigned int r, g, b; + + d = dst->data[0]; + s = src->data[0]; + for(;height > 0; height --) { + d1 = d; + s1 = s; + for(w = width; w >= 2; w -= 2) { + YUV_TO_RGB1_CCIR(s1[1], s1[3]); + + YUV_TO_RGB2_CCIR(r, g, b, s1[0]); + RGB_OUT(d1, r, g, b); + d1 += BPP; + + YUV_TO_RGB2_CCIR(r, g, b, s1[1]); + RGB_OUT(d1, r, g, b); + d1 += BPP; + + s1 += 4; + } + d += dst->linesize[0]; + s += src->linesize[0]; + } +} + +static void glue (yvyu422_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, + int width, int height) +{ + uint8_t *s, *d, *d1, *s1; + int w, y, cb, cr, r_add, g_add, b_add; + uint8_t *cm = cropTbl + MAX_NEG_CROP; + unsigned int r, g, b; + + d = dst->data[0]; + s = src->data[0]; + for(;height > 0; height --) { + d1 = d; + s1 = s; + for(w = width; w >= 2; w -= 2) { + YUV_TO_RGB1_CCIR(s1[3], s1[1]); + + YUV_TO_RGB2_CCIR(r, g, b, s1[0]); + RGB_OUT(d1, r, g, b); + d1 += BPP; + + YUV_TO_RGB2_CCIR(r, g, b, s1[1]); + RGB_OUT(d1, r, g, b); + d1 += BPP; + + s1 += 4; + } + d += dst->linesize[0]; + s += src->linesize[0]; + } +} + static void glue (yuv420p_to_, RGB_NAME)(AVPicture *dst, const AVPicture *src, int width, int height) {