comparison error_resilience.c @ 2444:a3e29f9ab677 libavcodec

count errors instead of printing 2^31
author michael
date Fri, 21 Jan 2005 23:47:03 +0000
parents 30d8b99e00f3
children 682c57163e60
comparison
equal deleted inserted replaced
2443:8d4708fabc06 2444:a3e29f9ab677
659 if(prev_status != (MV_END|DC_END|AC_END)) s->error_count= INT_MAX; 659 if(prev_status != (MV_END|DC_END|AC_END)) s->error_count= INT_MAX;
660 } 660 }
661 } 661 }
662 662
663 void ff_er_frame_end(MpegEncContext *s){ 663 void ff_er_frame_end(MpegEncContext *s){
664 int i, mb_x, mb_y, error, error_type; 664 int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error;
665 int distance; 665 int distance;
666 int threshold_part[4]= {100,100,100}; 666 int threshold_part[4]= {100,100,100};
667 int threshold= 50; 667 int threshold= 50;
668 int is_intra_likely; 668 int is_intra_likely;
669 int size = s->b8_stride * 2 * s->mb_height; 669 int size = s->b8_stride * 2 * s->mb_height;
670 Picture *pic= s->current_picture_ptr; 670 Picture *pic= s->current_picture_ptr;
671 671
672 if(!s->error_resilience || s->error_count==0 || 672 if(!s->error_resilience || s->error_count==0 ||
673 s->error_count==3*s->mb_width*(s->avctx->skip_top + s->avctx->skip_bottom)) return; 673 s->error_count==3*s->mb_width*(s->avctx->skip_top + s->avctx->skip_bottom)) return;
674 674
675 av_log(s->avctx, AV_LOG_INFO, "concealing %d errors\n", s->error_count);
676
677 if(s->current_picture.motion_val[0] == NULL){ 675 if(s->current_picture.motion_val[0] == NULL){
678 av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n"); 676 av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");
679 677
680 for(i=0; i<2; i++){ 678 for(i=0; i<2; i++){
681 pic->ref_index[i]= av_mallocz(size * sizeof(uint8_t)); 679 pic->ref_index[i]= av_mallocz(size * sizeof(uint8_t));
819 error|= AC_ERROR|DC_ERROR|MV_ERROR; 817 error|= AC_ERROR|DC_ERROR|MV_ERROR;
820 s->error_status_table[mb_xy]= error; 818 s->error_status_table[mb_xy]= error;
821 } 819 }
822 } 820 }
823 #endif 821 #endif
822
823 dc_error= ac_error= mv_error=0;
824 for(i=0; i<s->mb_num; i++){
825 const int mb_xy= s->mb_index2xy[i];
826 error= s->error_status_table[mb_xy];
827 if(error&DC_ERROR) dc_error ++;
828 if(error&AC_ERROR) ac_error ++;
829 if(error&MV_ERROR) mv_error ++;
830 }
831 av_log(s->avctx, AV_LOG_INFO, "concealing %d DC, %d AC, %d MV errors\n", dc_error, ac_error, mv_error);
832
824 is_intra_likely= is_intra_more_likely(s); 833 is_intra_likely= is_intra_more_likely(s);
825 834
826 /* set unknown mb-type to most likely */ 835 /* set unknown mb-type to most likely */
827 for(i=0; i<s->mb_num; i++){ 836 for(i=0; i<s->mb_num; i++){
828 const int mb_xy= s->mb_index2xy[i]; 837 const int mb_xy= s->mb_index2xy[i];