Commit 5d89a63a authored by Debargha Mukherjee's avatar Debargha Mukherjee

Misc. refactoring of loop restoration

Streamilines the functions and data structures to make it
easy to add new restore options.

Change-Id: Ib00638a5749e6c38c2455f3e3142b1025e6e0624
parent bda8d61e
......@@ -85,14 +85,10 @@ void av1_free_ref_frame_buffers(BufferPool *pool) {
void av1_free_restoration_buffers(AV1_COMMON *cm) {
aom_free(cm->rst_info.restoration_type);
cm->rst_info.restoration_type = NULL;
aom_free(cm->rst_info.bilateral_level);
cm->rst_info.bilateral_level = NULL;
aom_free(cm->rst_info.vfilter);
cm->rst_info.vfilter = NULL;
aom_free(cm->rst_info.hfilter);
cm->rst_info.hfilter = NULL;
aom_free(cm->rst_info.wiener_level);
cm->rst_info.wiener_level = NULL;
aom_free(cm->rst_info.bilateral_info);
cm->rst_info.bilateral_info = NULL;
aom_free(cm->rst_info.wiener_info);
cm->rst_info.wiener_info = NULL;
}
#endif // CONFIG_LOOP_RESTORATION
......
......@@ -1655,9 +1655,11 @@ void av1_setup_past_independence(AV1_COMMON *cm) {
// To force update of the sharpness
lf->last_sharpness_level = -1;
#if CONFIG_LOOP_RESTORATION
if (cm->rst_info.bilateral_level) {
if (cm->rst_info.bilateral_info) {
int s;
for (i = 0; i < cm->rst_internal.ntiles; ++i)
cm->rst_info.bilateral_level[i] = -1;
for (s = 0; s < BILATERAL_SUBTILES; ++s)
cm->rst_info.bilateral_info[i].level[s] = -1;
}
#endif // CONFIG_LOOP_RESTORATION
......
......@@ -40,14 +40,14 @@ typedef struct bilateral_params {
} BilateralParamsType;
static BilateralParamsType bilateral_level_to_params_arr[BILATERAL_LEVELS] = {
// Values are rounded to 1/16 th precision
// Values are rounded to 1/16 th precision
{ 8, 9, 30 }, { 9, 8, 30 }, { 9, 11, 32 }, { 11, 9, 32 },
{ 14, 14, 36 }, { 18, 18, 36 }, { 24, 24, 40 }, { 32, 32, 40 },
};
static BilateralParamsType
bilateral_level_to_params_arr_kf[BILATERAL_LEVELS_KF] = {
// Values are rounded to 1/16 th precision
// Values are rounded to 1/16 th precision
{ 8, 8, 30 }, { 9, 9, 32 }, { 10, 10, 32 }, { 12, 12, 32 },
{ 14, 14, 32 }, { 18, 18, 36 }, { 24, 24, 40 }, { 30, 30, 44 },
{ 36, 36, 48 }, { 42, 42, 48 }, { 48, 48, 48 }, { 48, 48, 56 },
......@@ -151,33 +151,35 @@ void av1_loop_restoration_init(RestorationInternal *rst, RestorationInfo *rsi,
&rst->nhtiles, &rst->nvtiles);
if (rsi->frame_restoration_type == RESTORE_WIENER) {
for (tile_idx = 0; tile_idx < rst->ntiles; ++tile_idx) {
rsi->vfilter[tile_idx][RESTORATION_HALFWIN] =
rsi->hfilter[tile_idx][RESTORATION_HALFWIN] = RESTORATION_FILT_STEP;
rsi->wiener_info[tile_idx].vfilter[RESTORATION_HALFWIN] =
rsi->wiener_info[tile_idx].hfilter[RESTORATION_HALFWIN] =
RESTORATION_FILT_STEP;
for (i = 0; i < RESTORATION_HALFWIN; ++i) {
rsi->vfilter[tile_idx][RESTORATION_WIN - 1 - i] =
rsi->vfilter[tile_idx][i];
rsi->hfilter[tile_idx][RESTORATION_WIN - 1 - i] =
rsi->hfilter[tile_idx][i];
rsi->vfilter[tile_idx][RESTORATION_HALFWIN] -=
2 * rsi->vfilter[tile_idx][i];
rsi->hfilter[tile_idx][RESTORATION_HALFWIN] -=
2 * rsi->hfilter[tile_idx][i];
rsi->wiener_info[tile_idx].vfilter[RESTORATION_WIN - 1 - i] =
rsi->wiener_info[tile_idx].vfilter[i];
rsi->wiener_info[tile_idx].hfilter[RESTORATION_WIN - 1 - i] =
rsi->wiener_info[tile_idx].hfilter[i];
rsi->wiener_info[tile_idx].vfilter[RESTORATION_HALFWIN] -=
2 * rsi->wiener_info[tile_idx].vfilter[i];
rsi->wiener_info[tile_idx].hfilter[RESTORATION_HALFWIN] -=
2 * rsi->wiener_info[tile_idx].hfilter[i];
}
}
} else if (rsi->frame_restoration_type == RESTORE_SWITCHABLE) {
for (tile_idx = 0; tile_idx < rst->ntiles; ++tile_idx) {
if (rsi->restoration_type[tile_idx] == RESTORE_WIENER) {
rsi->vfilter[tile_idx][RESTORATION_HALFWIN] =
rsi->hfilter[tile_idx][RESTORATION_HALFWIN] = RESTORATION_FILT_STEP;
rsi->wiener_info[tile_idx].vfilter[RESTORATION_HALFWIN] =
rsi->wiener_info[tile_idx].hfilter[RESTORATION_HALFWIN] =
RESTORATION_FILT_STEP;
for (i = 0; i < RESTORATION_HALFWIN; ++i) {
rsi->vfilter[tile_idx][RESTORATION_WIN - 1 - i] =
rsi->vfilter[tile_idx][i];
rsi->hfilter[tile_idx][RESTORATION_WIN - 1 - i] =
rsi->hfilter[tile_idx][i];
rsi->vfilter[tile_idx][RESTORATION_HALFWIN] -=
2 * rsi->vfilter[tile_idx][i];
rsi->hfilter[tile_idx][RESTORATION_HALFWIN] -=
2 * rsi->hfilter[tile_idx][i];
rsi->wiener_info[tile_idx].vfilter[RESTORATION_WIN - 1 - i] =
rsi->wiener_info[tile_idx].vfilter[i];
rsi->wiener_info[tile_idx].hfilter[RESTORATION_WIN - 1 - i] =
rsi->wiener_info[tile_idx].hfilter[i];
rsi->wiener_info[tile_idx].vfilter[RESTORATION_HALFWIN] -=
2 * rsi->wiener_info[tile_idx].vfilter[i];
rsi->wiener_info[tile_idx].hfilter[RESTORATION_HALFWIN] -=
2 * rsi->wiener_info[tile_idx].hfilter[i];
}
}
}
......@@ -195,8 +197,7 @@ static void loop_bilateral_filter_tile(uint8_t *data, int tile_idx, int width,
for (subtile_idx = 0; subtile_idx < BILATERAL_SUBTILES; ++subtile_idx) {
uint8_t *data_p, *tmpdata_p;
const int level =
rst->rsi->bilateral_level[tile_idx * BILATERAL_SUBTILES + subtile_idx];
const int level = rst->rsi->bilateral_info[tile_idx].level[subtile_idx];
uint8_t(*wx_lut)[RESTORATION_WIN];
uint8_t *wr_lut_;
......@@ -282,7 +283,7 @@ static void loop_wiener_filter_tile(uint8_t *data, int tile_idx, int width,
int h_start, h_end, v_start, v_end;
uint8_t *data_p, *tmpdata_p;
if (rst->rsi->wiener_level[tile_idx] == 0) return;
if (rst->rsi->wiener_info[tile_idx].level == 0) return;
// Filter row-wise
av1_get_rest_tile_limits(tile_idx, 0, 0, rst->nhtiles, rst->nvtiles,
tile_width, tile_height, width, height, 1, 0,
......@@ -291,7 +292,8 @@ static void loop_wiener_filter_tile(uint8_t *data, int tile_idx, int width,
tmpdata_p = tmpdata + h_start + v_start * tmpstride;
for (i = 0; i < (v_end - v_start); ++i) {
for (j = 0; j < (h_end - h_start); ++j) {
*tmpdata_p++ = hor_sym_filter(data_p++, rst->rsi->hfilter[tile_idx]);
*tmpdata_p++ =
hor_sym_filter(data_p++, rst->rsi->wiener_info[tile_idx].hfilter);
}
data_p += stride - (h_end - h_start);
tmpdata_p += tmpstride - (h_end - h_start);
......@@ -304,8 +306,8 @@ static void loop_wiener_filter_tile(uint8_t *data, int tile_idx, int width,
tmpdata_p = tmpdata + h_start + v_start * tmpstride;
for (i = 0; i < (v_end - v_start); ++i) {
for (j = 0; j < (h_end - h_start); ++j) {
*data_p++ =
ver_sym_filter(tmpdata_p++, tmpstride, rst->rsi->vfilter[tile_idx]);
*data_p++ = ver_sym_filter(tmpdata_p++, tmpstride,
rst->rsi->wiener_info[tile_idx].vfilter);
}
data_p += stride - (h_end - h_start);
tmpdata_p += tmpstride - (h_end - h_start);
......@@ -370,8 +372,7 @@ static void loop_bilateral_filter_tile_highbd(uint16_t *data, int tile_idx,
for (subtile_idx = 0; subtile_idx < BILATERAL_SUBTILES; ++subtile_idx) {
uint16_t *data_p, *tmpdata_p;
const int level =
rst->rsi->bilateral_level[tile_idx * BILATERAL_SUBTILES + subtile_idx];
const int level = rst->rsi->bilateral_info[tile_idx].level[subtile_idx];
uint8_t(*wx_lut)[RESTORATION_WIN];
uint8_t *wr_lut_;
......@@ -462,7 +463,7 @@ static void loop_wiener_filter_tile_highbd(uint16_t *data, int tile_idx,
int i, j;
uint16_t *data_p, *tmpdata_p;
if (rst->rsi->wiener_level[tile_idx] == 0) return;
if (rst->rsi->wiener_info[tile_idx].level == 0) return;
// Filter row-wise
av1_get_rest_tile_limits(tile_idx, 0, 0, rst->nhtiles, rst->nvtiles,
tile_width, tile_height, width, height, 1, 0,
......@@ -472,7 +473,7 @@ static void loop_wiener_filter_tile_highbd(uint16_t *data, int tile_idx,
for (i = 0; i < (v_end - v_start); ++i) {
for (j = 0; j < (h_end - h_start); ++j) {
*tmpdata_p++ = hor_sym_filter_highbd(
data_p++, rst->rsi->hfilter[tile_idx], bit_depth);
data_p++, rst->rsi->wiener_info[tile_idx].hfilter, bit_depth);
}
data_p += stride - (h_end - h_start);
tmpdata_p += tmpstride - (h_end - h_start);
......@@ -486,7 +487,8 @@ static void loop_wiener_filter_tile_highbd(uint16_t *data, int tile_idx,
for (i = 0; i < (v_end - v_start); ++i) {
for (j = 0; j < (h_end - h_start); ++j) {
*data_p++ = ver_sym_filter_highbd(tmpdata_p++, tmpstride,
rst->rsi->vfilter[tile_idx], bit_depth);
rst->rsi->wiener_info[tile_idx].vfilter,
bit_depth);
}
data_p += stride - (h_end - h_start);
tmpdata_p += tmpstride - (h_end - h_start);
......
......@@ -57,14 +57,20 @@ extern "C" {
#define WIENER_FILT_TAP2_MAXV \
(WIENER_FILT_TAP2_MINV - 1 + (1 << WIENER_FILT_TAP2_BITS))
typedef struct { int level[BILATERAL_SUBTILES]; } BilateralInfo;
typedef struct {
int level;
int vfilter[RESTORATION_WIN], hfilter[RESTORATION_WIN];
} WienerInfo;
typedef struct {
RestorationType frame_restoration_type;
RestorationType *restoration_type;
// Bilateral filter
int *bilateral_level;
BilateralInfo *bilateral_info;
// Wiener filter
int *wiener_level;
int (*vfilter)[RESTORATION_WIN], (*hfilter)[RESTORATION_WIN];
WienerInfo *wiener_info;
} RestorationInfo;
typedef struct {
......
......@@ -1920,101 +1920,96 @@ static void decode_restoration(AV1_COMMON *cm, aom_reader *rb) {
rsi->restoration_type = (RestorationType *)aom_realloc(
rsi->restoration_type, sizeof(*rsi->restoration_type) * ntiles);
if (rsi->frame_restoration_type == RESTORE_SWITCHABLE) {
rsi->bilateral_level = (int *)aom_realloc(
rsi->bilateral_level,
sizeof(*rsi->bilateral_level) * ntiles * BILATERAL_SUBTILES);
assert(rsi->bilateral_level != NULL);
rsi->wiener_level = (int *)aom_realloc(
rsi->wiener_level, sizeof(*rsi->wiener_level) * ntiles);
assert(rsi->wiener_level != NULL);
rsi->vfilter = (int(*)[RESTORATION_WIN])aom_realloc(
rsi->vfilter, sizeof(*rsi->vfilter) * ntiles);
assert(rsi->vfilter != NULL);
rsi->hfilter = (int(*)[RESTORATION_WIN])aom_realloc(
rsi->hfilter, sizeof(*rsi->hfilter) * ntiles);
assert(rsi->hfilter != NULL);
rsi->bilateral_info = (BilateralInfo *)aom_realloc(
rsi->bilateral_info, sizeof(*rsi->bilateral_info) * ntiles);
assert(rsi->bilateral_info != NULL);
rsi->wiener_info = (WienerInfo *)aom_realloc(
rsi->wiener_info, sizeof(*rsi->wiener_info) * ntiles);
assert(rsi->wiener_info != NULL);
for (i = 0; i < ntiles; ++i) {
rsi->restoration_type[i] = aom_read_tree(
rb, av1_switchable_restore_tree, cm->fc->switchable_restore_prob);
if (rsi->restoration_type[i] == RESTORE_WIENER) {
rsi->wiener_level[i] = 1;
rsi->vfilter[i][0] = aom_read_literal(rb, WIENER_FILT_TAP0_BITS) +
WIENER_FILT_TAP0_MINV;
rsi->vfilter[i][1] = aom_read_literal(rb, WIENER_FILT_TAP1_BITS) +
WIENER_FILT_TAP1_MINV;
rsi->vfilter[i][2] = aom_read_literal(rb, WIENER_FILT_TAP2_BITS) +
WIENER_FILT_TAP2_MINV;
rsi->hfilter[i][0] = aom_read_literal(rb, WIENER_FILT_TAP0_BITS) +
WIENER_FILT_TAP0_MINV;
rsi->hfilter[i][1] = aom_read_literal(rb, WIENER_FILT_TAP1_BITS) +
WIENER_FILT_TAP1_MINV;
rsi->hfilter[i][2] = aom_read_literal(rb, WIENER_FILT_TAP2_BITS) +
WIENER_FILT_TAP2_MINV;
rsi->wiener_info[i].level = 1;
rsi->wiener_info[i].vfilter[0] =
aom_read_literal(rb, WIENER_FILT_TAP0_BITS) +
WIENER_FILT_TAP0_MINV;
rsi->wiener_info[i].vfilter[1] =
aom_read_literal(rb, WIENER_FILT_TAP1_BITS) +
WIENER_FILT_TAP1_MINV;
rsi->wiener_info[i].vfilter[2] =
aom_read_literal(rb, WIENER_FILT_TAP2_BITS) +
WIENER_FILT_TAP2_MINV;
rsi->wiener_info[i].hfilter[0] =
aom_read_literal(rb, WIENER_FILT_TAP0_BITS) +
WIENER_FILT_TAP0_MINV;
rsi->wiener_info[i].hfilter[1] =
aom_read_literal(rb, WIENER_FILT_TAP1_BITS) +
WIENER_FILT_TAP1_MINV;
rsi->wiener_info[i].hfilter[2] =
aom_read_literal(rb, WIENER_FILT_TAP2_BITS) +
WIENER_FILT_TAP2_MINV;
} else if (rsi->restoration_type[i] == RESTORE_BILATERAL) {
int s;
for (s = 0; s < BILATERAL_SUBTILES; ++s) {
const int j = i * BILATERAL_SUBTILES + s;
#if BILATERAL_SUBTILES == 0
rsi->bilateral_level[j] =
rsi->bilateral_info[i].level[s] =
aom_read_literal(rb, av1_bilateral_level_bits(cm));
#else
if (aom_read(rb, RESTORE_NONE_BILATERAL_PROB)) {
rsi->bilateral_level[j] =
rsi->bilateral_info[i].level[s] =
aom_read_literal(rb, av1_bilateral_level_bits(cm));
} else {
rsi->bilateral_level[j] = -1;
rsi->bilateral_info[i].level[s] = -1;
}
#endif
}
}
}
} else if (rsi->frame_restoration_type == RESTORE_WIENER) {
rsi->wiener_level = (int *)aom_realloc(
rsi->wiener_level, sizeof(*rsi->wiener_level) * ntiles);
assert(rsi->wiener_level != NULL);
rsi->vfilter = (int(*)[RESTORATION_WIN])aom_realloc(
rsi->vfilter, sizeof(*rsi->vfilter) * ntiles);
assert(rsi->vfilter != NULL);
rsi->hfilter = (int(*)[RESTORATION_WIN])aom_realloc(
rsi->hfilter, sizeof(*rsi->hfilter) * ntiles);
assert(rsi->hfilter != NULL);
rsi->wiener_info = (WienerInfo *)aom_realloc(
rsi->wiener_info, sizeof(*rsi->wiener_info) * ntiles);
assert(rsi->wiener_info != NULL);
for (i = 0; i < ntiles; ++i) {
if (aom_read(rb, RESTORE_NONE_WIENER_PROB)) {
rsi->wiener_level[i] = 1;
rsi->wiener_info[i].level = 1;
rsi->restoration_type[i] = RESTORE_WIENER;
rsi->vfilter[i][0] = aom_read_literal(rb, WIENER_FILT_TAP0_BITS) +
WIENER_FILT_TAP0_MINV;
rsi->vfilter[i][1] = aom_read_literal(rb, WIENER_FILT_TAP1_BITS) +
WIENER_FILT_TAP1_MINV;
rsi->vfilter[i][2] = aom_read_literal(rb, WIENER_FILT_TAP2_BITS) +
WIENER_FILT_TAP2_MINV;
rsi->hfilter[i][0] = aom_read_literal(rb, WIENER_FILT_TAP0_BITS) +
WIENER_FILT_TAP0_MINV;
rsi->hfilter[i][1] = aom_read_literal(rb, WIENER_FILT_TAP1_BITS) +
WIENER_FILT_TAP1_MINV;
rsi->hfilter[i][2] = aom_read_literal(rb, WIENER_FILT_TAP2_BITS) +
WIENER_FILT_TAP2_MINV;
rsi->wiener_info[i].vfilter[0] =
aom_read_literal(rb, WIENER_FILT_TAP0_BITS) +
WIENER_FILT_TAP0_MINV;
rsi->wiener_info[i].vfilter[1] =
aom_read_literal(rb, WIENER_FILT_TAP1_BITS) +
WIENER_FILT_TAP1_MINV;
rsi->wiener_info[i].vfilter[2] =
aom_read_literal(rb, WIENER_FILT_TAP2_BITS) +
WIENER_FILT_TAP2_MINV;
rsi->wiener_info[i].hfilter[0] =
aom_read_literal(rb, WIENER_FILT_TAP0_BITS) +
WIENER_FILT_TAP0_MINV;
rsi->wiener_info[i].hfilter[1] =
aom_read_literal(rb, WIENER_FILT_TAP1_BITS) +
WIENER_FILT_TAP1_MINV;
rsi->wiener_info[i].hfilter[2] =
aom_read_literal(rb, WIENER_FILT_TAP2_BITS) +
WIENER_FILT_TAP2_MINV;
} else {
rsi->wiener_level[i] = 0;
rsi->wiener_info[i].level = 0;
rsi->restoration_type[i] = RESTORE_NONE;
}
}
} else {
rsi->frame_restoration_type = RESTORE_BILATERAL;
rsi->bilateral_level = (int *)aom_realloc(
rsi->bilateral_level,
sizeof(*rsi->bilateral_level) * ntiles * BILATERAL_SUBTILES);
assert(rsi->bilateral_level != NULL);
rsi->bilateral_info = (BilateralInfo *)aom_realloc(
rsi->bilateral_info, sizeof(*rsi->bilateral_info) * ntiles);
assert(rsi->bilateral_info != NULL);
for (i = 0; i < ntiles; ++i) {
int s;
rsi->restoration_type[i] = RESTORE_BILATERAL;
for (s = 0; s < BILATERAL_SUBTILES; ++s) {
const int j = i * BILATERAL_SUBTILES + s;
if (aom_read(rb, RESTORE_NONE_BILATERAL_PROB)) {
rsi->bilateral_level[j] =
rsi->bilateral_info[i].level[s] =
aom_read_literal(rb, av1_bilateral_level_bits(cm));
} else {
rsi->bilateral_level[j] = -1;
rsi->bilateral_info[i].level[s] = -1;
}
}
}
......
......@@ -2455,75 +2455,84 @@ static void encode_restoration_mode(AV1_COMMON *cm,
static void encode_restoration(AV1_COMMON *cm, aom_writer *wb) {
int i;
RestorationInfo *rst = &cm->rst_info;
if (rst->frame_restoration_type != RESTORE_NONE) {
if (rst->frame_restoration_type == RESTORE_SWITCHABLE) {
RestorationInfo *rsi = &cm->rst_info;
if (rsi->frame_restoration_type != RESTORE_NONE) {
if (rsi->frame_restoration_type == RESTORE_SWITCHABLE) {
// RESTORE_SWITCHABLE
for (i = 0; i < cm->rst_internal.ntiles; ++i) {
av1_write_token(
wb, av1_switchable_restore_tree, cm->fc->switchable_restore_prob,
&switchable_restore_encodings[rst->restoration_type[i]]);
if (rst->restoration_type[i] == RESTORE_NONE) {
} else if (rst->restoration_type[i] == RESTORE_BILATERAL) {
&switchable_restore_encodings[rsi->restoration_type[i]]);
if (rsi->restoration_type[i] == RESTORE_BILATERAL) {
int s;
for (s = 0; s < BILATERAL_SUBTILES; ++s) {
const int j = i * BILATERAL_SUBTILES + s;
#if BILATERAL_SUBTILES == 0
aom_write_literal(wb, rst->bilateral_level[j],
aom_write_literal(wb, rsi->bilateral_info[i].level[s],
av1_bilateral_level_bits(cm));
#else
aom_write(wb, rst->bilateral_level[j] >= 0,
aom_write(wb, rsi->bilateral_info[i].level[s] >= 0,
RESTORE_NONE_BILATERAL_PROB);
if (rst->bilateral_level[j] >= 0) {
aom_write_literal(wb, rst->bilateral_level[j],
if (rsi->bilateral_info[i].level[s] >= 0) {
aom_write_literal(wb, rsi->bilateral_info[i].level[s],
av1_bilateral_level_bits(cm));
}
#endif
}
} else {
aom_write_literal(wb, rst->vfilter[i][0] - WIENER_FILT_TAP0_MINV,
WIENER_FILT_TAP0_BITS);
aom_write_literal(wb, rst->vfilter[i][1] - WIENER_FILT_TAP1_MINV,
WIENER_FILT_TAP1_BITS);
aom_write_literal(wb, rst->vfilter[i][2] - WIENER_FILT_TAP2_MINV,
WIENER_FILT_TAP2_BITS);
aom_write_literal(wb, rst->hfilter[i][0] - WIENER_FILT_TAP0_MINV,
WIENER_FILT_TAP0_BITS);
aom_write_literal(wb, rst->hfilter[i][1] - WIENER_FILT_TAP1_MINV,
WIENER_FILT_TAP1_BITS);
aom_write_literal(wb, rst->hfilter[i][2] - WIENER_FILT_TAP2_MINV,
WIENER_FILT_TAP2_BITS);
} else if (rsi->restoration_type[i] == RESTORE_WIENER) {
aom_write_literal(
wb, rsi->wiener_info[i].vfilter[0] - WIENER_FILT_TAP0_MINV,
WIENER_FILT_TAP0_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].vfilter[1] - WIENER_FILT_TAP1_MINV,
WIENER_FILT_TAP1_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].vfilter[2] - WIENER_FILT_TAP2_MINV,
WIENER_FILT_TAP2_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].hfilter[0] - WIENER_FILT_TAP0_MINV,
WIENER_FILT_TAP0_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].hfilter[1] - WIENER_FILT_TAP1_MINV,
WIENER_FILT_TAP1_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].hfilter[2] - WIENER_FILT_TAP2_MINV,
WIENER_FILT_TAP2_BITS);
}
}
} else if (rst->frame_restoration_type == RESTORE_BILATERAL) {
} else if (rsi->frame_restoration_type == RESTORE_BILATERAL) {
for (i = 0; i < cm->rst_internal.ntiles; ++i) {
int s;
for (s = 0; s < BILATERAL_SUBTILES; ++s) {
const int j = i * BILATERAL_SUBTILES + s;
aom_write(wb, rst->bilateral_level[j] >= 0,
aom_write(wb, rsi->bilateral_info[i].level[s] >= 0,
RESTORE_NONE_BILATERAL_PROB);
if (rst->bilateral_level[j] >= 0) {
aom_write_literal(wb, rst->bilateral_level[j],
if (rsi->bilateral_info[i].level[s] >= 0) {
aom_write_literal(wb, rsi->bilateral_info[i].level[s],
av1_bilateral_level_bits(cm));
}
}
}
} else if (rst->frame_restoration_type == RESTORE_WIENER) {
} else if (rsi->frame_restoration_type == RESTORE_WIENER) {
for (i = 0; i < cm->rst_internal.ntiles; ++i) {
aom_write(wb, rst->wiener_level[i] != 0, RESTORE_NONE_WIENER_PROB);
if (rst->wiener_level[i]) {
aom_write_literal(wb, rst->vfilter[i][0] - WIENER_FILT_TAP0_MINV,
WIENER_FILT_TAP0_BITS);
aom_write_literal(wb, rst->vfilter[i][1] - WIENER_FILT_TAP1_MINV,
WIENER_FILT_TAP1_BITS);
aom_write_literal(wb, rst->vfilter[i][2] - WIENER_FILT_TAP2_MINV,
WIENER_FILT_TAP2_BITS);
aom_write_literal(wb, rst->hfilter[i][0] - WIENER_FILT_TAP0_MINV,
WIENER_FILT_TAP0_BITS);
aom_write_literal(wb, rst->hfilter[i][1] - WIENER_FILT_TAP1_MINV,
WIENER_FILT_TAP1_BITS);
aom_write_literal(wb, rst->hfilter[i][2] - WIENER_FILT_TAP2_MINV,
WIENER_FILT_TAP2_BITS);
aom_write(wb, rsi->wiener_info[i].level != 0, RESTORE_NONE_WIENER_PROB);
if (rsi->wiener_info[i].level) {
aom_write_literal(
wb, rsi->wiener_info[i].vfilter[0] - WIENER_FILT_TAP0_MINV,
WIENER_FILT_TAP0_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].vfilter[1] - WIENER_FILT_TAP1_MINV,
WIENER_FILT_TAP1_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].vfilter[2] - WIENER_FILT_TAP2_MINV,
WIENER_FILT_TAP2_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].hfilter[0] - WIENER_FILT_TAP0_MINV,
WIENER_FILT_TAP0_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].hfilter[1] - WIENER_FILT_TAP1_MINV,
WIENER_FILT_TAP1_BITS);
aom_write_literal(
wb, rsi->wiener_info[i].hfilter[2] - WIENER_FILT_TAP2_MINV,
WIENER_FILT_TAP2_BITS);
}
}
}
......
This diff is collapsed.
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