[FFmpeg-cvslog] lavfi/super2xsai: fix fate test on bigendian

Paul B Mahol git at videolan.org
Sat Jun 16 16:34:26 CEST 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Jun 16 09:35:05 2012 +0000| [fd8def92488921d475a7ceff341eaf4cfb009f9b] | committer: Paul B Mahol

lavfi/super2xsai: fix fate test on bigendian

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavfilter/vf_super2xsai.c        |   29 +++++++++++++++++++++--------
 tests/ref/lavfi/pixfmts_super2xsai |    4 ++++
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/libavfilter/vf_super2xsai.c b/libavfilter/vf_super2xsai.c
index e342078..1b0b6a0 100644
--- a/libavfilter/vf_super2xsai.c
+++ b/libavfilter/vf_super2xsai.c
@@ -40,6 +40,7 @@ typedef struct {
     uint32_t q_lo_pixel_mask;
 
     int bpp; ///< bytes per pixel, pixel stride for each (packed) pixel
+    int is_be;
 } Super2xSaIContext;
 
 #define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B != D))
@@ -72,7 +73,7 @@ static void super2xsai(AVFilterContext *ctx,
 
 #define READ_COLOR4(dst, src_line, off) dst = *((const uint32_t *)src_line + off)
 #define READ_COLOR3(dst, src_line, off) dst = AV_RL24 (src_line + 3*off)
-#define READ_COLOR2(dst, src_line, off) dst = *((const uint16_t *)src_line + off)
+#define READ_COLOR2(dst, src_line, off) dst = sai->is_be ? AV_RB16(src_line + 2 * off) : AV_RL16(src_line + 2 * off)
 
     for (y = 0; y < height; y++) {
         uint8_t *dst_line[2];
@@ -175,8 +176,13 @@ static void super2xsai(AVFilterContext *ctx,
                 AV_WL24(dst_line[1] + x * 6 + 3, product2b);
                 break;
             default: // bpp = 2
-                AV_WN32A(dst_line[0] + x * 4, product1a | (product1b << 16));
-                AV_WN32A(dst_line[1] + x * 4, product2a | (product2b << 16));
+                if (sai->is_be) {
+                    AV_WB32(dst_line[0] + x * 4, product1a | (product1b << 16));
+                    AV_WB32(dst_line[1] + x * 4, product2a | (product2b << 16));
+                } else {
+                    AV_WL32(dst_line[0] + x * 4, product1a | (product1b << 16));
+                    AV_WL32(dst_line[1] + x * 4, product2a | (product2b << 16));
+                }
             }
 
             /* Move color matrix forward */
@@ -227,7 +233,8 @@ static int query_formats(AVFilterContext *ctx)
     static const enum PixelFormat pix_fmts[] = {
         PIX_FMT_RGBA, PIX_FMT_BGRA, PIX_FMT_ARGB, PIX_FMT_ABGR,
         PIX_FMT_RGB24, PIX_FMT_BGR24,
-        PIX_FMT_RGB565, PIX_FMT_BGR565, PIX_FMT_RGB555, PIX_FMT_BGR555,
+        PIX_FMT_RGB565BE, PIX_FMT_BGR565BE, PIX_FMT_RGB555BE, PIX_FMT_BGR555BE,
+        PIX_FMT_RGB565LE, PIX_FMT_BGR565LE, PIX_FMT_RGB555LE, PIX_FMT_BGR555LE,
         PIX_FMT_NONE
     };
 
@@ -251,8 +258,11 @@ static int config_input(AVFilterLink *inlink)
         sai->bpp = 3;
         break;
 
-    case PIX_FMT_RGB565:
-    case PIX_FMT_BGR565:
+    case PIX_FMT_RGB565BE:
+    case PIX_FMT_BGR565BE:
+        sai->is_be = 1;
+    case PIX_FMT_RGB565LE:
+    case PIX_FMT_BGR565LE:
         sai->hi_pixel_mask   = 0xF7DEF7DE;
         sai->lo_pixel_mask   = 0x08210821;
         sai->q_hi_pixel_mask = 0xE79CE79C;
@@ -260,8 +270,11 @@ static int config_input(AVFilterLink *inlink)
         sai->bpp = 2;
         break;
 
-    case PIX_FMT_BGR555:
-    case PIX_FMT_RGB555:
+    case PIX_FMT_BGR555BE:
+    case PIX_FMT_RGB555BE:
+        sai->is_be = 1;
+    case PIX_FMT_BGR555LE:
+    case PIX_FMT_RGB555LE:
         sai->hi_pixel_mask   = 0x7BDE7BDE;
         sai->lo_pixel_mask   = 0x04210421;
         sai->q_hi_pixel_mask = 0x739C739C;
diff --git a/tests/ref/lavfi/pixfmts_super2xsai b/tests/ref/lavfi/pixfmts_super2xsai
index 0009d0d..8e5e2d0 100644
--- a/tests/ref/lavfi/pixfmts_super2xsai
+++ b/tests/ref/lavfi/pixfmts_super2xsai
@@ -1,10 +1,14 @@
 abgr                7df21399eedd7094a5c345035c220ebe
 argb                6de1f5a66d6517951243bb2a751180d2
 bgr24               6ff4af0eb9ab72eb723ed12469d559bc
+bgr555be            6a0979a52f5f48de2269eb0c123446c9
 bgr555le            38c2e84751c3ad108a55bf77ab8afbf5
+bgr565be            b4921dbc73bfd61ede103f39664d839f
 bgr565le            2efbb9c15f22d5c704a00d11a241c1da
 bgra                ab589a165007d5b0dbacb26df4bbe5e0
 rgb24               c4ed6e5ad7eb4e66ea18deef3584231f
+rgb555be            c24d62606900fd1a6088883c7022252a
 rgb555le            3b313e94f2bf70c8972af69b6dc331c9
+rgb565be            e45766a1f18b74cf9094933f704bfe53
 rgb565le            de2cf048dcd48c0a39dfcc9b6eac36fe
 rgba                e97cd6a0393fc354e95088065e668eb2



More information about the ffmpeg-cvslog mailing list