Commit 57214b2f authored by Vittorio Giovara's avatar Vittorio Giovara

dds: Fix palette decoding

Red and blue channels were decoded in the wrong order.

Found-By: ami_stuff
parent ea4d46e7
...@@ -645,11 +645,15 @@ static int dds_decode(AVCodecContext *avctx, void *data, ...@@ -645,11 +645,15 @@ static int dds_decode(AVCodecContext *avctx, void *data,
if (ctx->paletted) { if (ctx->paletted) {
int i; 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. */ /* Use the first 1024 bytes as palette, then copy the rest. */
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++) {
p[i] = bytestream2_get_le32(gbc); 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; frame->palette_has_changed = 1;
} }
......
#tb 0: 1/25 #tb 0: 1/25
0, 0, 0, 1, 65536, 0xbffee5cd 0, 0, 0, 1, 65536, 0x4287e5cd
#tb 0: 1/25 #tb 0: 1/25
0, 0, 0, 1, 16384, 0x23068060 0, 0, 0, 1, 16384, 0x6ac18060
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment