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

@ -160,7 +160,7 @@ int WebRtcAgc_AddMic(void* state,
/* apply slowly varying digital gain */
if (stt->micVol > stt->maxAnalog) {
/* |maxLevel| is strictly >= |micVol|, so this condition should be
/* `maxLevel` is strictly >= `micVol`, so this condition should be
* satisfied here, ensuring there is no divide-by-zero. */
RTC_DCHECK_GT(stt->maxLevel, stt->maxAnalog);

View File

@ -11,7 +11,6 @@
#ifndef MODULES_AUDIO_PROCESSING_AGC_LEGACY_ANALOG_AGC_H_
#define MODULES_AUDIO_PROCESSING_AGC_LEGACY_ANALOG_AGC_H_
#include "modules/audio_processing/agc/legacy/digital_agc.h"
#include "modules/audio_processing/agc/legacy/gain_control.h"
@ -63,7 +62,7 @@ typedef struct {
int32_t upperSecondaryLimit; // = kRxxBufferLen * 2677832; -17 dBfs
int32_t lowerSecondaryLimit; // = kRxxBufferLen * 267783; -27 dBfs
uint16_t targetIdx; // Table index for corresponding target level
int16_t analogTarget; // Digital reference level in ENV scale
int16_t analogTarget; // Digital reference level in ENV scale
// Analog AGC specific variables
int32_t filterState[8]; // For downsampling wb to nb
@ -74,8 +73,8 @@ typedef struct {
int32_t Rxx160_LPw32; // Low pass filtered frame energies
int32_t Rxx16_LPw32Max; // Keeps track of largest energy subframe
int32_t Rxx16_vectorw32[kRxxBufferLen]; // Array with subframe energies
int32_t Rxx16w32_array[2][5]; // Energy values of microphone signal
int32_t env[2][10]; // Envelope values of subframes
int32_t Rxx16w32_array[2][5]; // Energy values of microphone signal
int32_t env[2][10]; // Envelope values of subframes
int16_t Rxx16pos; // Current position in the Rxx16_vectorw32
int16_t envSum; // Filtered scaled envelope in subframes

View File

@ -79,10 +79,9 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t* gainTable, // Q16
uint16_t constMaxGain;
uint16_t tmpU16, intPart, fracPart;
const int16_t kCompRatio = 3;
const int16_t kSoftLimiterLeft = 1;
int16_t limiterOffset = 0; // Limiter offset
int16_t limiterIdx, limiterLvlX;
int16_t constLinApprox, zeroGainLvl, maxGain, diffGain;
int16_t constLinApprox, maxGain, diffGain;
int16_t i, tmp16, tmp16no1;
int zeros, zerosScale;
@ -98,17 +97,11 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t* gainTable, // Q16
WebRtcSpl_DivW32W16ResW16(tmp32no1 + (kCompRatio >> 1), kCompRatio);
maxGain = WEBRTC_SPL_MAX(tmp16no1, (analogTarget - targetLevelDbfs));
tmp32no1 = maxGain * kCompRatio;
zeroGainLvl = digCompGaindB;
zeroGainLvl -= WebRtcSpl_DivW32W16ResW16(tmp32no1 + ((kCompRatio - 1) >> 1),
kCompRatio - 1);
if ((digCompGaindB <= analogTarget) && (limiterEnable)) {
zeroGainLvl += (analogTarget - digCompGaindB + kSoftLimiterLeft);
limiterOffset = 0;
}
// Calculate the difference between maximum gain and gain at 0dB0v:
// diffGain = maxGain + (compRatio-1)*zeroGainLvl/compRatio
// = (compRatio-1)*digCompGaindB/compRatio
// Calculate the difference between maximum gain and gain at 0dB0v
tmp32no1 = digCompGaindB * (kCompRatio - 1);
diffGain =
WebRtcSpl_DivW32W16ResW16(tmp32no1 + (kCompRatio >> 1), kCompRatio);
@ -191,9 +184,9 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t* gainTable, // Q16
numFIX -= (int32_t)logApprox * diffGain; // Q14
// Calculate ratio
// Shift |numFIX| as much as possible.
// Ensure we avoid wrap-around in |den| as well.
if (numFIX > (den >> 8) || -numFIX > (den >> 8)) { // |den| is Q8.
// Shift `numFIX` as much as possible.
// Ensure we avoid wrap-around in `den` as well.
if (numFIX > (den >> 8) || -numFIX > (den >> 8)) { // `den` is Q8.
zeros = WebRtcSpl_NormW32(numFIX);
} else {
zeros = WebRtcSpl_NormW32(den) + 8;
@ -294,15 +287,12 @@ int32_t WebRtcAgc_ComputeDigitalGains(DigitalAgc* stt,
int16_t gate, gain_adj;
int16_t k;
size_t n, L;
int16_t L2; // samples/subframe
// determine number of samples per ms
if (FS == 8000) {
L = 8;
L2 = 3;
} else if (FS == 16000 || FS == 32000 || FS == 48000) {
L = 16;
L2 = 4;
} else {
return -1;
}

View File

@ -11,6 +11,9 @@
#ifndef MODULES_AUDIO_PROCESSING_AGC_LEGACY_GAIN_CONTROL_H_
#define MODULES_AUDIO_PROCESSING_AGC_LEGACY_GAIN_CONTROL_H_
#include <stddef.h>
#include <stdint.h>
namespace webrtc {
enum {