ref: 1a5482d4d856feacd7bf5a6385f72051675f93a7
parent: 66695533a8ec6530f557f9b00875473298e08b7a
author: Marco <marpan@google.com>
date: Mon Feb 6 12:02:28 EST 2017
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
--- a/vp9/encoder/vp9_denoiser.c
+++ b/vp9/encoder/vp9_denoiser.c
@@ -564,6 +564,25 @@
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;
--- a/vp9/encoder/vp9_denoiser.h
+++ b/vp9/encoder/vp9_denoiser.h
@@ -97,6 +97,13 @@
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
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -488,8 +488,16 @@
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) {
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -353,8 +353,17 @@
*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))