Signed-off-by: Anton Khirnov <anton@khirnov.net>tags/n0.10
| @@ -703,7 +703,7 @@ static int is_intra_more_likely(MpegEncContext *s){ | |||||
| } | } | ||||
| void ff_er_frame_start(MpegEncContext *s){ | void ff_er_frame_start(MpegEncContext *s){ | ||||
| if(!s->error_recognition) return; | |||||
| if(!s->err_recognition) return; | |||||
| memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_stride*s->mb_height*sizeof(uint8_t)); | memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_stride*s->mb_height*sizeof(uint8_t)); | ||||
| s->error_count= 3*s->mb_num; | s->error_count= 3*s->mb_num; | ||||
| @@ -731,7 +731,7 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en | |||||
| return; | return; | ||||
| } | } | ||||
| if(!s->error_recognition) return; | |||||
| if(!s->err_recognition) return; | |||||
| mask &= ~VP_START; | mask &= ~VP_START; | ||||
| if(status & (AC_ERROR|AC_END)){ | if(status & (AC_ERROR|AC_END)){ | ||||
| @@ -787,7 +787,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||||
| int size = s->b8_stride * 2 * s->mb_height; | int size = s->b8_stride * 2 * s->mb_height; | ||||
| Picture *pic= s->current_picture_ptr; | Picture *pic= s->current_picture_ptr; | ||||
| if(!s->error_recognition || s->error_count==0 || s->avctx->lowres || | |||||
| if(!s->err_recognition || s->error_count==0 || s->avctx->lowres || | |||||
| s->avctx->hwaccel || | s->avctx->hwaccel || | ||||
| s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU || | s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU || | ||||
| s->picture_structure != PICT_FRAME || // we do not support ER of field pictures yet, though it should not crash if enabled | s->picture_structure != PICT_FRAME || // we do not support ER of field pictures yet, though it should not crash if enabled | ||||
| @@ -859,7 +859,7 @@ void ff_er_frame_end(MpegEncContext *s){ | |||||
| } | } | ||||
| /* handle missing slices */ | /* handle missing slices */ | ||||
| if(s->error_recognition>=4){ | |||||
| if(s->err_recognition&AV_EF_EXPLODE){ | |||||
| int end_ok=1; | int end_ok=1; | ||||
| for(i=s->mb_num-2; i>=s->mb_width+100; i--){ //FIXME +100 hack | for(i=s->mb_num-2; i>=s->mb_width+100; i--){ //FIXME +100 hack | ||||
| @@ -310,7 +310,7 @@ static int decode_slice(MpegEncContext *s){ | |||||
| max_extra+= 17; | max_extra+= 17; | ||||
| /* buggy padding but the frame should still end approximately at the bitstream end */ | /* buggy padding but the frame should still end approximately at the bitstream end */ | ||||
| if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_recognition>=3) | |||||
| if((s->workaround_bugs&FF_BUG_NO_PADDING) && (s->err_recognition&AV_EF_BUFFER)) | |||||
| max_extra+= 48; | max_extra+= 48; | ||||
| else if((s->workaround_bugs&FF_BUG_NO_PADDING)) | else if((s->workaround_bugs&FF_BUG_NO_PADDING)) | ||||
| max_extra+= 256*256*256*64; | max_extra+= 256*256*256*64; | ||||
| @@ -3704,7 +3704,7 @@ static int execute_decode_slices(H264Context *h, int context_count){ | |||||
| } else { | } else { | ||||
| for(i = 1; i < context_count; i++) { | for(i = 1; i < context_count; i++) { | ||||
| hx = h->thread_context[i]; | hx = h->thread_context[i]; | ||||
| hx->s.error_recognition = avctx->error_recognition; | |||||
| hx->s.err_recognition = avctx->err_recognition; | |||||
| hx->s.error_count = 0; | hx->s.error_count = 0; | ||||
| } | } | ||||
| @@ -484,7 +484,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block, | |||||
| level = get_bits(&s->gb, 8); | level = get_bits(&s->gb, 8); | ||||
| if((level&0x7F) == 0){ | if((level&0x7F) == 0){ | ||||
| av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y); | av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y); | ||||
| if(s->error_recognition >= FF_ER_COMPLIANT) | |||||
| if(s->err_recognition & AV_EF_BITSTREAM) | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| if (level == 255) | if (level == 255) | ||||
| @@ -174,7 +174,7 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *di | |||||
| }else{ | }else{ | ||||
| level += pred; | level += pred; | ||||
| ret= level; | ret= level; | ||||
| if(s->error_recognition>=3){ | |||||
| if(s->err_recognition&AV_EF_BITSTREAM){ | |||||
| if(level<0){ | if(level<0){ | ||||
| av_log(s->avctx, AV_LOG_ERROR, "dc<0 at %dx%d\n", s->mb_x, s->mb_y); | av_log(s->avctx, AV_LOG_ERROR, "dc<0 at %dx%d\n", s->mb_x, s->mb_y); | ||||
| return -1; | return -1; | ||||
| @@ -520,7 +520,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) | |||||
| if (code > 8){ | if (code > 8){ | ||||
| if(get_bits1(&s->gb)==0){ /* marker */ | if(get_bits1(&s->gb)==0){ /* marker */ | ||||
| if(s->error_recognition>=2){ | |||||
| if(s->err_recognition&AV_EF_BITSTREAM){ | |||||
| av_log(s->avctx, AV_LOG_ERROR, "dc marker bit missing\n"); | av_log(s->avctx, AV_LOG_ERROR, "dc marker bit missing\n"); | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| @@ -994,7 +994,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, | |||||
| else level= level * qmul - qadd; | else level= level * qmul - qadd; | ||||
| if((unsigned)(level + 2048) > 4095){ | if((unsigned)(level + 2048) > 4095){ | ||||
| if(s->error_recognition > FF_ER_COMPLIANT){ | |||||
| if(s->err_recognition & AV_EF_BITSTREAM){ | |||||
| if(level > 2560 || level<-2560){ | if(level > 2560 || level<-2560){ | ||||
| av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc, qp=%d\n", s->qscale); | av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc, qp=%d\n", s->qscale); | ||||
| return -1; | return -1; | ||||
| @@ -1305,7 +1305,7 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) | |||||
| } | } | ||||
| } | } | ||||
| s->error_recognition= avctx->error_recognition; | |||||
| s->err_recognition = avctx->err_recognition; | |||||
| /* set dequantizer, we can't do it during init as it might change for mpeg4 | /* set dequantizer, we can't do it during init as it might change for mpeg4 | ||||
| and we can't do it in the header decode as init is not called for mpeg4 there yet */ | and we can't do it in the header decode as init is not called for mpeg4 there yet */ | ||||
| @@ -487,7 +487,7 @@ typedef struct MpegEncContext { | |||||
| GetBitContext last_resync_gb; ///< used to search for the next resync marker | GetBitContext last_resync_gb; ///< used to search for the next resync marker | ||||
| int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only) | int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only) | ||||
| int next_p_frame_damaged; ///< set if the next p frame is damaged, to avoid showing trashed b frames | int next_p_frame_damaged; ///< set if the next p frame is damaged, to avoid showing trashed b frames | ||||
| int error_recognition; | |||||
| int err_recognition; | |||||
| ParseContext parse_context; | ParseContext parse_context; | ||||
| @@ -1810,7 +1810,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, | |||||
| i-= 192; | i-= 192; | ||||
| if(i&(~63)){ | if(i&(~63)){ | ||||
| const int left= get_bits_left(&s->gb); | const int left= get_bits_left(&s->gb); | ||||
| if(((i+192 == 64 && level/qmul==-1) || s->error_recognition<=1) && left>=0){ | |||||
| if(((i+192 == 64 && level/qmul==-1) || !(s->err_recognition&AV_EF_BITSTREAM)) && left>=0){ | |||||
| av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y); | av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y); | ||||
| break; | break; | ||||
| }else{ | }else{ | ||||