ref: 17962ab2c07f4f8eaefac1d5050530f7e93887b0
parent: 63eb2ee0569e5480b39860eb898e16ab45b43e9c
author: JackyChen <[email protected]>
date: Tue Jun 14 10:25:55 EDT 2016
vp9: Code clean up for short circuit feature in low temp variance. Change-Id: I7573a5cf0ab79abed8d124019c0ed6d9531277f9
--- 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
@@ -1278,12 +1278,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];
@@ -1313,15 +1313,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;
}
@@ -1473,7 +1473,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]) &&