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

Ronald S. Bultje rsbultje
Mon Feb 28 16:52:43 CET 2011


Hi,

On Mon, Feb 28, 2011 at 10:41 AM, Anatoly Nenashev
<anatoly.nenashev at ovsoft.ru> wrote:
> On 28.02.2011 18:34, Ronald S. Bultje wrote:
>> 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.
>
> Ok. I've removed it.

This version looks OK to me. I'll check the others later.

Ronald



More information about the ffmpeg-devel mailing list