Commit e2511e15 authored by Jean-Marc Valin's avatar Jean-Marc Valin

Deringing cleanup: don't hardcode the number of levels

No change in code behaviour.

Change-Id: If612c1340b4ca30e290947607ecb64a0cb30e95e
parent 8fe5c5d6
......@@ -20,7 +20,7 @@
int compute_level_from_index(int global_level, int gi) {
static const int dering_gains[4] = {0, 11, 16, 22};
static const int dering_gains[DERING_REFINEMENT_LEVELS] = {0, 11, 16, 22};
int level;
if (global_level == 0) return 0;
level = (global_level*dering_gains[gi] + 8) >> 4;
......
......@@ -15,6 +15,8 @@ extern "C" {
#define MAX_DERING_LEVEL (1 << DERING_LEVEL_BITS)
#define DERING_REFINEMENT 1
#define DERING_REFINEMENT_BITS 2
#define DERING_REFINEMENT_LEVELS 4
int compute_level_from_index(int global_level, int gi);
int sb_all_skip(const VP10_COMMON *const cm, int mi_row, int mi_col);
......
......@@ -976,7 +976,7 @@ static void decode_partition(VP10Decoder *const pbi, MACROBLOCKD *const xd,
if (bsize == BLOCK_64X64) {
if (cm->dering_level != 0 && !sb_all_skip(cm, mi_row, mi_col)) {
cm->mi_grid_visible[mi_row*cm->mi_stride + mi_col]->mbmi.dering_gain =
vpx_read_literal(r, 2);
vpx_read_literal(r, DERING_REFINEMENT_BITS);
} else {
cm->mi_grid_visible[mi_row*cm->mi_stride + mi_col]->mbmi.dering_gain = 0;
}
......
......@@ -611,7 +611,7 @@ static void write_modes_sb(VP10_COMP *cpi, const TileInfo *const tile,
!sb_all_skip(cm, mi_row, mi_col)) {
vpx_write_literal(
w, cm->mi_grid_visible[mi_row*cm->mi_stride + mi_col]->mbmi.dering_gain,
2);
DERING_REFINEMENT_BITS);
}
#endif
}
......
......@@ -155,7 +155,7 @@ int vp10_dering_search(YV12_BUFFER_CONFIG *frame, const YV12_BUFFER_CONFIG *ref,
int best_gi;
int best_mse = mse[nhsb*sbr+sbc][0];
best_gi = 0;
for (gi = 1; gi < 4; gi++) {
for (gi = 1; gi < DERING_REFINEMENT_LEVELS; gi++) {
level = compute_level_from_index(best_level, gi);
if (mse[nhsb*sbr+sbc][level] < best_mse) {
best_gi = gi;
......
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