summaryrefslogtreecommitdiff
path: root/libavcodec/dds.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-07-20 23:47:13 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-07-22 13:35:44 +0100
commitd08d8b61aa9f07d3ea993fe5392f7408c958d221 (patch)
treea266eba0f5e556d38ff0ebbc7d33c15e2dae3df6 /libavcodec/dds.c
parent57214b2f7f9b1ccfd61e232e8989b5ee850f169c (diff)
dds: Fix 32bpp bitmaps decoding
Found-By: ami_stuff Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
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 85d85fd9f0..625cb3027d 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -358,13 +358,13 @@ static int parse_pixel_format(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_BGR24;
/* 32 bpp */
else if (bpp == 32 && r == 0xff0000 && g == 0xff00 && b == 0xff && a == 0)
- avctx->pix_fmt = AV_PIX_FMT_RGBA; // opaque
- else if (bpp == 32 && r == 0xff && g == 0xff00 && b == 0xff0000 && a == 0)
avctx->pix_fmt = AV_PIX_FMT_BGRA; // opaque
+ else if (bpp == 32 && r == 0xff && g == 0xff00 && b == 0xff0000 && a == 0)
+ avctx->pix_fmt = AV_PIX_FMT_RGBA; // opaque
else if (bpp == 32 && r == 0xff0000 && g == 0xff00 && b == 0xff && a == 0xff000000)
- avctx->pix_fmt = AV_PIX_FMT_RGBA;
- else if (bpp == 32 && r == 0xff && g == 0xff00 && b == 0xff0000 && a == 0xff000000)
avctx->pix_fmt = AV_PIX_FMT_BGRA;
+ else if (bpp == 32 && r == 0xff && g == 0xff00 && b == 0xff0000 && a == 0xff000000)
+ avctx->pix_fmt = AV_PIX_FMT_RGBA;
/* give up */
else {
av_log(avctx, AV_LOG_ERROR, "Unknown pixel format "
@@ -664,7 +664,9 @@ static int dds_decode(AVCodecContext *avctx, void *data,
}
/* Run any post processing here if needed. */
- if (avctx->pix_fmt == AV_PIX_FMT_RGBA || avctx->pix_fmt == AV_PIX_FMT_YA8)
+ if (avctx->pix_fmt == AV_PIX_FMT_BGRA ||
+ avctx->pix_fmt == AV_PIX_FMT_RGBA ||
+ avctx->pix_fmt == AV_PIX_FMT_YA8)
run_postproc(avctx, frame);
/* Frame is ready to be output. */