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

Stefano Sabatini stefano.sabatini-lala at poste.it
Tue May 17 00:11:08 CEST 2011


On date Monday 2011-05-16 18:01:27 +0200, Michael Niedermayer encoded:
> On Mon, May 16, 2011 at 04:49:15PM +0200, Stefano Sabatini wrote:
> > 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.
> 
> thx
> 
> 
> > --
> > FFmpeg = Frightening Frenzy Minimal Porno Everlasting Guide
> 
> >  imgutils.c |   39 ++++++++++++++++++++++++---------------
> >  1 file changed, 24 insertions(+), 15 deletions(-)
> > 4046c9f824558c9e6a2ed8eadea863f0ed7e42db  0003-imgutils-introduce-internal-image_get_linesize-and-u.patch
> > From 220adcafd993ab627f883c4e7a911e42f085a526 Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > Date: Sun, 15 May 2011 12:47:06 +0200
> > Subject: [PATCH] imgutils: introduce internal image_get_linesize() and use it
> > 
> > Allow to factorize code between av_image_get_linesize() and
> > av_image_fill_linesizes(), and add missing checks.
> > 
> > Increase robustness.
> 
> LGTM if tested

Sent.
-- 
FFmpeg = Funny & Formidable Monstrous Portentous Evangelical Gadget


More information about the ffmpeg-devel mailing list