AEC3: Audibility: improvements on the initial noise estimation

Bug: webrtc:9193,chromium:836790
Change-Id: I589082a18a4a5d1ba5abc170b6cf49d1f545b6cc
Reviewed-on: https://webrtc-review.googlesource.com/72480
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23027}
This commit is contained in:
Jesús de Vicente Peña
2018-04-25 16:11:42 +02:00
committed by Commit Bot
parent ff61273c01
commit dc872b6be1
6 changed files with 72 additions and 6 deletions

View File

@ -45,6 +45,14 @@ class RenderBuffer {
return spectrum_buffer_->buffer[position];
}
// Get the spectrum directly from a position in the buffer.
rtc::ArrayView<const float> SpectrumFromPosition(int position) const {
RTC_CHECK_LT(position, spectrum_buffer_->size);
int position_bound = std::min(position, spectrum_buffer_->size - 1);
position_bound = std::max(0, position_bound);
return spectrum_buffer_->buffer[position_bound];
}
// Returns the circular fft buffer.
rtc::ArrayView<const FftData> GetFftBuffer() const {
return fft_buffer_->buffer;
@ -57,6 +65,9 @@ class RenderBuffer {
return fft_buffer_->read;
}
// Returns the write postion in the circular buffer.
int GetWritePositionSpectrum() const { return spectrum_buffer_->write; }
// Returns the sum of the spectrums for a certain number of FFTs.
void SpectralSum(size_t num_spectra,
std::array<float, kFftLengthBy2Plus1>* X2) const;
@ -82,6 +93,9 @@ class RenderBuffer {
return headroom;
}
// Decrease an index that is used for accessing the buffer.
int DecIdx(int idx) const { return spectrum_buffer_->DecIndex(idx); }
private:
const MatrixBuffer* const block_buffer_;
const VectorBuffer* const spectrum_buffer_;