]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/dds: Fix palettes on big endian
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 22 Jun 2015 21:59:28 +0000 (23:59 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 22 Jun 2015 21:59:28 +0000 (23:59 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/dds.c

index 514225a6323940ad4a238e20aa4cddff2008082d..3f6f7f8cb7352826b4adf529ab9886093cd6b51f 100644 (file)
@@ -626,8 +626,13 @@ static int dds_decode(AVCodecContext *avctx, void *data,
         int linesize = av_image_get_linesize(avctx->pix_fmt, frame->width, 0);
 
         if (ctx->paletted) {
+            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));
+
             frame->palette_has_changed = 1;
         }