summaryrefslogtreecommitdiff
path: root/libavcodec/dds.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-07-23 17:59:44 +0300
committerMartin Storsjö <martin@martin.st>2015-07-23 19:07:43 +0300
commit44f7df0c987965763c609f6dc36974b04182e58d (patch)
tree919aa8fa77378affa0e065f0d1c495e58fe56c77 /libavcodec/dds.c
parent11f3d5c69b711a1f1631961921ecd20d31f8336d (diff)
downloadffmpeg-44f7df0c987965763c609f6dc36974b04182e58d.tar.gz
dds: Write the palette in the native endian form
This fixes the palette on big endian, broken (or, differing from little endian) since 57214b2f7. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/dds.c')
-rw-r--r--libavcodec/dds.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index 2c3a2f25b8..f124d4a13d 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -653,14 +653,16 @@ static int dds_decode(AVCodecContext *avctx, void *data,
if (ctx->paletted) {
int i;
- uint8_t *p = frame->data[1];
+ uint32_t *p = (uint32_t*) frame->data[1];
/* Use the first 1024 bytes as palette, then copy the rest. */
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);
+ uint32_t rgba = 0;
+ rgba |= bytestream2_get_byte(gbc) << 16;
+ rgba |= bytestream2_get_byte(gbc) << 8;
+ rgba |= bytestream2_get_byte(gbc) << 0;
+ rgba |= bytestream2_get_byte(gbc) << 24;
+ p[i] = rgba;
}
frame->palette_has_changed = 1;