Merge "vp8: Update to the adaptive denoising mode."
This commit is contained in:
commit
c92abbc447
@ -385,13 +385,13 @@ void vp8_deblock(VP8_COMMON *cm,
|
||||
}
|
||||
#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 @@ void vp8_de_noise(VP8_COMMON *cm,
|
||||
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)
|
||||
{
|
||||
|
@ -39,7 +39,8 @@ void vp8_de_noise(struct VP8Common *oci,
|
||||
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,
|
||||
|
@ -384,6 +384,7 @@ void vp8_denoiser_set_parameters(VP8_DENOISER *denoiser, int mode) {
|
||||
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 @@ void vp8_denoiser_set_parameters(VP8_DENOISER *denoiser, int mode) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,8 @@ typedef struct {
|
||||
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
|
||||
|
@ -4023,6 +4023,17 @@ static void encode_frame_to_data_rate
|
||||
|
||||
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 @@ static void encode_frame_to_data_rate
|
||||
|
||||
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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user