diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-07-20 23:47:12 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2015-07-22 13:35:44 +0100 |
commit | 57214b2f7f9b1ccfd61e232e8989b5ee850f169c (patch) | |
tree | 885c57e6b0027e58f43c4e0720db49fca35f90db | |
parent | ea4d46e72945cba37feb7aa154eb970732f513e4 (diff) | |
download | ffmpeg-57214b2f7f9b1ccfd61e232e8989b5ee850f169c.tar.gz |
dds: Fix palette decoding
Red and blue channels were decoded in the wrong order.
Found-By: ami_stuff
-rw-r--r-- | libavcodec/dds.c | 10 | ||||
-rw-r--r-- | tests/ref/fate/dds-pal | 2 | ||||
-rw-r--r-- | tests/ref/fate/dds-pal-ati | 2 |
3 files changed, 9 insertions, 5 deletions
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; } diff --git a/tests/ref/fate/dds-pal b/tests/ref/fate/dds-pal index 85414414d5..575a4bd51b 100644 --- a/tests/ref/fate/dds-pal +++ b/tests/ref/fate/dds-pal @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 65536, 0xbffee5cd +0, 0, 0, 1, 65536, 0x4287e5cd diff --git a/tests/ref/fate/dds-pal-ati b/tests/ref/fate/dds-pal-ati index 6b43bb4a8b..6de8adb445 100644 --- a/tests/ref/fate/dds-pal-ati +++ b/tests/ref/fate/dds-pal-ati @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 16384, 0x23068060 +0, 0, 0, 1, 16384, 0x6ac18060 |