avutil: change default buffer size alignment for sample buffer functions
authorJustin Ruggles <justin.ruggles@gmail.com>
Tue, 10 Apr 2012 14:53:55 +0000 (10:53 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Mon, 23 Apr 2012 18:06:45 +0000 (14:06 -0400)
Aligning nb_samples will give both correct plane pointer alignment and enough
padding for SIMD-optimized functions.

libavutil/samplefmt.c

index 2e0aa98..0a2ffa0 100644 (file)
@@ -124,8 +124,10 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
         return AVERROR(EINVAL);
 
     /* auto-select alignment if not specified */
-    if (!align)
-        align = 32;
+    if (!align) {
+        align = 1;
+        nb_samples = FFALIGN(nb_samples, 32);
+    }
 
     /* check for integer overflow */
     if (nb_channels > INT_MAX / align ||