From 3225385b3e4d5667beef90811cf859aae48ff78a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Spr=C3=A5ng?= Date: Thu, 31 Mar 2022 16:11:15 +0200 Subject: [PATCH] VP9 per layer settings should not force denoising. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In r36379 a change to per-resolution setting of denoising was introduced that unintentionally enabled denoising on lower resolutions in the case that VideoCodec::VP9()->denoising was false. The CL makes sure the per-resolution setting are only allowed to disable denoising, not enable it. Bug: webrtc:13888 Change-Id: Ice07a5a7d27798dc2182a40af0ec521bde6210b6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257303 Reviewed-by: Ying Wang Commit-Queue: Erik Språng Cr-Commit-Position: refs/heads/main@{#36412} --- modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc | 10 +++++----- modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc index c8170837e7..0f398b8410 100644 --- a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc +++ b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc @@ -399,9 +399,9 @@ bool LibvpxVp9Encoder::SetSvcRates( if (seen_active_layer && performance_flags_.use_per_layer_speed) { bool denoiser_on = - AllowDenoising() && + AllowDenoising() && codec_.VP9()->denoisingOn && performance_flags_by_spatial_index_[num_active_spatial_layers_ - 1] - .denoiser_on; + .allow_denoising; libvpx_->codec_control(encoder_, VP9E_SET_NOISE_SENSITIVITY, denoiser_on ? 1 : 0); } @@ -823,9 +823,9 @@ int LibvpxVp9Encoder::InitAndSetControlSettings(const VideoCodec* inst) { performance_flags_by_spatial_index_[si].deblock_mode; } bool denoiser_on = - AllowDenoising() && + AllowDenoising() && inst->VP9().denoisingOn && performance_flags_by_spatial_index_[num_spatial_layers_ - 1] - .denoiser_on; + .allow_denoising; libvpx_->codec_control(encoder_, VP9E_SET_NOISE_SENSITIVITY, denoiser_on ? 1 : 0); } @@ -1911,7 +1911,7 @@ LibvpxVp9Encoder::ParsePerformanceFlagsFromTrials( FieldTrialStructMember("deblock_mode", [](Params* p) { return &p->deblock_mode; }), FieldTrialStructMember("denoiser", - [](Params* p) { return &p->denoiser_on; })}, + [](Params* p) { return &p->allow_denoising; })}, {}); FieldTrialFlag per_layer_speed("use_per_layer_speed"); diff --git a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h index e1be0f7c40..dd1ef3c763 100644 --- a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h +++ b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.h @@ -220,7 +220,7 @@ class LibvpxVp9Encoder : public VP9Encoder { // 1 = disable deblock for top-most TL // 2 = disable deblock for all TLs int deblock_mode = 0; - bool denoiser_on = true; + bool allow_denoising = true; }; // Map from min pixel count to settings for that resolution and above. // E.g. if you want some settings A if below wvga (640x360) and some other