diff --git a/ffplay.c b/ffplay.c index 7fe54924c6..5bb3e09af1 100644 --- a/ffplay.c +++ b/ffplay.c @@ -207,7 +207,7 @@ static int idct = FF_IDCT_AUTO; static enum AVDiscard skip_frame= AVDISCARD_DEFAULT; static enum AVDiscard skip_idct= AVDISCARD_DEFAULT; static enum AVDiscard skip_loop_filter= AVDISCARD_DEFAULT; -static int error_resilience = FF_ER_CAREFUL; +static int error_recognition = FF_ER_CAREFUL; static int error_concealment = 3; static int decoder_reorder_pts= 0; @@ -1734,7 +1734,7 @@ static int stream_component_open(VideoState *is, int stream_index) enc->skip_frame= skip_frame; enc->skip_idct= skip_idct; enc->skip_loop_filter= skip_loop_filter; - enc->error_resilience= error_resilience; + enc->error_recognition= error_recognition; enc->error_concealment= error_concealment; if (!codec || avcodec_open(enc, codec) < 0) @@ -2489,7 +2489,7 @@ static const OptionDef options[] = { { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&skip_frame}, "", "" }, { "skipidct", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&skip_idct}, "", "" }, { "idct", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&idct}, "set idct algo", "algo" }, - { "er", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_resilience}, "set error detection threshold (0-4)", "threshold" }, + { "er", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_recognition}, "set error detection threshold (0-4)", "threshold" }, { "ec", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_concealment}, "set error concealment options", "bit_mask" }, { "sync", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" }, { "threads", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" }, diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 1a22126d8c..5e568a9ae7 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -216,7 +216,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) s->downmixed = 1; /* allocate context input buffer */ - if (avctx->error_resilience >= FF_ER_CAREFUL) { + if (avctx->error_recognition >= FF_ER_CAREFUL) { s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); if (!s->input_buffer) return AVERROR_NOMEM; @@ -1186,7 +1186,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, } /* check for crc mismatch */ - if(err != AC3_PARSE_ERROR_FRAME_SIZE && avctx->error_resilience >= FF_ER_CAREFUL) { + if(err != AC3_PARSE_ERROR_FRAME_SIZE && avctx->error_recognition >= FF_ER_CAREFUL) { if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) { av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n"); err = AC3_PARSE_ERROR_CRC; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 73d90f52e7..c7e1b648bf 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1136,12 +1136,12 @@ typedef struct AVCodecContext { float b_quant_offset; /** - * Error resilience; higher values will detect more errors but may + * Error recognization; higher values will detect more errors but may * misdetect some more or less valid parts as errors. * - encoding: unused * - decoding: Set by user. */ - int error_resilience; + int error_recognition; #define FF_ER_CAREFUL 1 #define FF_ER_COMPLIANT 2 #define FF_ER_AGGRESSIVE 3 diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 59254a4146..381ae27171 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -603,7 +603,7 @@ static int is_intra_more_likely(MpegEncContext *s){ } void ff_er_frame_start(MpegEncContext *s){ - if(!s->error_resilience) return; + if(!s->error_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)); s->error_count= 3*s->mb_num; @@ -627,7 +627,7 @@ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int en return; } - if(!s->error_resilience) return; + if(!s->error_recognition) return; mask &= ~VP_START; if(status & (AC_ERROR|AC_END)){ @@ -680,7 +680,7 @@ void ff_er_frame_end(MpegEncContext *s){ int size = s->b8_stride * 2 * s->mb_height; Picture *pic= s->current_picture_ptr; - if(!s->error_resilience || s->error_count==0 || + if(!s->error_recognition || s->error_count==0 || s->error_count==3*s->mb_width*(s->avctx->skip_top + s->avctx->skip_bottom)) return; if(s->current_picture.motion_val[0] == NULL){ @@ -756,7 +756,7 @@ void ff_er_frame_end(MpegEncContext *s){ } #endif /* handle missing slices */ - if(s->error_resilience>=4){ + if(s->error_recognition>=4){ int end_ok=1; for(i=s->mb_num-2; i>=s->mb_width+100; i--){ //FIXME +100 hack diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 5369830c47..3f21eb8263 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -135,7 +135,7 @@ static int h261_decode_gob_header(H261Context *h){ if(s->qscale==0) { av_log(s->avctx, AV_LOG_ERROR, "qscale has forbidden 0 value\n"); - if (s->avctx->error_resilience >= FF_ER_COMPLIANT) + if (s->avctx->error_recognition >= FF_ER_COMPLIANT) return -1; } diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 95ad1f3ed1..e490995742 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -2569,7 +2569,7 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *di }else{ level += pred; ret= level; - if(s->error_resilience>=3){ + if(s->error_recognition>=3){ if(level<0){ av_log(s->avctx, AV_LOG_ERROR, "dc<0 at %dx%d\n", s->mb_x, s->mb_y); return -1; @@ -4588,7 +4588,7 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * block, level = get_bits(&s->gb, 8); 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); - if(s->error_resilience >= FF_ER_COMPLIANT) + if(s->error_recognition >= FF_ER_COMPLIANT) return -1; } if (level == 255) @@ -4708,7 +4708,7 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr) if (code > 8){ if(get_bits1(&s->gb)==0){ /* marker */ - if(s->error_resilience>=2){ + if(s->error_recognition>=2){ av_log(s->avctx, AV_LOG_ERROR, "dc marker bit missing\n"); return -1; } @@ -4874,7 +4874,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, } #if 0 - if(s->error_resilience >= FF_ER_COMPLIANT){ + if(s->error_recognition >= FF_ER_COMPLIANT){ const int abs_level= FFABS(level); if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ const int run1= run - rl->max_run[last][abs_level] - 1; @@ -4882,7 +4882,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n"); return -1; } - if(s->error_resilience > FF_ER_COMPLIANT){ + if(s->error_recognition > FF_ER_COMPLIANT){ if(abs_level <= rl->max_level[last][run]*2){ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n"); return -1; @@ -4899,7 +4899,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, else level= level * qmul - qadd; if((unsigned)(level + 2048) > 4095){ - if(s->error_resilience > FF_ER_COMPLIANT){ + if(s->error_recognition > FF_ER_COMPLIANT){ if(level > 2560 || level<-2560){ av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc, qp=%d\n", s->qscale); return -1; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index de1f146c3c..5603ec543a 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -295,7 +295,7 @@ static int decode_slice(MpegEncContext *s){ max_extra+= 17; /* buggy padding but the frame should still end approximately at the bitstream end */ - if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_resilience>=3) + if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_recognition>=3) max_extra+= 48; else if((s->workaround_bugs&FF_BUG_NO_PADDING)) max_extra+= 256*256*256*64; diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 98866c77af..e888f76100 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -7255,7 +7255,7 @@ static void execute_decode_slices(H264Context *h, int context_count){ } else { for(i = 1; i < context_count; i++) { hx = h->thread_context[i]; - hx->s.error_resilience = avctx->error_resilience; + hx->s.error_recognition = avctx->error_recognition; hx->s.error_count = 0; } diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 966fa48901..54779ac9d7 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1344,7 +1344,7 @@ static int mpeg1_decode_picture(AVCodecContext *avctx, if (s->pict_type == FF_P_TYPE || s->pict_type == FF_B_TYPE) { s->full_pel[0] = get_bits1(&s->gb); f_code = get_bits(&s->gb, 3); - if (f_code == 0 && avctx->error_resilience >= FF_ER_COMPLIANT) + if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT) return -1; s->mpeg_f_code[0][0] = f_code; s->mpeg_f_code[0][1] = f_code; @@ -1352,7 +1352,7 @@ static int mpeg1_decode_picture(AVCodecContext *avctx, if (s->pict_type == FF_B_TYPE) { s->full_pel[1] = get_bits1(&s->gb); f_code = get_bits(&s->gb, 3); - if (f_code == 0 && avctx->error_resilience >= FF_ER_COMPLIANT) + if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT) return -1; s->mpeg_f_code[1][0] = f_code; s->mpeg_f_code[1][1] = f_code; @@ -1776,7 +1776,7 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y, && s->progressive_frame == 0 /* vbv_delay == 0xBBB || 0xE10*/; if(left < 0 || (left && show_bits(&s->gb, FFMIN(left, 23)) && !is_d10) - || (avctx->error_resilience >= FF_ER_AGGRESSIVE && left>8)){ + || (avctx->error_recognition >= FF_ER_AGGRESSIVE && left>8)){ av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d %0X\n", left, show_bits(&s->gb, FFMIN(left, 23))); return -1; }else @@ -1947,7 +1947,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, s->aspect_ratio_info= get_bits(&s->gb, 4); if (s->aspect_ratio_info == 0) { av_log(avctx, AV_LOG_ERROR, "aspect ratio has forbidden 0 value\n"); - if (avctx->error_resilience >= FF_ER_COMPLIANT) + if (avctx->error_recognition >= FF_ER_COMPLIANT) return -1; } s->frame_rate_index = get_bits(&s->gb, 4); diff --git a/libavcodec/mpegaudio.h b/libavcodec/mpegaudio.h index bf79d3b58c..21de2da20d 100644 --- a/libavcodec/mpegaudio.h +++ b/libavcodec/mpegaudio.h @@ -116,7 +116,7 @@ typedef struct MPADecodeContext { void (*compute_antialias)(struct MPADecodeContext *s, struct GranuleDef *g); int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3 int dither_state; - int error_resilience; + int error_recognition; AVCodecContext* avctx; } MPADecodeContext; diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 34538797fb..ce80217546 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -327,7 +327,7 @@ static int decode_init(AVCodecContext * avctx) #else avctx->sample_fmt= SAMPLE_FMT_S16; #endif - s->error_resilience= avctx->error_resilience; + s->error_recognition= avctx->error_recognition; if(avctx->antialias_algo != FF_AA_FLOAT) s->compute_antialias= compute_antialias_integer; @@ -1565,7 +1565,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, s_index -= 4; skip_bits_long(&s->gb, last_pos - pos); av_log(s->avctx, AV_LOG_INFO, "overread, skip %d enddists: %d %d\n", last_pos - pos, end_pos-pos, end_pos2-pos); - if(s->error_resilience >= FF_ER_COMPLIANT) + if(s->error_recognition >= FF_ER_COMPLIANT) s_index=0; break; } @@ -1602,7 +1602,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, if (bits_left < 0/* || bits_left > 500*/) { av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); s_index=0; - }else if(bits_left > 0 && s->error_resilience >= FF_ER_AGGRESSIVE){ + }else if(bits_left > 0 && s->error_recognition >= FF_ER_AGGRESSIVE){ av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); s_index=0; } diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 845bc39b83..ce52a0cabc 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -915,7 +915,7 @@ alloc: } s->hurry_up= s->avctx->hurry_up; - s->error_resilience= avctx->error_resilience; + s->error_recognition= avctx->error_recognition; /* 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 */ diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index d2c46e31cb..86247c2ce1 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -479,7 +479,7 @@ typedef struct MpegEncContext { 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 next_p_frame_damaged; ///< set if the next p frame is damaged, to avoid showing trashed b frames - int error_resilience; + int error_recognition; ParseContext parse_context; diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 16fdd8608c..5165d25c88 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -1822,7 +1822,7 @@ int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, i-= 192; if(i&(~63)){ const int left= s->gb.size_in_bits - get_bits_count(&s->gb); - if(((i+192 == 64 && level/qmul==-1) || s->error_resilience<=1) && left>=0){ + if(((i+192 == 64 && level/qmul==-1) || s->error_recognition<=1) && left>=0){ av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y); break; }else{ diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 6b86e554a6..cf00d2552c 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -499,7 +499,7 @@ static const AVOption options[]={ {"inofficial", "allow inofficial extensions", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_INOFFICIAL, INT_MIN, INT_MAX, V|D|E, "strict"}, {"experimental", "allow non standardized experimental things", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_EXPERIMENTAL, INT_MIN, INT_MAX, V|D|E, "strict"}, {"b_qoffset", "qp offset between P and B frames", OFFSET(b_quant_offset), FF_OPT_TYPE_FLOAT, 1.25, -FLT_MAX, FLT_MAX, V|E}, -{"er", "set error resilience strategy", OFFSET(error_resilience), FF_OPT_TYPE_INT, FF_ER_CAREFUL, INT_MIN, INT_MAX, A|V|D, "er"}, +{"er", "set error detection aggressivity", OFFSET(error_recognition), FF_OPT_TYPE_INT, FF_ER_CAREFUL, INT_MIN, INT_MAX, A|V|D, "er"}, {"careful", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"}, {"compliant", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_COMPLIANT, INT_MIN, INT_MAX, V|D, "er"}, {"aggressive", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_AGGRESSIVE, INT_MIN, INT_MAX, V|D, "er"}, @@ -575,7 +575,7 @@ static const AVOption options[]={ {"skip", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_SKIP, INT_MIN, INT_MAX, V|D, "debug"}, {"startcode", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_STARTCODE, INT_MIN, INT_MAX, V|D, "debug"}, {"pts", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_PTS, INT_MIN, INT_MAX, V|D, "debug"}, -{"er", "error resilience", 0, FF_OPT_TYPE_CONST, FF_DEBUG_ER, INT_MIN, INT_MAX, V|D, "debug"}, +{"er", "error recognition", 0, FF_OPT_TYPE_CONST, FF_DEBUG_ER, INT_MIN, INT_MAX, V|D, "debug"}, {"mmco", "memory management control operations (H.264)", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MMCO, INT_MIN, INT_MAX, V|D, "debug"}, {"bugs", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUGS, INT_MIN, INT_MAX, V|D, "debug"}, {"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_QP, INT_MIN, INT_MAX, V|D, "debug"},