Commit db8b1b7b authored by James Zern's avatar James Zern
Browse files

vp9: skip loopfilter when the frame is corrupt

this change is proactive: the loop filter expects valid input and may
produce undefined results / crash in other cases.

Change-Id: I6cc1e966062a91cbc6db981c87cd03d9129fc8fe
Showing with 7 additions and 5 deletions
...@@ -884,7 +884,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, ...@@ -884,7 +884,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
pbi->mb.corrupted |= tile_data->xd.corrupted; pbi->mb.corrupted |= tile_data->xd.corrupted;
} }
// Loopfilter one row. // Loopfilter one row.
if (cm->lf.filter_level) { if (cm->lf.filter_level && !pbi->mb.corrupted) {
const int lf_start = mi_row - MI_BLOCK_SIZE; const int lf_start = mi_row - MI_BLOCK_SIZE;
LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
...@@ -907,7 +907,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi, ...@@ -907,7 +907,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
} }
// Loopfilter remaining rows in the frame. // Loopfilter remaining rows in the frame.
if (cm->lf.filter_level) { if (cm->lf.filter_level && !pbi->mb.corrupted) {
LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
winterface->sync(&pbi->lf_worker); winterface->sync(&pbi->lf_worker);
lf_data->start = lf_data->stop; lf_data->start = lf_data->stop;
...@@ -1432,9 +1432,11 @@ void vp9_decode_frame(VP9Decoder *pbi, ...@@ -1432,9 +1432,11 @@ void vp9_decode_frame(VP9Decoder *pbi,
if (pbi->max_threads > 1 && tile_rows == 1 && tile_cols > 1 && if (pbi->max_threads > 1 && tile_rows == 1 && tile_cols > 1 &&
cm->frame_parallel_decoding_mode) { cm->frame_parallel_decoding_mode) {
*p_data_end = decode_tiles_mt(pbi, data + first_partition_size, data_end); *p_data_end = decode_tiles_mt(pbi, data + first_partition_size, data_end);
// If multiple threads are used to decode tiles, then we use those threads if (!xd->corrupted) {
// to do parallel loopfiltering. // If multiple threads are used to decode tiles, then we use those threads
vp9_loop_filter_frame_mt(new_fb, pbi, cm, cm->lf.filter_level, 0); // to do parallel loopfiltering.
vp9_loop_filter_frame_mt(new_fb, pbi, cm, cm->lf.filter_level, 0);
}
} else { } else {
*p_data_end = decode_tiles(pbi, data + first_partition_size, data_end); *p_data_end = decode_tiles(pbi, data + first_partition_size, data_end);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment