[FFmpeg-devel] [PATCH] iff: fix case where image does not have alpha channel

Paul B Mahol onemda at gmail.com
Mon Jul 23 22:22:53 CEST 2012


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/iff.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 6f11f58..9ddeb4a 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -325,8 +325,16 @@ static av_cold int decode_init(AVCodecContext *avctx)
         avctx->pix_fmt = (avctx->bits_per_coded_sample < 8) ||
                          (avctx->extradata_size >= 2 && palette_size) ? PIX_FMT_PAL8 : PIX_FMT_GRAY8;
     } else if (avctx->bits_per_coded_sample <= 32) {
-        if (avctx->codec_tag != MKTAG('D','E','E','P'))
-            avctx->pix_fmt = PIX_FMT_BGR32;
+        if (avctx->codec_tag != MKTAG('D','E','E','P')) {
+            if (avctx->bits_per_coded_sample == 24) {
+                avctx->pix_fmt = PIX_FMT_RGB0;
+            } else if (avctx->bits_per_coded_sample == 32) {
+                avctx->pix_fmt = PIX_FMT_BGR32;
+            } else {
+                av_log_ask_for_sample(avctx, "unknown bits_per_coded_sample\n");
+                return AVERROR_PATCHWELCOME;
+            }
+        }
     } else {
         return AVERROR_INVALIDDATA;
     }
-- 
1.7.7



More information about the ffmpeg-devel mailing list