Simplification and refactoring of the AudioBuffer code

This CL performs a major refactoring and simplification
of the AudioBuffer code that.
-Removes 7 of the 9 internal buffers of the AudioBuffer.
-Avoids the implicit copying required to keep the
 internal buffers in sync.
-Removes all code relating to handling of fixed-point
 sample data in the AudioBuffer.
-Changes the naming of the class methods to reflect
 that only floating point is handled.
-Corrects some bugs in the code.
-Extends the handling of internal downmixing to be
 more generic.

Bug: webrtc:10882
Change-Id: I12c8af156fbe366b154744a0a1b3d926bf7be572
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149828
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28928}
This commit is contained in:
Per Åhgren
2019-08-21 15:02:37 +02:00
committed by Commit Bot
parent f69bd5f184
commit 81c0cf287c
32 changed files with 541 additions and 452 deletions

View File

@ -53,7 +53,6 @@ TEST(BlockDelayBuffer, CorrectDelayApplied) {
for (auto rate : {8000, 16000, 32000, 48000}) {
SCOPED_TRACE(ProduceDebugText(rate, delay));
size_t num_bands = NumBandsForRate(rate);
size_t fullband_frame_length = rate / 100;
size_t subband_frame_length = rate == 8000 ? 80 : 160;
BlockDelayBuffer delay_buffer(num_bands, subband_frame_length, delay);
@ -61,25 +60,23 @@ TEST(BlockDelayBuffer, CorrectDelayApplied) {
static constexpr size_t kNumFramesToProcess = 20;
for (size_t frame_index = 0; frame_index < kNumFramesToProcess;
++frame_index) {
AudioBuffer audio_buffer(fullband_frame_length, 1,
fullband_frame_length, 1,
fullband_frame_length);
AudioBuffer audio_buffer(rate, 1, rate, 1, rate);
if (rate > 16000) {
audio_buffer.SplitIntoFrequencyBands();
}
size_t first_sample_index = frame_index * subband_frame_length;
PopulateInputFrame(subband_frame_length, num_bands, first_sample_index,
&audio_buffer.split_bands_f(0)[0]);
&audio_buffer.split_bands(0)[0]);
delay_buffer.DelaySignal(&audio_buffer);
for (size_t k = 0; k < num_bands; ++k) {
size_t sample_index = first_sample_index;
for (size_t i = 0; i < subband_frame_length; ++i, ++sample_index) {
if (sample_index < delay) {
EXPECT_EQ(0.f, audio_buffer.split_bands_f(0)[k][i]);
EXPECT_EQ(0.f, audio_buffer.split_bands(0)[k][i]);
} else {
EXPECT_EQ(SampleValue(sample_index - delay),
audio_buffer.split_bands_f(0)[k][i]);
audio_buffer.split_bands(0)[k][i]);
}
}
}