Index: source/libvpx/vp8/encoder/onyx_if.c |
=================================================================== |
--- source/libvpx/vp8/encoder/onyx_if.c (revision 291087) |
+++ source/libvpx/vp8/encoder/onyx_if.c (working copy) |
@@ -615,19 +615,21 @@ |
cpi->cyclic_refresh_mode_index = i; |
#if CONFIG_TEMPORAL_DENOISING |
- if (cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive && |
- Q < (int)cpi->denoiser.denoise_pars.qp_thresh) { |
- // Under aggressive denoising mode, use segmentation to turn off loop |
- // filter below some qp thresh. The loop filter is turned off for all |
- // blocks that have been encoded as ZEROMV LAST x frames in a row, |
- // where x is set by cpi->denoiser.denoise_pars.consec_zerolast. |
- // This is to avoid "dot" artifacts that can occur from repeated |
- // loop filtering on noisy input source. |
- cpi->cyclic_refresh_q = Q; |
- lf_adjustment = -MAX_LOOP_FILTER; |
- for (i = 0; i < mbs_in_frame; ++i) { |
- seg_map[i] = (cpi->consec_zero_last[i] > |
- cpi->denoiser.denoise_pars.consec_zerolast) ? 1 : 0; |
+ if (cpi->oxcf.noise_sensitivity > 0) { |
+ if (cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive && |
+ Q < (int)cpi->denoiser.denoise_pars.qp_thresh) { |
+ // Under aggressive denoising, use segmentation to turn off loop |
+ // filter below some qp thresh. The filter is turned off for all |
+ // blocks that have been encoded as ZEROMV LAST x frames in a row, |
+ // where x is set by cpi->denoiser.denoise_pars.consec_zerolast. |
+ // This is to avoid "dot" artifacts that can occur from repeated |
+ // loop filtering on noisy input source. |
+ cpi->cyclic_refresh_q = Q; |
+ lf_adjustment = -MAX_LOOP_FILTER; |
+ for (i = 0; i < mbs_in_frame; ++i) { |
+ seg_map[i] = (cpi->consec_zero_last[i] > |
+ cpi->denoiser.denoise_pars.consec_zerolast) ? 1 : 0; |
+ } |
} |
} |
#endif |
@@ -3301,15 +3303,17 @@ |
int skip = 2; |
// Only select blocks for computing nmse that have been encoded |
// as ZERO LAST min_consec_zero_last frames in a row. |
- int min_consec_zero_last = 10; |
+ // Scale with number of temporal layers. |
+ int min_consec_zero_last = 8 / cpi->oxcf.number_of_layers; |
// Decision is tested for changing the denoising mode every |
// num_mode_change times this function is called. Note that this |
// function called every 8 frames, so (8 * num_mode_change) is number |
// of frames where denoising mode change is tested for switch. |
int num_mode_change = 15; |
// Framerate factor, to compensate for larger mse at lower framerates. |
- // TODO(marpan): Adjust this factor, |
- int fac_framerate = cpi->output_framerate < 25.0f ? 80 : 100; |
+ // Use ref_framerate, which is full source framerate for temporal layers. |
+ // TODO(marpan): Adjust this factor. |
+ int fac_framerate = cpi->ref_framerate < 25.0f ? 80 : 100; |
int tot_num_blocks = cm->mb_rows * cm->mb_cols; |
int ystride = cpi->Source->y_stride; |
unsigned char *src = cpi->Source->y_buffer; |
@@ -3378,13 +3382,13 @@ |
// num_mode_change. |
if (cpi->denoiser.nmse_source_diff_count == num_mode_change) { |
// Check for going up: from normal to aggressive mode. |
- if ((cpi->denoiser.denoiser_mode = kDenoiserOnYUV) && |
+ if ((cpi->denoiser.denoiser_mode == kDenoiserOnYUV) && |
(cpi->denoiser.nmse_source_diff > |
cpi->denoiser.threshold_aggressive_mode)) { |
vp8_denoiser_set_parameters(&cpi->denoiser, kDenoiserOnYUVAggressive); |
} else { |
// Check for going down: from aggressive to normal mode. |
- if ((cpi->denoiser.denoiser_mode = kDenoiserOnYUVAggressive) && |
+ if ((cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive) && |
(cpi->denoiser.nmse_source_diff < |
cpi->denoiser.threshold_aggressive_mode)) { |
vp8_denoiser_set_parameters(&cpi->denoiser, kDenoiserOnYUV); |