blob: b16418628b06f4051d4f2cfa75b284d7d290b7d8 [file] [log] [blame]
Per Åhgrenef5d5af2018-07-31 00:03:46 +02001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_
12#define MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_
13
Yves Gerey988cc082018-10-23 12:03:01 +020014#include <array>
Per Åhgrenef5d5af2018-07-31 00:03:46 +020015#include <vector>
16
17#include "absl/types/optional.h"
18#include "api/array_view.h"
19#include "modules/audio_processing/aec3/aec3_common.h"
Per Åhgrenef5d5af2018-07-31 00:03:46 +020020
21namespace webrtc {
22
23// Class for updating the frequency response for the reverb.
24class ReverbFrequencyResponse {
25 public:
26 ReverbFrequencyResponse();
27 ~ReverbFrequencyResponse();
28
29 // Updates the frequency response estimate of the reverb.
30 void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
31 frequency_response,
32 int filter_delay_blocks,
33 const absl::optional<float>& linear_filter_quality,
34 bool stationary_block);
35
36 // Returns the estimated frequency response for the reverb.
37 rtc::ArrayView<const float> FrequencyResponse() const {
38 return tail_response_;
39 }
40
41 private:
42 void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
43 frequency_response,
44 int filter_delay_blocks,
45 float linear_filter_quality);
46
Per Åhgrenef5d5af2018-07-31 00:03:46 +020047 float average_decay_ = 0.f;
48 std::array<float, kFftLengthBy2Plus1> tail_response_;
49};
50
51} // namespace webrtc
52
53#endif // MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_