[FFmpeg-devel] [PATCH 3/4] Implement dynamic memory allocation for MJPEG's picture

Anatoly Nenashev anatoly.nenashev
Mon Feb 28 16:41:40 CET 2011


On 28.02.2011 18:34, Ronald S. Bultje wrote:
> Hi,
>
> On Mon, Feb 28, 2011 at 9:19 AM, Anatoly Nenashev
> <anatoly.nenashev at ovsoft.ru>  wrote:
>    
>> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
>> index d146973..7f2d907 100644
>> --- a/libavcodec/mjpegdec.c
>> +++ b/libavcodec/mjpegdec.c
>> @@ -81,6 +81,11 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
>>   {
>>       MJpegDecodeContext *s = avctx->priv_data;
>>
>> +    if (!s->picture_ptr) {
>> +        s->picture_ptr =&s->picture;
>>      
> Why the if?
>
>    
Because I don't know that s->picture_ptr is set or not. Some external 
decoders can setup s->picture_ptr before or after call of 
ff_mjpeg_decode_init. This check is just for robustness.

>> +        s->picture_ptr->reference = 0;
>>      
> Unnecessary, all memory is zero'ed on init.
>
> Ronald
>    
Ok. I've removed it.




More information about the ffmpeg-devel mailing list