On 10/19/2012 04:42 AM, Martin Storsjö wrote: > On Thu, 18 Oct 2012, Justin Ruggles wrote: > >> --- >> libavcodec/atrac3.c | 3 +-- >> 1 files changed, 1 insertions(+), 2 deletions(-) >> >> diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c >> index 28c72c7..343e31b 100644 >> --- a/libavcodec/atrac3.c >> +++ b/libavcodec/atrac3.c >> @@ -949,8 +949,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); >> -- >> 1.7.1 > > Hmm, doesn't the original calculation add 4 bytes extra if the block > align is evenly divisible by 4? That probably isn't necessary though, so > ok if that's the case, please amend the commit message to explain this > though.
How about this: atrac3: replace a calculation with FFALIGN() 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. -Justin _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel