AEC3: use different seed for different channels in CNG
Bug: webrtc:10913 Change-Id: Idca6be02b54b67753cfaf6ff588f5271e0cce892 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155160 Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org> Commit-Queue: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29344}
This commit is contained in:
committed by
Commit Bot
parent
09f119598e
commit
32eae4c231
@ -92,9 +92,10 @@ void GenerateComfortNoise(Aec3Optimization optimization,
|
||||
|
||||
} // namespace
|
||||
|
||||
ComfortNoiseGenerator::ComfortNoiseGenerator(Aec3Optimization optimization)
|
||||
ComfortNoiseGenerator::ComfortNoiseGenerator(Aec3Optimization optimization,
|
||||
uint32_t seed)
|
||||
: optimization_(optimization),
|
||||
seed_(42),
|
||||
seed_(seed),
|
||||
N2_initial_(new std::array<float, kFftLengthBy2Plus1>()) {
|
||||
N2_initial_->fill(0.f);
|
||||
Y2_smoothed_.fill(0.f);
|
||||
|
||||
@ -41,7 +41,7 @@ void EstimateComfortNoise(const std::array<float, kFftLengthBy2Plus1>& N2,
|
||||
// Generates the comfort noise.
|
||||
class ComfortNoiseGenerator {
|
||||
public:
|
||||
explicit ComfortNoiseGenerator(Aec3Optimization optimization);
|
||||
ComfortNoiseGenerator(Aec3Optimization optimization, uint32_t seed);
|
||||
~ComfortNoiseGenerator();
|
||||
|
||||
// Computes the comfort noise.
|
||||
|
||||
@ -36,7 +36,7 @@ TEST(ComfortNoiseGenerator, NullLowerBandNoise) {
|
||||
std::array<float, kFftLengthBy2Plus1> N2;
|
||||
FftData noise;
|
||||
EXPECT_DEATH(
|
||||
ComfortNoiseGenerator(DetectOptimization())
|
||||
ComfortNoiseGenerator(DetectOptimization(), 42)
|
||||
.Compute(AecState(EchoCanceller3Config{}), N2, nullptr, &noise),
|
||||
"");
|
||||
}
|
||||
@ -45,7 +45,7 @@ TEST(ComfortNoiseGenerator, NullUpperBandNoise) {
|
||||
std::array<float, kFftLengthBy2Plus1> N2;
|
||||
FftData noise;
|
||||
EXPECT_DEATH(
|
||||
ComfortNoiseGenerator(DetectOptimization())
|
||||
ComfortNoiseGenerator(DetectOptimization(), 42)
|
||||
.Compute(AecState(EchoCanceller3Config{}), N2, &noise, nullptr),
|
||||
"");
|
||||
}
|
||||
@ -53,7 +53,7 @@ TEST(ComfortNoiseGenerator, NullUpperBandNoise) {
|
||||
#endif
|
||||
|
||||
TEST(ComfortNoiseGenerator, CorrectLevel) {
|
||||
ComfortNoiseGenerator cng(DetectOptimization());
|
||||
ComfortNoiseGenerator cng(DetectOptimization(), 42);
|
||||
AecState aec_state(EchoCanceller3Config{});
|
||||
|
||||
std::array<float, kFftLengthBy2Plus1> N2;
|
||||
|
||||
@ -220,12 +220,14 @@ EchoRemoverImpl::EchoRemoverImpl(const EchoCanceller3Config& config,
|
||||
e_k.fill(0.f);
|
||||
}
|
||||
|
||||
uint32_t cng_seed = 42;
|
||||
for (size_t ch = 0; ch < num_capture_channels_; ++ch) {
|
||||
residual_echo_estimators_[ch] =
|
||||
std::make_unique<ResidualEchoEstimator>(config_);
|
||||
suppression_gains_[ch] = std::make_unique<SuppressionGain>(
|
||||
config_, optimization_, sample_rate_hz);
|
||||
cngs_[ch] = std::make_unique<ComfortNoiseGenerator>(optimization_);
|
||||
cngs_[ch] =
|
||||
std::make_unique<ComfortNoiseGenerator>(optimization_, cng_seed++);
|
||||
e_old_[ch].fill(0.f);
|
||||
y_old_[ch].fill(0.f);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user