av_image_alloc: Align the width to 8 when align >= 8.
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Apr 2012 19:03:19 +0000 (21:03 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 13 Apr 2012 16:40:17 +0000 (18:40 +0200)
This allows simd optimized routines to work in steps of 8 pixels
without going over the linesize. (this matters for yuv->rgb24 for example)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/imgutils.c

index 75642d1..ef7d413 100644 (file)
@@ -188,7 +188,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
 
     if ((ret = av_image_check_size(w, h, 0, NULL)) < 0)
         return ret;
-    if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, w)) < 0)
+    if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, align>7 ? FFALIGN(w, 8) : w)) < 0)
         return ret;
 
     for (i = 0; i < 4; i++)