Chromium Code Reviews| Index: webrtc/modules/audio_processing/aec3/render_buffer.h |
| diff --git a/webrtc/modules/audio_processing/aec3/fft_buffer.h b/webrtc/modules/audio_processing/aec3/render_buffer.h |
| similarity index 64% |
| rename from webrtc/modules/audio_processing/aec3/fft_buffer.h |
| rename to webrtc/modules/audio_processing/aec3/render_buffer.h |
| index c99c9570f35e58ed6db62c522c4471ea34305bbe..a1f5de09f803fdaf3627902a2bf2b25f3382a12e 100644 |
| --- a/webrtc/modules/audio_processing/aec3/fft_buffer.h |
| +++ b/webrtc/modules/audio_processing/aec3/render_buffer.h |
| @@ -8,31 +8,41 @@ |
| * be found in the AUTHORS file in the root of the source tree. |
| */ |
| -#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_FFT_BUFFER_H_ |
| -#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_FFT_BUFFER_H_ |
| +#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_BUFFER_H_ |
| +#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_BUFFER_H_ |
| #include <memory> |
| #include <vector> |
| #include "webrtc/base/array_view.h" |
| #include "webrtc/base/constructormagic.h" |
| +#include "webrtc/modules/audio_processing/aec3/aec3_fft.h" |
| #include "webrtc/modules/audio_processing/aec3/fft_data.h" |
| namespace webrtc { |
| -// Provides a circular buffer for 128 point real-valued FFT data. |
| -class FftBuffer { |
| +// Provides a buffer of the render data for the echo remover. |
| +class RenderBuffer { |
| public: |
| - // The constructor takes as parameters the size of the buffer, as well as a |
| + // The constructor takes apart from the other parameters a |
|
ivoc
2017/03/31 13:58:31
This is unclear to me, how about something like th
peah-webrtc
2017/04/03 08:02:33
Great!
I modified it along your suggestion.
PTAL
ivoc
2017/04/03 16:09:07
Ok, looks good now.
|
| // vector containing the number of FFTs that will be included in the spectral |
| // sums in the call to SpectralSum. |
| - FftBuffer(Aec3Optimization optimization, |
| - size_t size, |
| - const std::vector<size_t> num_ffts_for_spectral_sums); |
| - ~FftBuffer(); |
| + RenderBuffer(Aec3Optimization optimization, |
| + size_t num_bands, |
| + size_t size, |
| + const std::vector<size_t> num_ffts_for_spectral_sums); |
| + ~RenderBuffer(); |
| - // Insert an FFT into the buffer. |
| - void Insert(const FftData& fft); |
| + // Clears the buffer. |
| + void Clear(); |
| + |
| + // Insert a block into the buffer. |
| + void Insert(const std::vector<std::vector<float>>& block); |
| + |
| + // Gets the last inserted block. |
| + const std::vector<std::vector<float>>& MostRecentBlock() const { |
| + return last_block_; |
| + } |
| // Get the spectrum from one of the FFTs in the buffer |
| const std::array<float, kFftLengthBy2Plus1>& Spectrum( |
| @@ -61,10 +71,11 @@ class FftBuffer { |
| size_t spectral_sums_length_; |
| std::vector<std::array<float, kFftLengthBy2Plus1>> spectral_sums_; |
| size_t position_ = 0; |
| - |
| - RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FftBuffer); |
| + std::vector<std::vector<float>> last_block_; |
| + const Aec3Fft fft_; |
| + RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RenderBuffer); |
| }; |
| } // namespace webrtc |
| -#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_FFT_BUFFER_H_ |
| +#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_BUFFER_H_ |