avcodec/dds: fix paletted files
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 19 Jul 2015 20:55:16 +0000 (22:55 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 19 Jul 2015 21:26:59 +0000 (23:26 +0200)
Fixes Ticket4664

The changed fate tests lack red/blue shades and thus look correct
either way

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/dds.c
tests/ref/fate/dds-pal
tests/ref/fate/dds-pal-ati

index 3f6f7f8..566954d 100644 (file)
@@ -629,9 +629,13 @@ static int dds_decode(AVCodecContext *avctx, void *data,
             int i;
             /* Use the first 1024 bytes as palette, then copy the rest. */
             bytestream2_get_buffer(gbc, frame->data[1], 256 * 4);
-            if (HAVE_BIGENDIAN)
-                for (i = 0; i < 256; i++)
-                    AV_WB32(frame->data[1] + i*4, AV_RL32(frame->data[1] + i*4));
+            for (i = 0; i < 256; i++)
+                AV_WN32(frame->data[1] + i*4,
+                        (frame->data[1][2+i*4]<<0)+
+                        (frame->data[1][1+i*4]<<8)+
+                        (frame->data[1][0+i*4]<<16)+
+                        (frame->data[1][3+i*4]<<24)
+                );
 
             frame->palette_has_changed = 1;
         }
index 8541441..575a4bd 100644 (file)
@@ -1,2 +1,2 @@
 #tb 0: 1/25
-0,          0,          0,        1,    65536, 0xbffee5cd
+0,          0,          0,        1,    65536, 0x4287e5cd
index 6b43bb4..6de8adb 100644 (file)
@@ -1,2 +1,2 @@
 #tb 0: 1/25
-0,          0,          0,        1,    16384, 0x23068060
+0,          0,          0,        1,    16384, 0x6ac18060