[FFmpeg-devel] [PATCH]: libswscale: update just added rgb444 support for meanwhile introduced foreign endianess handling

Janusz Krzysztofik jkrzyszt
Fri Mar 5 17:10:20 CET 2010


While working on further extending rgb444 support just added to swscaler, I 
found that in the meantine foreing endianes support was added to rgb5[56]5 
output format handling. I think it could also apply to rgb444, that's why this 
patch.

Created and tested against libswscale svn revision 30842.

Signed-off-by: Janusz Krzysztofik <jkrzyszt at tis.icnet.pl>
---
--- trunk/libswscale/swscale_internal.h.orig	2010-03-05 14:13:14.000000000 +0100
+++ trunk/libswscale/swscale_internal.h	2010-03-05 15:31:18.000000000 +0100
@@ -395,7 +395,8 @@ const char *sws_format_name(enum PixelFo
         || (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 PixelFo
         || (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   \
--- trunk/libswscale/yuv2rgb.c.orig	2010-03-05 14:13:13.000000000 +0100
+++ trunk/libswscale/yuv2rgb.c	2010-03-05 15:35:17.000000000 +0100
@@ -630,15 +630,18 @@ av_cold int ff_yuv2rgb_c_init_tables(Sws
                         || 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(Sws
             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);



More information about the ffmpeg-devel mailing list