summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_noise_estimate.c
diff options
context:
space:
mode:
authorMarco <marpan@google.com>2016-12-21 14:33:21 -0800
committerMarco <marpan@google.com>2017-01-10 17:23:58 -0800
commit7e3a82c3847c9f6f84f2a2f7cf3ea2aab0388053 (patch)
tree9dedd9f02804687c091ff8c5244a3e6928c4dd20 /vp9/encoder/vp9_noise_estimate.c
parent91fc730d831a46751fe5adb96f4897085b483313 (diff)
downloadlibvpx-7e3a82c3847c9f6f84f2a2f7cf3ea2aab0388053.tar.gz
vp9: Make the denoiser work with spatial SVC.
If enabled denoiser will only denoise the top spatial layer for now. Added unittest for SVC with denoising. Change-Id: Ifa373771c4ecfa208615eb163cc38f1c22c6664b
Diffstat (limited to 'vp9/encoder/vp9_noise_estimate.c')
-rw-r--r--vp9/encoder/vp9_noise_estimate.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/vp9/encoder/vp9_noise_estimate.c b/vp9/encoder/vp9_noise_estimate.c
index 2252fe16b..3dc321bfc 100644
--- a/vp9/encoder/vp9_noise_estimate.c
+++ b/vp9/encoder/vp9_noise_estimate.c
@@ -40,8 +40,8 @@ void vp9_noise_estimate_init(NOISE_ESTIMATE *const ne, int width, int height) {
static int enable_noise_estimation(VP9_COMP *const cpi) {
// Enable noise estimation if denoising is on, but not for low resolutions.
#if CONFIG_VP9_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity > 0 && cpi->common.width >= 640 &&
- cpi->common.height >= 360)
+ if (cpi->oxcf.noise_sensitivity > 0 && denoise_svc(cpi) &&
+ cpi->common.width >= 640 && cpi->common.height >= 360)
return 1;
#endif
// Only allow noise estimate under certain encoding mode.
@@ -101,17 +101,22 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
unsigned int thresh_sum_spatial = (200 * 200) << 8;
unsigned int thresh_spatial_var = (32 * 32) << 8;
int min_blocks_estimate = cm->mi_rows * cm->mi_cols >> 7;
+ int frame_counter = cm->current_video_frame;
// Estimate is between current source and last source.
YV12_BUFFER_CONFIG *last_source = cpi->Last_Source;
#if CONFIG_VP9_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity > 0) last_source = &cpi->denoiser.last_source;
+ if (cpi->oxcf.noise_sensitivity > 0 && denoise_svc(cpi))
+ last_source = &cpi->denoiser.last_source;
#endif
ne->enabled = enable_noise_estimation(cpi);
- if (!ne->enabled || cm->current_video_frame % frame_period != 0 ||
- last_source == NULL || ne->last_w != cm->width ||
- ne->last_h != cm->height) {
+ if (cpi->svc.number_spatial_layers > 1)
+ frame_counter = cpi->svc.current_superframe;
+ if (!ne->enabled || frame_counter % frame_period != 0 ||
+ last_source == NULL ||
+ (cpi->svc.number_spatial_layers == 1 &&
+ (ne->last_w != cm->width || ne->last_h != cm->height))) {
#if CONFIG_VP9_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity > 0)
+ if (cpi->oxcf.noise_sensitivity > 0 && denoise_svc(cpi))
copy_frame(&cpi->denoiser.last_source, cpi->Source);
#endif
if (last_source != NULL) {
@@ -123,7 +128,7 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
// Force noise estimation to 0 and denoiser off if content has high motion.
ne->level = kLowLow;
#if CONFIG_VP9_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity > 0)
+ if (cpi->oxcf.noise_sensitivity > 0 && denoise_svc(cpi))
vp9_denoiser_set_noise_level(&cpi->denoiser, ne->level);
#endif
return;
@@ -232,14 +237,14 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
ne->count = 0;
ne->level = vp9_noise_estimate_extract_level(ne);
#if CONFIG_VP9_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity > 0)
+ if (cpi->oxcf.noise_sensitivity > 0 && denoise_svc(cpi))
vp9_denoiser_set_noise_level(&cpi->denoiser, ne->level);
#endif
}
}
}
#if CONFIG_VP9_TEMPORAL_DENOISING
- if (cpi->oxcf.noise_sensitivity > 0)
+ if (cpi->oxcf.noise_sensitivity > 0 && denoise_svc(cpi))
copy_frame(&cpi->denoiser.last_source, cpi->Source);
#endif
}