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

Don Moir donmoir at comcast.net
Mon Jul 23 22:54:30 CEST 2012


----- Original Message ----- 
From: "Paul B Mahol" <onemda at gmail.com>
To: <ffmpeg-devel at ffmpeg.org>
Sent: Monday, July 23, 2012 4:22 PM
Subject: [FFmpeg-devel] [PATCH] iff: fix case where image does not havealpha 
channel


> 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
>

Appears to fix the IFF samples I have. I don't have any IFF files that 
contain transparency and can't find any so if anyone can point me to some 
IFF files that have transparency, I will test them. 



More information about the ffmpeg-devel mailing list