From: Marco Date: Tue, 7 Feb 2017 01:02:28 +0000 (-0800) Subject: vp9: Denoiser speed-up: increase partition and ac skip thresholds. X-Git-Tag: v1.7.0~745^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a5482d4d856feacd7bf5a6385f72051675f93a7;p=platform%2Fupstream%2Flibvpx.git vp9: Denoiser speed-up: increase partition and ac skip thresholds. Add factor to increase varianace partition and ac skip thresholds, under certain conditions (noise level and sum_diff), to increase denoiser speed. Change-Id: I7671140ef3598bf5f114a72623d68792bcd7b77b --- diff --git a/vp9/encoder/vp9_denoiser.c b/vp9/encoder/vp9_denoiser.c index a505d41..afc66d0 100644 --- a/vp9/encoder/vp9_denoiser.c +++ b/vp9/encoder/vp9_denoiser.c @@ -564,6 +564,25 @@ void vp9_denoiser_set_noise_level(VP9_DENOISER *denoiser, int noise_level) { denoiser->prev_denoising_level = denoiser->denoising_level; } +// Scale/increase the partition threshold for denoiser speed-up. +int64_t vp9_scale_part_thresh(int64_t threshold, + VP9_DENOISER_LEVEL noise_level) { + if (noise_level >= kDenLow) + return ((5 * threshold) >> 2); + else + return threshold; +} + +// Scale/increase the ac skip threshold for denoiser speed-up. +int64_t vp9_scale_acskip_thresh(int64_t threshold, + VP9_DENOISER_LEVEL noise_level, + int abs_sumdiff) { + if (noise_level >= kDenLow && abs_sumdiff < 5) + return threshold *= (noise_level == kDenLow) ? 2 : 6; + else + return threshold; +} + #ifdef OUTPUT_YUV_DENOISED static void make_grayscale(YV12_BUFFER_CONFIG *yuv) { int r, c; diff --git a/vp9/encoder/vp9_denoiser.h b/vp9/encoder/vp9_denoiser.h index fcfaa50..a029339 100644 --- a/vp9/encoder/vp9_denoiser.h +++ b/vp9/encoder/vp9_denoiser.h @@ -97,6 +97,13 @@ void vp9_denoiser_free(VP9_DENOISER *denoiser); void vp9_denoiser_set_noise_level(VP9_DENOISER *denoiser, int noise_level); +int64_t vp9_scale_part_thresh(int64_t threshold, + VP9_DENOISER_LEVEL noise_level); + +int64_t vp9_scale_acskip_thresh(int64_t threshold, + VP9_DENOISER_LEVEL noise_level, + int abs_sumdiff); + #ifdef __cplusplus } // extern "C" #endif diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index a62f4b4..1bbdeec 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -488,8 +488,16 @@ static void set_vbp_thresholds(VP9_COMP *cpi, int64_t thresholds[], int q) { else if (noise_level < kLow) threshold_base = (7 * threshold_base) >> 3; } +#if CONFIG_VP9_TEMPORAL_DENOISING + if (cpi->oxcf.noise_sensitivity > 0) + threshold_base = + vp9_scale_part_thresh(threshold_base, cpi->denoiser.denoising_level); + else if (cpi->oxcf.speed >= 8 && cm->width <= 640 && cm->height <= 480) + threshold_base = (5 * threshold_base) >> 2; +#else if (cpi->oxcf.speed >= 8 && cm->width <= 640 && cm->height <= 480) threshold_base = (5 * threshold_base) >> 2; +#endif thresholds[0] = threshold_base; thresholds[2] = threshold_base << cpi->oxcf.speed; if (cm->width <= 352 && cm->height <= 288) { diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index de1546a..8126a0a 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -353,8 +353,17 @@ static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize, *var_y = var; *sse_y = sse; +#if CONFIG_VP9_TEMPORAL_DENOISING + if (cpi->oxcf.noise_sensitivity > 0) + ac_thr = vp9_scale_acskip_thresh(ac_thr, cpi->denoiser.denoising_level, + (abs(sum) >> (bw + bh))); + else + ac_thr *= ac_thr_factor(cpi->oxcf.speed, cpi->common.width, + cpi->common.height, abs(sum) >> (bw + bh)); +#else ac_thr *= ac_thr_factor(cpi->oxcf.speed, cpi->common.width, cpi->common.height, abs(sum) >> (bw + bh)); +#endif if (cpi->common.tx_mode == TX_MODE_SELECT) { if (sse > (var << 2))