#include "modules/audio_processing/agc/legacy/analog_agc.h"
#include <stdlib.h>
#include "rtc_base/checks.h"
namespace webrtc {
namespace {
#define AGC_UNSPECIFIED_ERROR …
#define AGC_UNINITIALIZED_ERROR …
#define AGC_NULL_POINTER_ERROR …
#define AGC_BAD_PARAMETER_ERROR …
static const int16_t kSlope1[8] = …;
static const int16_t kOffset1[8] = …;
static const int16_t kSlope2[8] = …;
static const int16_t kOffset2[8] = …;
static const int16_t kMuteGuardTimeMs = …;
static const int16_t kInitCheck = …;
static const size_t kNumSubframes = …;
#define AGC_DEFAULT_TARGET_LEVEL …
#define AGC_DEFAULT_COMP_GAIN …
#define ANALOG_TARGET_LEVEL …
#define ANALOG_TARGET_LEVEL_2 …
#define OFFSET_ENV_TO_RMS …
#define DIGITAL_REF_AT_0_COMP_GAIN …
#define DIFF_REF_TO_ANALOG …
#define GAIN_TBL_LEN …
static const uint16_t kGainTableAnalog[GAIN_TBL_LEN] = …;
static const uint16_t kGainTableVirtualMic[128] = …;
static const uint16_t kSuppressionTableVirtualMic[128] = …;
static const int32_t kTargetLevelTable[64] = …;
}
int WebRtcAgc_AddMic(void* state,
int16_t* const* in_mic,
size_t num_bands,
size_t samples) { … }
int WebRtcAgc_AddFarend(void* state, const int16_t* in_far, size_t samples) { … }
int WebRtcAgc_GetAddFarendError(void* state, size_t samples) { … }
int WebRtcAgc_VirtualMic(void* agcInst,
int16_t* const* in_near,
size_t num_bands,
size_t samples,
int32_t micLevelIn,
int32_t* micLevelOut) { … }
void WebRtcAgc_UpdateAgcThresholds(LegacyAgc* stt) { … }
void WebRtcAgc_SaturationCtrl(LegacyAgc* stt,
uint8_t* saturated,
int32_t* env) { … }
void WebRtcAgc_ZeroCtrl(LegacyAgc* stt, int32_t* inMicLevel, int32_t* env) { … }
void WebRtcAgc_SpeakerInactiveCtrl(LegacyAgc* stt) { … }
void WebRtcAgc_ExpCurve(int16_t volume, int16_t* index) { … }
int32_t WebRtcAgc_ProcessAnalog(void* state,
int32_t inMicLevel,
int32_t* outMicLevel,
int16_t vadLogRatio,
int16_t echo,
uint8_t* saturationWarning) { … }
int WebRtcAgc_Analyze(void* agcInst,
const int16_t* const* in_near,
size_t num_bands,
size_t samples,
int32_t inMicLevel,
int32_t* outMicLevel,
int16_t echo,
uint8_t* saturationWarning,
int32_t gains[11]) { … }
int WebRtcAgc_Process(const void* agcInst,
const int32_t gains[11],
const int16_t* const* in_near,
size_t num_bands,
int16_t* const* out) { … }
int WebRtcAgc_set_config(void* agcInst, WebRtcAgcConfig agcConfig) { … }
int WebRtcAgc_get_config(void* agcInst, WebRtcAgcConfig* config) { … }
void* WebRtcAgc_Create() { … }
void WebRtcAgc_Free(void* state) { … }
int WebRtcAgc_Init(void* agcInst,
int32_t minLevel,
int32_t maxLevel,
int16_t agcMode,
uint32_t fs) { … }
}