[FFmpeg-cvslog] swscale: add rgb565 endianess conversion

Janne Grunau git at videolan.org
Sun Dec 18 03:12:21 CET 2011


ffmpeg | branch: master | Janne Grunau <janne-libav at jannau.net> | Fri Dec 16 19:38:53 2011 +0100| [ed46a3d8423b8697773bdd9f22125bc19c9f72b1] | committer: Janne Grunau

swscale: add rgb565 endianess conversion

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed46a3d8423b8697773bdd9f22125bc19c9f72b1
---

 libswscale/swscale_unscaled.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index ec8f1bb..b42854a 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -718,15 +718,6 @@ void ff_get_unscaled_swscale(SwsContext *c)
     if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
         c->swScale= bgr24ToYv12Wrapper;
 
-    /* bswap 16 bits per component packed formats */
-    if ((srcFormat == PIX_FMT_RGB48LE  && dstFormat == PIX_FMT_RGB48BE)  ||
-        (srcFormat == PIX_FMT_RGB48BE  && dstFormat == PIX_FMT_RGB48LE)  ||
-        (srcFormat == PIX_FMT_BGR48LE  && dstFormat == PIX_FMT_BGR48BE)  ||
-        (srcFormat == PIX_FMT_BGR48BE  && dstFormat == PIX_FMT_BGR48LE)  ||
-        (srcFormat == PIX_FMT_GRAY16LE && dstFormat == PIX_FMT_GRAY16BE) ||
-        (srcFormat == PIX_FMT_GRAY16BE && dstFormat == PIX_FMT_GRAY16LE))
-        c->swScale = packed_16bpc_bswap;
-
     /* RGB/BGR -> RGB/BGR (no dither needed forms) */
     if (   isAnyRGB(srcFormat)
         && isAnyRGB(dstFormat)
@@ -745,6 +736,19 @@ void ff_get_unscaled_swscale(SwsContext *c)
         && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
         c->swScale= rgbToRgbWrapper;
 
+    /* bswap 16 bits per pixel/component packed formats */
+    if ((srcFormat == PIX_FMT_RGB48LE  && dstFormat == PIX_FMT_RGB48BE)  ||
+        (srcFormat == PIX_FMT_RGB48BE  && dstFormat == PIX_FMT_RGB48LE)  ||
+        (srcFormat == PIX_FMT_BGR48LE  && dstFormat == PIX_FMT_BGR48BE)  ||
+        (srcFormat == PIX_FMT_BGR48BE  && dstFormat == PIX_FMT_BGR48LE)  ||
+        (srcFormat == PIX_FMT_GRAY16LE && dstFormat == PIX_FMT_GRAY16BE) ||
+        (srcFormat == PIX_FMT_GRAY16BE && dstFormat == PIX_FMT_GRAY16LE) ||
+        (srcFormat == PIX_FMT_RGB565LE && dstFormat == PIX_FMT_RGB565BE) ||
+        (srcFormat == PIX_FMT_RGB565BE && dstFormat == PIX_FMT_RGB565LE) ||
+        (srcFormat == PIX_FMT_BGR565BE && dstFormat == PIX_FMT_BGR565LE) ||
+        (srcFormat == PIX_FMT_BGR565LE && dstFormat == PIX_FMT_BGR565BE))
+        c->swScale = packed_16bpc_bswap;
+
     if ((usePal(srcFormat) && (
         dstFormat == PIX_FMT_RGB32   ||
         dstFormat == PIX_FMT_RGB32_1 ||



More information about the ffmpeg-cvslog mailing list