From 7796c02b4280139ea6e082b5012dd07f627267c1 Mon Sep 17 00:00:00 2001 From: "turajs@google.com" Date: Tue, 30 Aug 2011 20:30:17 +0000 Subject: [PATCH] Wrap encode, decode, PLC NB functions in #define to avoid warnings. Review URL: http://webrtc-codereview.appspot.com/133005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@492 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../codecs/iSAC/fix/interface/isacfix.h | 12 ++++++ .../codecs/iSAC/fix/source/codec.h | 2 +- .../codecs/iSAC/fix/source/filterbanks.c | 4 +- .../codecs/iSAC/fix/source/isacfix.c | 39 +++++++------------ .../codecs/iSAC/fix/source/structs.h | 4 +- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/modules/audio_coding/codecs/iSAC/fix/interface/isacfix.h b/src/modules/audio_coding/codecs/iSAC/fix/interface/isacfix.h index 4df005547d..28e942940f 100644 --- a/src/modules/audio_coding/codecs/iSAC/fix/interface/isacfix.h +++ b/src/modules/audio_coding/codecs/iSAC/fix/interface/isacfix.h @@ -144,6 +144,8 @@ extern "C" { * 10ms frames until it reaches the chosen Framesize (480 or 960 wide-band samples * corresponding to 30 or 60 ms frames), and then proceeds to the encoding. * + * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined + * * Input: * - ISAC_main_inst : ISAC instance. * - speechIn : input speech vector. @@ -158,9 +160,11 @@ extern "C" { */ +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED WebRtc_Word16 WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct *ISAC_main_inst, const WebRtc_Word16 *speechIn, WebRtc_Word16 *encoded); +#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED @@ -262,6 +266,8 @@ extern "C" { * Output speech length will be a multiple of 240 samples: 240 or 480 samples, * depending on the framesize (30 or 60 ms). * + * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined + * * Input: * - ISAC_main_inst : ISAC instance. * - encoded : encoded ISAC frame(s) @@ -274,11 +280,13 @@ extern "C" { * -1 - Error */ +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED WebRtc_Word16 WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, const WebRtc_UWord16 *encoded, WebRtc_Word16 len, WebRtc_Word16 *decoded, WebRtc_Word16 *speechType); +#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED /**************************************************************************** @@ -288,6 +296,8 @@ extern "C" { * Output speech length will be "240*noOfLostFrames" samples * that equevalent of "30*noOfLostFrames" millisecond. * + * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined + * * Input: * - ISAC_main_inst : ISAC instance. * - noOfLostFrames : Number of PLC frames (240 sample=30ms) to produce @@ -300,9 +310,11 @@ extern "C" { * -1 - Error */ +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED WebRtc_Word16 WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct *ISAC_main_inst, WebRtc_Word16 *decoded, WebRtc_Word16 noOfLostFrames ); +#endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED diff --git a/src/modules/audio_coding/codecs/iSAC/fix/source/codec.h b/src/modules/audio_coding/codecs/iSAC/fix/source/codec.h index f852d9d338..5b00cbe4db 100644 --- a/src/modules/audio_coding/codecs/iSAC/fix/source/codec.h +++ b/src/modules/audio_coding/codecs/iSAC/fix/source/codec.h @@ -97,7 +97,7 @@ void WebRtcIsacfix_FilterAndCombine1(WebRtc_Word16 *tempin_ch1, WebRtc_Word16 *out16, PostFiltBankstr *postfiltdata); -#ifdef NB_CALLS +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED void WebRtcIsacfix_SplitAndFilter2(WebRtc_Word16 *in, WebRtc_Word16 *LP16, diff --git a/src/modules/audio_coding/codecs/iSAC/fix/source/filterbanks.c b/src/modules/audio_coding/codecs/iSAC/fix/source/filterbanks.c index ac412b4604..09a1b9fa7f 100644 --- a/src/modules/audio_coding/codecs/iSAC/fix/source/filterbanks.c +++ b/src/modules/audio_coding/codecs/iSAC/fix/source/filterbanks.c @@ -152,7 +152,7 @@ void WebRtcIsacfix_SplitAndFilter1(WebRtc_Word16 *pin, }/*end of WebRtcIsacfix_SplitAndFilter */ -#ifdef NB_CALLS +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED /* Without lookahead */ void WebRtcIsacfix_SplitAndFilter2(WebRtc_Word16 *pin, @@ -267,7 +267,7 @@ void WebRtcIsacfix_FilterAndCombine1(WebRtc_Word16 *tempin_ch1, } -#ifdef NB_CALLS +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED /* Function WebRtcIsacfix_FilterAndCombine */ /* This is a decoder function that takes the decimated length len/2 input low-pass and diff --git a/src/modules/audio_coding/codecs/iSAC/fix/source/isacfix.c b/src/modules/audio_coding/codecs/iSAC/fix/source/isacfix.c index bab7b5185d..46a38bfb25 100644 --- a/src/modules/audio_coding/codecs/iSAC/fix/source/isacfix.c +++ b/src/modules/audio_coding/codecs/iSAC/fix/source/isacfix.c @@ -242,7 +242,7 @@ WebRtc_Word16 WebRtcIsacfix_EncoderInit(ISACFIX_MainStruct *ISAC_main_inst, ISAC_inst->ISACenc_obj.bitstr_obj.stream[k] = 0; } -#ifdef NB_CALLS +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED WebRtcIsacfix_InitPostFilterbank(&ISAC_inst->ISACenc_obj.interpolatorstr_obj); #endif @@ -332,6 +332,8 @@ WebRtc_Word16 WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst, * 10ms frames until it reaches the chosen Framesize (480 or 960 wide-band samples * corresponding to 30 or 60 ms frames), and then proceeds to the encoding. * + * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined + * * Input: * - ISAC_main_inst : ISAC instance. * - speechIn : input speech vector. @@ -345,13 +347,11 @@ WebRtc_Word16 WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst, * so it keeps buffering speech samples. * : -1 - Error */ - +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED WebRtc_Word16 WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct *ISAC_main_inst, const WebRtc_Word16 *speechIn, WebRtc_Word16 *encoded) { -#ifdef NB_CALLS - ISACFIX_SubStruct *ISAC_inst; WebRtc_Word16 stream_len; WebRtc_Word16 speechInWB[FRAMESAMPLES_10ms]; @@ -407,11 +407,8 @@ WebRtc_Word16 WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct *ISAC_main_inst, return stream_len; - -#else /* NB_CALLS not defined */ - return -1; -#endif /* NB_CALLS */ } +#endif /* WEBRTC_ISAC_FIX_NB_CALLS_ENABLED */ /**************************************************************************** @@ -511,7 +508,7 @@ WebRtc_Word16 WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst) WebRtcIsacfix_InitPlc( &ISAC_inst->ISACdec_obj.plcstr_obj ); -#ifdef NB_CALLS +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED WebRtcIsacfix_InitPreFilterbank(&ISAC_inst->ISACdec_obj.decimatorstr_obj); #endif @@ -814,6 +811,8 @@ WebRtc_Word16 WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst, * Output speech length will be a multiple of 240 samples: 240 or 480 samples, * depending on the framesize (30 or 60 ms). * + * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined + * * Input: * - ISAC_main_inst : ISAC instance. * - encoded : encoded ISAC frame(s) @@ -826,14 +825,13 @@ WebRtc_Word16 WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst, * -1 - Error */ - +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED WebRtc_Word16 WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, const WebRtc_UWord16 *encoded, WebRtc_Word16 len, WebRtc_Word16 *decoded, WebRtc_Word16 *speechType) { -#ifdef NB_CALLS ISACFIX_SubStruct *ISAC_inst; /* twice the number of samples (480 or 960), output from decoder */ /* that were actually used in the encoder/decoder (determined on the fly) */ @@ -908,11 +906,8 @@ WebRtc_Word16 WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, } return number_of_samples/2; - -#else /* NB_CALLS not defined */ - return -1; -#endif /* NB_CALLS */ } +#endif /* WEBRTC_ISAC_FIX_NB_CALLS_ENABLED */ /**************************************************************************** @@ -922,6 +917,8 @@ WebRtc_Word16 WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, * Output speech length will be "240*noOfLostFrames" samples * that is equevalent of "30*noOfLostFrames" millisecond. * + * The function is enabled if WEBRTC_ISAC_FIX_NB_CALLS_ENABLED is defined + * * Input: * - ISAC_main_inst : ISAC instance. * - noOfLostFrames : Number of PLC frames (240 sample=30ms) to produce @@ -933,13 +930,11 @@ WebRtc_Word16 WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, * -1 - Error */ +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED WebRtc_Word16 WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct *ISAC_main_inst, WebRtc_Word16 *decoded, WebRtc_Word16 noOfLostFrames ) { - -#ifdef NB_CALLS - WebRtc_Word16 no_of_samples, declen, k, ok; WebRtc_Word16 outframeNB[FRAMESAMPLES]; WebRtc_Word16 outframeWB[FRAMESAMPLES]; @@ -977,14 +972,8 @@ WebRtc_Word16 WebRtcIsacfix_DecodePlcNb(ISACFIX_MainStruct *ISAC_main_inst, } return declen; - - -#else /* NB_CALLS not defined */ - return -1; -#endif /* NB_CALLS */ - - } +#endif /* WEBRTC_ISAC_FIX_NB_CALLS_ENABLED */ diff --git a/src/modules/audio_coding/codecs/iSAC/fix/source/structs.h b/src/modules/audio_coding/codecs/iSAC/fix/source/structs.h index b500379cb4..54dffa9249 100644 --- a/src/modules/audio_coding/codecs/iSAC/fix/source/structs.h +++ b/src/modules/audio_coding/codecs/iSAC/fix/source/structs.h @@ -322,7 +322,7 @@ typedef struct { WebRtc_UWord16 MaxBits; WebRtc_Word16 bitstr_seed; -#ifdef NB_CALLS +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED PostFiltBankstr interpolatorstr_obj; #endif @@ -344,7 +344,7 @@ typedef struct { PitchFiltstr pitchfiltstr_obj; PLCstr plcstr_obj; /* TS; for packet loss concealment */ -#ifdef NB_CALLS +#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED PreFiltBankstr decimatorstr_obj; #endif