diff options
author | 2010-03-04 16:57:04 +0000 | |
---|---|---|
committer | 2010-03-04 16:57:04 +0000 | |
commit | 487b94aa88f26bef0b520de127d2eb354ae96f48 (patch) | |
tree | 030750d2098c77b464725f894df1a424b0fc63ea /libswscale/yuv2rgb.c | |
parent | ceb90b2c199b1fe6bea1e9dc20834718d3c53b18 (diff) |
Support BGR555, BGR565, RGB555 and RGB565 foreign endian output in
libswscale.
Patch by Alexis Ballier, alexis D ballier A gmail
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30840 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libswscale/yuv2rgb.c')
-rw-r--r-- | libswscale/yuv2rgb.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 2a05477bda..babc8c311e 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -33,6 +33,7 @@ #include "swscale.h" #include "swscale_internal.h" #include "libavutil/x86_cpu.h" +#include "libavutil/bswap.h" extern const uint8_t dither_8x8_32[8][8]; extern const uint8_t dither_8x8_73[8][8]; @@ -596,12 +597,18 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int const int isRgb = c->dstFormat==PIX_FMT_RGB32 || c->dstFormat==PIX_FMT_RGB32_1 || c->dstFormat==PIX_FMT_BGR24 - || c->dstFormat==PIX_FMT_RGB565 - || c->dstFormat==PIX_FMT_RGB555 + || c->dstFormat==PIX_FMT_RGB565BE + || c->dstFormat==PIX_FMT_RGB565LE + || c->dstFormat==PIX_FMT_RGB555BE + || c->dstFormat==PIX_FMT_RGB555LE || 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(BGR565LE,BGR565BE) + || c->dstFormat==PIX_FMT_NE(BGR555LE,BGR555BE); const int bpp = c->dstFormatBpp; uint8_t *y_table; uint16_t *y_table16; @@ -709,6 +716,9 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int y_table16[i+2048] = (yval >> 3) << 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); |