[FFmpeg-devel] [PATCH] IFF: Fix IFF decoder crash with enabled avfilter

Sebastian Vater cdgs.basty
Mon May 24 17:46:07 CEST 2010


Ronald S. Bultje a ?crit :
> Hi,
>
> On Sun, May 23, 2010 at 12:41 PM, Sebastian Vater
> <cdgs.basty at googlemail.com> wrote:
>   
>> Finally, the IFF decoder works also with enabled libavfilter.
>>
>> I just tried out this patch with all images and they work like a charm.
>>
>> I did this by moving get_buffer call in decode_init to both decode_frame
>> parts (replacing the reget_buffers there).
>>
>> Also I had to move ff_read_cmap_palette from decode_init to decode_frame
>> also since that relies on get_buffer already called.
>>
>> So here's the very small patch to review. :)
>>     
> [..]
>   
>> -    if (avctx->reget_buffer(avctx, &s->frame) < 0){
>> +    if ((res = avctx->get_buffer(avctx, &s->frame) < 0)) {
>>          av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>> -        return -1;
>> +        return res;
>> +    } else if (avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt != PIX_FMT_GRAY8) {
>> +        if ((res = ff_cmap_read_palette(avctx, (uint32_t*)s->frame.data[1])) < 0)
>> +            return res;
>>      }
>>     
>
> You don't want to do this every time, right? Shouldn't there be some
> s->init variable or so, so you do this only once?
>   

I guess you mean the read palette stuff, right?

The palette can change within frames with upcoming IFF-ANIM stuff, so
it's actually a good idea to read it everytime.

For this time, however, since it only supports static images right now,
it should be called only once (but isn't decode_frame called only once
then after all?).

I should mention also that IFF-ILBM supports color cycling which is
basically color register movement for each frame.

-- 

Best regards,
                   :-) Basty/CDGS (-:




More information about the ffmpeg-devel mailing list