vp9: Enable noise estimation on low res.

Set noise level to kLowLow for high motion low res clips.
Change the normalization in noise metric for low res.
Reduce the initial time-window for all resolutions.

Change-Id: Iaed39dbb50b205cd9c735dc5b84822304fb01987
This commit is contained in:
Jerome Jiang 2017-05-01 10:49:54 -07:00
parent a24e1e8027
commit af69ed20c4

View File

@ -26,25 +26,27 @@ void vp9_noise_estimate_init(NOISE_ESTIMATE *const ne, int width, int height) {
ne->level = kLowLow;
ne->value = 0;
ne->count = 0;
ne->thresh = 100;
ne->thresh = 90;
ne->last_w = 0;
ne->last_h = 0;
if (width * height >= 1920 * 1080) {
ne->thresh = 200;
} else if (width * height >= 1280 * 720) {
ne->thresh = 140;
} else if (width * height >= 640 * 360) {
ne->thresh = 100;
}
ne->num_frames_estimate = 20;
ne->num_frames_estimate = 15;
}
static int enable_noise_estimation(VP9_COMP *const cpi) {
#if CONFIG_VP9_HIGHBITDEPTH
if (cpi->common.use_highbitdepth) return 0;
#endif
// Enable noise estimation if denoising is on, but not for low resolutions.
// Enable noise estimation if denoising is on.
#if CONFIG_VP9_TEMPORAL_DENOISING
if (cpi->oxcf.noise_sensitivity > 0 && denoise_svc(cpi) &&
cpi->common.width >= 640 && cpi->common.height >= 360)
cpi->common.width >= 320 && cpi->common.height >= 180)
return 1;
#endif
// Only allow noise estimate under certain encoding mode.
@ -97,6 +99,7 @@ NOISE_LEVEL vp9_noise_estimate_extract_level(NOISE_ESTIMATE *const ne) {
void vp9_update_noise_estimate(VP9_COMP *const cpi) {
const VP9_COMMON *const cm = &cpi->common;
NOISE_ESTIMATE *const ne = &cpi->noise_estimate;
const int low_res = (cm->width <= 352 && cm->height <= 288);
// Estimate of noise level every frame_period frames.
int frame_period = 8;
int thresh_consec_zeromv = 6;
@ -127,7 +130,7 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
ne->last_h = cm->height;
}
return;
} else if (cpi->rc.avg_frame_low_motion < 50) {
} else if (cpi->rc.avg_frame_low_motion < (low_res ? 70 : 50)) {
// Force noise estimation to 0 and denoiser off if content has high motion.
ne->level = kLowLow;
#if CONFIG_VP9_TEMPORAL_DENOISING
@ -210,7 +213,8 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
// Avoid blocks with high brightness and high spatial variance.
if ((sse2 - spatial_variance) < thresh_sum_spatial &&
spatial_variance < thresh_spatial_var) {
avg_est += variance / ((spatial_variance >> 9) + 1);
avg_est += low_res ? variance >> 4
: variance / ((spatial_variance >> 9) + 1);
num_samples++;
}
}