From af69ed20c4be1d8fda493334105a51ecb45cd6d4 Mon Sep 17 00:00:00 2001 From: Jerome Jiang Date: Mon, 1 May 2017 10:49:54 -0700 Subject: [PATCH] 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 --- vp9/encoder/vp9_noise_estimate.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/vp9/encoder/vp9_noise_estimate.c b/vp9/encoder/vp9_noise_estimate.c index fc2e32448..5652ded95 100644 --- a/vp9/encoder/vp9_noise_estimate.c +++ b/vp9/encoder/vp9_noise_estimate.c @@ -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++; } } -- 2.40.0