mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-29 14:30:27 +00:00
avcodec/ac3en: use FF_ALLOC(Z)_ARRAY()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
bcac0f4010
commit
8572dbc5db
@ -2327,50 +2327,50 @@ static av_cold int allocate_buffers(AC3EncodeContext *s)
|
||||
if (s->allocate_sample_buffers(s))
|
||||
goto alloc_fail;
|
||||
|
||||
FF_ALLOC_OR_GOTO(avctx, s->bap_buffer, total_coefs *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->bap_buffer, total_coefs,
|
||||
sizeof(*s->bap_buffer), alloc_fail);
|
||||
FF_ALLOC_OR_GOTO(avctx, s->bap1_buffer, total_coefs *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->bap1_buffer, total_coefs,
|
||||
sizeof(*s->bap1_buffer), alloc_fail);
|
||||
FF_ALLOCZ_OR_GOTO(avctx, s->mdct_coef_buffer, total_coefs *
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->mdct_coef_buffer, total_coefs,
|
||||
sizeof(*s->mdct_coef_buffer), alloc_fail);
|
||||
FF_ALLOC_OR_GOTO(avctx, s->exp_buffer, total_coefs *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->exp_buffer, total_coefs,
|
||||
sizeof(*s->exp_buffer), alloc_fail);
|
||||
FF_ALLOC_OR_GOTO(avctx, s->grouped_exp_buffer, channel_blocks * 128 *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->grouped_exp_buffer, channel_blocks, 128 *
|
||||
sizeof(*s->grouped_exp_buffer), alloc_fail);
|
||||
FF_ALLOC_OR_GOTO(avctx, s->psd_buffer, total_coefs *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->psd_buffer, total_coefs,
|
||||
sizeof(*s->psd_buffer), alloc_fail);
|
||||
FF_ALLOC_OR_GOTO(avctx, s->band_psd_buffer, channel_blocks * 64 *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->band_psd_buffer, channel_blocks, 64 *
|
||||
sizeof(*s->band_psd_buffer), alloc_fail);
|
||||
FF_ALLOC_OR_GOTO(avctx, s->mask_buffer, channel_blocks * 64 *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->mask_buffer, channel_blocks, 64 *
|
||||
sizeof(*s->mask_buffer), alloc_fail);
|
||||
FF_ALLOC_OR_GOTO(avctx, s->qmant_buffer, total_coefs *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->qmant_buffer, total_coefs,
|
||||
sizeof(*s->qmant_buffer), alloc_fail);
|
||||
if (s->cpl_enabled) {
|
||||
FF_ALLOC_OR_GOTO(avctx, s->cpl_coord_exp_buffer, channel_blocks * 16 *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->cpl_coord_exp_buffer, channel_blocks, 16 *
|
||||
sizeof(*s->cpl_coord_exp_buffer), alloc_fail);
|
||||
FF_ALLOC_OR_GOTO(avctx, s->cpl_coord_mant_buffer, channel_blocks * 16 *
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->cpl_coord_mant_buffer, channel_blocks, 16 *
|
||||
sizeof(*s->cpl_coord_mant_buffer), alloc_fail);
|
||||
}
|
||||
for (blk = 0; blk < s->num_blocks; blk++) {
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->mdct_coef, channels * sizeof(*block->mdct_coef),
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->mdct_coef, channels, sizeof(*block->mdct_coef),
|
||||
alloc_fail);
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->exp, channels * sizeof(*block->exp),
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->exp, channels, sizeof(*block->exp),
|
||||
alloc_fail);
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->grouped_exp, channels * sizeof(*block->grouped_exp),
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->grouped_exp, channels, sizeof(*block->grouped_exp),
|
||||
alloc_fail);
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->psd, channels * sizeof(*block->psd),
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->psd, channels, sizeof(*block->psd),
|
||||
alloc_fail);
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->band_psd, channels * sizeof(*block->band_psd),
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->band_psd, channels, sizeof(*block->band_psd),
|
||||
alloc_fail);
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->mask, channels * sizeof(*block->mask),
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->mask, channels, sizeof(*block->mask),
|
||||
alloc_fail);
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->qmant, channels * sizeof(*block->qmant),
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->qmant, channels, sizeof(*block->qmant),
|
||||
alloc_fail);
|
||||
if (s->cpl_enabled) {
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->cpl_coord_exp, channels * sizeof(*block->cpl_coord_exp),
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->cpl_coord_exp, channels, sizeof(*block->cpl_coord_exp),
|
||||
alloc_fail);
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->cpl_coord_mant, channels * sizeof(*block->cpl_coord_mant),
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->cpl_coord_mant, channels, sizeof(*block->cpl_coord_mant),
|
||||
alloc_fail);
|
||||
}
|
||||
|
||||
@ -2393,11 +2393,11 @@ static av_cold int allocate_buffers(AC3EncodeContext *s)
|
||||
}
|
||||
|
||||
if (!s->fixed_point) {
|
||||
FF_ALLOCZ_OR_GOTO(avctx, s->fixed_coef_buffer, total_coefs *
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->fixed_coef_buffer, total_coefs,
|
||||
sizeof(*s->fixed_coef_buffer), alloc_fail);
|
||||
for (blk = 0; blk < s->num_blocks; blk++) {
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->fixed_coef, channels *
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->fixed_coef, channels,
|
||||
sizeof(*block->fixed_coef), alloc_fail);
|
||||
for (ch = 0; ch < channels; ch++)
|
||||
block->fixed_coef[ch] = &s->fixed_coef_buffer[AC3_MAX_COEFS * (s->num_blocks * ch + blk)];
|
||||
@ -2405,7 +2405,7 @@ static av_cold int allocate_buffers(AC3EncodeContext *s)
|
||||
} else {
|
||||
for (blk = 0; blk < s->num_blocks; blk++) {
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
FF_ALLOCZ_OR_GOTO(avctx, block->fixed_coef, channels *
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, block->fixed_coef, channels,
|
||||
sizeof(*block->fixed_coef), alloc_fail);
|
||||
for (ch = 0; ch < channels; ch++)
|
||||
block->fixed_coef[ch] = (int32_t *)block->mdct_coef[ch];
|
||||
|
Loading…
Reference in New Issue
Block a user