Revision d31dbec3 libavcodec/dnxhdenc.c

View differences:

libavcodec/dnxhdenc.c
55 55
    int i, j, level, run;
56 56
    int max_level = 1<<(ctx->cid_table->bit_depth+2);
57 57

  
58
    CHECKED_ALLOCZ(ctx->vlc_codes, max_level*4*sizeof(*ctx->vlc_codes));
59
    CHECKED_ALLOCZ(ctx->vlc_bits,  max_level*4*sizeof(*ctx->vlc_bits));
60
    CHECKED_ALLOCZ(ctx->run_codes, 63*2);
61
    CHECKED_ALLOCZ(ctx->run_bits,    63);
58
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_codes, max_level*4*sizeof(*ctx->vlc_codes), fail);
59
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_bits , max_level*4*sizeof(*ctx->vlc_bits ), fail);
60
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_codes, 63*2                               , fail);
61
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_bits , 63                                 , fail);
62 62

  
63 63
    ctx->vlc_codes += max_level*2;
64 64
    ctx->vlc_bits  += max_level*2;
......
111 111
    uint16_t weight_matrix[64] = {1,}; // convert_matrix needs uint16_t*
112 112
    int qscale, i;
113 113

  
114
    CHECKED_ALLOCZ(ctx->qmatrix_l,   (ctx->m.avctx->qmax+1) * 64 * sizeof(int));
115
    CHECKED_ALLOCZ(ctx->qmatrix_c,   (ctx->m.avctx->qmax+1) * 64 * sizeof(int));
116
    CHECKED_ALLOCZ(ctx->qmatrix_l16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t));
117
    CHECKED_ALLOCZ(ctx->qmatrix_c16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t));
114
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l,   (ctx->m.avctx->qmax+1) * 64 *     sizeof(int)     , fail);
115
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c,   (ctx->m.avctx->qmax+1) * 64 *     sizeof(int)     , fail);
116
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t), fail);
117
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t), fail);
118 118

  
119 119
    for (i = 1; i < 64; i++) {
120 120
        int j = ctx->m.dsp.idct_permutation[ff_zigzag_direct[i]];
......
142 142

  
143 143
static int dnxhd_init_rc(DNXHDEncContext *ctx)
144 144
{
145
    CHECKED_ALLOCZ(ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry));
145
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail);
146 146
    if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
147
        CHECKED_ALLOCZ(ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry));
147
        FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);
148 148

  
149 149
    ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8;
150 150
    ctx->qscale = 1;
......
203 203
    if (dnxhd_init_rc(ctx) < 0)
204 204
        return -1;
205 205

  
206
    CHECKED_ALLOCZ(ctx->slice_size, ctx->m.mb_height*sizeof(uint32_t));
207
    CHECKED_ALLOCZ(ctx->mb_bits,    ctx->m.mb_num   *sizeof(uint16_t));
208
    CHECKED_ALLOCZ(ctx->mb_qscale,  ctx->m.mb_num   *sizeof(uint8_t));
206
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->slice_size, ctx->m.mb_height*sizeof(uint32_t), fail);
207
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_bits,    ctx->m.mb_num   *sizeof(uint16_t), fail);
208
    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_qscale,  ctx->m.mb_num   *sizeof(uint8_t) , fail);
209 209

  
210 210
    ctx->frame.key_frame = 1;
211 211
    ctx->frame.pict_type = FF_I_TYPE;
......
228 228
    }
229 229

  
230 230
    return 0;
231
 fail: //for CHECKED_ALLOCZ
231
 fail: //for FF_ALLOCZ_OR_GOTO
232 232
    return -1;
233 233
}
234 234

  

Also available in: Unified diff