summaryrefslogtreecommitdiff
path: root/libavcodec/8bps.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-16 11:43:26 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-16 11:43:26 +0200
commit15677e72399d12911128e7109a7e4101226f48d6 (patch)
treee9542130a2999d049af7489c838f47c0a025a0d5 /libavcodec/8bps.c
parentec0e0eb4c16f1ac1b0c0bb5fe34a34ebab0b3749 (diff)
parente8c0defe1322f0ff281d9bc5eee91fa1b712b6aa (diff)
Merge commit 'e8c0defe1322f0ff281d9bc5eee91fa1b712b6aa'
* commit 'e8c0defe1322f0ff281d9bc5eee91fa1b712b6aa': 8bps: decode 24bit files correctly as rgb32 on bigendian Conflicts: libavcodec/8bps.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/8bps.c')
-rw-r--r--libavcodec/8bps.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index c46c8c1c00..0e091460e0 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -159,17 +159,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",
@@ -177,6 +167,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;
}