Reland "Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3.""
This is a reland of a66395e72f9fc86873bf443579ec73c3d78af240 Original change's description: > Reland "Add core multi-channel pipeline in AEC3 This CL adds basic the basic pipeline to support multi-channel processing in AEC3." > > This is a reland of f3a197e55323aee974a932c52dd19fa88e5d4e38 > > Original change's description: > > Add core multi-channel pipeline in AEC3 > > This CL adds basic the basic pipeline to support multi-channel > > processing in AEC3. > > > > Apart from that, it removes the 8 kHz processing support in several > > places of the AEC3 code. > > > > Bug: webrtc:10913 > > Change-Id: If5b75fa325ed0071deea94a7546cb4a7adf22137 > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150332 > > Commit-Queue: Per Åhgren <peah@webrtc.org> > > Reviewed-by: Sam Zackrisson <saza@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#29017} > > Bug: webrtc:10913 > Change-Id: Ifc4b13bd994cfd22dca8f8755fa5700617cc379d > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151124 > Reviewed-by: Sam Zackrisson <saza@webrtc.org> > Commit-Queue: Per Åhgren <peah@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#29034} Bug: webrtc:10913 Change-Id: Id8da5666df8c86f290c73ad5dc9958199f1a7ebe Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/151127 Commit-Queue: Sam Zackrisson <saza@webrtc.org> Reviewed-by: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29042}
This commit is contained in:
@ -33,14 +33,23 @@ constexpr float kPi = 3.141592f;
|
||||
void ProduceSinusoid(int sample_rate_hz,
|
||||
float sinusoidal_frequency_hz,
|
||||
size_t* sample_counter,
|
||||
rtc::ArrayView<float> x) {
|
||||
std::vector<std::vector<std::vector<float>>>* x) {
|
||||
// Produce a sinusoid of the specified frequency.
|
||||
for (size_t k = *sample_counter, j = 0; k < (*sample_counter + kBlockSize);
|
||||
++k, ++j) {
|
||||
x[j] = 32767.f *
|
||||
std::sin(2.f * kPi * sinusoidal_frequency_hz * k / sample_rate_hz);
|
||||
for (size_t channel = 0; channel < (*x)[0].size(); ++channel) {
|
||||
(*x)[0][channel][j] =
|
||||
32767.f *
|
||||
std::sin(2.f * kPi * sinusoidal_frequency_hz * k / sample_rate_hz);
|
||||
}
|
||||
}
|
||||
*sample_counter = *sample_counter + kBlockSize;
|
||||
|
||||
for (size_t band = 1; band < x->size(); ++band) {
|
||||
for (size_t channel = 0; channel < (*x)[band].size(); ++channel) {
|
||||
std::fill((*x)[band][channel].begin(), (*x)[band][channel].end(), 0.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -58,15 +67,17 @@ TEST(RenderSignalAnalyzer, NullMaskOutput) {
|
||||
TEST(RenderSignalAnalyzer, NoFalseDetectionOfNarrowBands) {
|
||||
RenderSignalAnalyzer analyzer(EchoCanceller3Config{});
|
||||
Random random_generator(42U);
|
||||
std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f));
|
||||
std::vector<std::vector<std::vector<float>>> x(
|
||||
3,
|
||||
std::vector<std::vector<float>>(1, std::vector<float>(kBlockSize, 0.f)));
|
||||
std::array<float, kBlockSize> x_old;
|
||||
std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
|
||||
RenderDelayBuffer::Create(EchoCanceller3Config(), 48000));
|
||||
RenderDelayBuffer::Create(EchoCanceller3Config(), 48000, 1));
|
||||
std::array<float, kFftLengthBy2Plus1> mask;
|
||||
x_old.fill(0.f);
|
||||
|
||||
for (size_t k = 0; k < 100; ++k) {
|
||||
RandomizeSampleVector(&random_generator, x[0]);
|
||||
RandomizeSampleVector(&random_generator, x[0][0]);
|
||||
|
||||
render_delay_buffer->Insert(x);
|
||||
if (k == 0) {
|
||||
@ -89,12 +100,17 @@ TEST(RenderSignalAnalyzer, NoFalseDetectionOfNarrowBands) {
|
||||
TEST(RenderSignalAnalyzer, NarrowBandDetection) {
|
||||
RenderSignalAnalyzer analyzer(EchoCanceller3Config{});
|
||||
Random random_generator(42U);
|
||||
std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f));
|
||||
constexpr size_t kNumChannels = 1;
|
||||
constexpr int kSampleRateHz = 48000;
|
||||
constexpr size_t kNumBands = NumBandsForRate(kSampleRateHz);
|
||||
std::vector<std::vector<std::vector<float>>> x(
|
||||
kNumBands, std::vector<std::vector<float>>(
|
||||
kNumChannels, std::vector<float>(kBlockSize, 0.f)));
|
||||
std::array<float, kBlockSize> x_old;
|
||||
Aec3Fft fft;
|
||||
EchoCanceller3Config config;
|
||||
std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
|
||||
RenderDelayBuffer::Create(config, 48000));
|
||||
RenderDelayBuffer::Create(config, kSampleRateHz, kNumChannels));
|
||||
|
||||
std::array<float, kFftLengthBy2Plus1> mask;
|
||||
x_old.fill(0.f);
|
||||
@ -104,7 +120,7 @@ TEST(RenderSignalAnalyzer, NarrowBandDetection) {
|
||||
size_t sample_counter = 0;
|
||||
for (size_t k = 0; k < 100; ++k) {
|
||||
ProduceSinusoid(16000, 16000 / 2 * kSinusFrequencyBin / kFftLengthBy2,
|
||||
&sample_counter, x[0]);
|
||||
&sample_counter, &x);
|
||||
|
||||
render_delay_buffer->Insert(x);
|
||||
if (k == 0) {
|
||||
|
||||
Reference in New Issue
Block a user