Commit 7d2e5c96 authored by Imdad Sardharwalla's avatar Imdad Sardharwalla Committed by Debargha Mukherjee

Move loop restoration parameters to start of superblock.

The loop restoration parameters were previously written
at the end of each superblock, and have now been moved
to the beginning.

Change-Id: I45fc57a82d0ee340e6281f0a70d42ec0829caf9c
parent 3a32e103
......@@ -611,6 +611,23 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
#if CONFIG_LOOP_RESTORATION
for (int plane = 0; plane < av1_num_planes(cm); ++plane) {
int rcol0, rcol1, rrow0, rrow1, tile_tl_idx;
if (av1_loop_restoration_corners_in_sb(cm, plane, mi_row, mi_col, bsize,
&rcol0, &rcol1, &rrow0, &rrow1,
&tile_tl_idx)) {
const int rstride = cm->rst_info[plane].horz_units_per_tile;
for (int rrow = rrow0; rrow < rrow1; ++rrow) {
for (int rcol = rcol0; rcol < rcol1; ++rcol) {
const int rtile_idx = tile_tl_idx + rcol + rrow * rstride;
loop_restoration_read_sb_coeffs(cm, xd, r, plane, rtile_idx);
}
}
}
}
#endif
partition = (bsize < BLOCK_8X8) ? PARTITION_NONE
: read_partition(xd, mi_row, mi_col, r,
has_rows, has_cols, bsize);
......@@ -705,23 +722,6 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
(bsize == BLOCK_8X8 || partition != PARTITION_SPLIT))
update_partition_context(xd, mi_row, mi_col, subsize, bsize);
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_LOOP_RESTORATION
for (int plane = 0; plane < av1_num_planes(cm); ++plane) {
int rcol0, rcol1, rrow0, rrow1, tile_tl_idx;
if (av1_loop_restoration_corners_in_sb(cm, plane, mi_row, mi_col, bsize,
&rcol0, &rcol1, &rrow0, &rrow1,
&tile_tl_idx)) {
const int rstride = cm->rst_info[plane].horz_units_per_tile;
for (int rrow = rrow0; rrow < rrow1; ++rrow) {
for (int rcol = rcol0; rcol < rcol1; ++rcol) {
const int rtile_idx = tile_tl_idx + rcol + rrow * rstride;
loop_restoration_read_sb_coeffs(cm, xd, r, plane, rtile_idx);
}
}
}
}
#endif
}
static void setup_bool_decoder(const uint8_t *data, const uint8_t *data_end,
......
......@@ -2090,6 +2090,25 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return;
#if CONFIG_LOOP_RESTORATION
for (int plane = 0; plane < av1_num_planes(cm); ++plane) {
int rcol0, rcol1, rrow0, rrow1, tile_tl_idx;
if (av1_loop_restoration_corners_in_sb(cm, plane, mi_row, mi_col, bsize,
&rcol0, &rcol1, &rrow0, &rrow1,
&tile_tl_idx)) {
const int rstride = cm->rst_info[plane].horz_units_per_tile;
for (int rrow = rrow0; rrow < rrow1; ++rrow) {
for (int rcol = rcol0; rcol < rcol1; ++rcol) {
const int rtile_idx = tile_tl_idx + rcol + rrow * rstride;
const RestorationUnitInfo *rui =
&cm->rst_info[plane].unit_info[rtile_idx];
loop_restoration_write_sb_coeffs(cm, xd, rui, w, plane);
}
}
}
}
#endif
write_partition(cm, xd, hbs, mi_row, mi_col, partition, bsize, w);
switch (partition) {
case PARTITION_NONE:
......@@ -2161,25 +2180,6 @@ static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
(bsize == BLOCK_8X8 || partition != PARTITION_SPLIT))
update_partition_context(xd, mi_row, mi_col, subsize, bsize);
#endif // CONFIG_EXT_PARTITION_TYPES
#if CONFIG_LOOP_RESTORATION
for (int plane = 0; plane < av1_num_planes(cm); ++plane) {
int rcol0, rcol1, rrow0, rrow1, tile_tl_idx;
if (av1_loop_restoration_corners_in_sb(cm, plane, mi_row, mi_col, bsize,
&rcol0, &rcol1, &rrow0, &rrow1,
&tile_tl_idx)) {
const int rstride = cm->rst_info[plane].horz_units_per_tile;
for (int rrow = rrow0; rrow < rrow1; ++rrow) {
for (int rcol = rcol0; rcol < rcol1; ++rcol) {
const int rtile_idx = tile_tl_idx + rcol + rrow * rstride;
const RestorationUnitInfo *rui =
&cm->rst_info[plane].unit_info[rtile_idx];
loop_restoration_write_sb_coeffs(cm, xd, rui, w, plane);
}
}
}
}
#endif
}
static void write_modes(AV1_COMP *const cpi, const TileInfo *const tile,
......
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