Moved calling points of spl_int routines from module init to module create routines.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2872 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kma@webrtc.org 2012-10-05 00:19:01 +00:00
parent 3f9a721da5
commit ac4d70de04
9 changed files with 12 additions and 19 deletions

View File

@ -14,10 +14,6 @@
* Some code came from common/rtcd.c in the WebM project. * Some code came from common/rtcd.c in the WebM project.
*/ */
/* TODO(kma): Add calls to WebRtcSpl_Init() in all related modules
* (AEC, NS, codecs etc.).
*/
#include "common_audio/signal_processing/include/real_fft.h" #include "common_audio/signal_processing/include/real_fft.h"
#include "common_audio/signal_processing/include/signal_processing_library.h" #include "common_audio/signal_processing/include/signal_processing_library.h"
#include "system_wrappers/interface/cpu_features_wrapper.h" #include "system_wrappers/interface/cpu_features_wrapper.h"

View File

@ -37,6 +37,8 @@ int WebRtcVad_Create(VadInst** handle) {
return -1; return -1;
} }
WebRtcSpl_Init();
self->init_flag = 0; self->init_flag = 0;
return 0; return 0;
@ -54,7 +56,6 @@ int WebRtcVad_Free(VadInst* handle) {
// TODO(bjornv): Move WebRtcVad_InitCore() code here. // TODO(bjornv): Move WebRtcVad_InitCore() code here.
int WebRtcVad_Init(VadInst* handle) { int WebRtcVad_Init(VadInst* handle) {
WebRtcSpl_Init();
// Initialize the core VAD component. // Initialize the core VAD component.
return WebRtcVad_InitCore((VadInstT*) handle); return WebRtcVad_InitCore((VadInstT*) handle);
} }

View File

@ -48,6 +48,7 @@ WebRtc_Word16 WebRtcIlbcfix_DecoderAssign(iLBC_decinst_t **iLBC_decinst, WebRtc_
WebRtc_Word16 WebRtcIlbcfix_EncoderCreate(iLBC_encinst_t **iLBC_encinst) { WebRtc_Word16 WebRtcIlbcfix_EncoderCreate(iLBC_encinst_t **iLBC_encinst) {
*iLBC_encinst=(iLBC_encinst_t*)malloc(sizeof(iLBC_Enc_Inst_t)); *iLBC_encinst=(iLBC_encinst_t*)malloc(sizeof(iLBC_Enc_Inst_t));
if (*iLBC_encinst!=NULL) { if (*iLBC_encinst!=NULL) {
WebRtcSpl_Init();
return(0); return(0);
} else { } else {
return(-1); return(-1);
@ -57,6 +58,7 @@ WebRtc_Word16 WebRtcIlbcfix_EncoderCreate(iLBC_encinst_t **iLBC_encinst) {
WebRtc_Word16 WebRtcIlbcfix_DecoderCreate(iLBC_decinst_t **iLBC_decinst) { WebRtc_Word16 WebRtcIlbcfix_DecoderCreate(iLBC_decinst_t **iLBC_decinst) {
*iLBC_decinst=(iLBC_decinst_t*)malloc(sizeof(iLBC_Dec_Inst_t)); *iLBC_decinst=(iLBC_decinst_t*)malloc(sizeof(iLBC_Dec_Inst_t));
if (*iLBC_decinst!=NULL) { if (*iLBC_decinst!=NULL) {
WebRtcSpl_Init();
return(0); return(0);
} else { } else {
return(-1); return(-1);

View File

@ -29,8 +29,6 @@ WebRtc_Word16 WebRtcIlbcfix_InitDecode( /* (o) Number of decoded samples */
int use_enhancer) { /* (i) 1: use enhancer, 0: no enhancer */ int use_enhancer) { /* (i) 1: use enhancer, 0: no enhancer */
int i; int i;
WebRtcSpl_Init();
iLBCdec_inst->mode = mode; iLBCdec_inst->mode = mode;
/* Set all the variables that are dependent on the frame size mode */ /* Set all the variables that are dependent on the frame size mode */

View File

@ -26,8 +26,6 @@
WebRtc_Word16 WebRtcIlbcfix_InitEncode( /* (o) Number of bytes encoded */ WebRtc_Word16 WebRtcIlbcfix_InitEncode( /* (o) Number of bytes encoded */
iLBC_Enc_Inst_t *iLBCenc_inst, /* (i/o) Encoder instance */ iLBC_Enc_Inst_t *iLBCenc_inst, /* (i/o) Encoder instance */
WebRtc_Word16 mode) { /* (i) frame size mode */ WebRtc_Word16 mode) { /* (i) frame size mode */
WebRtcSpl_Init();
iLBCenc_inst->mode = mode; iLBCenc_inst->mode = mode;
/* Set all the variables that are dependent on the frame size mode */ /* Set all the variables that are dependent on the frame size mode */

View File

@ -86,6 +86,7 @@ WebRtc_Word16 WebRtcIsacfix_Create(ISACFIX_MainStruct **ISAC_main_inst)
(*(ISACFIX_SubStruct**)ISAC_main_inst)->errorcode = 0; (*(ISACFIX_SubStruct**)ISAC_main_inst)->errorcode = 0;
(*(ISACFIX_SubStruct**)ISAC_main_inst)->initflag = 0; (*(ISACFIX_SubStruct**)ISAC_main_inst)->initflag = 0;
(*(ISACFIX_SubStruct**)ISAC_main_inst)->ISACenc_obj.SaveEnc_ptr = NULL; (*(ISACFIX_SubStruct**)ISAC_main_inst)->ISACenc_obj.SaveEnc_ptr = NULL;
WebRtcSpl_Init();
return(0); return(0);
} else { } else {
return(-1); return(-1);
@ -217,8 +218,6 @@ WebRtc_Word16 WebRtcIsacfix_EncoderInit(ISACFIX_MainStruct *ISAC_main_inst,
/* flag encoder init */ /* flag encoder init */
ISAC_inst->initflag |= 2; ISAC_inst->initflag |= 2;
WebRtcSpl_Init();
if (CodingMode == 0) if (CodingMode == 0)
/* Adaptive mode */ /* Adaptive mode */
ISAC_inst->ISACenc_obj.new_framelength = INITIAL_FRAMESAMPLES; ISAC_inst->ISACenc_obj.new_framelength = INITIAL_FRAMESAMPLES;
@ -529,8 +528,6 @@ WebRtc_Word16 WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst)
/* flag decoder init */ /* flag decoder init */
ISAC_inst->initflag |= 1; ISAC_inst->initflag |= 1;
WebRtcSpl_Init();
WebRtcIsacfix_InitMaskingDec(&ISAC_inst->ISACdec_obj.maskfiltstr_obj); WebRtcIsacfix_InitMaskingDec(&ISAC_inst->ISACdec_obj.maskfiltstr_obj);
WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACdec_obj.postfiltbankstr_obj); WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACdec_obj.postfiltbankstr_obj);
WebRtcIsacfix_InitPitchFilter(&ISAC_inst->ISACdec_obj.pitchfiltstr_obj); WebRtcIsacfix_InitPitchFilter(&ISAC_inst->ISACdec_obj.pitchfiltstr_obj);

View File

@ -290,6 +290,9 @@ int WebRtcNetEQ_Assign(void **inst, void *NETEQ_inst_Addr)
MainInst_t *NetEqMainInst = (MainInst_t*) NETEQ_inst_Addr; MainInst_t *NetEqMainInst = (MainInst_t*) NETEQ_inst_Addr;
*inst = NETEQ_inst_Addr; *inst = NETEQ_inst_Addr;
if (*inst == NULL) return (-1); if (*inst == NULL) return (-1);
WebRtcSpl_Init();
/* Clear memory */ /* Clear memory */
WebRtcSpl_MemSetW16((WebRtc_Word16*) NetEqMainInst, 0, WebRtcSpl_MemSetW16((WebRtc_Word16*) NetEqMainInst, 0,
(sizeof(MainInst_t) / sizeof(WebRtc_Word16))); (sizeof(MainInst_t) / sizeof(WebRtc_Word16)));
@ -396,8 +399,6 @@ int WebRtcNetEQ_Init(void *inst, WebRtc_UWord16 fs)
return (-1); return (-1);
} }
WebRtcSpl_Init();
#ifdef NETEQ_VAD #ifdef NETEQ_VAD
/* Start out with no PostDecode VAD instance */ /* Start out with no PostDecode VAD instance */
NetEqMainInst->DSPinst.VADInst.VADState = NULL; NetEqMainInst->DSPinst.VADInst.VADState = NULL;

View File

@ -111,6 +111,8 @@ AudioDeviceModule* AudioDeviceModuleImpl::Create(const WebRtc_Word32 id,
return NULL; return NULL;
} }
WebRtcSpl_Init();
return audioDevice; return audioDevice;
} }
@ -608,8 +610,6 @@ WebRtc_Word32 AudioDeviceModuleImpl::Init()
if (!_ptrAudioDevice) if (!_ptrAudioDevice)
return -1; return -1;
WebRtcSpl_Init();
_ptrAudioDeviceUtility->Init(); _ptrAudioDeviceUtility->Init();
if (_ptrAudioDevice->Init() == -1) if (_ptrAudioDevice->Init() == -1)

View File

@ -110,6 +110,8 @@ WebRtc_Word32 WebRtcAecm_Create(void **aecmInst)
return -1; return -1;
} }
WebRtcSpl_Init();
aecm->initFlag = 0; aecm->initFlag = 0;
aecm->lastError = 0; aecm->lastError = 0;
@ -171,8 +173,6 @@ WebRtc_Word32 WebRtcAecm_Init(void *aecmInst, WebRtc_Word32 sampFreq)
} }
aecm->sampFreq = sampFreq; aecm->sampFreq = sampFreq;
WebRtcSpl_Init();
// Initialize AECM core // Initialize AECM core
if (WebRtcAecm_InitCore(aecm->aecmCore, aecm->sampFreq) == -1) if (WebRtcAecm_InitCore(aecm->aecmCore, aecm->sampFreq) == -1)
{ {