ref: 9c90830165413f5197d993a94e4b46def3e53aa3
parent: 221fcdac85eaab64c4ea65d06cbbdc6e124c5412
parent: 17962ab2c07f4f8eaefac1d5050530f7e93887b0
author: Jacky Chen <jackychen@google.com>
date: Wed Jun 15 12:49:32 EDT 2016
Merge "vp9: Code clean up for short circuit feature in low temp variance."
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -773,9 +773,7 @@
}
}
- for (i = 0; i < 25; i++) {
- x->variance_low[i] = 0;
- }
+ memset(x->variance_low, 0, sizeof(x->variance_low));
if (xd->mb_to_right_edge < 0)
pixels_wide += (xd->mb_to_right_edge >> 3);
@@ -1083,7 +1081,7 @@
}
if (cpi->sf.short_circuit_low_temp_var) {
- int mv_thr = cm->width > 640 ? 8 : 4;
+ const int mv_thr = cm->width > 640 ? 8 : 4;
// Check temporal variance for bsize >= 16x16, if LAST_FRAME was selected
// and int_pro mv is small. If the temporal variance is small set the
// variance_low flag for the block. The variance threshold can be adjusted,
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -1276,12 +1276,12 @@
}
#endif // CONFIG_VP9_TEMPORAL_DENOISING
-static INLINE int set_force_skip_low_temp_var(uint8_t *variance_low,
+static INLINE int get_force_skip_low_temp_var(uint8_t *variance_low,
int mi_row, int mi_col,
BLOCK_SIZE bsize) {
+ const int i = (mi_row & 0x7) >> 1;
+ const int j = (mi_col & 0x7) >> 1;
int force_skip_low_temp_var = 0;
- int i = (mi_row & 0x7) >> 1;
- int j = (mi_col & 0x7) >> 1;
// Set force_skip_low_temp_var based on the block size and block offset.
if (bsize == BLOCK_64X64) {
force_skip_low_temp_var = variance_low[0];
@@ -1311,15 +1311,15 @@
force_skip_low_temp_var = variance_low[pos_shift_16x16[i][j]];
} else if (bsize == BLOCK_32X16) {
// The col shift index for the second 16x16 block.
- int j2 = ((mi_col + 2) & 0x7) >> 1;
+ const int j2 = ((mi_col + 2) & 0x7) >> 1;
// Only if each 16x16 block inside has low temporal variance.
force_skip_low_temp_var = variance_low[pos_shift_16x16[i][j]] &&
- variance_low[pos_shift_16x16[i][j2]];
+ variance_low[pos_shift_16x16[i][j2]];
} else if (bsize == BLOCK_16X32) {
// The row shift index for the second 16x16 block.
- int i2 = ((mi_row + 2) & 0x7) >> 1;
+ const int i2 = ((mi_row + 2) & 0x7) >> 1;
force_skip_low_temp_var = variance_low[pos_shift_16x16[i][j]] &&
- variance_low[pos_shift_16x16[i2][j]];
+ variance_low[pos_shift_16x16[i2][j]];
}
return force_skip_low_temp_var;
}
@@ -1471,7 +1471,7 @@
if (cpi->sf.short_circuit_low_temp_var) {
force_skip_low_temp_var =
- set_force_skip_low_temp_var(&x->variance_low[0], mi_row, mi_col, bsize);
+ get_force_skip_low_temp_var(&x->variance_low[0], mi_row, mi_col, bsize);
}
if (!((cpi->ref_frame_flags & flag_list[GOLDEN_FRAME]) &&