ref: 6b79a1e3e0dfc265f43445b8181aa95e1c02deac
parent: 1b63238b678e24dfcd0ea17fc0d63c70b4b3d1a8
author: Marco <[email protected]>
date: Thu Nov 12 04:06:12 EST 2015
Update to noise estimation. Add frame level global check and adjust some parameters. Change-Id: I42103394f2d329781195d94ce6cbb5b3383eea17
--- a/vp9/encoder/vp9_noise_estimate.c
+++ b/vp9/encoder/vp9_noise_estimate.c
@@ -88,7 +88,7 @@
// Estimate of noise level every frame_period frames.
int frame_period = 10;
int thresh_consec_zeromv = 8;
- unsigned int thresh_sum_diff = 128;
+ unsigned int thresh_sum_diff = 80;
unsigned int thresh_sum_spatial = (200 * 200) << 8;
unsigned int thresh_spatial_var = (32 * 32) << 8;
int num_frames_estimate = 20;
@@ -135,8 +135,19 @@
const int uv_width_shift = y_width_shift >> 1;
const int uv_height_shift = y_height_shift >> 1;
int mi_row, mi_col;
+ int num_low_motion = 0;
+ int frame_low_motion = 1;
for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) {
+ int bl_index = mi_row * cm->mi_cols + mi_col;
+ if (cr->consec_zero_mv[bl_index] > thresh_consec_zeromv)
+ num_low_motion++;
+ }
+ }
+ if (num_low_motion < ((5 * cm->mi_rows * cm->mi_cols) >> 3))
+ frame_low_motion = 1;
+ for (mi_row = 0; mi_row < cm->mi_rows; mi_row++) {
+ for (mi_col = 0; mi_col < cm->mi_cols; mi_col++) {
// 16x16 blocks, 1/4 sample of frame.
if (mi_row % 4 == 0 && mi_col % 4 == 0) {
int bl_index = mi_row * cm->mi_cols + mi_col;
@@ -154,7 +165,8 @@
const uint8_t vsource =
src_v[uv_height_shift * src_uvstride + uv_width_shift];
int is_skin = vp9_skin_pixel(ysource, usource, vsource);
- if (cr->consec_zero_mv[bl_index] > thresh_consec_zeromv &&
+ if (frame_low_motion &&
+ cr->consec_zero_mv[bl_index] > thresh_consec_zeromv &&
cr->consec_zero_mv[bl_index1] > thresh_consec_zeromv &&
cr->consec_zero_mv[bl_index2] > thresh_consec_zeromv &&
cr->consec_zero_mv[bl_index3] > thresh_consec_zeromv &&
@@ -202,7 +214,7 @@
// Normalize.
avg_est = avg_est / num_samples;
// Update noise estimate.
- ne->value = (int)((3 * ne->value + avg_est) >> 2);
+ ne->value = (int)((7 * ne->value + avg_est) >> 3);
ne->count++;
if (ne->count == num_frames_estimate) {
// Reset counter and check noise level condition.