Rename _t struct types in audio_processing.

_t names are reserved in POSIX.

R=bjornv@webrtc.org
BUG=162

Review URL: https://webrtc-codereview.appspot.com/34509005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7943 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org
2014-12-18 09:11:33 +00:00
parent cab1291745
commit e468bc9e60
25 changed files with 347 additions and 366 deletions

View File

@ -119,8 +119,8 @@ int WebRtcAgc_AddMic(void *state, int16_t* const* in_mic, int16_t num_bands,
int32_t *ptr;
uint16_t targetGainIdx, gain;
int16_t i, n, L, tmp16, tmp_speech[16];
Agc_t *stt;
stt = (Agc_t *)state;
LegacyAgc* stt;
stt = (LegacyAgc*)state;
if (stt->fs == 8000) {
L = 8;
@ -252,8 +252,8 @@ int WebRtcAgc_AddMic(void *state, int16_t* const* in_mic, int16_t num_bands,
int WebRtcAgc_AddFarend(void *state, const int16_t *in_far, int16_t samples)
{
Agc_t *stt;
stt = (Agc_t *)state;
LegacyAgc* stt;
stt = (LegacyAgc*)state;
if (stt == NULL)
{
@ -287,7 +287,7 @@ int WebRtcAgc_VirtualMic(void *agcInst, int16_t* const* in_near,
int32_t tmpFlt, micLevelTmp, gainIdx;
uint16_t gain;
int16_t ii, j;
Agc_t *stt;
LegacyAgc* stt;
uint32_t nrg;
int16_t sampleCntr;
@ -297,7 +297,7 @@ int WebRtcAgc_VirtualMic(void *agcInst, int16_t* const* in_near,
const int16_t kZeroCrossingLowLim = 15;
const int16_t kZeroCrossingHighLim = 20;
stt = (Agc_t *)agcInst;
stt = (LegacyAgc*)agcInst;
/*
* Before applying gain decide if this is a low-level signal.
@ -423,9 +423,7 @@ int WebRtcAgc_VirtualMic(void *agcInst, int16_t* const* in_near,
return 0;
}
void WebRtcAgc_UpdateAgcThresholds(Agc_t *stt)
{
void WebRtcAgc_UpdateAgcThresholds(LegacyAgc* stt) {
int16_t tmp16;
#ifdef MIC_LEVEL_FEEDBACK
int zeros;
@ -475,8 +473,9 @@ void WebRtcAgc_UpdateAgcThresholds(Agc_t *stt)
stt->lowerLimit = stt->startLowerLimit;
}
void WebRtcAgc_SaturationCtrl(Agc_t *stt, uint8_t *saturated, int32_t *env)
{
void WebRtcAgc_SaturationCtrl(LegacyAgc* stt,
uint8_t* saturated,
int32_t* env) {
int16_t i, tmpW16;
/* Check if the signal is saturated */
@ -500,8 +499,7 @@ void WebRtcAgc_SaturationCtrl(Agc_t *stt, uint8_t *saturated, int32_t *env)
(int16_t)32440, 15);
}
void WebRtcAgc_ZeroCtrl(Agc_t *stt, int32_t *inMicLevel, int32_t *env)
{
void WebRtcAgc_ZeroCtrl(LegacyAgc* stt, int32_t* inMicLevel, int32_t* env) {
int16_t i;
int32_t tmp32 = 0;
int32_t midVal;
@ -562,8 +560,7 @@ void WebRtcAgc_ZeroCtrl(Agc_t *stt, int32_t *inMicLevel, int32_t *env)
}
}
void WebRtcAgc_SpeakerInactiveCtrl(Agc_t *stt)
{
void WebRtcAgc_SpeakerInactiveCtrl(LegacyAgc* stt) {
/* Check if the near end speaker is inactive.
* If that is the case the VAD threshold is
* increased since the VAD speech model gets
@ -653,9 +650,9 @@ int32_t WebRtcAgc_ProcessAnalog(void *state, int32_t inMicLevel,
int32_t inMicLevelTmp, lastMicVol;
int16_t i;
uint8_t saturated = 0;
Agc_t *stt;
LegacyAgc* stt;
stt = (Agc_t *)state;
stt = (LegacyAgc*)state;
inMicLevelTmp = inMicLevel << stt->scale;
if (inMicLevelTmp > stt->maxAnalog)
@ -1146,9 +1143,9 @@ int WebRtcAgc_Process(void *agcInst, const int16_t* const* in_near,
int32_t *outMicLevel, int16_t echo,
uint8_t *saturationWarning)
{
Agc_t *stt;
LegacyAgc* stt;
stt = (Agc_t *)agcInst;
stt = (LegacyAgc*)agcInst;
//
if (stt == NULL)
@ -1237,10 +1234,9 @@ int WebRtcAgc_Process(void *agcInst, const int16_t* const* in_near,
return 0;
}
int WebRtcAgc_set_config(void *agcInst, WebRtcAgc_config_t agcConfig)
{
Agc_t *stt;
stt = (Agc_t *)agcInst;
int WebRtcAgc_set_config(void* agcInst, WebRtcAgcConfig agcConfig) {
LegacyAgc* stt;
stt = (LegacyAgc*)agcInst;
if (stt == NULL)
{
@ -1287,7 +1283,7 @@ int WebRtcAgc_set_config(void *agcInst, WebRtcAgc_config_t agcConfig)
#endif
return -1;
}
/* Store the config in a WebRtcAgc_config_t */
/* Store the config in a WebRtcAgcConfig */
stt->usedConfig.compressionGaindB = agcConfig.compressionGaindB;
stt->usedConfig.limiterEnable = agcConfig.limiterEnable;
stt->usedConfig.targetLevelDbfs = agcConfig.targetLevelDbfs;
@ -1295,10 +1291,9 @@ int WebRtcAgc_set_config(void *agcInst, WebRtcAgc_config_t agcConfig)
return 0;
}
int WebRtcAgc_get_config(void *agcInst, WebRtcAgc_config_t *config)
{
Agc_t *stt;
stt = (Agc_t *)agcInst;
int WebRtcAgc_get_config(void* agcInst, WebRtcAgcConfig* config) {
LegacyAgc* stt;
stt = (LegacyAgc*)agcInst;
if (stt == NULL)
{
@ -1326,12 +1321,12 @@ int WebRtcAgc_get_config(void *agcInst, WebRtcAgc_config_t *config)
int WebRtcAgc_Create(void **agcInst)
{
Agc_t *stt;
LegacyAgc* stt;
if (agcInst == NULL)
{
return -1;
}
stt = (Agc_t *)malloc(sizeof(Agc_t));
stt = (LegacyAgc*)malloc(sizeof(LegacyAgc));
*agcInst = stt;
if (stt == NULL)
@ -1353,9 +1348,9 @@ int WebRtcAgc_Create(void **agcInst)
int WebRtcAgc_Free(void *state)
{
Agc_t *stt;
LegacyAgc* stt;
stt = (Agc_t *)state;
stt = (LegacyAgc*)state;
#ifdef WEBRTC_AGC_DEBUG_DUMP
fclose(stt->fpt);
fclose(stt->agcLog);
@ -1375,10 +1370,10 @@ int WebRtcAgc_Init(void *agcInst, int32_t minLevel, int32_t maxLevel,
int32_t max_add, tmp32;
int16_t i;
int tmpNorm;
Agc_t *stt;
LegacyAgc* stt;
/* typecast state pointer */
stt = (Agc_t *)agcInst;
stt = (LegacyAgc*)agcInst;
if (WebRtcAgc_InitDigital(&stt->digitalAgc, agcMode) != 0)
{

View File

@ -50,8 +50,8 @@ typedef struct
int16_t targetLevelDbfs; // Target level in -dBfs of envelope (default -3)
int16_t agcMode; // Hard coded mode (adaptAna/adaptDig/fixedDig)
uint8_t limiterEnable; // Enabling limiter (on/off (default off))
WebRtcAgc_config_t defaultConfig;
WebRtcAgc_config_t usedConfig;
WebRtcAgcConfig defaultConfig;
WebRtcAgcConfig usedConfig;
// General variables
int16_t initFlag;
@ -118,8 +118,8 @@ typedef struct
uint8_t micLvlSat;
#endif
// Structs for VAD and digital_agc
AgcVad_t vadMic;
DigitalAgc_t digitalAgc;
AgcVad vadMic;
DigitalAgc digitalAgc;
#ifdef WEBRTC_AGC_DEBUG_DUMP
FILE* fpt;
@ -128,6 +128,6 @@ typedef struct
#endif
int16_t lowLevelSignal;
} Agc_t;
} LegacyAgc;
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_LEGACY_ANALOG_AGC_H_

View File

@ -256,9 +256,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
return 0;
}
int32_t WebRtcAgc_InitDigital(DigitalAgc_t *stt, int16_t agcMode)
{
int32_t WebRtcAgc_InitDigital(DigitalAgc* stt, int16_t agcMode) {
if (agcMode == kAgcModeFixedDigital)
{
// start at minimum to find correct gain faster
@ -283,9 +281,9 @@ int32_t WebRtcAgc_InitDigital(DigitalAgc_t *stt, int16_t agcMode)
return 0;
}
int32_t WebRtcAgc_AddFarendToDigital(DigitalAgc_t *stt, const int16_t *in_far,
int16_t nrSamples)
{
int32_t WebRtcAgc_AddFarendToDigital(DigitalAgc* stt,
const int16_t* in_far,
int16_t nrSamples) {
assert(stt != NULL);
// VAD for far end
WebRtcAgc_ProcessVad(&stt->vadFarend, in_far, nrSamples);
@ -293,13 +291,12 @@ int32_t WebRtcAgc_AddFarendToDigital(DigitalAgc_t *stt, const int16_t *in_far,
return 0;
}
int32_t WebRtcAgc_ProcessDigital(DigitalAgc_t *stt,
int32_t WebRtcAgc_ProcessDigital(DigitalAgc* stt,
const int16_t* const* in_near,
int16_t num_bands,
int16_t* const* out,
uint32_t FS,
int16_t lowlevelSignal)
{
int16_t lowlevelSignal) {
// array for gains (one value per ms, incl start & end)
int32_t gains[11];
@ -607,8 +604,7 @@ int32_t WebRtcAgc_ProcessDigital(DigitalAgc_t *stt,
return 0;
}
void WebRtcAgc_InitVad(AgcVad_t *state)
{
void WebRtcAgc_InitVad(AgcVad* state) {
int16_t k;
state->HPstate = 0; // state of high pass filter
@ -635,9 +631,9 @@ void WebRtcAgc_InitVad(AgcVad_t *state)
}
}
int16_t WebRtcAgc_ProcessVad(AgcVad_t *state, // (i) VAD state
const int16_t *in, // (i) Speech signal
int16_t nrSamples) // (i) number of samples
int16_t WebRtcAgc_ProcessVad(AgcVad* state, // (i) VAD state
const int16_t* in, // (i) Speech signal
int16_t nrSamples) // (i) number of samples
{
int32_t out, nrg, tmp32, tmp32b;
uint16_t tmpU16;

View File

@ -34,7 +34,7 @@ typedef struct
int16_t meanShortTerm; // Q10
int32_t varianceShortTerm; // Q8
int16_t stdShortTerm; // Q10
} AgcVad_t; // total = 54 bytes
} AgcVad; // total = 54 bytes
typedef struct
{
@ -44,32 +44,32 @@ typedef struct
int32_t gainTable[32];
int16_t gatePrevious;
int16_t agcMode;
AgcVad_t vadNearend;
AgcVad_t vadFarend;
AgcVad vadNearend;
AgcVad vadFarend;
#ifdef WEBRTC_AGC_DEBUG_DUMP
FILE* logFile;
int frameCounter;
#endif
} DigitalAgc_t;
} DigitalAgc;
int32_t WebRtcAgc_InitDigital(DigitalAgc_t *digitalAgcInst, int16_t agcMode);
int32_t WebRtcAgc_InitDigital(DigitalAgc* digitalAgcInst, int16_t agcMode);
int32_t WebRtcAgc_ProcessDigital(DigitalAgc_t *digitalAgcInst,
int32_t WebRtcAgc_ProcessDigital(DigitalAgc* digitalAgcInst,
const int16_t* const* inNear,
int16_t num_bands,
int16_t* const* out,
uint32_t FS,
int16_t lowLevelSignal);
int32_t WebRtcAgc_AddFarendToDigital(DigitalAgc_t *digitalAgcInst,
const int16_t *inFar,
int32_t WebRtcAgc_AddFarendToDigital(DigitalAgc* digitalAgcInst,
const int16_t* inFar,
int16_t nrSamples);
void WebRtcAgc_InitVad(AgcVad_t *vadInst);
void WebRtcAgc_InitVad(AgcVad* vadInst);
int16_t WebRtcAgc_ProcessVad(AgcVad_t *vadInst, // (i) VAD state
const int16_t *in, // (i) Speech signal
int16_t nrSamples); // (i) number of samples
int16_t WebRtcAgc_ProcessVad(AgcVad* vadInst, // (i) VAD state
const int16_t* in, // (i) Speech signal
int16_t nrSamples); // (i) number of samples
int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
int16_t compressionGaindB, // Q0 (in dB)

View File

@ -42,7 +42,7 @@ typedef struct
int16_t targetLevelDbfs; // default 3 (-3 dBOv)
int16_t compressionGaindB; // default 9 dB
uint8_t limiterEnable; // default kAgcTrue (on)
} WebRtcAgc_config_t;
} WebRtcAgcConfig;
#if defined(__cplusplus)
extern "C"
@ -181,7 +181,7 @@ int WebRtcAgc_Process(void* agcInst,
* : 0 - Normal operation.
* : -1 - Error
*/
int WebRtcAgc_set_config(void* agcInst, WebRtcAgc_config_t config);
int WebRtcAgc_set_config(void* agcInst, WebRtcAgcConfig config);
/*
* This function returns the config parameters (targetLevelDbfs,
@ -197,7 +197,7 @@ int WebRtcAgc_set_config(void* agcInst, WebRtcAgc_config_t config);
* : 0 - Normal operation.
* : -1 - Error
*/
int WebRtcAgc_get_config(void* agcInst, WebRtcAgc_config_t* config);
int WebRtcAgc_get_config(void* agcInst, WebRtcAgcConfig* config);
/*
* This function creates an AGC instance, which will contain the state