[FFmpeg-devel] [PATCH] lavfi/af_atempo: use av_malloc for rDFT buffers.
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Tue Aug 28 18:48:51 CEST 2012
On Tue, Aug 28, 2012 at 06:24:12PM +0200, Nicolas George wrote:
> Memory obtained from av_realloc is not aligned enough for AVX.
> The buffers are always completely filled, data does not need
> to be preserved.
>
> Fix trac ticket #1692.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
> libavfilter/af_atempo.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
> index 7971aef..4c4d376 100644
> --- a/libavfilter/af_atempo.c
> +++ b/libavfilter/af_atempo.c
> @@ -219,6 +219,18 @@ static void yae_release_buffers(ATempoContext *atempo)
> field = new_field; \
> } while (0)
>
> +/* av_realloc is not aligned enough; fortunately, the data does not need to
> + * be preserved */
> +#define RE_MALLOC_OR_FAIL(field, field_size) \
> + do { \
> + av_freep(&field); \
> + field = av_malloc((field_size)); \
> + if (!field) { \
> + yae_release_buffers(atempo); \
> + return AVERROR(ENOMEM); \
> + } \
> + } while (0)
I can't see why the data for the other cases would need to be preserved?
So you could just make all use this code.
Btw. the double () around field_size looks a bit ugly.
More information about the ffmpeg-devel
mailing list