| 908 | } |
| 909 | |
| 910 | void ff_er_frame_end(ERContext *s, int *decode_error_flags) |
| 911 | { |
| 912 | int *linesize = NULL; |
| 913 | int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error; |
| 914 | int distance; |
| 915 | int threshold_part[4] = { 100, 100, 100 }; |
| 916 | int threshold = 50; |
| 917 | int is_intra_likely; |
| 918 | int size = s->b8_stride * 2 * s->mb_height; |
| 919 | int guessed_mb_type; |
| 920 | |
| 921 | /* We do not support ER of field pictures yet, |
| 922 | * though it should not crash if enabled. */ |
| 923 | if (!s->avctx->error_concealment || !atomic_load(&s->error_count) || |
| 924 | s->avctx->lowres || |
| 925 | !er_supported(s) || |
| 926 | atomic_load(&s->error_count) == 3 * s->mb_width * |
| 927 | (s->avctx->skip_top + s->avctx->skip_bottom)) { |
| 928 | return; |
| 929 | } |
| 930 | linesize = s->cur_pic.f->linesize; |
| 931 | |
| 932 | if ( s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO |
| 933 | && (FFALIGN(s->avctx->height, 16)&16) |
| 934 | && atomic_load(&s->error_count) == 3 * s->mb_width * (s->avctx->skip_top + s->avctx->skip_bottom + 1)) { |
| 935 | for (mb_x = 0; mb_x < s->mb_width; mb_x++) { |
| 936 | int status = s->error_status_table[mb_x + (s->mb_height - 1) * s->mb_stride]; |
| 937 | if (status != 0x7F) |
| 938 | break; |
| 939 | } |
| 940 | |
| 941 | if (mb_x == s->mb_width) { |
| 942 | av_log(s->avctx, AV_LOG_DEBUG, "ignoring last missing slice\n"); |
| 943 | return; |
| 944 | } |
| 945 | } |
| 946 | |
| 947 | if (s->last_pic.f) { |
| 948 | if (s->last_pic.f->width != s->cur_pic.f->width || |
| 949 | s->last_pic.f->height != s->cur_pic.f->height || |
| 950 | s->last_pic.f->format != s->cur_pic.f->format) { |
| 951 | av_log(s->avctx, AV_LOG_WARNING, "Cannot use previous picture in error concealment\n"); |
| 952 | memset(&s->last_pic, 0, sizeof(s->last_pic)); |
| 953 | } |
| 954 | } |
| 955 | if (s->next_pic.f) { |
| 956 | if (s->next_pic.f->width != s->cur_pic.f->width || |
| 957 | s->next_pic.f->height != s->cur_pic.f->height || |
| 958 | s->next_pic.f->format != s->cur_pic.f->format) { |
| 959 | av_log(s->avctx, AV_LOG_WARNING, "Cannot use next picture in error concealment\n"); |
| 960 | memset(&s->next_pic, 0, sizeof(s->next_pic)); |
| 961 | } |
| 962 | } |
| 963 | |
| 964 | if (!s->cur_pic.motion_val[0] || !s->cur_pic.ref_index[0]) { |
| 965 | av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n"); |
| 966 | |
| 967 | for (i = 0; i < 2; i++) { |
no test coverage detected