[FFmpeg-devel] [PATCH] imgutils: introduce	internal	image_get_linesize() and use it
    Michael Niedermayer 
    michaelni at gmx.at
       
    Mon May 16 02:44:53 CEST 2011
    
    
  
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[]
[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110516/e26aa716/attachment.asc>
    
    
More information about the ffmpeg-devel
mailing list