Commit d08d8b61 authored by Michael Niedermayer's avatar Michael Niedermayer Committed by Vittorio Giovara

dds: Fix 32bpp bitmaps decoding

Found-By: ami_stuff
Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent 57214b2f
...@@ -358,13 +358,13 @@ static int parse_pixel_format(AVCodecContext *avctx) ...@@ -358,13 +358,13 @@ static int parse_pixel_format(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_BGR24; avctx->pix_fmt = AV_PIX_FMT_BGR24;
/* 32 bpp */ /* 32 bpp */
else if (bpp == 32 && r == 0xff0000 && g == 0xff00 && b == 0xff && a == 0) 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 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) 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; 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 */ /* give up */
else { else {
av_log(avctx, AV_LOG_ERROR, "Unknown pixel format " av_log(avctx, AV_LOG_ERROR, "Unknown pixel format "
...@@ -664,7 +664,9 @@ static int dds_decode(AVCodecContext *avctx, void *data, ...@@ -664,7 +664,9 @@ static int dds_decode(AVCodecContext *avctx, void *data,
} }
/* Run any post processing here if needed. */ /* 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); run_postproc(avctx, frame);
/* Frame is ready to be output. */ /* Frame is ready to be output. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment