aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2020-06-01 22:23:57 +0800
committerLimin Wang <lance.lmwang@gmail.com>2020-06-13 06:59:19 +0800
commitafaaf27fc4f3a5ff16d0f970603fb337ea9d8f8e (patch)
treeb9d5a3f66b066618139f2fbb91ec779c0c557eae
parent8a8802e9cbcd9f111e1e3b888db5cddd9c223893 (diff)
downloadffmpeg-afaaf27fc4f3a5ff16d0f970603fb337ea9d8f8e.tar.gz
avcodec/twinvq: remove FF_ALLOCZ_ARRAY_OR_GOTO and gotos label
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
-rw-r--r--libavcodec/twinvq.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
index 34ca1846b9..6dfaf06b14 100644
--- a/libavcodec/twinvq.c
+++ b/libavcodec/twinvq.c
@@ -538,6 +538,7 @@ static av_cold int init_mdct_win(TwinVQContext *tctx)
int size_m = mtab->size / mtab->fmode[TWINVQ_FT_MEDIUM].sub;
int channels = tctx->avctx->channels;
float norm = channels == 1 ? 2.0 : 1.0;
+ int table_size = 2 * mtab->size * channels;
for (i = 0; i < 3; i++) {
int bsize = tctx->mtab->size / tctx->mtab->fmode[i].sub;
@@ -546,25 +547,17 @@ static av_cold int init_mdct_win(TwinVQContext *tctx)
return ret;
}
- FF_ALLOC_ARRAY_OR_GOTO(tctx->avctx, tctx->tmp_buf,
- mtab->size, sizeof(*tctx->tmp_buf), alloc_fail);
-
- FF_ALLOC_ARRAY_OR_GOTO(tctx->avctx, tctx->spectrum,
- 2 * mtab->size, channels * sizeof(*tctx->spectrum),
- alloc_fail);
- FF_ALLOC_ARRAY_OR_GOTO(tctx->avctx, tctx->curr_frame,
- 2 * mtab->size, channels * sizeof(*tctx->curr_frame),
- alloc_fail);
- FF_ALLOC_ARRAY_OR_GOTO(tctx->avctx, tctx->prev_frame,
- 2 * mtab->size, channels * sizeof(*tctx->prev_frame),
- alloc_fail);
+ if (!FF_ALLOC_TYPED_ARRAY(tctx->tmp_buf, mtab->size) ||
+ !FF_ALLOC_TYPED_ARRAY(tctx->spectrum, table_size) ||
+ !FF_ALLOC_TYPED_ARRAY(tctx->curr_frame, table_size) ||
+ !FF_ALLOC_TYPED_ARRAY(tctx->prev_frame, table_size))
+ return AVERROR(ENOMEM);
for (i = 0; i < 3; i++) {
int m = 4 * mtab->size / mtab->fmode[i].sub;
double freq = 2 * M_PI / m;
- FF_ALLOC_ARRAY_OR_GOTO(tctx->avctx, tctx->cos_tabs[i],
- (m / 4), sizeof(*tctx->cos_tabs[i]), alloc_fail);
-
+ if (!FF_ALLOC_TYPED_ARRAY(tctx->cos_tabs[i], m / 4))
+ return AVERROR(ENOMEM);
for (j = 0; j <= m / 8; j++)
tctx->cos_tabs[i][j] = cos((2 * j + 1) * freq);
for (j = 1; j < m / 8; j++)
@@ -576,9 +569,6 @@ static av_cold int init_mdct_win(TwinVQContext *tctx)
ff_init_ff_sine_windows(av_log2(mtab->size));
return 0;
-
-alloc_fail:
- return AVERROR(ENOMEM);
}
/**