2018-07-04 11:02:09 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "modules/audio_processing/aec3/reverb_model_estimator.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
ReverbModelEstimator::ReverbModelEstimator(const EchoCanceller3Config& config)
|
2018-07-31 00:03:46 +02:00
|
|
|
: reverb_decay_estimator_(config) {}
|
2018-07-04 11:02:09 +02:00
|
|
|
|
|
|
|
|
ReverbModelEstimator::~ReverbModelEstimator() = default;
|
|
|
|
|
|
|
|
|
|
void ReverbModelEstimator::Update(
|
2018-07-31 00:03:46 +02:00
|
|
|
rtc::ArrayView<const float> impulse_response,
|
2018-07-04 11:02:09 +02:00
|
|
|
const std::vector<std::array<float, kFftLengthBy2Plus1>>&
|
2018-07-31 00:03:46 +02:00
|
|
|
frequency_response,
|
|
|
|
|
const absl::optional<float>& linear_filter_quality,
|
2018-07-04 11:02:09 +02:00
|
|
|
int filter_delay_blocks,
|
|
|
|
|
bool usable_linear_estimate,
|
|
|
|
|
bool stationary_block) {
|
2018-07-31 00:03:46 +02:00
|
|
|
// Estimate the frequency response for the reverb.
|
|
|
|
|
reverb_frequency_response_.Update(frequency_response, filter_delay_blocks,
|
|
|
|
|
linear_filter_quality, stationary_block);
|
2018-07-04 11:02:09 +02:00
|
|
|
|
2018-07-31 00:03:46 +02:00
|
|
|
// Estimate the reverb decay,
|
|
|
|
|
reverb_decay_estimator_.Update(impulse_response, linear_filter_quality,
|
|
|
|
|
filter_delay_blocks, usable_linear_estimate,
|
|
|
|
|
stationary_block);
|
2018-07-04 11:02:09 +02:00
|
|
|
}
|
|
|
|
|
} // namespace webrtc
|