Update to current webrtc library

This is from the upstream library commit id
3326535126e435f1ba647885ce43a8f0f3d317eb, corresponding to Chromium
88.0.4290.1.
This commit is contained in:
Arun Raghavan
2020-10-12 18:08:02 -04:00
parent b1b02581d3
commit bcec8b0b21
859 changed files with 76187 additions and 49580 deletions

View File

@ -8,22 +8,23 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/modules/audio_processing/vad/vad_audio_proc.h"
#include "modules/audio_processing/vad/vad_audio_proc.h"
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "webrtc/common_audio/fft4g.h"
#include "webrtc/modules/audio_processing/vad/vad_audio_proc_internal.h"
#include "webrtc/modules/audio_processing/vad/pitch_internal.h"
#include "webrtc/modules/audio_processing/vad/pole_zero_filter.h"
#include "common_audio/third_party/ooura/fft_size_256/fft4g.h"
#include "modules/audio_processing/vad/pitch_internal.h"
#include "modules/audio_processing/vad/pole_zero_filter.h"
#include "modules/audio_processing/vad/vad_audio_proc_internal.h"
#include "rtc_base/checks.h"
extern "C" {
#include "webrtc/modules/audio_coding/codecs/isac/main/source/codec.h"
#include "webrtc/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h"
#include "webrtc/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h"
#include "webrtc/modules/audio_coding/codecs/isac/main/source/structs.h"
#include "modules/audio_coding/codecs/isac/main/source/filter_functions.h"
#include "modules/audio_coding/codecs/isac/main/source/isac_vad.h"
#include "modules/audio_coding/codecs/isac/main/source/pitch_estimator.h"
#include "modules/audio_coding/codecs/isac/main/source/structs.h"
}
#include "webrtc/modules/interface/module_common_types.h"
namespace webrtc {
@ -32,9 +33,9 @@ namespace webrtc {
struct VadAudioProc::PitchAnalysisStruct : public ::PitchAnalysisStruct {};
struct VadAudioProc::PreFiltBankstr : public ::PreFiltBankstr {};
static const float kFrequencyResolution =
static constexpr float kFrequencyResolution =
kSampleRateHz / static_cast<float>(VadAudioProc::kDftSize);
static const int kSilenceRms = 5;
static constexpr int kSilenceRms = 5;
// TODO(turajs): Make a Create or Init for VadAudioProc.
VadAudioProc::VadAudioProc()
@ -66,8 +67,7 @@ VadAudioProc::VadAudioProc()
WebRtcIsac_InitPitchAnalysis(pitch_analysis_handle_.get());
}
VadAudioProc::~VadAudioProc() {
}
VadAudioProc::~VadAudioProc() {}
void VadAudioProc::ResetBuffer() {
memcpy(audio_buffer_, &audio_buffer_[kNumSamplesToProcess],
@ -95,7 +95,7 @@ int VadAudioProc::ExtractFeatures(const int16_t* frame,
if (num_buffer_samples_ < kBufferLength) {
return 0;
}
assert(num_buffer_samples_ == kBufferLength);
RTC_DCHECK_EQ(num_buffer_samples_, kBufferLength);
features->num_frames = kNum10msSubframes;
features->silence = false;
@ -121,7 +121,7 @@ int VadAudioProc::ExtractFeatures(const int16_t* frame,
void VadAudioProc::SubframeCorrelation(double* corr,
size_t length_corr,
size_t subframe_index) {
assert(length_corr >= kLpcOrder + 1);
RTC_DCHECK_GE(length_corr, kLpcOrder + 1);
double windowed_audio[kNumSubframeSamples + kNumPastSignalSamples];
size_t buffer_index = subframe_index * kNumSubframeSamples;
@ -137,7 +137,7 @@ void VadAudioProc::SubframeCorrelation(double* corr,
// each 10ms sub-frame. This is equivalent to computing LPC coefficients for the
// first half of each 10 ms subframe.
void VadAudioProc::GetLpcPolynomials(double* lpc, size_t length_lpc) {
assert(length_lpc >= kNum10msSubframes * (kLpcOrder + 1));
RTC_DCHECK_GE(length_lpc, kNum10msSubframes * (kLpcOrder + 1));
double corr[kLpcOrder + 1];
double reflec_coeff[kLpcOrder];
for (size_t i = 0, offset_lpc = 0; i < kNum10msSubframes;
@ -165,7 +165,7 @@ static float QuadraticInterpolation(float prev_val,
fractional_index =
-(next_val - prev_val) * 0.5f / (next_val + prev_val - 2.f * curr_val);
assert(fabs(fractional_index) < 1);
RTC_DCHECK_LT(fabs(fractional_index), 1);
return fractional_index;
}
@ -176,7 +176,7 @@ static float QuadraticInterpolation(float prev_val,
// to save on one square root.
void VadAudioProc::FindFirstSpectralPeaks(double* f_peak,
size_t length_f_peak) {
assert(length_f_peak >= kNum10msSubframes);
RTC_DCHECK_GE(length_f_peak, kNum10msSubframes);
double lpc[kNum10msSubframes * (kLpcOrder + 1)];
// For all sub-frames.
GetLpcPolynomials(lpc, kNum10msSubframes * (kLpcOrder + 1));
@ -232,7 +232,7 @@ void VadAudioProc::PitchAnalysis(double* log_pitch_gains,
size_t length) {
// TODO(turajs): This can be "imported" from iSAC & and the next two
// constants.
assert(length >= kNum10msSubframes);
RTC_DCHECK_GE(length, kNum10msSubframes);
const int kNumPitchSubframes = 4;
double gains[kNumPitchSubframes];
double lags[kNumPitchSubframes];
@ -262,7 +262,7 @@ void VadAudioProc::PitchAnalysis(double* log_pitch_gains,
}
void VadAudioProc::Rms(double* rms, size_t length_rms) {
assert(length_rms >= kNum10msSubframes);
RTC_DCHECK_GE(length_rms, kNum10msSubframes);
size_t offset = kNumPastSignalSamples;
for (size_t i = 0; i < kNum10msSubframes; i++) {
rms[i] = 0;