[FFmpeg-devel] [PATCH] imgutils: introduce internal image_get_linesize() and use it

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon May 16 16:49:15 CEST 2011


On date Monday 2011-05-16 02:44:53 +0200, Michael Niedermayer encoded:
> On Sun, May 15, 2011 at 01:05:58PM +0200, Stefano Sabatini wrote:
> > Allow to factorize code between av_image_get_linesize() and
> > av_image_fill_linesizes().
> > ---
> >  libavutil/imgutils.c |   37 ++++++++++++++++++++++---------------
> >  1 files changed, 22 insertions(+), 15 deletions(-)
> [...]
> > @@ -74,15 +88,8 @@ int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
> >          return AVERROR(EINVAL);
> >  
> >      av_image_fill_max_pixsteps(max_step, max_step_comp, desc);
> > -    for (i = 0; i < 4; i++) {
> > -        int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0;
> > -        int shifted_w = ((width + (1 << s) - 1)) >> s;
> > -        if (max_step[i] > INT_MAX / shifted_w)
> > -            return AVERROR(EINVAL);
> > -        linesizes[i] = max_step[i] * shifted_w;
> > -        if (desc->flags & PIX_FMT_BITSTREAM)
> > -            linesizes[i] = (linesizes[i] + 7) >> 3;
> > -    }
> > +    for (i = 0; i < 4; i++)
> > +        linesizes[i] = image_get_linesize(width, i, max_step[i], max_step_comp[i], desc);
> 
> this is missing error checking for the image_get_linesize() return value.
> it could thus store a error code in linesizes[]

Fixed.
-- 
FFmpeg = Frightening Frenzy Minimal Porno Everlasting Guide
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-imgutils-introduce-internal-image_get_linesize-and-u.patch
Type: text/x-diff
Size: 3380 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110516/0e5ca668/attachment.bin>


More information about the ffmpeg-devel mailing list