ref: c92abbc4478e9424b0b737c6e15ac00b7622b1d0
parent: d689e77c043ebd6fd6fb1671b3fbe2fa09c9faaa
parent: 06fce6b640aefffccd06551380520dac9a01660f
author: Marco <[email protected]>
date: Fri Sep 19 06:16:04 EDT 2014
Merge "vp8: Update to the adaptive denoising mode."
--- a/vp8/common/postproc.c
+++ b/vp8/common/postproc.c
@@ -385,13 +385,13 @@
}
#endif
-#if !(CONFIG_TEMPORAL_DENOISING)
void vp8_de_noise(VP8_COMMON *cm,
YV12_BUFFER_CONFIG *source,
YV12_BUFFER_CONFIG *post,
int q,
int low_var_thresh,
- int flag)
+ int flag,
+ int uvfilter)
{
int mbr;
double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
@@ -412,18 +412,20 @@
source->y_buffer + 16 * mbr * source->y_stride,
source->y_buffer + 16 * mbr * source->y_stride,
source->y_stride, source->y_stride, source->y_width, limits, 16);
-
- vp8_post_proc_down_and_across_mb_row(
- source->u_buffer + 8 * mbr * source->uv_stride,
- source->u_buffer + 8 * mbr * source->uv_stride,
- source->uv_stride, source->uv_stride, source->uv_width, limits, 8);
- vp8_post_proc_down_and_across_mb_row(
- source->v_buffer + 8 * mbr * source->uv_stride,
- source->v_buffer + 8 * mbr * source->uv_stride,
- source->uv_stride, source->uv_stride, source->uv_width, limits, 8);
+ if (uvfilter == 1) {
+ vp8_post_proc_down_and_across_mb_row(
+ source->u_buffer + 8 * mbr * source->uv_stride,
+ source->u_buffer + 8 * mbr * source->uv_stride,
+ source->uv_stride, source->uv_stride, source->uv_width, limits,
+ 8);
+ vp8_post_proc_down_and_across_mb_row(
+ source->v_buffer + 8 * mbr * source->uv_stride,
+ source->v_buffer + 8 * mbr * source->uv_stride,
+ source->uv_stride, source->uv_stride, source->uv_width, limits,
+ 8);
+ }
}
}
-#endif
double vp8_gaussian(double sigma, double mu, double x)
{
--- a/vp8/common/postproc.h
+++ b/vp8/common/postproc.h
@@ -39,7 +39,8 @@
YV12_BUFFER_CONFIG *post,
int q,
int low_var_thresh,
- int flag);
+ int flag,
+ int uvfilter);
void vp8_deblock(struct VP8Common *oci,
YV12_BUFFER_CONFIG *source,
--- a/vp8/encoder/denoising.c
+++ b/vp8/encoder/denoising.c
@@ -384,6 +384,7 @@
denoiser->denoise_pars.pickmode_mv_bias = 100;
denoiser->denoise_pars.qp_thresh = 0;
denoiser->denoise_pars.consec_zerolast = UINT_MAX;
+ denoiser->denoise_pars.spatial_blur = 0;
} else {
denoiser->denoise_pars.scale_sse_thresh = 2;
denoiser->denoise_pars.scale_motion_thresh = 16;
@@ -392,6 +393,7 @@
denoiser->denoise_pars.pickmode_mv_bias = 60;
denoiser->denoise_pars.qp_thresh = 100;
denoiser->denoise_pars.consec_zerolast = 10;
+ denoiser->denoise_pars.spatial_blur = 20;
}
}
--- a/vp8/encoder/denoising.h
+++ b/vp8/encoder/denoising.h
@@ -67,6 +67,8 @@
unsigned int qp_thresh;
// Threshold for number of consecutive frames for blocks coded as ZEROMV-LAST.
unsigned int consec_zerolast;
+ // Threshold for amount of spatial blur on Y channel. 0 means no spatial blur.
+ unsigned int spatial_blur;
} denoise_params;
typedef struct vp8_denoiser
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -4023,6 +4023,17 @@
scale_and_extend_source(cpi->un_scaled_source, cpi);
+#if CONFIG_TEMPORAL_DENOISING && CONFIG_POSTPROC
+ // Option to apply spatial blur under the aggressive or adaptive
+ // (temporal denoising) mode.
+ if (cpi->oxcf.noise_sensitivity >= 3) {
+ if (cpi->denoiser.denoise_pars.spatial_blur != 0) {
+ vp8_de_noise(cm, cpi->Source, cpi->Source,
+ cpi->denoiser.denoise_pars.spatial_blur, 1, 0, 0);
+ }
+ }
+#endif
+
#if !(CONFIG_REALTIME_ONLY) && CONFIG_POSTPROC && !(CONFIG_TEMPORAL_DENOISING)
if (cpi->oxcf.noise_sensitivity > 0)
@@ -4055,11 +4066,11 @@
if (cm->frame_type == KEY_FRAME)
{
- vp8_de_noise(cm, cpi->Source, cpi->Source, l , 1, 0);
+ vp8_de_noise(cm, cpi->Source, cpi->Source, l , 1, 0, 1);
}
else
{
- vp8_de_noise(cm, cpi->Source, cpi->Source, l , 1, 0);
+ vp8_de_noise(cm, cpi->Source, cpi->Source, l , 1, 0, 1);
src = cpi->Source->y_buffer;