]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/error_resilience.c
add support for files that do not allow more than 4 subframes
[ffmpeg] / libavcodec / error_resilience.c
index c6eea3811ef84fb32601b471dd2d827dd5498993..dc015b9f6af63beb30528b32044ca0d3e9b7a51e 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 /**
- * @file libavcodec/error_resilience.c
+ * @file
  * Error resilience / concealment.
  */
 
@@ -31,6 +31,7 @@
 #include "dsputil.h"
 #include "mpegvideo.h"
 #include "h264.h"
+#include "rectangle.h"
 
 /*
  * H264 redefines mb_intra so it is not mistakely used (its uninitialized in h264)
@@ -43,7 +44,7 @@ static void decode_mb(MpegEncContext *s, int ref){
     s->dest[1] = s->current_picture.data[1] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift);
     s->dest[2] = s->current_picture.data[2] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift);
 
-    if(s->codec_id == CODEC_ID_H264){
+    if(CONFIG_H264_DECODER && s->codec_id == CODEC_ID_H264){
         H264Context *h= (void*)s;
         h->mb_xy= s->mb_x + s->mb_y*s->mb_stride;
         memset(h->non_zero_count_cache, 0, sizeof(h->non_zero_count_cache));
@@ -629,6 +630,12 @@ static int is_intra_more_likely(MpegEncContext *s){
             undamaged_count++;
     }
 
+    if(s->codec_id == CODEC_ID_H264){
+        H264Context *h= (void*)s;
+        if(h->ref_count[0] <= 0 || !h->ref_list[0][0].data[0])
+            return 1;
+    }
+
     if(undamaged_count < 5) return 0; //almost all MBs damaged -> use temporal prediction
 
     //prevent dsp.sad() check, that requires access to the image