]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/error_resilience: factor er_supported() check out
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 15:49:00 +0000 (16:49 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 6 Dec 2013 15:49:00 +0000 (16:49 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/error_resilience.c

index 55c68a59019e002ddef3fdb0da73f850d2717f8c..4e3fdbd50296a7b81a3a4b768b2caed3ec102529 100644 (file)
@@ -768,6 +768,17 @@ void ff_er_frame_start(ERContext *s)
     s->error_occurred = 0;
 }
 
+static int er_supported(ERContext *s)
+{
+    if(s->avctx->hwaccel                                              ||
+       s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU          ||
+       !s->cur_pic                                                    ||
+       s->cur_pic->field_picture
+    )
+        return 0;
+    return 1;
+}
+
 /**
  * Add a slice.
  * @param endx   x component of the last macroblock, can be -1
@@ -859,9 +870,7 @@ void ff_er_frame_end(ERContext *s)
      * though it should not crash if enabled. */
     if (!s->avctx->error_concealment || s->error_count == 0            ||
         s->avctx->lowres                                               ||
-        s->avctx->hwaccel                                              ||
-        s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU          ||
-        !s->cur_pic || s->cur_pic->field_picture                               ||
+        !er_supported(s)                                               ||
         s->error_count == 3 * s->mb_width *
                           (s->avctx->skip_top + s->avctx->skip_bottom)) {
         return;