AEC3: Rename shadow filter

This CL renames the shadow filter in AEC3 to have the more accurate name
coarse filter.

The CL consists of 3 main initial patch sets, designed to simplify
the review:
1) Replaces "shadow" with "coarse" and adds a fall-back functionality
to support the old filter naming.
2) Renames the files according to the new naming.
3) Performs a "git cl format"

Bug: webrtc:8671
Change-Id: I28d6041d0d34e85f8f8048d004b44a1a5f07bb07
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170981
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30846}
diff --git a/api/audio/echo_canceller3_config.cc b/api/audio/echo_canceller3_config.cc
index 1122d4c..2438738 100644
--- a/api/audio/echo_canceller3_config.cc
+++ b/api/audio/echo_canceller3_config.cc
@@ -170,6 +170,19 @@
     res = false;
   }
 
+  res = res & FloorLimit(&c->filter.coarse.length_blocks, 1);
+  res = res & Limit(&c->filter.coarse.rate, 0.f, 1.f);
+  res = res & Limit(&c->filter.coarse.noise_gate, 0.f, 100000000.f);
+
+  res = res & FloorLimit(&c->filter.coarse_initial.length_blocks, 1);
+  res = res & Limit(&c->filter.coarse_initial.rate, 0.f, 1.f);
+  res = res & Limit(&c->filter.coarse_initial.noise_gate, 0.f, 100000000.f);
+
+  if (c->filter.coarse.length_blocks < c->filter.coarse_initial.length_blocks) {
+    c->filter.coarse_initial.length_blocks = c->filter.coarse.length_blocks;
+    res = false;
+  }
+
   res = res & Limit(&c->filter.config_change_duration_blocks, 0, 100000);
   res = res & Limit(&c->filter.initial_state_seconds, 0.f, 100.f);
 
diff --git a/api/audio/echo_canceller3_config.h b/api/audio/echo_canceller3_config.h
index 66989db..523cf94 100644
--- a/api/audio/echo_canceller3_config.h
+++ b/api/audio/echo_canceller3_config.h
@@ -70,31 +70,34 @@
       float noise_gate;
     };
 
-    struct ShadowConfiguration {
+    struct CoarseConfiguration {
       size_t length_blocks;
       float rate;
       float noise_gate;
     };
 
     RefinedConfiguration main = {13, 0.00005f, 0.05f, 0.001f, 2.f, 20075344.f};
-    ShadowConfiguration shadow = {13, 0.7f, 20075344.f};
+    CoarseConfiguration shadow = {13, 0.7f, 20075344.f};
     RefinedConfiguration refined = {13,     0.00005f, 0.05f,
                                     0.001f, 2.f,      20075344.f};
+    CoarseConfiguration coarse = {13, 0.7f, 20075344.f};
 
     RefinedConfiguration main_initial = {12,     0.005f, 0.5f,
                                          0.001f, 2.f,    20075344.f};
-    ShadowConfiguration shadow_initial = {12, 0.9f, 20075344.f};
+    CoarseConfiguration shadow_initial = {12, 0.9f, 20075344.f};
     RefinedConfiguration refined_initial = {12,     0.005f, 0.5f,
                                             0.001f, 2.f,    20075344.f};
+    CoarseConfiguration coarse_initial = {12, 0.9f, 20075344.f};
 
     size_t config_change_duration_blocks = 250;
     float initial_state_seconds = 2.5f;
     bool conservative_initial_phase = false;
     bool enable_shadow_filter_output_usage = true;
+    bool enable_coarse_filter_output_usage = true;
     bool use_linear_filter = true;
     bool export_linear_aec_output = false;
-    // Uses the filter configurations named main rather than those named
-    // refined.
+    // Uses the filter configurations named main and shadow rather than those
+    // named refined and coarse.
     bool use_legacy_filter_naming = true;
   } filter;
 
diff --git a/api/audio/echo_canceller3_config_json.cc b/api/audio/echo_canceller3_config_json.cc
index fd06fa9..7734e32 100644
--- a/api/audio/echo_canceller3_config_json.cc
+++ b/api/audio/echo_canceller3_config_json.cc
@@ -76,7 +76,7 @@
 
 void ReadParam(const Json::Value& root,
                std::string param_name,
-               EchoCanceller3Config::Filter::ShadowConfiguration* param) {
+               EchoCanceller3Config::Filter::CoarseConfiguration* param) {
   RTC_DCHECK(param);
   Json::Value json_array;
   if (rtc::GetValueFromJsonObject(root, param_name, &json_array)) {
@@ -218,9 +218,11 @@
     ReadParam(section, "main", &cfg.filter.main);
     ReadParam(section, "refined", &cfg.filter.refined);
     ReadParam(section, "shadow", &cfg.filter.shadow);
+    ReadParam(section, "coarse", &cfg.filter.coarse);
     ReadParam(section, "main_initial", &cfg.filter.main_initial);
     ReadParam(section, "refined_initial", &cfg.filter.refined_initial);
     ReadParam(section, "shadow_initial", &cfg.filter.shadow_initial);
+    ReadParam(section, "coarse_initial", &cfg.filter.coarse_initial);
     ReadParam(section, "config_change_duration_blocks",
               &cfg.filter.config_change_duration_blocks);
     ReadParam(section, "initial_state_seconds",
@@ -229,6 +231,8 @@
               &cfg.filter.conservative_initial_phase);
     ReadParam(section, "enable_shadow_filter_output_usage",
               &cfg.filter.enable_shadow_filter_output_usage);
+    ReadParam(section, "enable_coarse_filter_output_usage",
+              &cfg.filter.enable_coarse_filter_output_usage);
     ReadParam(section, "use_linear_filter", &cfg.filter.use_linear_filter);
     ReadParam(section, "export_linear_aec_output",
               &cfg.filter.export_linear_aec_output);
@@ -487,6 +491,12 @@
   ost << config.filter.shadow.noise_gate;
   ost << "],";
 
+  ost << "\"coarse\": [";
+  ost << config.filter.coarse.length_blocks << ",";
+  ost << config.filter.coarse.rate << ",";
+  ost << config.filter.coarse.noise_gate;
+  ost << "],";
+
   ost << "\"main_initial\": [";
   ost << config.filter.main_initial.length_blocks << ",";
   ost << config.filter.main_initial.leakage_converged << ",";
@@ -511,6 +521,12 @@
   ost << config.filter.shadow_initial.noise_gate;
   ost << "],";
 
+  ost << "\"coarse_initial\": [";
+  ost << config.filter.coarse_initial.length_blocks << ",";
+  ost << config.filter.coarse_initial.rate << ",";
+  ost << config.filter.coarse_initial.noise_gate;
+  ost << "],";
+
   ost << "\"config_change_duration_blocks\": "
       << config.filter.config_change_duration_blocks << ",";
   ost << "\"initial_state_seconds\": " << config.filter.initial_state_seconds
@@ -520,6 +536,9 @@
   ost << "\"enable_shadow_filter_output_usage\": "
       << (config.filter.enable_shadow_filter_output_usage ? "true" : "false")
       << ",";
+  ost << "\"enable_coarse_filter_output_usage\": "
+      << (config.filter.enable_coarse_filter_output_usage ? "true" : "false")
+      << ",";
   ost << "\"use_linear_filter\": "
       << (config.filter.use_linear_filter ? "true" : "false") << ",";
   ost << "\"export_linear_aec_output\": "
diff --git a/api/audio/test/echo_canceller3_config_json_unittest.cc b/api/audio/test/echo_canceller3_config_json_unittest.cc
index 2cc3463..f5c2675 100644
--- a/api/audio/test/echo_canceller3_config_json_unittest.cc
+++ b/api/audio/test/echo_canceller3_config_json_unittest.cc
@@ -22,6 +22,7 @@
   cfg.filter.main.error_floor = 1.f;
   cfg.filter.refined.error_floor = 2.f;
   cfg.filter.shadow_initial.length_blocks = 7u;
+  cfg.filter.coarse_initial.length_blocks = 3u;
   cfg.suppressor.normal_tuning.mask_hf.enr_suppress = .5f;
   cfg.suppressor.subband_nearend_detection.nearend_average_blocks = 3;
   cfg.suppressor.subband_nearend_detection.subband1 = {1, 3};
@@ -42,12 +43,14 @@
             cfg_transformed.delay.down_sampling_factor);
   EXPECT_EQ(cfg.delay.log_warning_on_delay_changes,
             cfg_transformed.delay.log_warning_on_delay_changes);
+  EXPECT_EQ(cfg.filter.coarse_initial.length_blocks,
+            cfg_transformed.filter.coarse_initial.length_blocks);
+  EXPECT_EQ(cfg.filter.shadow_initial.length_blocks,
+            cfg_transformed.filter.shadow_initial.length_blocks);
   EXPECT_EQ(cfg.filter.main.error_floor,
             cfg_transformed.filter.main.error_floor);
   EXPECT_EQ(cfg.filter.refined.error_floor,
             cfg_transformed.filter.refined.error_floor);
-  EXPECT_EQ(cfg.filter.shadow_initial.length_blocks,
-            cfg_transformed.filter.shadow_initial.length_blocks);
   EXPECT_EQ(cfg.suppressor.normal_tuning.mask_hf.enr_suppress,
             cfg_transformed.suppressor.normal_tuning.mask_hf.enr_suppress);
   EXPECT_EQ(cfg.suppressor.subband_nearend_detection.nearend_average_blocks,
diff --git a/modules/audio_processing/aec3/BUILD.gn b/modules/audio_processing/aec3/BUILD.gn
index e67c802..c56f05c 100644
--- a/modules/audio_processing/aec3/BUILD.gn
+++ b/modules/audio_processing/aec3/BUILD.gn
@@ -38,6 +38,8 @@
     "block_processor_metrics.h",
     "clockdrift_detector.cc",
     "clockdrift_detector.h",
+    "coarse_filter_update_gain.cc",
+    "coarse_filter_update_gain.h",
     "comfort_noise_generator.cc",
     "comfort_noise_generator.h",
     "decimator.cc",
@@ -101,8 +103,6 @@
     "reverb_model.h",
     "reverb_model_estimator.cc",
     "reverb_model_estimator.h",
-    "shadow_filter_update_gain.cc",
-    "shadow_filter_update_gain.h",
     "signal_dependent_erle_estimator.cc",
     "signal_dependent_erle_estimator.h",
     "spectrum_buffer.cc",
@@ -203,6 +203,7 @@
         "block_processor_metrics_unittest.cc",
         "block_processor_unittest.cc",
         "clockdrift_detector_unittest.cc",
+        "coarse_filter_update_gain_unittest.cc",
         "comfort_noise_generator_unittest.cc",
         "decimator_unittest.cc",
         "echo_canceller3_unittest.cc",
@@ -226,7 +227,6 @@
         "render_signal_analyzer_unittest.cc",
         "residual_echo_estimator_unittest.cc",
         "reverb_model_estimator_unittest.cc",
-        "shadow_filter_update_gain_unittest.cc",
         "signal_dependent_erle_estimator_unittest.cc",
         "subtractor_unittest.cc",
         "suppression_filter_unittest.cc",
diff --git a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
index 7e0591d..8e4f5d9 100644
--- a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
+++ b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
@@ -25,9 +25,9 @@
 #include "modules/audio_processing/aec3/adaptive_fir_filter_erl.h"
 #include "modules/audio_processing/aec3/aec3_fft.h"
 #include "modules/audio_processing/aec3/aec_state.h"
+#include "modules/audio_processing/aec3/coarse_filter_update_gain.h"
 #include "modules/audio_processing/aec3/render_delay_buffer.h"
 #include "modules/audio_processing/aec3/render_signal_analyzer.h"
-#include "modules/audio_processing/aec3/shadow_filter_update_gain.h"
 #include "modules/audio_processing/logging/apm_data_dumper.h"
 #include "modules/audio_processing/test/echo_canceller_test_tools.h"
 #include "modules/audio_processing/utility/cascaded_biquad_filter.h"
@@ -354,9 +354,9 @@
 
   if (num_render_channels == 33) {
     config.filter.refined = {13, 0.00005f, 0.0005f, 0.0001f, 2.f, 20075344.f};
-    config.filter.shadow = {13, 0.1f, 20075344.f};
+    config.filter.coarse = {13, 0.1f, 20075344.f};
     config.filter.refined_initial = {12, 0.005f, 0.5f, 0.001f, 2.f, 20075344.f};
-    config.filter.shadow_initial = {12, 0.7f, 20075344.f};
+    config.filter.coarse_initial = {12, 0.7f, 20075344.f};
   }
 
   AdaptiveFirFilter filter(
@@ -375,7 +375,7 @@
   config.delay.default_delay = 1;
   std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
       RenderDelayBuffer::Create(config, kSampleRateHz, num_render_channels));
-  ShadowFilterUpdateGain gain(config.filter.shadow,
+  CoarseFilterUpdateGain gain(config.filter.coarse,
                               config.filter.config_change_duration_blocks);
   Random random_generator(42U);
   std::vector<std::vector<std::vector<float>>> x(
@@ -395,7 +395,7 @@
   std::vector<std::array<float, kFftLengthBy2Plus1>> Y2(num_capture_channels);
   std::vector<std::array<float, kFftLengthBy2Plus1>> E2_refined(
       num_capture_channels);
-  std::array<float, kFftLengthBy2Plus1> E2_shadow;
+  std::array<float, kFftLengthBy2Plus1> E2_coarse;
   // [B,A] = butter(2,100/8000,'high')
   constexpr CascadedBiQuadFilter::BiQuadCoefficients
       kHighPassFilterCoefficients = {{0.97261f, -1.94523f, 0.97261f},
@@ -406,7 +406,7 @@
   for (auto& E2_refined_ch : E2_refined) {
     E2_refined_ch.fill(0.f);
   }
-  E2_shadow.fill(0.f);
+  E2_coarse.fill(0.f);
   for (auto& subtractor_output : output) {
     subtractor_output.Reset();
   }
diff --git a/modules/audio_processing/aec3/aec_state.cc b/modules/audio_processing/aec3/aec_state.cc
index b4b1411..3c2a403 100644
--- a/modules/audio_processing/aec3/aec_state.cc
+++ b/modules/audio_processing/aec3/aec_state.cc
@@ -512,7 +512,7 @@
       saturated_echo_ =
           saturated_echo_ ||
           (subtractor_output[ch].s_refined_max_abs > kSaturationThreshold ||
-           subtractor_output[ch].s_shadow_max_abs > kSaturationThreshold);
+           subtractor_output[ch].s_coarse_max_abs > kSaturationThreshold);
     }
   } else {
     float max_sample = 0.f;
diff --git a/modules/audio_processing/aec3/shadow_filter_update_gain.cc b/modules/audio_processing/aec3/coarse_filter_update_gain.cc
similarity index 86%
rename from modules/audio_processing/aec3/shadow_filter_update_gain.cc
rename to modules/audio_processing/aec3/coarse_filter_update_gain.cc
index 51ead2e..f4fb74d 100644
--- a/modules/audio_processing/aec3/shadow_filter_update_gain.cc
+++ b/modules/audio_processing/aec3/coarse_filter_update_gain.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/audio_processing/aec3/shadow_filter_update_gain.h"
+#include "modules/audio_processing/aec3/coarse_filter_update_gain.h"
 
 #include <algorithm>
 #include <functional>
@@ -17,8 +17,8 @@
 
 namespace webrtc {
 
-ShadowFilterUpdateGain::ShadowFilterUpdateGain(
-    const EchoCanceller3Config::Filter::ShadowConfiguration& config,
+CoarseFilterUpdateGain::CoarseFilterUpdateGain(
+    const EchoCanceller3Config::Filter::CoarseConfiguration& config,
     size_t config_change_duration_blocks)
     : config_change_duration_blocks_(
           static_cast<int>(config_change_duration_blocks)) {
@@ -27,15 +27,15 @@
   one_by_config_change_duration_blocks_ = 1.f / config_change_duration_blocks_;
 }
 
-void ShadowFilterUpdateGain::HandleEchoPathChange() {
+void CoarseFilterUpdateGain::HandleEchoPathChange() {
   poor_signal_excitation_counter_ = 0;
   call_counter_ = 0;
 }
 
-void ShadowFilterUpdateGain::Compute(
+void CoarseFilterUpdateGain::Compute(
     const std::array<float, kFftLengthBy2Plus1>& render_power,
     const RenderSignalAnalyzer& render_signal_analyzer,
-    const FftData& E_shadow,
+    const FftData& E_coarse,
     size_t size_partitions,
     bool saturated_capture_signal,
     FftData* G) {
@@ -72,12 +72,12 @@
 
   // G = mu * E * X2.
   for (size_t k = 0; k < kFftLengthBy2Plus1; ++k) {
-    G->re[k] = mu[k] * E_shadow.re[k];
-    G->im[k] = mu[k] * E_shadow.im[k];
+    G->re[k] = mu[k] * E_coarse.re[k];
+    G->im[k] = mu[k] * E_coarse.im[k];
   }
 }
 
-void ShadowFilterUpdateGain::UpdateCurrentConfig() {
+void CoarseFilterUpdateGain::UpdateCurrentConfig() {
   RTC_DCHECK_GE(config_change_duration_blocks_, config_change_counter_);
   if (config_change_counter_ > 0) {
     if (--config_change_counter_ > 0) {
diff --git a/modules/audio_processing/aec3/shadow_filter_update_gain.h b/modules/audio_processing/aec3/coarse_filter_update_gain.h
similarity index 73%
rename from modules/audio_processing/aec3/shadow_filter_update_gain.h
rename to modules/audio_processing/aec3/coarse_filter_update_gain.h
index 9d14807..a1a1399 100644
--- a/modules/audio_processing/aec3/shadow_filter_update_gain.h
+++ b/modules/audio_processing/aec3/coarse_filter_update_gain.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef MODULES_AUDIO_PROCESSING_AEC3_SHADOW_FILTER_UPDATE_GAIN_H_
-#define MODULES_AUDIO_PROCESSING_AEC3_SHADOW_FILTER_UPDATE_GAIN_H_
+#ifndef MODULES_AUDIO_PROCESSING_AEC3_COARSE_FILTER_UPDATE_GAIN_H_
+#define MODULES_AUDIO_PROCESSING_AEC3_COARSE_FILTER_UPDATE_GAIN_H_
 
 #include <stddef.h>
 
@@ -22,11 +22,11 @@
 
 namespace webrtc {
 
-// Provides functionality for computing the fixed gain for the shadow filter.
-class ShadowFilterUpdateGain {
+// Provides functionality for computing the fixed gain for the coarse filter.
+class CoarseFilterUpdateGain {
  public:
-  explicit ShadowFilterUpdateGain(
-      const EchoCanceller3Config::Filter::ShadowConfiguration& config,
+  explicit CoarseFilterUpdateGain(
+      const EchoCanceller3Config::Filter::CoarseConfiguration& config,
       size_t config_change_duration_blocks);
 
   // Takes action in the case of a known echo path change.
@@ -35,14 +35,14 @@
   // Computes the gain.
   void Compute(const std::array<float, kFftLengthBy2Plus1>& render_power,
                const RenderSignalAnalyzer& render_signal_analyzer,
-               const FftData& E_shadow,
+               const FftData& E_coarse,
                size_t size_partitions,
                bool saturated_capture_signal,
                FftData* G);
 
   // Sets a new config.
   void SetConfig(
-      const EchoCanceller3Config::Filter::ShadowConfiguration& config,
+      const EchoCanceller3Config::Filter::CoarseConfiguration& config,
       bool immediate_effect) {
     if (immediate_effect) {
       old_target_config_ = current_config_ = target_config_ = config;
@@ -55,9 +55,9 @@
   }
 
  private:
-  EchoCanceller3Config::Filter::ShadowConfiguration current_config_;
-  EchoCanceller3Config::Filter::ShadowConfiguration target_config_;
-  EchoCanceller3Config::Filter::ShadowConfiguration old_target_config_;
+  EchoCanceller3Config::Filter::CoarseConfiguration current_config_;
+  EchoCanceller3Config::Filter::CoarseConfiguration target_config_;
+  EchoCanceller3Config::Filter::CoarseConfiguration old_target_config_;
   const int config_change_duration_blocks_;
   float one_by_config_change_duration_blocks_;
   // TODO(peah): Check whether this counter should instead be initialized to a
@@ -71,4 +71,4 @@
 
 }  // namespace webrtc
 
-#endif  // MODULES_AUDIO_PROCESSING_AEC3_SHADOW_FILTER_UPDATE_GAIN_H_
+#endif  // MODULES_AUDIO_PROCESSING_AEC3_COARSE_FILTER_UPDATE_GAIN_H_
diff --git a/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc b/modules/audio_processing/aec3/coarse_filter_update_gain_unittest.cc
similarity index 85%
rename from modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc
rename to modules/audio_processing/aec3/coarse_filter_update_gain_unittest.cc
index ccac9b3..4185c1a 100644
--- a/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc
+++ b/modules/audio_processing/aec3/coarse_filter_update_gain_unittest.cc
@@ -8,9 +8,10 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "modules/audio_processing/aec3/shadow_filter_update_gain.h"
+#include "modules/audio_processing/aec3/coarse_filter_update_gain.h"
 
 #include <algorithm>
+#include <memory>
 #include <numeric>
 #include <string>
 #include <vector>
@@ -44,8 +45,8 @@
       config.filter.refined.length_blocks, config.filter.refined.length_blocks,
       config.filter.config_change_duration_blocks, num_render_channels,
       DetectOptimization(), &data_dumper);
-  AdaptiveFirFilter shadow_filter(
-      config.filter.shadow.length_blocks, config.filter.shadow.length_blocks,
+  AdaptiveFirFilter coarse_filter(
+      config.filter.coarse.length_blocks, config.filter.coarse.length_blocks,
       config.filter.config_change_duration_blocks, num_render_channels,
       DetectOptimization(), &data_dumper);
   Aec3Fft fft;
@@ -55,8 +56,8 @@
   std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
       RenderDelayBuffer::Create(config, kSampleRateHz, num_render_channels));
 
-  ShadowFilterUpdateGain shadow_gain(
-      config.filter.shadow, config.filter.config_change_duration_blocks);
+  CoarseFilterUpdateGain coarse_gain(
+      config.filter.coarse, config.filter.config_change_duration_blocks);
   Random random_generator(42U);
   std::vector<std::vector<std::vector<float>>> x(
       NumBandsForRate(kSampleRateHz),
@@ -67,8 +68,8 @@
   std::array<float, kFftLength> s;
   FftData S;
   FftData G;
-  FftData E_shadow;
-  std::array<float, kBlockSize> e_shadow;
+  FftData E_coarse;
+  std::array<float, kBlockSize> e_coarse;
 
   constexpr float kScale = 1.0f / kFftLengthBy2;
 
@@ -96,24 +97,24 @@
     render_signal_analyzer.Update(*render_delay_buffer->GetRenderBuffer(),
                                   delay_samples / kBlockSize);
 
-    shadow_filter.Filter(*render_delay_buffer->GetRenderBuffer(), &S);
+    coarse_filter.Filter(*render_delay_buffer->GetRenderBuffer(), &S);
     fft.Ifft(S, &s);
     std::transform(y.begin(), y.end(), s.begin() + kFftLengthBy2,
-                   e_shadow.begin(),
+                   e_coarse.begin(),
                    [&](float a, float b) { return a - b * kScale; });
-    std::for_each(e_shadow.begin(), e_shadow.end(),
+    std::for_each(e_coarse.begin(), e_coarse.end(),
                   [](float& a) { a = rtc::SafeClamp(a, -32768.f, 32767.f); });
-    fft.ZeroPaddedFft(e_shadow, Aec3Fft::Window::kRectangular, &E_shadow);
+    fft.ZeroPaddedFft(e_coarse, Aec3Fft::Window::kRectangular, &E_coarse);
 
     std::array<float, kFftLengthBy2Plus1> render_power;
     render_delay_buffer->GetRenderBuffer()->SpectralSum(
-        shadow_filter.SizePartitions(), &render_power);
-    shadow_gain.Compute(render_power, render_signal_analyzer, E_shadow,
-                        shadow_filter.SizePartitions(), saturation, &G);
-    shadow_filter.Adapt(*render_delay_buffer->GetRenderBuffer(), G);
+        coarse_filter.SizePartitions(), &render_power);
+    coarse_gain.Compute(render_power, render_signal_analyzer, E_coarse,
+                        coarse_filter.SizePartitions(), saturation, &G);
+    coarse_filter.Adapt(*render_delay_buffer->GetRenderBuffer(), G);
   }
 
-  std::copy(e_shadow.begin(), e_shadow.end(), e_last_block->begin());
+  std::copy(e_coarse.begin(), e_coarse.end(), e_last_block->begin());
   std::copy(y.begin(), y.end(), y_last_block->begin());
   std::copy(G.re.begin(), G.re.end(), G_last_block->re.begin());
   std::copy(G.im.begin(), G.im.end(), G_last_block->im.begin());
@@ -137,14 +138,14 @@
 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
 
 // Verifies that the check for non-null output gain parameter works.
-TEST(ShadowFilterUpdateGain, NullDataOutputGain) {
+TEST(CoarseFilterUpdateGain, NullDataOutputGain) {
   ApmDataDumper data_dumper(42);
   FftBuffer fft_buffer(1, 1);
   RenderSignalAnalyzer analyzer(EchoCanceller3Config{});
   FftData E;
-  const EchoCanceller3Config::Filter::ShadowConfiguration& config = {
+  const EchoCanceller3Config::Filter::CoarseConfiguration& config = {
       12, 0.5f, 220075344.f};
-  ShadowFilterUpdateGain gain(config, 250);
+  CoarseFilterUpdateGain gain(config, 250);
   std::array<float, kFftLengthBy2Plus1> render_power;
   render_power.fill(0.f);
   EXPECT_DEATH(gain.Compute(render_power, analyzer, E, 1, false, nullptr), "");
@@ -152,16 +153,16 @@
 
 #endif
 
-class ShadowFilterUpdateGainOneTwoEightRenderChannels
+class CoarseFilterUpdateGainOneTwoEightRenderChannels
     : public ::testing::Test,
       public ::testing::WithParamInterface<size_t> {};
 
 INSTANTIATE_TEST_SUITE_P(MultiChannel,
-                         ShadowFilterUpdateGainOneTwoEightRenderChannels,
+                         CoarseFilterUpdateGainOneTwoEightRenderChannels,
                          ::testing::Values(1, 2, 8));
 
 // Verifies that the gain formed causes the filter using it to converge.
-TEST_P(ShadowFilterUpdateGainOneTwoEightRenderChannels,
+TEST_P(CoarseFilterUpdateGainOneTwoEightRenderChannels,
        GainCausesFilterToConverge) {
   const size_t num_render_channels = GetParam();
   std::vector<int> blocks_with_echo_path_changes;
@@ -193,7 +194,7 @@
 }
 
 // Verifies that the gain is zero when there is saturation.
-TEST_P(ShadowFilterUpdateGainOneTwoEightRenderChannels, SaturationBehavior) {
+TEST_P(CoarseFilterUpdateGainOneTwoEightRenderChannels, SaturationBehavior) {
   const size_t num_render_channels = GetParam();
   std::vector<int> blocks_with_echo_path_changes;
   std::vector<int> blocks_with_saturation;
@@ -218,22 +219,22 @@
   }
 }
 
-class ShadowFilterUpdateGainOneTwoFourRenderChannels
+class CoarseFilterUpdateGainOneTwoFourRenderChannels
     : public ::testing::Test,
       public ::testing::WithParamInterface<size_t> {};
 
 INSTANTIATE_TEST_SUITE_P(
     MultiChannel,
-    ShadowFilterUpdateGainOneTwoFourRenderChannels,
+    CoarseFilterUpdateGainOneTwoFourRenderChannels,
     ::testing::Values(1, 2, 4),
     [](const ::testing::TestParamInfo<
-        ShadowFilterUpdateGainOneTwoFourRenderChannels::ParamType>& info) {
+        CoarseFilterUpdateGainOneTwoFourRenderChannels::ParamType>& info) {
       return (rtc::StringBuilder() << "Render" << info.param).str();
     });
 
 // Verifies that the magnitude of the gain on average decreases for a
 // persistently exciting signal.
-TEST_P(ShadowFilterUpdateGainOneTwoFourRenderChannels, DecreasingGain) {
+TEST_P(CoarseFilterUpdateGainOneTwoFourRenderChannels, DecreasingGain) {
   const size_t num_render_channels = GetParam();
   for (size_t filter_length_blocks : {12, 20, 30}) {
     SCOPED_TRACE(ProduceDebugText(filter_length_blocks));
diff --git a/modules/audio_processing/aec3/echo_canceller3.cc b/modules/audio_processing/aec3/echo_canceller3.cc
index 30ae80b..bd1b82a 100644
--- a/modules/audio_processing/aec3/echo_canceller3.cc
+++ b/modules/audio_processing/aec3/echo_canceller3.cc
@@ -41,6 +41,10 @@
   if (adjusted_cfg.filter.use_legacy_filter_naming) {
     adjusted_cfg.filter.refined = adjusted_cfg.filter.main;
     adjusted_cfg.filter.refined_initial = adjusted_cfg.filter.main_initial;
+    adjusted_cfg.filter.coarse = adjusted_cfg.filter.shadow;
+    adjusted_cfg.filter.coarse_initial = adjusted_cfg.filter.shadow_initial;
+    adjusted_cfg.filter.enable_coarse_filter_output_usage =
+        adjusted_cfg.filter.enable_shadow_filter_output_usage;
   }
 
   if (field_trial::IsEnabled("WebRTC-Aec3ShortHeadroomKillSwitch")) {
@@ -480,12 +484,12 @@
     size_t num_capture_channels) {
   EchoCanceller3Config cfg;
   if (num_render_channels > 1) {
-    // Use shorter and more rapidly adapting shadow filter to compensate for
+    // Use shorter and more rapidly adapting coarse filter to compensate for
     // thge increased number of total filter parameters to adapt.
-    cfg.filter.shadow.length_blocks = 11;
-    cfg.filter.shadow.rate = 0.95f;
-    cfg.filter.shadow_initial.length_blocks = 11;
-    cfg.filter.shadow_initial.rate = 0.95f;
+    cfg.filter.coarse.length_blocks = 11;
+    cfg.filter.coarse.rate = 0.95f;
+    cfg.filter.coarse_initial.length_blocks = 11;
+    cfg.filter.coarse_initial.rate = 0.95f;
 
     // Use more concervative suppressor behavior for non-nearend speech.
     cfg.suppressor.normal_tuning.max_dec_factor_lf = 0.35f;
diff --git a/modules/audio_processing/aec3/echo_remover.cc b/modules/audio_processing/aec3/echo_remover.cc
index 55cfe4b..06f3b45 100644
--- a/modules/audio_processing/aec3/echo_remover.cc
+++ b/modules/audio_processing/aec3/echo_remover.cc
@@ -133,7 +133,7 @@
   }
 
  private:
-  // Selects which of the shadow and refined linear filter outputs that is most
+  // Selects which of the coarse and refined linear filter outputs that is most
   // appropriate to pass to the suppressor and forms the linear filter output by
   // smoothly transition between those.
   void FormLinearFilterOutput(const SubtractorOutput& subtractor_output,
@@ -147,7 +147,7 @@
   const int sample_rate_hz_;
   const size_t num_render_channels_;
   const size_t num_capture_channels_;
-  const bool use_shadow_filter_output_;
+  const bool use_coarse_filter_output_;
   Subtractor subtractor_;
   SuppressionGain suppression_gain_;
   ComfortNoiseGenerator cng_;
@@ -189,8 +189,8 @@
       sample_rate_hz_(sample_rate_hz),
       num_render_channels_(num_render_channels),
       num_capture_channels_(num_capture_channels),
-      use_shadow_filter_output_(
-          config_.filter.enable_shadow_filter_output_usage),
+      use_coarse_filter_output_(
+          config_.filter.enable_coarse_filter_output_usage),
       subtractor_(config,
                   num_render_channels_,
                   num_capture_channels_,
@@ -457,21 +457,21 @@
     const SubtractorOutput& subtractor_output,
     rtc::ArrayView<float> output) {
   RTC_DCHECK_EQ(subtractor_output.e_refined.size(), output.size());
-  RTC_DCHECK_EQ(subtractor_output.e_shadow.size(), output.size());
+  RTC_DCHECK_EQ(subtractor_output.e_coarse.size(), output.size());
   bool use_refined_output = true;
-  if (use_shadow_filter_output_) {
+  if (use_coarse_filter_output_) {
     // As the output of the refined adaptive filter generally should be better
-    // than the shadow filter output, add a margin and threshold for when
-    // choosing the shadow filter output.
-    if (subtractor_output.e2_shadow < 0.9f * subtractor_output.e2_refined &&
+    // than the coarse filter output, add a margin and threshold for when
+    // choosing the coarse filter output.
+    if (subtractor_output.e2_coarse < 0.9f * subtractor_output.e2_refined &&
         subtractor_output.y2 > 30.f * 30.f * kBlockSize &&
         (subtractor_output.s2_refined > 60.f * 60.f * kBlockSize ||
-         subtractor_output.s2_shadow > 60.f * 60.f * kBlockSize)) {
+         subtractor_output.s2_coarse > 60.f * 60.f * kBlockSize)) {
       use_refined_output = false;
     } else {
       // If the refined filter is diverged, choose the filter output that has
       // the lowest power.
-      if (subtractor_output.e2_shadow < subtractor_output.e2_refined &&
+      if (subtractor_output.e2_coarse < subtractor_output.e2_refined &&
           subtractor_output.y2 < subtractor_output.e2_refined) {
         use_refined_output = false;
       }
@@ -480,9 +480,9 @@
 
   SignalTransition(refined_filter_output_last_selected_
                        ? subtractor_output.e_refined
-                       : subtractor_output.e_shadow,
+                       : subtractor_output.e_coarse,
                    use_refined_output ? subtractor_output.e_refined
-                                      : subtractor_output.e_shadow,
+                                      : subtractor_output.e_coarse,
                    output);
   refined_filter_output_last_selected_ = use_refined_output;
 }
diff --git a/modules/audio_processing/aec3/refined_filter_update_gain.cc b/modules/audio_processing/aec3/refined_filter_update_gain.cc
index bd79f87..138329a 100644
--- a/modules/audio_processing/aec3/refined_filter_update_gain.cc
+++ b/modules/audio_processing/aec3/refined_filter_update_gain.cc
@@ -78,7 +78,7 @@
   // Introducing shorter notation to improve readability.
   const FftData& E_refined = subtractor_output.E_refined;
   const auto& E2_refined = subtractor_output.E2_refined;
-  const auto& E2_shadow = subtractor_output.E2_shadow;
+  const auto& E2_coarse = subtractor_output.E2_coarse;
   FftData* G = gain_fft;
   const auto& X2 = render_power;
 
@@ -125,7 +125,7 @@
 
   // H_error = H_error + factor * erl.
   for (size_t k = 0; k < kFftLengthBy2Plus1; ++k) {
-    if (E2_shadow[k] >= E2_refined[k]) {
+    if (E2_coarse[k] >= E2_refined[k]) {
       H_error_[k] += current_config_.leakage_converged * erl[k];
     } else {
       H_error_[k] += current_config_.leakage_diverged * erl[k];
diff --git a/modules/audio_processing/aec3/refined_filter_update_gain_unittest.cc b/modules/audio_processing/aec3/refined_filter_update_gain_unittest.cc
index 6ee880a..117f345 100644
--- a/modules/audio_processing/aec3/refined_filter_update_gain_unittest.cc
+++ b/modules/audio_processing/aec3/refined_filter_update_gain_unittest.cc
@@ -18,9 +18,9 @@
 #include "modules/audio_processing/aec3/adaptive_fir_filter.h"
 #include "modules/audio_processing/aec3/adaptive_fir_filter_erl.h"
 #include "modules/audio_processing/aec3/aec_state.h"
+#include "modules/audio_processing/aec3/coarse_filter_update_gain.h"
 #include "modules/audio_processing/aec3/render_delay_buffer.h"
 #include "modules/audio_processing/aec3/render_signal_analyzer.h"
-#include "modules/audio_processing/aec3/shadow_filter_update_gain.h"
 #include "modules/audio_processing/aec3/subtractor_output.h"
 #include "modules/audio_processing/logging/apm_data_dumper.h"
 #include "modules/audio_processing/test/echo_canceller_test_tools.h"
@@ -52,13 +52,13 @@
 
   EchoCanceller3Config config;
   config.filter.refined.length_blocks = filter_length_blocks;
-  config.filter.shadow.length_blocks = filter_length_blocks;
+  config.filter.coarse.length_blocks = filter_length_blocks;
   AdaptiveFirFilter refined_filter(
       config.filter.refined.length_blocks, config.filter.refined.length_blocks,
       config.filter.config_change_duration_blocks, kNumRenderChannels,
       optimization, &data_dumper);
-  AdaptiveFirFilter shadow_filter(
-      config.filter.shadow.length_blocks, config.filter.shadow.length_blocks,
+  AdaptiveFirFilter coarse_filter(
+      config.filter.coarse.length_blocks, config.filter.coarse.length_blocks,
       config.filter.config_change_duration_blocks, kNumRenderChannels,
       optimization, &data_dumper);
   std::vector<std::vector<std::array<float, kFftLengthBy2Plus1>>> H2(
@@ -79,8 +79,8 @@
   Aec3Fft fft;
   std::array<float, kBlockSize> x_old;
   x_old.fill(0.f);
-  ShadowFilterUpdateGain shadow_gain(
-      config.filter.shadow, config.filter.config_change_duration_blocks);
+  CoarseFilterUpdateGain coarse_gain(
+      config.filter.coarse, config.filter.config_change_duration_blocks);
   RefinedFilterUpdateGain refined_gain(
       config.filter.refined, config.filter.config_change_duration_blocks);
   Random random_generator(42U);
@@ -103,12 +103,12 @@
     subtractor_output.Reset();
   }
   FftData& E_refined = output[0].E_refined;
-  FftData E_shadow;
+  FftData E_coarse;
   std::vector<std::array<float, kFftLengthBy2Plus1>> Y2(kNumCaptureChannels);
   std::vector<std::array<float, kFftLengthBy2Plus1>> E2_refined(
       kNumCaptureChannels);
   std::array<float, kBlockSize>& e_refined = output[0].e_refined;
-  std::array<float, kBlockSize>& e_shadow = output[0].e_shadow;
+  std::array<float, kBlockSize>& e_coarse = output[0].e_coarse;
   for (auto& Y2_ch : Y2) {
     Y2_ch.fill(0.f);
   }
@@ -167,27 +167,27 @@
       s[k] = kScale * s_scratch[k + kFftLengthBy2];
     }
 
-    // Apply the shadow filter.
-    shadow_filter.Filter(*render_delay_buffer->GetRenderBuffer(), &S);
+    // Apply the coarse filter.
+    coarse_filter.Filter(*render_delay_buffer->GetRenderBuffer(), &S);
     fft.Ifft(S, &s_scratch);
     std::transform(y.begin(), y.end(), s_scratch.begin() + kFftLengthBy2,
-                   e_shadow.begin(),
+                   e_coarse.begin(),
                    [&](float a, float b) { return a - b * kScale; });
-    std::for_each(e_shadow.begin(), e_shadow.end(),
+    std::for_each(e_coarse.begin(), e_coarse.end(),
                   [](float& a) { a = rtc::SafeClamp(a, -32768.f, 32767.f); });
-    fft.ZeroPaddedFft(e_shadow, Aec3Fft::Window::kRectangular, &E_shadow);
+    fft.ZeroPaddedFft(e_coarse, Aec3Fft::Window::kRectangular, &E_coarse);
 
     // Compute spectra for future use.
     E_refined.Spectrum(Aec3Optimization::kNone, output[0].E2_refined);
-    E_shadow.Spectrum(Aec3Optimization::kNone, output[0].E2_shadow);
+    E_coarse.Spectrum(Aec3Optimization::kNone, output[0].E2_coarse);
 
-    // Adapt the shadow filter.
+    // Adapt the coarse filter.
     std::array<float, kFftLengthBy2Plus1> render_power;
     render_delay_buffer->GetRenderBuffer()->SpectralSum(
-        shadow_filter.SizePartitions(), &render_power);
-    shadow_gain.Compute(render_power, render_signal_analyzer, E_shadow,
-                        shadow_filter.SizePartitions(), saturation, &G);
-    shadow_filter.Adapt(*render_delay_buffer->GetRenderBuffer(), G);
+        coarse_filter.SizePartitions(), &render_power);
+    coarse_gain.Compute(render_power, render_signal_analyzer, E_coarse,
+                        coarse_filter.SizePartitions(), saturation, &G);
+    coarse_filter.Adapt(*render_delay_buffer->GetRenderBuffer(), G);
 
     // Adapt the refined filter
     render_delay_buffer->GetRenderBuffer()->SpectralSum(
diff --git a/modules/audio_processing/aec3/subtractor.cc b/modules/audio_processing/aec3/subtractor.cc
index da6fda1..d152299 100644
--- a/modules/audio_processing/aec3/subtractor.cc
+++ b/modules/audio_processing/aec3/subtractor.cc
@@ -67,11 +67,11 @@
       config_(config),
       num_capture_channels_(num_capture_channels),
       refined_filters_(num_capture_channels_),
-      shadow_filter_(num_capture_channels_),
+      coarse_filter_(num_capture_channels_),
       refined_gains_(num_capture_channels_),
-      shadow_gains_(num_capture_channels_),
+      coarse_gains_(num_capture_channels_),
       filter_misadjustment_estimators_(num_capture_channels_),
-      poor_shadow_filter_counters_(num_capture_channels_, 0),
+      poor_coarse_filter_counters_(num_capture_channels_, 0),
       refined_frequency_responses_(
           num_capture_channels_,
           std::vector<std::array<float, kFftLengthBy2Plus1>>(
@@ -91,16 +91,16 @@
         config.filter.config_change_duration_blocks, num_render_channels,
         optimization, data_dumper_);
 
-    shadow_filter_[ch] = std::make_unique<AdaptiveFirFilter>(
-        config_.filter.shadow.length_blocks,
-        config_.filter.shadow_initial.length_blocks,
+    coarse_filter_[ch] = std::make_unique<AdaptiveFirFilter>(
+        config_.filter.coarse.length_blocks,
+        config_.filter.coarse_initial.length_blocks,
         config.filter.config_change_duration_blocks, num_render_channels,
         optimization, data_dumper_);
     refined_gains_[ch] = std::make_unique<RefinedFilterUpdateGain>(
         config_.filter.refined_initial,
         config_.filter.config_change_duration_blocks);
-    shadow_gains_[ch] = std::make_unique<ShadowFilterUpdateGain>(
-        config_.filter.shadow_initial,
+    coarse_gains_[ch] = std::make_unique<CoarseFilterUpdateGain>(
+        config_.filter.coarse_initial,
         config.filter.config_change_duration_blocks);
   }
 
@@ -119,15 +119,15 @@
   const auto full_reset = [&]() {
     for (size_t ch = 0; ch < num_capture_channels_; ++ch) {
       refined_filters_[ch]->HandleEchoPathChange();
-      shadow_filter_[ch]->HandleEchoPathChange();
+      coarse_filter_[ch]->HandleEchoPathChange();
       refined_gains_[ch]->HandleEchoPathChange(echo_path_variability);
-      shadow_gains_[ch]->HandleEchoPathChange();
+      coarse_gains_[ch]->HandleEchoPathChange();
       refined_gains_[ch]->SetConfig(config_.filter.refined_initial, true);
-      shadow_gains_[ch]->SetConfig(config_.filter.shadow_initial, true);
+      coarse_gains_[ch]->SetConfig(config_.filter.coarse_initial, true);
       refined_filters_[ch]->SetSizePartitions(
           config_.filter.refined_initial.length_blocks, true);
-      shadow_filter_[ch]->SetSizePartitions(
-          config_.filter.shadow_initial.length_blocks, true);
+      coarse_filter_[ch]->SetSizePartitions(
+          config_.filter.coarse_initial.length_blocks, true);
     }
   };
 
@@ -146,10 +146,10 @@
 void Subtractor::ExitInitialState() {
   for (size_t ch = 0; ch < num_capture_channels_; ++ch) {
     refined_gains_[ch]->SetConfig(config_.filter.refined, false);
-    shadow_gains_[ch]->SetConfig(config_.filter.shadow, false);
+    coarse_gains_[ch]->SetConfig(config_.filter.coarse, false);
     refined_filters_[ch]->SetSizePartitions(
         config_.filter.refined.length_blocks, false);
-    shadow_filter_[ch]->SetSizePartitions(config_.filter.shadow.length_blocks,
+    coarse_filter_[ch]->SetSizePartitions(config_.filter.coarse.length_blocks,
                                           false);
   }
 }
@@ -163,22 +163,22 @@
 
   // Compute the render powers.
   const bool same_filter_sizes = refined_filters_[0]->SizePartitions() ==
-                                 shadow_filter_[0]->SizePartitions();
+                                 coarse_filter_[0]->SizePartitions();
   std::array<float, kFftLengthBy2Plus1> X2_refined;
-  std::array<float, kFftLengthBy2Plus1> X2_shadow_data;
-  auto& X2_shadow = same_filter_sizes ? X2_refined : X2_shadow_data;
+  std::array<float, kFftLengthBy2Plus1> X2_coarse_data;
+  auto& X2_coarse = same_filter_sizes ? X2_refined : X2_coarse_data;
   if (same_filter_sizes) {
     render_buffer.SpectralSum(refined_filters_[0]->SizePartitions(),
                               &X2_refined);
   } else if (refined_filters_[0]->SizePartitions() >
-             shadow_filter_[0]->SizePartitions()) {
-    render_buffer.SpectralSums(shadow_filter_[0]->SizePartitions(),
+             coarse_filter_[0]->SizePartitions()) {
+    render_buffer.SpectralSums(coarse_filter_[0]->SizePartitions(),
                                refined_filters_[0]->SizePartitions(),
-                               &X2_shadow, &X2_refined);
+                               &X2_coarse, &X2_refined);
   } else {
     render_buffer.SpectralSums(refined_filters_[0]->SizePartitions(),
-                               shadow_filter_[0]->SizePartitions(), &X2_refined,
-                               &X2_shadow);
+                               coarse_filter_[0]->SizePartitions(), &X2_refined,
+                               &X2_coarse);
   }
 
   // Process all capture channels
@@ -187,19 +187,19 @@
     SubtractorOutput& output = outputs[ch];
     rtc::ArrayView<const float> y = capture[ch];
     FftData& E_refined = output.E_refined;
-    FftData E_shadow;
+    FftData E_coarse;
     std::array<float, kBlockSize>& e_refined = output.e_refined;
-    std::array<float, kBlockSize>& e_shadow = output.e_shadow;
+    std::array<float, kBlockSize>& e_coarse = output.e_coarse;
 
     FftData S;
     FftData& G = S;
 
-    // Form the outputs of the refined and shadow filters.
+    // Form the outputs of the refined and coarse filters.
     refined_filters_[ch]->Filter(render_buffer, &S);
     PredictionError(fft_, S, y, &e_refined, &output.s_refined);
 
-    shadow_filter_[ch]->Filter(render_buffer, &S);
-    PredictionError(fft_, S, y, &e_shadow, &output.s_shadow);
+    coarse_filter_[ch]->Filter(render_buffer, &S);
+    PredictionError(fft_, S, y, &e_coarse, &output.s_coarse);
 
     // Compute the signal powers in the subtractor output.
     output.ComputeMetrics(y);
@@ -218,12 +218,12 @@
       refined_filters_adjusted = true;
     }
 
-    // Compute the FFts of the refined and shadow filter outputs.
+    // Compute the FFts of the refined and coarse filter outputs.
     fft_.ZeroPaddedFft(e_refined, Aec3Fft::Window::kHanning, &E_refined);
-    fft_.ZeroPaddedFft(e_shadow, Aec3Fft::Window::kHanning, &E_shadow);
+    fft_.ZeroPaddedFft(e_coarse, Aec3Fft::Window::kHanning, &E_coarse);
 
     // Compute spectra for future use.
-    E_shadow.Spectrum(optimization_, output.E2_shadow);
+    E_coarse.Spectrum(optimization_, output.E2_coarse);
     E_refined.Spectrum(optimization_, output.E2_refined);
 
     // Update the refined filter.
@@ -247,28 +247,28 @@
       data_dumper_->DumpRaw("aec3_subtractor_G_refined", G.im);
     }
 
-    // Update the shadow filter.
-    poor_shadow_filter_counters_[ch] =
-        output.e2_refined < output.e2_shadow
-            ? poor_shadow_filter_counters_[ch] + 1
+    // Update the coarse filter.
+    poor_coarse_filter_counters_[ch] =
+        output.e2_refined < output.e2_coarse
+            ? poor_coarse_filter_counters_[ch] + 1
             : 0;
-    if (poor_shadow_filter_counters_[ch] < 5) {
-      shadow_gains_[ch]->Compute(X2_shadow, render_signal_analyzer, E_shadow,
-                                 shadow_filter_[ch]->SizePartitions(),
+    if (poor_coarse_filter_counters_[ch] < 5) {
+      coarse_gains_[ch]->Compute(X2_coarse, render_signal_analyzer, E_coarse,
+                                 coarse_filter_[ch]->SizePartitions(),
                                  aec_state.SaturatedCapture(), &G);
     } else {
-      poor_shadow_filter_counters_[ch] = 0;
-      shadow_filter_[ch]->SetFilter(refined_filters_[ch]->SizePartitions(),
+      poor_coarse_filter_counters_[ch] = 0;
+      coarse_filter_[ch]->SetFilter(refined_filters_[ch]->SizePartitions(),
                                     refined_filters_[ch]->GetFilter());
-      shadow_gains_[ch]->Compute(X2_shadow, render_signal_analyzer, E_refined,
-                                 shadow_filter_[ch]->SizePartitions(),
+      coarse_gains_[ch]->Compute(X2_coarse, render_signal_analyzer, E_refined,
+                                 coarse_filter_[ch]->SizePartitions(),
                                  aec_state.SaturatedCapture(), &G);
     }
 
-    shadow_filter_[ch]->Adapt(render_buffer, G);
+    coarse_filter_[ch]->Adapt(render_buffer, G);
     if (ch == 0) {
-      data_dumper_->DumpRaw("aec3_subtractor_G_shadow", G.re);
-      data_dumper_->DumpRaw("aec3_subtractor_G_shadow", G.im);
+      data_dumper_->DumpRaw("aec3_subtractor_G_coarse", G.re);
+      data_dumper_->DumpRaw("aec3_subtractor_G_coarse", G.im);
       filter_misadjustment_estimators_[ch].Dump(data_dumper_);
       DumpFilters();
     }
@@ -279,8 +279,8 @@
     if (ch == 0) {
       data_dumper_->DumpWav("aec3_refined_filters_output", kBlockSize,
                             &e_refined[0], 16000, 1);
-      data_dumper_->DumpWav("aec3_shadow_filter_output", kBlockSize,
-                            &e_shadow[0], 16000, 1);
+      data_dumper_->DumpWav("aec3_coarse_filter_output", kBlockSize,
+                            &e_coarse[0], 16000, 1);
     }
   }
 }
diff --git a/modules/audio_processing/aec3/subtractor.h b/modules/audio_processing/aec3/subtractor.h
index 7b3e6ac..42ca372 100644
--- a/modules/audio_processing/aec3/subtractor.h
+++ b/modules/audio_processing/aec3/subtractor.h
@@ -23,11 +23,11 @@
 #include "modules/audio_processing/aec3/aec3_common.h"
 #include "modules/audio_processing/aec3/aec3_fft.h"
 #include "modules/audio_processing/aec3/aec_state.h"
+#include "modules/audio_processing/aec3/coarse_filter_update_gain.h"
 #include "modules/audio_processing/aec3/echo_path_variability.h"
 #include "modules/audio_processing/aec3/refined_filter_update_gain.h"
 #include "modules/audio_processing/aec3/render_buffer.h"
 #include "modules/audio_processing/aec3/render_signal_analyzer.h"
-#include "modules/audio_processing/aec3/shadow_filter_update_gain.h"
 #include "modules/audio_processing/aec3/subtractor_output.h"
 #include "modules/audio_processing/logging/apm_data_dumper.h"
 #include "rtc_base/checks.h"
@@ -80,7 +80,7 @@
                 refined_filters_[0]->max_filter_size_partitions())));
 
     refined_filters_[0]->DumpFilter("aec3_subtractor_H_refined");
-    shadow_filter_[0]->DumpFilter("aec3_subtractor_H_shadow");
+    coarse_filter_[0]->DumpFilter("aec3_subtractor_H_coarse");
   }
 
  private:
@@ -122,11 +122,11 @@
   const size_t num_capture_channels_;
 
   std::vector<std::unique_ptr<AdaptiveFirFilter>> refined_filters_;
-  std::vector<std::unique_ptr<AdaptiveFirFilter>> shadow_filter_;
+  std::vector<std::unique_ptr<AdaptiveFirFilter>> coarse_filter_;
   std::vector<std::unique_ptr<RefinedFilterUpdateGain>> refined_gains_;
-  std::vector<std::unique_ptr<ShadowFilterUpdateGain>> shadow_gains_;
+  std::vector<std::unique_ptr<CoarseFilterUpdateGain>> coarse_gains_;
   std::vector<FilterMisadjustmentEstimator> filter_misadjustment_estimators_;
-  std::vector<size_t> poor_shadow_filter_counters_;
+  std::vector<size_t> poor_coarse_filter_counters_;
   std::vector<std::vector<std::array<float, kFftLengthBy2Plus1>>>
       refined_frequency_responses_;
   std::vector<std::vector<float>> refined_impulse_responses_;
diff --git a/modules/audio_processing/aec3/subtractor_output.cc b/modules/audio_processing/aec3/subtractor_output.cc
index 11c8174..ed80101 100644
--- a/modules/audio_processing/aec3/subtractor_output.cc
+++ b/modules/audio_processing/aec3/subtractor_output.cc
@@ -19,17 +19,17 @@
 
 void SubtractorOutput::Reset() {
   s_refined.fill(0.f);
-  s_shadow.fill(0.f);
+  s_coarse.fill(0.f);
   e_refined.fill(0.f);
-  e_shadow.fill(0.f);
+  e_coarse.fill(0.f);
   E_refined.re.fill(0.f);
   E_refined.im.fill(0.f);
   E2_refined.fill(0.f);
-  E2_shadow.fill(0.f);
+  E2_coarse.fill(0.f);
   e2_refined = 0.f;
-  e2_shadow = 0.f;
+  e2_coarse = 0.f;
   s2_refined = 0.f;
-  s2_shadow = 0.f;
+  s2_coarse = 0.f;
   y2 = 0.f;
 }
 
@@ -38,21 +38,21 @@
   y2 = std::accumulate(y.begin(), y.end(), 0.f, sum_of_squares);
   e2_refined =
       std::accumulate(e_refined.begin(), e_refined.end(), 0.f, sum_of_squares);
-  e2_shadow =
-      std::accumulate(e_shadow.begin(), e_shadow.end(), 0.f, sum_of_squares);
+  e2_coarse =
+      std::accumulate(e_coarse.begin(), e_coarse.end(), 0.f, sum_of_squares);
   s2_refined =
       std::accumulate(s_refined.begin(), s_refined.end(), 0.f, sum_of_squares);
-  s2_shadow =
-      std::accumulate(s_shadow.begin(), s_shadow.end(), 0.f, sum_of_squares);
+  s2_coarse =
+      std::accumulate(s_coarse.begin(), s_coarse.end(), 0.f, sum_of_squares);
 
   s_refined_max_abs = *std::max_element(s_refined.begin(), s_refined.end());
   s_refined_max_abs =
       std::max(s_refined_max_abs,
                -(*std::min_element(s_refined.begin(), s_refined.end())));
 
-  s_shadow_max_abs = *std::max_element(s_shadow.begin(), s_shadow.end());
-  s_shadow_max_abs = std::max(
-      s_shadow_max_abs, -(*std::min_element(s_shadow.begin(), s_shadow.end())));
+  s_coarse_max_abs = *std::max_element(s_coarse.begin(), s_coarse.end());
+  s_coarse_max_abs = std::max(
+      s_coarse_max_abs, -(*std::min_element(s_coarse.begin(), s_coarse.end())));
 }
 
 }  // namespace webrtc
diff --git a/modules/audio_processing/aec3/subtractor_output.h b/modules/audio_processing/aec3/subtractor_output.h
index 3f856d9..d2d1208 100644
--- a/modules/audio_processing/aec3/subtractor_output.h
+++ b/modules/audio_processing/aec3/subtractor_output.h
@@ -26,19 +26,19 @@
   ~SubtractorOutput();
 
   std::array<float, kBlockSize> s_refined;
-  std::array<float, kBlockSize> s_shadow;
+  std::array<float, kBlockSize> s_coarse;
   std::array<float, kBlockSize> e_refined;
-  std::array<float, kBlockSize> e_shadow;
+  std::array<float, kBlockSize> e_coarse;
   FftData E_refined;
   std::array<float, kFftLengthBy2Plus1> E2_refined;
-  std::array<float, kFftLengthBy2Plus1> E2_shadow;
+  std::array<float, kFftLengthBy2Plus1> E2_coarse;
   float s2_refined = 0.f;
-  float s2_shadow = 0.f;
+  float s2_coarse = 0.f;
   float e2_refined = 0.f;
-  float e2_shadow = 0.f;
+  float e2_coarse = 0.f;
   float y2 = 0.f;
   float s_refined_max_abs = 0.f;
-  float s_shadow_max_abs = 0.f;
+  float s_coarse_max_abs = 0.f;
 
   // Reset the struct content.
   void Reset();
diff --git a/modules/audio_processing/aec3/subtractor_output_analyzer.cc b/modules/audio_processing/aec3/subtractor_output_analyzer.cc
index ac29199..8b22185 100644
--- a/modules/audio_processing/aec3/subtractor_output_analyzer.cc
+++ b/modules/audio_processing/aec3/subtractor_output_analyzer.cc
@@ -33,17 +33,17 @@
   for (size_t ch = 0; ch < subtractor_output.size(); ++ch) {
     const float y2 = subtractor_output[ch].y2;
     const float e2_refined = subtractor_output[ch].e2_refined;
-    const float e2_shadow = subtractor_output[ch].e2_shadow;
+    const float e2_coarse = subtractor_output[ch].e2_coarse;
 
     constexpr float kConvergenceThreshold = 50 * 50 * kBlockSize;
     bool refined_filter_converged =
         e2_refined < 0.5f * y2 && y2 > kConvergenceThreshold;
-    bool shadow_filter_converged =
-        e2_shadow < 0.05f * y2 && y2 > kConvergenceThreshold;
-    float min_e2 = std::min(e2_refined, e2_shadow);
+    bool coarse_filter_converged =
+        e2_coarse < 0.05f * y2 && y2 > kConvergenceThreshold;
+    float min_e2 = std::min(e2_refined, e2_coarse);
     bool filter_diverged = min_e2 > 1.5f * y2 && y2 > 30.f * 30.f * kBlockSize;
     filters_converged_[ch] =
-        refined_filter_converged || shadow_filter_converged;
+        refined_filter_converged || coarse_filter_converged;
 
     *any_filter_converged = *any_filter_converged || filters_converged_[ch];
     *all_filters_diverged = *all_filters_diverged && filter_diverged;
diff --git a/modules/audio_processing/aec3/subtractor_unittest.cc b/modules/audio_processing/aec3/subtractor_unittest.cc
index 56b0e93..72e5787 100644
--- a/modules/audio_processing/aec3/subtractor_unittest.cc
+++ b/modules/audio_processing/aec3/subtractor_unittest.cc
@@ -32,7 +32,7 @@
     int num_blocks_to_process,
     int delay_samples,
     int refined_filter_length_blocks,
-    int shadow_filter_length_blocks,
+    int coarse_filter_length_blocks,
     bool uncorrelated_inputs,
     const std::vector<int>& blocks_with_echo_path_changes) {
   ApmDataDumper data_dumper(42);
@@ -40,7 +40,7 @@
   constexpr size_t kNumBands = NumBandsForRate(kSampleRateHz);
   EchoCanceller3Config config;
   config.filter.refined.length_blocks = refined_filter_length_blocks;
-  config.filter.shadow.length_blocks = shadow_filter_length_blocks;
+  config.filter.coarse.length_blocks = coarse_filter_length_blocks;
 
   Subtractor subtractor(config, num_render_channels, num_capture_channels,
                         &data_dumper, DetectOptimization());
@@ -61,7 +61,7 @@
   std::vector<std::array<float, kFftLengthBy2Plus1>> Y2(num_capture_channels);
   std::vector<std::array<float, kFftLengthBy2Plus1>> E2_refined(
       num_capture_channels);
-  std::array<float, kFftLengthBy2Plus1> E2_shadow;
+  std::array<float, kFftLengthBy2Plus1> E2_coarse;
   AecState aec_state(config, num_capture_channels);
   x_old.fill(0.f);
   for (auto& Y2_ch : Y2) {
@@ -70,7 +70,7 @@
   for (auto& E2_refined_ch : E2_refined) {
     E2_refined_ch.fill(0.f);
   }
-  E2_shadow.fill(0.f);
+  E2_coarse.fill(0.f);
 
   std::vector<std::vector<std::unique_ptr<DelayBuffer<float>>>> delay_buffer(
       num_capture_channels);
@@ -232,8 +232,8 @@
 }
 
 // Verifies that the subtractor is able to handle the case when the refined
-// filter is longer than the shadow filter.
-TEST(Subtractor, RefinedFilterLongerThanShadowFilter) {
+// filter is longer than the coarse filter.
+TEST(Subtractor, RefinedFilterLongerThanCoarseFilter) {
   std::vector<int> blocks_with_echo_path_changes;
   std::vector<float> echo_to_nearend_powers = RunSubtractorTest(
       1, 1, 400, 64, 20, 15, false, blocks_with_echo_path_changes);
@@ -242,9 +242,9 @@
   }
 }
 
-// Verifies that the subtractor is able to handle the case when the shadow
+// Verifies that the subtractor is able to handle the case when the coarse
 // filter is longer than the refined filter.
-TEST(Subtractor, ShadowFilterLongerThanRefinedFilter) {
+TEST(Subtractor, CoarseFilterLongerThanRefinedFilter) {
   std::vector<int> blocks_with_echo_path_changes;
   std::vector<float> echo_to_nearend_powers = RunSubtractorTest(
       1, 1, 400, 64, 15, 20, false, blocks_with_echo_path_changes);