diff options
author | Paul B Mahol <onemda@gmail.com> | 2023-07-15 10:39:27 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2023-07-15 10:52:15 +0200 |
commit | ef3b5789ece62c26c12697c588bbb34f3efbd437 (patch) | |
tree | 8536d53ab51fe56d27b0c4e36a22e45824c89398 /libavfilter/af_atempo.c | |
parent | f264204de9d15f21d10a67304ee32347a5adb411 (diff) | |
download | ffmpeg-ef3b5789ece62c26c12697c588bbb34f3efbd437.tar.gz |
avfilter/af_atempo: improve RE_MALLOC_OR_FAIL macro
Make use of third parameter of av_calloc() call.
Diffstat (limited to 'libavfilter/af_atempo.c')
-rw-r--r-- | libavfilter/af_atempo.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c index 27f13638b0..4621b67b03 100644 --- a/libavfilter/af_atempo.c +++ b/libavfilter/af_atempo.c @@ -247,10 +247,10 @@ static void yae_release_buffers(ATempoContext *atempo) /* av_realloc is not aligned enough; fortunately, the data does not need to * be preserved */ -#define RE_MALLOC_OR_FAIL(field, field_size) \ +#define RE_MALLOC_OR_FAIL(field, field_size, element_size) \ do { \ av_freep(&field); \ - field = av_calloc(field_size, 1); \ + field = av_calloc(field_size, element_size); \ if (!field) { \ yae_release_buffers(atempo); \ return AVERROR(ENOMEM); \ @@ -290,12 +290,12 @@ static int yae_reset(ATempoContext *atempo, } // initialize audio fragment buffers: - RE_MALLOC_OR_FAIL(atempo->frag[0].data, atempo->window * atempo->stride); - RE_MALLOC_OR_FAIL(atempo->frag[1].data, atempo->window * atempo->stride); - RE_MALLOC_OR_FAIL(atempo->frag[0].xdat_in, (atempo->window + 1) * sizeof(AVComplexFloat)); - RE_MALLOC_OR_FAIL(atempo->frag[1].xdat_in, (atempo->window + 1) * sizeof(AVComplexFloat)); - RE_MALLOC_OR_FAIL(atempo->frag[0].xdat, (atempo->window + 1) * sizeof(AVComplexFloat)); - RE_MALLOC_OR_FAIL(atempo->frag[1].xdat, (atempo->window + 1) * sizeof(AVComplexFloat)); + RE_MALLOC_OR_FAIL(atempo->frag[0].data, atempo->window, atempo->stride); + RE_MALLOC_OR_FAIL(atempo->frag[1].data, atempo->window, atempo->stride); + RE_MALLOC_OR_FAIL(atempo->frag[0].xdat_in, (atempo->window + 1), sizeof(AVComplexFloat)); + RE_MALLOC_OR_FAIL(atempo->frag[1].xdat_in, (atempo->window + 1), sizeof(AVComplexFloat)); + RE_MALLOC_OR_FAIL(atempo->frag[0].xdat, (atempo->window + 1), sizeof(AVComplexFloat)); + RE_MALLOC_OR_FAIL(atempo->frag[1].xdat, (atempo->window + 1), sizeof(AVComplexFloat)); // initialize rDFT contexts: av_tx_uninit(&atempo->real_to_complex); @@ -313,14 +313,14 @@ static int yae_reset(ATempoContext *atempo, return AVERROR(ENOMEM); } - RE_MALLOC_OR_FAIL(atempo->correlation_in, (atempo->window + 1) * sizeof(AVComplexFloat)); - RE_MALLOC_OR_FAIL(atempo->correlation, atempo->window * sizeof(AVComplexFloat)); + RE_MALLOC_OR_FAIL(atempo->correlation_in, (atempo->window + 1), sizeof(AVComplexFloat)); + RE_MALLOC_OR_FAIL(atempo->correlation, atempo->window, sizeof(AVComplexFloat)); atempo->ring = atempo->window * 3; - RE_MALLOC_OR_FAIL(atempo->buffer, atempo->ring * atempo->stride); + RE_MALLOC_OR_FAIL(atempo->buffer, atempo->ring, atempo->stride); // initialize the Hann window function: - RE_MALLOC_OR_FAIL(atempo->hann, atempo->window * sizeof(float)); + RE_MALLOC_OR_FAIL(atempo->hann, atempo->window, sizeof(float)); for (i = 0; i < atempo->window; i++) { double t = (double)i / (double)(atempo->window - 1); |