You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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>
This commit is contained in:
@@ -653,14 +653,16 @@ static int dds_decode(AVCodecContext *avctx, void *data,
|
|||||||
|
|
||||||
if (ctx->paletted) {
|
if (ctx->paletted) {
|
||||||
int i;
|
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. */
|
/* 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 * 4 + 2] = bytestream2_get_byte(gbc);
|
uint32_t rgba = 0;
|
||||||
p[i * 4 + 1] = bytestream2_get_byte(gbc);
|
rgba |= bytestream2_get_byte(gbc) << 16;
|
||||||
p[i * 4 + 0] = bytestream2_get_byte(gbc);
|
rgba |= bytestream2_get_byte(gbc) << 8;
|
||||||
p[i * 4 + 3] = bytestream2_get_byte(gbc);
|
rgba |= bytestream2_get_byte(gbc) << 0;
|
||||||
|
rgba |= bytestream2_get_byte(gbc) << 24;
|
||||||
|
p[i] = rgba;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame->palette_has_changed = 1;
|
frame->palette_has_changed = 1;
|
||||||
|
Reference in New Issue
Block a user