avcodec/dds: Fix palettes on big endian

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-06-22 23:59:28 +02:00
parent ff68b83968
commit 21d2e3d602
1 changed files with 5 additions and 0 deletions

View File

@ -626,8 +626,13 @@ static int dds_decode(AVCodecContext *avctx, void *data,
int linesize = av_image_get_linesize(avctx->pix_fmt, frame->width, 0); int linesize = av_image_get_linesize(avctx->pix_fmt, frame->width, 0);
if (ctx->paletted) { if (ctx->paletted) {
int i;
/* Use the first 1024 bytes as palette, then copy the rest. */ /* Use the first 1024 bytes as palette, then copy the rest. */
bytestream2_get_buffer(gbc, frame->data[1], 256 * 4); bytestream2_get_buffer(gbc, frame->data[1], 256 * 4);
if (HAVE_BIGENDIAN)
for (i = 0; i < 256; i++)
AV_WB32(frame->data[1] + i*4, AV_RL32(frame->data[1] + i*4));
frame->palette_has_changed = 1; frame->palette_has_changed = 1;
} }