From e8c0defe1322f0ff281d9bc5eee91fa1b712b6aa Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Fri, 19 Jul 2013 13:51:51 +0200 Subject: [PATCH] 8bps: decode 24bit files correctly as rgb32 on bigendian --- libavcodec/8bps.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index ad1266f6b5..552e926c22 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -168,17 +168,7 @@ static av_cold int decode_init(AVCodecContext *avctx) case 32: avctx->pix_fmt = AV_PIX_FMT_RGB32; c->planes = 4; -#if HAVE_BIGENDIAN - c->planemap[0] = 1; // 1st plane is red - c->planemap[1] = 2; // 2nd plane is green - c->planemap[2] = 3; // 3rd plane is blue - c->planemap[3] = 0; // 4th plane is alpha??? -#else - c->planemap[0] = 2; // 1st plane is red - c->planemap[1] = 1; // 2nd plane is green - c->planemap[2] = 0; // 3rd plane is blue - c->planemap[3] = 3; // 4th plane is alpha??? -#endif + /* handle planemap setup later for decoding rgb24 data as rbg32 */ break; default: av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", @@ -186,6 +176,12 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } + if (avctx->pix_fmt == AV_PIX_FMT_RGB32) { + c->planemap[0] = HAVE_BIGENDIAN ? 1 : 2; // 1st plane is red + c->planemap[1] = HAVE_BIGENDIAN ? 2 : 1; // 2nd plane is green + c->planemap[2] = HAVE_BIGENDIAN ? 3 : 0; // 3rd plane is blue + c->planemap[3] = HAVE_BIGENDIAN ? 0 : 3; // 4th plane is alpha??? + } return 0; }