From 57214b2f7f9b1ccfd61e232e8989b5ee850f169c Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Mon, 20 Jul 2015 23:47:12 +0100 Subject: dds: Fix palette decoding Red and blue channels were decoded in the wrong order. Found-By: ami_stuff --- libavcodec/dds.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/dds.c b/libavcodec/dds.c index d259b5e0f4..85d85fd9f0 100644 --- a/libavcodec/dds.c +++ b/libavcodec/dds.c @@ -645,11 +645,15 @@ static int dds_decode(AVCodecContext *avctx, void *data, if (ctx->paletted) { int i; - uint32_t *p = (uint32_t *)frame->data[1]; + uint8_t *p = frame->data[1]; /* Use the first 1024 bytes as palette, then copy the rest. */ - for (i = 0; i < 256; i++) - p[i] = bytestream2_get_le32(gbc); + for (i = 0; i < 256; i++) { + p[i * 4 + 2] = bytestream2_get_byte(gbc); + p[i * 4 + 1] = bytestream2_get_byte(gbc); + p[i * 4 + 0] = bytestream2_get_byte(gbc); + p[i * 4 + 3] = bytestream2_get_byte(gbc); + } frame->palette_has_changed = 1; } -- cgit v1.2.3