From 387aa470840ec54fbe0376ef701dca2dac16a0e6 Mon Sep 17 00:00:00 2001 From: stefano Date: Sat, 6 Mar 2010 11:27:31 +0000 Subject: Add support to BGR444/RGB444 foreign endian output in libswscale. Patch by Janusz Krzysztofik |jkrzyszt ^ tis icnet pl|. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30855 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_internal.h | 6 ++++-- libswscale/yuv2rgb.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 856b61c484..aebe30e1cf 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -395,7 +395,8 @@ const char *sws_format_name(enum PixelFormat format); || (x)==PIX_FMT_RGB565LE \ || (x)==PIX_FMT_RGB555BE \ || (x)==PIX_FMT_RGB555LE \ - || (x)==PIX_FMT_RGB444 \ + || (x)==PIX_FMT_RGB444BE \ + || (x)==PIX_FMT_RGB444LE \ || (x)==PIX_FMT_RGB8 \ || (x)==PIX_FMT_RGB4 \ || (x)==PIX_FMT_RGB4_BYTE \ @@ -410,7 +411,8 @@ const char *sws_format_name(enum PixelFormat format); || (x)==PIX_FMT_BGR565LE \ || (x)==PIX_FMT_BGR555BE \ || (x)==PIX_FMT_BGR555LE \ - || (x)==PIX_FMT_BGR444 \ + || (x)==PIX_FMT_BGR444BE \ + || (x)==PIX_FMT_BGR444LE \ || (x)==PIX_FMT_BGR8 \ || (x)==PIX_FMT_BGR4 \ || (x)==PIX_FMT_BGR4_BYTE \ diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index c7afb18deb..6883f774e2 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -630,15 +630,18 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int || c->dstFormat==PIX_FMT_RGB565LE || c->dstFormat==PIX_FMT_RGB555BE || c->dstFormat==PIX_FMT_RGB555LE - || c->dstFormat==PIX_FMT_RGB444 + || c->dstFormat==PIX_FMT_RGB444BE + || c->dstFormat==PIX_FMT_RGB444LE || c->dstFormat==PIX_FMT_RGB8 || c->dstFormat==PIX_FMT_RGB4 || c->dstFormat==PIX_FMT_RGB4_BYTE || c->dstFormat==PIX_FMT_MONOBLACK; const int isNotNe = c->dstFormat==PIX_FMT_NE(RGB565LE,RGB565BE) || c->dstFormat==PIX_FMT_NE(RGB555LE,RGB555BE) + || c->dstFormat==PIX_FMT_NE(RGB444LE,RGB444BE) || c->dstFormat==PIX_FMT_NE(BGR565LE,BGR565BE) - || c->dstFormat==PIX_FMT_NE(BGR555LE,BGR555BE); + || c->dstFormat==PIX_FMT_NE(BGR555LE,BGR555BE) + || c->dstFormat==PIX_FMT_NE(BGR444LE,BGR444BE); const int bpp = c->dstFormatBpp; uint8_t *y_table; uint16_t *y_table16; @@ -745,6 +748,9 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int y_table16[i+2048] = (yval >> 4) << bbase; yb += cy; } + if (isNotNe) + for (i = 0; i < 1024*3; i++) + y_table16[i] = bswap_16(y_table16[i]); fill_table(c->table_rV, 2, crv, y_table16 + yoffs); fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024); fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048); -- cgit v1.2.3