atrac3: replace a calculation with FFALIGN()
authorJustin Ruggles <justin.ruggles@gmail.com>
Fri, 19 Oct 2012 03:51:37 +0000 (23:51 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Mon, 22 Oct 2012 14:10:08 +0000 (10:10 -0400)
This allocates 4 bytes less than the previous code if avctx->block_align is
a multiple of 4, but the extra 4 bytes is not really needed.

libavcodec/atrac3.c

index 66c672a..9cf9892 100644 (file)
@@ -947,8 +947,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
     if (avctx->block_align >= UINT_MAX / 2)
         return AVERROR(EINVAL);
 
-    q->decoded_bytes_buffer = av_mallocz(avctx->block_align +
-                                         (4 - avctx->block_align % 4) +
+    q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) +
                                          FF_INPUT_BUFFER_PADDING_SIZE);
     if (q->decoded_bytes_buffer == NULL)
         return AVERROR(ENOMEM);