Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: source/libvpx/vp8/encoder/onyx_if.c

Issue 592203002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/vp8/encoder/encodemb.c ('k') | source/libvpx/vp8/encoder/quantize.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp8/encoder/onyx_if.c
===================================================================
--- source/libvpx/vp8/encoder/onyx_if.c (revision 292072)
+++ source/libvpx/vp8/encoder/onyx_if.c (working copy)
@@ -3370,33 +3370,43 @@
if (total > 0 &&
(num_blocks > (tot_num_blocks >> 4))) {
// Update the recursive mean square source_diff.
- if (cpi->denoiser.nmse_source_diff_count == 0)
+ if (cpi->denoiser.nmse_source_diff_count == 0) {
// First sample in new interval.
cpi->denoiser.nmse_source_diff = total;
- else
+ cpi->denoiser.qp_avg = cm->base_qindex;
+ } else {
// For subsequent samples, use average with weight ~1/4 for new sample.
cpi->denoiser.nmse_source_diff = (int)((total >> 2) +
3 * (cpi->denoiser.nmse_source_diff >> 2));
+ cpi->denoiser.qp_avg = (int)((cm->base_qindex >> 2) +
+ 3 * (cpi->denoiser.qp_avg >> 2));
+ }
cpi->denoiser.nmse_source_diff_count++;
}
// Check for changing the denoiser mode, when we have obtained #samples =
- // num_mode_change.
+ // num_mode_change. Condition the change also on the bitrate and QP.
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) &&
(cpi->denoiser.nmse_source_diff >
- cpi->denoiser.threshold_aggressive_mode)) {
+ cpi->denoiser.threshold_aggressive_mode) &&
+ (cpi->denoiser.qp_avg < cpi->denoiser.qp_threshold_up &&
+ cpi->target_bandwidth > cpi->denoiser.bitrate_threshold)) {
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)) {
+ cpi->denoiser.threshold_aggressive_mode)) ||
+ ((cpi->denoiser.denoiser_mode == kDenoiserOnYUVAggressive) &&
+ (cpi->denoiser.qp_avg > cpi->denoiser.qp_threshold_down ||
+ cpi->target_bandwidth < cpi->denoiser.bitrate_threshold))) {
vp8_denoiser_set_parameters(&cpi->denoiser, kDenoiserOnYUV);
}
}
// Reset metric and counter for next interval.
cpi->denoiser.nmse_source_diff = 0;
+ cpi->denoiser.qp_avg = 0;
cpi->denoiser.nmse_source_diff_count = 0;
}
}
@@ -4013,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)
@@ -4045,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;
« no previous file with comments | « source/libvpx/vp8/encoder/encodemb.c ('k') | source/libvpx/vp8/encoder/quantize.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698