1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avcodec/dnxhdenc: Use FF_ALLOCZ_ARRAY_OR_GOTO()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-09-10 22:29:14 +02:00
parent 743d489c9a
commit 7258b5eb65

View File

@ -133,10 +133,10 @@ static av_cold int dnxhd_init_vlc(DNXHDEncContext *ctx)
int i, j, level, run; int i, j, level, run;
int max_level = 1 << (ctx->cid_table->bit_depth + 2); int max_level = 1 << (ctx->cid_table->bit_depth + 2);
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_codes, FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->vlc_codes,
max_level * 4 * sizeof(*ctx->vlc_codes), fail); max_level, 4 * sizeof(*ctx->vlc_codes), fail);
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_bits, FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->vlc_bits,
max_level * 4 * sizeof(*ctx->vlc_bits), fail); max_level, 4 * sizeof(*ctx->vlc_bits), fail);
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_codes, FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_codes,
63 * 2, fail); 63 * 2, fail);
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_bits, FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_bits,
@ -197,15 +197,15 @@ static av_cold int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
const uint8_t *luma_weight_table = ctx->cid_table->luma_weight; const uint8_t *luma_weight_table = ctx->cid_table->luma_weight;
const uint8_t *chroma_weight_table = ctx->cid_table->chroma_weight; const uint8_t *chroma_weight_table = ctx->cid_table->chroma_weight;
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l, FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l,
(ctx->m.avctx->qmax + 1) * 64 * sizeof(int), fail); (ctx->m.avctx->qmax + 1), 64 * sizeof(int), fail);
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c, FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c,
(ctx->m.avctx->qmax + 1) * 64 * sizeof(int), fail); (ctx->m.avctx->qmax + 1), 64 * sizeof(int), fail);
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l16, FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l16,
(ctx->m.avctx->qmax + 1) * 64 * 2 * sizeof(uint16_t), (ctx->m.avctx->qmax + 1), 64 * 2 * sizeof(uint16_t),
fail); fail);
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c16, FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c16,
(ctx->m.avctx->qmax + 1) * 64 * 2 * sizeof(uint16_t), (ctx->m.avctx->qmax + 1), 64 * 2 * sizeof(uint16_t),
fail); fail);
if (ctx->cid_table->bit_depth == 8) { if (ctx->cid_table->bit_depth == 8) {
@ -271,10 +271,10 @@ fail:
static av_cold int dnxhd_init_rc(DNXHDEncContext *ctx) static av_cold int dnxhd_init_rc(DNXHDEncContext *ctx)
{ {
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160 * (ctx->m.avctx->qmax + 1) * sizeof(RCEntry), fail); FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->mb_rc, (ctx->m.avctx->qmax + 1), 8160 * sizeof(RCEntry), fail);
if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD) if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, FF_ALLOCZ_ARRAY_OR_GOTO(ctx->m.avctx, ctx->mb_cmp,
ctx->m.mb_num * sizeof(RCCMPEntry), fail); ctx->m.mb_num, sizeof(RCCMPEntry), fail);
ctx->frame_bits = (ctx->cid_table->coding_unit_size - ctx->frame_bits = (ctx->cid_table->coding_unit_size -
640 - 4 - ctx->min_padding) * 8; 640 - 4 - ctx->min_padding) * 8;