Commit 879b4ff8 authored by Ryan Lei's avatar Ryan Lei Committed by Yaowu Xu

Fix two bugs in parallel_deblocking experiment

This commit fixes two major bugs in parallel deblocking experiment, the
first one is missing initialization of lfm->lfl_uv array for horizontal
filtering. The second one is inconsistent order of vertical/horizontal
filtering of superblocks within a frame between encoder and decoder.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=45#c2
BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=53#c1

Change-Id: I2df7eb313d49203fb70efe2bdf957b9d7e0bf678
parent 585fc42b
This diff is collapsed.
......@@ -123,7 +123,8 @@ void av1_filter_block_plane_non420_ver(struct AV1Common *cm,
int mi_col);
void av1_filter_block_plane_non420_hor(struct AV1Common *cm,
struct macroblockd_plane *plane,
int mi_row);
MODE_INFO **mi_8x8, int mi_row,
int mi_col);
void av1_loop_filter_init(struct AV1Common *cm);
......
......@@ -112,8 +112,8 @@ static INLINE void loop_filter_block_plane_ver(
av1_filter_block_plane_ss00_ver(cm, &planes[plane], mi_row, lfm);
break;
case LF_PATH_SLOW:
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi + mi_col,
mi_row, mi_col);
av1_filter_block_plane_non420_ver(cm, &planes[plane], mi, mi_row,
mi_col);
break;
}
}
......@@ -121,7 +121,8 @@ static INLINE void loop_filter_block_plane_ver(
static INLINE void loop_filter_block_plane_hor(
AV1_COMMON *cm, struct macroblockd_plane planes[MAX_MB_PLANE], int plane,
int mi_row, enum lf_path path, LOOP_FILTER_MASK *lfm) {
MODE_INFO **mi, int mi_row, int mi_col, enum lf_path path,
LOOP_FILTER_MASK *lfm) {
if (plane == 0) {
av1_filter_block_plane_ss00_hor(cm, &planes[0], mi_row, lfm);
} else {
......@@ -133,7 +134,8 @@ static INLINE void loop_filter_block_plane_hor(
av1_filter_block_plane_ss00_hor(cm, &planes[plane], mi_row, lfm);
break;
case LF_PATH_SLOW:
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi_row);
av1_filter_block_plane_non420_hor(cm, &planes[plane], mi, mi_row,
mi_col);
break;
}
}
......@@ -162,8 +164,8 @@ static int loop_filter_ver_row_worker(AV1LfSync *const lf_sync,
lf_data->cm->mi_stride, &lfm);
for (plane = 0; plane < num_planes; ++plane)
loop_filter_block_plane_ver(lf_data->cm, lf_data->planes, plane, mi,
mi_row, mi_col, path, &lfm);
loop_filter_block_plane_ver(lf_data->cm, lf_data->planes, plane,
mi + mi_col, mi_row, mi_col, path, &lfm);
}
}
return 1;
......@@ -198,9 +200,8 @@ static int loop_filter_hor_row_worker(AV1LfSync *const lf_sync,
lf_data->cm->mi_stride, &lfm);
for (plane = 0; plane < num_planes; ++plane)
loop_filter_block_plane_hor(lf_data->cm, lf_data->planes, plane, mi_row,
path, &lfm);
loop_filter_block_plane_hor(lf_data->cm, lf_data->planes, plane,
mi + mi_col, mi_row, mi_col, path, &lfm);
sync_write(lf_sync, r, c, sb_cols);
}
}
......@@ -234,10 +235,10 @@ static int loop_filter_row_worker(AV1LfSync *const lf_sync,
lf_data->cm->mi_stride, &lfm);
for (plane = 0; plane < num_planes; ++plane) {
loop_filter_block_plane_ver(lf_data->cm, lf_data->planes, plane, mi,
mi_row, mi_col, path, &lfm);
loop_filter_block_plane_hor(lf_data->cm, lf_data->planes, plane, mi_row,
path, &lfm);
loop_filter_block_plane_ver(lf_data->cm, lf_data->planes, plane,
mi + mi_col, mi_row, mi_col, path, &lfm);
loop_filter_block_plane_hor(lf_data->cm, lf_data->planes, plane,
mi + mi_col, mi_row, mi_col, path, &lfm);
}
sync_write(lf_sync, r, c, sb_cols);
......
......@@ -1371,6 +1371,11 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
aom_internal_error(&cm->error, AOM_CODEC_CORRUPT_FRAME,
"Failed to decode tile data");
}
// when Parallel deblocking is enabled, deblocking should not
// be interleaved with decoding. Instead, deblocking should be done
// after the entire frame is decoded.
#if !CONFIG_PARALLEL_DEBLOCKING
// Loopfilter one row.
if (cm->lf.filter_level && !cm->skip_loop_filter) {
const int lf_start = mi_row - MAX_MIB_SIZE;
......@@ -1391,9 +1396,11 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
winterface->execute(&pbi->lf_worker);
}
}
// After loopfiltering, the last 7 row pixels in each superblock row may
// still be changed by the longest loopfilter of the next superblock
// row.
// After loopfiltering, the last 7 row pixels in each superblock row may
// still be changed by the longest loopfilter of the next superblock
// row.
#endif // !CONFIG_PARALLEL_DEBLOCKING
if (cm->frame_parallel_decode)
av1_frameworker_broadcast(pbi->cur_buf, mi_row << MAX_MIB_SIZE_LOG2);
}
......@@ -1403,6 +1410,16 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
// aom_accounting_dump(&pbi->accounting);
#endif
#if CONFIG_PARALLEL_DEBLOCKING
// Loopfilter all rows in the frame in the frame.
if (cm->lf.filter_level && !cm->skip_loop_filter) {
LFWorkerData *const lf_data = (LFWorkerData *)pbi->lf_worker.data1;
winterface->sync(&pbi->lf_worker);
lf_data->start = 0;
lf_data->stop = cm->mi_rows;
winterface->execute(&pbi->lf_worker);
}
#else
// Loopfilter remaining rows in the frame.
if (cm->lf.filter_level && !cm->skip_loop_filter) {
LFWorkerData *const lf_data = (LFWorkerData *)pbi->lf_worker.data1;
......@@ -1411,6 +1428,7 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
lf_data->stop = cm->mi_rows;
winterface->execute(&pbi->lf_worker);
}
#endif // CONFIG_PARALLEL_DEBLOCKING
// Get last tile data.
tile_data = pbi->tile_data + tile_cols * tile_rows - 1;
......
Markdown is supported
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