diff mbox series

[FFmpeg-devel,1/2] avcodec/error_resilience: cleanup mpeg2 handling

Message ID 20210524204355.6312-1-michael@niedermayer.cc
State Accepted
Commit b752d195cc527c0147bad97767632de75e1be0d9
Headers show
Series [FFmpeg-devel,1/2] avcodec/error_resilience: cleanup mpeg2 handling | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer May 24, 2021, 8:43 p.m. UTC
After this, the loop for the mpeg2 case is only executed when needed

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/error_resilience.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

Comments

Michael Niedermayer May 27, 2021, 3:42 p.m. UTC | #1
On Mon, May 24, 2021 at 10:43:54PM +0200, Michael Niedermayer wrote:
> After this, the loop for the mpeg2 case is only executed when needed
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/error_resilience.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index ca2287198b..68bc10ac31 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -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) {