ffmpegcolorspace: support for direct conversion from uyvy422 to rgb formats

This commit is contained in:
Siarhei Siamashka 2009-07-06 23:06:50 +03:00 committed by Stefan Kost
parent 007da06645
commit 720a927f38
2 changed files with 45 additions and 2 deletions

View file

@ -2683,6 +2683,18 @@ static ConvertEntry convert_table[] = {
{PIX_FMT_UYVY422, PIX_FMT_YUV420P, uyvy422_to_yuv420p},
{PIX_FMT_UYVY422, PIX_FMT_YUV422P, uyvy422_to_yuv422p},
{PIX_FMT_UYVY422, PIX_FMT_GRAY8, uyvy422_to_gray},
{PIX_FMT_UYVY422, PIX_FMT_RGB555, uyvy422_to_rgb555},
{PIX_FMT_UYVY422, PIX_FMT_RGB565, uyvy422_to_rgb565},
{PIX_FMT_UYVY422, PIX_FMT_BGR24, uyvy422_to_bgr24},
{PIX_FMT_UYVY422, PIX_FMT_RGB24, uyvy422_to_rgb24},
{PIX_FMT_UYVY422, PIX_FMT_RGB32, uyvy422_to_rgb32},
{PIX_FMT_UYVY422, PIX_FMT_BGR32, uyvy422_to_bgr32},
{PIX_FMT_UYVY422, PIX_FMT_xRGB32, uyvy422_to_xrgb32},
{PIX_FMT_UYVY422, PIX_FMT_BGRx32, uyvy422_to_bgrx32},
{PIX_FMT_UYVY422, PIX_FMT_RGBA32, uyvy422_to_rgba32},
{PIX_FMT_UYVY422, PIX_FMT_BGRA32, uyvy422_to_bgra32},
{PIX_FMT_UYVY422, PIX_FMT_ARGB32, uyvy422_to_argb32},
{PIX_FMT_UYVY422, PIX_FMT_ABGR32, uyvy422_to_abgr32},
{PIX_FMT_YVYU422, PIX_FMT_YUV420P, yvyu422_to_yuv420p},
{PIX_FMT_YVYU422, PIX_FMT_YUV422P, yvyu422_to_yuv422p},

View file

@ -21,8 +21,39 @@
#define RGB_OUT(d, r, g, b) RGBA_OUT(d, r, g, b, 0xffU)
#endif
static void glue (yuv420p_to_, RGB_NAME) (AVPicture * dst,
const AVPicture * src, int width, int height)
static void glue (uyvy422_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[0], s1[2]);
YUV_TO_RGB2_CCIR(r, g, b, s1[1]);
RGB_OUT(d1, r, g, b);
d1 += BPP;
YUV_TO_RGB2_CCIR(r, g, b, s1[3]);
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)
{
const uint8_t *y1_ptr, *y2_ptr, *cb_ptr, *cr_ptr;
uint8_t *d, *d1, *d2;