summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp9/encoder/vp9_denoiser.c19
-rw-r--r--vp9/encoder/vp9_denoiser.h7
-rw-r--r--vp9/encoder/vp9_encodeframe.c8
-rw-r--r--vp9/encoder/vp9_pickmode.c9
4 files changed, 43 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_denoiser.c b/vp9/encoder/vp9_denoiser.c
index a505d4105..afc66d00f 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 fcfaa5051..a029339e5 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 a62f4b44c..1bbdeece5 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 de1546aff..8126a0a71 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))