[FFmpeg-devel] [PATCH] examples/demuxing_decoding: use correct size of video_dst_data[0]

Michael Niedermayer michaelni at gmx.at
Wed May 13 04:00:12 CEST 2015


On Tue, May 12, 2015 at 09:48:45PM +0200, Andreas Cadhalpun wrote:
> On 12.05.2015 21:12, Michael Niedermayer wrote:
> > On Tue, May 12, 2015 at 04:02:44PM +0200, Andreas Cadhalpun wrote:
> >> On 12.05.2015 14:51, Michael Niedermayer wrote:
> >>> On Tue, May 12, 2015 at 02:31:38PM +0200, Andreas Cadhalpun wrote:
> >>>> @@ -108,6 +109,14 @@ static int decode_packet(int *got_frame, int cached)
> >>>>                            (const uint8_t **)(frame->data), frame->linesize,
> >>>>                            pix_fmt, width, height);
> >>>>  
> >>>> +            if ((desc->flags & AV_PIX_FMT_FLAG_PAL ||
> >>>> +                 desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) &&
> >>>> +                video_dst_data[1] - video_dst_data[0] > video_dst_linesize[0] * height) {
> >>>> +                /* zero-initialize the padding before the palette */
> >>>> +                memset(video_dst_data[0] + video_dst_linesize[0] * height, 0,
> >>>> +                       video_dst_data[1] - video_dst_data[0] - video_dst_linesize[0] * height);
> >>>> +            }
> >>>
> >>> i wonder if this shouldnt be moved to av_image_alloc() ?
> >>
> >> It's a bit nicer to do this in av_image_fill_pointers.
> > 
> > yes but thats not safe
> > 
> > for example rawdec calls avpicture_fill() on the input buffer
> > which uses av_image_fill_pointers()
> 
> OK, then let's do it in av_image_alloc.
> 
> Best regards,
> Andreas
> 

>  imgutils.c |    8 ++++++++
>  1 file changed, 8 insertions(+)
> d5adef96014b1b086bdebacf6301d2f8ed104625  0001-imgutils-initialize-palette-padding-bytes-in-av_imag.patch
> From c244cba6812bcb15f871b72e721fc3310f6c983f Mon Sep 17 00:00:00 2001
> From: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> Date: Tue, 12 May 2015 21:45:42 +0200
> Subject: [PATCH] imgutils: initialize palette padding bytes in av_image_alloc

applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150513/f1fbc20d/attachment.asc>


More information about the ffmpeg-devel mailing list