ref: dde819599b15ec1c9c951a23ff7a00b4c04eea85
parent: 4f860dba7822a6920c812ada0a5d4ecdd20d62f2
author: hkuang <[email protected]>
date: Thu Dec 4 10:06:31 EST 2014
Clean up the logic of handling corrupted frame. No more checking of corrupted reference frame as we skip decoding any non-intra frame in case of frame corrupted. Change-Id: I77d41bbb02fc5f61972740e2d411441eb6a17073
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -747,10 +747,6 @@
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 @@
&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 @@
}
// 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 @@
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 @@
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);
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -440,9 +440,6 @@
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],
--- a/vp9/decoder/vp9_decoder.c
+++ b/vp9/decoder/vp9_decoder.c
@@ -288,16 +288,6 @@
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--;