[FFmpeg-cvslog] ff: fix case where image does not have alpha channel

Paul B Mahol git at videolan.org
Tue Oct 30 16:29:07 CET 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Oct 30 15:28:13 2012 +0000| [8a4284adbf180c8bf3f649d6dd4281565e0dd015] | committer: Paul B Mahol

ff: fix case where image does not have alpha channel

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a4284adbf180c8bf3f649d6dd4281565e0dd015
---

 libavcodec/iff.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 3940a0c..bc88a8e 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -330,8 +330,16 @@ static av_cold int decode_init(AVCodecContext *avctx)
         avctx->pix_fmt = (avctx->bits_per_coded_sample < 8) ||
                          (avctx->extradata_size >= 2 && palette_size) ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8;
     } else if (avctx->bits_per_coded_sample <= 32) {
-        if (avctx->codec_tag != MKTAG('D','E','E','P'))
-            avctx->pix_fmt = AV_PIX_FMT_BGR32;
+        if (avctx->codec_tag != MKTAG('D','E','E','P')) {
+            if (avctx->bits_per_coded_sample == 24) {
+                avctx->pix_fmt = AV_PIX_FMT_RGB0;
+            } else if (avctx->bits_per_coded_sample == 32) {
+                avctx->pix_fmt = AV_PIX_FMT_BGR32;
+            } else {
+                av_log_ask_for_sample(avctx, "unknown bits_per_coded_sample\n");
+                return AVERROR_PATCHWELCOME;
+            }
+        }
     } else {
         return AVERROR_INVALIDDATA;
     }



More information about the ffmpeg-cvslog mailing list