avcodec/error_resilience: cleanup mpeg2 handling

After this, the loop for the mpeg2 case is only executed when needed

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-05-24 20:29:10 +02:00
parent f8611ae1ef
commit b752d195cc
1 changed files with 12 additions and 11 deletions

View File

@ -917,19 +917,20 @@ void ff_er_frame_end(ERContext *s)
return;
}
linesize = s->cur_pic.f->linesize;
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
int status = s->error_status_table[mb_x + (s->mb_height - 1) * s->mb_stride];
if (status != 0x7F)
break;
}
if ( mb_x == s->mb_width
&& s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO
if ( s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO
&& (FFALIGN(s->avctx->height, 16)&16)
&& atomic_load(&s->error_count) == 3 * s->mb_width * (s->avctx->skip_top + s->avctx->skip_bottom + 1)
) {
av_log(s->avctx, AV_LOG_DEBUG, "ignoring last missing slice\n");
return;
&& atomic_load(&s->error_count) == 3 * s->mb_width * (s->avctx->skip_top + s->avctx->skip_bottom + 1)) {
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
int status = s->error_status_table[mb_x + (s->mb_height - 1) * s->mb_stride];
if (status != 0x7F)
break;
}
if (mb_x == s->mb_width) {
av_log(s->avctx, AV_LOG_DEBUG, "ignoring last missing slice\n");
return;
}
}
if (s->last_pic.f) {