Clang-format ns_core

BUG=webrtc:3811
R=bjornv@webrtc.org, kwiberg@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7257 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
aluebs@webrtc.org
2014-09-22 10:59:46 +00:00
parent 759982d357
commit bdfdc96b22
2 changed files with 401 additions and 334 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,107 +8,106 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NS_CORE_H_ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_NS_CORE_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NS_CORE_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_NS_NS_CORE_H_
#include "webrtc/modules/audio_processing/ns/defines.h" #include "webrtc/modules/audio_processing/ns/defines.h"
typedef struct NSParaExtract_t_ { typedef struct NSParaExtract_t_ {
// bin size of histogram
//bin size of histogram
float binSizeLrt; float binSizeLrt;
float binSizeSpecFlat; float binSizeSpecFlat;
float binSizeSpecDiff; float binSizeSpecDiff;
//range of histogram over which lrt threshold is computed // range of histogram over which lrt threshold is computed
float rangeAvgHistLrt; float rangeAvgHistLrt;
//scale parameters: multiply dominant peaks of the histograms by scale factor to obtain // scale parameters: multiply dominant peaks of the histograms by scale factor
//thresholds for prior model // to obtain thresholds for prior model
float factor1ModelPars; //for lrt and spectral difference float factor1ModelPars; // for lrt and spectral difference
float factor2ModelPars; //for spectral_flatness: used when noise is flatter than speech float factor2ModelPars; // for spectral_flatness: used when noise is flatter
//peak limit for spectral flatness (varies between 0 and 1) // than speech
// peak limit for spectral flatness (varies between 0 and 1)
float thresPosSpecFlat; float thresPosSpecFlat;
//limit on spacing of two highest peaks in histogram: spacing determined by bin size // limit on spacing of two highest peaks in histogram: spacing determined by
// bin size
float limitPeakSpacingSpecFlat; float limitPeakSpacingSpecFlat;
float limitPeakSpacingSpecDiff; float limitPeakSpacingSpecDiff;
//limit on relevance of second peak: // limit on relevance of second peak:
float limitPeakWeightsSpecFlat; float limitPeakWeightsSpecFlat;
float limitPeakWeightsSpecDiff; float limitPeakWeightsSpecDiff;
//limit on fluctuation of lrt feature // limit on fluctuation of lrt feature
float thresFluctLrt; float thresFluctLrt;
//limit on the max and min values for the feature thresholds // limit on the max and min values for the feature thresholds
float maxLrt; float maxLrt;
float minLrt; float minLrt;
float maxSpecFlat; float maxSpecFlat;
float minSpecFlat; float minSpecFlat;
float maxSpecDiff; float maxSpecDiff;
float minSpecDiff; float minSpecDiff;
//criteria of weight of histogram peak to accept/reject feature // criteria of weight of histogram peak to accept/reject feature
int thresWeightSpecFlat; int thresWeightSpecFlat;
int thresWeightSpecDiff; int thresWeightSpecDiff;
} NSParaExtract_t; } NSParaExtract_t;
typedef struct NSinst_t_ { typedef struct NSinst_t_ {
uint32_t fs;
int blockLen;
int blockLen10ms;
int windShift;
int outLen;
int anaLen;
int magnLen;
int aggrMode;
const float* window;
float analyzeBuf[ANAL_BLOCKL_MAX];
float dataBuf[ANAL_BLOCKL_MAX];
float syntBuf[ANAL_BLOCKL_MAX];
float outBuf[3 * BLOCKL_MAX];
uint32_t fs; int initFlag;
int blockLen;
int blockLen10ms;
int windShift;
int outLen;
int anaLen;
int magnLen;
int aggrMode;
const float* window;
float analyzeBuf[ANAL_BLOCKL_MAX];
float dataBuf[ANAL_BLOCKL_MAX];
float syntBuf[ANAL_BLOCKL_MAX];
float outBuf[3 * BLOCKL_MAX];
int initFlag;
// parameters for quantile noise estimation // parameters for quantile noise estimation
float density[SIMULT* HALF_ANAL_BLOCKL]; float density[SIMULT * HALF_ANAL_BLOCKL];
float lquantile[SIMULT* HALF_ANAL_BLOCKL]; float lquantile[SIMULT * HALF_ANAL_BLOCKL];
float quantile[HALF_ANAL_BLOCKL]; float quantile[HALF_ANAL_BLOCKL];
int counter[SIMULT]; int counter[SIMULT];
int updates; int updates;
// parameters for Wiener filter // parameters for Wiener filter
float smooth[HALF_ANAL_BLOCKL]; float smooth[HALF_ANAL_BLOCKL];
float overdrive; float overdrive;
float denoiseBound; float denoiseBound;
int gainmap; int gainmap;
// fft work arrays. // fft work arrays.
int ip[IP_LENGTH]; int ip[IP_LENGTH];
float wfft[W_LENGTH]; float wfft[W_LENGTH];
// parameters for new method: some not needed, will reduce/cleanup later // parameters for new method: some not needed, will reduce/cleanup later
int32_t blockInd; //frame index counter int32_t blockInd; // frame index counter
int modelUpdatePars[4]; //parameters for updating or estimating int modelUpdatePars[4]; // parameters for updating or estimating
// thresholds/weights for prior model // thresholds/weights for prior model
float priorModelPars[7]; //parameters for prior model float priorModelPars[7]; // parameters for prior model
float noisePrev[HALF_ANAL_BLOCKL]; //noise spectrum from previous frame float noisePrev[HALF_ANAL_BLOCKL]; // noise spectrum from previous frame
float magnPrev[HALF_ANAL_BLOCKL]; //magnitude spectrum of previous frame float magnPrev[HALF_ANAL_BLOCKL]; // magnitude spectrum of previous frame
float logLrtTimeAvg[HALF_ANAL_BLOCKL]; //log lrt factor with time-smoothing float logLrtTimeAvg[HALF_ANAL_BLOCKL]; // log lrt factor with time-smoothing
float priorSpeechProb; //prior speech/noise probability float priorSpeechProb; // prior speech/noise probability
float featureData[7]; //data for features float featureData[7]; // data for features
float magnAvgPause[HALF_ANAL_BLOCKL]; //conservative noise spectrum estimate float magnAvgPause[HALF_ANAL_BLOCKL]; // conservative noise spectrum estimate
float signalEnergy; //energy of magn float signalEnergy; // energy of magn
float sumMagn; //sum of magn float sumMagn; // sum of magn
float whiteNoiseLevel; //initial noise estimate float whiteNoiseLevel; // initial noise estimate
float initMagnEst[HALF_ANAL_BLOCKL]; //initial magnitude spectrum estimate float initMagnEst[HALF_ANAL_BLOCKL]; // initial magnitude spectrum estimate
float pinkNoiseNumerator; //pink noise parameter: numerator float pinkNoiseNumerator; // pink noise parameter: numerator
float pinkNoiseExp; //pink noise parameter: power of freq float pinkNoiseExp; // pink noise parameter: power of freq
NSParaExtract_t featureExtractionParams; //parameters for feature extraction NSParaExtract_t featureExtractionParams; // parameters for feature extraction
//histograms for parameter estimation // histograms for parameter estimation
int histLrt[HIST_PAR_EST]; int histLrt[HIST_PAR_EST];
int histSpecFlat[HIST_PAR_EST]; int histSpecFlat[HIST_PAR_EST];
int histSpecDiff[HIST_PAR_EST]; int histSpecDiff[HIST_PAR_EST];
//quantities for high band estimate // quantities for high band estimate
float speechProb[HALF_ANAL_BLOCKL]; //final speech/noise prob: prior + LRT float speechProb[HALF_ANAL_BLOCKL]; // final speech/noise prob: prior + LRT
float dataBufHB[ANAL_BLOCKL_MAX]; //buffering data for HB float dataBufHB[ANAL_BLOCKL_MAX]; // buffering data for HB
} NSinst_t; } NSinst_t;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -137,7 +136,7 @@ int WebRtcNs_InitCore(NSinst_t* inst, uint32_t fs);
* *
* Input: * Input:
* - inst : Instance that should be initialized * - inst : Instance that should be initialized
* - mode : 0: Mild (6 dB), 1: Medium (10 dB), 2: Aggressive (15 dB) * - mode : 0: Mild (6dB), 1: Medium (10dB), 2: Aggressive (15dB)
* *
* Output: * Output:
* - NS_inst : Initialized instance * - NS_inst : Initialized instance
@ -188,8 +187,7 @@ int WebRtcNs_ProcessCore(NSinst_t* inst,
float* outFrameLow, float* outFrameLow,
float* outFrameHigh); float* outFrameHigh);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NS_CORE_H_ #endif // WEBRTC_MODULES_AUDIO_PROCESSING_NS_NS_CORE_H_