Bump to WebRTC M120 release

Some API deprecation -- ExperimentalAgc and ExperimentalNs are gone.
We're continuing to carry iSAC even though it's gone upstream, but maybe
we'll want to drop that soon.
This commit is contained in:
Arun Raghavan
2023-12-12 10:42:58 -05:00
parent 9a202fb8c2
commit c6abf6cd3f
479 changed files with 20900 additions and 11996 deletions

View File

@ -19,7 +19,7 @@ rtc_library("aecm_core") {
deps = [
"../../../common_audio:common_audio_c",
"../../../rtc_base:checks",
"../../../rtc_base:rtc_base_approved",
"../../../rtc_base:safe_conversions",
"../../../rtc_base:sanitizer",
"../../../system_wrappers",
"../utility:legacy_delay_estimator",

View File

@ -123,8 +123,7 @@ const int16_t WebRtcAecm_kSinTable[] = {
-2667, -2531, -2395, -2258, -2120, -1981, -1842, -1703, -1563, -1422, -1281,
-1140, -998, -856, -713, -571, -428, -285, -142};
// Moves the pointer to the next entry and inserts |far_spectrum| and
// Moves the pointer to the next entry and inserts `far_spectrum` and
// corresponding Q-domain in its buffer.
//
// Inputs:
@ -574,7 +573,7 @@ int WebRtcAecm_ProcessFrame(AecmCore* aecm,
// Obtain an output frame.
WebRtc_ReadBuffer(aecm->outFrameBuf, (void**)&out_ptr, out, FRAME_LEN);
if (out_ptr != out) {
// ReadBuffer() hasn't copied to |out| in this case.
// ReadBuffer() hasn't copied to `out` in this case.
memcpy(out, out_ptr, FRAME_LEN * sizeof(int16_t));
}
@ -616,22 +615,22 @@ int16_t WebRtcAecm_AsymFilt(const int16_t filtOld,
// ExtractFractionPart(a, zeros)
//
// returns the fraction part of |a|, with |zeros| number of leading zeros, as an
// int16_t scaled to Q8. There is no sanity check of |a| in the sense that the
// returns the fraction part of `a`, with `zeros` number of leading zeros, as an
// int16_t scaled to Q8. There is no sanity check of `a` in the sense that the
// number of zeros match.
static int16_t ExtractFractionPart(uint32_t a, int zeros) {
return (int16_t)(((a << zeros) & 0x7FFFFFFF) >> 23);
}
// Calculates and returns the log of |energy| in Q8. The input |energy| is
// supposed to be in Q(|q_domain|).
// Calculates and returns the log of `energy` in Q8. The input `energy` is
// supposed to be in Q(`q_domain`).
static int16_t LogOfEnergyInQ8(uint32_t energy, int q_domain) {
static const int16_t kLogLowValue = PART_LEN_SHIFT << 7;
int16_t log_energy_q8 = kLogLowValue;
if (energy > 0) {
int zeros = WebRtcSpl_NormU32(energy);
int16_t frac = ExtractFractionPart(energy, zeros);
// log2 of |energy| in Q8.
// log2 of `energy` in Q8.
log_energy_q8 += ((31 - zeros) << 8) + frac - (q_domain << 8);
}
return log_energy_q8;

View File

@ -58,7 +58,7 @@ typedef struct {
void* delay_estimator;
uint16_t currentDelay;
// Far end history variables
// TODO(bjornv): Replace |far_history| with ring_buffer.
// TODO(bjornv): Replace `far_history` with ring_buffer.
uint16_t far_history[PART_LEN1 * MAX_DELAY];
int far_history_pos;
int far_q_domains[MAX_DELAY];
@ -248,7 +248,7 @@ int WebRtcAecm_ProcessBlock(AecmCore* aecm,
//
void WebRtcAecm_BufferFarFrame(AecmCore* const aecm,
const int16_t* const farend,
const int farLen);
int farLen);
////////////////////////////////////////////////////////////////////////////////
// WebRtcAecm_FetchFarFrame()
@ -263,15 +263,15 @@ void WebRtcAecm_BufferFarFrame(AecmCore* const aecm,
//
void WebRtcAecm_FetchFarFrame(AecmCore* const aecm,
int16_t* const farend,
const int farLen,
const int knownDelay);
int farLen,
int knownDelay);
// All the functions below are intended to be private
////////////////////////////////////////////////////////////////////////////////
// WebRtcAecm_UpdateFarHistory()
//
// Moves the pointer to the next entry and inserts |far_spectrum| and
// Moves the pointer to the next entry and inserts `far_spectrum` and
// corresponding Q-domain in its buffer.
//
// Inputs:
@ -339,8 +339,8 @@ int16_t WebRtcAecm_CalcSuppressionGain(AecmCore* const aecm);
//
void WebRtcAecm_CalcEnergies(AecmCore* aecm,
const uint16_t* far_spectrum,
const int16_t far_q,
const uint32_t nearEner,
int16_t far_q,
uint32_t nearEner,
int32_t* echoEst);
///////////////////////////////////////////////////////////////////////////////
@ -374,9 +374,9 @@ int16_t WebRtcAecm_CalcStepSize(AecmCore* const aecm);
//
void WebRtcAecm_UpdateChannel(AecmCore* aecm,
const uint16_t* far_spectrum,
const int16_t far_q,
int16_t far_q,
const uint16_t* const dfa,
const int16_t mu,
int16_t mu,
int32_t* echoEst);
extern const int16_t WebRtcAecm_kCosTable[];

View File

@ -98,7 +98,7 @@ static void ComfortNoise(AecmCore* aecm,
// Track the minimum.
if (aecm->noiseEst[i] < (1 << minTrackShift)) {
// For small values, decrease noiseEst[i] every
// |kNoiseEstIncCount| block. The regular approach below can not
// `kNoiseEstIncCount` block. The regular approach below can not
// go further down due to truncation.
aecm->noiseEstTooHighCtr[i]++;
if (aecm->noiseEstTooHighCtr[i] >= kNoiseEstIncCount) {
@ -125,7 +125,7 @@ static void ComfortNoise(AecmCore* aecm,
aecm->noiseEst[i] >>= 11;
} else {
// Make incremental increases based on size every
// |kNoiseEstIncCount| block
// `kNoiseEstIncCount` block
aecm->noiseEstTooLowCtr[i]++;
if (aecm->noiseEstTooLowCtr[i] >= kNoiseEstIncCount) {
aecm->noiseEst[i] += (aecm->noiseEst[i] >> 9) + 1;
@ -181,12 +181,13 @@ static void WindowAndFFT(AecmCore* aecm,
// FFT of signal
for (i = 0; i < PART_LEN; i++) {
// Window time domain signal and insert into real part of
// transformation array |fft|
// transformation array `fft`
int16_t scaled_time_signal = time_signal[i] * (1 << time_signal_scaling);
fft[i] = (int16_t)((scaled_time_signal * WebRtcAecm_kSqrtHanning[i]) >> 14);
scaled_time_signal = time_signal[i + PART_LEN] * (1 << time_signal_scaling);
fft[PART_LEN + i] = (int16_t)(
(scaled_time_signal * WebRtcAecm_kSqrtHanning[PART_LEN - i]) >> 14);
fft[PART_LEN + i] = (int16_t)((scaled_time_signal *
WebRtcAecm_kSqrtHanning[PART_LEN - i]) >>
14);
}
// Do forward FFT, then take only the first PART_LEN complex samples,
@ -204,8 +205,8 @@ static void InverseFFTAndWindow(AecmCore* aecm,
const int16_t* nearendClean) {
int i, j, outCFFT;
int32_t tmp32no1;
// Reuse |efw| for the inverse FFT output after transferring
// the contents to |fft|.
// Reuse `efw` for the inverse FFT output after transferring
// the contents to `fft`.
int16_t* ifft_out = (int16_t*)efw;
// Synthesis
@ -312,7 +313,7 @@ static int TimeToFrequencyDomain(AecmCore* aecm,
} else {
// Approximation for magnitude of complex fft output
// magn = sqrt(real^2 + imag^2)
// magn ~= alpha * max(|imag|,|real|) + beta * min(|imag|,|real|)
// magn ~= alpha * max(`imag`,`real`) + beta * min(`imag`,`real`)
//
// The parameters alpha and beta are stored in Q15
@ -541,7 +542,7 @@ int RTC_NO_SANITIZE("signed-integer-overflow") // bugs.webrtc.org/8200
}
zeros16 = WebRtcSpl_NormW16(aecm->nearFilt[i]);
RTC_DCHECK_GE(zeros16, 0); // |zeros16| is a norm, hence non-negative.
RTC_DCHECK_GE(zeros16, 0); // `zeros16` is a norm, hence non-negative.
dfa_clean_q_domain_diff = aecm->dfaCleanQDomain - aecm->dfaCleanQDomainOld;
if (zeros16 < dfa_clean_q_domain_diff && aecm->nearFilt[i]) {
tmp16no1 = aecm->nearFilt[i] * (1 << zeros16);
@ -644,18 +645,18 @@ int RTC_NO_SANITIZE("signed-integer-overflow") // bugs.webrtc.org/8200
}
// multiply with Wiener coefficients
efw[i].real = (int16_t)(
WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real, hnl[i], 14));
efw[i].imag = (int16_t)(
WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag, hnl[i], 14));
efw[i].real = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real,
hnl[i], 14));
efw[i].imag = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag,
hnl[i], 14));
}
} else {
// multiply with Wiener coefficients
for (i = 0; i < PART_LEN1; i++) {
efw[i].real = (int16_t)(
WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real, hnl[i], 14));
efw[i].imag = (int16_t)(
WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag, hnl[i], 14));
efw[i].real = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real,
hnl[i], 14));
efw[i].imag = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag,
hnl[i], 14));
}
}

View File

@ -569,8 +569,8 @@ static void InverseFFTAndWindow(AecmCore* aecm,
[paecm_buf] "+r"(paecm_buf), [i] "=&r"(i),
[pp_kSqrtHanning] "+r"(pp_kSqrtHanning),
[p_kSqrtHanning] "+r"(p_kSqrtHanning)
: [out_aecm] "r"(out_aecm),
[WebRtcAecm_kSqrtHanning] "r"(WebRtcAecm_kSqrtHanning)
: [out_aecm] "r"(out_aecm), [WebRtcAecm_kSqrtHanning] "r"(
WebRtcAecm_kSqrtHanning)
: "hi", "lo", "memory");
// Copy the current block to the old position
@ -822,7 +822,7 @@ static int TimeToFrequencyDomain(AecmCore* aecm,
} else {
// Approximation for magnitude of complex fft output
// magn = sqrt(real^2 + imag^2)
// magn ~= alpha * max(|imag|,|real|) + beta * min(|imag|,|real|)
// magn ~= alpha * max(`imag`,`real`) + beta * min(`imag`,`real`)
//
// The parameters alpha and beta are stored in Q15
tmp16no1 = WEBRTC_SPL_ABS_W16(freq_signal[i].real);
@ -1106,7 +1106,7 @@ int WebRtcAecm_ProcessBlock(AecmCore* aecm,
}
zeros16 = WebRtcSpl_NormW16(aecm->nearFilt[i]);
RTC_DCHECK_GE(zeros16, 0); // |zeros16| is a norm, hence non-negative.
RTC_DCHECK_GE(zeros16, 0); // `zeros16` is a norm, hence non-negative.
dfa_clean_q_domain_diff = aecm->dfaCleanQDomain - aecm->dfaCleanQDomainOld;
if (zeros16 < dfa_clean_q_domain_diff && aecm->nearFilt[i]) {
tmp16no1 = aecm->nearFilt[i] << zeros16;
@ -1334,10 +1334,10 @@ int WebRtcAecm_ProcessBlock(AecmCore* aecm,
} else {
// multiply with Wiener coefficients
for (i = 0; i < PART_LEN1; i++) {
efw[i].real = (int16_t)(
WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real, hnl[i], 14));
efw[i].imag = (int16_t)(
WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag, hnl[i], 14));
efw[i].real = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].real,
hnl[i], 14));
efw[i].imag = (int16_t)(WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(dfw[i].imag,
hnl[i], 14));
}
}
@ -1411,7 +1411,7 @@ static void ComfortNoise(AecmCore* aecm,
// Track the minimum.
if (tnoise < (1 << minTrackShift)) {
// For small values, decrease noiseEst[i] every
// |kNoiseEstIncCount| block. The regular approach below can not
// `kNoiseEstIncCount` block. The regular approach below can not
// go further down due to truncation.
aecm->noiseEstTooHighCtr[i]++;
if (aecm->noiseEstTooHighCtr[i] >= kNoiseEstIncCount) {
@ -1424,8 +1424,8 @@ static void ComfortNoise(AecmCore* aecm,
"srav %[tmp32], %[tmp32], %[minTrackShift] \n\t"
"subu %[tnoise], %[tnoise], %[tmp32] \n\t"
: [tmp32] "=&r"(tmp32), [tnoise] "+r"(tnoise)
:
[outLShift32] "r"(outLShift32), [minTrackShift] "r"(minTrackShift));
: [outLShift32] "r"(outLShift32), [minTrackShift] "r"(
minTrackShift));
}
} else {
// Reset "too high" counter
@ -1442,7 +1442,7 @@ static void ComfortNoise(AecmCore* aecm,
: "hi", "lo");
} else {
// Make incremental increases based on size every
// |kNoiseEstIncCount| block
// `kNoiseEstIncCount` block
aecm->noiseEstTooLowCtr[i]++;
if (aecm->noiseEstTooLowCtr[i] >= kNoiseEstIncCount) {
__asm __volatile(
@ -1484,7 +1484,7 @@ static void ComfortNoise(AecmCore* aecm,
// Track the minimum.
if (tnoise1 < (1 << minTrackShift)) {
// For small values, decrease noiseEst[i] every
// |kNoiseEstIncCount| block. The regular approach below can not
// `kNoiseEstIncCount` block. The regular approach below can not
// go further down due to truncation.
aecm->noiseEstTooHighCtr[i + 1]++;
if (aecm->noiseEstTooHighCtr[i + 1] >= kNoiseEstIncCount) {
@ -1497,8 +1497,8 @@ static void ComfortNoise(AecmCore* aecm,
"srav %[tmp32], %[tmp32], %[minTrackShift] \n\t"
"subu %[tnoise1], %[tnoise1], %[tmp32] \n\t"
: [tmp32] "=&r"(tmp32), [tnoise1] "+r"(tnoise1)
:
[outLShift32] "r"(outLShift32), [minTrackShift] "r"(minTrackShift));
: [outLShift32] "r"(outLShift32), [minTrackShift] "r"(
minTrackShift));
}
} else {
// Reset "too high" counter
@ -1515,7 +1515,7 @@ static void ComfortNoise(AecmCore* aecm,
: "hi", "lo");
} else {
// Make incremental increases based on size every
// |kNoiseEstIncCount| block
// `kNoiseEstIncCount` block
aecm->noiseEstTooLowCtr[i + 1]++;
if (aecm->noiseEstTooLowCtr[i + 1] >= kNoiseEstIncCount) {
__asm __volatile(