comparison mpegvideo.c @ 10137:9a670cfd1941 libavcodec

Rename CHECKED_ALLOC(Z) to FF_ALLOC(Z)_OR_GOTO and add context and label parameters.
author ramiro
date Sun, 06 Sep 2009 00:08:19 +0000
parents 6487152f17f2
children ce2cf9e32b09
comparison
equal deleted inserted replaced
10136:399b5d6b5439 10137:9a670cfd1941
241 s->uvlinesize= pic->linesize[1]; 241 s->uvlinesize= pic->linesize[1];
242 } 242 }
243 243
244 if(pic->qscale_table==NULL){ 244 if(pic->qscale_table==NULL){
245 if (s->encoding) { 245 if (s->encoding) {
246 CHECKED_ALLOCZ(pic->mb_var , mb_array_size * sizeof(int16_t)) 246 FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_var , mb_array_size * sizeof(int16_t) , fail)
247 CHECKED_ALLOCZ(pic->mc_mb_var, mb_array_size * sizeof(int16_t)) 247 FF_ALLOCZ_OR_GOTO(s->avctx, pic->mc_mb_var, mb_array_size * sizeof(int16_t) , fail)
248 CHECKED_ALLOCZ(pic->mb_mean , mb_array_size * sizeof(int8_t)) 248 FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_mean , mb_array_size * sizeof(int8_t ) , fail)
249 } 249 }
250 250
251 CHECKED_ALLOCZ(pic->mbskip_table , mb_array_size * sizeof(uint8_t)+2) //the +2 is for the slice end check 251 FF_ALLOCZ_OR_GOTO(s->avctx, pic->mbskip_table , mb_array_size * sizeof(uint8_t)+2, fail) //the +2 is for the slice end check
252 CHECKED_ALLOCZ(pic->qscale_table , mb_array_size * sizeof(uint8_t)) 252 FF_ALLOCZ_OR_GOTO(s->avctx, pic->qscale_table , mb_array_size * sizeof(uint8_t) , fail)
253 CHECKED_ALLOCZ(pic->mb_type_base , (big_mb_num + s->mb_stride) * sizeof(uint32_t)) 253 FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_type_base , (big_mb_num + s->mb_stride) * sizeof(uint32_t), fail)
254 pic->mb_type= pic->mb_type_base + 2*s->mb_stride+1; 254 pic->mb_type= pic->mb_type_base + 2*s->mb_stride+1;
255 if(s->out_format == FMT_H264){ 255 if(s->out_format == FMT_H264){
256 for(i=0; i<2; i++){ 256 for(i=0; i<2; i++){
257 CHECKED_ALLOCZ(pic->motion_val_base[i], 2 * (b4_array_size+4) * sizeof(int16_t)) 257 FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b4_array_size+4) * sizeof(int16_t), fail)
258 pic->motion_val[i]= pic->motion_val_base[i]+4; 258 pic->motion_val[i]= pic->motion_val_base[i]+4;
259 CHECKED_ALLOCZ(pic->ref_index[i], b8_array_size * sizeof(uint8_t)) 259 FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], b8_array_size * sizeof(uint8_t), fail)
260 } 260 }
261 pic->motion_subsample_log2= 2; 261 pic->motion_subsample_log2= 2;
262 }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF_DEBUG_MV) || (s->avctx->debug_mv)){ 262 }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF_DEBUG_MV) || (s->avctx->debug_mv)){
263 for(i=0; i<2; i++){ 263 for(i=0; i<2; i++){
264 CHECKED_ALLOCZ(pic->motion_val_base[i], 2 * (b8_array_size+4) * sizeof(int16_t)) 264 FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b8_array_size+4) * sizeof(int16_t), fail)
265 pic->motion_val[i]= pic->motion_val_base[i]+4; 265 pic->motion_val[i]= pic->motion_val_base[i]+4;
266 CHECKED_ALLOCZ(pic->ref_index[i], b8_array_size * sizeof(uint8_t)) 266 FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], b8_array_size * sizeof(uint8_t), fail)
267 } 267 }
268 pic->motion_subsample_log2= 3; 268 pic->motion_subsample_log2= 3;
269 } 269 }
270 if(s->avctx->debug&FF_DEBUG_DCT_COEFF) { 270 if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
271 CHECKED_ALLOCZ(pic->dct_coeff, 64 * mb_array_size * sizeof(DCTELEM)*6) 271 FF_ALLOCZ_OR_GOTO(s->avctx, pic->dct_coeff, 64 * mb_array_size * sizeof(DCTELEM)*6, fail)
272 } 272 }
273 pic->qstride= s->mb_stride; 273 pic->qstride= s->mb_stride;
274 CHECKED_ALLOCZ(pic->pan_scan , 1 * sizeof(AVPanScan)) 274 FF_ALLOCZ_OR_GOTO(s->avctx, pic->pan_scan , 1 * sizeof(AVPanScan), fail)
275 } 275 }
276 276
277 /* It might be nicer if the application would keep track of these 277 /* It might be nicer if the application would keep track of these
278 * but it would require an API change. */ 278 * but it would require an API change. */
279 memmove(s->prev_pict_types+1, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE-1); 279 memmove(s->prev_pict_types+1, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE-1);
280 s->prev_pict_types[0]= s->dropable ? FF_B_TYPE : s->pict_type; 280 s->prev_pict_types[0]= s->dropable ? FF_B_TYPE : s->pict_type;
281 if(pic->age < PREV_PICT_TYPES_BUFFER_SIZE && s->prev_pict_types[pic->age] == FF_B_TYPE) 281 if(pic->age < PREV_PICT_TYPES_BUFFER_SIZE && s->prev_pict_types[pic->age] == FF_B_TYPE)
282 pic->age= INT_MAX; // Skipped MBs in B-frames are quite rare in MPEG-1/2 and it is a bit tricky to skip them anyway. 282 pic->age= INT_MAX; // Skipped MBs in B-frames are quite rare in MPEG-1/2 and it is a bit tricky to skip them anyway.
283 283
284 return 0; 284 return 0;
285 fail: //for the CHECKED_ALLOCZ macro 285 fail: //for the FF_ALLOCZ_OR_GOTO macro
286 if(r>=0) 286 if(r>=0)
287 free_frame_buffer(s, pic); 287 free_frame_buffer(s, pic);
288 return -1; 288 return -1;
289 } 289 }
290 290
323 323
324 static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){ 324 static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){
325 int i; 325 int i;
326 326
327 // edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264) 327 // edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264)
328 CHECKED_ALLOCZ(s->allocated_edge_emu_buffer, (s->width+64)*2*21*2); //(width + edge + align)*interlaced*MBsize*tolerance 328 FF_ALLOCZ_OR_GOTO(s->avctx, s->allocated_edge_emu_buffer, (s->width+64)*2*21*2, fail); //(width + edge + align)*interlaced*MBsize*tolerance
329 s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21; 329 s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21;
330 330
331 //FIXME should be linesize instead of s->width*2 but that is not known before get_buffer() 331 //FIXME should be linesize instead of s->width*2 but that is not known before get_buffer()
332 CHECKED_ALLOCZ(s->me.scratchpad, (s->width+64)*4*16*2*sizeof(uint8_t)) 332 FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad, (s->width+64)*4*16*2*sizeof(uint8_t), fail)
333 s->me.temp= s->me.scratchpad; 333 s->me.temp= s->me.scratchpad;
334 s->rd_scratchpad= s->me.scratchpad; 334 s->rd_scratchpad= s->me.scratchpad;
335 s->b_scratchpad= s->me.scratchpad; 335 s->b_scratchpad= s->me.scratchpad;
336 s->obmc_scratchpad= s->me.scratchpad + 16; 336 s->obmc_scratchpad= s->me.scratchpad + 16;
337 if (s->encoding) { 337 if (s->encoding) {
338 CHECKED_ALLOCZ(s->me.map , ME_MAP_SIZE*sizeof(uint32_t)) 338 FF_ALLOCZ_OR_GOTO(s->avctx, s->me.map , ME_MAP_SIZE*sizeof(uint32_t), fail)
339 CHECKED_ALLOCZ(s->me.score_map, ME_MAP_SIZE*sizeof(uint32_t)) 339 FF_ALLOCZ_OR_GOTO(s->avctx, s->me.score_map, ME_MAP_SIZE*sizeof(uint32_t), fail)
340 if(s->avctx->noise_reduction){ 340 if(s->avctx->noise_reduction){
341 CHECKED_ALLOCZ(s->dct_error_sum, 2 * 64 * sizeof(int)) 341 FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_error_sum, 2 * 64 * sizeof(int), fail)
342 } 342 }
343 } 343 }
344 CHECKED_ALLOCZ(s->blocks, 64*12*2 * sizeof(DCTELEM)) 344 FF_ALLOCZ_OR_GOTO(s->avctx, s->blocks, 64*12*2 * sizeof(DCTELEM), fail)
345 s->block= s->blocks[0]; 345 s->block= s->blocks[0];
346 346
347 for(i=0;i<12;i++){ 347 for(i=0;i<12;i++){
348 s->pblocks[i] = &s->block[i]; 348 s->pblocks[i] = &s->block[i];
349 } 349 }
507 + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16) 507 + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16)
508 + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24); 508 + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24);
509 509
510 s->avctx->coded_frame= (AVFrame*)&s->current_picture; 510 s->avctx->coded_frame= (AVFrame*)&s->current_picture;
511 511
512 CHECKED_ALLOCZ(s->mb_index2xy, (s->mb_num+1)*sizeof(int)) //error ressilience code looks cleaner with this 512 FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num+1)*sizeof(int), fail) //error ressilience code looks cleaner with this
513 for(y=0; y<s->mb_height; y++){ 513 for(y=0; y<s->mb_height; y++){
514 for(x=0; x<s->mb_width; x++){ 514 for(x=0; x<s->mb_width; x++){
515 s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride; 515 s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride;
516 } 516 }
517 } 517 }
518 s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed? 518 s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed?
519 519
520 if (s->encoding) { 520 if (s->encoding) {
521 /* Allocate MV tables */ 521 /* Allocate MV tables */
522 CHECKED_ALLOCZ(s->p_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) 522 FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)
523 CHECKED_ALLOCZ(s->b_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) 523 FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)
524 CHECKED_ALLOCZ(s->b_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) 524 FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)
525 CHECKED_ALLOCZ(s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) 525 FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)
526 CHECKED_ALLOCZ(s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) 526 FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)
527 CHECKED_ALLOCZ(s->b_direct_mv_table_base , mv_table_size * 2 * sizeof(int16_t)) 527 FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)
528 s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1; 528 s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1;
529 s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1; 529 s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1;
530 s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1; 530 s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1;
531 s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1; 531 s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1;
532 s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1; 532 s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1;
533 s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1; 533 s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1;
534 534
535 if(s->msmpeg4_version){ 535 if(s->msmpeg4_version){
536 CHECKED_ALLOCZ(s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int)); 536 FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int), fail);
537 } 537 }
538 CHECKED_ALLOCZ(s->avctx->stats_out, 256); 538 FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);
539 539
540 /* Allocate MB type table */ 540 /* Allocate MB type table */
541 CHECKED_ALLOCZ(s->mb_type , mb_array_size * sizeof(uint16_t)) //needed for encoding 541 FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type , mb_array_size * sizeof(uint16_t), fail) //needed for encoding
542 542
543 CHECKED_ALLOCZ(s->lambda_table, mb_array_size * sizeof(int)) 543 FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail)
544 544
545 CHECKED_ALLOCZ(s->q_intra_matrix, 64*32 * sizeof(int)) 545 FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix , 64*32 * sizeof(int), fail)
546 CHECKED_ALLOCZ(s->q_inter_matrix, 64*32 * sizeof(int)) 546 FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix , 64*32 * sizeof(int), fail)
547 CHECKED_ALLOCZ(s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t)) 547 FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t), fail)
548 CHECKED_ALLOCZ(s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t)) 548 FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t), fail)
549 CHECKED_ALLOCZ(s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*)) 549 FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail)
550 CHECKED_ALLOCZ(s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*)) 550 FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail)
551 551
552 if(s->avctx->noise_reduction){ 552 if(s->avctx->noise_reduction){
553 CHECKED_ALLOCZ(s->dct_offset, 2 * 64 * sizeof(uint16_t)) 553 FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset, 2 * 64 * sizeof(uint16_t), fail)
554 } 554 }
555 } 555 }
556 CHECKED_ALLOCZ(s->picture, MAX_PICTURE_COUNT * sizeof(Picture)) 556 FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail)
557 for(i = 0; i < MAX_PICTURE_COUNT; i++) { 557 for(i = 0; i < MAX_PICTURE_COUNT; i++) {
558 avcodec_get_frame_defaults((AVFrame *)&s->picture[i]); 558 avcodec_get_frame_defaults((AVFrame *)&s->picture[i]);
559 } 559 }
560 560
561 CHECKED_ALLOCZ(s->error_status_table, mb_array_size*sizeof(uint8_t)) 561 FF_ALLOCZ_OR_GOTO(s->avctx, s->error_status_table, mb_array_size*sizeof(uint8_t), fail)
562 562
563 if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){ 563 if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){
564 /* interlaced direct mode decoding tables */ 564 /* interlaced direct mode decoding tables */
565 for(i=0; i<2; i++){ 565 for(i=0; i<2; i++){
566 int j, k; 566 int j, k;
567 for(j=0; j<2; j++){ 567 for(j=0; j<2; j++){
568 for(k=0; k<2; k++){ 568 for(k=0; k<2; k++){
569 CHECKED_ALLOCZ(s->b_field_mv_table_base[i][j][k] , mv_table_size * 2 * sizeof(int16_t)) 569 FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_mv_table_base[i][j][k], mv_table_size * 2 * sizeof(int16_t), fail)
570 s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1; 570 s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1;
571 } 571 }
572 CHECKED_ALLOCZ(s->b_field_select_table[i][j] , mb_array_size * 2 * sizeof(uint8_t)) 572 FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail)
573 CHECKED_ALLOCZ(s->p_field_mv_table_base[i][j] , mv_table_size * 2 * sizeof(int16_t)) 573 FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail)
574 s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1; 574 s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j]+ s->mb_stride + 1;
575 } 575 }
576 CHECKED_ALLOCZ(s->p_field_select_table[i] , mb_array_size * 2 * sizeof(uint8_t)) 576 FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail)
577 } 577 }
578 } 578 }
579 if (s->out_format == FMT_H263) { 579 if (s->out_format == FMT_H263) {
580 /* ac values */ 580 /* ac values */
581 CHECKED_ALLOCZ(s->ac_val_base, yc_size * sizeof(int16_t) * 16); 581 FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_val_base, yc_size * sizeof(int16_t) * 16, fail);
582 s->ac_val[0] = s->ac_val_base + s->b8_stride + 1; 582 s->ac_val[0] = s->ac_val_base + s->b8_stride + 1;
583 s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1; 583 s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1;
584 s->ac_val[2] = s->ac_val[1] + c_size; 584 s->ac_val[2] = s->ac_val[1] + c_size;
585 585
586 /* cbp values */ 586 /* cbp values */
587 CHECKED_ALLOCZ(s->coded_block_base, y_size); 587 FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail);
588 s->coded_block= s->coded_block_base + s->b8_stride + 1; 588 s->coded_block= s->coded_block_base + s->b8_stride + 1;
589 589
590 /* cbp, ac_pred, pred_dir */ 590 /* cbp, ac_pred, pred_dir */
591 CHECKED_ALLOCZ(s->cbp_table , mb_array_size * sizeof(uint8_t)) 591 FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table , mb_array_size * sizeof(uint8_t), fail)
592 CHECKED_ALLOCZ(s->pred_dir_table, mb_array_size * sizeof(uint8_t)) 592 FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail)
593 } 593 }
594 594
595 if (s->h263_pred || s->h263_plus || !s->encoding) { 595 if (s->h263_pred || s->h263_plus || !s->encoding) {
596 /* dc values */ 596 /* dc values */
597 //MN: we need these for error resilience of intra-frames 597 //MN: we need these for error resilience of intra-frames
598 CHECKED_ALLOCZ(s->dc_val_base, yc_size * sizeof(int16_t)); 598 FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail);
599 s->dc_val[0] = s->dc_val_base + s->b8_stride + 1; 599 s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
600 s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1; 600 s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
601 s->dc_val[2] = s->dc_val[1] + c_size; 601 s->dc_val[2] = s->dc_val[1] + c_size;
602 for(i=0;i<yc_size;i++) 602 for(i=0;i<yc_size;i++)
603 s->dc_val_base[i] = 1024; 603 s->dc_val_base[i] = 1024;
604 } 604 }
605 605
606 /* which mb is a intra block */ 606 /* which mb is a intra block */
607 CHECKED_ALLOCZ(s->mbintra_table, mb_array_size); 607 FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail);
608 memset(s->mbintra_table, 1, mb_array_size); 608 memset(s->mbintra_table, 1, mb_array_size);
609 609
610 /* init macroblock skip table */ 610 /* init macroblock skip table */
611 CHECKED_ALLOCZ(s->mbskip_table, mb_array_size+2); 611 FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size+2, fail);
612 //Note the +1 is for a quicker mpeg4 slice_end detection 612 //Note the +1 is for a quicker mpeg4 slice_end detection
613 CHECKED_ALLOCZ(s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE); 613 FF_ALLOCZ_OR_GOTO(s->avctx, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE, fail);
614 614
615 s->parse_context.state= -1; 615 s->parse_context.state= -1;
616 if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ 616 if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){
617 s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); 617 s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);
618 s->visualization_buffer[1] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); 618 s->visualization_buffer[1] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);