]> git.sesse.net Git - ffmpeg/commitdiff
dds: Fix 32bpp bitmaps decoding
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 20 Jul 2015 22:47:13 +0000 (23:47 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Wed, 22 Jul 2015 12:35:44 +0000 (13:35 +0100)
Found-By: ami_stuff
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
libavcodec/dds.c

index 85d85fd9f0faf4328895b5b15811445616429f26..625cb3027d94aa0ce532c32b920c1789515b8065 100644 (file)
@@ -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. */