]> granicus.if.org Git - libvpx/commitdiff
Clean up the logic of handling corrupted frame.
authorhkuang <hkuang@google.com>
Thu, 4 Dec 2014 23:06:31 +0000 (15:06 -0800)
committerhkuang <hkuang@google.com>
Thu, 4 Dec 2014 23:07:59 +0000 (15:07 -0800)
No more checking of corrupted reference frame as we skip
decoding any non-intra frame in case of frame corrupted.

Change-Id: I77d41bbb02fc5f61972740e2d411441eb6a17073

vp9/decoder/vp9_decodeframe.c
vp9/decoder/vp9_decodemv.c
vp9/decoder/vp9_decoder.c

index a088325df9a04bc73b63734e366a5661e827d1df..2c5fbacb9b15de3c7b19289970d0429aacdac23f 100644 (file)
@@ -747,10 +747,6 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
       YV12_BUFFER_CONFIG *const buf = cm->frame_refs[i].buf;
       width = buf->y_crop_width;
       height = buf->y_crop_height;
-      if (buf->corrupted) {
-        vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
-                           "Frame reference is corrupt");
-      }
       found = 1;
       break;
     }
@@ -978,9 +974,12 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
                            &tile_data->bit_reader, BLOCK_64X64);
         }
         pbi->mb.corrupted |= tile_data->xd.corrupted;
+        if (pbi->mb.corrupted)
+            vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
+                               "Failed to decode tile data");
       }
       // Loopfilter one row.
-      if (cm->lf.filter_level && !pbi->mb.corrupted) {
+      if (cm->lf.filter_level) {
         const int lf_start = mi_row - MI_BLOCK_SIZE;
         LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
 
@@ -1003,7 +1002,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
   }
 
   // Loopfilter remaining rows in the frame.
-  if (cm->lf.filter_level && !pbi->mb.corrupted) {
+  if (cm->lf.filter_level) {
     LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
     winterface->sync(&pbi->lf_worker);
     lf_data->start = lf_data->stop;
@@ -1564,6 +1563,9 @@ void vp9_decode_frame(VP9Decoder *pbi,
 
   xd->corrupted = 0;
   new_fb->corrupted = read_compressed_header(pbi, data, first_partition_size);
+  if (new_fb->corrupted)
+    vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
+                       "Decode failed. Frame data header is corrupted.");
 
   // TODO(jzern): remove frame_parallel_decoding_mode restriction for
   // single-frame tile decoding.
@@ -1576,6 +1578,10 @@ void vp9_decode_frame(VP9Decoder *pbi,
       vp9_loop_filter_frame_mt(&pbi->lf_row_sync, new_fb, pbi->mb.plane, cm,
                                pbi->tile_workers, pbi->num_tile_workers,
                                cm->lf.filter_level, 0);
+    } else {
+      vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
+                         "Decode failed. Frame data is corrupted.");
+
     }
   } else {
     *p_data_end = decode_tiles(pbi, data + first_partition_size, data_end);
index ecab71a9b77dc3e981e65c503919e93d2a3ecac0..cff94db2d85f5f3d6e29639b8408c6c4277d33cc 100644 (file)
@@ -440,9 +440,6 @@ static void read_inter_block_mode_info(VP9_COMMON *const cm,
     if ((!vp9_is_valid_scale(&ref_buf->sf)))
       vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM,
                          "Reference frame has invalid dimensions");
-    if (ref_buf->buf->corrupted)
-      vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
-                         "Block reference is corrupt");
     vp9_setup_pre_planes(xd, ref, ref_buf->buf, mi_row, mi_col,
                          &ref_buf->sf);
     vp9_find_mv_refs(cm, xd, tile, mi, frame, mbmi->ref_mvs[frame],
index 39f03aac1c61ac578e8f1b931cb7b3e11ab66fe6..2daf86200a5f836a6c307e4116696f091a1c0da1 100644 (file)
@@ -288,16 +288,6 @@ int vp9_receive_compressed_data(VP9Decoder *pbi,
 
     vp9_clear_system_state();
 
-    // We do not know if the missing frame(s) was supposed to update
-    // any of the reference buffers, but we act conservative and
-    // mark only the last buffer as corrupted.
-    //
-    // TODO(jkoleszar): Error concealment is undefined and non-normative
-    // at this point, but if it becomes so, [0] may not always be the correct
-    // thing to do here.
-    if (cm->frame_refs[0].idx != INT_MAX && cm->frame_refs[0].buf != NULL)
-      cm->frame_refs[0].buf->corrupted = 1;
-
     if (cm->new_fb_idx > 0 && cm->frame_bufs[cm->new_fb_idx].ref_count > 0)
       cm->frame_bufs[cm->new_fb_idx].ref_count--;