diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 860fa74772bf2205c28ef11ef70d09175e531e5d..eec60bbd296fda785ba0814b0e587834536b489a 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -1745,7 +1745,7 @@ typedef enum _DCTTYPE #define MSNUMSUBFR 6 #define MSBUFLEN 5 -#define NOISE_HEADROOM 5 /* headroom of noise in generate_masking_noise */ +#define NOISE_HEADROOM 5 /* headroom of noise in generate_masking_noise_fx */ #define MSALPHACORALPHA_FLT 0.7f #define MSALPHACORMAX_FLT 0.3f diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 1a14fb4c8ce7cb572bfbaa973f82588b3aea74a7..9079381699c3ffab05c11dd3928e0836879e8981 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4982,7 +4982,7 @@ void FdCngEncodeDiracMDCTStereoSID( CPE_ENC_HANDLE hCPE /* i/o: CPE encoder state structure */ ); -void FdCngDecodeDiracMDCTStereoSID( +void FdCngDecodeDiracMDCTStereoSID_fx( CPE_DEC_HANDLE hCPE /* i/o: CPE decoder state structure */ ); diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 6e03bb27d0f17988d3d4379df191dc90ea466d8b..c694d05d3e2bda8bb9ad5c05f829ca3946bd3ba3 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1645,7 +1645,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( const Word16 nchan_in /* i : number of input channels */ ); -void configureFdCngDec_fx( +void configureFdCngDec_ivas_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, const Word32 total_brate, @@ -1786,7 +1786,7 @@ ivas_error stereo_memory_dec_fx( const Word16 nchan_transport /* i : number of transport channels*/ ); -void ivas_initFdCngDec_fx( +void initFdCngDec_ivas_fx( DEC_CORE_HANDLE st, /* i/o: decoder state structure */ Word16 scale ); diff --git a/lib_com/lsf_dec_bfi.c b/lib_com/lsf_dec_bfi.c index 62f41f93728e0a926bab8226f72003265ab9f86b..34eede552b984dbcfa6f43692eb886f69869705d 100644 --- a/lib_com/lsf_dec_bfi.c +++ b/lib_com/lsf_dec_bfi.c @@ -262,7 +262,7 @@ const float *PlcGetlsfBase_flt( /* high rates, return value is never used; the correct value changes dynamically and is not available during PLC; therefore, the setting is kept as before (without the define PLC_FIX_XSF_HANDLING); the - correct value would be isf[m] as returned by lpc_unquantize_flt() + correct value would be isf[m] as returned by lpc_unquantize() during normal decoding */ if ( sr_core == 32000 ) diff --git a/lib_com/lsf_dec_bfi_fx.c b/lib_com/lsf_dec_bfi_fx.c index a8012671e6b1add6838db18fea3466ccfa11df0b..45a3bb1d70438bbabda9b0242f0f4691f76f0c10 100644 --- a/lib_com/lsf_dec_bfi_fx.c +++ b/lib_com/lsf_dec_bfi_fx.c @@ -266,7 +266,7 @@ Word16 const * PlcGetLsfBase ( /* high rates, return value is never used; the correct value changes dynamically and is not available during PLC; therefore, the setting is kept as before (without the define PLC_FIX_XSF_HANDLING); the - correct value would be isf[m] as returned by lpc_unquantize() + correct value would be isf[m] as returned by lpc_unquantize_fx() during normal decoding */ IF(EQ_32(sr_core,32000)) { diff --git a/lib_com/prot.h b/lib_com/prot.h index b27d15c20a47607f2c84e5492b5ab3752d0835c9..86cfc35c18b4c4ad16e6f1f319a94382acbf68d8 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -5315,7 +5315,7 @@ void HQ_nbfec_init_flt( HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle */ ); -ivas_error evs_dec_flt( +ivas_error evs_dec( Decoder_State *st, /* i/o: Decoder state structure */ float mem_hp20_out[L_HP20_MEM], /* i/o: HP filter memory for synthesis */ float *output, /* o : output synthesis signal */ @@ -5556,7 +5556,7 @@ void hq_core_dec( float *output /* o : LB synthesis in case of ACELP-HQ switch */ ); -void IMDCT_flt( +void IMDCT( float *x, float *old_syn_overl, float *syn_Overl_TDAC, @@ -6741,7 +6741,7 @@ void ifft3( ); /*! r: updated estimate of background noise */ -void minimumStatistics_flt( +void minimumStatistics( float *noiseLevelMemory, /* i/o: internal state */ int16_t *noiseLevelIndex, /* i/o: internal state */ int16_t *currLevelIndex, /* i/o: internal state (circular buffer) */ @@ -7121,7 +7121,7 @@ int16_t Mode2_gain_enc_mless( const int16_t coder_type /* i : type of coder */ ); -void decode_acelp_gains_flt( +void decode_acelp_gains( const float *code, const int16_t gains_mode, const float mean_ener_code, @@ -7135,7 +7135,7 @@ void decode_acelp_gains_flt( float *code2, float *gain_code2 ); -void gain_dec_gacelp_uv_flt( +void gain_dec_gacelp_uv( int16_t index, /* i/o: Quantization index vector */ const float *code, /* i : algebraic code excitation */ const float *code2, /* i : algebraic code excitation */ @@ -7274,14 +7274,14 @@ int16_t encode_lpc_avq( const int16_t element_mode /* i : element mode */ ); -int16_t dlpc_avq_flt( +int16_t dlpc_avq( int16_t *index, /* i : Quantization indices */ float *LSF_Q, /* o : Quantized LSF vectors */ const int16_t numlpc, /* i : Number of sets of lpc */ const int32_t sr_core /* i : internal sampling rate */ ); -int16_t decode_lpc_avq_flt( +int16_t decode_lpc_avq( Decoder_State *st, /* i/o: decoder state structure */ const int16_t numlpc, /* i : Number of sets of lpc */ int16_t *param_lpc, /* o : lpc parameters */ @@ -8114,7 +8114,7 @@ void coder_tcx_post( const float *Ai /* i : Unquantized (interpolated) LPC coefficients */ ); -void decoder_tcx_flt( +void decoder_tcx( Decoder_State *st, /* i/o: coder memory state */ int16_t prm[], /* i : parameters */ float A[], /* i : coefficients NxAz[M+1] */ @@ -8126,7 +8126,7 @@ void decoder_tcx_flt( const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ ); -void decoder_tcx_post_flt( +void decoder_tcx_post( Decoder_State *st, /* i/o: decoder memory state */ float *synth, float *synthFB, @@ -8421,7 +8421,7 @@ int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( float *dist_ptr /* i/o: updated MSE vector for stage1 */ ); -void PulseResynchronization_flt( +void PulseResynchronization( const float *src_exc, /* i : Input excitation buffer */ float *dst_exc, /* o : output excitation buffer */ const int16_t nFrameLength, /* i : frame length */ @@ -8430,7 +8430,7 @@ void PulseResynchronization_flt( const float pitchEnd /* i : Pitch at the end of the current frame */ ); -void con_acelp_flt( +void con_acelp( float A[], /* i : coefficients NxAz[M+1] */ const int16_t coder_type, /* i : ACELP coder type */ float synth[], /* i/o: synthesis */ @@ -8443,7 +8443,7 @@ void con_acelp_flt( float *bwe_exc /* o : excitation for SWB TBE */ ); -void con_tcx_flt( +void con_tcx( Decoder_State *st, /* i/o: coder memory state */ float synth[], /* i/o: synth[] */ const float coh, /* i : coherence of stereo signal */ @@ -8589,7 +8589,7 @@ void lpc_quantization( int16_t *bits_param_lpc, int16_t *no_param_lpc ); -void lpc_unquantize_flt( +void lpc_unquantize( Decoder_State *st, float *lsf, float *lsp, @@ -8850,21 +8850,21 @@ void generate_comfort_noise_enc( Encoder_State *st /* i/o: encoder state structure */ ); -void generate_comfort_noise_dec_flt( +void generate_comfort_noise_dec( float **bufferReal, /* o : Real part of input bands */ float **bufferImag, /* o : Imaginary part of input bands */ Decoder_State *st, /* i/o: decoder state structure */ const int16_t nchan_out /* i : number of output channels */ ); -void generate_comfort_noise_dec_hf_flt( +void generate_comfort_noise_dec_hf( float **bufferReal, /* o : Real part of input bands */ float **bufferImag, /* o : Imaginary part of input bands */ HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ const int16_t cng_flag /* i : CNG Flag */ ); -void generate_masking_noise_flt( +void generate_masking_noise( float *timeDomainBuffer, /* i/o: time-domain signal */ HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ const int16_t length, /* i : frame size */ @@ -8891,11 +8891,11 @@ void generate_masking_noise_ivas_fx( ); #endif -void generate_masking_noise_update_seed_flt( +void generate_masking_noise_update_seed( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ); -void generate_masking_noise_mdct_flt( +void generate_masking_noise_mdct( float *mdctBuffer, /* i/o: time-domain signal */ HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ); @@ -8941,16 +8941,6 @@ void generate_stereo_masking_noise( #ifdef IVAS_FLOAT_FIXED void generate_stereo_masking_noise_fx( - float *syn, /* i/o: time-domain signal */ - Decoder_State *st, /* i/o: decoder state structure */ - STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i : TD stereo structure */ - const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ - const int16_t fadeOut, /* i : only fade out of previous state */ - STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t nchan_out /* i : number of output channels */ -); - -void generate_stereo_masking_noise_16fx( Word16 *syn, /* i/o: time-domain signal */ Word16 Q_syn, Decoder_State *st, /* i/o: decoder state structure */ @@ -9040,17 +9030,17 @@ void lpc_from_spectrum_flt( const int16_t stop, const float preemph_fac ); -ivas_error createFdCngDec_flt( +ivas_error createFdCngDec( HANDLE_FD_CNG_DEC *hFdCngDec ); -void deleteFdCngDec_flt( +void deleteFdCngDec( HANDLE_FD_CNG_DEC *hFdCngDec ); -void initFdCngDec_flt( +void initFdCngDec( DEC_CORE_HANDLE st /* i/o: decoder state structure */ ); -void configureFdCngDec_flt( +void configureFdCngDec( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const int16_t bwidth, const int32_t total_brate, @@ -9058,7 +9048,7 @@ void configureFdCngDec_flt( const int16_t last_L_frame, const int16_t element_mode ); -void ApplyFdCng_flt( +void ApplyFdCng( float *timeDomainInput, float *powerSpectrum, float **realBuffer, /* i/o: Real part of the buffer */ @@ -9067,7 +9057,7 @@ void ApplyFdCng_flt( const int16_t concealWholeFrame, /* i : binary flag indicating frame loss */ const int16_t is_music ); -void generate_comfort_noise_dec_flt( +void generate_comfort_noise_dec( float **bufferReal, /* o : Real part of input bands */ float **bufferImag, /* o : Imaginary part of input bands */ Decoder_State *st, /* i/o: decoder state structure */ @@ -9084,7 +9074,7 @@ float cng_energy( const int16_t len /* i : vector length */ ); -void FdCng_decodeSID_flt( +void FdCng_decodeSID( Decoder_State *st /* i/o: decoder state structure */ ); @@ -9109,7 +9099,7 @@ void FdCng_exc_flt( float *bwe_exc /* o : LP excitation for BWE */ ); -void noisy_speech_detection_flt( +void noisy_speech_detection( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure */ const int16_t vad, /* i : VAD flag */ const float syn[] /* i : input time-domain frame */ @@ -9867,7 +9857,7 @@ void fer_energy( const int16_t useOffset /* i : speech pointer offset (0 or L_FRAME) */ ); -float getLevelSynDeemph_flt( +float getLevelSynDeemph( const float h1Init[], /* i : input value or vector to be processed */ const float A[], /* i : LPC coefficients */ const int16_t lenLpcExc, /* i : length of the LPC excitation buffer */ @@ -9875,14 +9865,14 @@ float getLevelSynDeemph_flt( const int16_t numLoops /* i : number of loops */ ); -void genPlcFiltBWAdap_flt( +void genPlcFiltBWAdap( const int32_t sr_core, /* i : core sampling rate */ float *lpFiltAdapt, /* o : filter coefficients for filtering codebooks in case of flc */ const int16_t type, /* i : type of filter, either 0 : lowpass or 1 : highpass */ const float alpha /* i : fade out factor [0 1) used decrease filter tilt */ ); -void highPassFiltering_flt( +void highPassFiltering( const int16_t last_good, /* i : last classification type */ const int16_t L_buffer, /* i : buffer length */ float exc2[], /* i/o: unvoiced excitation before the high pass filtering */ @@ -9890,7 +9880,7 @@ void highPassFiltering_flt( const int16_t l_fir_fer /* i : high pass filter length */ ); -int16_t GetPLCModeDecision_flt( +int16_t GetPLCModeDecision( Decoder_State *st /* i/o: decoder memory state pointer */ ); diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 0b1b531aab747ddac3b6a07cab953571970b8704..a7e85e0211ced4c2e465606d8e871e10e50d20c1 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -771,7 +771,7 @@ void v_sort(Word16 *r, const Word16 lo, const Word16 up); void compute_poly_product_fx(Word16 *coef, Word32 *p, Word16 order); -void dec_prm_hm( +void dec_prm_hm_fx( Decoder_State *st, Word16 *prm_hm, const Word16 L_frame @@ -6351,7 +6351,7 @@ void init_tcx_cfg_fx( ); //er_sync_exc_fx.c - void PulseResynchronization( + void PulseResynchronization_fx( Word16 /*float*/ const * const src_exc, /*i Q15*/ Word16 /*float*/ * const dst_exc, /*o Q15*/ Word16 /*int*/ const nFrameLength, /*i Q0 */ @@ -7051,18 +7051,18 @@ void GSC_dec_init_ivas_fx( //fd_cng_dec_fx.c - ivas_error createFdCngDec(HANDLE_FD_CNG_DEC* hFdCngDec); + ivas_error createFdCngDec_fx(HANDLE_FD_CNG_DEC* hFdCngDec); - void initFdCngDec( + void initFdCngDec_fx( DEC_CORE_HANDLE st, /* i/o: decoder state structure */ Word16 scale ); /* Delete the instance of type FD_CNG */ - void deleteFdCngDec(HANDLE_FD_CNG_DEC* hFdCngDec); + void deleteFdCngDec_fx(HANDLE_FD_CNG_DEC* hFdCngDec); /* Configure CLDFB-CNG */ - void configureFdCngDec( + void configureFdCngDec_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the CLDFB-based CNG process */ Word16 bandwidth, Word32 bitrate, @@ -7072,7 +7072,7 @@ void GSC_dec_init_ivas_fx( ); /* Apply the CLDFB-based CNG */ - Word16 ApplyFdCng( + Word16 ApplyFdCng_fx( Word16* timeDomainInput, /* i : pointer to time domain i */ Word16 Q, #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT @@ -7086,7 +7086,7 @@ void GSC_dec_init_ivas_fx( Word16 is_music ); - Word16 ApplyFdCng_fx( + Word16 ApplyFdCng_ivas_fx( Word16 *timeDomainInput, /* i : pointer to time domain input */ Word16 Q, Word32 *powerSpectrum, @@ -7100,7 +7100,7 @@ void GSC_dec_init_ivas_fx( ); /* Perform noise estimation */ - void perform_noise_estimation_dec( + void perform_noise_estimation_dec_fx( const Word16* timeDomainInput, /* i: pointer to time domain i */ const Word16 Q, #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT @@ -7117,7 +7117,7 @@ void GSC_dec_init_ivas_fx( #endif ); - void perform_noise_estimation_dec_fx( + void perform_noise_estimation_dec_ivas_fx( const Word16 *timeDomainInput, /* i: pointer to time domain input */ const Word16 Q, Word32 *power_spectrum, @@ -7132,17 +7132,17 @@ void GSC_dec_init_ivas_fx( ); /* Decode the CLDFB-CNG bitstream */ - void FdCng_decodeSID(HANDLE_FD_CNG_COM st, /* i/o: FD_CNG structure containing all buffers and variables */ + void FdCng_decodeSID_fx(HANDLE_FD_CNG_COM st, /* i/o: FD_CNG structure containing all buffers and variables */ Decoder_State *corest); /* i/o: decoder state structure */ - void noisy_speech_detection( + void noisy_speech_detection_fx( HANDLE_FD_CNG_DEC hFdCngDec,/* i/o: FD_CNG structure */ const Word16 vad, /* i : VAD flag */ const Word16* syn, /* i : i time-domain frame */ const Word16 Q ); - void generate_comfort_noise_dec( + void generate_comfort_noise_dec_fx( Word32 **bufferReal, /* o : matrix to real part of i bands */ Word32 **bufferImag, /* o : matrix to imaginary part of i bands */ Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of i bands */ @@ -7153,7 +7153,7 @@ void GSC_dec_init_ivas_fx( ); void - generate_comfort_noise_dec_hf(Word32 **bufferReal, /* o : matrix to real part of i bands */ + generate_comfort_noise_dec_hf_fx(Word32 **bufferReal, /* o : matrix to real part of i bands */ Word32 **bufferImag, /* o : matrix to imaginary part of i bands */ Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of i bands */ Decoder_State *stdec @@ -7168,18 +7168,18 @@ void generate_comfort_noise_dec_hf_ivas_fx( ); /* Generate the comfort noise based on the target noise level */ - void generate_masking_noise(Word16 *timeDomainBuffer, /* i/o: time-domain signal */ + void generate_masking_noise_fx(Word16 *timeDomainBuffer, /* i/o: time-domain signal */ Word16 Q, HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing all buffers and variables */ , Word16 length , Word16 core ); - void generate_masking_noise_update_seed( + void generate_masking_noise_update_seed_fx( HANDLE_FD_CNG_COM st /* i/o : pointer to FD_CNG_COM structure */ ); - void generate_masking_noise_mdct(Word32 *mdctBuffer, /* i/o: time-domain signal */ + void generate_masking_noise_mdct_fx(Word32 *mdctBuffer, /* i/o: time-domain signal */ Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */ HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing all buffers and variables */ , Word16 L_frame @@ -8329,7 +8329,7 @@ Word16 ari_decode_14bits_pow_fx(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res Word16 ari_decode_14bits_sign_fx(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s); //dec_prm_fx.c -void getTCXparam( +void getTCXparam_fx( Decoder_State *st, /* i/o: Decoder State handle */ Decoder_State *st0, /* i : bitstream */ CONTEXT_HM_CONFIG hm_cfg, /* i/o: HM config */ @@ -8341,7 +8341,7 @@ void getTCXparam( Word16 nTnsBitsTCX10[2], const Word16 pre_past_flag ); -void dec_prm( +void dec_prm_fx( Word16 *coder_type, Word16 param[], /* (o) : decoded parameters */ Word16 param_lpc[], /* (o) : LPC parameters */ @@ -8351,7 +8351,7 @@ void dec_prm( Word16 *bitsRead ); -void getLPCparam( +void getLPCparam_fx( Decoder_State *st, /* i/o: decoder memory state */ Word16 param_lpc[], /* o : LTP parameters */ Decoder_State *st0, /* i : bitstream */ @@ -8582,13 +8582,13 @@ void init_igf_dec( ); //dlpc_avq_fx.c -Word16 dlpc_avq( +Word16 dlpc_avq_fx( Word16 *index, /* (i) Quantization indices */ Word16 *LSF_Q, /* (o) Quantized LSF vectors */ Word16 numlpc, /* (i) Number of sets of lpc */ Word32 sr_core ); -Word16 decode_lpc_avq( +Word16 decode_lpc_avq_fx( Decoder_State* st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ Word16* param_lpc /* o : lpc parameters */ @@ -8599,8 +8599,8 @@ Word16 decode_lpc_avq( #endif ); -//decode_lpc_avq declaration with IVAS_CODE_AVQ_LPC enabled -Word16 decode_lpc_avq_ivas( +//decode_lpc_avq_ivas_fx declaration with IVAS_CODE_AVQ_LPC enabled +Word16 decode_lpc_avq_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ Word16 *param_lpc /* o : lpc parameters */ @@ -8689,7 +8689,7 @@ void reconfig_decoder_LPD_ivas_fx( #endif // IVAS_FLOAT_FIXED //er_utils_fx.c -void minimumStatistics(Word16* noiseLevelMemory, /* Q15, internal state */ +void minimumStatistics_fx(Word16* noiseLevelMemory, /* Q15, internal state */ Word16* noiseLevelIndex, /* Q0, internal state */ Word16* currLevelIndex, /* Q0, internal state (circular buffer) */ Word16* noiseEstimate, /* Q15, previous estimate of background noise */ @@ -8702,7 +8702,7 @@ void minimumStatistics(Word16* noiseLevelMemory, /* Q15, internal sta Word16 currentFrameLevel_e); /* exponent of currentFrameLevel */ -Word16 getLevelSynDeemph( /*10Q5*/ +Word16 getLevelSynDeemph_fx( /*10Q5*/ Word16 h1Init[], /* i: i value or vector to be processed */ /* Q15 */ Word16 const A[], /* i: LPC coefficients */ /* Qx */ Word16 const lpcorder, /* i: LPC order */ /* Q0 */ @@ -8712,14 +8712,14 @@ Word16 getLevelSynDeemph( /*10Q5*/ Word16 *Exp /* o: exponent of return value Q15 */ ); -void genPlcFiltBWAdap( +void genPlcFiltBWAdap_fx( Word32 const sr_core, /* 0 ) && ( cond2 != 0 ) && ( cond3 > 0 ) && extrapolationFailed == 0 ) { mvr2r( exc, exc - L_frame - L_SUBFR, L_frame + L_SUBFR ); - PulseResynchronization_flt( exc - L_frame - L_SUBFR, exc, L_frame, L_frame / L_SUBFR, Tc, new_pit ); + PulseResynchronization( exc - L_frame - L_SUBFR, exc, L_frame, L_frame / L_SUBFR, Tc, new_pit ); } } diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 7b4b7fe98a6b6bcd108fb1edbf2f72abc617008a..2dc26d6a30760233ec403c10a3c3056aeca9591c 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -10,7 +10,7 @@ #include "prot_fx1.h" /* Function prototypes */ #include "prot_fx2.h" /* Function prototypes */ #include "basop_util.h" - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ @@ -440,7 +440,7 @@ void FEC_exc_estim_fx( ) { Copy(exc,exc-L_frame-L_SUBFR,L_frame+L_SUBFR); - PulseResynchronization(exc-L_frame-L_SUBFR, exc, L_frame, nb_subfr, L_deposit_h(Tc/*Q0*/)/*15Q16*/, L_deposit_h(new_pit/*Q0*/)/*15Q16*/); + PulseResynchronization_fx(exc-L_frame-L_SUBFR, exc, L_frame, nb_subfr, L_deposit_h(Tc/*Q0*/)/*15Q16*/, L_deposit_h(new_pit/*Q0*/)/*15Q16*/); } } test(); @@ -870,3 +870,4 @@ void gain_dec_bfi_fx( return; } +#endif diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 53cd72a3602104a30ef5368d1f587ef807465def..9146adea3fe60b48676a0ed39f801c05ce59c89e 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -149,7 +149,7 @@ ivas_error acelp_core_dec( /* Only run parameter decoding in SID frames */ if ( st->core_brate == SID_2k40 ) { - FdCng_decodeSID_flt( st ); + FdCng_decodeSID( st ); } for ( i = 0; i < NPART; i++ ) @@ -157,7 +157,7 @@ ivas_error acelp_core_dec( st->hFdCngDec->hFdCngCom->sidNoiseEstLp_flt[i] = STEREO_DFT_FD_FILT * st->hFdCngDec->hFdCngCom->sidNoiseEstLp_flt[i] + ( 1 - STEREO_DFT_FD_FILT ) * st->hFdCngDec->hFdCngCom->sidNoiseEst_flt[i]; } - ApplyFdCng_flt( NULL, NULL, NULL, NULL, st, 0, 0 ); + ApplyFdCng( NULL, NULL, NULL, NULL, st, 0, 0 ); } else { @@ -515,7 +515,7 @@ ivas_error acelp_core_dec( { if ( st->core_brate == SID_2k40 && st->element_mode != IVAS_CPE_MDCT ) { - FdCng_decodeSID_flt( st ); + FdCng_decodeSID( st ); *sid_bw = 0; } @@ -527,7 +527,7 @@ ivas_error acelp_core_dec( { st->hFdCngDec->hFdCngCom->sidNoiseEstLp_flt[i] = STEREO_DFT_FD_FILT * st->hFdCngDec->hFdCngCom->sidNoiseEstLp_flt[i] + ( 1 - STEREO_DFT_FD_FILT ) * st->hFdCngDec->hFdCngCom->sidNoiseEst_flt[i]; } - ApplyFdCng_flt( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); + ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); } if ( !read_sid_info ) @@ -541,7 +541,7 @@ ivas_error acelp_core_dec( } } - generate_comfort_noise_dec_flt( NULL, NULL, st, nchan_out ); + generate_comfort_noise_dec( NULL, NULL, st, nchan_out ); FdCng_exc_flt( st->hFdCngDec->hFdCngCom, &st->CNG_mode, st->L_frame, st->lsp_old, st->first_CNG, st->lspCNG, Aq, lsp_new, lsf_new, exc, exc2, bwe_exc ); @@ -1117,7 +1117,7 @@ ivas_error acelp_core_dec( if ( st->idchan == 0 && ( st->flag_cna || ( st->cng_type == FD_CNG && st->total_brate <= ACELP_32k ) || ( st->cng_type == LP_CNG && st->core_brate <= SID_2k40 ) ) ) { /*Noisy speech detector*/ - noisy_speech_detection_flt( st->hFdCngDec, st->VAD, syn ); + noisy_speech_detection( st->hFdCngDec, st->VAD, syn ); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt = 0.99f * st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt + 0.01f * (float) st->hFdCngDec->hFdCngCom->flag_noisy_speech; } @@ -1131,7 +1131,7 @@ ivas_error acelp_core_dec( { /*Noise estimate*/ - ApplyFdCng_flt( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); + ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); } if ( !st->cna_dirac_flag ) @@ -1165,7 +1165,7 @@ ivas_error acelp_core_dec( { set_f( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, 0.0f, st->hFdCngDec->hFdCngCom->fftlen ); } - generate_masking_noise_flt( syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); + generate_masking_noise( syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); } } } @@ -1196,7 +1196,7 @@ ivas_error acelp_core_dec( /*Noise estimate*/ if ( st->idchan == 0 && ( nchan_out == 2 || ( st->core_brate != FRAME_NO_DATA && st->core_brate != SID_2k40 ) ) ) { - ApplyFdCng_flt( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); + ApplyFdCng( syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); } } } @@ -1301,7 +1301,7 @@ ivas_error acelp_core_dec( /*WB/SWB-FD_CNG*/ if ( ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && ( st->cng_type == FD_CNG ) && ( st->hFdCngDec->hFdCngCom->numCoreBands < st->cldfbSyn->no_channels ) ) { - generate_comfort_noise_dec_hf_flt( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom, st->cng_ism_flag ); + generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom, st->cng_ism_flag ); if ( st->hFdCngDec->hFdCngCom->regularStopBand < st->cldfbSyn->no_channels ) { diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 2033bc20bcb9be640bce4f7bb0a9b527c6da5ccf..360f9bd7e9e567b312a91eabeef39e32cad93adb 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -157,12 +157,12 @@ ivas_error acelp_core_dec_fx( { if (st->cng_type == FD_CNG) { - configureFdCngDec(st->hFdCngDec, st->bwidth, ACELP_14k25, st->L_frame, st->last_L_frame, st->element_mode); + configureFdCngDec_fx(st->hFdCngDec, st->bwidth, ACELP_14k25, st->L_frame, st->last_L_frame, st->element_mode); /* Only run parameter decoding in SID frames */ if (st->core_brate == SID_2k40) { - FdCng_decodeSID(st); + FdCng_decodeSID_fx(st); } for (i = 0; i < NPART; i++) @@ -171,14 +171,14 @@ ivas_error acelp_core_dec_fx( } #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - ApplyFdCng(NULL, NULL, NULL, NULL, st, 0, 0); + ApplyFdCng_fx(NULL, NULL, NULL, NULL, st, 0, 0); #else - ApplyFdCng(NULL, NULL, NULL, NULL, st, 0, 0); + ApplyFdCng_fx(NULL, NULL, NULL, NULL, st, 0, 0); #endif } else { - configureFdCngDec(st->hFdCngDec, st->bwidth, ACELP_14k25, st->L_frame, st->last_L_frame, st->element_mode); + configureFdCngDec_fx(st->hFdCngDec, st->bwidth, ACELP_14k25, st->L_frame, st->last_L_frame, st->element_mode); /* decode CNG parameters */ CNG_dec(st, last_element_mode, Aq, lsp_new, lsf_new, &allow_cn_step, sid_bw, q_env); @@ -623,7 +623,7 @@ ivas_error acelp_core_dec_fx( { IF( EQ_32(st_fx->core_brate,SID_2k40) && NE_16(st_fx->element_mode, IVAS_CPE_MDCT) ) { - FdCng_decodeSID(st_fx->hFdCngDec->hFdCngCom, st_fx); + FdCng_decodeSID_fx(st_fx->hFdCngDec->hFdCngCom, st_fx); *sid_bw=0; move16(); } @@ -637,9 +637,9 @@ ivas_error acelp_core_dec_fx( st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] = STEREO_DFT_FD_FILT * st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] + (1 - STEREO_DFT_FD_FILT) * st->hFdCngDec->hFdCngCom->sidNoiseEst[i]; } #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - ApplyFdCng(syn, 0, NULL, realBuffer, imagBuffer, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); + ApplyFdCng_fx(syn, 0, NULL, realBuffer, imagBuffer, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); #else - ApplyFdCng(syn, realBuffer, imagBuffer, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); + ApplyFdCng_fx(syn, realBuffer, imagBuffer, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); #endif } if (!read_sid_info) @@ -653,7 +653,7 @@ ivas_error acelp_core_dec_fx( } } #endif - generate_comfort_noise_dec( NULL, NULL, NULL, st_fx, &(st_fx->Q_exc), 2, -1 ); + generate_comfort_noise_dec_fx( NULL, NULL, NULL, st_fx, &(st_fx->Q_exc), 2, -1 ); FdCng_exc(st_fx->hFdCngDec->hFdCngCom, &st_fx->CNG_mode, st_fx->L_frame, st_fx->lsp_old_fx, st_fx->first_CNG, st_fx->lspCNG_fx, Aq_fx, lsp_new_fx, lsf_new_fx, exc_fx, exc2_fx, bwe_exc_fx); @@ -1414,7 +1414,7 @@ ivas_error acelp_core_dec_fx( (EQ_16(st_fx->cng_type, LP_CNG) && LE_32(st_fx->total_brate, SID_2k40)))) { /*Noisy speech detector*/ - noisy_speech_detection(st_fx->hFdCngDec, st_fx->VAD, syn_fx, st_fx->Q_syn); + noisy_speech_detection_fx(st_fx->hFdCngDec, st_fx->VAD, syn_fx, st_fx->Q_syn); st_fx->hFdCngDec->hFdCngCom->likelihood_noisy_speech = mult_r(st_fx->hFdCngDec->hFdCngCom->likelihood_noisy_speech, 32440/*0.99 Q15*/); IF(st_fx->hFdCngDec->hFdCngCom->flag_noisy_speech != 0) @@ -1435,9 +1435,9 @@ ivas_error acelp_core_dec_fx( { #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT PMT("Code for IVAS_CODE_CNG_FIX185_PLC_FADEOUT not done") - ApplyFdCng(syn, st_fx->Q_syn, NULL, realBuffer, imagBuffer, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); + ApplyFdCng_fx(syn, st_fx->Q_syn, NULL, realBuffer, imagBuffer, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); #else - ApplyFdCng(syn_fx, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st_fx, 0, (EQ_16(st_fx->coder_type, AUDIO) && st_fx->GSC_noisy_speech == 0)); + ApplyFdCng_fx(syn_fx, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st_fx, 0, (EQ_16(st_fx->coder_type, AUDIO) && st_fx->GSC_noisy_speech == 0)); #endif } /* CNA: Generate additional comfort noise to mask potential coding artefacts */ @@ -1477,7 +1477,7 @@ ivas_error acelp_core_dec_fx( { set_f(st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0.0f, st->hFdCngDec->hFdCngCom->fftlen); } - generate_masking_noise(syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out); + generate_masking_noise_fx(syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out); } } } @@ -1509,9 +1509,9 @@ ivas_error acelp_core_dec_fx( if (st->idchan == 0 && (nchan_out == 2 || (st->core_brate != FRAME_NO_DATA && st->core_brate != SID_2k40))) { #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - ApplyFdCng(syn, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); + ApplyFdCng_fx(syn, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); #else - ApplyFdCng(syn, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); + ApplyFdCng_fx(syn, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); #endif } } @@ -1541,7 +1541,7 @@ ivas_error acelp_core_dec_fx( #else IF(st_fx->flag_cna && NE_16(st_fx->coder_type, AUDIO)) { - generate_masking_noise(syn_fx, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, st_fx->hFdCngDec->hFdCngCom->frameSize, 0); + generate_masking_noise_fx(syn_fx, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, st_fx->hFdCngDec->hFdCngCom->frameSize, 0); } ELSE IF(st_fx->flag_cna && st_fx->coder_type == AUDIO && st_fx->last_core == ACELP_CORE && st_fx->last_coder_type != AUDIO) { @@ -1666,7 +1666,7 @@ ivas_error acelp_core_dec_fx( { IF((EQ_32(st_fx->core_brate, FRAME_NO_DATA) || EQ_32(st_fx->core_brate, SID_2k40)) && (EQ_16(st_fx->cng_type, FD_CNG)) && (LT_16(st_fx->hFdCngDec->hFdCngCom->numCoreBands, st_fx->cldfbSyn->no_channels))) { - generate_comfort_noise_dec_hf(realBuffer, imagBuffer, &scaleFactor.hb_scale, st_fx); + generate_comfort_noise_dec_hf_fx(realBuffer, imagBuffer, &scaleFactor.hb_scale, st_fx); st_fx->cldfbSyn->bandsToZero = 0; move16(); diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 4bae09992d44650e1191485c5352000b179e5cc8..13a5425e2835451c0b808abb09c1136552925ebf 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -149,7 +149,7 @@ ivas_error acelp_core_dec_ivas_fx( { if ( st->cng_type == FD_CNG ) { - configureFdCngDec( st->hFdCngDec, st->bwidth, ACELP_14k25, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, ACELP_14k25, st->L_frame, st->last_L_frame, st->element_mode ); Word16 old_NoiseEstExp = st->hFdCngDec->hFdCngCom->sidNoiseEstExp; /* Only run parameter decoding in SID frames */ if ( st->core_brate == SID_2k40 ) @@ -163,7 +163,7 @@ ivas_error acelp_core_dec_ivas_fx( Mpy_32_32( STEREO_DFT_FD_FILT_COMP_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEst[i] ) ); } - ApplyFdCng_fx( NULL, 0, NULL, 0, NULL, NULL, NULL, st, 0, 0 ); + ApplyFdCng_ivas_fx( NULL, 0, NULL, 0, NULL, NULL, NULL, st, 0, 0 ); if (st->hFdCngDec->hFdCngCom->cngNoiseLevelExp < 0) { Scale_sig32(st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp); @@ -172,7 +172,7 @@ ivas_error acelp_core_dec_ivas_fx( } else { - configureFdCngDec( st->hFdCngDec, st->bwidth, ACELP_14k25, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, ACELP_14k25, st->L_frame, st->last_L_frame, st->element_mode ); /* decode CNG parameters */ CNG_dec_fx( st, last_element_mode, Aq_fx, lsp_new_fx, lsf_new_fx, &allow_cn_step, sid_bw, q_env_fx); @@ -584,7 +584,7 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32(st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp - new_cngNoiseLevelExp); st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = new_cngNoiseLevelExp; - ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); + ApplyFdCng_ivas_fx(psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); if (st->hFdCngDec->hFdCngCom->cngNoiseLevelExp < 0) { Scale_sig32(st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp); @@ -603,7 +603,7 @@ ivas_error acelp_core_dec_ivas_fx( } } - generate_comfort_noise_dec(NULL, NULL, NULL, st, &(st->Q_exc), 1, nchan_out); + generate_comfort_noise_dec_fx(NULL, NULL, NULL, st, &(st->Q_exc), 1, nchan_out); FdCng_exc(st->hFdCngDec->hFdCngCom, &st->CNG_mode, st->L_frame, st->lsp_old_fx, st->first_CNG, st->lspCNG_fx, Aq_fx, lsp_new_fx, lsf_new_fx, exc_fx, exc2_fx, bwe_exc_fx); @@ -1300,7 +1300,7 @@ ivas_error acelp_core_dec_ivas_fx( if (st->idchan == 0 && (st->flag_cna || (st->cng_type == FD_CNG && st->total_brate <= ACELP_32k) || (st->cng_type == LP_CNG && st->core_brate <= SID_2k40))) { /*Noisy speech detector*/ - noisy_speech_detection(st->hFdCngDec, st->VAD, psyn_fx, st->Q_syn); + noisy_speech_detection_fx(st->hFdCngDec, st->VAD, psyn_fx, st->Q_syn); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = mult_r(st->hFdCngDec->hFdCngCom->likelihood_noisy_speech, 32440/*0.99 Q15*/); IF(st->hFdCngDec->hFdCngCom->flag_noisy_speech != 0) @@ -1328,7 +1328,7 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32(st->hFdCngDec->hFdCngCom->sidNoiseEstLp, NPART, st->hFdCngDec->hFdCngCom->sidNoiseEstExp - Q27); st->hFdCngDec->hFdCngCom->sidNoiseEstExp = 31 - Q4; // Q4 /*==========================================================*/ - ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); + ApplyFdCng_ivas_fx(psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); /*==========================================================*/ if (st->hFdCngDec->partNoiseShape_exp < 0) { Scale_sig32(st->hFdCngDec->partNoiseShape, NPART, st->hFdCngDec->partNoiseShape_exp); @@ -1350,7 +1350,7 @@ ivas_error acelp_core_dec_ivas_fx( { if (hStereoCng->flag_cna_fade) { - generate_stereo_masking_noise_16fx(psyn_fx, st->Q_syn, st, hStereoTD, flag_sec_CNA, 1, hStereoCng, nchan_out); + generate_stereo_masking_noise_fx(psyn_fx, st->Q_syn, st, hStereoTD, flag_sec_CNA, 1, hStereoCng, nchan_out); hStereoCng->flag_cna_fade = 0; } else @@ -1361,7 +1361,7 @@ ivas_error acelp_core_dec_ivas_fx( set_s(hStereoCng->olapBufferSynth22_fx, 0, st->hFdCngDec->hFdCngCom->frameSize / 2); } - generate_stereo_masking_noise_16fx(psyn_fx, st->Q_syn, st, hStereoTD, flag_sec_CNA, 0, hStereoCng, nchan_out); + generate_stereo_masking_noise_fx(psyn_fx, st->Q_syn, st, hStereoTD, flag_sec_CNA, 0, hStereoCng, nchan_out); } } else if (st->element_mode != IVAS_CPE_DFT) @@ -1372,7 +1372,7 @@ ivas_error acelp_core_dec_ivas_fx( { set_s(st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, st->hFdCngDec->hFdCngCom->fftlen); } - generate_masking_noise(psyn_fx, st->Q_syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0/*, 0, 0, st->element_mode, hStereoCng, nchan_out*/); + generate_masking_noise_fx(psyn_fx, st->Q_syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0/*, 0, 0, st->element_mode, hStereoCng, nchan_out*/); } } } @@ -1380,7 +1380,7 @@ ivas_error acelp_core_dec_ivas_fx( { if (st->element_mode == IVAS_CPE_TD && nchan_out == 2) { - generate_stereo_masking_noise_16fx(psyn_fx, st->Q_syn, st, hStereoTD, flag_sec_CNA, 1, hStereoCng, nchan_out); + generate_stereo_masking_noise_fx(psyn_fx, st->Q_syn, st, hStereoTD, flag_sec_CNA, 1, hStereoCng, nchan_out); hStereoCng->flag_cna_fade = 1; } else @@ -1406,7 +1406,7 @@ ivas_error acelp_core_dec_ivas_fx( /*Noise estimate*/ if (st->idchan == 0 && (nchan_out == 2 || (st->core_brate != FRAME_NO_DATA && st->core_brate != SID_2k40))) { - ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); + ApplyFdCng_ivas_fx(psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); if (st->hFdCngDec->partNoiseShape_exp < 0) { Scale_sig32(st->hFdCngDec->partNoiseShape, NPART, -st->hFdCngDec->partNoiseShape_exp); st->hFdCngDec->partNoiseShape_exp = 0; diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index 8a4bcdc6216955bf1d88ba6f5c6cb631c87b2c1b..8e3be60975f6eebe1c5ea8b8c018a539feac8178 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -204,7 +204,7 @@ ivas_error acelp_core_switch_dec( if ( st->flag_cna ) { - generate_masking_noise_flt( synth_intFreq, st->hFdCngDec->hFdCngCom, 2 * L_SUBFR, 0, 0, 0, st->element_mode, NULL, nchan_out ); + generate_masking_noise( synth_intFreq, st->hFdCngDec->hFdCngCom, 2 * L_SUBFR, 0, 0, 0, st->element_mode, NULL, nchan_out ); } /*----------------------------------------------------------------* diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index cf28c1ed57ca9de169a0074807c4b8163074e180..c6a5d3123f3e8f614a19806521decb18fc2e95b8 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -183,7 +183,7 @@ ivas_error acelp_core_switch_dec_fx( IF ( st_fx->flag_cna != 0 ) { - generate_masking_noise( synth_intFreq, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, 2*L_SUBFR, 0); + generate_masking_noise_fx( synth_intFreq, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, 2*L_SUBFR, 0); } /*----------------------------------------------------------------* diff --git a/lib_dec/amr_wb_dec.c b/lib_dec/amr_wb_dec.c index 457b7bb720ec36dc711d7bc900421a394d270eba..90bbfede8c2e70ccf97c850a4de8b0a206e4dbba 100644 --- a/lib_dec/amr_wb_dec.c +++ b/lib_dec/amr_wb_dec.c @@ -624,12 +624,12 @@ ivas_error amr_wb_dec( /*VAD only for non inactive frame*/ st->VAD = ( st->VAD && ( st->coder_type != INACTIVE ) ); - ApplyFdCng_flt( syn, NULL, NULL, NULL, st, 0, 0 ); + ApplyFdCng( syn, NULL, NULL, NULL, st, 0, 0 ); st->hFdCngDec->hFdCngCom->frame_type_previous = st->m_frame_type; /*Noisy speech detector*/ - noisy_speech_detection_flt( st->hFdCngDec, st->VAD, syn ); + noisy_speech_detection( st->hFdCngDec, st->VAD, syn ); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt = 0.99f * st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt + 0.01f * (float) st->hFdCngDec->hFdCngCom->flag_noisy_speech; @@ -638,16 +638,16 @@ ivas_error amr_wb_dec( if ( st->flag_cna && ( st->psf_lp_noise >= 15.f ) ) { flag_cna = 1; - generate_masking_noise_flt( syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, AMR_WB_CORE, 0, 0, st->element_mode, NULL, -1 ); + generate_masking_noise( syn, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, AMR_WB_CORE, 0, 0, st->element_mode, NULL, -1 ); } else if ( st->flag_cna ) { - generate_masking_noise_update_seed_flt( st->hFdCngDec->hFdCngCom ); + generate_masking_noise_update_seed( st->hFdCngDec->hFdCngCom ); } } else if ( st->flag_cna ) { - generate_masking_noise_update_seed_flt( st->hFdCngDec->hFdCngCom ); + generate_masking_noise_update_seed( st->hFdCngDec->hFdCngCom ); } if ( flag_cna == 0 ) diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index 69ed9d99060ea3d3170675ce4363df226aa0932d..30159c660db1e4d63bce4b1a364e6047ae6b422a 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -782,14 +782,14 @@ ivas_error amr_wb_dec_fx( } #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT PMT("Fixed point not done here ") - ApplyFdCng(syn, NULL, NULL, NULL, st, 0, 0); + ApplyFdCng_fx(syn, NULL, NULL, NULL, st, 0, 0); #else - ApplyFdCng( syn_fx, st_fx->Q_syn, NULL, NULL, NULL, st_fx, 0, 0 ); + ApplyFdCng_fx( syn_fx, st_fx->Q_syn, NULL, NULL, NULL, st_fx, 0, 0 ); #endif st_fx->hFdCngDec->hFdCngCom->frame_type_previous = st_fx->m_frame_type; /*Noisy speech detector*/ - noisy_speech_detection(st_fx->hFdCngDec, st_fx->VAD, syn_fx, st_fx->Q_syn); + noisy_speech_detection_fx(st_fx->hFdCngDec, st_fx->VAD, syn_fx, st_fx->Q_syn); st_fx->hFdCngDec->hFdCngCom->likelihood_noisy_speech = mult_r(st_fx->hFdCngDec->hFdCngCom->likelihood_noisy_speech, 32440/*0.99 Q15*/); IF ( st_fx->hFdCngDec->hFdCngCom->flag_noisy_speech != 0 ) @@ -805,18 +805,18 @@ ivas_error amr_wb_dec_fx( { flag_cna = 1; move16(); - generate_masking_noise( syn_fx, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, st_fx->hFdCngDec->hFdCngCom->frameSize, AMR_WB_CORE ); + generate_masking_noise_fx( syn_fx, st_fx->Q_syn, st_fx->hFdCngDec->hFdCngCom, st_fx->hFdCngDec->hFdCngCom->frameSize, AMR_WB_CORE ); } ELSE IF ( st_fx->flag_cna ) { - generate_masking_noise_update_seed( st_fx->hFdCngDec->hFdCngCom ); + generate_masking_noise_update_seed_fx( st_fx->hFdCngDec->hFdCngCom ); } /*Copy(syn+L_FRAME-M-1, st_fx->syn, M+1);*/ } ELSE IF ( st_fx->flag_cna ) { - generate_masking_noise_update_seed( st_fx->hFdCngDec->hFdCngCom ); + generate_masking_noise_update_seed_fx( st_fx->hFdCngDec->hFdCngCom ); } diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 1f15288bf7cf186653d32f324490b792e1d6fc95..c2a318b2eb8f3dce63bc8d0da43b4b81fcdd3bf5 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -652,11 +652,11 @@ ivas_error core_switching_pre_dec_ivas_fx( /* || st->last_core == AMR_WB_CORE || st->last_codec_mode == MODE2)){*/ IF( NE_16(st->core , AMR_WB_CORE) ) { - configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); } ELSE { - configureFdCngDec_fx( st->hFdCngDec, WB, ACELP_8k00, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec_ivas_fx( st->hFdCngDec, WB, ACELP_8k00, st->L_frame, st->last_L_frame, st->element_mode ); IF( st->VAD ) { @@ -1142,13 +1142,13 @@ ivas_error core_switching_pre_dec( /* || st->last_core == AMR_WB_CORE || st->last_codec_mode == MODE2)){*/ if ( st->core != AMR_WB_CORE ) { - configureFdCngDec_flt( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); configureFdCngDec( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); } else { - configureFdCngDec_flt( st->hFdCngDec, WB, ACELP_8k00, st->L_frame, st->last_L_frame, st->element_mode ); configureFdCngDec( st->hFdCngDec, WB, ACELP_8k00, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec_fx( st->hFdCngDec, WB, ACELP_8k00, st->L_frame, st->last_L_frame, st->element_mode ); if ( st->VAD ) { diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 8b905e5099622b9e4580d4179dcc4b8af1794e0d..4b2713f4162ed08090b9dc6ca47849cc83bc0cd7 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1044,11 +1044,11 @@ ivas_error core_switching_pre_dec_fx( tmp = ACELP_9k60; move32(); } - configureFdCngDec(st_fx->hFdCngDec, st_fx->bwidth, tmp, st_fx->L_frame, st_fx->last_L_frame, st_fx->element_mode ); + configureFdCngDec_fx(st_fx->hFdCngDec, st_fx->bwidth, tmp, st_fx->L_frame, st_fx->last_L_frame, st_fx->element_mode ); } ELSE { - configureFdCngDec(st_fx->hFdCngDec, 1, ACELP_8k00, st_fx->L_frame, st_fx->last_L_frame, st_fx->element_mode); + configureFdCngDec_fx(st_fx->hFdCngDec, 1, ACELP_8k00, st_fx->L_frame, st_fx->last_L_frame, st_fx->element_mode); if( st_fx->VAD ) { diff --git a/lib_dec/d_gain2p.c b/lib_dec/d_gain2p.c index 49c164b6e6450ca32d376a0c5074c57425a27451..8d675a4d9d05639d1530c379b20f51310862b0af 100644 --- a/lib_dec/d_gain2p.c +++ b/lib_dec/d_gain2p.c @@ -135,12 +135,12 @@ static void Mode2_gain_dec_mless_flt( /*---------------------------------------------------------------------* - * gain_dec_uv_flt + * gain_dec_uv * * Decoding of pitch and codebook gains for Unvoiced mode *---------------------------------------------------------------------*/ -static void gain_dec_uv_flt( +static void gain_dec_uv( const int16_t index, /* i/o: Quantization index vector */ const float *code, /* i : algebraic code excitation */ const int16_t lcode, /* i : Subframe size */ @@ -181,12 +181,12 @@ static void gain_dec_uv_flt( /*---------------------------------------------------------------------* - * gain_dec_gacelp_uv_flt + * gain_dec_gacelp_uv * * Decoding of pitch and codebook gains for Unvoiced mode *---------------------------------------------------------------------*/ -void gain_dec_gacelp_uv_flt( +void gain_dec_gacelp_uv( int16_t index, /* i/o: Quantization index vector */ const float *code, /* i : algebraic code excitation */ const float *code2, /* i : algebraic code excitation */ @@ -240,12 +240,12 @@ void gain_dec_gacelp_uv_flt( /*---------------------------------------------------------------------* - * decode_acelp_gains_flt + * decode_acelp_gains * * *---------------------------------------------------------------------*/ -void decode_acelp_gains_flt( +void decode_acelp_gains( const float *code, const int16_t gains_mode, const float mean_ener_code, @@ -272,12 +272,12 @@ void decode_acelp_gains_flt( else if ( gains_mode == 6 ) { /* UV gains quantizer (6bits/subfr) */ - gain_dec_uv_flt( index, code, L_subfr, gain_pit, gain_code, past_gpit, past_gcode, gain_inov ); + gain_dec_uv( index, code, L_subfr, gain_pit, gain_code, past_gpit, past_gcode, gain_inov ); } else if ( gains_mode == 7 ) { /* GACELP_UV gains quantizer (7=5-2bits/subfr) */ - gain_dec_gacelp_uv_flt( index, code, code2, mean_ener_code, L_subfr, gain_pit, gain_code, gain_code2, past_gpit, past_gcode, gain_inov ); + gain_dec_gacelp_uv( index, code, code2, mean_ener_code, L_subfr, gain_pit, gain_code, gain_code2, past_gpit, past_gcode, gain_inov ); } else { diff --git a/lib_dec/d_gain2p_fx.c b/lib_dec/d_gain2p_fx.c index 48e2df97f7fba23471eeeded83464e6247bde190..335f964d16fdeea81abc837d79c082db121ff7ed 100644 --- a/lib_dec/d_gain2p_fx.c +++ b/lib_dec/d_gain2p_fx.c @@ -9,7 +9,7 @@ #include "basop_util.h" #include "stl.h" #include "rom_com.h" - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Decoding of pitch and codebook gains (see q_gain2_plus.c) * *-------------------------------------------------------------------*/ @@ -17,7 +17,7 @@ /********************* * private functions * *********************/ -static Word32 calc_gcode0( +static Word32 calc_gcode0_fx( Word16 *gcode0, Word16 *exp_gcode0 ) @@ -37,7 +37,7 @@ static Word32 calc_gcode0( return L_tmp; } -static Word32 calc_gain_code(Word16 g_code, Word16 gcode0, Word16 exp_gcode0) +static Word32 calc_gain_code_fx(Word16 g_code, Word16 gcode0, Word16 exp_gcode0) { Word32 L_tmp; @@ -53,12 +53,12 @@ static Word32 calc_gain_code(Word16 g_code, Word16 gcode0, Word16 exp_gcode0) } /*--------------------------------------------------------------------------* -* Mode2_gain_dec_mless +* Mode2_gain_dec_mless_fx * * Decoding of pitch and codebook gains without updating long term energies *-------------------------------------------------------------------------*/ -static void Mode2_gain_dec_mless( +static void Mode2_gain_dec_mless_fx( Word16 index, /* i : Quantization index vector Q0 */ Word16 *code, /* i : algebraic code excitation Q9 */ Word16 lcode, /* i : Subframe size Q0 */ @@ -124,14 +124,14 @@ static void Mode2_gain_dec_mless( /*gcode0 = (float)pow(10.0,(gcode0)*0.05);*/ /* predicted gain */ - calc_gcode0(&gcode0, &exp_gcode0); + calc_gcode0_fx(&gcode0, &exp_gcode0); /*-----------------------------------------------------------------* * decode normalized codebook gain *-----------------------------------------------------------------*/ /* *gain_code = t_qua_gain[index*2+1] * gcode0;*/ - L_tmp = calc_gain_code(t_qua_gain[index*2+1], gcode0, exp_gcode0); + L_tmp = calc_gain_code_fx(t_qua_gain[index*2+1], gcode0, exp_gcode0); *gain_code = L_tmp; *past_gpit = *gain_pit; @@ -146,12 +146,12 @@ static void Mode2_gain_dec_mless( } /*---------------------------------------------------------------------* - * gain_dec_uv + * gain_dec_uv_fx * * Decoding of pitch and codebook gains for Unvoiced mode *---------------------------------------------------------------------*/ -static void gain_dec_uv( +static void gain_dec_uv_fx( Word16 index, /* i : Quantization index vector Q0 */ Word16 *code, /* i : algebraic code excitation Q9 */ Word16 lcode, /* i : Subframe size Q0 */ @@ -211,12 +211,12 @@ static void gain_dec_uv( } /*---------------------------------------------------------------------* - * gain_dec_gacelp_uv + * gain_dec_gacelp_uv_fx * * Decoding of pitch and codebook gains for Unvoiced mode *---------------------------------------------------------------------*/ -static void gain_dec_gacelp_uv( +static void gain_dec_gacelp_uv_fx( Word16 index, /* i : Quantization index vector Q0 */ Word16 *code, /* i : algebraic code excitation Q9 */ Word16 *code2, /* i : algebraic code excitation Q9 */ @@ -333,7 +333,7 @@ static void gain_dec_gacelp_uv( * public functions * *********************/ -void decode_acelp_gains( +void decode_acelp_gains_fx( Word16 *code, /* i : algebraic code excitation Q9 */ Word16 gains_mode, Word16 mean_ener_code, /* i : mean_ener defined in open-loop Q8 */ @@ -357,7 +357,7 @@ void decode_acelp_gains( IF ( s_and(gains_mode > 0,(Word16) LT_16(gains_mode, 4))) { /* ACELP gains quantizer (5bits/subfr) */ - Mode2_gain_dec_mless(index, code, L_subfr, gain_pit, gain_code, mean_ener_code, past_gpit, past_gcode, gain_inov, gains_mode-1 ); + Mode2_gain_dec_mless_fx(index, code, L_subfr, gain_pit, gain_code, mean_ener_code, past_gpit, past_gcode, gain_inov, gains_mode-1 ); } ELSE IF (s_or((Word16)EQ_16(gains_mode,4),(Word16)EQ_16(gains_mode,5))) { @@ -367,12 +367,12 @@ void decode_acelp_gains( ELSE IF ( EQ_16(gains_mode,6)) { /* UV gains quantizer (6bits/subfr) */ - gain_dec_uv( index, code, L_subfr, gain_pit, gain_code, past_gpit, past_gcode, gain_inov ); + gain_dec_uv_fx( index, code, L_subfr, gain_pit, gain_code, past_gpit, past_gcode, gain_inov ); } ELSE IF (EQ_16(gains_mode,7)) { /* GACELP_UV gains quantizer (7=5-2bits/subfr) */ - gain_dec_gacelp_uv( index, code, code2, mean_ener_code, L_subfr, gain_pit, gain_code, gain_code2, past_gpit, past_gcode, gain_inov ); + gain_dec_gacelp_uv_fx( index, code, code2, mean_ener_code, L_subfr, gain_pit, gain_code, gain_code2, past_gpit, past_gcode, gain_inov ); } ELSE { @@ -383,12 +383,12 @@ void decode_acelp_gains( /*---------------------------------------------------------------------* - * d_gain_pred : + * d_gain_pred_fx : * * decode the predicted value for the scaled * innovation energy in all subframes *---------------------------------------------------------------------*/ -void d_gain_pred( +void d_gain_pred_fx( Word16 nrg_mode, /* i : NRG moe */ Word16 *Es_pred, /* o : predicted scaled innovation energy Q8 */ Word16 **pt_indice /* i/o: pointer to the buffer of indices */ @@ -422,3 +422,4 @@ void d_gain_pred( return; } +#endif diff --git a/lib_dec/dec_LPD.c b/lib_dec/dec_LPD.c index df050e043b4c76bf4af2429f08b7d8e7b5fd250a..a58fb94a926124eb1701c1236c09aa102e0d71e5 100644 --- a/lib_dec/dec_LPD.c +++ b/lib_dec/dec_LPD.c @@ -164,7 +164,7 @@ void decoder_LPD( st->flagGuidedAcelp = 0; st->nbLostCmpt++; st->core_brate = st->last_core_brate; - st->core = GetPLCModeDecision_flt( st ); + st->core = GetPLCModeDecision( st ); } } else @@ -180,7 +180,7 @@ void decoder_LPD( } /* PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed */ - st->core = GetPLCModeDecision_flt( st ); + st->core = GetPLCModeDecision( st ); } /* PLC: [Common: Memory update] @@ -293,11 +293,11 @@ void decoder_LPD( /* Unquantize LPC */ if ( st->core == TCX_20_CORE ) { - lpc_unquantize_flt( st, lsf, lsp, param_lpc, lspmid, lsfmid, AUDIO, &LSF_Q_prediction ); + lpc_unquantize( st, lsf, lsp, param_lpc, lspmid, lsfmid, AUDIO, &LSF_Q_prediction ); } else { - lpc_unquantize_flt( st, lsf, lsp, param_lpc, lspmid, lsfmid, st->coder_type, &LSF_Q_prediction ); + lpc_unquantize( st, lsf, lsp, param_lpc, lspmid, lsfmid, st->coder_type, &LSF_Q_prediction ); if ( st->prev_use_partial_copy && st->last_core == ACELP_CORE && st->core == ACELP_CORE && st->prev_rf_frame_type >= RF_GENPRED && st->coder_type == UNVOICED ) { @@ -476,7 +476,7 @@ void decoder_LPD( if ( bfi && st->last_core != ACELP_CORE ) { /* PLC: [TCX: TD PLC] */ - con_tcx_flt( st, &synthFB[0], -1.f, NULL, 0, NULL ); + con_tcx( st, &synthFB[0], -1.f, NULL, 0, NULL ); lerp_flt( synthFB, synth, st->L_frame, st->hTcxDec->L_frameTCX ); st->con_tcx = 1; set_f( &st->mem_pitch_gain_float[2], st->lp_gainp, st->nb_subfr ); @@ -500,7 +500,7 @@ void decoder_LPD( { /* PLC: [ACELP: general] * PLC: Use the ACELP like concealment */ - con_acelp_flt( Aq, st->core_ext_mode, &synth[0], pitch, pit_gain, st->stab_fac, st, pitch_buf, voice_factors, ptr_bwe_exc ); + con_acelp( Aq, st->core_ext_mode, &synth[0], pitch, pit_gain, st->stab_fac, st, pitch_buf, voice_factors, ptr_bwe_exc ); mvr2r( &st->mem_pitch_gain_float[2], &st->mem_pitch_gain_float[st->nb_subfr + 2], st->nb_subfr ); set_zero( &st->mem_pitch_gain_float[2], st->nb_subfr ); } @@ -589,7 +589,7 @@ void decoder_LPD( } /* TCX decoder */ - decoder_tcx_flt( st, prm, Aq, Aind, &synth[0], &synthFB[0], bfi, 0, 0 ); + decoder_tcx( st, prm, Aq, Aind, &synth[0], &synthFB[0], bfi, 0, 0 ); } /*--------------------------------------------------------------------------------* @@ -615,7 +615,7 @@ void decoder_LPD( IGFDecRestoreTCX10SubFrameData_flt( st->hIGFDec, k ); /* TCX decoder */ - decoder_tcx_flt( st, prm, Aq, Aind, &synth[k * L_frame / 2], &synthFB[k * L_frameTCX / 2], bfi, k, 0 ); + decoder_tcx( st, prm, Aq, Aind, &synth[k * L_frame / 2], &synthFB[k * L_frameTCX / 2], bfi, k, 0 ); } } @@ -644,7 +644,7 @@ void decoder_LPD( TonalMDCTConceal_SaveTimeSignal_ivas( st->hTonalMDCTConc, synthFB, L_frameTCX ); } - decoder_tcx_post_flt( st, synth, synthFB, Aq, bfi, 0 ); + decoder_tcx_post( st, synth, synthFB, Aq, bfi, 0 ); if ( st->core == TCX_20_CORE ) { diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index dd66fb8160eb1cd9ac1e4c357a12713df6731da6..a79ab4358580b5dbc79fbbfa92c1e4de6675a94d 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -151,7 +151,7 @@ void decoder_LPD_fx( move16(); tcx_current_overlap_mode = st->hTcxCfg->tcx_curr_overlap_mode; move16(); - dec_prm(&st->coder_type, param, param_lpc, total_nbbits, st, L_frame, bitsRead); + dec_prm_fx(&st->coder_type, param, param_lpc, total_nbbits, st, L_frame, bitsRead); IF(!st->rate_switching_init && EQ_16((st->last_codec_mode), MODE2)&&st->BER_detect) { st->coder_type = st->last_coder_type; @@ -172,7 +172,7 @@ void decoder_LPD_fx( move16(); st->core_brate = st->last_core_brate; move16(); - st->core = GetPLCModeDecision( st ); + st->core = GetPLCModeDecision_fx( st ); } } @@ -183,7 +183,7 @@ void decoder_LPD_fx( test(); IF( st->use_partial_copy && GE_16(st->rf_frame_type, RF_TCXFD)&&LE_16(st->rf_frame_type,RF_TCXTD2)) { - dec_prm( &st->coder_type, param, param_lpc, total_nbbits, st, L_frame, bitsRead ); + dec_prm_fx( &st->coder_type, param, param_lpc, total_nbbits, st, L_frame, bitsRead ); } if (GT_16(st->nbLostCmpt, 1)) @@ -197,7 +197,7 @@ void decoder_LPD_fx( * PLC: Decide which Concealment to use. Update pitch lags if needed */ IF ( bfi!=0 ) { - st->core = GetPLCModeDecision(st); + st->core = GetPLCModeDecision_fx(st); } IF ( bfi == 0 ) @@ -329,11 +329,11 @@ void decoder_LPD_fx( } IF (EQ_16(st->core, TCX_20_CORE)) { - lpc_unquantize( st, lsf, lsp, M, param_lpc, lspmid, lsfmid, AUDIO, &LSF_Q_prediction); + lpc_unquantize_fx( st, lsf, lsp, M, param_lpc, lspmid, lsfmid, AUDIO, &LSF_Q_prediction); } ELSE { - lpc_unquantize( st, lsf, lsp, M, param_lpc, lspmid, lsfmid, st->coder_type, &LSF_Q_prediction); + lpc_unquantize_fx( st, lsf, lsp, M, param_lpc, lspmid, lsfmid, st->coder_type, &LSF_Q_prediction); IF(EQ_16(st->prev_use_partial_copy,1)&&EQ_16(st->last_core,ACELP_CORE)&&EQ_16(st->core,ACELP_CORE) && GE_16(st->prev_rf_frame_type, RF_GENPRED) && EQ_16(st->coder_type, UNVOICED)) @@ -553,9 +553,9 @@ void decoder_LPD_fx( { /* PLC: [TCX: TD PLC] */ #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - con_tcx(st, &synthFB[0], -1.f, NULL, 0, NULL); + con_tcx_fx(st, &synthFB[0], -1.f, NULL, 0, NULL); #else - con_tcx( st, &synthFB[0] ); + con_tcx_fx( st, &synthFB[0] ); #endif lerp( synthFB, synth, st->L_frame, hTcxDec->L_frameTCX ); st->con_tcx = 1; @@ -580,7 +580,7 @@ void decoder_LPD_fx( { /* PLC: [ACELP: general] * PLC: Use the ACELP like concealment */ - con_acelp(Aq,st->core_ext_mode,&synth[0],pitch,pit_gain,st->stab_fac_fx,st, + con_acelp_fx(Aq,st->core_ext_mode,&synth[0],pitch,pit_gain,st->stab_fac_fx,st, &st->Q_exc, &st->Q_syn, /*Q format of st->mem_syn*/ pitch_buf, voice_factors, ptr_bwe_exc); Copy(&st->mem_pitch_gain[2], &st->mem_pitch_gain[st->nb_subfr+2], st->nb_subfr); @@ -689,7 +689,7 @@ void decoder_LPD_fx( E_LPC_f_lsp_a_conversion(lspind, Aind, M); } /* TCX decoder */ - decoder_tcx(st->hTcxCfg,prm,Aq,Aind,L_frame,L_frameTCX,st->hTcxCfg->tcx_coded_lines,&synth[0],&synthFB[0],st, st->coder_type, bfi,0,st->stab_fac_fx); + decoder_tcx_fx(st->hTcxCfg,prm,Aq,Aind,L_frame,L_frameTCX,st->hTcxCfg->tcx_coded_lines,&synth[0],&synthFB[0],st, st->coder_type, bfi,0,st->stab_fac_fx); } @@ -716,7 +716,7 @@ void decoder_LPD_fx( /* TCX decoder */ IGFDecRestoreTCX10SubFrameData( st->hIGFDec, k ); - decoder_tcx(st->hTcxCfg,prm,Aq,Aind,shr(L_frame, 1),shr(L_frameTCX, 1), + decoder_tcx_fx(st->hTcxCfg,prm,Aq,Aind,shr(L_frame, 1),shr(L_frameTCX, 1), shr(st->hTcxCfg->tcx_coded_lines, 1),&synth[k*L_frame/2],&synthFB[k*L_frameTCX/2],st, st->coder_type, bfi, k, st->stab_fac_fx ); } @@ -758,9 +758,9 @@ void decoder_LPD_fx( TonalMDCTConceal_SaveTimeSignal( &st->tonalMDCTconceal, synthFB, L_frameTCX ); } #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - decoder_tcx_post(st, synth, synthFB, Aq, bfi, 0); + decoder_tcx_post_fx(st, synth, synthFB, Aq, bfi, 0); #else - decoder_tcx_post( st, synth, synthFB, Aq, bfi ); + decoder_tcx_post_fx( st, synth, synthFB, Aq, bfi ); #endif IF (EQ_16(st->core, TCX_20_CORE)) { diff --git a/lib_dec/dec_ace.c b/lib_dec/dec_ace.c index 9a8c91853b2fd7bd7044cafada04b88f6e9a5968..4cdbb8b1208e891823e6f23bf6c3b9535553a60e 100644 --- a/lib_dec/dec_ace.c +++ b/lib_dec/dec_ace.c @@ -350,7 +350,7 @@ void decoder_acelp( if ( st->acelp_cfg.gains_mode[i_subfr / L_SUBFR] != 0 ) { - decode_acelp_gains_flt( code, acelp_cfg.gains_mode[i_subfr / L_SUBFR], Es_pred, &gain_pit, &gain_code, &prm, &( st->past_gpit_float), &( st->past_gcode_float), &gain_inov, L_SUBFR, code2, &gain_code2 ); + decode_acelp_gains( code, acelp_cfg.gains_mode[i_subfr / L_SUBFR], Es_pred, &gain_pit, &gain_code, &prm, &( st->past_gpit_float), &( st->past_gcode_float), &gain_inov, L_SUBFR, code2, &gain_code2 ); } if ( st->use_partial_copy && st->rf_frame_type == RF_ALLPRED ) diff --git a/lib_dec/dec_ace_fx.c b/lib_dec/dec_ace_fx.c index 6d79c5cd6e6cc0a4332fe7f8c1a49d126b280109..f0bdb1eb7afa09efed79b3afd39c51675abd3ae6 100644 --- a/lib_dec/dec_ace_fx.c +++ b/lib_dec/dec_ace_fx.c @@ -225,7 +225,7 @@ void decoder_acelp_fx( move16(); IF ( acelp_cfg.nrg_mode>0 ) { - d_gain_pred(acelp_cfg.nrg_mode, &Es_pred, &prm ); + d_gain_pred_fx(acelp_cfg.nrg_mode, &Es_pred, &prm ); } /*------------------------------------------------------------------------* @@ -382,7 +382,7 @@ void decoder_acelp_fx( *-------------------------------------------------*/ IF( st->acelp_cfg.gains_mode[i_subfr/L_SUBFR] != 0 ) { - decode_acelp_gains( code, acelp_cfg.gains_mode[i_subfr/L_SUBFR], Es_pred, &gain_pit, &gain_code, &prm, &(st->past_gpit), + decode_acelp_gains_fx( code, acelp_cfg.gains_mode[i_subfr/L_SUBFR], Es_pred, &gain_pit, &gain_code, &prm, &(st->past_gpit), &(st->past_gcode), &gain_inov, L_SUBFR, code2, &gain_code2 ); } IF(st->use_partial_copy&& st->rf_frame_type == RF_ALLPRED) diff --git a/lib_dec/dec_acelp_tcx_main.c b/lib_dec/dec_acelp_tcx_main.c index 9c3d8074bf3c3c5ae9f84042cc5f0147c84e0362..ab9447b9a6300ad2773156f41e3e28cc4a252256 100644 --- a/lib_dec/dec_acelp_tcx_main.c +++ b/lib_dec/dec_acelp_tcx_main.c @@ -217,7 +217,7 @@ static void decode_frame_type_flt( } /*Reconf Frequency-domain based CNG*/ - configureFdCngDec_flt( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); if ( st->last_L_frame != st->L_frame && st->L_frame <= L_FRAME16k && st->last_L_frame <= L_FRAME16k ) { lerp_flt( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->L_frame * 2, st->last_L_frame * 2 ); @@ -476,7 +476,7 @@ void dec_acelp_tcx_frame( if ( st->m_frame_type == SID_FRAME ) { /* Decode the FD-CNG bitstream */ - FdCng_decodeSID_flt( st ); + FdCng_decodeSID( st ); } /* updates */ diff --git a/lib_dec/dec_acelp_tcx_main_fx.c b/lib_dec/dec_acelp_tcx_main_fx.c index 9e6ec189816792f37f2daf2920facdbf9940fef7..c4a0df61913528058d8bc1e402d36f35d460fac5 100644 --- a/lib_dec/dec_acelp_tcx_main_fx.c +++ b/lib_dec/dec_acelp_tcx_main_fx.c @@ -238,7 +238,7 @@ void decode_frame_type_fx(Decoder_State *st L_tmp = ACELP_9k60; move32(); } - configureFdCngDec( st->hFdCngDec, st->bwidth, L_tmp, st->L_frame, st->last_L_frame, st->element_mode); + configureFdCngDec_fx( st->hFdCngDec, st->bwidth, L_tmp, st->L_frame, st->last_L_frame, st->element_mode); test(); test(); IF ( (NE_16(st->last_L_frame,st->L_frame))&&(LE_16(st->L_frame, L_FRAME16k))&&(LE_16(st->last_L_frame, L_FRAME16k))) @@ -516,7 +516,7 @@ Word16 dec_acelp_tcx_frame_fx( IF ( EQ_16(st->m_frame_type,SID_FRAME)) { - FdCng_decodeSID(st->hFdCngDec->hFdCngCom, st); + FdCng_decodeSID_fx(st->hFdCngDec->hFdCngCom, st); } /* updates */ diff --git a/lib_dec/dec_ppp_fx.c b/lib_dec/dec_ppp_fx.c index 575c53508d40ab52d22160b8ee713d1bea753547..88ef2dc670ae1e23613e0b36f8f7a268ed29b98d 100644 --- a/lib_dec/dec_ppp_fx.c +++ b/lib_dec/dec_ppp_fx.c @@ -7,7 +7,7 @@ #include "options.h" /* Compilation switches */ #include "prot_fx1.h" /* Function prototypes */ #include "prot_fx2.h" /* Function prototypes */ - +#ifdef IVAS_FLOAT_FIXED /*===================================================================*/ /* FUNCTION : void decod_ppp_fx () */ /*-------------------------------------------------------------------*/ @@ -113,3 +113,4 @@ ivas_error decod_ppp_fx( set16_fx(gain_buf,0,NB_SUBFR16k); return error; } +#endif diff --git a/lib_dec/dec_prm.c b/lib_dec/dec_prm.c index 19d3856a1e5de7af0f1aed25d337bd8002b5f88e..cf84280904bccbd895b98b5ed4a9c858db903fcd 100644 --- a/lib_dec/dec_prm.c +++ b/lib_dec/dec_prm.c @@ -360,7 +360,7 @@ void getLPCparam_ivas( { if ( st->lpcQuantization == 0 ) { - decode_lpc_avq_flt( st0, st->numlpc, param_lpc, ch, st->element_mode, sns_low_br_mode ); + decode_lpc_avq( st0, st->numlpc, param_lpc, ch, st->element_mode, sns_low_br_mode ); } else if ( st->lpcQuantization == 1 ) { @@ -700,11 +700,7 @@ void getTCXparam_ivas( { ConfigureContextHm_ivas( lgFB, nbits_tcx, PeriodicityIndex, hTcxDec->tcx_hm_LtpPitchLag, &hm_cfg ); } -#ifdef IVAS_FLOAT_FIXED - hTcxDec->resQBits[k] = RCcontextMapping_decode2_no_mem_s17_LCS_fx( st0, prm + j, lgFB, nbits_tcx, NPRM_RESQ * st->hTcxCfg->resq, flag_ctx_hm ? &hm_cfg : NULL ); -#else hTcxDec->resQBits[k] = RCcontextMapping_decode2_no_mem_s17_LCS( st0, prm + j, lgFB, nbits_tcx, NPRM_RESQ * st->hTcxCfg->resq, flag_ctx_hm ? &hm_cfg : NULL ); -#endif } else { diff --git a/lib_dec/dec_prm_fx.c b/lib_dec/dec_prm_fx.c index 75fbef2927725147a558ac33547c8fff68fd5cd0..f1195d5c6b8379ba92310884fb4e4a0afb5050fe 100644 --- a/lib_dec/dec_prm_fx.c +++ b/lib_dec/dec_prm_fx.c @@ -13,14 +13,14 @@ #include "prot_fx1.h" #include "prot_fx2.h" #include "basop_util.h" - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * getLPCparam_ivas() * * get LPC parameters *--------------------------------------------------------------------*/ -void getLPCparam( +void getLPCparam_fx( Decoder_State *st, /* i/o: decoder memory state */ Word16 param_lpc[], /* o : LTP parameters */ Decoder_State *st0, /* i : bitstream */ @@ -51,7 +51,7 @@ void getLPCparam( { IF( EQ_16( st->lpcQuantization, 0 ) ) { - decode_lpc_avq_ivas( st0, st->numlpc, param_lpc, ch, st->element_mode, sns_low_br_mode ); + decode_lpc_avq_ivas_fx( st0, st->numlpc, param_lpc, ch, st->element_mode, sns_low_br_mode ); } ELSE IF( EQ_16( st->lpcQuantization, 1 ) ) { @@ -93,7 +93,7 @@ void getLPCparam( return; } -void dec_prm_hm( +void dec_prm_hm_fx( Decoder_State *st, Word16 *prm_hm, const Word16 L_frame @@ -142,12 +142,12 @@ void dec_prm_hm( } /*-------------------------------------------------------------------* - * getTCXparam() + * getTCXparam_fx() * * get TCX core parameters *-------------------------------------------------------------------*/ -void getTCXparam( +void getTCXparam_fx( Decoder_State *st, /* i/o: Decoder State handle */ Decoder_State *st0, /* i : bitstream */ CONTEXT_HM_CONFIG hm_cfg, /* i/o: HM config */ @@ -351,7 +351,7 @@ void getTCXparam( IF( hTcxDec->tcx_lpc_shaped_ari && NE_16( st->last_core_from_bs, ACELP_CORE ) ) { - dec_prm_hm( st0, &prm[j], hm_size ); + dec_prm_hm_fx( st0, &prm[j], hm_size ); } nbits_tcx = sub( st->bits_frame_core, sub( st0->next_bit_pos, start_bit_pos ) ); @@ -451,14 +451,14 @@ void getTCXparam( return; } /*-----------------------------------------------------------------* - * Funtion dec_prm() * + * Funtion dec_prm_fx() * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * * SQ is used for TCX modes * * decode parameters according to selected mode * *-----------------------------------------------------------------*/ -void dec_prm( +void dec_prm_fx( Word16 *coder_type, Word16 param[], /* (o) : decoded parameters */ Word16 param_lpc[], /* (o) : LPC parameters */ @@ -606,7 +606,7 @@ void dec_prm( IF (get_next_indice_1(st) != 0) /* TCX */ { tmp = get_next_indice(st, 3); - assert(!(tmp & 4) || !"HQ_CORE encountered in dec_prm"); + assert(!(tmp & 4) || !"HQ_CORE encountered in dec_prm_fx"); st->core = TCX_20_CORE; move16(); st->hTcxCfg->coder_type = tmp; @@ -876,7 +876,7 @@ void dec_prm( { IF (st->lpcQuantization==0) { - decode_lpc_avq( st, st->numlpc, param_lpc + decode_lpc_avq_fx( st, st->numlpc, param_lpc #ifdef IVAS_CODE_AVQ_LPC , , , #endif @@ -1210,7 +1210,7 @@ void dec_prm( test(); IF (hTcxDec->tcx_lpc_shaped_ari != 0 && NE_16(st->last_core_from_bs, ACELP_CORE)) { - dec_prm_hm(st, &prm[j], hm_size); + dec_prm_hm_fx(st, &prm[j], hm_size); } nbits_tcx = sub(st->bits_frame_core, sub(st->next_bit_pos, start_bit_pos)); @@ -1574,4 +1574,4 @@ void dec_prm( return; } - +#endif diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 71776c40016ce250393bdd60474f49b07203bb04..92c25ad45a089718e6e62bb90e16004875aa5ed5 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -53,12 +53,12 @@ #ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* - * decoder_tcx_flt() + * decoder_tcx() * * *-----------------------------------------------------------------*/ -void decoder_tcx_flt( +void decoder_tcx( Decoder_State *st, /* i/o: coder memory state */ int16_t prm[], /* i : parameters */ float A[], /* i : coefficients NxAz[M+1] */ @@ -114,12 +114,12 @@ void decoder_tcx_flt( #endif /*-------------------------------------------------------------------* - * decoder_tcx_post_flt() + * decoder_tcx_post() * * *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED -void decoder_tcx_post_flt( +void decoder_tcx_post( Decoder_State *st, /* i/o: decoder memory state */ float *synth, /* i/o: synthesis */ float *synthFB, /* i/o: FB synthesis */ @@ -179,7 +179,7 @@ void decoder_tcx_post_flt( * PLC: update or retrieve the background level */ if ( bfi == 0 && st->tcxonly && ( st->element_mode != IVAS_CPE_MDCT || MCT_flag ) && st->clas_dec == UNVOICED_CLAS ) { - minimumStatistics_flt( hTcxDec->NoiseLevelMemory_bfi, &hTcxDec->NoiseLevelIndex_bfi, &hTcxDec->CurrLevelIndex_bfi, &hTcxDec->CngLevelBackgroundTrace_bfi, &hTcxDec->LastFrameLevel_bfi, level_syn, PLC_MIN_CNG_LEV_FLT, PLC_MIN_STAT_BUFF_SIZE ); + minimumStatistics( hTcxDec->NoiseLevelMemory_bfi, &hTcxDec->NoiseLevelIndex_bfi, &hTcxDec->CurrLevelIndex_bfi, &hTcxDec->CngLevelBackgroundTrace_bfi, &hTcxDec->LastFrameLevel_bfi, level_syn, PLC_MIN_CNG_LEV_FLT, PLC_MIN_STAT_BUFF_SIZE ); } /* PLC: [TCX: Fade-out] @@ -260,9 +260,7 @@ void decoder_tcx_post_flt( st->old_pitch_buf[1] = st->old_pitch_buf[st->nb_subfr + 1]; mvr2r( &st->old_pitch_buf[st->nb_subfr + 2], &st->old_pitch_buf[2], st->nb_subfr ); set_f( &st->old_pitch_buf[st->nb_subfr + 2], st->old_fpitch_float, st->nb_subfr ); -#ifndef IVAS_FLOAT_FIXED st->bfi_pitch = st->old_fpitch_float; -#endif // #ifndef IVAS_FLOAT_FIXED st->bfi_pitch_frame = st->L_frame; st->mem_pitch_gain_float[2 * st->nb_subfr + 1] = st->mem_pitch_gain_float[st->nb_subfr + 1]; @@ -279,11 +277,11 @@ void decoder_tcx_post_flt( /*-------------------------------------------------------------------* - * IMDCT_flt() + * IMDCT() * * *-------------------------------------------------------------------*/ -void IMDCT_flt( +void IMDCT( float *x, float *old_syn_overl, float *syn_Overl_TDAC, @@ -357,48 +355,12 @@ void IMDCT_flt( { if ( kernel_type == MDST_IV || ( kernel_type & w ) ) { -#ifdef IVAS_FLOAT_FIXED - Word32 x_fx[L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX]; - Word16 win_fx[810] = { 0 }; - Word16 q_x = Q15, q_win, x_e_hdrm; - x_e_hdrm = sub(q_x, 15); - q_win = q_x + x_e_hdrm - 16; - for ( int k = 0; k < L_ola + L_win; k++ ) - { - x_fx[w * L_spec_TCX5 + k] = (Word32) ( x[w * L_spec_TCX5 + k] * ( 1u << q_x ) ); - } - - TCX_MDST_Inverse_fx( x_fx + w * L_spec_TCX5, x_e_hdrm, win_fx, L_ola, L_win - L_ola, L_ola); - - for ( int k = 0; k < L_ola + L_win; k++ ) - { - win[k] = (float) win_fx[k] / ( 1u << (q_win) ); - } -#else TCX_MDST_Inverse_flt( x + w * L_spec_TCX5, win, L_ola, L_win - L_ola, L_ola, st->element_mode ); -#endif // IVAS_FLOAT_FIXED } else if ( kernel_type != 0 && w == 0 ) /* type 1 or 2 */ { -#ifdef IVAS_FLOAT_FIXED - Word32 x_fx[L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX]; - Word16 win_fx[810] = { 0 }; - Word16 q_x = Q13, q_win, x_e_hdrm; - x_e_hdrm = sub( q_x, 10 ); - q_win = q_x + x_e_hdrm - 16; - for ( int k = 0; k < L_ola + L_win; k++ ) - { - x_fx[w * L_spec_TCX5 + k] = (Word32) ( x[w * L_spec_TCX5 + k] * ( 1u << q_x ) ); - } - TCX_MDXT_Inverse_fx( x_fx + w * L_spec_TCX5, x_e_hdrm, win_fx, L_ola, L_win - L_ola, L_ola, kernel_type ); - for ( int k = 0; k < L_ola + L_win; k++ ) - { - win[k] = (float) win_fx[k] / ( 1u << ( q_win ) ); - } -#else TCX_MDXT_Inverse_flt( x + w * L_spec_TCX5, win, L_ola, L_win - L_ola, L_ola, kernel_type ); -#endif // IVAS_FLOAT_FIXED } else { @@ -598,26 +560,6 @@ void IMDCT_flt( mvr2r( xn_buf + overlap / 2 + 2 * acelp_mem_len, &buf[0], analysis_len ); /* get LPC from that signal part to use for acelp zir smoothing */ -#ifdef IVAS_FLOAT_FIXED - Word16 buf_fx[L_FRAME_MAX / 4]; - Word16 window_buf_fx[L_FRAME_MAX / 4]; - Word32 r_fx[M + 1]; - Word16 q_r, q_old_Aq_12_8, q_buf; - f2me_buf_16(buf, buf_fx, &q_buf, analysis_len); - q_buf = sub(15, q_buf); - q_old_Aq_12_8 = 28; - Word32 old_Aq_12_8_fx[17]; - FOR(Word16 ind = 0; ind < 17; ind++) { - old_Aq_12_8_fx[ind] = float_to_fix(st->old_Aq_12_8[ind], q_old_Aq_12_8); - } - ham_cos_window_ivas( &window_buf_fx[0], analysis_len / 2, analysis_len / 2 ); - autocorr_fx_32( &buf_fx[0], M, &r_fx[0], &q_r, analysis_len, &window_buf_fx[0], 0, 0 ); - lag_wind_32( r_fx, M, L_frame_glob * FRAMES_PER_SEC, LAGW_STRONG ); - lev_dur_fx( &old_Aq_12_8_fx[0], &r_fx[0], M, NULL, q_old_Aq_12_8, q_buf * 2 + q_r + 1 ); - FOR(Word16 ind = 0; ind < 17; ind++) { - st->old_Aq_12_8[ind] = fix_to_float(old_Aq_12_8_fx[ind], q_old_Aq_12_8); - } -#else float window_buf[L_FRAME_MAX / 4]; float r[M + 1]; @@ -625,7 +567,6 @@ void IMDCT_flt( autocorr( &buf[0], &r[0], M, analysis_len, &window_buf[0], 0, 0, 0 ); lag_wind_flt( r, M, L_frame_glob * FRAMES_PER_SEC, LAGW_STRONG ); lev_dur( &st->old_Aq_12_8[0], &r[0], M, NULL ); -#endif } /* Window current frame */ @@ -882,19 +823,7 @@ void decoder_tcx_invQ( prm_target = prm_sqQ; prm_sqQ = prm_target + 1; -#ifdef IVAS_FLOAT_FIXED - Word32 x_fx[N_MAX]; - Word16 x_e; - //st->hTcxCfg->preemph_fac = FL2WORD16(st->hTcxCfg->preemph_fac_flt); - //st->inv_gamma = FL2WORD16_SCALE(1 / st->gamma_float, 1); - tcx_arith_decode_envelope_ivas_fx( st, x_fx, &x_e, L_frame, L_spec, Aind, *prm_target, prm_sqQ, st->last_core_from_bs != ACELP_CORE, prm_hm, /* HM parameter area */ hTcxDec->tcx_hm_LtpPitchLag, &arith_bits, &signaling_bits, ( st->bwidth > WB ) ? 1 : 0 ); - for (int k = 0; k < N_MAX; ++k) - { - x[k] = ((float)x_fx[k] / ((unsigned)1 << (31 - x_e))); - } -#else tcx_arith_decode_envelope( st, x, L_frame, L_spec, Aind, *prm_target, prm_sqQ, st->last_core_from_bs != ACELP_CORE, prm_hm, /* HM parameter area */ hTcxDec->tcx_hm_LtpPitchLag, &arith_bits, &signaling_bits, ( st->bwidth > WB ) ? 1 : 0 ); -#endif hTcxDec->resQBits[frame_cnt] = *prm_target - arith_bits; @@ -1900,7 +1829,7 @@ void decoder_tcx_imdct( if ( st->element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag ) { - IMDCT_flt( xn_bufFB, hTcxDec->syn_Overl_float, hTcxDec->syn_Overl_TDAC_float, xn_buf, hTcxCfg->tcx_aldo_window_1_trunc_flt, hTcxCfg->tcx_aldo_window_2_flt, + IMDCT( xn_bufFB, hTcxDec->syn_Overl_float, hTcxDec->syn_Overl_TDAC_float, xn_buf, hTcxCfg->tcx_aldo_window_1_trunc_flt, hTcxCfg->tcx_aldo_window_2_flt, hTcxCfg->tcx_mdct_window_half_flt, hTcxCfg->tcx_mdct_window_minimum_flt, hTcxCfg->tcx_mdct_window_trans_flt, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_outLB, 0, st, 0, acelp_zir ); } @@ -1908,7 +1837,7 @@ void decoder_tcx_imdct( /* Generate additional comfort noise to mask potential coding artefacts */ if ( st->flag_cna && st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && !st->cna_dirac_flag ) { - generate_masking_noise_mdct_flt( x, st->hFdCngDec->hFdCngCom ); + generate_masking_noise_mdct( x, st->hFdCngDec->hFdCngCom ); } if ( st->element_mode == IVAS_CPE_DFT || sba_dirac_stereo_flag ) @@ -1916,19 +1845,19 @@ void decoder_tcx_imdct( mvr2r( x, xn_bufFB, max( L_spec, max( L_frame, L_frameTCX ) ) ); - IMDCT_flt( xn_bufFB, hTcxDec->syn_Overl_float, hTcxDec->syn_Overl_TDAC_float, xn_buf, hTcxCfg->tcx_aldo_window_1_trunc_flt, hTcxCfg->tcx_aldo_window_2_flt, hTcxCfg->tcx_mdct_window_half_flt, hTcxCfg->tcx_mdct_window_minimum_flt, hTcxCfg->tcx_mdct_window_trans_flt, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, + IMDCT( xn_bufFB, hTcxDec->syn_Overl_float, hTcxDec->syn_Overl_TDAC_float, xn_buf, hTcxCfg->tcx_aldo_window_1_trunc_flt, hTcxCfg->tcx_aldo_window_2_flt, hTcxCfg->tcx_mdct_window_half_flt, hTcxCfg->tcx_mdct_window_minimum_flt, hTcxCfg->tcx_mdct_window_trans_flt, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_outLB, 0, st, 0, acelp_zir ); } if ( st->element_mode != EVS_MONO ) { - IMDCT_flt( x_tmp, hTcxDec->syn_OverlFB_float, hTcxDec->syn_Overl_TDACFB_float, xn_bufFB, hTcxCfg->tcx_aldo_window_1_FB_trunc_flt, hTcxCfg->tcx_aldo_window_2_FB_flt, + IMDCT( x_tmp, hTcxDec->syn_OverlFB_float, hTcxDec->syn_Overl_TDACFB_float, xn_bufFB, hTcxCfg->tcx_aldo_window_1_FB_trunc_flt, hTcxCfg->tcx_aldo_window_2_FB_flt, hTcxCfg->tcx_mdct_window_halfFB_flt, hTcxCfg->tcx_mdct_window_minimumFB_flt, hTcxCfg->tcx_mdct_window_transFB_flt, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); } else { - IMDCT_flt( x, hTcxDec->syn_OverlFB_float, hTcxDec->syn_Overl_TDACFB_float, xn_bufFB, hTcxCfg->tcx_aldo_window_1_FB_trunc_flt, hTcxCfg->tcx_aldo_window_2_FB_flt, hTcxCfg->tcx_mdct_window_halfFB_flt, hTcxCfg->tcx_mdct_window_minimumFB_flt, hTcxCfg->tcx_mdct_window_transFB_flt, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, + IMDCT( x, hTcxDec->syn_OverlFB_float, hTcxDec->syn_Overl_TDACFB_float, xn_bufFB, hTcxCfg->tcx_aldo_window_1_FB_trunc_flt, hTcxCfg->tcx_aldo_window_2_FB_flt, hTcxCfg->tcx_mdct_window_halfFB_flt, hTcxCfg->tcx_mdct_window_minimumFB_flt, hTcxCfg->tcx_mdct_window_transFB_flt, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); } @@ -2148,7 +2077,7 @@ void decoder_tcx_imdct_fx( /* Generate additional comfort noise to mask potential coding artefacts */ IF ( NE_16(st->flag_cna, 0) && NE_16(st->element_mode, IVAS_CPE_TD) && NE_16(st->element_mode, IVAS_CPE_DFT) && EQ_16(st->cna_dirac_flag, 0) ) { - generate_masking_noise_mdct( x_fx, &x_e, st->hFdCngDec->hFdCngCom, L_frame ); + generate_masking_noise_mdct_fx( x_fx, &x_e, st->hFdCngDec->hFdCngCom, L_frame ); FOR(Word16 ind = 0; ind < L_frame; ind++) { x_fx[ind] = L_shr(x_fx[ind], sub(31, add(x_e, q_x))); } diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index fb963993b18a38dd03f41a1d8b64c3b7a62643c7..45e907d8d8058284151e6c6778cc3119e0721b8f 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -16,17 +16,17 @@ #include "ivas_prot_fx.h" #include "ivas_rom_com.h" #include "ivas_rom_com_fx.h" - +#ifdef IVAS_FLOAT_FIXED extern const Word16 T_DIV_L_Frame[];/*0Q15 * 2^-7 */ -static Word32 CalculateAbsEnergy( /* o : normalized result Q31 */ +static Word32 CalculateAbsEnergy_fx( /* o : normalized result Q31 */ const Word32 L_off, /* i : initial sum value Qn */ const Word16 x[], /* i : x vector Qn */ const Word16 lg, /* i : vector length, range [0..7FFF] Q0 */ Word16 * exp /* o : exponent of result in [-32,31] Q0 */ ); -void decoder_tcx( +void decoder_tcx_fx( TCX_CONFIG_HANDLE hTcxCfg, Word16 prm[], /* input: parameters */ Word16 A[], /* input: coefficients NxAz[M+1] */ @@ -500,7 +500,7 @@ void decoder_tcx( } ELSE { - hTcxDec->damping = Damping_fact(coder_type, st->nbLostCmpt, st->last_good, stab_fac, &(st->Mode2_lp_gainp), st->last_core); + hTcxDec->damping = Damping_fact_fx(coder_type, st->nbLostCmpt, st->last_good, stab_fac, &(st->Mode2_lp_gainp), st->last_core); gain_tcx = hTcxDec->old_gaintcx_bfi; move16(); gain_tcx_e = hTcxDec->old_gaintcx_bfi_e; @@ -872,8 +872,8 @@ void decoder_tcx( Word16 exp1, exp2; Word32 E_2ndlast, E_last; - E_2ndlast = CalculateAbsEnergy(1, &(st->tonalMDCTconceal.lastBlockData.spectralData[0]), infoIGFStartLine, &exp2); - E_last = CalculateAbsEnergy(1, &(st->tonalMDCTconceal.lastBlockData.spectralData[1]), infoIGFStartLine, &exp1); + E_2ndlast = CalculateAbsEnergy_fx(1, &(st->tonalMDCTconceal.lastBlockData.spectralData[0]), infoIGFStartLine, &exp2); + E_last = CalculateAbsEnergy_fx(1, &(st->tonalMDCTconceal.lastBlockData.spectralData[1]), infoIGFStartLine, &exp1); BASOP_Util_Divide_MantExp(extract_h(E_2ndlast), exp2, extract_h(E_last), exp1, &tmp1, &tmp2); @@ -1080,7 +1080,7 @@ void decoder_tcx( index = hTcxCfg->tcx_last_overlap_mode; /* backup last TCX overlap mode */ move16(); - /* normalize spectrum to minimize IMDCT noise */ + /* normalize spectrum to minimize IMDCT_fx noise */ tmp1 = s_max(s_max(L_frame,L_frameTCX), L_spec); s = s_max(0, sub(getScaleFactor32(x, tmp1), 4)); /* Keep 4 bits headroom for TNS */ Scale_sig32(x, tmp1, s); @@ -1235,17 +1235,17 @@ void decoder_tcx( { set32_fx( xn_buf32+st->hIGFDec->infoIGFStartLine, 0, sub(L_frameTCX, st->hIGFDec->infoIGFStartLine) ); } - IMDCT(xn_buf32, x_e, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, + IMDCT_fx(xn_buf32, x_e, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, st->hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, st->hTcxCfg->tcx_mdct_window_trans, st->hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr(s_max(L_frameTCX, L_spec), 1), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, &st->hHQ_core->Q_old_wtda_LB,st, 0, acelp_zir); /* Generate additional comfort noise to mask potential coding artefacts */ IF ( st->flag_cna != 0 ) { - generate_masking_noise_mdct (x, &x_e, st->hFdCngDec->hFdCngCom, s_max(s_max(L_frame,L_frameTCX), L_spec) ); + generate_masking_noise_mdct_fx (x, &x_e, st->hFdCngDec->hFdCngCom, s_max(s_max(L_frame,L_frameTCX), L_spec) ); } - IMDCT(x, x_e, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, + IMDCT_fx(x, x_e, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr(s_max(L_frameTCX, L_spec), 1), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, &st->hHQ_core->Q_old_wtda, st, div_l(L_mult(FSCALE_DENOM, L_frameTCX_glob), L_frame_glob), acelp_zir); @@ -1289,7 +1289,7 @@ void decoder_tcx( -void decoder_tcx_post(Decoder_State *st_fx, +void decoder_tcx_post_fx(Decoder_State *st_fx, Word16 *synth, Word16 *synthFB, Word16 *A, @@ -1404,7 +1404,7 @@ void decoder_tcx_post(Decoder_State *st_fx, Word16 Qnew_levelBackgroundTrace; Qnew_levelBackgroundTrace = 0; move16(); - minimumStatistics(hTcxDec->conNoiseLevelMemory, /*Q15*/ + minimumStatistics_fx(hTcxDec->conNoiseLevelMemory, /*Q15*/ &hTcxDec->conNoiseLevelIndex, /*Q0 */ &hTcxDec->conCurrLevelIndex, /*Q0 */ &hTcxDec->conCngLevelBackgroundTrace, /*Q15*/ @@ -1728,7 +1728,7 @@ void decoder_tcx_post_ivas_fx(Decoder_State *st_fx, Word16 Qnew_levelBackgroundTrace; Qnew_levelBackgroundTrace = 0; move16(); - minimumStatistics(hTcxDec->conNoiseLevelMemory, /*Q15*/ + minimumStatistics_fx(hTcxDec->conNoiseLevelMemory, /*Q15*/ &hTcxDec->NoiseLevelIndex_bfi, /*Q0 */ &hTcxDec->CurrLevelIndex_bfi, /*Q0 */ &hTcxDec->conCngLevelBackgroundTrace, /*Q15*/ @@ -1932,7 +1932,7 @@ void decoder_tcx_post_ivas_fx(Decoder_State *st_fx, } #endif -static Word32 CalculateAbsEnergy( /* o : normalized result Q31 */ +static Word32 CalculateAbsEnergy_fx( /* o : normalized result Q31 */ const Word32 L_off, /* i : initial sum value Qn */ const Word16 x[], /* i : x vector Qn */ const Word16 lg, /* i : vector length, range [0..7FFF] Q0 */ @@ -1988,7 +1988,7 @@ static Word32 CalculateAbsEnergy( /* o : normalized result Q31 */ } -void IMDCT(Word32 *x, Word16 x_e, +void IMDCT_fx(Word32 *x, Word16 x_e, Word16 *old_syn_overl, Word16 *syn_Overl_TDAC, Word16 *xn_buf, @@ -3577,7 +3577,7 @@ void decoder_tcx_IGF_stereo_fx( #ifdef IVAS_FLOAT_FIXED -void decoder_tcx_fx( +void decoder_tcx_ivas_fx( Decoder_State *st, Word16 prm[], Word16 A_fx[], @@ -3994,7 +3994,7 @@ void decoder_tcx_invQ_fx( *gain_tcx_e = hTcxDec->old_gaintcx_bfi_e; move16(); - hTcxDec->damping = Damping_fact( st->coder_type, st->nbLostCmpt, st->last_good, + hTcxDec->damping = Damping_fact_fx( st->coder_type, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &st->Mode2_lp_gainp, st->last_core ); @@ -4494,8 +4494,8 @@ void decoder_tcx_noisefilling_fx( move16(); } - E_2ndlast = CalculateAbsEnergy( 1, &( st->hTonalMDCTConc->lastBlockData.spectralData[0] ), tmp_len, &exp2 ); - E_last = CalculateAbsEnergy( 1, &( st->hTonalMDCTConc->lastBlockData.spectralData[1] ), tmp_len, &exp1 ); + E_2ndlast = CalculateAbsEnergy_fx( 1, &( st->hTonalMDCTConc->lastBlockData.spectralData[0] ), tmp_len, &exp2 ); + E_last = CalculateAbsEnergy_fx( 1, &( st->hTonalMDCTConc->lastBlockData.spectralData[1] ), tmp_len, &exp1 ); BASOP_Util_Divide_MantExp( extract_h( E_2ndlast ), exp2, extract_h( E_last ), exp1, &tmp1, &tmp2 ); @@ -4851,4 +4851,5 @@ void decoder_tcx_noiseshaping_igf_fx( } return; -} \ No newline at end of file +} +#endif diff --git a/lib_dec/dec_tran_fx.c b/lib_dec/dec_tran_fx.c index cf28f654d4cddca964d9f206ace7027fd5e85344..32227b458125eb0a5b4fc28a751e54a89921e289 100644 --- a/lib_dec/dec_tran_fx.c +++ b/lib_dec/dec_tran_fx.c @@ -6,7 +6,7 @@ #include "cnst.h" /* Common constants */ #include "prot_fx1.h" /* Function prototypes */ #include "prot_fx2.h" /* Function prototypes */ - +#ifdef IVAS_FLOAT_FIXED /*======================================================================*/ /* FUNCTION : decod_tran_fx() */ /*----------------------------------------------------------------------*/ @@ -252,3 +252,4 @@ void decod_tran_fx( return; } +#endif diff --git a/lib_dec/dec_uv.c b/lib_dec/dec_uv.c index c5b52d986a6c8a2fdd01e402f4d5eb2a4be946d8..e9a0823f7b594ed5ef0b92728c54ec464b3fc3b1 100644 --- a/lib_dec/dec_uv.c +++ b/lib_dec/dec_uv.c @@ -120,7 +120,7 @@ void decod_unvoiced( *-----------------------------------------------------------------*/ index = get_next_indice( st, st->acelp_cfg.gains_mode[i_subfr / L_SUBFR] ); - gain_dec_gacelp_uv_flt( index, code, code2, Es_pred, L_SUBFR, &gain_pit, &gain_code, &gain_code2, &( st->past_gpit_float), &norm_gain_code, &gain_inov ); + gain_dec_gacelp_uv( index, code, code2, Es_pred, L_SUBFR, &gain_pit, &gain_code, &gain_code2, &( st->past_gpit_float), &norm_gain_code, &gain_inov ); st->tilt_code = est_tilt( exc + i_subfr, gain_pit, code, gain_code, &voice_fac, L_SUBFR, 0 ); diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index f8a069799c943100975d63a5c173fa23e495107b..3ab65b7280aea1bf68163cfdda51d96a3d745a2e 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -6,8 +6,8 @@ #include "cnst.h" /* Common constants */ #include "prot_fx1.h" /* Function prototypes */ #include "prot_fx2.h" /* Function prototypes */ - -static void gain_dec_gacelp_uv( +#ifdef IVAS_FLOAT_FIXED +static void gain_dec_gacelp_uv_fx( Word16 index, /* i : Quantization index vector Q0 */ Word16 *code, /* i : algebraic code excitation Q9 */ Word16 *code2, /* i : algebraic code excitation Q9 */ @@ -184,8 +184,8 @@ void decod_unvoiced_ivas_fx( *-----------------------------------------------------------------*/ Word16 index = get_next_indice(st_fx, st_fx->acelp_cfg.gains_mode[i_subfr_fx / L_SUBFR]); - //gain_dec_gacelp_uv_flt(index, code, code2, Es_pred, L_SUBFR, &gain_pit, &gain_code, &gain_code2, &(st->past_gpit_float), &norm_gain_code, &gain_inov); - gain_dec_gacelp_uv(index, code_fx, code2_fx, Es_pred_fx, L_SUBFR, &gain_pit_fx, &gain_code_fx, &gain_code2_fx, &(st_fx->past_gpit), &norm_gain_code_fx, &gain_inov_fx); + //gain_dec_gacelp_uv(index, code, code2, Es_pred, L_SUBFR, &gain_pit, &gain_code, &gain_code2, &(st->past_gpit_float), &norm_gain_code, &gain_inov); + gain_dec_gacelp_uv_fx(index, code_fx, code2_fx, Es_pred_fx, L_SUBFR, &gain_pit_fx, &gain_code_fx, &gain_code2_fx, &(st_fx->past_gpit), &norm_gain_code_fx, &gain_inov_fx); //st->tilt_code = est_tilt(exc + i_subfr, gain_pit, code, gain_code, &voice_fac, L_SUBFR, 0); st_fx->tilt_code_fx = est_tilt_ivas_fx(exc_fx + i_subfr_fx, gain_pit_fx, code_fx, gain_code_fx, &voice_fac_fx, st_fx->Q_exc, L_SUBFR, 0); @@ -254,12 +254,12 @@ void decod_unvoiced_ivas_fx( /*---------------------------------------------------------------------* - * gain_dec_gacelp_uv + * gain_dec_gacelp_uv_fx * * Decoding of pitch and codebook gains for Unvoiced mode *---------------------------------------------------------------------*/ -static void gain_dec_gacelp_uv( +static void gain_dec_gacelp_uv_fx( Word16 index, /* i : Quantization index vector Q0 */ Word16 *code, /* i : algebraic code excitation Q9 */ Word16 *code2, /* i : algebraic code excitation Q9 */ @@ -362,4 +362,5 @@ static void gain_dec_gacelp_uv( return; -} \ No newline at end of file +} +#endif diff --git a/lib_dec/dlpc_avq.c b/lib_dec/dlpc_avq.c index 3138d3e12a7862f9f4bfc7c7e235da7cb6b699dc..6e161254c455d7c59313c752bf5f80c842ad9615 100644 --- a/lib_dec/dlpc_avq.c +++ b/lib_dec/dlpc_avq.c @@ -41,12 +41,12 @@ #include "wmc_auto.h" /*------------------------------------------------------------------* - * dlpc_avq_flt() + * dlpc_avq() * * Variable bitrate multiple LPC un-quantizer *------------------------------------------------------------------*/ -int16_t dlpc_avq_flt( +int16_t dlpc_avq( int16_t *index, /* i : Quantization indices */ float *LSF_Q, /* o : Quantized LSF vectors */ const int16_t numlpc, /* i : Number of sets of lpc */ @@ -175,12 +175,12 @@ static int16_t pack4bits( /*------------------------------------------------------------------* - * decode_lpc_avq_flt() + * decode_lpc_avq() * * *------------------------------------------------------------------*/ -int16_t decode_lpc_avq_flt( +int16_t decode_lpc_avq( Decoder_State *st, /* i/o: decoder state structure */ const int16_t numlpc, /* i : Number of sets of lpc */ int16_t *param_lpc, /* o : lpc parameters */ diff --git a/lib_dec/dlpc_avq_fx.c b/lib_dec/dlpc_avq_fx.c index 1610e17272edb97f658a37b26a4ff4c2eb28ed7b..ac123253685db2563a02b875e99714c91b2d7582 100644 --- a/lib_dec/dlpc_avq_fx.c +++ b/lib_dec/dlpc_avq_fx.c @@ -8,7 +8,7 @@ #include #include "prot_fx1.h" #include "prot_fx2.h" - +#ifdef IVAS_FLOAT_FIXED /* Constants */ #define M 16 /* length of LPC */ @@ -18,7 +18,7 @@ /* Variable bit-rate multiple LPC un-quantizer */ /***********************************************/ -Word16 dlpc_avq( +Word16 dlpc_avq_fx( Word16 *index, /* i : Quantization indices */ Word16 *LSF_Q, /* o : Quantized LSF vectors */ Word16 numlpc, /* i : Number of sets of lpc */ @@ -92,7 +92,7 @@ Word16 dlpc_avq( return (Word16)(p_index-index); } -static Word16 unary_decode( +static Word16 unary_decode_fx( Decoder_State *st, Word16 *ind ) @@ -124,7 +124,7 @@ static Word16 unary_decode( } -static Word16 pack4bits( +static Word16 pack4bits_fx( Word16 nbits, Decoder_State *st, Word16 *prm @@ -151,7 +151,7 @@ static Word16 pack4bits( return(i); } -Word16 decode_lpc_avq( +Word16 decode_lpc_avq_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ Word16* param_lpc /* o : lpc parameters */ @@ -253,7 +253,7 @@ Word16 decode_lpc_avq( IF(GT_16(qn1, 4)) { - nb = unary_decode(st, &qn1); + nb = unary_decode_fx(st, &qn1); if (EQ_16(nb, 1)) { @@ -276,7 +276,7 @@ Word16 decode_lpc_avq( IF(GT_16(qn2, 4)) { - nb = unary_decode(st, &qn2); + nb = unary_decode_fx(st, &qn2); if (EQ_16(nb, 1)) { @@ -319,11 +319,11 @@ Word16 decode_lpc_avq( /* Decode Split-by-2 algebraic VQ */ avqBits = shl(qn1, 2); - pack4bits(avqBits, st, ¶m_lpc[j]); + pack4bits_fx(avqBits, st, ¶m_lpc[j]); j = add(j, qn1); avqBits = shl(qn2, 2); - pack4bits(avqBits, st, ¶m_lpc[j]); + pack4bits_fx(avqBits, st, ¶m_lpc[j]); j = add(j, qn2); } #ifdef IVAS_CODE_AVQ_LPC @@ -341,7 +341,7 @@ Word16 decode_lpc_avq( return sub(st->next_bit_pos, start_bit_pos); } -Word16 decode_lpc_avq_ivas( +Word16 decode_lpc_avq_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 numlpc, /* i : Number of sets of lpc */ Word16 *param_lpc /* o : lpc parameters */ @@ -436,7 +436,7 @@ Word16 decode_lpc_avq_ivas( IF( GT_16( qn1, 4 ) ) { - nb = unary_decode( st, &qn1 ); + nb = unary_decode_fx( st, &qn1 ); if ( EQ_16( nb, 1 ) ) { @@ -459,7 +459,7 @@ Word16 decode_lpc_avq_ivas( IF( GT_16( qn2, 4 ) ) { - nb = unary_decode( st, &qn2 ); + nb = unary_decode_fx( st, &qn2 ); if ( EQ_16( nb, 1 ) ) { @@ -502,11 +502,11 @@ Word16 decode_lpc_avq_ivas( /* Decode Split-by-2 algebraic VQ */ avqBits = shl( qn1, 2 ); - pack4bits( avqBits, st, ¶m_lpc[j] ); + pack4bits_fx( avqBits, st, ¶m_lpc[j] ); j = add( j, qn1 ); avqBits = shl( qn2, 2 ); - pack4bits( avqBits, st, ¶m_lpc[j] ); + pack4bits_fx( avqBits, st, ¶m_lpc[j] ); j = add( j, qn2 ); } ELSE @@ -522,3 +522,4 @@ Word16 decode_lpc_avq_ivas( return sub( st->next_bit_pos, start_bit_pos ); } +#endif diff --git a/lib_dec/dlpc_stoch.c b/lib_dec/dlpc_stoch.c index 9e86d5efcd1f64dea7a025a40a2704d244d096b3..dc853a8b2ba2959095a09180b792e461bb953896 100644 --- a/lib_dec/dlpc_stoch.c +++ b/lib_dec/dlpc_stoch.c @@ -43,12 +43,12 @@ #include "wmc_auto.h" /*------------------------------------------------------------------* - * lpc_unquantize_flt() + * lpc_unquantize() * * *------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED -void lpc_unquantize_flt( +void lpc_unquantize( Decoder_State *st, float *lsf, float *lsp, @@ -67,7 +67,7 @@ void lpc_unquantize_flt( nb_indices = 0; if ( st->lpcQuantization == 0 ) { - nb_indices = dlpc_avq_flt( param_lpc, &lsf[M], st->numlpc, st->sr_core ); + nb_indices = dlpc_avq( param_lpc, &lsf[M], st->numlpc, st->sr_core ); for ( k = 0; k < st->numlpc; k++ ) { diff --git a/lib_dec/dlpc_stoch_fx.c b/lib_dec/dlpc_stoch_fx.c index 7ffdfc750b2fb607693e7894173e7293e749edc2..e28044c197135d2db54e75647d808e976faae224 100644 --- a/lib_dec/dlpc_stoch_fx.c +++ b/lib_dec/dlpc_stoch_fx.c @@ -10,13 +10,13 @@ #include "basop_util.h" #include "prot_fx1.h" #include "prot_fx2.h" - +#ifdef IVAS_FLOAT_FIXED /* Constants */ #define M 16 #define BFI_FAC 0.9f -void lpc_unquantize( +void lpc_unquantize_fx( Decoder_State * st, Word16 *lsf, Word16 *lsp, @@ -39,7 +39,7 @@ void lpc_unquantize( IF(st->lpcQuantization == 0 ) { - nb_indices = dlpc_avq(param_lpc, &lsf[m], st->numlpc, st->sr_core); + nb_indices = dlpc_avq_fx(param_lpc, &lsf[m], st->numlpc, st->sr_core); FOR ( k=0; k< st->numlpc; k++ ) { E_LPC_lsf_lsp_conversion(&lsf[(k+1)*m], &lsp[(k+1)*m], m); @@ -107,4 +107,4 @@ void lpc_unquantize( return; } - +#endif diff --git a/lib_dec/er_dec_acelp.c b/lib_dec/er_dec_acelp.c index ddc0f08224323ae179c3061ce1569de66b5dcf86..d598cf7aa0af844fa84fb149bd502c565db2fa22 100644 --- a/lib_dec/er_dec_acelp.c +++ b/lib_dec/er_dec_acelp.c @@ -42,12 +42,12 @@ #include "wmc_auto.h" #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* - * con_acelp_flt() + * con_acelp() * * Concealment function for ACELP and TD-TCX *--------------------------------------------------------------------*/ -void con_acelp_flt( +void con_acelp( float A[], /* i : coefficients NxAz[M+1] */ const int16_t coder_type, /* i : ACELP coder type */ float synth[], /* i/o: synthesis */ @@ -208,7 +208,7 @@ void con_acelp_flt( { /* pitch cycle is first low-pass filtered */ /*get filter coefficients*/ - genPlcFiltBWAdap_flt( st->sr_core, &lpFiltAdapt[0], 0, st->cummulative_damping_float); + genPlcFiltBWAdap( st->sr_core, &lpFiltAdapt[0], 0, st->cummulative_damping_float); for ( i = 0; i < Tc; i++ ) { *pt_exc++ = ( lpFiltAdapt[0] * pt1_exc[-1] + lpFiltAdapt[1] * pt1_exc[0] + lpFiltAdapt[2] * pt1_exc[1] ); @@ -260,7 +260,7 @@ void con_acelp_flt( { get_subframe_pitch_flt( st->nb_subfr, st->old_fpitch_float, predPitchLag, pitch_buf ); - PulseResynchronization_flt( harmonic_exc_buf, exc, L_frame, st->nb_subfr, st->old_fpitch_float, predPitchLag ); + PulseResynchronization( harmonic_exc_buf, exc, L_frame, st->nb_subfr, st->old_fpitch_float, predPitchLag ); } else { @@ -391,12 +391,12 @@ void con_acelp_flt( } /*get filter coefficients*/ - genPlcFiltBWAdap_flt( st->sr_core, &hp_filt[0], 1, st->cummulative_damping_float); + genPlcFiltBWAdap( st->sr_core, &hp_filt[0], 1, st->cummulative_damping_float); /* PLC: [ACELP: Fade-out] * PLC: retrieve background level */ tmp = 1.0f; - gainSynthDeemph = getLevelSynDeemph_flt( &( tmp ), A, L_SUBFR, st->preemph_fac_float, L_frame / L_SUBFR ); + gainSynthDeemph = getLevelSynDeemph( &( tmp ), A, L_SUBFR, st->preemph_fac_float, L_frame / L_SUBFR ); gainCNG = st->cngTDLevel_float / gainSynthDeemph; gain = st->lp_gainc; /* start-of-the-frame gain */ @@ -415,7 +415,7 @@ void con_acelp_flt( st->lp_gainc = gainCNG; } - highPassFiltering_flt( st->last_good, L_frame + l_fir_fer / 2, noise_buf, hp_filt, l_fir_fer ); + highPassFiltering( st->last_good, L_frame + l_fir_fer / 2, noise_buf, hp_filt, l_fir_fer ); /* Find energy normalization factor */ pt_exc = noise_buf + l_fir_fer / 2; diff --git a/lib_dec/er_dec_acelp_fx.c b/lib_dec/er_dec_acelp_fx.c index acaddaad91e73e921ecb17f287f0eba54efc3fae..e4907163c08899ad54a2b4d0ea7cce3a79469ce4 100644 --- a/lib_dec/er_dec_acelp_fx.c +++ b/lib_dec/er_dec_acelp_fx.c @@ -12,7 +12,7 @@ #include "prot_fx2.h" #include "basop_util.h" #include "rom_dec.h" - +#ifdef IVAS_FLOAT_FIXED extern const Word16 T_DIV_L_Frame[];/*0Q15 * 2^-7 */ /*Table 2^7 * 1/L_frame */ @@ -21,7 +21,7 @@ extern const Word16 T_DIV_L_Frame[];/*0Q15 * 2^-7 */ #define L_EXC_BUF OLD_EXC_SIZE_DEC_16k+L_DIV_MAX+L_SUBFR+1+L_DIV_MAX/2 /*LOCAL FUNCTIONS*/ -static void memsynPrecission(Word16 nbLostCmpt,Word16* mem_syn, Word16* exc, Word16 len, Word16*s_16); +static void memsynPrecission_fx(Word16 nbLostCmpt,Word16* mem_syn, Word16* exc, Word16 len, Word16*s_16); @@ -31,7 +31,7 @@ static void memsynPrecission(Word16 nbLostCmpt,Word16* mem_syn, Word16* exc, Wor * ****************************************************************/ -void con_acelp( +void con_acelp_fx( const Word16 A[], /*nbLostCmpt, st->last_good, stab_fac, &(st->Mode2_lp_gainp), 0); /*Q14*/ + alpha = Damping_fact_fx(coder_type, st->nbLostCmpt, st->last_good, stab_fac, &(st->Mode2_lp_gainp), 0); /*Q14*/ st->cummulative_damping = shl(mult(st->cummulative_damping,alpha),1);/*shl(Q15*Q14,1)=shl(Q14,1) = Q15*/ if (EQ_16(st->nbLostCmpt,1)) { @@ -243,7 +243,7 @@ void con_acelp( /* pitch cycle is first low-pass filtered */ /*get filter coefficients*/ - genPlcFiltBWAdap( + genPlcFiltBWAdap_fx( st->sr_core, /*W32 Q0*/ &lpFiltAdapt[0] /*Q15*/, 0, @@ -315,7 +315,7 @@ void con_acelp( { get_subframe_pitch(st->nb_subfr, st->old_fpitch, predPitchLag, pitch_buf); - PulseResynchronization(harmonic_exc_buf, exc, st->L_frame, st->nb_subfr, st->old_fpitch, predPitchLag); + PulseResynchronization_fx(harmonic_exc_buf, exc, st->L_frame, st->nb_subfr, st->old_fpitch, predPitchLag); } ELSE { set32_fx(pitch_buf, st->old_fpitch, st->nb_subfr); @@ -502,7 +502,7 @@ void con_acelp( } /*get filter coefficients*/ - genPlcFiltBWAdap(st->sr_core, /*W32 Q0*/ + genPlcFiltBWAdap_fx(st->sr_core, /*W32 Q0*/ &hp_filt[0], /*Q15*/ 1, st->cummulative_damping); /*Q15*/ @@ -514,7 +514,7 @@ void con_acelp( tmp = 32767/*1.0f Q15*/; - gainSynthDeemph=getLevelSynDeemph(&(tmp), + gainSynthDeemph=getLevelSynDeemph_fx(&(tmp), A, M, L_SUBFR, @@ -593,7 +593,7 @@ void con_acelp( st->Mode2_lp_gainc = L_shr(st->Mode2_lp_gainc,sub(5,gainCNG_e)); /*15Q16, no scaling*/ } - highPassFiltering(st->last_good, add(st->L_frame,shr(l_fir_fer,1)), noise_buf, hp_filt, l_fir_fer); + highPassFiltering_fx(st->last_good, add(st->L_frame,shr(l_fir_fer,1)), noise_buf, hp_filt, l_fir_fer); pt_exc = noise_buf + l_fir_fer/2; @@ -836,7 +836,7 @@ void con_acelp( p_A = A; /*in case of more than 5 consecutive concealed frames, improve precision of synthesis*/ - memsynPrecission(st->nbLostCmpt,mem_syn, exc, st->L_frame, &s_16); + memsynPrecission_fx(st->nbLostCmpt,mem_syn, exc, st->L_frame, &s_16); FOR (i_subfr = 0; i_subfr < st->L_frame; i_subfr += L_SUBFR) { @@ -922,7 +922,7 @@ void con_acelp( p_A = st->Aq_cng; /*in case of more than 5 consecutive concealed frames, improve precision of synthesis*/ - memsynPrecission(st->nbLostCmpt,mem_syn_unv, exc_unv, st->L_frame, &s_16); + memsynPrecission_fx(st->nbLostCmpt,mem_syn_unv, exc_unv, st->L_frame, &s_16); FOR (i_subfr = 0; i_subfr < st->L_frame; i_subfr += L_SUBFR) { @@ -1137,7 +1137,7 @@ void con_acelp( return; } -static void memsynPrecission(Word16 nbLostCmpt,Word16* mem_syn, Word16* exc, Word16 len, Word16*s_16) +static void memsynPrecission_fx(Word16 nbLostCmpt,Word16* mem_syn, Word16* exc, Word16 len, Word16*s_16) { IF(GT_16(nbLostCmpt,5)) { @@ -1185,3 +1185,4 @@ static void memsynPrecission(Word16 nbLostCmpt,Word16* mem_syn, Word16* exc, Wor } } +#endif diff --git a/lib_dec/er_dec_tcx.c b/lib_dec/er_dec_tcx.c index 9d1abdb32f9dfa86bb68414491589cb68b97d6f9..b1ed7dedb7b7663e7ddf5923ec61841a1028b56a 100644 --- a/lib_dec/er_dec_tcx.c +++ b/lib_dec/er_dec_tcx.c @@ -46,12 +46,12 @@ #ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* - * con_tcx_flt() + * con_tcx() * * *-----------------------------------------------------------------*/ -void con_tcx_flt( +void con_tcx( Decoder_State *st, /* i/o: coder memory state */ float synth[], /* i/o: synth[] */ const float coh, /* i : coherence of stereo signal */ @@ -251,7 +251,7 @@ void con_tcx_flt( { get_subframe_pitch_flt( st->nb_subfr, st->old_fpitch_float, predPitchLag * st->L_frame / L_frame, pitch_buf ); - PulseResynchronization_flt( buf, exc, L_frame, st->nb_subfr, st->old_fpitchFB_float, predPitchLag ); + PulseResynchronization( buf, exc, L_frame, st->nb_subfr, st->old_fpitchFB_float, predPitchLag ); } else { @@ -417,7 +417,7 @@ void con_tcx_flt( if ( st->nbLostCmpt == 1 ) { - highPassFiltering_flt( st->last_good, L_frame + L_frame / 2 + L_FIR_FER2, noise, hp_filt, L_FIR_FER2 ); + highPassFiltering( st->last_good, L_frame + L_frame / 2 + L_FIR_FER2, noise, hp_filt, L_FIR_FER2 ); } else { @@ -434,11 +434,11 @@ void con_tcx_flt( tmp = 1.0f; if ( A_cng != NULL ) { - gainSynthDeemph = getLevelSynDeemph_flt( &( tmp ), A_cng, L_frame / 4, st->preemph_fac_float, 1 ) / 4.f; + gainSynthDeemph = getLevelSynDeemph( &( tmp ), A_cng, L_frame / 4, st->preemph_fac_float, 1 ) / 4.f; } else { - gainSynthDeemph = getLevelSynDeemph_flt( &( tmp ), A_local, L_frame / 4, st->preemph_fac_float, 1 ); + gainSynthDeemph = getLevelSynDeemph( &( tmp ), A_local, L_frame / 4, st->preemph_fac_float, 1 ); } if ( st->tcxonly ) { diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index d0b2b1df91a8e5693faeda7cf896074e28703726..4a0208b9dcf99aaa5b2a7b640d98689816093e83 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -10,12 +10,12 @@ #include "prot_fx2.h" #include "basop_util.h" #include "rom_dec.h" - +#ifdef IVAS_FLOAT_FIXED /***************************************************** calcGainc calculates st->lp_gainc ******************************************************/ -static void calcGainc(Word16* exc, Word16 Q_exc, Word32 old_fpitch, Word16 L_subfr, Word32 lp_gainp, Word32* lp_gainc) +static void calcGainc_fx(Word16* exc, Word16 Q_exc, Word32 old_fpitch, Word16 L_subfr, Word32 lp_gainp, Word32* lp_gainc) { Word32 L_c ; Word16 tmp16, tmp16_2, tmp16_3, tmp_e, tmp2_e, tmp_loop, i; @@ -76,7 +76,7 @@ static void calcGainc(Word16* exc, Word16 Q_exc, Word32 old_fpitch, Word16 L_sub } -static void calcGainc2(Word16 *exc, Word16 Q_exc, Word16 L_subfr, Word32* lp_gainc) +static void calcGainc2_fx(Word16 *exc, Word16 Q_exc, Word16 L_subfr, Word32* lp_gainc) { Word16 i, cnt, tmp16 , tmp_e, tmp2_e; Word32 L_c, L_acc, L_tmp; @@ -132,7 +132,7 @@ con_tcx *******************************************************/ -void con_tcx( +void con_tcx_fx( Decoder_State *st, /* i/o: coder memory state */ Word16 synth[] /* i/o: synth[] *//*Q0 */ #ifdef IVAS_CODE_CON_TCX @@ -306,7 +306,7 @@ void con_tcx( IF ( EQ_16(st->nbLostCmpt,1)|| hTcxDec->tcxConceal_recalc_exc) { - calcGainc( exc, Q_exc, st->old_fpitchFB, L_subfr, st->Mode2_lp_gainp, &(st->Mode2_lp_gainc)); + calcGainc_fx( exc, Q_exc, st->old_fpitchFB, L_subfr, st->Mode2_lp_gainp, &(st->Mode2_lp_gainc)); } tmp16 = 0; @@ -500,7 +500,7 @@ void con_tcx( 7-16)/*Q16*/, pitch_buf); - PulseResynchronization(buf, exc, L_frame, st->nb_subfr, st->old_fpitchFB, predPitchLag); + PulseResynchronization_fx(buf, exc, L_frame, st->nb_subfr, st->old_fpitchFB, predPitchLag); } ELSE { @@ -540,14 +540,14 @@ void con_tcx( alpha = 1.0f; if (st->element_mode == IVAS_CPE_MDCT && st->nbLostCmpt >= MDCT_ST_PLC_FADEOUT_START_FRAME) { - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &(st->lp_gainp), 0); + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &(st->lp_gainp), 0); } else if (st->element_mode != IVAS_CPE_MDCT) { - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &(st->lp_gainp), 0); + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &(st->lp_gainp), 0); } #else - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), 0);/*Q14*/ + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), 0);/*Q14*/ #endif IF ( EQ_16(st->nbLostCmpt , 1)) { @@ -616,7 +616,7 @@ void con_tcx( set16_fx(&exc[0], 0, add(L_frame,shr(L_frame,1))); IF ( EQ_16(st->nbLostCmpt , 1)) { - calcGainc2(&exc[0], Q_exc, L_subfr, &(st->Mode2_lp_gainc)); + calcGainc2_fx(&exc[0], Q_exc, L_subfr, &(st->Mode2_lp_gainc)); } set32_fx( pitch_buf, L_deposit_h(L_SUBFR), st->nb_subfr); /* PLC: calculate damping factor */ @@ -624,14 +624,14 @@ void con_tcx( alpha = 1.0f; if (st->element_mode == IVAS_CPE_MDCT && st->nbLostCmpt >= MDCT_ST_PLC_FADEOUT_START_FRAME) { - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &(st->lp_gainp), 0); + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &(st->lp_gainp), 0); } else if (st->element_mode != IVAS_CPE_MDCT) { - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &(st->lp_gainp), 0); + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &(st->lp_gainp), 0); } #else - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), 0);/*Q14*/ + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), 0);/*Q14*/ #endif } @@ -733,7 +733,7 @@ void con_tcx( } IF ( EQ_16(st->nbLostCmpt,1)) { - highPassFiltering(st->last_good, add(add(L_frame, shr(L_frame,1)),L_FIR_FER2), noise, hp_filt, L_FIR_FER2); + highPassFiltering_fx(st->last_good, add(add(L_frame, shr(L_frame,1)),L_FIR_FER2), noise, hp_filt, L_FIR_FER2); } ELSE { @@ -759,16 +759,16 @@ void con_tcx( #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT if (A_cng != NULL) { - gainSynthDeemph = getLevelSynDeemph(&(tmp), A_cng, L_frame / 4, st->preemph_fac, 1) / 4.f; + gainSynthDeemph = getLevelSynDeemph_fx(&(tmp), A_cng, L_frame / 4, st->preemph_fac, 1) / 4.f; } else { - gainSynthDeemph = getLevelSynDeemph(&(tmp), A_local, L_frame / 4, st->preemph_fac, 1); + gainSynthDeemph = getLevelSynDeemph_fx(&(tmp), A_local, L_frame / 4, st->preemph_fac, 1); } #else tmp16 = 32767; move16(); - gainSynthDeemph = getLevelSynDeemph(&(tmp16), A_local, M, shr(L_frame,2), st->preemph_fac, 1, &gainSynthDeemph_e); + gainSynthDeemph = getLevelSynDeemph_fx(&(tmp16), A_local, M, shr(L_frame,2), st->preemph_fac, 1, &gainSynthDeemph_e); #endif IF (0 != st->tcxonly) { @@ -972,7 +972,7 @@ void con_tcx( alpha_delayed = 1.0f; if (st->nbLostCmpt > MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE) { - alpha_delayed = Damping_fact(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE, st->last_good, st->stab_fac, &(st->lp_gainp), ACELP_CORE); + alpha_delayed = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE, st->last_good, st->stab_fac, &(st->lp_gainp), ACELP_CORE); } if (st->plcBackgroundNoiseUpdated && alpha_delayed != 1.0f) @@ -1295,7 +1295,7 @@ void con_tcx_ivas_fx( IF ( EQ_16(st->nbLostCmpt,1)|| hTcxDec->tcxConceal_recalc_exc) { - calcGainc( exc, Q_exc, st->old_fpitchFB, L_subfr, st->Mode2_lp_gainp, &(st->Mode2_lp_gainc)); + calcGainc_fx( exc, Q_exc, st->old_fpitchFB, L_subfr, st->Mode2_lp_gainp, &(st->Mode2_lp_gainc)); } tmp16 = 0; @@ -1459,7 +1459,7 @@ void con_tcx_ivas_fx( 7-16)/*Q16*/, pitch_buf); - PulseResynchronization(buf, exc, L_frame, st->nb_subfr, st->old_fpitchFB, predPitchLag); + PulseResynchronization_fx(buf, exc, L_frame, st->nb_subfr, st->old_fpitchFB, predPitchLag); } ELSE { @@ -1499,14 +1499,14 @@ void con_tcx_ivas_fx( alpha = 1.0f; if (st->element_mode == IVAS_CPE_MDCT && st->nbLostCmpt >= MDCT_ST_PLC_FADEOUT_START_FRAME) { - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &(st->lp_gainp), 0); + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &(st->lp_gainp), 0); } else if (st->element_mode != IVAS_CPE_MDCT) { - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &(st->lp_gainp), 0); + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &(st->lp_gainp), 0); } #else - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), 0);/*Q14*/ + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), 0);/*Q14*/ #endif IF ( EQ_16(st->nbLostCmpt , 1)) { @@ -1575,7 +1575,7 @@ void con_tcx_ivas_fx( set16_fx(&exc[0], 0, add(L_frame,shr(L_frame,1))); IF ( EQ_16(st->nbLostCmpt , 1)) { - calcGainc2(&exc[0], Q_exc, L_subfr, &(st->Mode2_lp_gainc)); + calcGainc2_fx(&exc[0], Q_exc, L_subfr, &(st->Mode2_lp_gainc)); } set32_fx( pitch_buf, L_deposit_h(L_SUBFR), st->nb_subfr); /* PLC: calculate damping factor */ @@ -1583,14 +1583,14 @@ void con_tcx_ivas_fx( alpha = 1.0f; if (st->element_mode == IVAS_CPE_MDCT && st->nbLostCmpt >= MDCT_ST_PLC_FADEOUT_START_FRAME) { - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &(st->lp_gainp), 0); + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &(st->lp_gainp), 0); } else if (st->element_mode != IVAS_CPE_MDCT) { - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &(st->lp_gainp), 0); + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &(st->lp_gainp), 0); } #else - alpha = Damping_fact(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), 0);/*Q14*/ + alpha = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), 0);/*Q14*/ #endif } @@ -1698,7 +1698,7 @@ void con_tcx_ivas_fx( } IF ( EQ_16(st->nbLostCmpt,1)) { - highPassFiltering(st->last_good, add(add(L_frame, shr(L_frame,1)),L_FIR_FER2), noise, hp_filt, L_FIR_FER2); + highPassFiltering_fx(st->last_good, add(add(L_frame, shr(L_frame,1)),L_FIR_FER2), noise, hp_filt, L_FIR_FER2); } ELSE { @@ -1725,16 +1725,16 @@ void con_tcx_ivas_fx( tmp16 = 32767; IF (A_cng != NULL) { - gainSynthDeemph = shr(getLevelSynDeemph(&(tmp16), A_cng, M, shr(L_frame, 2), st->preemph_fac, 1, &gainSynthDeemph_e) , 2); + gainSynthDeemph = shr(getLevelSynDeemph_fx(&(tmp16), A_cng, M, shr(L_frame, 2), st->preemph_fac, 1, &gainSynthDeemph_e) , 2); } ELSE { - gainSynthDeemph = getLevelSynDeemph(&(tmp16), A_local, M, shr(L_frame, 2), st->preemph_fac, 1, &gainSynthDeemph_e); + gainSynthDeemph = getLevelSynDeemph_fx(&(tmp16), A_local, M, shr(L_frame, 2), st->preemph_fac, 1, &gainSynthDeemph_e); } #else tmp16 = 32767; move16(); - gainSynthDeemph = getLevelSynDeemph(&(tmp16), A_local, M, shr(L_frame,2), st->preemph_fac, 1, &gainSynthDeemph_e); + gainSynthDeemph = getLevelSynDeemph_fx(&(tmp16), A_local, M, shr(L_frame,2), st->preemph_fac, 1, &gainSynthDeemph_e); #endif IF (0 != st->tcxonly) { @@ -1942,7 +1942,7 @@ void con_tcx_ivas_fx( alpha_delayed = 16384; IF (st->nbLostCmpt > MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE) { - alpha_delayed = Damping_fact(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), ACELP_CORE); + alpha_delayed = Damping_fact_fx(st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE, st->last_good, st->stab_fac_fx, &(st->Mode2_lp_gainp), ACELP_CORE); } IF (st->plcBackgroundNoiseUpdated && alpha_delayed != 16384) @@ -2087,3 +2087,4 @@ void con_tcx_ivas_fx( return; } #endif +#endif diff --git a/lib_dec/er_scale_syn_fx.c b/lib_dec/er_scale_syn_fx.c index 8ee2514d6439913d33a08f87a45edde365622514..847798483d8d3c322cd37b530c04fd798bf70dc9 100644 --- a/lib_dec/er_scale_syn_fx.c +++ b/lib_dec/er_scale_syn_fx.c @@ -10,16 +10,16 @@ #include "prot_fx2.h" #include "basop_util.h" #include "cnst.h" - +#ifdef IVAS_FLOAT_FIXED /*----------------------------------------------------------------------------------* -* Damping_fact() +* Damping_fact_fx() * * Estimate damping factor *----------------------------------------------------------------------------------*/ /*This BASOP version was ported based on trunk rev. 27621 and updated based on trunk rev. 29287, re-updated based on trunk rev. 32244 */ -Word16 Damping_fact( /* o : damping factor *//*Q14*/ +Word16 Damping_fact_fx( /* o : damping factor *//*Q14*/ const Word16 coder_type, /* i : coding type in last good received frame */ const Word16 nbLostCmpt, /* i : counter of consecutive bfi frames */ const Word16 last_good, /* i : last good frame class */ @@ -135,3 +135,4 @@ Word16 Damping_fact( /* o : damping factor } return alpha; } +#endif \ No newline at end of file diff --git a/lib_dec/er_sync_exc.c b/lib_dec/er_sync_exc.c index 0da906ecfb78c22b2ade8aaf3d0615fb05c21b32..70b930f183a379e679bf424262b89e25e0a68644 100644 --- a/lib_dec/er_sync_exc.c +++ b/lib_dec/er_sync_exc.c @@ -177,12 +177,12 @@ static void RemoveSamples( /*-------------------------------------------------------------------* - * PulseResynchronization_flt() + * PulseResynchronization() * * Resynchronize glottal pulse positions of the signal in src_exc and store it in dst_exc *--------------------------------------------------------------------*/ -void PulseResynchronization_flt( +void PulseResynchronization( const float *src_exc, /* i : Input excitation buffer */ float *dst_exc, /* o : output excitation buffer */ const int16_t nFrameLength, /* i : frame length */ diff --git a/lib_dec/er_sync_exc_fx.c b/lib_dec/er_sync_exc_fx.c index cf9534f331bd5c63e4e6c6ffd6bcc320a29931a7..c6898cd23b09d4336f7a262b4dc68137656dfe96 100644 --- a/lib_dec/er_sync_exc_fx.c +++ b/lib_dec/er_sync_exc_fx.c @@ -12,7 +12,7 @@ #include "prot_fx2.h" #include "basop32.h" #include "basop_util.h" - +#ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * * Perform resynchronisation of the last glottal pulse in voiced lost frame @@ -23,7 +23,7 @@ /** Get the location of the minimum energy in the given signal. * @returns Index of the position of the minimum energy, that is the position i where filter(x[i-filterLength/2],...,x[i+(filterLength-filterLength/2)-1]) is at maximum. */ -static Word16 GetMinimumPosition( +static Word16 GetMinimumPosition_fx( Word16 const * x, /* Input signal. Qx*/ Word16 length, /* The length of the input signal. Q0*/ Word16 filterLength /* the length of the filter length used for the energy calculation. Q0*/ @@ -108,7 +108,7 @@ static Word16 GetMinimumPosition( * \returns Index of the position of the maximum peak, that is the position i where abs(x[i]) has it's maximum. */ -static Word16 FindMaxPeak +static Word16 FindMaxPeak_fx ( Word16 /*float*/ const * x, /* #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" -#endif -/* static void setnoiseLevelMemory() +/* static void setnoiseLevelMemory_fx() * - * Helper function - updates buffer for minimumStatistics function + * Helper function - updates buffer for minimumStatistics_fx function */ -static void setnoiseLevelMemory(Word16 f, Word16* new_noiseEstimate_e, Word16* noiseLevelMemory_e, Word16* noiseLevelMemory, Word16* currLevelIndex) +static void setnoiseLevelMemory_fx(Word16 f, Word16* new_noiseEstimate_e, Word16* noiseLevelMemory_e, Word16* noiseLevelMemory, Word16* currLevelIndex) { noiseLevelMemory[*currLevelIndex] = f; move16(); @@ -30,7 +29,7 @@ static void setnoiseLevelMemory(Word16 f, Word16* new_noiseEstimate_e, Word16* n /* PLC: [Common: Fade-out] * PLC: and for PLC fade out */ -void minimumStatistics( +void minimumStatistics_fx( Word16* noiseLevelMemory, /* Qx, internal state */ Word16* noiseLevelIndex, /* Q0, internal state */ Word16* currLevelIndex, /* Q0, internal state (circular buffer) */ @@ -138,7 +137,7 @@ void minimumStatistics( /*rescale noiseLevelMemory*/ - setnoiseLevelMemory(f,new_noiseEstimate_e,noiseLevelMemory_e, noiseLevelMemory, currLevelIndex); + setnoiseLevelMemory_fx(f,new_noiseEstimate_e,noiseLevelMemory_e, noiseLevelMemory, currLevelIndex); p = *currLevelIndex; move16(); } @@ -146,7 +145,7 @@ void minimumStatistics( { move16(); - setnoiseLevelMemory(f,new_noiseEstimate_e, noiseLevelMemory_e, noiseLevelMemory, currLevelIndex); + setnoiseLevelMemory_fx(f,new_noiseEstimate_e, noiseLevelMemory_e, noiseLevelMemory, currLevelIndex); /* current min is not a new min, so check if min must be re-searched */ IF (NE_16(p, *currLevelIndex)) @@ -190,10 +189,10 @@ void minimumStatistics( /*----------------------------------------------------------------------* * PLC: [ACELP: Fade-out] - * PLC: getLevelSynDeemph: derives on frame or subframe basis the level + * PLC: getLevelSynDeemph_fx: derives on frame or subframe basis the level * of LPC synthesis and deeemphasis based on the given input *----------------------------------------------------------------------*/ -Word16 getLevelSynDeemph( /*10Q5*/ +Word16 getLevelSynDeemph_fx( /*10Q5*/ Word16 h1Init[], /* i: input value or vector to be processed */ /* Q15 */ Word16 const A[], /* i: LPC coefficients */ /* Qx */ Word16 const lpcorder, /* i: LPC order */ /* Q0 */ @@ -274,7 +273,7 @@ Word16 getLevelSynDeemph( /*10Q5*/ } /* BASOP version: up to date with rev 7422 */ -void genPlcFiltBWAdap( +void genPlcFiltBWAdap_fx( const Word32 sr_core, /* i : core sampling rate */ Word16* lpFiltAdapt, /* o : filter coefficients for filtering codebooks in case of flc */ const Word16 type, /* i : type of filter, either 0 : lowpass or 1 : highpass */ @@ -348,7 +347,7 @@ void genPlcFiltBWAdap( * PLC: high pass filtering *-----------------------------------------------------------------*/ /*VERSIONINFO: This port is up to date with trunk rev. 32434*/ -void highPassFiltering( +void highPassFiltering_fx( const Word16 last_good, /* i: short last classification type */ const Word16 L_buffer, /* i: int buffer length */ Word16 exc2[], /* i/o: Qx unvoiced excitation before the high pass filtering */ @@ -507,7 +506,7 @@ Word16 GetPLCModeDecision_ivas_fx( } #endif -Word16 GetPLCModeDecision( +Word16 GetPLCModeDecision_fx( Decoder_State *st /* i/o: decoder memory state pointer */ ) { @@ -647,3 +646,4 @@ Word16 GetPLCModeDecision( } return core; } +#endif diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 15276b8a876e7fd7cef90eeeffca988cdff2f6cd..96c3b57928b31659d1f135f695bc94e022e15328 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -48,12 +48,12 @@ #endif #ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* - * evs_dec_flt() + * evs_dec() * * Principal decoder routine *--------------------------------------------------------------------------*/ -ivas_error evs_dec_flt( +ivas_error evs_dec( Decoder_State *st, /* i/o: Decoder state structure */ float mem_hp20_out[L_HP20_MEM], /* i/o: HP filter memory for synthesis */ float *output, /* o : output synthesis signal */ @@ -85,7 +85,7 @@ ivas_error evs_dec_flt( error = IVAS_ERR_OK; - push_wmops( "evs_dec_flt" ); + push_wmops( "evs_dec" ); /*------------------------------------------------------------------* * Initialization *-----------------------------------------------------------------*/ @@ -666,18 +666,18 @@ ivas_error evs_dec_flt( * - do CNG during inactive frames * -------------------------------------------------------------- */ - noisy_speech_detection_flt( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, output ); + noisy_speech_detection( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, output ); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt = 0.99f * st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt + 0.01f * (float) st->hFdCngDec->hFdCngCom->flag_noisy_speech; st->lp_noise_float = st->hFdCngDec->lp_noise_float; - ApplyFdCng_flt( output, NULL, realBuffer, imagBuffer, st, concealWholeFrame, 0 ); + ApplyFdCng( output, NULL, realBuffer, imagBuffer, st, concealWholeFrame, 0 ); /* Generate additional comfort noise to mask potential coding artefacts */ if ( st->m_frame_type == ACTIVE_FRAME && st->flag_cna ) { - generate_masking_noise_flt( output, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, NULL, -1 ); + generate_masking_noise( output, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, NULL, -1 ); } } @@ -704,7 +704,7 @@ ivas_error evs_dec_flt( /* Generate additional comfort noise to mask potential coding artefacts */ if ( st->flag_cna ) { - generate_masking_noise_flt( timeDomainBuffer, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, NULL, -1 ); + generate_masking_noise( timeDomainBuffer, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, NULL, -1 ); } else if ( st->L_frame == L_FRAME16k && st->last_flag_cna == 1 && ( ( st->last_core == ACELP_CORE && st->last_coder_type != AUDIO ) || st->last_core == TCX_20_CORE || st->last_core == AMR_WB_CORE ) ) { diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index 39a39689280f3e9f6abfea34a9914d230bfccbe1..0952a63593494f2bc72e3a37eedb8d51e864f0ba 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -999,7 +999,7 @@ ivas_error evs_dec_fx( ****************************************/ HANDLE_FD_CNG_DEC hFdCngDec = st_fx->hFdCngDec; move16(); - noisy_speech_detection(st_fx->hFdCngDec, st_fx->VAD && st_fx->m_frame_type == ACTIVE_FRAME, output_sp, 0); + noisy_speech_detection_fx(st_fx->hFdCngDec, st_fx->VAD && st_fx->m_frame_type == ACTIVE_FRAME, output_sp, 0); hFdCngDec->hFdCngCom->likelihood_noisy_speech = mult_r(hFdCngDec->hFdCngCom->likelihood_noisy_speech, 32440/*0.99 Q15*/); IF ( hFdCngDec->hFdCngCom->flag_noisy_speech != 0 ) @@ -1010,15 +1010,15 @@ ivas_error evs_dec_fx( st_fx->lp_noise = hFdCngDec->lp_noise; move32(); #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - ApplyFdCng(output, NULL, realBuffer, imagBuffer, st, concealWholeFrame, 0); + ApplyFdCng_fx(output, NULL, realBuffer, imagBuffer, st, concealWholeFrame, 0); #else - ApplyFdCng( output_sp, 0, realBuffer, imagBuffer, &st_fx->scaleFactor.hb_scale, st_fx, concealWholeFrame, 0); + ApplyFdCng_fx( output_sp, 0, realBuffer, imagBuffer, &st_fx->scaleFactor.hb_scale, st_fx, concealWholeFrame, 0); #endif /* Generate additional comfort noise to mask potential coding artefacts */ test(); IF( EQ_16(st_fx->m_frame_type,ACTIVE_FRAME)&&st_fx->flag_cna) { - generate_masking_noise( output_sp, 0, hFdCngDec->hFdCngCom, hFdCngDec->hFdCngCom->frameSize, 0 ); + generate_masking_noise_fx( output_sp, 0, hFdCngDec->hFdCngCom, hFdCngDec->hFdCngCom->frameSize, 0 ); } } @@ -1068,7 +1068,7 @@ ivas_error evs_dec_fx( /* Generate additional comfort noise to mask potential coding artefacts */ IF( st_fx->flag_cna ) { - generate_masking_noise( timeDomainBuffer, 0, st_fx->hFdCngDec->hFdCngCom, st_fx->hFdCngDec->hFdCngCom->frameSize, 0 ); + generate_masking_noise_fx( timeDomainBuffer, 0, st_fx->hFdCngDec->hFdCngCom, st_fx->hFdCngDec->hFdCngCom->frameSize, 0 ); } ELSE IF( EQ_16(st_fx->L_frame,L_FRAME16k)&&EQ_16(st_fx->last_flag_cna,1)&&((EQ_16(st_fx->last_core,ACELP_CORE)&&NE_16(st_fx->last_coder_type,AUDIO))||EQ_16(st_fx->last_core,TCX_20_CORE)||EQ_16(st_fx->last_core,AMR_WB_CORE))) { diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 3831b1d78f60177933a64600b494c4f86072009d..b774056583f790caf6556e247d478a9a05dafa7c 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -75,16 +75,16 @@ * Local fucntions declarations *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED -static void perform_noise_estimation_dec_flt( const float *timeDomainInput, float *power_spectrum, HANDLE_FD_CNG_DEC hFdCngDec, const int16_t element_mode, const int16_t bwidth, const int16_t L_frame, const int16_t last_L_frame, const int32_t last_core_brate, const int16_t VAD ); +static void perform_noise_estimation_dec( const float *timeDomainInput, float *power_spectrum, HANDLE_FD_CNG_DEC hFdCngDec, const int16_t element_mode, const int16_t bwidth, const int16_t L_frame, const int16_t last_L_frame, const int32_t last_core_brate, const int16_t VAD ); #endif // IVAS_FLOAT_FIXED /*------------------------------------------------------------------- - * createFdCngDec_flt() + * createFdCngDec() * * Create an instance of type FD_CNG *-------------------------------------------------------------------*/ -ivas_error createFdCngDec_flt( +ivas_error createFdCngDec( HANDLE_FD_CNG_DEC *hFdCngDec ) { HANDLE_FD_CNG_DEC hs; @@ -112,12 +112,12 @@ ivas_error createFdCngDec_flt( /*------------------------------------------------------------------- - * initFdCngDec_flt() + * initFdCngDec() * * Initialize an instance of type FD_CNG *-------------------------------------------------------------------*/ -void initFdCngDec_flt( +void initFdCngDec( DEC_CORE_HANDLE st /* i/o: decoder state structure */ ) { @@ -206,12 +206,12 @@ void initFdCngDec_flt( #ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- - * configureFdCngDec_flt() + * configureFdCngDec() * * Configure an instance of type FD_CNG *-------------------------------------------------------------------*/ -void configureFdCngDec_flt( +void configureFdCngDec( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const int16_t bwidth, const int32_t total_brate, @@ -325,11 +325,7 @@ void configureFdCngDec_flt( hsCom->startBand = 2; hsCom->stopBand = hsCom->FdCngSetup.sidPartitions[hsCom->FdCngSetup.numPartitions - 1] + 1; -#ifndef IVAS_FLOAT_FIXED initPartitions_flt( hsCom->FdCngSetup.sidPartitions, hsCom->FdCngSetup.numPartitions, hsCom->startBand, hsCom->stopBand, hsCom->part, &hsCom->npart, hsCom->midband, hsCom->psize_flt, hsCom->psize_inv_flt, 0 ); -#else // IVAS_FLOAT_FIXED - initPartitions(hsCom->FdCngSetup.sidPartitions, hsCom->FdCngSetup.numPartitions, hsCom->startBand, hsCom->stopBand, hsCom->part, &hsCom->npart, hsCom->midband, hsCom->psize, hsCom->psize_norm, &hsCom->psize_norm_exp, hsCom->psize_inv, 0); -#endif // IVAS_FLOAT_FIXED if ( hsCom->stopFFTbin == 160 ) { @@ -355,11 +351,7 @@ void configureFdCngDec_flt( { stopBandFR = hsCom->stopFFTbin; } -#ifndef IVAS_FLOAT_FIXED initPartitions_flt( hsCom->FdCngSetup.shapingPartitions, hsCom->FdCngSetup.numShapingPartitions, hsCom->startBand, hsCom->stopFFTbin, hFdCngDec->part_shaping, &hFdCngDec->npart_shaping, hFdCngDec->midband_shaping, hFdCngDec->psize_shaping_float, hFdCngDec->psize_inv_shaping_float, stopBandFR ); -#else // IVAS_FLOAT_FIXED - initPartitions( hsCom->FdCngSetup.shapingPartitions, hsCom->FdCngSetup.numShapingPartitions, hsCom->startBand, hsCom->stopFFTbin, hFdCngDec->part_shaping, &hFdCngDec->npart_shaping, hFdCngDec->midband_shaping, hFdCngDec->psize_shaping, hFdCngDec->psize_shaping_norm, &hFdCngDec->psize_shaping_norm_exp, hFdCngDec->psize_inv_shaping, stopBandFR ); -#endif // IVAS_FLOAT_FIXED hFdCngDec->nFFTpart_shaping = hFdCngDec->npart_shaping; @@ -369,21 +361,11 @@ void configureFdCngDec_flt( hsCom->fftSineTab_flt = NULL; hsCom->olapWinAna_flt = olapWinAna512; hsCom->olapWinSyn_flt = olapWinSyn256; -#ifdef IVAS_FLOAT_FIXED - hsCom->olapWinAna_fx = olapWinAna512_fx; - hsCom->fftSineTab_fx = NULL; - hsCom->olapWinSyn_fx = olapWinSyn256_fx; -#endif break; case 640: hsCom->fftSineTab_flt = fftSineTab640; hsCom->olapWinAna_flt = olapWinAna640; hsCom->olapWinSyn_flt = olapWinSyn320; -#ifdef IVAS_FLOAT_FIXED - hsCom->olapWinAna_fx = olapWinAna640_fx; - hsCom->fftSineTab_fx = fftSineTab640_fx; - hsCom->olapWinSyn_fx = olapWinSyn320_fx; -#endif break; default: assert( !"Unsupported FFT length for FD-based CNG" ); @@ -395,7 +377,7 @@ void configureFdCngDec_flt( } #endif #ifdef IVAS_FLOAT_FIXED -void configureFdCngDec_fx( +void configureFdCngDec_ivas_fx( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bwidth, const Word32 total_brate, @@ -639,12 +621,12 @@ void configureFdCngDec_fx( #endif /*------------------------------------------------------------------- - * deleteFdCngDec_flt() + * deleteFdCngDec() * * Delete the instance of type FD_CNG *-------------------------------------------------------------------*/ -void deleteFdCngDec_flt( +void deleteFdCngDec( HANDLE_FD_CNG_DEC *hFdCngDec ) { HANDLE_FD_CNG_DEC hsDec = *hFdCngDec; @@ -661,12 +643,12 @@ void deleteFdCngDec_flt( /*------------------------------------------------------------------- - * ApplyFdCng_flt() + * ApplyFdCng() * * Apply the CLDFB-based CNG at the decoder *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED -void ApplyFdCng_flt( +void ApplyFdCng( float *timeDomainInput, float *powerSpectrum, float **realBuffer, /* i/o: Real part of the buffer */ @@ -685,7 +667,7 @@ void ApplyFdCng_flt( int16_t L_frame, last_L_frame; int32_t sr_core; - push_wmops( "ApplyFdCng_flt" ); + push_wmops( "ApplyFdCng" ); /* limit L_frame and core Fs values for MDCT-Stereo modes which can have higher core sampling than 16kHz, but use a downsampled buffer */ L_frame = min( st->L_frame, L_FRAME16k ); @@ -725,7 +707,7 @@ void ApplyFdCng_flt( ( !st->BER_detect ) ) { /* Perform noise estimation at the decoder */ - perform_noise_estimation_dec_flt( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); + perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); if ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT ) { @@ -772,7 +754,7 @@ void ApplyFdCng_flt( if ( hFdCngCom->active_frame_counter > 0 ) { /* Perform noise estimation in active frames in the decoder for downward updates */ - perform_noise_estimation_dec_flt( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); + perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); } } @@ -814,7 +796,7 @@ void ApplyFdCng_flt( if ( st != NULL && st->cng_type == LP_CNG ) { /* Perform noise estimation on inactive phase at the decoder */ - perform_noise_estimation_dec_flt( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); + perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); if ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT ) { @@ -899,7 +881,7 @@ void ApplyFdCng_flt( if ( st->codec_mode == MODE2 ) { /* Generate comfort noise during SID or zero frames */ - generate_comfort_noise_dec_flt( realBuffer, imagBuffer, st, -1 ); + generate_comfort_noise_dec( realBuffer, imagBuffer, st, -1 ); } break; @@ -916,12 +898,12 @@ void ApplyFdCng_flt( /*------------------------------------------------------------------- - * perform_noise_estimation_dec_flt() + * perform_noise_estimation_dec() * * Perform noise estimation at the decoder *-------------------------------------------------------------------*/ -static void perform_noise_estimation_dec_flt( +static void perform_noise_estimation_dec( const float *timeDomainInput, float *power_spectrum, HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure containing all buffers and variables */ @@ -1237,24 +1219,7 @@ static void perform_noise_estimation_dec_flt( DEC, element_mode ); /* Expand MS outputs */ -#ifdef IVAS_FLOAT_FIXED - Word16 logNoiseFx[NPART_SHAPING]; - Word32 noiseFx[NPART_SHAPING]; - Word16 q_out; - for (int ii = 0; ii < npart; ii++) - { - logNoiseFx[ii] = (Word16)(msLogNoiseEst[ii] * pow(2, Q9)); - } - expand_range(logNoiseFx, noiseFx, &q_out, npart); - - for (int ii = 0; ii < npart; ii++) - { - /* converting back to float. */ - msNoiseEst[ii] = (float)(noiseFx[ii] * pow(2, q_out - 31)); - } -#else expand_range_flt( msLogNoiseEst, msNoiseEst, npart ); -#endif } return; @@ -1262,12 +1227,12 @@ static void perform_noise_estimation_dec_flt( #endif /*------------------------------------------------------------------- - * FdCng_decodeSID_flt() + * FdCng_decodeSID() * * Decode the FD-CNG bitstream *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED -void FdCng_decodeSID_flt( +void FdCng_decodeSID( Decoder_State *st /* i/o: decoder state structure */ ) { @@ -1346,7 +1311,7 @@ void FdCng_decodeSID_flt( #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- - * FdCng_decodeSID_flt() + * FdCng_decodeSID_ivas_fx() * * Decode the FD-CNG bitstream *-------------------------------------------------------------------*/ @@ -1446,12 +1411,12 @@ void FdCng_decodeSID_ivas_fx( #endif /*------------------------------------------------------------------- - * noisy_speech_detection_flt() + * noisy_speech_detection() * * *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED -void noisy_speech_detection_flt( +void noisy_speech_detection( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure */ const int16_t vad, /* i : VAD flag */ const float syn[] /* i : input time-domain frame */ @@ -1483,12 +1448,12 @@ void noisy_speech_detection_flt( #endif /*------------------------------------------------------------------- - * generate_comfort_noise_dec_flt() + * generate_comfort_noise_dec() * * Generate the comfort noise based on the target noise level *-------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED -void generate_comfort_noise_dec_flt( +void generate_comfort_noise_dec( float **bufferReal, /* o : Real part of input bands */ float **bufferImag, /* o : Imaginary part of input bands */ Decoder_State *st, /* i/o: decoder state structure */ @@ -1751,12 +1716,12 @@ void generate_comfort_noise_dec_flt( #endif #ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- - * generate_comfort_noise_dec_hf_flt() + * generate_comfort_noise_dec_hf() * * Generate the comfort noise based on the target noise level for the CLDFB part *-------------------------------------------------------------------*/ -void generate_comfort_noise_dec_hf_flt( +void generate_comfort_noise_dec_hf( float **bufferReal, /* o : Real part of input bands */ float **bufferImag, /* o : Imaginary part of input bands */ HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ @@ -1825,12 +1790,12 @@ void generate_comfort_noise_dec_hf_flt( #endif /*------------------------------------------------------------------- - * generate_masking_noise_flt() + * generate_masking_noise() * * Generate additional comfort noise (kind of noise filling) *-------------------------------------------------------------------*/ - -void generate_masking_noise_flt( +#ifndef IVAS_FLOAT_FIXED +void generate_masking_noise( float *timeDomainBuffer, /* i/o: time-domain signal */ HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ const int16_t length, /* i : frame size */ @@ -1842,7 +1807,6 @@ void generate_masking_noise_flt( const int16_t nchan_out /* i : number of output channels */ ) { -#ifndef IVAS_FLOAT_FIXED float *cngNoiseLevel_flt = hFdCngCom->cngNoiseLevel_flt; float *ptr_level = cngNoiseLevel_flt; float *fftBuffer = hFdCngCom->fftBuffer_flt; @@ -1932,7 +1896,7 @@ void generate_masking_noise_flt( else { /* very low level case - update random seeds and reset FFT buffer; don't fully skip SynthesisSTFT_flt(), because of the buffer updates done there... */ - generate_masking_noise_update_seed_flt( hFdCngCom ); + generate_masking_noise_update_seed( hFdCngCom ); set_f( fftBuffer, 0.f, hFdCngCom->fftlen ); } @@ -1958,26 +1922,8 @@ void generate_masking_noise_flt( } return; -#else - Word32 tdb_temp[L_FRAME16k]; - Word16 tdb_temp_exp; - generate_masking_noise_ivas_fx( tdb_temp, &tdb_temp_exp, hFdCngCom, length, core, 1, secondary, element_mode, hStereoCng, nchan_out ); - if ( return_noise ) - { - for ( Word32 i = 0; i < min( hFdCngCom->frameSize, length ); i++ ) - { - timeDomainBuffer[i] = fix_to_float(tdb_temp[i], tdb_temp_exp ); - } - } - else - { - for ( Word32 i = 0; i < min( hFdCngCom->frameSize, length ); i++ ) - { - timeDomainBuffer[i] += fix_to_float(tdb_temp[i], tdb_temp_exp); - } - } -#endif } +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- @@ -2115,7 +2061,7 @@ void generate_masking_noise_ivas_fx( ELSE { /* very low level case - update random seeds and reset FFT buffer; don't fully skip SynthesisSTFT_flt(), because of the buffer updates done there... */ - generate_masking_noise_update_seed( hFdCngCom ); + generate_masking_noise_update_seed_fx( hFdCngCom ); set_l( fftBuffer_fx, 0, hFdCngCom->fftlen ); } @@ -2150,13 +2096,13 @@ void generate_masking_noise_ivas_fx( #endif /*------------------------------------------------------------------- - * generate_masking_noise_update_seed_flt() + * generate_masking_noise_update_seed() * - * Update seed for scenarios where generate_masking_noise_flt() is + * Update seed for scenarios where generate_masking_noise() is * not called based on signal statistics *-------------------------------------------------------------------*/ -void generate_masking_noise_update_seed_flt( +void generate_masking_noise_update_seed( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ) { @@ -2188,12 +2134,12 @@ void generate_masking_noise_update_seed_flt( #ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- - * generate_masking_noise_mdct_flt() + * generate_masking_noise_mdct() * * Generate additional comfort noise (kind of noise filling) *-------------------------------------------------------------------*/ -void generate_masking_noise_mdct_flt( +void generate_masking_noise_mdct( float *mdctBuffer, /* i/o: time-domain signal */ HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ) @@ -2309,11 +2255,11 @@ void generate_stereo_masking_noise( if ( !fadeOut ) { - generate_masking_noise_flt( N1, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out ); + generate_masking_noise( N1, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out ); /* Generate masking noise for secondary channel */ if ( flag_sec_CNA ) { - generate_masking_noise_flt( N2, hFdCngCom, hFdCngCom->frameSize, 0, 1, 1, st->element_mode, hStereoCng, nchan_out ); + generate_masking_noise( N2, hFdCngCom, hFdCngCom->frameSize, 0, 1, 1, st->element_mode, hStereoCng, nchan_out ); gamma = hStereoCng->c_PS_LT * hStereoCng->c_PS_LT; scale = 1.0f; if ( gamma < 0.9f ) @@ -2401,12 +2347,12 @@ void generate_stereo_masking_noise( #endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- - * generate_stereo_masking_noise_16fx() + * generate_stereo_masking_noise_fx() * * Generate additional comfort noise (kind of noise filling) *-------------------------------------------------------------------*/ -void generate_stereo_masking_noise_16fx( +void generate_stereo_masking_noise_fx( Word16 *syn, /* i/o: time-domain signal */ Word16 Q_syn, Decoder_State *st, /* i/o: decoder state structure */ @@ -2437,14 +2383,14 @@ void generate_stereo_masking_noise_16fx( IF(!fadeOut) { - // generate_masking_noise_flt(N1, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out); + // generate_masking_noise(N1, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out); Copy_Scale_sig_16_32( hStereoCng->olapBufferSynth22_fx, hStereoCng->olapBufferSynth22_32fx, hFdCngCom->fftlen, -(st->Q_syn - 15) ); generate_masking_noise_ivas_fx(N1_fx, &N1_fx_exp, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out); // N1_fx Q6 /* Generate masking noise for secondary channel */ IF(flag_sec_CNA) { - // generate_masking_noise_flt(N2, hFdCngCom, hFdCngCom->frameSize, 0, 1, 1, st->element_mode, hStereoCng, nchan_out); + // generate_masking_noise(N2, hFdCngCom, hFdCngCom->frameSize, 0, 1, 1, st->element_mode, hStereoCng, nchan_out); generate_masking_noise_ivas_fx(N2_fx, &N2_fx_exp, hFdCngCom, hFdCngCom->frameSize, 0, 1, 1, st->element_mode, hStereoCng, nchan_out); // N2_fx Q6 // gamma = hStereoCng->c_PS_LT * hStereoCng->c_PS_LT; gamma_fx = L_shr( Mpy_32_32( hStereoCng->c_PS_LT_fx, hStereoCng->c_PS_LT_fx ), 1 ); @@ -2693,7 +2639,7 @@ void generate_masking_noise_lb_dirac( else { /* very low level case - update random seeds */ - generate_masking_noise_update_seed_flt( hFdCngCom ); + generate_masking_noise_update_seed( hFdCngCom ); set_f( fftBuffer, 0.f, hFdCngCom->fftlen ); @@ -2824,7 +2770,7 @@ void generate_masking_noise_lb_dirac_fx( ELSE { /* very low level case - update random seeds */ - generate_masking_noise_update_seed( hFdCngCom ); + generate_masking_noise_update_seed_fx( hFdCngCom ); set32_fx( fftBuffer, 0, hFdCngCom->fftlen ); /* Perform STFT synthesis */ @@ -2944,7 +2890,7 @@ void generate_masking_noise_dirac( } #endif #ifdef IVAS_FLOAT_FIXED -void generate_masking_noise_dirac_fx( +void generate_masking_noise_dirac_ivas_fx( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ HANDLE_CLDFB_FILTER_BANK h_cldfb, /* i : filterbank state */ Word32 *tdBuffer_fx, /* i/o: time-domain signal, if NULL no LB-CNA */ @@ -3328,7 +3274,7 @@ void FdCngDecodeMDCTStereoSID( /*------------------------------------------------------------------- - * FdCngDecodeDiracMDCTStereoSID() + * FdCngDecodeDiracMDCTStereoSID_fx() * * Decode FD-CNG parameters for CNG in 2TC DirAC mode from the bitstream *-------------------------------------------------------------------*/ diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index b856b1af25da9ec138585b7057a8b0a0fdec3513..b2d730debe44f646395700fc840ef84afb6bbb18 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -35,7 +35,7 @@ const Word16 maxN_37bits = FD_CNG_maxN_37bits; const Word16 maxC_37bits = FD_CNG_maxC_37bits; const Word16 stages_37bits = FD_CNG_stages_37bits; /* - createFdCngDec + createFdCngDec_fx Parameters: @@ -44,7 +44,7 @@ const Word16 stages_37bits = FD_CNG_stages_37bits; Function: create an instance of type FD_CNG */ -ivas_error createFdCngDec (HANDLE_FD_CNG_DEC *hFdCngDec) +ivas_error createFdCngDec_fx (HANDLE_FD_CNG_DEC *hFdCngDec) { HANDLE_FD_CNG_DEC hs; ivas_error error; @@ -67,7 +67,7 @@ ivas_error createFdCngDec (HANDLE_FD_CNG_DEC *hFdCngDec) } #ifdef IVAS_FLOAT_FIXED -void ivas_initFdCngDec_fx( +void initFdCngDec_ivas_fx( DEC_CORE_HANDLE st, /* i/o: decoder state structure */ Word16 scale ) { @@ -184,7 +184,7 @@ void ivas_initFdCngDec_fx( return; } #endif -void initFdCngDec( +void initFdCngDec_fx( DEC_CORE_HANDLE st, /* i/o: decoder state structure */ Word16 scale ) @@ -296,7 +296,7 @@ void initFdCngDec( } /* - configureFdCngDec + configureFdCngDec_fx Parameters: @@ -312,7 +312,7 @@ void initFdCngDec( Returns: void */ -void configureFdCngDec ( +void configureFdCngDec_fx ( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the CLDFB-based CNG process */ Word16 bwidth, Word32 total_brate, @@ -527,7 +527,7 @@ void configureFdCngDec ( /* - deleteFdCngDec + deleteFdCngDec_fx Parameters: @@ -539,7 +539,7 @@ void configureFdCngDec ( Returns: void */ -void deleteFdCngDec (HANDLE_FD_CNG_DEC *hFdCngDec) +void deleteFdCngDec_fx (HANDLE_FD_CNG_DEC *hFdCngDec) { HANDLE_FD_CNG_DEC hsDec = *hFdCngDec; @@ -553,7 +553,7 @@ void deleteFdCngDec (HANDLE_FD_CNG_DEC *hFdCngDec) /* - ApplyFdCng + ApplyFdCng_fx Parameters: @@ -574,7 +574,7 @@ void deleteFdCngDec (HANDLE_FD_CNG_DEC *hFdCngDec) Returns: error */ -Word16 ApplyFdCng ( +Word16 ApplyFdCng_fx ( Word16 *timeDomainInput, /* i : pointer to time domain input */ Word16 Q, #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT @@ -676,9 +676,9 @@ Word16 ApplyFdCng ( { /* Perform noise estimation at the decoder */ #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - perform_noise_estimation_dec(timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD); + perform_noise_estimation_dec_fx(timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD); #else - perform_noise_estimation_dec (timeDomainInput, Q, hFdCngDec); + perform_noise_estimation_dec_fx (timeDomainInput, Q, hFdCngDec); #endif /* Update the shaping parameters */ @@ -853,9 +853,9 @@ Word16 ApplyFdCng ( { /* Perform noise estimation in active frames in the decoder for downward updates */ #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - perform_noise_estimation_dec(timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD); + perform_noise_estimation_dec_fx(timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD); #else - perform_noise_estimation_dec(timeDomainInput, Q, hFdCngDec); + perform_noise_estimation_dec_fx(timeDomainInput, Q, hFdCngDec); #endif } } @@ -944,9 +944,9 @@ Word16 ApplyFdCng ( { /* Perform noise estimation on inactive phase at the decoder */ #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - perform_noise_estimation_dec(timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD); + perform_noise_estimation_dec_fx(timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD); #else - perform_noise_estimation_dec(timeDomainInput, Q, hFdCngDec); + perform_noise_estimation_dec_fx(timeDomainInput, Q, hFdCngDec); #endif /* Update the shaping parameters */ @@ -1162,7 +1162,7 @@ Word16 ApplyFdCng ( IF ( EQ_16(st->codec_mode, MODE2)) { /* Generate comfort noise during SID or zero frames */ - generate_comfort_noise_dec (cldfbBufferReal, cldfbBufferImag, cldfbBufferScale, st, &(st->Q_exc), 2, -1); + generate_comfort_noise_dec_fx (cldfbBufferReal, cldfbBufferImag, cldfbBufferScale, st, &(st->Q_exc), 2, -1); } BREAK; @@ -1176,7 +1176,7 @@ Word16 ApplyFdCng ( } #ifdef IVAS_FLOAT_FIXED -Word16 ApplyFdCng_fx( +Word16 ApplyFdCng_ivas_fx( Word16 *timeDomainInput, /* i : pointer to time domain input */ Word16 Q, Word32 *powerSpectrum, @@ -1271,7 +1271,7 @@ Word16 ApplyFdCng_fx( ( !st->BER_detect ) ) { /* Perform noise estimation at the decoder */ - perform_noise_estimation_dec_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); + perform_noise_estimation_dec_ivas_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); /* Update the shaping parameters */ test(); @@ -1539,7 +1539,7 @@ Word16 ApplyFdCng_fx( IF( hFdCngCom->active_frame_counter > 0 ) { /* Perform noise estimation in active frames in the decoder for downward updates */ - perform_noise_estimation_dec_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); + perform_noise_estimation_dec_ivas_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); } } test(); @@ -1598,7 +1598,7 @@ Word16 ApplyFdCng_fx( IF( st != NULL && EQ_16( st->cng_type, LP_CNG ) ) { /* Perform noise estimation on inactive phase at the decoder */ - perform_noise_estimation_dec_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); + perform_noise_estimation_dec_ivas_fx( timeDomainInput, Q, powerSpectrum, Q_power_spectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); /* Update the shaping parameters */ @@ -1861,7 +1861,7 @@ Word16 ApplyFdCng_fx( IF( EQ_16( st->codec_mode, MODE2 ) ) { /* Generate comfort noise during SID or zero frames */ - generate_comfort_noise_dec( cldfbBufferReal, cldfbBufferImag, cldfbBufferScale, st, &( st->Q_exc ), 2, -1 ); + generate_comfort_noise_dec_fx( cldfbBufferReal, cldfbBufferImag, cldfbBufferScale, st, &( st->Q_exc ), 2, -1 ); } BREAK; @@ -1876,7 +1876,7 @@ Word16 ApplyFdCng_fx( #endif // IVAS_FLOAT_FIXED /* - perform_noise_estimation_dec + perform_noise_estimation_dec_fx Parameters: @@ -1890,7 +1890,7 @@ Word16 ApplyFdCng_fx( Returns: void */ -void perform_noise_estimation_dec ( +void perform_noise_estimation_dec_fx ( const Word16 *timeDomainInput, /* i: pointer to time domain input */ const Word16 Q, #ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT @@ -2339,7 +2339,7 @@ void perform_noise_estimation_dec ( } #ifdef IVAS_FLOAT_FIXED -void perform_noise_estimation_dec_fx( +void perform_noise_estimation_dec_ivas_fx( const Word16 *timeDomainInput, /* i: pointer to time domain input */ const Word16 Q, Word32 *power_spectrum, @@ -2951,7 +2951,7 @@ void perform_noise_estimation_dec_fx( /* - FdCng_decodeSID + FdCng_decodeSID_fx Parameters: @@ -2966,7 +2966,7 @@ void perform_noise_estimation_dec_fx( Returns: void */ -void FdCng_decodeSID (HANDLE_FD_CNG_COM st, Decoder_State *corest) +void FdCng_decodeSID_fx (HANDLE_FD_CNG_COM st, Decoder_State *corest) { Word16 i, N, index; Word32 *sidNoiseEst; @@ -3094,7 +3094,7 @@ void FdCng_decodeSID (HANDLE_FD_CNG_COM st, Decoder_State *corest) /* - noisy_speech_detection + noisy_speech_detection_fx Parameters: @@ -3113,7 +3113,7 @@ void FdCng_decodeSID (HANDLE_FD_CNG_COM st, Decoder_State *corest) void */ -void noisy_speech_detection ( +void noisy_speech_detection_fx ( HANDLE_FD_CNG_DEC hFdCngDec,/* i/o: FD_CNG structure */ const Word16 vad, const Word16 * syn, /* i : input time-domain frame */ @@ -3224,7 +3224,7 @@ void noisy_speech_detection ( void -generate_comfort_noise_dec ( +generate_comfort_noise_dec_fx ( Word32 **bufferReal, /* o : matrix to real part of input bands */ Word32 **bufferImag, /* o : matrix to imaginary part of input bands */ Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of input bands */ @@ -3640,7 +3640,7 @@ generate_comfort_noise_dec ( void -generate_comfort_noise_dec_hf ( +generate_comfort_noise_dec_hf_fx ( Word32 **bufferReal, /* o : matrix to real part of input bands */ Word32 **bufferImag, /* o : matrix to imaginary part of input bands */ Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of input bands */ @@ -3841,7 +3841,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( /* - generate_masking_noise + generate_masking_noise_fx Parameters: @@ -3856,7 +3856,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( void */ -void generate_masking_noise ( +void generate_masking_noise_fx ( Word16 *timeDomainBuffer, /* i/o : pointer to time domain output buffer 15Q0 */ Word16 Q, HANDLE_FD_CNG_COM hFdCngCom /* i/o : pointer to FD_CNG_COM structure */ @@ -4042,13 +4042,13 @@ void generate_masking_noise ( } /*------------------------------------------------------------------- - * generate_masking_noise_update_seed() + * generate_masking_noise_update_seed_fx() * - * Update seed for scenarios where generate_masking_noise() is + * Update seed for scenarios where generate_masking_noise_fx() is * not called based on signal statistics *-------------------------------------------------------------------*/ -void generate_masking_noise_update_seed ( +void generate_masking_noise_update_seed_fx ( HANDLE_FD_CNG_COM hFdCngCom /* i/o : pointer to FD_CNG_COM structure */ ) { @@ -4080,7 +4080,7 @@ void generate_masking_noise_update_seed ( /************************************************************ * Generate additional comfort noise (kind of noise filling) * ************************************************************/ -void generate_masking_noise_mdct ( +void generate_masking_noise_mdct_fx ( Word32 *mdctBuffer, /* i/o: time-domain signal */ Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */ HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ @@ -4284,11 +4284,11 @@ void generate_stereo_masking_noise( if (!fadeOut) { - generate_masking_noise(N1, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out); + generate_masking_noise_fx(N1, hFdCngCom, hFdCngCom->frameSize, 0, 1, 0, st->element_mode, hStereoCng, nchan_out); /* Generate masking noise for secondary channel */ if (flag_sec_CNA) { - generate_masking_noise(N2, hFdCngCom, hFdCngCom->frameSize, 0, 1, 1, st->element_mode, hStereoCng, nchan_out); + generate_masking_noise_fx(N2, hFdCngCom, hFdCngCom->frameSize, 0, 1, 1, st->element_mode, hStereoCng, nchan_out); gamma = hStereoCng->c_PS_LT * hStereoCng->c_PS_LT; scale = 1.0f; if (gamma < 0.9f) @@ -4511,7 +4511,7 @@ void generate_masking_noise_dirac( if (slot_index == 0) { /* very low level case - update random seeds */ - generate_masking_noise_update_seed(hFdCngCom); + generate_masking_noise_update_seed_fx(hFdCngCom); set_f(fftBuffer, 0.f, hFdCngCom->fftlen); diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index 244aa115e22788b4900565efa9718996eb396004..5c4b16a5625ea72020226985128b09a337da2734 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -377,7 +377,7 @@ void hq_core_dec( /* LB synthesis */ - IMDCT( t_audio_q_fx, E_audio, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio_16_fx, tcx_cfg->tcx_aldo_window_1, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, + IMDCT_fx( t_audio_q_fx, E_audio, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio_16_fx, tcx_cfg->tcx_aldo_window_1, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, 0, st->bfi, hHQ_core->old_out_LB_fx, &hHQ_core->Q_old_wtda_LB, st, 0, acelp_zir_fx ); Scale_sig( wtda_audio_16_fx + L_frame, overlap, Q1 ); @@ -386,7 +386,7 @@ void hq_core_dec( /* FB synthesis */ - IMDCT( t_audio_q_fx, E_audio, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio_16_fx, tcx_cfg->tcx_aldo_window_1_FB, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, + IMDCT_fx( t_audio_q_fx, E_audio, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio_16_fx, tcx_cfg->tcx_aldo_window_1_FB, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, 0, st->bfi, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir_fx ); Scale_sig( wtda_audio_16_fx + L_frameTCX, overlapFB, Q1 ); @@ -441,14 +441,14 @@ void hq_core_dec( /* LB synthesis */ - IMDCT_flt( t_audio_q, hTcxDec->syn_Overl_float, hTcxDec->syn_Overl_TDAC_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc_flt, tcx_cfg->tcx_aldo_window_2_flt, tcx_cfg->tcx_mdct_window_half_flt, tcx_cfg->tcx_mdct_window_minimum_flt, tcx_cfg->tcx_mdct_window_trans_flt, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, + IMDCT( t_audio_q, hTcxDec->syn_Overl_float, hTcxDec->syn_Overl_TDAC_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc_flt, tcx_cfg->tcx_aldo_window_2_flt, tcx_cfg->tcx_mdct_window_half_flt, tcx_cfg->tcx_mdct_window_minimum_flt, tcx_cfg->tcx_mdct_window_trans_flt, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, MDCT_IV, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, 0, st->bfi, hHQ_core->old_outLB, 0, st, 0, acelp_zir ); mvr2r( wtda_audio + ( overlap >> 1 ) - tcx_offset, output, L_frame_glob ); /* FB synthesis */ - IMDCT_flt( t_audio_q, hTcxDec->syn_OverlFB_float, hTcxDec->syn_Overl_TDACFB_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc_flt, tcx_cfg->tcx_aldo_window_2_FB_flt, tcx_cfg->tcx_mdct_window_halfFB_flt, tcx_cfg->tcx_mdct_window_minimumFB_flt, tcx_cfg->tcx_mdct_window_transFB_flt, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, + IMDCT( t_audio_q, hTcxDec->syn_OverlFB_float, hTcxDec->syn_Overl_TDACFB_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc_flt, tcx_cfg->tcx_aldo_window_2_FB_flt, tcx_cfg->tcx_mdct_window_halfFB_flt, tcx_cfg->tcx_mdct_window_minimumFB_flt, tcx_cfg->tcx_mdct_window_transFB_flt, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, MDCT_IV, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, 0, st->bfi, hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); mvr2r( wtda_audio + ( overlapFB >> 1 ) - tcx_offsetFB, synth, L_frameTCX_glob ); diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index 60daf629b7cea54ff4bf50870fae191ba7ea4a2c..d033fdef08cb32da075f2a45dce31d71c29e6f9d 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -358,13 +358,13 @@ void hq_core_dec_fx( index = tcx_cfg->tcx_last_overlap_mode; /* LB synthesis */ - IMDCT(t_audio_q, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, + IMDCT_fx(t_audio_q, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, MDCT_IV, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max(L_frameTCX, L_spec) >> 1, L_frame_glob, 0, st->bfi, hHQ_core->old_outLB, 0, st, 0, acelp_zir); mvr2r(wtda_audio + (overlap >> 1) - tcx_offset, output, L_frame_glob); /* FB synthesis */ - IMDCT(t_audio_q, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, + IMDCT_fx(t_audio_q, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, MDCT_IV, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max(L_frameTCX, L_spec) >> 1, L_frameTCX_glob, 0, st->bfi, hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir); mvr2r(wtda_audio + (overlapFB >> 1) - tcx_offsetFB, synth, L_frameTCX_glob); @@ -961,7 +961,7 @@ void ivas_hq_core_dec_fx( /* LB synthesis */ E_audio = 31 - Q_audio; move16(); - IMDCT( t_audio_q, E_audio, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio_16, tcx_cfg->tcx_aldo_window_1, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, + IMDCT_fx( t_audio_q, E_audio, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio_16, tcx_cfg->tcx_aldo_window_1, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, 0, st_fx->bfi, hHQ_core->old_out_LB_fx, &hHQ_core->Q_old_wtda_LB, st_fx, 0, acelp_zir ); // values till L_frame same @@ -971,7 +971,7 @@ void ivas_hq_core_dec_fx( /* FB synthesis */ - IMDCT( t_audio_q, E_audio, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio_16, tcx_cfg->tcx_aldo_window_1_FB, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, + IMDCT_fx( t_audio_q, E_audio, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio_16, tcx_cfg->tcx_aldo_window_1_FB, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, 0, st_fx->bfi, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, st_fx, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); Scale_sig( wtda_audio_16 + L_frameTCX, overlapFB, Q1 ); diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 04d294df1ef5ffa792570d8d8f43b3b8c5d72304..258536bce0a7969875a90e90733dc563b4c9fdc4 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -759,16 +759,16 @@ ivas_error init_decoder( if ( ( st->element_mode == IVAS_CPE_MDCT || idchan == 0 ) && mc_mode != MC_MODE_MCT && mc_mode != MC_MODE_PARAMUPMIX ) { /* Create FD_CNG instance */ - if ( ( error = createFdCngDec_flt( &st->hFdCngDec ) ) != IVAS_ERR_OK ) + if ( ( error = createFdCngDec( &st->hFdCngDec ) ) != IVAS_ERR_OK ) { return error; } /* Init FD-CNG */ - initFdCngDec_flt( st ); + initFdCngDec( st ); #ifdef IVAS_FLOAT_FIXED st->cldfbSyn->scale = (Word16) ( st->cldfbSyn->scale_flt * ( 1u << norm_s( (Word16) st->cldfbSyn->scale_flt ) ) ); - initFdCngDec( st, st->cldfbSyn->scale ); + initFdCngDec_fx( st, st->cldfbSyn->scale ); #endif // IVAS_FLOAT_FIXED } else @@ -838,7 +838,7 @@ void destroy_cldfb_decoder_ivas_fx( deleteCldfb_ivas_fx( &st->cldfbSyn ); /* delete synthesis at output sampling rate */ deleteCldfb_ivas_fx( &st->cldfbSynHB ); - deleteFdCngDec( &st->hFdCngDec ); + deleteFdCngDec_fx( &st->hFdCngDec ); return; } @@ -854,7 +854,7 @@ void destroy_cldfb_decoder_flt( deleteCldfb_ivas( &st->cldfbSyn ); /* delete synthesis at output sampling rate */ deleteCldfb_ivas( &st->cldfbSynHB ); - deleteFdCngDec_flt( &st->hFdCngDec ); + deleteFdCngDec( &st->hFdCngDec ); return; } diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 880628a176ccaef805ff32e27c7458ff7acbaf36..eb61ce095900e7deaf961b499ce71de30314751f 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -762,13 +762,13 @@ ivas_error init_decoder_fx( { /* Create FD_CNG instance */ - if ((error = createFdCngDec(&st_fx->hFdCngDec)) != IVAS_ERR_OK ) + if ((error = createFdCngDec_fx(&st_fx->hFdCngDec)) != IVAS_ERR_OK ) { return error; } /* Init FD-CNG */ - initFdCngDec( st_fx, st_fx->cldfbSyn->scale ); + initFdCngDec_fx( st_fx, st_fx->cldfbSyn->scale ); } ELSE { @@ -1924,16 +1924,16 @@ ivas_error init_decoder_ivas_fx( { /* Create FD_CNG instance */ - IF ((error = createFdCngDec(&st_fx->hFdCngDec)) != IVAS_ERR_OK) + IF ((error = createFdCngDec_fx(&st_fx->hFdCngDec)) != IVAS_ERR_OK) { return error; } /* Init FD-CNG */ #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - initFdCngDec_flt(st_fx); + initFdCngDec(st_fx); #endif - ivas_initFdCngDec_fx(st_fx, st_fx->cldfbSyn->scale); + initFdCngDec_ivas_fx(st_fx, st_fx->cldfbSyn->scale); } ELSE { @@ -2044,7 +2044,7 @@ void destroy_cldfb_decoder_fx( /* delete synthesis for output SR */ deleteCldfb(&st_fx->cldfbSyn); - deleteFdCngDec( &st_fx->hFdCngDec ); + deleteFdCngDec_fx( &st_fx->hFdCngDec ); return; } diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index b2319820276906ad3a77ca4d645d433829427ad9..f4fe287de3be7f4a4b6e9e10c0c9428d521fd39d 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -105,14 +105,14 @@ ivas_error ivas_core_dec( STEREO_ICBWE_DEC_HANDLE hStereoICBWE; STEREO_TD_DEC_DATA_HANDLE hStereoTD; int16_t sharpFlag[CPE_CHANNELS]; - float synth[CPE_CHANNELS][L_FRAME48k]; - float tmp_buffer[L_FRAME48k]; + //float synth[CPE_CHANNELS][L_FRAME48k]; + //float tmp_buffer[L_FRAME48k]; //float output[CPE_CHANNELS][L_FRAME48k]; //fixedToFloat_arrL(output_32_fx[0],output[0],Q11,L_FRAME48k); //if(n_channels > 1)fixedToFloat_arrL(output_32_fx[1],output[1],Q11,L_FRAME48k); #ifdef IVAS_FLOAT_FIXED //Word32 synth_fx[CPE_CHANNELS][L_FRAME48k]; - set_zero( tmp_buffer, L_FRAME48k ); + //set_zero( tmp_buffer, L_FRAME48k ); Word16 tmp_buffer_fx[L_FRAME48k]; //Word32 tmp_buffer_fx_32[L_FRAME48k]; set_s(tmp_buffer_fx, 0, L_FRAME48k); @@ -173,6 +173,8 @@ ivas_error ivas_core_dec( Word16 hb_synth_16_fx[CPE_CHANNELS][L_FRAME48k]; //Word32 hb_synth_32_fx[CPE_CHANNELS][L_FRAME48k]; + Word16 synth_16_fx[CPE_CHANNELS][L_FRAME48k]; + Word32 synth_32_fx[CPE_CHANNELS][L_FRAME48k]; FOR( i = 0; i < CPE_CHANNELS; i++ ) { @@ -184,7 +186,7 @@ ivas_error ivas_core_dec( #ifdef IVAS_FLOAT_FIXED //Word16 hb_synth_fx[6][L_FRAME48k]; /*not sure about number of channels so kept it as 6 will change it later*/ //Word16 output_16fx[CPE_CHANNELS][L_FRAME48k]; - Word16 synth_16fx[CPE_CHANNELS][L_FRAME48k]; + //Word16 synth_16fx[CPE_CHANNELS][L_FRAME48k]; Word32 pitch_buf_32fx[CPE_CHANNELS][NB_SUBFR16k]; Word16 tdm_lsfQ_PCh_fx[M], tdm_lspQ_PCh_fx[M]; Word32 conceal_eof_gain32; @@ -618,7 +620,7 @@ ivas_error ivas_core_dec( IF ( st->core == ACELP_CORE ) { /* ACELP core decoder */ - Word16 /*output_fx[L_FRAME48k],*/ synth_fxl[L_FRAME48k], old_syn_12k8_16k_fx_16[L_FRAME16k]; + Word16 /*output_fx[L_FRAME48k],*//* synth_fxl[L_FRAME48k],*/ old_syn_12k8_16k_fx_16[L_FRAME16k]; set_s(output_16_fx[n], 0, L_FRAME48k); Word16 save_hb_synth_fx_arr[L_FRAME48k], *save_hb_synth_16_fx; IF (save_hb_synth_32_fx) { @@ -634,7 +636,6 @@ ivas_error ivas_core_dec( //if (hStereoTD) { // floatToFixed_arr(hStereoTD->tdm_Pri_pitch_buf, hStereoTD->tdm_Pri_pitch_buf_fx, Q6, NB_SUBFR); //} - IF( st->hFdCngDec != NULL ) { Scale_sig32( st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub( st->hFdCngDec->msNoiseEst_exp, 27 ) ); @@ -643,7 +644,7 @@ ivas_error ivas_core_dec( Scale_sig( st->hFdCngDec->hFdCngCom->A_cng, M + 1, norm_s( st->hFdCngDec->hFdCngCom->A_cng[0] - 1 ) - 3 ); } - IF ( ( error = acelp_core_dec_ivas_fx( st, output_16_fx[n], synth_fxl, save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) + IF( ( error = acelp_core_dec_ivas_fx( st, output_16_fx[n], synth_16_fx[n], save_hb_synth_16_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx_16, sharpFlag[n], pitch_buf_fx[n], &unbits[n], &sid_bw[n], hStereoTD, tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, use_cldfb_for_dft, last_element_mode, last_element_brate, flag_sec_CNA, nchan_out, hCPE == NULL ? NULL : hCPE->hStereoCng, read_sid_info ) ) != IVAS_ERR_OK ) { return error; } @@ -653,7 +654,7 @@ ivas_error ivas_core_dec( Scale_sig(output_16_fx[n], L_FRAME48k, -st->Q_syn2); acelp_decoder_state_fix2float(st/*, hCPE == NULL ? NULL : hCPE->hStereoCng*/); //fixedToFloat_arr(output_16_fx[n], output[n], 0, L_FRAME48k); - fixedToFloat_arr(synth_fxl, synth[n], 0, L_FRAME48k); + //fixedToFloat_arr(synth_16_fx[n], synth[n], 0, L_FRAME48k); if ( save_hb_synth_32_fx ) { Copy_Scale_sig_16_32( save_hb_synth_16_fx, save_hb_synth_32_fx, output_frame, Q11 ); @@ -679,11 +680,11 @@ ivas_error ivas_core_dec( Scale_sig32(st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub(st->hFdCngDec->msNoiseEst_exp, 27)); st->hFdCngDec->msNoiseEst_exp = 27; - stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16fx[n], pitch_buf_32fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); + stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16_fx[n], pitch_buf_32fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); //fixedToFloat_arr( output_16_fx[n], output[n], 0, st->L_frame ); Copy_Scale_sig_16_32(output_16_fx[n],output_32_fx[n],L_FRAME48k,Q11); - fixedToFloat_arr( synth_16fx[n], synth[n], 0, st->hTcxDec->L_frameTCX ); + //fixedToFloat_arr( synth_16_fx[n], synth[n], 0, st->hTcxDec->L_frameTCX ); //fixedToFloat_arrL( pitch_buf_32fx[n], pitch_buf[n], Q6, NB_SUBFR16k ); Copy_Scale_sig_32_16(pitch_buf_32fx[n], pitch_buf_fx[n],NB_SUBFR16k,0); @@ -695,7 +696,7 @@ ivas_error ivas_core_dec( if ( st->core == HQ_CORE ) { /* HQ core decoder */ - Word16 synth_fxl[L_FRAME48k]; + //Word16 synth_fxl[L_FRAME48k]; //Word16 output_fx[L_FRAME48k]; Q_synth = 0; Word16 Q_output = 0; @@ -707,7 +708,7 @@ ivas_error ivas_core_dec( st->hHQ_core->Q_old_wtda = -1; st->hHQ_core->Q_old_wtda_LB = -1; - floatToFixed_arr( synth[n], synth_fxl, st->Q_syn, L_FRAME48k ); + //floatToFixed_arr( synth[n], synth_16_fx[n], st->Q_syn, L_FRAME48k ); //floatToFixed_arr( output[n], output_16_fx[n], st->Q_syn, L_FRAME48k ); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED @@ -717,11 +718,12 @@ ivas_error ivas_core_dec( //floatToFixed_arr( st->hTcxDec->prev_good_synth - tmp_size, st->hTcxDec->prev_good_synth_fx - tmp_size, 0, 2 * output_frame + tmp_size ); #endif - ivas_hq_core_dec_fx( st, synth_fxl, &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); + ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); Copy_Scale_sig_16_32(output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 - Q_output); + Scale_sig(synth_16_fx[n], L_FRAME48k, -Q_synth); Scale_sig(output_16_fx[n], L_FRAME48k, -Q_output); - fixedToFloat_arr( synth_fxl, synth[n], Q_synth, L_FRAME48k ); + //fixedToFloat_arr( synth_16_fx[n], synth[n], 0, L_FRAME48k ); //fixedToFloat_arr( output_16_fx[n], output[n], 0, L_FRAME48k ); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED @@ -780,7 +782,7 @@ ivas_error ivas_core_dec( #if 1 Word16 e_sig = 17; //Word32 *output_fx[CPE_CHANNELS]; - Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; + //Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; Word16 ch; sts = hCPE->hCoreCoder; Word16 will_estimate_noise_on_channel[CPE_CHANNELS]; @@ -915,7 +917,7 @@ ivas_error ivas_core_dec( } } #endif - stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_fx_16 ); + stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_16_fx ); #if 1 // Fix to float conversion IF( st_ivas->hLsSetUpConversion ) @@ -1051,8 +1053,11 @@ ivas_error ivas_core_dec( fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, s_min( 480, st->hTonalMDCTConc->nSamples / 2 ) ); } - fixedToFloat_arr( synth_fx_16[0], synth[0], 15 - e_sig, 960 ); - fixedToFloat_arr( synth_fx_16[1], synth[1], 15 - e_sig, 960 ); + Scale_sig(synth_16_fx[0],L_FRAME48k,e_sig - 15); + Scale_sig(synth_16_fx[1],L_FRAME48k,e_sig - 15); + + //fixedToFloat_arr( synth_16_fx[0], synth[0], 0, 960 ); + //fixedToFloat_arr( synth_16_fx[1], synth[1], 0, 960 ); //fixedToFloat_arrL( output_32_fx[0], output[0], Q11, 960 ); //fixedToFloat_arrL( output_32_fx[1], output[1], Q11, 960 ); #endif @@ -1063,8 +1068,8 @@ ivas_error ivas_core_dec( { #ifdef IVAS_FLOAT_FIXED /* To be cleaned up once the caller function is converted // These changes are for system testing of fixed changes made */ - double max_synth = 0.0f; - Word16 Q_syn = 15, synth_fxl[CPE_CHANNELS][L_FRAME48k]; + //double max_synth = 0.0f; + //Word16 Q_syn = 15/*, synth_fxl[CPE_CHANNELS][L_FRAME48k]*/; //double max_output = 0.0f; //Word16 Q_output = 31; //Word32 output_fx[CPE_CHANNELS][L_FRAME48k]; @@ -1074,19 +1079,19 @@ ivas_error ivas_core_dec( if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { - for ( int jj = 0; jj < output_frame; jj++ ) + /*for ( int jj = 0; jj < output_frame; jj++ ) { max_synth = max( max_synth, fabs( synth[0][jj] ) ); } if ( (Word16) max_synth != 0 ) { Q_syn = norm_s( (Word16) max_synth ); - } + }*/ - for ( int jj = 0; jj < output_frame; jj++ ) + /*for ( int jj = 0; jj < output_frame; jj++ ) { - synth_fxl[0][jj] = float_to_fix16( synth[0][jj], Q_syn ); - } + synth_16_fx[0][jj] = float_to_fix16( synth[0][jj], 0 ); + }*/ //for ( int jj = 0; jj < output_frame; jj++ ) //{ @@ -1113,7 +1118,7 @@ ivas_error ivas_core_dec( f2me_buf_16( sts[0]->hHQ_core->old_out, sts[0]->hHQ_core->old_out_fx, &sts[0]->hHQ_core->exp_old_out, L_FRAME48k ); f2me_buf_16( sts[1]->hHQ_core->old_out, sts[1]->hHQ_core->old_out_fx, &sts[1]->hHQ_core->exp_old_out, L_FRAME48k ); } - updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_fxl ); + updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_16_fx ); if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { @@ -1131,13 +1136,13 @@ ivas_error ivas_core_dec( // } //} - for ( i = 1; i < CPE_CHANNELS; i++ ) + /*for ( i = 1; i < CPE_CHANNELS; i++ ) { for ( int jj = 0; jj < output_frame; jj++ ) { - synth[i][jj] = fix16_to_float( synth_fxl[i][jj], Q_syn ); + synth[i][jj] = fix16_to_float( synth_16_fx[i][jj], 0 ); } - } + }*/ #else updateBuffersForDmxMdctStereo( hCPE, output_frame, output, synth ); #endif @@ -1279,13 +1284,13 @@ ivas_error ivas_core_dec( /*------------------fix-to-fix-end-----------------------*/ - Word16 *synth_fx16; + //Word16 *synth_fx16; //Word16 *output_mem_fx; Word16 output_mem_16_fx[L_FRAME48k]; Word16 *p_output_mem_16; - synth_fx16 = (Word16 *)malloc(L_FRAME48k * sizeof(Word16)); + //synth_fx16 = (Word16 *)malloc(L_FRAME48k * sizeof(Word16)); //Word32 output_fx32[L_FRAME48k]; //output_mem_fx = (Word16 *)malloc(NS2SA(st->output_Fs, 3125000) * sizeof(Word16)); @@ -1304,7 +1309,7 @@ ivas_error ivas_core_dec( set16_fx(output_mem_16_fx, 0, NS2SA(st->output_Fs, 3125000)); } - floatToFixed_arr(synth[n], synth_fx16, Q_synth, L_FRAME48k); + //floatToFixed_arr(synth[n], synth_16_fx[n], Q_synth, L_FRAME48k); //floatToFixed_arrL(output[n], output_32_fx[n], Q11, L_FRAME48k); Scale_sig32(output_32_fx[n], L_FRAME48k, Q4 - Q11); @@ -1350,7 +1355,9 @@ ivas_error ivas_core_dec( Word16 q_audio, old_syn_fx; old_syn_fx = Q11; q_audio = Q12; - + if (hSCE != NULL) { + if(hSCE->save_synth != NULL)floatToFixed_arrL(hSCE->save_synth, hSCE->save_synth_fx, Q11, output_frame); + } #endif test(); test(); test(); test(); IF ( EQ_16(st->last_core, ACELP_CORE) && (EQ_16(st->core, TCX_20_CORE) || EQ_16(st->core, TCX_10_CORE) || EQ_16(st->core, HQ_CORE) ) && st->hBWE_TD != NULL ) @@ -1393,10 +1400,10 @@ ivas_error ivas_core_dec( test(); test(); test(); IF (sba_dirac_stereo_flag && NE_16(st->element_mode, IVAS_CPE_MDCT) && !(EQ_32(st->core_brate, SID_2k40) && EQ_16(st->cng_type, FD_CNG))) { - Copy_Scale_sig_16_32(synth_fx16, hSCE->save_synth_fx, output_frame, 0); + Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11 - Q_synth); } - IF ( ( error = core_switching_post_dec_ivas_fx( st, synth_fx16, output_32_fx[n], p_output_mem_16, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE, &Q_synth ) ) != IVAS_ERR_OK ) + IF ( ( error = core_switching_post_dec_ivas_fx( st, synth_16_fx[n], output_32_fx[n], p_output_mem_16, ( st_ivas != NULL ) ? st_ivas->ivas_format : UNDEFINED_FORMAT, use_cldfb_for_dft, output_frame, 0 /*core_switching_flag*/, sba_dirac_stereo_flag, nchan_out, ( hCPE != NULL ) ? hCPE->last_element_mode : IVAS_SCE, &Q_synth ) ) != IVAS_ERR_OK ) { return error; } @@ -1405,7 +1412,7 @@ ivas_error ivas_core_dec( test(); test(); test(); IF (sba_dirac_stereo_flag && hSCE && EQ_32(st->core_brate, SID_2k40) && EQ_16(st->cng_type, FD_CNG)) { - Copy_Scale_sig_16_32(synth_fx16, hSCE->save_synth_fx, output_frame, 0); + Copy_Scale_sig_16_32(synth_16_fx[n], hSCE->save_synth_fx, output_frame, Q11 - Q_synth); } /* if we transition from inactive to active coding in MDCT-Stereo DTX and the output format is mono DMX, we need to sync the upsampled buffer between channels here */ @@ -1432,9 +1439,13 @@ ivas_error ivas_core_dec( //fixedToFloat_arrL(hb_synth_32_fx[ch_ind], hb_synth[ch_ind], 11, L_FRAME48k); } } - if (sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT && !(st->core_brate == SID_2k40 && st->cng_type == FD_CNG)) + if (hSCE != NULL) { + if (hSCE->save_synth != NULL)fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11, output_frame); + } + if (sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT && !(st->core_brate == SID_2k40 && st->cng_type == FD_CNG)) { - mvr2r(synth[n], hSCE->save_synth, output_frame); + //mvr2r(synth[n], hSCE->save_synth, output_frame); + //fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11,output_frame); } /*-------------------cldfb-start-------------------------*/ @@ -1454,8 +1465,8 @@ ivas_error ivas_core_dec( } /*-------------------cldfb-end---------------------------*/ - - fixedToFloat_arr(synth_fx16, synth[n], Q_synth, L_FRAME48k); + Scale_sig(synth_16_fx[n], L_FRAME48k, negate(Q_synth)); + //fixedToFloat_arr(synth_16_fx[n], synth[n], 0, L_FRAME48k); //fixedToFloat_arrL(output_32_fx[n], output[n], Q11, L_FRAME48k); IF(st->hHQ_core != NULL) { @@ -1477,12 +1488,13 @@ ivas_error ivas_core_dec( st->hBWE_FD->prev_flag = st->hBWE_FD->prev_flag; } - free(synth_fx16); + //free(synth_fx16); //free(output_mem_fx); if (sba_dirac_stereo_flag && hSCE && st->core_brate == SID_2k40 && st->cng_type == FD_CNG) { - mvr2r(synth[n], hSCE->save_synth, output_frame); + //mvr2r(synth[n], hSCE->save_synth, output_frame); + //fixedToFloat_arrL(hSCE->save_synth_fx, hSCE->save_synth, Q11,output_frame); } #endif @@ -1496,10 +1508,10 @@ ivas_error ivas_core_dec( //Word16 hb_synth_fx_16[CPE_CHANNELS][L_FRAME48k]; //Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]; //Word16 output_fx_16[CPE_CHANNELS][L_FRAME48k]; - Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; + //Word16 synth_fx_16[CPE_CHANNELS][L_FRAME48k]; Word16 Q_input, Q_hb_synth_fx, Q_synth_fx; - Word32 synth_fx32[L_FRAME48k]; + //Word32 synth_fx32[L_FRAME48k]; //Word32 hb_synth_fx32[L_FRAME48k]; Word16 Q_syn_hb; @@ -1521,7 +1533,7 @@ ivas_error ivas_core_dec( Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, negate(Q11)); //floatToFixed_arr( hb_synth[n], hb_synth_16_fx[n], Q_hb_synth_fx, L_FRAME48k ); //floatToFixed_arr( output[n], output_16_fx[n], Q_input, L_FRAME48k ); - floatToFixed_arr( synth[n], synth_fx_16[n], Q_synth_fx, L_FRAME48k ); + //floatToFixed_arr( synth[n], synth_16_fx[n], Q_synth_fx, L_FRAME48k ); IF( hBWE_TD != NULL ) { @@ -1547,13 +1559,13 @@ ivas_error ivas_core_dec( ELSE IF( EQ_16( st->extl, WB_BWE ) && EQ_16( st->bws_cnt, 0 ) ) { /* WB BWE decoder */ - Q_hb_synth_fx = ivas_wb_bwe_dec_fx( st, output_16_fx[n], synth_fx_16[n], hb_synth_16_fx[n], use_cldfb_for_dft, output_frame, voice_factors_fx[n], pitch_buf_fx[n], &Q_synth_fx ); + Q_hb_synth_fx = ivas_wb_bwe_dec_fx( st, output_16_fx[n], synth_16_fx[n], hb_synth_16_fx[n], use_cldfb_for_dft, output_frame, voice_factors_fx[n], pitch_buf_fx[n], &Q_synth_fx ); } /* Memories Re-Scaling */ Copy_Scale_sig_16_32( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, Q11 - Q_hb_synth_fx ); Copy_Scale_sig_16_32( output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 - Q_input ); - Copy_Scale_sig_16_32( synth_fx_16[n], synth_fx32, L_FRAME48k, Q11 - Q_synth_fx ); + Copy_Scale_sig_16_32( synth_16_fx[n], synth_32_fx[n], L_FRAME48k, Q11 - Q_synth_fx ); IF( hBWE_FD != NULL ) { @@ -1603,7 +1615,7 @@ ivas_error ivas_core_dec( ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) || ( GE_32( output_Fs, 32000 ) && EQ_16( st->core, ACELP_CORE ) && GT_16( st->bwidth, NB ) && GT_16( st->bws_cnt, 0 ) && !st->ppp_mode_dec && !( EQ_16( st->nelp_mode_dec, 1 ) && EQ_16( st->bfi, 1 ) ) ) ) { /* SWB BWE decoder */ - Q_syn_hb = swb_bwe_dec_fx32( st, output_32_fx[n], synth_fx32, hb_synth_32_fx[n], use_cldfb_for_dft, output_frame ); + Q_syn_hb = swb_bwe_dec_fx32( st, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], use_cldfb_for_dft, output_frame ); // Output Scale_sig32( hb_synth_32_fx[n], output_frame, Q11 - Q_syn_hb ); @@ -1653,7 +1665,7 @@ ivas_error ivas_core_dec( Word16 q = 2; //st->prev_Q_bwe_syn2 = 0; Copy_Scale_sig_32_16(hb_synth_32_fx[n], hb_synth_16_fx[n], L_FRAME48k, -(Q11 + q)); - Copy_Scale_sig_32_16(synth_fx32, synth_fxl, L_FRAME48k, -(Q11 + q)); + Copy_Scale_sig_32_16(synth_32_fx[n], synth_fxl, L_FRAME48k, -(Q11 + q)); Scale_sig(st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, (Q8 - st->prev_Q_bwe_syn)); Scale_sig32(st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, (st->prev_Q_bwe_syn2 - Q11)); Copy_Scale_sig_32_16(st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, 2 * ALLPASSSECTIONS_STEEP, (st->prev_Q_bwe_syn2 - Q11)); @@ -1661,7 +1673,7 @@ ivas_error ivas_core_dec( swb_CNG_dec_ivas_fx( st, synth_fxl, hb_synth_16_fx[n], sid_bw[n], -q ); Copy_Scale_sig_16_32(hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, (Q11 + q)); - Copy_Scale_sig_16_32(synth_fxl, synth_fx32, L_FRAME48k, (Q11 + q)); + Copy_Scale_sig_16_32(synth_fxl, synth_32_fx[n], L_FRAME48k, (Q11 + q)); Scale_sig(st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, -(Q8 - st->prev_Q_bwe_syn)); Scale_sig32(st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, -(st->prev_Q_bwe_syn2 - Q11)); Copy_Scale_sig_16_32(st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 2 * ALLPASSSECTIONS_STEEP, -(st->prev_Q_bwe_syn2 - Q11)); @@ -1671,7 +1683,8 @@ ivas_error ivas_core_dec( //fixedToFloat_arrL(hb_synth_32_fx[n], hb_synth[n], Q11, L_FRAME48k); //fixedToFloat_arrL(output_32_fx[n], output[n], Q11, L_FRAME48k); - fixedToFloat_arrL(synth_fx32, synth[n], Q11, L_FRAME48k); + //fixedToFloat_arrL(synth_32_fx[n], synth[n], Q11, L_FRAME48k); + //Copy_Scale_sig_32_16(synth_32_fx[n],synth_16_fx[n],L_FRAME48k,negate(Q11)); IF(hBWE_TD != NULL) { @@ -1736,7 +1749,7 @@ ivas_error ivas_core_dec( { tmps = NS2SA_fx2( output_Fs, DELAY_CLDFB_NS ); - waveform_adj2_fix( st->hTonalMDCTConc->secondLastPcmOut, synth_16fx[n] + tmps, st->plcInfo.data_noise, &st->plcInfo.outx_new_n1_fx, + waveform_adj2_fix( st->hTonalMDCTConc->secondLastPcmOut, synth_16_fx[n] + tmps, st->plcInfo.data_noise, &st->plcInfo.outx_new_n1_fx, &st->plcInfo.nsapp_gain_fx, &st->plcInfo.nsapp_gain_n_fx, &st->plcInfo.recovery_gain, st->plcInfo.step_concealgain_fx, st->plcInfo.Pitch_fx, st->plcInfo.FrameSize, tmps, st->hPlcInfo->nbLostCmpt + 1, st->bfi ); @@ -1958,7 +1971,7 @@ ivas_error ivas_core_dec( #ifdef IVAS_FLOAT_FIXED // TO DO delete below //Word32 output_fx[CPE_CHANNELS][L_FRAME48k]; - Word32 synth_fxg[CPE_CHANNELS][L_FRAME48k]; + //Word32 synth_fxg[CPE_CHANNELS][L_FRAME48k]; //Word32 hb_synth_fxg[CPE_CHANNELS][L_FRAME48k]; FOR(int ch_ind = 0; ch_ind < n_channels; ch_ind++) @@ -1966,7 +1979,7 @@ ivas_error ivas_core_dec( FOR(int ind = 0; ind < L_FRAME48k; ind++) { //output_32_fx[ch_ind][ind] = (Word32)(output[ch_ind][ind] * (1 << 11)); - synth_fxg[ch_ind][ind] = (Word32)(synth[ch_ind][ind] * (1 << 11)); + //synth_32_fx[ch_ind][ind] = (Word32)(synth[ch_ind][ind] * (1 << 11)); //hb_synth_32_fx[ch_ind][ind] = (Word32)(hb_synth[ch_ind][ind] * (1 << 11)); } } @@ -2094,7 +2107,7 @@ ivas_error ivas_core_dec( IF ( NE_16(st->element_mode, IVAS_CPE_MDCT) || sba_dirac_stereo_flag ) { - ivas_post_proc_fx( hSCE, hCPE, n, synth_fxg[n], NULL, output_frame, sba_dirac_stereo_flag ); + ivas_post_proc_fx( hSCE, hCPE, n, synth_32_fx[n], NULL, output_frame, sba_dirac_stereo_flag ); } /* update OLA buffers - needed for switching to DFT stereo */ @@ -2102,7 +2115,7 @@ ivas_error ivas_core_dec( { IF ( hCPE != NULL ) { - stereo_td2dft_update_fx( hCPE, n, output_32_fx[n], synth_fxg[n], hb_synth_32_fx[n], output_frame ); + stereo_td2dft_update_fx( hCPE, n, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], output_frame ); } } } @@ -2111,11 +2124,11 @@ ivas_error ivas_core_dec( Word16 q = 11; IF ( EQ_16(hCPE->last_element_mode, IVAS_CPE_MDCT )) { - stereo_mdct2dft_update_fx( hCPE, output_32_fx[0], synth_fxg[0] ); + stereo_mdct2dft_update_fx( hCPE, output_32_fx[0], synth_32_fx[0] ); } Word16 q_DFT[2] = { 3, 3 }; - stereo_dft_dec_core_switching_fx( hCPE, output_32_fx[0], synth_fxg[0], hb_synth_32_fx[0], DFT_fx, output_frame, use_cldfb_for_dft, 0, &q, q_DFT ); + stereo_dft_dec_core_switching_fx( hCPE, output_32_fx[0], synth_32_fx[0], hb_synth_32_fx[0], DFT_fx, output_frame, use_cldfb_for_dft, 0, &q, q_DFT ); hCPE->hStereoDft->q_dft = s_min( q_DFT[0], q_DFT[1] ); @@ -2128,11 +2141,11 @@ ivas_error ivas_core_dec( IF( EQ_16( hCPE->nchan_out, 1 ) && EQ_16( hCPE->hStereoDft->hConfig->res_cod_mode, STEREO_DFT_RES_COD_OFF ) ) { /* mono output for non-residual coding modes uses CLDFB instead of DFT - requires DFT buffer update in case of bitrate switching */ - stereo_td2dft_update_fx( hCPE, n, output_32_fx[n], synth_fxg[n], hb_synth_32_fx[n], output_frame ); + stereo_td2dft_update_fx( hCPE, n, output_32_fx[n], synth_32_fx[n], hb_synth_32_fx[n], output_frame ); } } - Copy32( synth_fxg[n], output_32_fx[n], output_frame ); + Copy32( synth_32_fx[n], output_32_fx[n], output_frame ); /*--------------------------------------------------------* * Common updates @@ -2190,7 +2203,7 @@ ivas_error ivas_core_dec( FOR( i = 0; i < L_FRAME48k; i++ ) { //output[ch_ind][i] = fixedToFloat(output_32_fx[ch_ind][i], 11); - synth[ch_ind][i] = (float) synth_fxg[ch_ind][i] / (float) ( 1 << 11 ); + //synth[ch_ind][i] = (float) synth_32_fx[ch_ind][i] / (float) ( 1 << 11 ); //hb_synth[ch_ind][i] = (float) hb_synth_32_fx[ch_ind][i] / (float) ( 1 << 11 ); } } diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index e5eabe3d44508ca86754cefead30c3280d9a67da..67f65d1af523570a9f97f0050b473958d2a23df1 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -396,9 +396,6 @@ ivas_error ivas_corecoder_dec_reconfig_fx( } set32_fx( st_ivas->hCPE[0]->hStereoDft->buff_LBTCX_mem_fx, 0, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); -#if 1 /*TODO: To be removed later*/ - set_f( st_ivas->hCPE[0]->hStereoDft->buff_LBTCX_mem, 0, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); -#endif st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ st_ivas->hCPE[0]->hCoreCoder[1] = NULL; diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 475f3f7e5bfdb3a928af49f1c0fceef4d2825f88..e52a7b5635def3ffc9295f013b3ade200a6f8070 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -109,30 +109,6 @@ ivas_error ivas_cpe_dec_fx( move32(); #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - Word16 q_common = Q11; - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - IF( hCPE->output_mem[n] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[n], hCPE->output_mem_fx[n], q_common, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - } - IF( hCPE->input_mem_LB[n] != NULL ) - { - floatToFixed_arrL( hCPE->input_mem_LB[n], hCPE->input_mem_LB_fx[n], q_common, STEREO_DFT32MS_OVL_16k ); - } - if (hCPE->input_mem[n] != NULL) - { - floatToFixed_arrL(&hCPE->input_mem[n][0], &hCPE->input_mem_fx[n][0], q_common, NS2SA(hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS)); - } - if (hCPE->input_mem_BPF[0] != NULL) - { - floatToFixed_arrL(hCPE->input_mem_BPF[0], hCPE->input_mem_BPF_fx[0], q_common, STEREO_DFT32MS_OVL_16k); - } - } - IF( hCPE->hStereoDft != NULL ) - { - floatToFixed_arrL( hCPE->hStereoDft->buff_LBTCX_mem, hCPE->hStereoDft->buff_LBTCX_mem_fx, q_common, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); - } #endif /*------------------------------------------------------------------* * Read stereo technology info & audio bandwidth @@ -1227,29 +1203,6 @@ ivas_error ivas_cpe_dec_fx( st_ivas->BER_detect = s_or( st_ivas->BER_detect, sts[1]->BER_detect ); #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - IF( hCPE->output_mem[n] != NULL ) - { - fixedToFloat_arrL( hCPE->output_mem_fx[n], hCPE->output_mem[n], q_common, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - } - IF( hCPE->input_mem_LB[n] != NULL ) - { - fixedToFloat_arrL( hCPE->input_mem_LB_fx[n], hCPE->input_mem_LB[n], q_common, STEREO_DFT32MS_OVL_16k ); - } - if (hCPE->input_mem[n] != NULL) - { - fixedToFloat_arrL(&hCPE->input_mem_fx[n][0], &hCPE->input_mem[n][0], q_common, NS2SA(hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS)); - } - if (hCPE->input_mem_BPF[0] != NULL) - { - fixedToFloat_arrL(hCPE->input_mem_BPF_fx[0], hCPE->input_mem_BPF[0], q_common, STEREO_DFT32MS_OVL_16k); - } - } - IF( hCPE->hStereoDft != NULL ) - { - fixedToFloat_arrL( hCPE->hStereoDft->buff_LBTCX_mem_fx, hCPE->hStereoDft->buff_LBTCX_mem, q_common, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); - } #endif pop_wmops(); @@ -1364,20 +1317,6 @@ ivas_error create_cpe_dec( IF( EQ_16( (Word16) st_ivas->ivas_format, STEREO_FORMAT ) || EQ_16( (Word16) st_ivas->ivas_format, MASA_FORMAT ) || EQ_16( (Word16) st_ivas->ivas_format, MASA_ISM_FORMAT ) || ( EQ_16( (Word16) st_ivas->ivas_format, MC_FORMAT ) && EQ_16( (Word16) st_ivas->mc_mode, MC_MODE_MCMASA ) ) || st_ivas->sba_dirac_stereo_flag ) { -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF( ( hCPE->input_mem[i] = (float *) malloc( sizeof( float ) * NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) ); - } - set_zero( hCPE->input_mem[i], NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - - IF( ( hCPE->input_mem_LB[i] = (float *) malloc( sizeof( float ) * STEREO_DFT32MS_OVL_16k ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) ); - } - set_zero( hCPE->input_mem_LB[i], STEREO_DFT32MS_OVL_16k ); -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF( ( hCPE->input_mem_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) ); @@ -1392,13 +1331,6 @@ ivas_error create_cpe_dec( IF( EQ_16( i, 0 ) ) { -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF( ( hCPE->input_mem_BPF[0] = (float *) malloc( sizeof( float ) * STEREO_DFT32MS_OVL_16k ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) ); - } - set_zero( hCPE->input_mem_BPF[0], STEREO_DFT32MS_OVL_16k ); -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED IF( ( hCPE->input_mem_BPF_fx[0] = (Word32 *) malloc( sizeof( Word32 ) * STEREO_DFT32MS_OVL_16k ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) ); @@ -1406,20 +1338,12 @@ ivas_error create_cpe_dec( set32_fx( hCPE->input_mem_BPF_fx[0], 0, STEREO_DFT32MS_OVL_16k ); } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF( ( hCPE->output_mem[i] = (float *) malloc( sizeof( float ) * NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) ); - } - set_zero( hCPE->output_mem[i], NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ) ); -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF( ( hCPE->output_mem_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) ); } set32_fx( hCPE->output_mem_fx[i], 0, NS2SA_fx2( output_Fs, STEREO_DFT32MS_OVL_NS ) ); - hCPE->q_output_mem_fx[i] = 0; + hCPE->q_output_mem_fx[i] = Q11; IF( LT_16( i, hCPE->nchan_out ) ) { IF( ( hCPE->prev_synth_chs_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * NS2SA_fx2( output_Fs, FRAME_SIZE_NS ) ) ) == NULL ) @@ -1444,15 +1368,6 @@ ivas_error create_cpe_dec( hCPE->output_mem_fx[i] = NULL; hCPE->q_output_mem_fx[i] = 0; hCPE->prev_synth_chs_fx[i] = NULL; -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - hCPE->input_mem[i] = NULL; - hCPE->input_mem_LB[i] = NULL; - if ( i == 0 ) - { - hCPE->input_mem_BPF[0] = NULL; - } - hCPE->output_mem[i] = NULL; -#endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED } } @@ -1690,16 +1605,10 @@ void destroy_cpe_dec( hCPE->hStereoICBWE = NULL; } - IF( hCPE->input_mem_LB[0] != NULL ) + IF( hCPE->input_mem_LB_fx[0] != NULL ) { FOR( n = 0; n < CPE_CHANNELS; n++ ) { - free( hCPE->input_mem_LB[n] ); - hCPE->input_mem_LB[n] = NULL; - free( hCPE->input_mem[n] ); - hCPE->input_mem[n] = NULL; - free( hCPE->output_mem[n] ); - hCPE->output_mem[n] = NULL; #ifdef IVAS_FLOAT_FIXED free( hCPE->input_mem_LB_fx[n] ); hCPE->input_mem_LB_fx[n] = NULL; @@ -1715,8 +1624,6 @@ void destroy_cpe_dec( hCPE->prev_synth_chs_fx[n] = NULL; } } - free( hCPE->input_mem_BPF[0] ); - hCPE->input_mem_BPF[0] = NULL; #ifdef IVAS_FLOAT_FIXED free( hCPE->input_mem_BPF_fx[0] ); hCPE->input_mem_BPF_fx[0] = NULL; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index df70e04c156f07f0557b2501e758881cc43e229c..cd1b47041ab9669a29a2b0f2c5f291a8e6ba7c6c 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -4084,7 +4084,7 @@ void ivas_dirac_dec_render_sf( Word16 Q_input = Q11; move16(); q_temp_cldfb = Q11; - generate_masking_noise_dirac_fx( st->hFdCngDec->hFdCngCom, + generate_masking_noise_dirac_ivas_fx( st->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], st_ivas->hTcBuffer->tc_fx[1], Cldfb_RealBuffer_fx[1][0], @@ -5301,8 +5301,8 @@ void ivas_dirac_dec_render_sf( index_slot = slot_idx_start_cldfb_synth; #ifdef IVAS_FLOAT_FIXED - Word16 cldfb_re_q = Q_factor_arrL((float *)Cldfb_RealBuffer, MAX_OUTPUT_CHANNELS*MAX_PARAM_SPATIAL_SUBFRAMES*CLDFB_NO_CHANNELS_MAX); - Word16 cldfb_im_q = Q_factor_arrL((float *)Cldfb_ImagBuffer, MAX_OUTPUT_CHANNELS*MAX_PARAM_SPATIAL_SUBFRAMES*CLDFB_NO_CHANNELS_MAX); + Word16 cldfb_re_q = Q6; // Q_factor_arrL((float *)Cldfb_RealBuffer, MAX_OUTPUT_CHANNELS*MAX_PARAM_SPATIAL_SUBFRAMES*CLDFB_NO_CHANNELS_MAX); + Word16 cldfb_im_q = Q6; // Q_factor_arrL((float *)Cldfb_ImagBuffer, MAX_OUTPUT_CHANNELS*MAX_PARAM_SPATIAL_SUBFRAMES*CLDFB_NO_CHANNELS_MAX); for (int idx1 = 0; idx1 < MAX_OUTPUT_CHANNELS; idx1++) { for (int idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++) @@ -5448,11 +5448,8 @@ void ivas_dirac_dec_render_sf( if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] ) { -#ifdef IVAS_FLOAT_FIXED - ivas_jbm_dec_get_adapted_linear_interpolator_fx( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator_fx ); -#else ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator_fx ); -#endif + interp_offset = 0; } for ( i = 0; i < num_objects; i++ ) @@ -5460,24 +5457,7 @@ void ivas_dirac_dec_render_sf( /* Combined rotation: rotate the object positions depending the head and external orientations */ if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 ) { -#ifdef IVAS_FLOAT_FIXED - ////////// flt2fix (to be removed) - for ( Word16 col = 0; col < 3; col++ ) - { - for (Word16 row = 0; row < 3; row++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][col][row] = floatToFixed( st_ivas->hCombinedOrientationData->Rmat[0][col][row], Q30 ); - } - } - Word32 azi_32, ele_32; - ////////// flt2fix end - rotateAziEle_fixed( (Word16) L_shr(st_ivas->hIsmMetaData[i]->azimuth_fx, 22), (Word16) L_shr(st_ivas->hIsmMetaData[i]->elevation_fx, 22), &azi_32, &ele_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup ); - // downscaling to Q0 angles - az1 = (Word16) L_shr(azi_32, 22); - el1 = (Word16) L_shr(ele_32, 22); -#else rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &az1, &el1, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup ); -#endif if ( st_ivas->hEFAPdata != NULL ) { efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], az1, el1, EFAP_MODE_EFAP ); @@ -5653,8 +5633,6 @@ void ivas_dirac_dec_render_sf( else { #ifdef IVAS_FLOAT_FIXED - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; Word32 *RealBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; Word32 *ImagBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; Word16 outchannels; @@ -5805,109 +5783,104 @@ void ivas_dirac_dec_render_sf( } else { - for ( ch = 0; ch < outchannels; ch++ ) +#ifdef IVAS_FLOAT_FIXED + FOR ( ch = 0; ch < outchannels; ch++ ) { - if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) +#if 1 // Float to fixed + Word16 tmp_idx_in = idx_in; + Word16 tmp_idx_lfe = idx_lfe; + IF((hDirACRend->hOutSetup.num_lfe > 0) && (EQ_16(hDirACRend->hOutSetup.index_lfe[idx_lfe], ch))) { - if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled ) + IF(st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) + { + // Float to fixed + Word16 cldfbSynIdx = hDirACRend->hOutSetup.nchan_out_woLFE + tmp_idx_lfe; + st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = Q_factor_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); + floatToFixed_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); + } + ELSE IF(st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled) { - for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) + /* LFE has been synthesized in the time domain, do nothing. */ + } + ELSE + { + } + IF(LT_16(tmp_idx_lfe, sub(hDirACRend->hOutSetup.num_lfe, 1))) + { + tmp_idx_lfe = add(tmp_idx_lfe, 1); + } + } + ELSE IF((hDirACRend->hOutSetup.separateChannelEnabled) && EQ_16(hDirACRend->hOutSetup.separateChannelIndex, ch)) + { + /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated + * channel is combined with the synthesized channels here. */ + } + ELSE + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ + st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = Q_factor_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); + floatToFixed_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); + } +#endif + IF ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( EQ_16( hDirACRend->hOutSetup.index_lfe[idx_lfe], ch ) ) ) + { + IF(st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) + { + FOR(i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) { - RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; -#ifdef IVAS_FLOAT_FIXED RealBuffer_fx[i] = Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i]; ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i]; -#endif } -#ifdef IVAS_FLOAT_FIXED - // Float to fixed. - st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q_factor_arrL(st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length); - floatToFixed_arrL(st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->Q_cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length); - - + Word16 cldfbSynIdx = hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe; + Word16 samplesToProcess = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; Word32 *p_out = &(output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands]); - Word16 common_q; - common_q = sub( s_min( cldfb_re_q, cldfb_im_q ), 1 ); // 1 guard bit - FOR(i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) - { - scale_sig32(RealBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, sub(common_q, cldfb_re_q)); - scale_sig32(ImagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, sub(common_q, cldfb_im_q)); - } - cldfb_re_q = common_q; - move16(); - cldfb_im_q = common_q; - move16(); - Word16 samplesToProcess = hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx]; + scale_sig32(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length, sub(Q6 - 1, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state)); + st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state = Q6 - 1; - scale_sig32(st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->p_filter_length, sub(sub(common_q, 1), st_ivas->cldfbSynDec[ch]->Q_cldfb_state)); - st_ivas->cldfbSynDec[ch]->Q_cldfb_state = sub(common_q, 1); - cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe] ); + cldfbSynthesis_ivas_fx(RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[cldfbSynIdx]); // Calculating length of output - Word16 no_col = st_ivas->cldfbSynDec[ch]->no_col, no_channels = st_ivas->cldfbSynDec[ch]->no_channels; + Word16 no_col = st_ivas->cldfbSynDec[cldfbSynIdx]->no_col, no_channels = st_ivas->cldfbSynDec[cldfbSynIdx]->no_channels; IF(GT_16(samplesToProcess, -1)) { - no_col = s_min(no_col, (samplesToProcess + st_ivas->cldfbSynDec[ch]->no_channels - 1) / st_ivas->cldfbSynDec[ch]->no_channels); + no_col = s_min(no_col, (samplesToProcess + st_ivas->cldfbSynDec[cldfbSynIdx]->no_channels - 1) / st_ivas->cldfbSynDec[cldfbSynIdx]->no_channels); } Word16 synth_len = imult1616(no_col, no_channels); - scale_sig32(p_out, synth_len, sub(Q11, sub(common_q, 1))); - - // Fixed to float - fixedToFloat_arrL(st_ivas->cldfbSynDec[ch]->cldfb_state_fx, st_ivas->cldfbSynDec[ch]->cldfb_state, st_ivas->cldfbSynDec[ch]->Q_cldfb_state, st_ivas->cldfbSynDec[ch]->p_filter_length); - for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) - { - fixedToFloat_arrL(Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i], Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i], CLDFB_NO_CHANNELS_MAX, cldfb_re_q); - fixedToFloat_arrL(Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i], CLDFB_NO_CHANNELS_MAX, cldfb_im_q); - } - fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, L_FRAME48k); -#else - cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe] ); -#endif + scale_sig32(p_out, synth_len, (Q11 - (Q6 - 1))); } - else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) + ELSE IF( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) { /* LFE has been synthesized in the time domain, do nothing. */ } - else + ELSE { - set_zero( &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); + set32_fx( &( output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), 0, imult1616( hSpatParamRendCom->subframe_nbslots[subframe_idx], hSpatParamRendCom->num_freq_bands ) ); } - - if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) + IF( LT_16( idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) ) ) { - idx_lfe++; + idx_lfe = add( idx_lfe, 1 ); } } - else if ( ( hDirACRend->hOutSetup.separateChannelEnabled ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) + ELSE IF ( ( hDirACRend->hOutSetup.separateChannelEnabled ) && EQ_16( hDirACRend->hOutSetup.separateChannelIndex, ch ) ) { /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated * channel is combined with the synthesized channels here. */ } - else + ELSE { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ -#ifdef IVAS_FLOAT_FIXED - // Float to fixed - st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = Q_factor_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); - floatToFixed_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); - Word32 *p_out = &( output_buf_fx[ch][index_slot * hSpatParamRendCom->num_freq_bands] ); - Word16 samplesToProcess, out_len; FOR( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { - RealBuffer_fx[i] = Cldfb_RealBuffer_fx[idx_in][i]; // cldfb_re_q - ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; // cldfb_im_q - // Scaling cldfb buffers to Q6 - scale_sig32( RealBuffer_fx[i], hSpatParamRendCom->num_freq_bands, sub( Q6, cldfb_re_q ) ); - scale_sig32( ImagBuffer_fx[i], hSpatParamRendCom->num_freq_bands, sub( Q6, cldfb_im_q ) ); + RealBuffer_fx[i] = Cldfb_RealBuffer_fx[idx_in][i]; // Q6 + ImagBuffer_fx[i] = Cldfb_ImagBuffer_fx[idx_in][i]; // Q6 } samplesToProcess = imult1616( hSpatParamRendCom->num_freq_bands, hSpatParamRendCom->subframe_nbslots[subframe_idx] ); - // Calculating length of output + // Calculating length of processed output Word16 no_col = st_ivas->cldfbSynDec[idx_in]->no_col, no_channels = st_ivas->cldfbSynDec[idx_in]->no_channels; IF(GT_16(samplesToProcess, -1)) { @@ -5920,26 +5893,95 @@ void ivas_dirac_dec_render_sf( st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state = Q6 - 1; move16(); + // Scaling the output to Q10 + scale_sig32(output_buf_fx[ch], samplesToProcess + index_slot * hSpatParamRendCom->num_freq_bands, Q10 - Q11 ); + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, p_out, samplesToProcess, st_ivas->cldfbSynDec[idx_in] ); - // Scaling output from Q6-1 to Q11 - /* NOTE: here, the output is saturating. since Q11 is not sufficient for storing the output in 1 case. - hence there is significant increase in MLD for [Multi-channel 7_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out] case. - Need to fix this. - */ - Scale_sig32(p_out, out_len, (Q11 - (Q6 - 1))); + // Scaling output from Q6-1 to Q10 + scale_sig32(p_out, out_len, (Q10 - (Q6 - 1))); + idx_in = add( idx_in, 1 ); + } +#if 1 // Fixed to float + IF((hDirACRend->hOutSetup.num_lfe > 0) && (EQ_16(hDirACRend->hOutSetup.index_lfe[idx_lfe], ch))) + { + IF(st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) + { + Word16 cldfbSynIdx = hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe; + // Fixed to float + fixedToFloat_arrL(st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state_fx, st_ivas->cldfbSynDec[cldfbSynIdx]->cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->Q_cldfb_state, st_ivas->cldfbSynDec[cldfbSynIdx]->p_filter_length); + for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) + { + fixedToFloat_arrL(Cldfb_RealBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i], Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i], CLDFB_NO_CHANNELS_MAX, Q6); + fixedToFloat_arrL(Cldfb_ImagBuffer_fx[MAX_OUTPUT_CHANNELS - 1][i], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i], CLDFB_NO_CHANNELS_MAX, Q6); + } + fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands); + } + ELSE IF(st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled) + { + /* LFE has been synthesized in the time domain, do nothing. */ + } + ELSE + { + // Float to fixed. + fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands + index_slot * hSpatParamRendCom->num_freq_bands); + } + } + ELSE IF((hDirACRend->hOutSetup.separateChannelEnabled) && EQ_16(hDirACRend->hOutSetup.separateChannelIndex, ch)) + { + /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated + * channel is combined with the synthesized channels here. */ + } + ELSE + { // Fixed to float - fixedToFloat_arrL(st_ivas->cldfbSynDec[idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[idx_in]->cldfb_state, st_ivas->cldfbSynDec[idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[idx_in]->p_filter_length); + fixedToFloat_arrL(st_ivas->cldfbSynDec[tmp_idx_in]->cldfb_state_fx, st_ivas->cldfbSynDec[tmp_idx_in]->cldfb_state, st_ivas->cldfbSynDec[tmp_idx_in]->Q_cldfb_state, st_ivas->cldfbSynDec[tmp_idx_in]->p_filter_length); for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) { - fixedToFloat_arrL(Cldfb_RealBuffer_fx[idx_in][i], Cldfb_RealBuffer[idx_in][i], CLDFB_NO_CHANNELS_MAX, Q6 ); - fixedToFloat_arrL(Cldfb_ImagBuffer_fx[idx_in][i], Cldfb_ImagBuffer[idx_in][i], CLDFB_NO_CHANNELS_MAX, Q6 ); + fixedToFloat_arrL(Cldfb_RealBuffer_fx[tmp_idx_in][i], Cldfb_RealBuffer[tmp_idx_in][i], CLDFB_NO_CHANNELS_MAX, Q6); + fixedToFloat_arrL(Cldfb_ImagBuffer_fx[tmp_idx_in][i], Cldfb_ImagBuffer[tmp_idx_in][i], CLDFB_NO_CHANNELS_MAX, Q6); } - fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q11, samplesToProcess + index_slot * hSpatParamRendCom->num_freq_bands); - - idx_in = add( idx_in, 1 ); + fixedToFloat_arrL(output_buf_fx[ch], output_f[ch], Q10, hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx] + index_slot * hSpatParamRendCom->num_freq_bands); + tmp_idx_in++; + } +#endif + } #else + for ( ch = 0; ch < outchannels; ch++ ) + { + if ( ( hDirACRend->hOutSetup.num_lfe > 0 ) && ( hDirACRend->hOutSetup.index_lfe[idx_lfe] == ch ) ) + { + if (st_ivas->mc_mode == MC_MODE_MCMASA && !hDirACRend->hOutSetup.separateChannelEnabled) + { + for (i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++) + { + RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; + ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; + } + cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirACRend->hOutSetup.nchan_out_woLFE + idx_lfe] ); + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirACRend->hOutSetup.separateChannelEnabled ) + { + /* LFE has been synthesized in the time domain, do nothing. */ + } + else + { + set_zero( &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); + } + if ( idx_lfe < ( hDirACRend->hOutSetup.num_lfe - 1 ) ) + { + idx_lfe++; + } + } + else if ( ( hDirACRend->hOutSetup.separateChannelEnabled ) && ( hDirACRend->hOutSetup.separateChannelIndex == ch ) ) + { + /* The separated channel is already set to output_f[hOutSetup.separateChannelIndex]. Thus, the separated + * channel is combined with the synthesized channels here. */ + } + else + { + /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ for ( i = 0; i < hSpatParamRendCom->subframe_nbslots[subframe_idx]; i++ ) { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; @@ -5947,9 +5989,9 @@ void ivas_dirac_dec_render_sf( } cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hSpatParamRendCom->num_freq_bands] ), hSpatParamRendCom->num_freq_bands * hSpatParamRendCom->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); idx_in++; -#endif } } +#endif } } hSpatParamRendCom->slots_rendered += hSpatParamRendCom->subframe_nbslots[subframe_idx]; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 8b71eef9b9a868a3f5e6e2502aadf7cbb0ce9639..8150ec3553f19257166c5bd5655e672c6342828b 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -515,25 +515,8 @@ ivas_error ivas_jbm_dec_tc( /*-------------------cldfb-end---------------------------*/ } - IF( hCPE->output_mem[0] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[0], hCPE->output_mem_fx[0], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - IF( hCPE->output_mem[1] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[1], hCPE->output_mem_fx[1], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - FOR( n = 0; n < CPE_CHANNELS; n++ ) { - - IF( hCPE->input_mem_LB[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB_fx[n][ind] = (Word32) ( hCPE->input_mem_LB[n][ind] * ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth_fx[n][k] = (Word32) ( hCPE->prev_synth[n][k] * ( 1 << q_output ) ); @@ -644,20 +627,6 @@ ivas_error ivas_jbm_dec_tc( FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hCPE->output_mem[n] != NULL ) - { - FOR( k = 0; k < NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->output_mem[n][k] = (float) hCPE->output_mem_fx[n][k] / ( 1u << 11 ); - } - } - IF( hCPE->input_mem[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB[n][ind] = ( (float) hCPE->input_mem_LB_fx[n][ind] / ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); @@ -886,11 +855,12 @@ ivas_error ivas_jbm_dec_tc( floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); } q = hCPE->hStereoDft->q_dft; - floatToFixed_arrL( &hCPE->input_mem_BPF[0][0], &hCPE->input_mem_BPF_fx[0][0], q, STEREO_DFT32MS_OVL_16k ); - floatToFixed_arrL( &hCPE->input_mem[0][0], &hCPE->input_mem_fx[0][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - floatToFixed_arrL( &hCPE->input_mem_LB[0][0], &hCPE->input_mem_LB_fx[0][0], q, STEREO_DFT32MS_OVL_16k ); - floatToFixed_arrL( &hCPE->input_mem[1][0], &hCPE->input_mem_fx[1][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - floatToFixed_arrL( &hCPE->input_mem_LB[1][0], &hCPE->input_mem_LB_fx[1][0], q, STEREO_DFT32MS_OVL_16k ); + scale_sig32(hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub(hCPE->hStereoDft->q_dft, Q11)); + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); + scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); + } if ( hSCE != NULL ) { floatToFixed_arrL( &hSCE->save_hb_synth[0], &hSCE->save_hb_synth_fx[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); @@ -908,9 +878,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); floatToFixed_arrL( &hCPE->hStereoDft->ap_delay_mem[0], &hCPE->hStereoDft->ap_delay_mem_fx[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - floatToFixed_arrL( &hCPE->hStereoDft->buff_LBTCX_mem[0], &hCPE->hStereoDft->buff_LBTCX_mem_fx[0], q, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); hCPE->hStereoDft->q_smooth_buf_fx = Q7; floatToFixed_arrL( &hCPE->hStereoDft->smooth_buf[0][0], &hCPE->hStereoDft->smooth_buf_fx[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); @@ -925,10 +895,10 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); } } - for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; - floatToFixed_arrL( &hCPE->output_mem[ii][0], &hCPE->output_mem_fx[ii][0], hCPE->hStereoDft->q_dft, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ) ); } floatToFixed_arrL( &hCPE->prev_synth[0][0], &hCPE->prev_synth_fx[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); @@ -952,11 +922,12 @@ ivas_error ivas_jbm_dec_tc( fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); } - fixedToFloat_arrL( &hCPE->input_mem_BPF_fx[0][0], &hCPE->input_mem_BPF[0][0], q, STEREO_DFT32MS_OVL_16k ); - fixedToFloat_arrL( &hCPE->input_mem_fx[0][0], &hCPE->input_mem[0][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - fixedToFloat_arrL( &hCPE->input_mem_LB_fx[0][0], &hCPE->input_mem_LB[0][0], q, STEREO_DFT32MS_OVL_16k ); - fixedToFloat_arrL( &hCPE->input_mem_fx[1][0], &hCPE->input_mem[1][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - fixedToFloat_arrL( &hCPE->input_mem_LB_fx[1][0], &hCPE->input_mem_LB[1][0], q, STEREO_DFT32MS_OVL_16k ); + scale_sig32(hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub(Q11, hCPE->hStereoDft->q_dft)); + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); + scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + } if ( hSCE != NULL ) { fixedToFloat_arrL( &hSCE->save_synth_fx[0], &hSCE->save_synth[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); @@ -971,9 +942,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); fixedToFloat_arrL( &hCPE->hStereoDft->ap_delay_mem_fx[0], &hCPE->hStereoDft->ap_delay_mem[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->buff_LBTCX_mem_fx[0], &hCPE->hStereoDft->buff_LBTCX_mem[0], q, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); fixedToFloat_arrL( &hCPE->hStereoDft->smooth_buf_fx[0][0], &hCPE->hStereoDft->smooth_buf[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } @@ -987,9 +958,10 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); } } - for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { - fixedToFloat_arrL( &hCPE->output_mem_fx[ii][0], &hCPE->output_mem[ii][0], hCPE->hStereoDft->q_dft, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ) ); + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + hCPE->q_output_mem_fx[ii] = Q11; } } #endif @@ -1495,25 +1467,8 @@ ivas_error ivas_jbm_dec_tc( /*-------------------cldfb-end---------------------------*/ } - IF( hCPE->output_mem[0] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[0], hCPE->output_mem_fx[0], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - IF( hCPE->output_mem[1] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[1], hCPE->output_mem_fx[1], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - FOR( n = 0; n < CPE_CHANNELS; n++ ) { - - IF( hCPE->input_mem_LB[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB_fx[n][ind] = (Word32) ( hCPE->input_mem_LB[n][ind] * ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth_fx[n][k] = (Word32) ( hCPE->prev_synth[n][k] * ( 1 << q_output ) ); @@ -1635,20 +1590,6 @@ ivas_error ivas_jbm_dec_tc( FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hCPE->output_mem[n] != NULL ) - { - FOR( k = 0; k < NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->output_mem[n][k] = (float) hCPE->output_mem_fx[n][k] / ( 1u << 11 ); - } - } - IF( hCPE->input_mem[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB[n][ind] = ( (float) hCPE->input_mem_LB_fx[n][ind] / ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); @@ -1866,11 +1807,12 @@ ivas_error ivas_jbm_dec_tc( floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); } q = hCPE->hStereoDft->q_dft; - floatToFixed_arrL( &hCPE->input_mem_BPF[0][0], &hCPE->input_mem_BPF_fx[0][0], q, STEREO_DFT32MS_OVL_16k ); - floatToFixed_arrL( &hCPE->input_mem[0][0], &hCPE->input_mem_fx[0][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - floatToFixed_arrL( &hCPE->input_mem_LB[0][0], &hCPE->input_mem_LB_fx[0][0], q, STEREO_DFT32MS_OVL_16k ); - floatToFixed_arrL( &hCPE->input_mem[1][0], &hCPE->input_mem_fx[1][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - floatToFixed_arrL( &hCPE->input_mem_LB[1][0], &hCPE->input_mem_LB_fx[1][0], q, STEREO_DFT32MS_OVL_16k ); + scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); + scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); + } if ( hSCE != NULL ) { floatToFixed_arrL( &hSCE->save_hb_synth[0], &hSCE->save_hb_synth_fx[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); @@ -1888,9 +1830,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); floatToFixed_arrL( &hCPE->hStereoDft->ap_delay_mem[0], &hCPE->hStereoDft->ap_delay_mem_fx[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - floatToFixed_arrL( &hCPE->hStereoDft->buff_LBTCX_mem[0], &hCPE->hStereoDft->buff_LBTCX_mem_fx[0], q, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); hCPE->hStereoDft->q_smooth_buf_fx = Q7; floatToFixed_arrL( &hCPE->hStereoDft->smooth_buf[0][0], &hCPE->hStereoDft->smooth_buf_fx[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); floatToFixed_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); @@ -1905,10 +1847,10 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); } } - for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; - floatToFixed_arrL( &hCPE->output_mem[ii][0], &hCPE->output_mem_fx[ii][0], hCPE->hStereoDft->q_dft, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ) ); } floatToFixed_arrL( &hCPE->prev_synth[0][0], &hCPE->prev_synth_fx[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); ivas_sba_dirac_stereo_dec_fx( st_ivas, &p_output_fx[sba_ch_idx], output_frame, 0 ); @@ -1929,11 +1871,12 @@ ivas_error ivas_jbm_dec_tc( { fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); } - fixedToFloat_arrL( &hCPE->input_mem_BPF_fx[0][0], &hCPE->input_mem_BPF[0][0], q, STEREO_DFT32MS_OVL_16k ); - fixedToFloat_arrL( &hCPE->input_mem_fx[0][0], &hCPE->input_mem[0][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - fixedToFloat_arrL( &hCPE->input_mem_LB_fx[0][0], &hCPE->input_mem_LB[0][0], q, STEREO_DFT32MS_OVL_16k ); - fixedToFloat_arrL( &hCPE->input_mem_fx[1][0], &hCPE->input_mem[1][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - fixedToFloat_arrL( &hCPE->input_mem_LB_fx[1][0], &hCPE->input_mem_LB[1][0], q, STEREO_DFT32MS_OVL_16k ); + scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); + scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + } if ( hSCE != NULL ) { fixedToFloat_arrL( &hSCE->save_synth_fx[0], &hSCE->save_synth[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); @@ -1948,9 +1891,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); fixedToFloat_arrL( &hCPE->hStereoDft->ap_delay_mem_fx[0], &hCPE->hStereoDft->ap_delay_mem[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->buff_LBTCX_mem_fx[0], &hCPE->hStereoDft->buff_LBTCX_mem[0], q, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); fixedToFloat_arrL( &st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0], &st_ivas->hSpar->hMdDec->mixer_mat_prev[0][0][0][0], Q31, sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx ) / sizeof( st_ivas->hSpar->hMdDec->mixer_mat_prev_fx[0][0][0][0] ) ); fixedToFloat_arrL( &hCPE->hStereoDft->smooth_buf_fx[0][0], &hCPE->hStereoDft->smooth_buf[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } @@ -1964,9 +1907,10 @@ ivas_error ivas_jbm_dec_tc( st_ivas->hSpar->hMdDec->mix_mat_dim_2 ); } } - for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { - fixedToFloat_arrL( &hCPE->output_mem_fx[ii][0], &hCPE->output_mem[ii][0], hCPE->hStereoDft->q_dft, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ) ); + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + hCPE->q_output_mem_fx[ii] = Q11; } } #endif @@ -2222,24 +2166,8 @@ ivas_error ivas_jbm_dec_tc( /*-------------------cldfb-end---------------------------*/ } - IF( hCPE->output_mem[0] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[0], hCPE->output_mem_fx[0], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - IF( hCPE->output_mem[1] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[1], hCPE->output_mem_fx[1], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hCPE->input_mem_LB[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB_fx[n][ind] = (Word32) ( hCPE->input_mem_LB[n][ind] * ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth_fx[n][k] = (Word32) ( hCPE->prev_synth[n][k] * ( 1 << q_output ) ); @@ -2349,20 +2277,6 @@ ivas_error ivas_jbm_dec_tc( } FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hCPE->output_mem[n] != NULL ) - { - FOR( k = 0; k < NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->output_mem[n][k] = (float) hCPE->output_mem_fx[n][k] / ( 1u << 11 ); - } - } - IF( hCPE->input_mem[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB[n][ind] = ( (float) hCPE->input_mem_LB_fx[n][ind] / ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); @@ -2528,24 +2442,8 @@ ivas_error ivas_jbm_dec_tc( /*-------------------cldfb-end---------------------------*/ } - IF( hCPE->output_mem[0] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[0], hCPE->output_mem_fx[0], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - IF( hCPE->output_mem[1] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[1], hCPE->output_mem_fx[1], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hCPE->input_mem_LB[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB_fx[n][ind] = (Word32) ( hCPE->input_mem_LB[n][ind] * ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth_fx[n][k] = (Word32) ( hCPE->prev_synth[n][k] * ( 1 << q_output ) ); @@ -2649,20 +2547,6 @@ ivas_error ivas_jbm_dec_tc( } FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hCPE->output_mem[n] != NULL ) - { - FOR( k = 0; k < NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->output_mem[n][k] = (float) hCPE->output_mem_fx[n][k] / ( 1u << 11 ); - } - } - IF( hCPE->input_mem[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB[n][ind] = ( (float) hCPE->input_mem_LB_fx[n][ind] / ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); @@ -2835,24 +2719,8 @@ ivas_error ivas_jbm_dec_tc( /*-------------------cldfb-end---------------------------*/ } - IF( hCPE->output_mem[0] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[0], hCPE->output_mem_fx[0], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - IF( hCPE->output_mem[1] != NULL ) - { - floatToFixed_arrL( hCPE->output_mem[1], hCPE->output_mem_fx[1], Q11, NS2SA( hCPE->hCoreCoder[0]->output_Fs, 3125000 ) ); - } - FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hCPE->input_mem_LB[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB_fx[n][ind] = (Word32) ( hCPE->input_mem_LB[n][ind] * ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth_fx[n][k] = (Word32) ( hCPE->prev_synth[n][k] * ( 1 << q_output ) ); @@ -2960,20 +2828,6 @@ ivas_error ivas_jbm_dec_tc( FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hCPE->output_mem[n] != NULL ) - { - FOR( k = 0; k < NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ); k++ ) - { - hCPE->output_mem[n][k] = (float) hCPE->output_mem_fx[n][k] / ( 1u << 11 ); - } - } - IF( hCPE->input_mem[n] != NULL ) - { - FOR( Word32 ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) - { - hCPE->input_mem_LB[n][ind] = ( (float) hCPE->input_mem_LB_fx[n][ind] / ( 1 << q_output ) ); - } - } FOR( k = 0; k < NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ); k++ ) { hCPE->prev_synth[n][k] = (float) hCPE->prev_synth_fx[n][k] / ( 1 << q_output ); @@ -3271,11 +3125,12 @@ ivas_error ivas_jbm_dec_tc( floatToFixed_arr( &hCPE->hStereoCng->cm[0], &hCPE->hStereoCng->cm_fx[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); } q = hCPE->hStereoDft->q_dft; - floatToFixed_arrL( &hCPE->input_mem_BPF[0][0], &hCPE->input_mem_BPF_fx[0][0], q, STEREO_DFT32MS_OVL_16k ); - floatToFixed_arrL( &hCPE->input_mem[0][0], &hCPE->input_mem_fx[0][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - floatToFixed_arrL( &hCPE->input_mem_LB[0][0], &hCPE->input_mem_LB_fx[0][0], q, STEREO_DFT32MS_OVL_16k ); - floatToFixed_arrL( &hCPE->input_mem[1][0], &hCPE->input_mem_fx[1][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - floatToFixed_arrL( &hCPE->input_mem_LB[1][0], &hCPE->input_mem_LB_fx[1][0], q, STEREO_DFT32MS_OVL_16k ); + scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hCPE->hStereoDft->q_dft, Q11 ) ); + scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); + } if ( hSCE != NULL ) { floatToFixed_arrL( &hSCE->save_hb_synth[0], &hSCE->save_hb_synth_fx[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); @@ -3293,9 +3148,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); floatToFixed_arrL( &hCPE->hStereoDft->td_gain[0], &hCPE->hStereoDft->td_gain_fx[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); floatToFixed_arrL( &hCPE->hStereoDft->ap_delay_mem[0], &hCPE->hStereoDft->ap_delay_mem_fx[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - floatToFixed_arrL( &hCPE->hStereoDft->buff_LBTCX_mem[0], &hCPE->hStereoDft->buff_LBTCX_mem_fx[0], q, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); hCPE->hStereoDft->q_smooth_buf_fx = Q7; floatToFixed_arrL( &hCPE->hStereoDft->smooth_buf[0][0], &hCPE->hStereoDft->smooth_buf_fx[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } @@ -3313,10 +3168,10 @@ ivas_error ivas_jbm_dec_tc( } } } - for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); hCPE->q_output_mem_fx[ii] = hCPE->hStereoDft->q_dft; - floatToFixed_arrL( &hCPE->output_mem[ii][0], &hCPE->output_mem_fx[ii][0], hCPE->hStereoDft->q_dft, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ) ); } floatToFixed_arrL( &hCPE->prev_synth[0][0], &hCPE->prev_synth_fx[0][0], hCPE->q_prev_synth_fx, sizeof( hCPE->prev_synth ) / sizeof( hCPE->prev_synth[0][0] ) ); ivas_sba_dirac_stereo_dec_fx( st_ivas, p_output_fx, output_frame, 1 ); @@ -3338,11 +3193,12 @@ ivas_error ivas_jbm_dec_tc( { fixedToFloat_arr( &hCPE->hStereoCng->cm_fx[0], &hCPE->hStereoCng->cm[0], Q15, sizeof( hCPE->hStereoCng->cm_fx ) / sizeof( hCPE->hStereoCng->cm_fx[0] ) ); } - fixedToFloat_arrL( &hCPE->input_mem_BPF_fx[0][0], &hCPE->input_mem_BPF[0][0], q, STEREO_DFT32MS_OVL_16k ); - fixedToFloat_arrL( &hCPE->input_mem_fx[0][0], &hCPE->input_mem[0][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - fixedToFloat_arrL( &hCPE->input_mem_LB_fx[0][0], &hCPE->input_mem_LB[0][0], q, STEREO_DFT32MS_OVL_16k ); - fixedToFloat_arrL( &hCPE->input_mem_fx[1][0], &hCPE->input_mem[1][0], q, NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); - fixedToFloat_arrL( &hCPE->input_mem_LB_fx[1][0], &hCPE->input_mem_LB[1][0], q, STEREO_DFT32MS_OVL_16k ); + scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); + FOR( i = 0; i < CPE_CHANNELS; ++i ) + { + scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) ); + scale_sig32( hCPE->input_mem_fx[i], NS2SA( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + } if ( hSCE != NULL ) { fixedToFloat_arrL( &hSCE->save_synth_fx[0], &hSCE->save_synth[0], q, (Word16) ( hCPE->hCoreCoder[0]->output_Fs / FRAMES_PER_SEC ) ); @@ -3357,9 +3213,9 @@ ivas_error ivas_jbm_dec_tc( } IF( hCPE->hStereoDft != NULL ) { + scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); fixedToFloat_arrL( &hCPE->hStereoDft->ap_delay_mem_fx[0], &hCPE->hStereoDft->ap_delay_mem[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->buff_LBTCX_mem_fx[0], &hCPE->hStereoDft->buff_LBTCX_mem[0], q, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); fixedToFloat_arrL( &hCPE->hStereoDft->smooth_buf_fx[0][0], &hCPE->hStereoDft->smooth_buf[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } IF( st_ivas->hSpar != NULL ) @@ -3369,7 +3225,6 @@ ivas_error ivas_jbm_dec_tc( { fixedToFloat_arrL( &hCPE->hStereoDft->td_gain_fx[0], &hCPE->hStereoDft->td_gain[0], Q31, sizeof( hCPE->hStereoDft->td_gain_fx ) / sizeof( hCPE->hStereoDft->td_gain_fx[0] ) ); fixedToFloat_arrL( &hCPE->hStereoDft->ap_delay_mem_fx[0], &hCPE->hStereoDft->ap_delay_mem[0], q, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); - fixedToFloat_arrL( &hCPE->hStereoDft->buff_LBTCX_mem_fx[0], &hCPE->hStereoDft->buff_LBTCX_mem[0], q, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) ); fixedToFloat_arrL( &hCPE->hStereoDft->smooth_buf_fx[0][0], &hCPE->hStereoDft->smooth_buf[0][0], hCPE->hStereoDft->q_smooth_buf_fx, sizeof( hCPE->hStereoDft->smooth_buf_fx ) / sizeof( hCPE->hStereoDft->smooth_buf_fx[0][0] ) ); } IF( st_ivas->hSpar != NULL ) @@ -3386,9 +3241,10 @@ ivas_error ivas_jbm_dec_tc( } } } - for ( int ii = 0; ii < CPE_CHANNELS; ii++ ) + FOR( int ii = 0; ii < CPE_CHANNELS; ii++ ) { - fixedToFloat_arrL( &hCPE->output_mem_fx[ii][0], &hCPE->output_mem[ii][0], hCPE->hStereoDft->q_dft, NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ) ); + scale_sig32( hCPE->output_mem_fx[ii], NS2SA_fx2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); + hCPE->q_output_mem_fx[ii] = Q11; } } #endif diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index a8253fdfb15e625b93c70949d948d143f39d8851..d579b13174b7eb67006193dcaaef66eac56d3b16 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -993,7 +993,7 @@ ivas_error ivas_mct_dec_fx( /* Postprocessing for ACELP/MDCT core switching and synchronization */ Word16 output_mem_fx[L_FRAME48k]; - IF( hCPE->output_mem[1] != NULL ) + IF( hCPE->output_mem_fx[1] != NULL ) { Copy_Scale_sig_32_16( hCPE->output_mem_fx[1], output_mem_fx, NS2SA( sts[n]->output_Fs, 3125000 ), sub(0, Q11) ); } diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index f6c4f3b33ea52c33e10692e2f7c55c77737f0c5b..b85d47ec8a143b8488d263867158388512b27b8d 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -228,7 +228,7 @@ static void dec_prm_tcx_sidebits_fx( * TCX20/TCX10 parameters *--------------------------------------------------------------------------------*/ - getTCXparam( st, st0, hm_cfg, param, 0, 0, ( ( ch > 0 ) && ( tnsSize ) && ( tnsSize[0] + tnsSize[1] > 0 ) ? tnsSize : NULL ), p_param, nTnsBitsTCX10, 0 ); + getTCXparam_fx( st, st0, hm_cfg, param, 0, 0, ( ( ch > 0 ) && ( tnsSize ) && ( tnsSize[0] + tnsSize[1] > 0 ) ? tnsSize : NULL ), p_param, nTnsBitsTCX10, 0 ); st->side_bits_frame_channel = st0->next_bit_pos - start_bit_pos; @@ -395,7 +395,7 @@ static void dec_prm_tcx_spec_fx( * TCX20/TCX10 parameters *--------------------------------------------------------------------------------*/ - getTCXparam( st, st, hm_cfg, param, 0, 0, NULL, p_param, target_bitsTCX10, 1 ); + getTCXparam_fx( st, st, hm_cfg, param, 0, 0, NULL, p_param, target_bitsTCX10, 1 ); nf_bits = i_mult2( nSubframes, ( add( NBITS_TCX_GAIN, i_mult2( NOISE_FILL_RANGES, NBITS_NOISE_FILL_LEVEL ) ) ) ); @@ -662,7 +662,7 @@ void ivas_mdct_dec_side_bits_frame_channel_fx( tmp = 3; } - getLPCparam( st, ¶m_lpc[ch][0], st0, tmp, sns_low_br_mode && !( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ); + getLPCparam_fx( st, ¶m_lpc[ch][0], st0, tmp, sns_low_br_mode && !( sts[0]->core == TCX_20 && sts[1]->core == TCX_20 ) ); st->side_bits_frame_channel += st0->next_bit_pos - start_bit_pos_sns; } @@ -1445,7 +1445,7 @@ void ivas_mdct_core_invQ( /* PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed */ - st->core = GetPLCModeDecision_flt( st ); + st->core = GetPLCModeDecision( st ); } if ( ( !st->bfi || st->hTcxCfg->psychParamsCurrent == NULL ) && st->core > ACELP_CORE ) @@ -1699,7 +1699,7 @@ void ivas_mdct_core_reconstruct( TonalMDCTConceal_SaveTimeSignal_ivas( st->hTonalMDCTConc, synthFB, L_frameTCX[ch] ); } - decoder_tcx_post_flt( st, synth, synthFB, NULL, bfi, MCT_flag ); + decoder_tcx_post( st, synth, synthFB, NULL, bfi, MCT_flag ); } else /*ACELP core for ACELP-PLC */ { @@ -1707,11 +1707,11 @@ void ivas_mdct_core_reconstruct( /* PLC: [TCX: TD PLC] */ if ( MCT_flag ) { - con_tcx_flt( st, &synthFB[0], -1.f, NULL, 0, NULL ); + con_tcx( st, &synthFB[0], -1.f, NULL, 0, NULL ); } else { - con_tcx_flt( st, &synthFB[0], hCPE->hStereoMdct->lastCoh, &sts[0]->seed_acelp, ( sts[1]->core != ACELP_CORE ) ? 1 : 0, &st->hFdCngDec->hFdCngCom->A_cng_flt[0] ); + con_tcx( st, &synthFB[0], hCPE->hStereoMdct->lastCoh, &sts[0]->seed_acelp, ( sts[1]->core != ACELP_CORE ) ? 1 : 0, &st->hFdCngDec->hFdCngCom->A_cng_flt[0] ); } lerp_flt( synthFB, synth, st->L_frame, st->hTcxDec->L_frameTCX ); @@ -1913,7 +1913,7 @@ void ivas_mdct_core_reconstruct_fx( /* PLC: [TCX: TD PLC] */ IF ( NE_16(MCT_flag , 0) ) { - con_tcx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); + con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); } ELSE { diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index 0c41700104e8fa14b91e3fb0b4c95045b4022c63..dd20c4303b37f222e7bd70309bfd6b078a83ab9c 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -50,6 +50,7 @@ * - in CPE_DFT, post-processing on output channels * - in CPE_TD, post-processing on decoded channels before upmixing *-------------------------------------------------------------------------*/ + #ifndef IVAS_FLOAT_FIXED void ivas_post_proc( SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ @@ -148,8 +149,7 @@ void ivas_post_proc( return; } -#endif -#ifdef IVAS_FLOAT_FIXED +#else void ivas_post_proc_fx( SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ @@ -250,12 +250,13 @@ void ivas_post_proc_fx( #endif // IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * stereo_dft_dec_core_switching_fx() * * core switching in DFT stereo *-------------------------------------------------------------------------*/ + +#ifdef IVAS_FLOAT_FIXED void stereo_dft_dec_core_switching_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ Word32 output_fx[], /* i/o: synthesis @internal Fs */ @@ -269,7 +270,6 @@ void stereo_dft_dec_core_switching_fx( Word16 *q_DFT ) { - Word32 output_Fs; Decoder_State *st; Word16 i, tmps; @@ -694,10 +694,7 @@ void stereo_dft_dec_core_switching_fx( return; } -#endif - - -#ifndef IVAS_FLOAT_FIXED +#else void stereo_dft_dec_core_switching( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float output[], /* i/o: synthesis @internal Fs */ diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 74a37d1ba972f29380aaf14b50e395a371bfa1a2..c84872f48b6ac5c295e629f0b60a7a4b5c052ed6 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -239,15 +239,6 @@ ivas_error ivas_sce_dec_fx( /*----------------------------------------------------------------* * Decoder *----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - float *output_flt[1]; - float outputHB_flt[1][960]; - output_flt[0] = malloc( sizeof( Word32 ) * L_FRAME48k ); - set_f( output_flt[0], 0, L_FRAME48k ); - FOR( int k = 0; k < L_FRAME48k; k++ ) - { - output_flt[0][k] = (float) output[0][k] / ONE_IN_Q11; - } #ifndef TO_BE_REMOVED_CONVERSION //Word16 k; @@ -278,20 +269,11 @@ ivas_error ivas_sce_dec_fx( #endif set32_fx(output[0], 0, L_FRAME48k); -#endif // !IVAS_FLOAT_FIXED_TO_BE_REMOVED IF( ( error = ivas_core_dec( st_ivas, hSCE, NULL, NULL, 1, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) { return error; } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - FOR( int k = 0; k < L_FRAME48k; k++ ) - { - //output[0][k] = (Word32) ( output_flt[0][k] * ONE_IN_Q11 ); - //outputHB[0][k] = (Word32) ( outputHB_flt[0][k] * ONE_IN_Q11 ); - } - free( output_flt[0] ); -#endif // !IVAS_FLOAT_FIXED_TO_BE_REMOVED IF( st_ivas->sba_dirac_stereo_flag && ( GT_32( st->core_brate, SID_2k40 ) || EQ_16( st->cng_type, LP_CNG ) ) ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index cb15a6c1a6c090298484164848511b6832badadb..154a589fa654a819c4bd6f247a60c0fdc1a5598a 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -204,7 +204,9 @@ typedef struct stereo_dft_dec_data_struct Word32 res_pred_gain_fx[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* prediction gain for the residual HFs */ /* Q31 */ #endif int16_t res_pred_band_min; /* Band min for prediction of residual */ +#ifndef IVAS_FLOAT_FIXED float DFT_past_DMX[STEREO_DFT_PAST_MAX][STEREO_DFT32MS_N_32k]; /* Past DMX for residual prediction */ +#endif int16_t past_DMX_pos; int16_t res_pred_flag_0; int16_t res_pred_flag_1; @@ -226,18 +228,16 @@ typedef struct stereo_dft_dec_data_struct int16_t res_cod_line_max; #ifndef IVAS_FLOAT_FIXED float res_hb_nrg_mem; -#endif float bpf_error_signal_last; -#ifndef IVAS_FLOAT_FIXED float bpf_error_ratio_mem; #endif #ifdef IVAS_FLOAT_FIXED - Word32 DFT_past_DMX_fx[STEREO_DFT_PAST_MAX][STEREO_DFT32MS_N_32k]; /* Past DMX for residual prediction */ - Word32 past_res_pred_gain_fx[STEREO_DFT_PAST_MAX][STEREO_DFT_BAND_MAX]; /* Q31 */ - Word32 res_gains_ind_fx[2][2 * STEREO_DFT_BAND_MAX]; /* Q26 */ - Word32 res_hb_nrg_mem_fx; /* Q0 */ - Word32 bpf_error_signal_last_fx; - Word16 bpf_error_ratio_mem_fx; /* Q13 */ + Word32 DFT_past_DMX_fx[STEREO_DFT_PAST_MAX][STEREO_DFT32MS_N_32k]; /* Past DMX for residual prediction */ /* Q(q_DFT_past_DMX_fx) */ + Word32 past_res_pred_gain_fx[STEREO_DFT_PAST_MAX][STEREO_DFT_BAND_MAX]; /* Q31 */ + Word32 res_gains_ind_fx[2][2 * STEREO_DFT_BAND_MAX]; /* Q26 */ + Word32 res_hb_nrg_mem_fx; /* Q0 */ + Word32 bpf_error_signal_last_fx; /* Q15 */ + Word16 bpf_error_ratio_mem_fx; /* Q13 */ Word16 q_dft; Word16 q_ip_mem; Word16 q_ap_delay_mem_fx; @@ -246,10 +246,12 @@ typedef struct stereo_dft_dec_data_struct Word32 res_global_gain_fx; /* Q15 */ #endif // IVAS_FLOAT_FIXED float res_cod_mem[STEREO_DFT_OVL_8k]; +#ifndef IVAS_FLOAT_FIXED float buff_LBTCX_mem[NS2SA( 16000, STEREO_DFT32MS_OVL_NS )]; +#endif // IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED Word32 res_cod_mem_fx[STEREO_DFT_OVL_8k]; - Word32 buff_LBTCX_mem_fx[NS2SA( 16000, STEREO_DFT32MS_OVL_NS )]; + Word32 buff_LBTCX_mem_fx[NS2SA( 16000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ Word16 q_res_cod_mem_fx; #endif @@ -273,7 +275,9 @@ typedef struct stereo_dft_dec_data_struct basic_allpass_t ap1, ap2, ap3; float ap_delay_mem[NS2SA( 16000, DELAY_BWE_TOTAL_NS )]; +#ifndef IVAS_FLOAT_FIXED float ap_fade_mem[STEREO_DFT_ALLPASS_FADELEN_16k]; +#endif #ifdef IVAS_FLOAT_FIXED Word16 stab_fac_smooth_res_fx; /* low-pass filtered stability factor */ /* Q15 */ Word32 lt_pred_gain_fx; @@ -283,7 +287,7 @@ typedef struct stereo_dft_dec_data_struct Word16 stefi_long_gain_fx; /* Q15 */ Word16 q_lt_pred_gain; Word32 ap_delay_mem_fx[NS2SA( 16000, DELAY_BWE_TOTAL_NS )]; - Word32 ap_fade_mem_fx[STEREO_DFT_ALLPASS_FADELEN_16k]; + Word32 ap_fade_mem_fx[STEREO_DFT_ALLPASS_FADELEN_16k]; /* Q(q_ap_fade_mem_fx) */ Word16 q_ap_fade_mem_fx; #endif @@ -1121,10 +1125,12 @@ typedef struct cpe_dec_data_structure float prev_synth[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS )]; /* DFT stereo I/O channel buffer memories that need to be updated for TD->DFT stereo switching */ +#ifndef IVAS_FLOAT_FIXED float *input_mem[CPE_CHANNELS]; float *input_mem_LB[CPE_CHANNELS]; float *input_mem_BPF[1]; float *output_mem[CPE_CHANNELS]; +#endif #ifdef IVAS_FLOAT_FIXED Word32 lt_es_em_fx;//24 @@ -1133,11 +1139,11 @@ typedef struct cpe_dec_data_structure Word32 prev_synth_fx[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS )]; Word16 q_prev_synth_fx; - Word32 *input_mem_fx[CPE_CHANNELS]; - Word32 *input_mem_LB_fx[CPE_CHANNELS]; - Word32 *input_mem_BPF_fx[1]; + Word32 *input_mem_fx[CPE_CHANNELS]; /* Q11 */ + Word32 *input_mem_LB_fx[CPE_CHANNELS]; /* Q11 */ + Word32 *input_mem_BPF_fx[1]; /* Q11 */ - Word32 *output_mem_fx[CPE_CHANNELS]; + Word32 *output_mem_fx[CPE_CHANNELS]; /* Q(q_output_mem_fx) */ Word16 q_output_mem_fx[CPE_CHANNELS]; Word32 *prev_synth_chs_fx[CPE_CHANNELS]; diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 5ac890f7ce664533d3f82451bcabc0277bc01313..d0381d674e9b0f28edeb1111f3cda6e6620271c4 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -564,10 +564,11 @@ void stereo_dft_dec_reset( set_s( hStereoDft->res_pred_mode, hStereoDft->hConfig->res_pred_mode, STEREO_DFT_DEC_DFT_NB ); for ( i = 0; i < STEREO_DFT_PAST_MAX; i++ ) { - set_zero( hStereoDft->DFT_past_DMX[i], STEREO_DFT32MS_N_32k ); #ifndef IVAS_FLOAT_FIXED + set_zero( hStereoDft->DFT_past_DMX[i], STEREO_DFT32MS_N_32k ); set_zero( hStereoDft->past_res_pred_gain[i], STEREO_DFT_BAND_MAX ); #else + set32_fx( hStereoDft->DFT_past_DMX_fx[i], 0, STEREO_DFT_BAND_MAX ); set32_fx( hStereoDft->past_res_pred_gain_fx[i], 0, STEREO_DFT_BAND_MAX ); #endif } @@ -623,8 +624,8 @@ void stereo_dft_dec_reset( hStereoDft->reverb_flag = 0; - hStereoDft->bpf_error_signal_last = 0.0f; #ifndef IVAS_FLOAT_FIXED + hStereoDft->bpf_error_signal_last = 0.0f; hStereoDft->bpf_error_ratio_mem = 1.0f; hStereoDft->res_hb_nrg_mem = 0.0f; #else @@ -685,7 +686,11 @@ void stereo_dft_dec_reset( #endif set_zero( hStereoDft->ap_delay_mem, NS2SA( 16000, DELAY_BWE_TOTAL_NS ) ); +#ifdef IVAS_FLOAT_FIXED + set32_fx( hStereoDft->ap_fade_mem_fx, 0, STEREO_DFT_ALLPASS_FADELEN_16k ); +#else set_zero( hStereoDft->ap_fade_mem, STEREO_DFT_ALLPASS_FADELEN_16k ); +#endif hStereoDft->ap_wasTransient = 0; #ifdef IVAS_FLOAT_FIXED set32_fx( hStereoDft->smooth_dmx_nrg_fx, 0, STEREO_DFT_BAND_MAX ); @@ -988,372 +993,6 @@ void stereo_dft_dec_destroy( *-------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -void stereo_dft_dec_analyze( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - // const Word32 *input_fx, /* i : input signal */ - // Word32 out_DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ - - const float *input, /* i : input signal */ - float out_DFT[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ - - const Word16 chan, /* i : channel number */ - const Word16 input_frame, /* i : input frame size */ - const Word16 output_frame, /* i : output frame size */ - const DFT_STEREO_DEC_ANA_TYPE ana_type, /* i : type of signal to analyse */ - const Word16 k_offset, /* i : offset of DFT */ - const Word16 delay /* i : delay in samples FOR input signal */ - /*Word16 *q, - Word16 *q_out_DFT*/ -) -{ - - Word16 q = 11; - Word32 output_Fs = hCPE->hCoreCoder[0]->output_Fs; - Word32 input_fx[2000]; - FOR( int i = 0; i < 960; i++ ) - { - input_fx[i] = (Word32)(input[i] * ( 1 << q )); - } - FOR( int i = 0; i < STEREO_DFT32MS_OVL_16k; i++ ) - hCPE->input_mem_BPF_fx[0][i] = (Word32)(hCPE->input_mem_BPF[0][i] * ( 1 << q )); - FOR( int i = 0; i < NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ); i++ ) - hCPE->input_mem_fx[0][i] = (Word32)(hCPE->input_mem[0][i] * ( 1 << q )); - FOR( int i = 0; i < STEREO_DFT32MS_OVL_16k; i++ ) - hCPE->input_mem_LB_fx[0][i] = (Word32)(hCPE->input_mem_LB[0][i] * ( 1 << q )); - FOR( int i = 0; i < NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ); i++ ) - hCPE->input_mem_fx[1][i] = (Word32)(hCPE->input_mem[1][i] * ( 1 << q )); - FOR( int i = 0; i < STEREO_DFT32MS_OVL_16k; i++ ) - hCPE->input_mem_LB_fx[1][i] = (Word32)(hCPE->input_mem_LB[1][i] * ( 1 << q )); - Word16 q_out_DFT[2] = { 3, 3 }; - Word32 out_DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX]; - IF( out_DFT ) - { - FOR( int i = 0; i < CPE_CHANNELS; i++ ) - FOR( int j = 0; j < STEREO_DFT_BUF_MAX; j++ ) - IF( abs( (Word32) out_DFT[i][j] ) != 0 ) - q_out_DFT[i] = min( q_out_DFT[i], norm_l( (Word32) out_DFT[i][j] ) ); - - FOR( int i = 0; i < CPE_CHANNELS; i++ ) - FOR( int j = 0; j < STEREO_DFT_BUF_MAX; j++ ) - out_DFT_fx[i][j] = (Word32)(out_DFT[i][j] * ( 1 << q_out_DFT[i] )); - } - ////////////////////////////////////////////////////////// - Word16 i, k; - STEREO_DFT_DEC_DATA_HANDLE hStereoDft; - Word32 *pInput_fx, *pInput_buff_fx; - Word32 *mem_fx, input_buff_fx[STEREO_DFT32MS_OVL_MAX + L_FRAME48k]; - Word32 DFT_fx[STEREO_DFT32MS_N_MAX], *pDFT_out_fx; - Word16 NFFT, NFFT_core, ovl, zp; - Word16 offset; - Word32 fac_fx; - const Word16 *trigo_fx, *win_left_fx, *win_right_fx, *win2_fx; - Word16 trigo_dec_fx[STEREO_DFT32MS_N_MAX / 2 + 1]; - Word16 trigo_step; - Word32 inputFs; - Word16 delay_dec; - Word16 mem_size; - Word16 ovl2; - - push_wmops( "DFT_analysis" ); - - hStereoDft = hCPE->hStereoDft; - - assert( output_frame == STEREO_DFT_NBDIV * hStereoDft->N ); - - /*-----------------------------------------------------------------* - * Initialization - *-----------------------------------------------------------------*/ - - IF( input_frame == output_frame ) - { - trigo_fx = hStereoDft->dft_trigo_fx; - trigo_step = hStereoDft->dft_trigo_step * STEREO_DFT_TRIGO_DEC_STEP; - win_right_fx = hStereoDft->win32ms_fx; - win_left_fx = hStereoDft->win32ms_fx; - win2_fx = hStereoDft->win232ms_fx; - - IF( ana_type == DFT_STEREO_DEC_ANA_BPF ) - { - assert( ( chan == 0 ) && "DFT stereo: BPF memory only FOR M channel" ); - mem_fx = hCPE->input_mem_BPF_fx[chan]; - } - ELSE IF( ana_type == DFT_STEREO_DEC_ANA_LB || ana_type == DFT_STEREO_DEC_ANA_LB_ADD ) - { - mem_fx = hCPE->input_mem_LB_fx[chan]; - } - ELSE - { - mem_fx = hCPE->input_mem_fx[chan]; - } - } - ELSE IF( input_frame == L_FRAME ) - { - trigo_fx = hStereoDft->dft_trigo_12k8_fx; - trigo_step = STEREO_DFT_TRIGO_SRATE_12k8_STEP * STEREO_DFT_TRIGO_DEC_STEP; - win_right_fx = hStereoDft->win32ms_12k8_fx; - win_left_fx = hStereoDft->win32ms_12k8_fx; - win2_fx = hStereoDft->win232ms_12k8_fx; - - IF( ana_type == DFT_STEREO_DEC_ANA_BPF ) - { - assert( ( chan == 0 ) && "DFT stereo: BPF memory only FOR M channel" ); - mem_fx = hCPE->input_mem_BPF_fx[chan]; - } - ELSE IF( ana_type == DFT_STEREO_DEC_ANA_LB || ana_type == DFT_STEREO_DEC_ANA_LB_ADD ) - { - mem_fx = hCPE->input_mem_LB_fx[chan]; - } - ELSE - { - assert( ( chan == 1 ) && "12.8kHz sampling rate only FOR second channel, i.e. residual coding or allpass signal" ); - mem_fx = hCPE->input_mem_fx[chan]; - } - } - ELSE IF( input_frame == L_FRAME16k ) - { - trigo_fx = hStereoDft->dft_trigo_16k_fx; - trigo_step = STEREO_DFT_TRIGO_SRATE_16k_STEP * STEREO_DFT_TRIGO_DEC_STEP; - win_right_fx = hStereoDft->win32ms_16k_fx; - win_left_fx = hStereoDft->win32ms_16k_fx; - win2_fx = hStereoDft->win232ms_16k_fx; - - IF( ana_type == DFT_STEREO_DEC_ANA_BPF ) - { - assert( ( chan == 0 ) && "DFT stereo: BPF memory only FOR M channel" ); - mem_fx = hCPE->input_mem_BPF_fx[chan]; - } - ELSE IF( ana_type == DFT_STEREO_DEC_ANA_LB || ana_type == DFT_STEREO_DEC_ANA_LB_ADD ) - { - mem_fx = hCPE->input_mem_LB_fx[chan]; - } - ELSE - { - assert( ( chan == 1 ) && hCPE->hStereoDft->hConfig->res_pred_mode == STEREO_DFT_RESPRED_ESF && "16kHz sampling rate only FOR second channel with allpass signal" ); - mem_fx = hCPE->input_mem_fx[chan]; - } - } - ELSE IF( input_frame == L_FRAME8k ) - { - assert( ( chan == 1 ) && "DFT stereo: 8kHz analysis only FOR residual coding" ); - trigo_fx = hStereoDft->dft_trigo_8k_fx; - trigo_step = STEREO_DFT_TRIGO_SRATE_8k_STEP * STEREO_DFT_TRIGO_DEC_STEP; - win_right_fx = hStereoDft->win32ms_8k_fx; - win_left_fx = hStereoDft->win32ms_8k_fx; - win2_fx = hStereoDft->win232ms_8k_fx; - mem_fx = hCPE->input_mem_fx[chan]; - } - ELSE - { - IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error in DFT stereo: sampling rate not supported" ); - mem_fx = NULL; /* to avoid compilation warning */ - trigo_fx = NULL; /* to avoid compilation warning */ - trigo_step = -1; /* to avoid compilation warning */ - win_right_fx = NULL; /* to avoid compilation warning */ - win_left_fx = NULL; /* to avoid compilation warning */ - win2_fx = NULL; /* to avoid compilation warning */ - } - - inputFs = input_frame * FRAMES_PER_SEC; - delay_dec = NS2SA( inputFs, STEREO_DFT32MS_OVL_NS ); - zp = NS2SA( inputFs, STEREO_DFT32MS_ZP_NS ); - ovl = NS2SA( inputFs, STEREO_DFT32MS_OVL_NS ); - NFFT = NS2SA( inputFs, STEREO_DFT32MS_N_NS ); - Word16 w1, w2, qw1, qw2, qfac_fx; - qw1 = norm_s( hStereoDft->NFFT ); - qw2 = norm_s( NFFT ); - w1 = shl( hStereoDft->NFFT, qw1 - 1 ); - w2 = shl( NFFT, qw2 ); - fac_fx = L_shl( div_s( w1, w2 ), 16 ); - qfac_fx = 31 - ( qw2 - ( qw1 - 1 ) ); - ovl2 = NS2SA( inputFs, STEREO_DFT32MS_OVL2_NS ); - - /* Offset FOR the time buffers */ - assert( ( delay >= -NS2SA( input_frame * FRAMES_PER_SEC, STEREO_DFT_DELAY_DEC_BWE_NS + STEREO_DFT_OVL_NS / 2 ) ) && ( delay <= NS2SA( input_frame * FRAMES_PER_SEC, STEREO_DFT_OVL_NS ) ) ); - mem_size = delay_dec + delay; - - /* Update buffers */ - Copy32( mem_fx, input_buff_fx, mem_size ); - Copy32( input_fx, input_buff_fx + mem_size, input_frame ); - Copy32( input_buff_fx + input_frame, mem_fx, mem_size ); - pInput_buff_fx = input_buff_fx; - - IF( hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) - { - pop_wmops(); - return; - } - - - /*-----------------------------------------------------------------* - * DFT Analysis: loop over frame - *-----------------------------------------------------------------*/ - - assert( k_offset <= STEREO_DFT_NBDIV ); - - FOR( i = 0; i < NFFT / 4; i++ ) - { - trigo_dec_fx[i] = trigo_fx[i * trigo_step]; - trigo_dec_fx[NFFT / 2 - i] = trigo_fx[i * trigo_step]; - } - trigo_dec_fx[NFFT / 4] = trigo_fx[NFFT / 4 * trigo_step]; - - FOR( k = 0; k < STEREO_DFT_NBDIV - k_offset; k++ ) - { - set32_fx( DFT_fx, 0, STEREO_DFT32MS_N_MAX ); - IF( k == 0 ) - { - offset = 0; - } - ELSE - { - /* If OVL2 = OVL offset = 10ms */ - offset = NS2SA( inputFs, STEREO_DFT32MS_WIN_CENTER_NS - STEREO_DFT32MS_OVL2_NS / 2 ); - } - - pInput_fx = pInput_buff_fx + offset; - pDFT_out_fx = out_DFT_fx[chan] + k * STEREO_DFT32MS_N_MAX; - - /*Forwards FFT: L and R*/ - /* Zero Padding & Flat Portion */ - Copy32( pInput_fx, DFT_fx + zp, NFFT - 2 * zp ); - - /* Overlapping portions */ - IF( k == 0 ) - { - FOR( i = 0; i < ovl; i++ ) - { - DFT_fx[i + zp] = Mpy_32_16_1( DFT_fx[i + zp], win_left_fx[STEREO_DFT32MS_STEP * i] ); - } - FOR( i = 0; i < ovl2; i++ ) - { - DFT_fx[NFFT - zp - 1 - i] = Mpy_32_16_1( DFT_fx[NFFT - zp - 1 - i], win2_fx[i] ); - } - } - ELSE - { - FOR( i = 0; i < ovl2; i++ ) - { - DFT_fx[i + zp] = Mpy_32_16_1( DFT_fx[i + zp], win2_fx[i] ); - } - FOR( i = 0; i < ovl; i++ ) - { - DFT_fx[NFFT - zp - i - 1] = Mpy_32_16_1( DFT_fx[NFFT - zp - i - 1], win_right_fx[STEREO_DFT32MS_STEP * i] ); - } - } - Word16 q_DFT, q_shift, guarded_bits; - q_DFT = q; - guarded_bits = find_guarded_bits_fx( NFFT ); - q_shift = L_norm_arr( DFT_fx, NFFT ) - guarded_bits; - - FOR( Word16 j = 0; j < NFFT; j++ ) - { - DFT_fx[j] = L_shl( DFT_fx[j], q_shift ); - } - - q_DFT += q_shift; - - rfft_fx( DFT_fx, trigo_dec_fx, NFFT, -1 ); - - q_shift = L_norm_arr( DFT_fx, NFFT ) - ( 31 - qfac_fx ); - FOR( Word16 j = 0; j < NFFT; j++ ) - { - DFT_fx[j] = L_shl( DFT_fx[j], q_shift ); - } - q_DFT += q_shift; - IF( q_out_DFT[chan] - q_DFT > 0 ) - { - FOR( int j = 0; j < NFFT; j++ ) - { - out_DFT_fx[chan][j] = L_shr( out_DFT_fx[chan][j], q_out_DFT[chan] - q_DFT ); - } - q_out_DFT[chan] = q_DFT; - } - ELSE - { - FOR( int j = 0; j < NFFT; j++ ) - { - DFT_fx[j] = L_shr( DFT_fx[j], q_DFT - q_out_DFT[chan] ); - } - q_DFT = q_out_DFT[chan]; - } - - /*Resampling: filtering+scaling*/ - IF( ana_type == DFT_STEREO_DEC_ANA_FB || ana_type == DFT_STEREO_DEC_ANA_LB || ana_type == DFT_STEREO_DEC_ANA_NOCORE ) - { - pDFT_out_fx[0] = L_shl( Mpy_32_32( DFT_fx[0], fac_fx ), 31 - qfac_fx ); /*DC*/ - IF( NFFT == hStereoDft->NFFT ) /*Nyquist*/ - { - pDFT_out_fx[1] = L_shl( Mpy_32_32( DFT_fx[1], fac_fx ), 31 - qfac_fx ); - } - ELSE - { - pDFT_out_fx[1] = 0; - } - FOR( i = 2; i < NFFT; i++ ) - { - pDFT_out_fx[i] = L_shl( Mpy_32_32( DFT_fx[i], fac_fx ), 31 - qfac_fx ); - } - FOR( i = NFFT; i < hStereoDft->NFFT; i++ ) - { - pDFT_out_fx[i] = 0; - } - } - ELSE IF( ana_type == DFT_STEREO_DEC_ANA_BPF ) - { - pDFT_out_fx[0] = L_sub( pDFT_out_fx[0], L_shl( Mpy_32_32( Mpy_32_32( DFT_fx[0], fac_fx ), dft_bpf_weights_fx[0] ), 32 - qfac_fx ) ); - - FOR( i = 1; i < STEREO_DFT_BPF_SIZE; i++ ) - { - pDFT_out_fx[2 * i] = L_sub( pDFT_out_fx[2 * i], L_shl( Mpy_32_32( Mpy_32_32( DFT_fx[2 * i], fac_fx ), dft_bpf_weights_fx[i] ), 32 - qfac_fx ) ); - pDFT_out_fx[2 * i + 1] = L_sub( pDFT_out_fx[2 * i + 1], L_shl( Mpy_32_32( Mpy_32_32( DFT_fx[2 * i + 1], fac_fx ), dft_bpf_weights_fx[i] ), 32 - qfac_fx ) ); - } - } - ELSE IF( ana_type == DFT_STEREO_DEC_ANA_HB_ADD ) - { - NFFT_core = NS2SA( hCPE->hCoreCoder[0]->L_frame * FRAMES_PER_SEC, STEREO_DFT32MS_N_NS ); - - FOR( i = NFFT_core; i < NFFT; i++ ) - { - pDFT_out_fx[i] = L_add( L_shl( Mpy_32_32( DFT_fx[i], fac_fx ), 31 - qfac_fx ), pDFT_out_fx[i] ); - } - } - ELSE - { - pDFT_out_fx[0] = L_add( pDFT_out_fx[0], L_shl( Mpy_32_32( DFT_fx[0], fac_fx ), 31 - qfac_fx ) ); /*DC*/ - IF( NFFT == hStereoDft->NFFT ) /*Nyquist*/ - { - pDFT_out_fx[1] = L_add( L_shl( Mpy_32_32( DFT_fx[1], fac_fx ), 31 - qfac_fx ), pDFT_out_fx[1] ); - } - FOR( i = 2; i < NFFT; i++ ) - { - pDFT_out_fx[i] = L_add( L_shl( Mpy_32_32( DFT_fx[i], fac_fx ), 31 - qfac_fx ), pDFT_out_fx[i] ); - } - } - } - /////////////////////////////////////////////////////// - FOR( int j = 0; j < STEREO_DFT32MS_OVL_16k; j++ ) - hCPE->input_mem_BPF[0][j] = (float) hCPE->input_mem_BPF_fx[0][j] / (float) ( 1 << q ); - FOR( int j = 0; j < NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ); j++ ) - hCPE->input_mem[0][j] = (float) hCPE->input_mem_fx[0][j] / (float) ( 1 << q ); - FOR( int j = 0; j < STEREO_DFT32MS_OVL_16k; j++ ) - hCPE->input_mem_LB[0][j] = (float) hCPE->input_mem_LB_fx[0][j] / (float) ( 1 << q ); - FOR( int j = 0; j < NS2SA( output_Fs, STEREO_DFT32MS_OVL_NS ); j++ ) - hCPE->input_mem[1][j] = (float) hCPE->input_mem_fx[1][j] / (float) ( 1 << q ); - FOR( int j = 0; j < STEREO_DFT32MS_OVL_16k; j++ ) - hCPE->input_mem_LB[1][j] = (float) hCPE->input_mem_LB_fx[1][j] / (float) ( 1 << q ); - - IF( out_DFT ) - { - FOR( k = 0; k < CPE_CHANNELS; k++ ) - FOR( int j = 0; j < STEREO_DFT_BUF_MAX; j++ ) - { - out_DFT[k][j] = (float) out_DFT_fx[k][j] / (float) ( 1 << q_out_DFT[k] ); - } - } - //////////////////////////////////////////////////////////////// - pop_wmops(); - return; -} void stereo_dft_dec_analyze_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ const Word32 *input_fx, /* i : input signal */ diff --git a/lib_dec/ivas_stereo_dft_dec_dmx.c b/lib_dec/ivas_stereo_dft_dec_dmx.c index 49743166dc0ab40e26cf796dd1afacf1d2e2177c..4397532953f3dfc8f60adc1e28eaffe8703105a2 100644 --- a/lib_dec/ivas_stereo_dft_dec_dmx.c +++ b/lib_dec/ivas_stereo_dft_dec_dmx.c @@ -351,16 +351,12 @@ void stereo_dft_unify_dmx_fx( pDFT_DMX[2 * i + 1] = L_shl( Mpy_32_32( L_add( Mpy_32_16_1( DFT_L[2 * i + 1], wL ), Mpy_32_16_1( DFT_R[2 * i + 1], wR ) ), INV_SQRT_2_Q31 ), Q2 ); /* Q(hStereoDft->q_dft) */ } } - // Scale_sig32(pDFT_DMX, (hStereoDft->band_limits[0]), -2); - // Scale_sig32(pDFT_DMX + hStereoDft->band_limits[hStereoDft->res_cod_band_max + 1], hStereoDft->NFFT - hStereoDft->band_limits[hStereoDft->res_cod_band_max + 1], -2); - Copy32( pDFT_DMX, DFT[0] + i_mult( k, STEREO_DFT32MS_N_MAX ), hStereoDft->NFFT ); /* Update DFT_past_DMX, needed for stereo filling used by stereo residual PLC */ hStereoDft->past_DMX_pos = ( hStereoDft->past_DMX_pos + 1 ) % STEREO_DFT_PAST_MAX; Copy32( pDFT_DMX, hStereoDft->DFT_past_DMX_fx[hStereoDft->past_DMX_pos], s_min( hStereoDft->NFFT, STEREO_DFT32MS_N_32k ) ); - // Scale_sig32(hStereoDft->DFT_past_DMX_fx[hStereoDft->past_DMX_pos], s_min(hStereoDft->NFFT, STEREO_DFT32MS_N_32k), -2); - // hStereoDft->q_DFT_past_DMX_fx[hStereoDft->past_DMX_pos] = sub(add(hStereoDft->q_dft, 13), 15); + hStereoDft->q_DFT_past_DMX_fx[hStereoDft->past_DMX_pos] = hStereoDft->q_dft; IF( st0->bfi && !prev_bfi ) { Word16 idx_k0, idx_k1; @@ -376,8 +372,6 @@ void stereo_dft_unify_dmx_fx( } } - // hStereoDft->q_dft = sub(add(hStereoDft->q_dft, 13), 15); - return; } #else diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 4fc77c669eace9b483d4197bac3b9e77e7a6cac3..2a25d8a3b096965427c2d61ca62ff2ee5e12d7ae 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -750,7 +750,7 @@ static void run_min_stats( } } - noisy_speech_detection_flt( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, power_spec ); + noisy_speech_detection( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, power_spec ); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt = 0.99f * st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt + 0.01f * (float) st->hFdCngDec->hFdCngCom->flag_noisy_speech; #ifdef IVAS_FLOAT_FIXED @@ -762,7 +762,7 @@ static void run_min_stats( if ( will_estimate_noise_on_channel[0] || will_estimate_noise_on_channel[1] || st->bfi ) { - ApplyFdCng_flt( NULL, st->bfi ? NULL : power_spec, NULL, NULL, st, st->bfi, 0 ); + ApplyFdCng( NULL, st->bfi ? NULL : power_spec, NULL, NULL, st, st->bfi, 0 ); } /* restore VAD (see above) */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 0bd8dc7942da637f94e2f52847190f272c9d4a72..0da7235e9c73545d14980bfa1e93be7910bab116 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -1013,7 +1013,7 @@ static void run_min_stats_fx( Copy_Scale_sig32_16(power_spec, power_spec_16, L_FRAME16k, 0); - noisy_speech_detection( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, power_spec_16, sub(15, power_spec_e)); + noisy_speech_detection_fx( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, power_spec_16, sub(15, power_spec_e)); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_32fx = L_add(Mpy_32_32(Q31_0_99, st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_32fx), Mpy_32_32(st->hFdCngDec->hFdCngCom->flag_noisy_speech, Q31_0_01)); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = extract_h( st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_32fx ); @@ -1034,7 +1034,7 @@ static void run_min_stats_fx( //Scale_sig32(power_spec, L_FRAME16k, sub(power_spec_e, 31)); //power_spec_e = 31; /*=================================================*/ - ApplyFdCng_fx( NULL, 0, st->bfi ? NULL : power_spec, sub(31, power_spec_e), NULL, NULL, NULL, st, st->bfi, 0 ); + ApplyFdCng_ivas_fx( NULL, 0, st->bfi ? NULL : power_spec, sub(31, power_spec_e), NULL, NULL, NULL, st, st->bfi, 0 ); /*=================================================*/ } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index 87a1e1bfbfec856c7068a2d6b3a3bef4dadfb85f..866e53366e51a23a4244ddeb382558279f5b67a1 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -891,16 +891,16 @@ ivas_error initMdctStereoDtxData_fx( IF( st->hFdCngDec == NULL ) { /* Create FD_CNG instance */ - IF( ( error = createFdCngDec( &st->hFdCngDec ) ) != IVAS_ERR_OK ) + IF( ( error = createFdCngDec_fx( &st->hFdCngDec ) ) != IVAS_ERR_OK ) { return error; } /* Init FD-CNG */ #if 1/*TODO: To be removed later*/ - initFdCngDec_flt( st ); + initFdCngDec( st ); #endif - ivas_initFdCngDec_fx( st, st->cldfbSyn->scale ); + initFdCngDec_ivas_fx( st, st->cldfbSyn->scale ); } IF( EQ_16( st->first_CNG, 0 ) ) @@ -950,16 +950,16 @@ ivas_error initMdctStereoDtxData( IF ( st->hFdCngDec == NULL ) { /* Create FD_CNG instance */ - IF ( ( error = createFdCngDec_flt( &st->hFdCngDec ) ) != IVAS_ERR_OK ) + IF ( ( error = createFdCngDec( &st->hFdCngDec ) ) != IVAS_ERR_OK ) { return error; } /* Init FD-CNG */ - initFdCngDec_flt( st ); + initFdCngDec( st ); #ifdef IVAS_FLOAT_FIXED st->cldfbSyn->scale = (Word16) ( st->cldfbSyn->scale_flt * ( 1u << norm_s( (Word16) st->cldfbSyn->scale_flt ) ) ); - ivas_initFdCngDec_fx( st, st->cldfbSyn->scale ); + initFdCngDec_ivas_fx( st, st->cldfbSyn->scale ); #endif IVAS_FLOAT_FIXED } @@ -1032,14 +1032,14 @@ void synchonize_channels_mdct_sid_fx( test(); IF( EQ_16( sts[0]->first_CNG, 1 ) && EQ_16( sts[1]->first_CNG, 0 ) ) { - configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); } } IF( EQ_16( sts[0]->first_CNG, 0 ) ) { /* configure CNG after reading first side info from SID to get correct values for L_frame and bwidth if first SID is also first valid frame */ - configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); } } @@ -1069,14 +1069,14 @@ void synchonize_channels_mdct_sid( /* configure when there is a switching from DFT CNG to MDCT CNG */ if ( sts[0]->first_CNG == 1 && sts[1]->first_CNG == 0 ) { - configureFdCngDec_flt( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); } } if ( sts[0]->first_CNG == 0 ) { /* configure CNG after reading first side info from SID to get correct values for L_frame and bwidth if first SID is also first valid frame */ - configureFdCngDec_flt( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec( st->hFdCngDec, st->bwidth, st->element_brate, st->L_frame, st->last_L_frame, st->element_mode ); } } diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index b56676021a1e4f1e5041575f1a71ffc354b84ea3..5d1c93a94f7d34f7e0653c101e4c05c8f23e01a6 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -707,7 +707,7 @@ ivas_error stereo_memory_dec( if ( hCPE->last_element_mode == IVAS_CPE_MDCT ) { cpy_tcx_ltp_data( hCPE->hCoreCoder[1]->hTcxLtpDec, hCPE->hStereoDft->hTcxLtpDec, output_Fs ); - deleteFdCngDec_flt( &hCPE->hCoreCoder[1]->hFdCngDec ); + deleteFdCngDec( &hCPE->hCoreCoder[1]->hFdCngDec ); } /* memory update - needed in TD stereo, TCX/HQ frame -> DFT stereo, ACELP frame switching */ @@ -772,7 +772,7 @@ ivas_error stereo_memory_dec( if ( hCPE->last_element_mode == IVAS_CPE_MDCT ) { - deleteFdCngDec_flt( &hCPE->hCoreCoder[1]->hFdCngDec ); + deleteFdCngDec( &hCPE->hCoreCoder[1]->hFdCngDec ); } /* allocate TD stereo data structure */ @@ -873,12 +873,12 @@ ivas_error stereo_memory_dec( if ( st->hFdCngDec == NULL ) { /* Create FD_CNG instance */ - if ( ( error = createFdCngDec_flt( &st->hFdCngDec ) ) != IVAS_ERR_OK ) + if ( ( error = createFdCngDec( &st->hFdCngDec ) ) != IVAS_ERR_OK ) { return error; } - initFdCngDec_flt( st ); - configureFdCngDec_flt( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); + initFdCngDec( st ); + configureFdCngDec( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); } /* allocate stereo CNG structure */ @@ -975,13 +975,13 @@ ivas_error stereo_memory_dec( } /* allocate Fd-Cng structure for second channel */ - if ( ( error = createFdCngDec_flt( &st->hFdCngDec ) ) != IVAS_ERR_OK ) + if ( ( error = createFdCngDec( &st->hFdCngDec ) ) != IVAS_ERR_OK ) { return error; } /* Init FD-CNG */ - initFdCngDec_flt( st ); + initFdCngDec( st ); if ( hCPE->last_element_mode == IVAS_CPE_DFT ) { @@ -1242,7 +1242,7 @@ ivas_error stereo_memory_dec( /* deallocate the FdCNG handle */ for ( i = 0; i < CPE_CHANNELS; ++i ) { - deleteFdCngDec_flt( &hCPE->hCoreCoder[i]->hFdCngDec ); + deleteFdCngDec( &hCPE->hCoreCoder[i]->hFdCngDec ); } } else @@ -1260,11 +1260,11 @@ ivas_error stereo_memory_dec( if ( hCPE->hCoreCoder[i]->hFdCngDec == NULL ) { - if ( ( error = createFdCngDec_flt( &hCPE->hCoreCoder[i]->hFdCngDec ) ) != IVAS_ERR_OK ) + if ( ( error = createFdCngDec( &hCPE->hCoreCoder[i]->hFdCngDec ) ) != IVAS_ERR_OK ) { return error; } - initFdCngDec_flt( hCPE->hCoreCoder[i] ); + initFdCngDec( hCPE->hCoreCoder[i] ); } } } @@ -1371,7 +1371,7 @@ ivas_error stereo_memory_dec_fx( IF ( EQ_16(hCPE->last_element_mode, IVAS_CPE_MDCT) ) { cpy_tcx_ltp_data_fx( hCPE->hCoreCoder[1]->hTcxLtpDec, hCPE->hStereoDft->hTcxLtpDec, output_Fs ); - deleteFdCngDec( &hCPE->hCoreCoder[1]->hFdCngDec ); + deleteFdCngDec_fx( &hCPE->hCoreCoder[1]->hFdCngDec ); } /* memory update - needed in TD stereo, TCX/HQ frame -> DFT stereo, ACELP frame switching */ @@ -1443,7 +1443,7 @@ ivas_error stereo_memory_dec_fx( IF ( EQ_16(hCPE->last_element_mode, IVAS_CPE_MDCT) ) { - deleteFdCngDec( &hCPE->hCoreCoder[1]->hFdCngDec ); + deleteFdCngDec_fx( &hCPE->hCoreCoder[1]->hFdCngDec ); } /* allocate TD stereo data structure */ @@ -1574,14 +1574,14 @@ ivas_error stereo_memory_dec_fx( IF ( st->hFdCngDec == NULL ) { /* Create FD_CNG instance */ - IF ( ( error = createFdCngDec( &st->hFdCngDec ) ) != IVAS_ERR_OK ) + IF ( ( error = createFdCngDec_fx( &st->hFdCngDec ) ) != IVAS_ERR_OK ) { return error; } - ivas_initFdCngDec_fx( st, st->cldfbSyn->scale ); + initFdCngDec_ivas_fx( st, st->cldfbSyn->scale ); - configureFdCngDec_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); + configureFdCngDec_ivas_fx( st->hFdCngDec, st->bwidth, st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); } /* allocate stereo CNG structure */ @@ -1680,15 +1680,15 @@ ivas_error stereo_memory_dec_fx( } /* allocate Fd-Cng structure for second channel */ - IF ( NE_16(( error = createFdCngDec( &st->hFdCngDec ) ), IVAS_ERR_OK) ) + IF ( NE_16(( error = createFdCngDec_fx( &st->hFdCngDec ) ), IVAS_ERR_OK) ) { return error; } /* Init FD-CNG */ - ivas_initFdCngDec_fx( st, st->cldfbSyn->scale); + initFdCngDec_ivas_fx( st, st->cldfbSyn->scale); #if 1 // TODO: To be removed later - initFdCngDec_flt( st ); + initFdCngDec( st ); #endif IF ( EQ_16(hCPE->last_element_mode, IVAS_CPE_DFT) ) @@ -1988,7 +1988,7 @@ ivas_error stereo_memory_dec_fx( /* deallocate the FdCNG handle */ FOR ( i = 0; i < CPE_CHANNELS; ++i ) { - deleteFdCngDec( &hCPE->hCoreCoder[i]->hFdCngDec ); + deleteFdCngDec_fx( &hCPE->hCoreCoder[i]->hFdCngDec ); } } ELSE @@ -2006,13 +2006,13 @@ ivas_error stereo_memory_dec_fx( IF ( hCPE->hCoreCoder[i]->hFdCngDec == NULL ) { - IF ( NE_16(( error = createFdCngDec( &hCPE->hCoreCoder[i]->hFdCngDec ) ), IVAS_ERR_OK) ) + IF ( NE_16(( error = createFdCngDec_fx( &hCPE->hCoreCoder[i]->hFdCngDec ) ), IVAS_ERR_OK) ) { return error; } - ivas_initFdCngDec_fx( hCPE->hCoreCoder[i], hCPE->hCoreCoder[i]->cldfbSyn->scale ); + initFdCngDec_ivas_fx( hCPE->hCoreCoder[i], hCPE->hCoreCoder[i]->cldfbSyn->scale ); #if 1 - initFdCngDec_flt( hCPE->hCoreCoder[i] ); + initFdCngDec( hCPE->hCoreCoder[i] ); #endif } } @@ -2393,9 +2393,6 @@ void synchro_synthesis_fx( const Word16 sba_dirac_stereo_flag /* i : signal stereo output FOR SBA DirAC */ ) { - - Word16 output_q = OUTPUT_Q; - Word16 n, delay_comp_TD, delay_comp_DFT; Word32 output_Fs; Decoder_State **sts; @@ -3622,7 +3619,7 @@ void stereo_td2dft_update_fx( } } } - ELSE IF( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->input_mem[0] != NULL ) + ELSE IF( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->input_mem_fx[0] != NULL ) { /* update DFT stereo OLA memories */ diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 66f5a428ec313a9da9a59bd54c22e3a1bef7df92..83db7194b51ce1d80557cc4176708505114609b0 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -424,7 +424,7 @@ void stereo_tcx_core_dec_fx( hTcxDec->envWeighted = 0; } - lpc_unquantize( st, lsf_fx, lsp_fx, M, param_lpc, lspmid_fx, lsfmid_fx, AUDIO, &LSF_Q_prediction ); + lpc_unquantize_fx( st, lsf_fx, lsp_fx, M, param_lpc, lspmid_fx, lsfmid_fx, AUDIO, &LSF_Q_prediction ); FOR( k = 0; k < st->numlpc; ++k ) { @@ -520,7 +520,7 @@ void stereo_tcx_core_dec_fx( } /* PLC: [TCX: TD PLC] */ - con_tcx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); + con_tcx_fx( st, &synthFB_fx[0] /*, -1.f, NULL, 0, NULL */ ); IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || hTcxDec->tcxConceal_recalc_exc ) { Copy_Scale_sig( &synthFB_fx[-( st->hTcxDec->L_frameTCX / 2 + hTcxDec->pit_max_TCX + 2 * M )], &synthFB_fx[-( st->hTcxDec->L_frameTCX / 2 + hTcxDec->pit_max_TCX + 2 * M )], st->hTcxDec->L_frameTCX / 2 + hTcxDec->pit_max_TCX + 2 * M, -( st->Q_exc - 1 ) ); @@ -597,7 +597,7 @@ void stereo_tcx_core_dec_fx( } /* TCX decoder */ - decoder_tcx_fx( st, prm, Aq_fx, Aind, &synth_fx[0], &synthFB_fx[0], bfi, 0, sba_dirac_stereo_flag ); + decoder_tcx_ivas_fx( st, prm, Aq_fx, Aind, &synth_fx[0], &synthFB_fx[0], bfi, 0, sba_dirac_stereo_flag ); } /*--------------------------------------------------------------------------------* @@ -626,7 +626,7 @@ void stereo_tcx_core_dec_fx( } /* TCX decoder */ - decoder_tcx_fx( st, prm, Aq_fx, Aind, &synth_fx[k * st->L_frame / 2], &synthFB_fx[k * hTcxDec->L_frameTCX / 2], bfi, k, sba_dirac_stereo_flag ); + decoder_tcx_ivas_fx( st, prm, Aq_fx, Aind, &synth_fx[k * st->L_frame / 2], &synthFB_fx[k * hTcxDec->L_frameTCX / 2], bfi, k, sba_dirac_stereo_flag ); } } @@ -662,7 +662,7 @@ void stereo_tcx_core_dec_fx( fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); } - decoder_tcx_post( st, synth_fx, synthFB_fx, Aq_fx, bfi ); + decoder_tcx_post_fx( st, synth_fx, synthFB_fx, Aq_fx, bfi ); IF( EQ_16( st->core, TCX_20_CORE ) ) { @@ -817,7 +817,7 @@ void stereo_tcx_core_dec_fx( IF( st->hFdCngDec != NULL && ( EQ_32( st->sr_core, INT_FS_12k8 ) || EQ_32( st->sr_core, INT_FS_16k ) ) && LE_32( st->total_brate, MAX_ACELP_BRATE ) ) { - noisy_speech_detection( st->hFdCngDec, st->VAD && EQ_16( st->m_frame_type, ACTIVE_FRAME ), signal_out_fx, 0 ); + noisy_speech_detection_fx( st->hFdCngDec, st->VAD && EQ_16( st->m_frame_type, ACTIVE_FRAME ), signal_out_fx, 0 ); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_32fx = L_add( Mpy_32_32( Q31_0_99, st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_32fx ), st->hFdCngDec->hFdCngCom->flag_noisy_speech * Q31_0_01 ); @@ -830,11 +830,11 @@ void stereo_tcx_core_dec_fx( { Word16 buffer[L_FRAME16k]; lerp( signal_outFB_fx, buffer, st->L_frame, hTcxDec->L_frameTCX ); - ApplyFdCng_fx( buffer, 0 /* Q of buffer */, NULL, 0, NULL, NULL, NULL, st, st->bfi, 0 ); + ApplyFdCng_ivas_fx( buffer, 0 /* Q of buffer */, NULL, 0, NULL, NULL, NULL, st, st->bfi, 0 ); } ELSE { - ApplyFdCng_fx( signal_out_fx, 0, NULL, 0, NULL, NULL, NULL, st, st->bfi, 0 ); + ApplyFdCng_ivas_fx( signal_out_fx, 0, NULL, 0, NULL, NULL, NULL, st, st->bfi, 0 ); } } @@ -851,18 +851,18 @@ void stereo_tcx_core_dec_fx( expand_range( st->hFdCngDec->msPsd, psd_part_fx, &psd_part_e, st->hFdCngDec->nFFTpart_shaping ); scalebands_fx( psd_part_fx, st->hFdCngDec->part_shaping, st->hFdCngDec->nFFTpart_shaping, st->hFdCngDec->midband_shaping, st->hFdCngDec->nFFTpart_shaping, st->hFdCngDec->hFdCngCom->stopFFTbin - st->hFdCngDec->hFdCngCom->startBand, psd_fx, 1 ); - generate_stereo_masking_noise_16fx( signal_out_fx, 0, st, hStereoTD, flag_sec_CNA, 0, hStereoCng, nchan_out ); + generate_stereo_masking_noise_fx( signal_out_fx, 0, st, hStereoTD, flag_sec_CNA, 0, hStereoCng, nchan_out ); } ELSE IF( NE_16( st->element_mode, IVAS_CPE_DFT ) ) { - // generate_masking_noise_flt( signal_out, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); - generate_masking_noise( signal_out_fx, 0, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0 ); + // generate_masking_noise( signal_out, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); + generate_masking_noise_fx( signal_out_fx, 0, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0 ); } } IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && EQ_16( st->idchan, 0 ) ) { - ApplyFdCng_fx( signal_out_fx, 0, NULL, 0, NULL, NULL, NULL, st, st->bfi, 0 ); + ApplyFdCng_ivas_fx( signal_out_fx, 0, NULL, 0, NULL, NULL, NULL, st, st->bfi, 0 ); } } @@ -997,7 +997,7 @@ void stereo_tcx_core_dec( /* PLC: [Common: mode decision] * PLC: Decide which Concealment to use. Update pitch lags if needed */ - st->core = GetPLCModeDecision_flt( st ); + st->core = GetPLCModeDecision( st ); } /*--------------------------------------------------------------------------------* @@ -1042,7 +1042,7 @@ void stereo_tcx_core_dec( hTcxDec->envWeighted = 0; } - lpc_unquantize_flt( st, lsf, lsp, param_lpc, lspmid, lsfmid, AUDIO, &LSF_Q_prediction ); + lpc_unquantize( st, lsf, lsp, param_lpc, lspmid, lsfmid, AUDIO, &LSF_Q_prediction ); for ( k = 0; k < st->numlpc; ++k ) { @@ -1137,7 +1137,7 @@ void stereo_tcx_core_dec( } /* PLC: [TCX: TD PLC] */ - con_tcx_flt( st, &synthFB[0], -1.f, NULL, 0, NULL ); + con_tcx( st, &synthFB[0], -1.f, NULL, 0, NULL ); lerp_flt( synthFB, synth, st->L_frame, hTcxDec->L_frameTCX ); st->con_tcx = 1; set_f( &st->mem_pitch_gain_float[2], st->lp_gainp, st->nb_subfr ); @@ -1204,7 +1204,7 @@ void stereo_tcx_core_dec( } /* TCX decoder */ - decoder_tcx_flt( st, prm, Aq, Aind, &synth[0], &synthFB[0], bfi, 0, sba_dirac_stereo_flag ); + decoder_tcx( st, prm, Aq, Aind, &synth[0], &synthFB[0], bfi, 0, sba_dirac_stereo_flag ); } /*--------------------------------------------------------------------------------* @@ -1232,7 +1232,7 @@ void stereo_tcx_core_dec( } /* TCX decoder */ - decoder_tcx_flt( st, prm, Aq, Aind, &synth[k * st->L_frame / 2], &synthFB[k * hTcxDec->L_frameTCX / 2], bfi, k, sba_dirac_stereo_flag ); + decoder_tcx( st, prm, Aq, Aind, &synth[k * st->L_frame / 2], &synthFB[k * hTcxDec->L_frameTCX / 2], bfi, k, sba_dirac_stereo_flag ); } } @@ -1265,7 +1265,7 @@ void stereo_tcx_core_dec( TonalMDCTConceal_SaveTimeSignal_ivas( st->hTonalMDCTConc, synthFB, hTcxDec->L_frameTCX ); } - decoder_tcx_post_flt( st, synth, synthFB, Aq, bfi, 0 ); + decoder_tcx_post( st, synth, synthFB, Aq, bfi, 0 ); if ( st->core == TCX_20_CORE ) { @@ -1410,7 +1410,7 @@ void stereo_tcx_core_dec( if ( st->hFdCngDec != NULL && ( st->sr_core == INT_FS_12k8 || st->sr_core == INT_FS_16k ) && st->total_brate <= MAX_ACELP_BRATE ) { - noisy_speech_detection_flt( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, signal_out ); + noisy_speech_detection( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, signal_out ); st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt = 0.99f * st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt + 0.01f * (float) st->hFdCngDec->hFdCngCom->flag_noisy_speech; @@ -1422,11 +1422,11 @@ void stereo_tcx_core_dec( { float buffer[L_FRAME16k]; lerp_flt( signal_outFB, buffer, st->L_frame, hTcxDec->L_frameTCX ); - ApplyFdCng_flt( buffer, NULL, NULL, NULL, st, st->bfi, 0 ); + ApplyFdCng( buffer, NULL, NULL, NULL, st, st->bfi, 0 ); } else { - ApplyFdCng_flt( signal_out, NULL, NULL, NULL, st, st->bfi, 0 ); + ApplyFdCng( signal_out, NULL, NULL, NULL, st, st->bfi, 0 ); } } @@ -1446,13 +1446,13 @@ void stereo_tcx_core_dec( } else if ( st->element_mode != IVAS_CPE_DFT ) { - generate_masking_noise_flt( signal_out, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); + generate_masking_noise( signal_out, st->hFdCngDec->hFdCngCom, st->hFdCngDec->hFdCngCom->frameSize, 0, 0, 0, st->element_mode, hStereoCng, nchan_out ); } } if ( st->element_mode == IVAS_CPE_TD && st->idchan == 0 ) { - ApplyFdCng_flt( signal_out, NULL, NULL, NULL, st, st->bfi, 0 ); + ApplyFdCng( signal_out, NULL, NULL, NULL, st, st->bfi, 0 ); } } @@ -1755,7 +1755,7 @@ static void dec_prm_tcx_ivas_fx( * LPC parameters *--------------------------------------------------------------------------------*/ - getLPCparam( st, param_lpc, st, -1, 0 ); + getLPCparam_fx( st, param_lpc, st, -1, 0 ); bits_common = sub( st->next_bit_pos, start_bit_pos ); @@ -1766,7 +1766,7 @@ static void dec_prm_tcx_ivas_fx( IF( EQ_16( st->use_partial_copy, 0 ) ) { - getTCXparam( st, st, hm_cfg, param, bits_common, start_bit_pos, NULL, NULL, NULL, -1 ); + getTCXparam_fx( st, st, hm_cfg, param, bits_common, start_bit_pos, NULL, NULL, NULL, -1 ); } IF( !st->use_partial_copy ) diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 6433f5a7a4f77d002e1f1a7178b23d559938f52d..4b17b616bd9d88ffef9cb6bbaa393c80aa9ec0b0 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2778,7 +2778,7 @@ static ivas_error evs_dec_main( else { #ifndef IVAS_FLOAT_FIXED - if ( ( error = evs_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) #else if ( ( error = evs_dec_fx(hCoreCoder[0], output_16, FRAMEMODE_NORMAL) ) != IVAS_ERR_OK ) #endif @@ -2792,7 +2792,7 @@ static ivas_error evs_dec_main( if ( hCoreCoder[0]->bfi == 0 ) { #ifndef IVAS_FLOAT_FIXED - if ( ( error = evs_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) #else if ( ( error = evs_dec_fx(hCoreCoder[0], output_16, FRAMEMODE_NORMAL)) != IVAS_ERR_OK ) #endif @@ -2803,7 +2803,7 @@ static ivas_error evs_dec_main( else if ( hCoreCoder[0]->bfi == 2 ) { #ifndef IVAS_FLOAT_FIXED - if ( ( error = evs_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) #else if ( ( error = evs_dec_fx(hCoreCoder[0], output_16, FRAMEMODE_FUTURE)) != IVAS_ERR_OK ) #endif @@ -2814,7 +2814,7 @@ static ivas_error evs_dec_main( else { #ifndef IVAS_FLOAT_FIXED - if ( ( error = evs_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) + if ( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) #else if ( ( error = evs_dec_fx(hCoreCoder[0], output_16, FRAMEMODE_MISSING)) != IVAS_ERR_OK ) #endif diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 3b06518e75c108fa5043c1bcca715a025daafa60..0a7bba5f35dabe09f46c5bb73d3fc2542f5eef32 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -2886,7 +2886,7 @@ static ivas_error evs_dec_main( ELSE { #ifndef IVAS_FLOAT_FIXED - IF( ( error = evs_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) + IF( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) #else IF( ( error = evs_dec_fx( hCoreCoder[0], output_16, FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) #endif @@ -2900,7 +2900,7 @@ static ivas_error evs_dec_main( IF( EQ_16( hCoreCoder[0]->bfi, 0 ) ) { #ifndef IVAS_FLOAT_FIXED - IF( ( error = evs_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) + IF( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) #else IF( ( error = evs_dec_fx( hCoreCoder[0], output_16, FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) #endif @@ -2911,7 +2911,7 @@ static ivas_error evs_dec_main( ELSE IF( EQ_16( hCoreCoder[0]->bfi, 2 ) ) { #ifndef IVAS_FLOAT_FIXED - IF( ( error = evs_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) + IF( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) #else IF( ( error = evs_dec_fx( hCoreCoder[0], output_16, FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) #endif @@ -2922,7 +2922,7 @@ static ivas_error evs_dec_main( ELSE { #ifndef IVAS_FLOAT_FIXED - IF( ( error = evs_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) + IF( ( error = evs_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0], FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) #else IF( ( error = evs_dec_fx( hCoreCoder[0], output_16, FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index ca6291a5547de4392f8b9f24d51e1d315609e95a..c4d70edf8bb831c21a353398af199006be3d89c1 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1260,7 +1260,7 @@ static void ivas_dirac_dec_binaural_internal( move16(); slotInFrame = add(hSpatParamRendCom->slots_rendered, slot); - generate_masking_noise_dirac_fx( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, + generate_masking_noise_dirac_ivas_fx( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], st_ivas->hTcBuffer->tc_fx[nchan_transport], Cldfb_RealBuffer_in_fx[2][slot], Cldfb_ImagBuffer_in_fx[2][slot], @@ -1269,7 +1269,7 @@ static void ivas_dirac_dec_binaural_internal( ( st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA || st_ivas->hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 ) && ( st_ivas->hSCE[0]->hCoreCoder[0]->cng_type == FD_CNG ) && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag, 11, &q_cldfb[2][slot] ); - generate_masking_noise_dirac_fx( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, + generate_masking_noise_dirac_ivas_fx( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], /*nothing will be analyzed, just get cnst*/ NULL, Cldfb_RealBuffer_in_fx[1][slot], Cldfb_ImagBuffer_in_fx[1][slot],