diff --git a/lib_com/arith_coder_fx.c b/lib_com/arith_coder_fx.c index 5fd4b472ea59005fd821661a2d48d5aa0705c583..ceb9b07dea791a277fa543a0c52861272d4645f3 100644 --- a/lib_com/arith_coder_fx.c +++ b/lib_com/arith_coder_fx.c @@ -87,7 +87,7 @@ Word32 expfp( /* o: Q31 */ * Returns: *pout1 = ( (base/65536)^(2*exp - 1) ) * 65536 * *pout2 = ( (base/65536)^(2*exp + 1) ) * 65536 * - * NOTE: This function must be in sync with ari_decode_14bits_pow() */ + * NOTE: This function must be in sync with ari_decode_14bits_pow_fx() */ void powfp_odd2( const Word16 base, /* Q15 */ const Word16 exp, /* Q0 */ diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c index 1d1710a1b0fc33dffaca65c2f1371255f1a29793..8e3d4f5fe2f16d7daa1bfe03fe0c9118fbb3c0be 100644 --- a/lib_com/edct_fx.c +++ b/lib_com/edct_fx.c @@ -13,6 +13,9 @@ #include "math_32.h" +#ifdef IVAS_FLOAT_FIXED + + static Word16 get_edxt_factor( Word16 length ) /* Returns value of sqrtf(2.f/length) in Q15 */ { @@ -815,3 +818,4 @@ void edxt_fx( } return; } +#endif \ No newline at end of file diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index cbac3dac23606a1a6dc64a94bb302f18f0cf5c47..7ebf70ec80a59a0bb8638b98b9dce72e2354441b 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -90,7 +90,7 @@ void initFdCngCom_flt( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ const float scale ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /* Calculate FFT scaling factor */ hFdCngCom->scalingFactor_flt = 1 / ( scale * scale * 8.f ); @@ -133,7 +133,7 @@ void initFdCngCom_flt( hFdCngCom->seed2 = 1; hFdCngCom->seed3 = 2; hFdCngCom->CngBitrate = -1; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /* Initialize noise estimation algorithm */ set_f( hFdCngCom->periodog_flt, 0.0f, PERIODOGLEN ); mhvals_flt( MSNUMSUBFR * MSSUBFRLEN, &( hFdCngCom->msM_win_flt ) ); @@ -149,7 +149,7 @@ void initFdCngCom_flt( hFdCngCom->offsetflag = 0; hFdCngCom->msFrCnt = MSSUBFRLEN; hFdCngCom->msMinBufferPtr = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hFdCngCom->msAlphaCor_flt, 0.3f, 2 ); hFdCngCom->coherence_flt = 0.5f; @@ -836,7 +836,7 @@ static void getmidbands( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * AnalysisSTFT_flt() * @@ -1065,7 +1065,7 @@ void SynthesisSTFT_fx( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * SynthesisSTFT_dirac_flt() * diff --git a/lib_com/guided_plc_util.c b/lib_com/guided_plc_util.c index 4d3d8bbb8ba3d1a9ddb178d9ea745a698ffd6cbd..910c114e257ac2b2f21dbdaca17afce7b4fc67ad 100644 --- a/lib_com/guided_plc_util.c +++ b/lib_com/guided_plc_util.c @@ -139,7 +139,7 @@ void getConcealedLP_flt( * * *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void RecLpcSpecPowDiffuseLc_flt( float *lspq, float *lsp_old, diff --git a/lib_com/isf_dec_amr_wb.c b/lib_com/isf_dec_amr_wb.c index 1a4159286ebaf276a0e85afb7014d01a4830212b..194354a386bbac2e8636dada74e64798a5ad92d4 100644 --- a/lib_com/isf_dec_amr_wb.c +++ b/lib_com/isf_dec_amr_wb.c @@ -46,7 +46,7 @@ * * Decoding of ISF parameters in AMR-WB IO mode *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void isf_dec_amr_wb( Decoder_State *st, /* i/o: State structure */ float *Aq, /* o : quantized A(z) for 4 subframes */ diff --git a/lib_com/ivas_arith.c b/lib_com/ivas_arith.c index a1d87d802d06b138bec0aa08db4342451a8a0846..852ddee0d678f21a979b1ebeef57daf75d1fce1b 100644 --- a/lib_com/ivas_arith.c +++ b/lib_com/ivas_arith.c @@ -42,7 +42,7 @@ * * Start arithemetic coding * - * Similar to ari_start_decoding_14bits(), but do not read past frame boundary. + * Similar to ari_start_decoding_14bits_fx(), but do not read past frame boundary. *-----------------------------------------------------------------------------------------*/ void ivas_ari_start_decoding_14bits_ext_1_lfe( diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index d77274a759b7a6f09bc467ea0cadc065e33aeece..0f3a2a911b6629e34b0fdae0774f8ceac5443226 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4520,7 +4520,7 @@ void ivas_mc_paramupmix_dec_digest_tc( const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ const int16_t nSamplesForRendering /* i : number of samples provided */ ); - +#ifdef IVAS_FLOAT_FIXED void ivas_mc_paramupmix_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -4529,7 +4529,17 @@ void ivas_mc_paramupmix_dec_render( Word32 *input_fx[], /* i : core-coder transport channels */ Word32 *output_fx[] /* i/o: synthesized core-coder transport channels */ ); +#else +void ivas_mc_paramupmix_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *input_f[], /* i : core-coder transport channels */ + float *output_f[] /* i/o: synthesized core-coder transport channels */ +); +#endif void ivas_param_mc_metadata_open( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ #ifndef FIX_901_PARAMMC_DEAD_CODE diff --git a/lib_com/options.h b/lib_com/options.h index 885bb30557b6992892fc3a149137f66b677049a0..ab10c15b7d934cf49c5445f866171fbdfec49052 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -101,7 +101,6 @@ #define EVS_FUNC_MODIFIED //#define DEBUGGING //#define DBG_WAV_WRITER -//#define EVS_FLOAT #define EVS_FLOAT_ENC //#define DUMPS_ENABLED #define FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION diff --git a/lib_com/prot.h b/lib_com/prot.h index 2341895efdd46d2ba0bc8fdb0fc5b1bdb2be1671..82ca8a5bcbf3e70f9b6a9448338342ac15b10d29 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -749,7 +749,7 @@ float lsf_stab( const int16_t L_frame /* i : frame length */ ); -void amr_wb_dec_init_flt( +void amr_wb_dec_init( AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ ); @@ -5315,7 +5315,7 @@ void get_next_frame_parameters( Decoder_State *st /* i/o: Decoder state structure */ ); -ivas_error amr_wb_dec_flt( +ivas_error amr_wb_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 : synthesis output */ @@ -7821,7 +7821,7 @@ int16_t ari_start_decoding_14bits_prm_ivas( int16_t bp, Tastat *s ); -Word16 ari_start_decoding_14bits_prm_fx_ivas( +Word16 ari_start_decoding_14bits_prm_ivas_fx( const Word16 *ptr, Word16 bp, Tastat *s @@ -7930,7 +7930,7 @@ void tcx_arith_encode_envelope( const int16_t low_complexity /* i : low-complexity flag */ ); -void tcx_arith_decode_envelope_flt( +void tcx_arith_decode_envelope( Decoder_State *st, /* i/o: coder state */ float q_spectrum[], /* o : quantised MDCT coefficients */ const int16_t L_frame, /* i : frame or MDCT length */ @@ -7946,7 +7946,7 @@ void tcx_arith_decode_envelope_flt( const int16_t low_complexity /* i : low-complexity flag */ ); -void tcx_arith_decode_envelope_fx( +void tcx_arith_decode_envelope_ivas_fx( Decoder_State *st, /* i/o: coder state */ Word32 q_spectrum[], /* o : quantised MDCT coefficients */ Word16 *q_spectrum_e, /* o : MDCT exponent */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 103675727f0a6828c3ecdf40e9c4b20b8f2786e6..9e8a2ee188fc740d441e8b3a3483e5b12b782255 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -7200,7 +7200,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ); - void destroy_cldfb_decoder( + void destroy_cldfb_decoder_fx( Decoder_State *st_fx /* o: Decoder static variables structure */ ); @@ -7264,10 +7264,10 @@ void generate_comfort_noise_dec_hf_ivas_fx( const Word16 hq_core_type, /* i : HQ core type */ const Word16 core_switching_flag /* i : ACELP->HQ switching frame flag */ ); - void HQ_core_dec_init( + void HQ_core_dec_init_fx( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ); - void HQ_nbfec_init( + void HQ_nbfec_init_fx( HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle */ ); @@ -7562,7 +7562,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( Decoder_State *st_fx /* o : Decoder static variables structure */ ); - void amr_wb_dec_init( + void amr_wb_dec_init_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ ); @@ -8293,35 +8293,35 @@ void IGFSCFDecoderDecode( ); //ari_dec_fx.c -Word16 ari_decode_overflow(Tastat *s); +Word16 ari_decode_overflow_fx(Tastat *s); -void ari_start_decoding_14bits( +void ari_start_decoding_14bits_fx( Decoder_State *st, Tastat *s ); -Word16 ari_start_decoding_14bits_prm(const Word16 *ptr, Word16 bp, Tastat *s); +Word16 ari_start_decoding_14bits_prm_fx(const Word16 *ptr, Word16 bp, Tastat *s); -Word16 ari_decode_14bits_s17_ext( +Word16 ari_decode_14bits_s17_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq ); -Word16 ari_decode_14bits_s27_ext( +Word16 ari_decode_14bits_s27_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq ); -Word16 ari_decode_14bits_bit_ext( +Word16 ari_decode_14bits_bit_ext_fx( Decoder_State *st, Tastat *s ); -Word16 ari_decode_14bits_pow(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s, Word16 base); +Word16 ari_decode_14bits_pow_fx(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s, Word16 base); -Word16 ari_decode_14bits_sign(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s); +Word16 ari_decode_14bits_sign_fx(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s); //dec_prm_fx.c void getTCXparam( @@ -8862,7 +8862,7 @@ void decoder_tcx_post(Decoder_State *st_fx, ); //arith_coder_dec_fx.c -void tcx_arith_decode_envelope( +void tcx_arith_decode_envelope_fx( Word32 q_spectrum[], /* o: quantised MDCT coefficients Q31-e */ Word16 *q_spectrum_e, /* o: MDCT exponent Q0 */ Word16 L_frame, /* i: frame or MDCT length */ @@ -9120,7 +9120,7 @@ void tcx5TnsUngrouping_fx( const Word16 enc_dec ); // bass_psfilter.c -void bpf_pitch_coherence_fx( +void bpf_pitch_coherence_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word32 pitch_buf[] /* i : pitch for each subframe [0,1,2,3] */ ); @@ -9148,7 +9148,7 @@ void cldfbSynthesis_ivas_fx( ); // bass_psfilter.c -void addBassPostFilter_fx( +void addBassPostFilter_ivas_fx( const Word32 *harm_timeIn_fx, const int16_t samplesToProcess, Word32 **rAnalysis_fx, diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index f9401cca2668e4c77c8895d3c14dc461e70b730e..3c9f4cfbc26f0e0b9d15e012969c208648614fe2 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -818,7 +818,7 @@ typedef struct pfstat_structure { int16_t on; /* On/off flag */ int16_t reset; /* reset flag */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_pf_in_flt[L_SUBFR]; /* Input memory */ float mem_stp_flt[L_SUBFR]; /* 1/A(gamma1) memory */ float mem_res2_flt[DECMEM_RES2]; /* A(gamma2) residual */ diff --git a/lib_com/stl.h b/lib_com/stl.h index cb5c7477c38c0f73e40820dcc59c45d3385c37f8..5ffc103a46f6d2a856dcfe34691c910abe771d90 100644 --- a/lib_com/stl.h +++ b/lib_com/stl.h @@ -66,7 +66,6 @@ #if defined BASOP_NOGLOB && !defined BASOP_NOGLOB_DEV_USE_GLOBALS #define BASOP_NOGLOB_DECLARE_LOCAL #endif -//#define EVS_FLOAT #include "options.h" /* note: needed until BASOP_NOGLOB is accepted */ #include "typedef.h" diff --git a/lib_com/swb_tbe_com.c b/lib_com/swb_tbe_com.c index 170f4f5e5311fc1820e6bfdbc16d3ce1c55786c4..b27fb86b2f0610084573d5a4570fac2d5c658bf8 100644 --- a/lib_com/swb_tbe_com.c +++ b/lib_com/swb_tbe_com.c @@ -1365,7 +1365,7 @@ void GenShapedSHBExcitation( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * GenSHBSynth() * diff --git a/lib_com/tcx_ltp.c b/lib_com/tcx_ltp.c index 5c79b03d1c4f1ef9af59af10d3d6190259a893f4..e4c86f2b104d694a89401b079ce7c6a67997f490 100644 --- a/lib_com/tcx_ltp.c +++ b/lib_com/tcx_ltp.c @@ -801,7 +801,7 @@ static void tcx_ltp_synth_filter_11_unequal_pitch_flt( * * *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void tcx_ltp_post_flt( Decoder_State *st, TCX_LTP_DEC_HANDLE hTcxLtpDec, diff --git a/lib_com/tec_com_flt.c b/lib_com/tec_com_flt.c index b8a9c4e01d6a428affe258757ac9105deace74de..3d64b60484544c269cd1731a622de040a7126394 100644 --- a/lib_com/tec_com_flt.c +++ b/lib_com/tec_com_flt.c @@ -269,7 +269,7 @@ static float calcCorrelationCoefficient2( } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * resetTecDec() * diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index 10b177c9f92f68341a490c9df27f70973daff6d1..3cbeae48409378ceb29453980e992f0e9b33338e 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -130,7 +130,7 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( } /* Start Decoding */ - ari_start_decoding_14bits(st, &as); + ari_start_decoding_14bits_fx(st, &as); overflow_bit_pos = st->next_bit_pos; move16(); @@ -180,7 +180,7 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( assert(tmp >= 0 && tmp < 4096); pki = ari_lookup_s17_LC[tmp]; move16(); - r = ari_decode_14bits_s17_ext(st, &as, ari_pk_s17_LC_ext[pki]); + r = ari_decode_14bits_s17_ext_fx(st, &as, ari_pk_s17_LC_ext[pki]); IF (LT_16(r, VAL_ESC)) { diff --git a/lib_dec/FEC.c b/lib_dec/FEC.c index ed3492b844dac0e63e1dc47777729178c3f7bcef..0faa0a12d16b702aec8fde38abaef572fcc78e89 100644 --- a/lib_dec/FEC.c +++ b/lib_dec/FEC.c @@ -56,7 +56,7 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1 * * Calculation of excitation signal *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void FEC_exc_estim( Decoder_State *st, /* i/o: Decoder static memory */ const int16_t L_frame, /* i : length of the frame */ diff --git a/lib_dec/FEC_HQ_core.c b/lib_dec/FEC_HQ_core.c index 6060f47f7d0cf7c016b6e2283d1ac54fa0c5941e..4a336eccf809995ae904389f1dbbcf8d8097f3e6 100644 --- a/lib_dec/FEC_HQ_core.c +++ b/lib_dec/FEC_HQ_core.c @@ -47,7 +47,7 @@ #include "prot_fx2.h" #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * Local prototypes *---------------------------------------------------------------------*/ @@ -1332,7 +1332,7 @@ static void Smoothing_vector_scaledown_NB( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * time_domain_FEC_HQ() * diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index bbe4bb5a3f1a69d4e44f7ef5605c5592dec085a8..ba285662532751db2b385e4020511781b547a21a 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -2131,7 +2131,7 @@ static void hq_phase_ecu( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- * hq_ecu() * diff --git a/lib_dec/FEC_lsf_estim.c b/lib_dec/FEC_lsf_estim.c index 622a9fe7699aa81b83889902fbfe92bc5a1866a8..54d3ea811d2a02d2129dd25745a495cc1c216263 100644 --- a/lib_dec/FEC_lsf_estim.c +++ b/lib_dec/FEC_lsf_estim.c @@ -47,7 +47,7 @@ * - LSP calculation * - A(z) calculation *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void FEC_lsf2lsp_interp_flt( Decoder_State *st, /* i/o: Decoder static memory */ const int16_t L_frame, /* i : length of the frame */ diff --git a/lib_dec/FEC_pitch_estim.c b/lib_dec/FEC_pitch_estim.c index 8001be7c1fea6ea0647ea95f0c4c3d54ab919190..725bbca8e91550e59047cc35405d19a3f60acd66 100644 --- a/lib_dec/FEC_pitch_estim.c +++ b/lib_dec/FEC_pitch_estim.c @@ -40,7 +40,7 @@ #include "cnst.h" #include "prot.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------* * FEC_pitch_estim() * diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index 536141bffe71599a720cc25ee43c479f62f463e2..d6a64ad796487daaa2d2c53cb1909bab0ff6dbb4 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -70,7 +70,7 @@ static void analy_sp_dct( const float dct_in[], float dct_buf[], float *fr_bands static void find_enr_dct( const float data[], float band[], float *ptE, float *Etot, const int16_t min_band, const int16_t max_band, float *Bin_E, const float bin_freq ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------* * LD_music_post_filter() * @@ -734,21 +734,21 @@ void music_postfilt_init_flt( { int16_t i; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hMusicPF->dct_post_old_exc, 0, DCT_L_POST - OFFSET2 ); #endif #ifdef IVAS_FLOAT_FIXED set_val_Word16( hMusicPF->dct_post_old_exc_fx, 0, DCT_L_POST - OFFSET2 ); #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hMusicPF->LDm_enh_min_ns_gain = (float) pow( 10.0f, -12 / 20.0f ); #endif #ifdef IVAS_FLOAT_FIXED hMusicPF->LDm_enh_min_ns_gain_fx = (Word16)(0x2027); #endif hMusicPF->LDm_last_music_flag = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hMusicPF->LDm_lt_diff_etot, 0, MAX_LT ); hMusicPF->LDm_thres[0] = TH_0_MIN; hMusicPF->LDm_thres[1] = TH_1_MIN; @@ -765,7 +765,7 @@ void music_postfilt_init_flt( #endif hMusicPF->LDm_nb_thr_1 = 0; hMusicPF->LDm_nb_thr_3 = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hMusicPF->LDm_mem_etot = 0.0f; #endif #ifdef IVAS_FLOAT_FIXED @@ -774,7 +774,7 @@ void music_postfilt_init_flt( for ( i = 0; i < VOIC_BINS_HR; i++ ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hMusicPF->LDm_enh_lp_gbin[i] = 1.0f; hMusicPF->LDm_enh_lf_EO[i] = 0.01f; #endif @@ -786,7 +786,7 @@ void music_postfilt_init_flt( for ( i = 0; i < MBANDS_GN_LD; i++ ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hMusicPF->LDm_bckr_noise[i] = E_MIN; #endif #ifdef IVAS_FLOAT_FIXED diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 053904fdd9fa166e837f6029d56ae35ed2e045d6..53cd72a3602104a30ef5368d1f587ef807465def 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -49,7 +49,7 @@ #include "ivas_rom_com.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * acelp_core_dec() * diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 8635dc75301d4fb81816c9dcdf953b24f32712fa..0c8238c046fddab98e5c5959911c34490d681cf0 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1927,7 +1927,7 @@ ivas_error acelp_core_dec_ivas_fx( pitch_buf_fx_q20[lp] = L_shl(pitch_buf_fx[lp], Q14); } - bpf_pitch_coherence_fx(st, pitch_buf_fx_q20); + bpf_pitch_coherence_ivas_fx(st, pitch_buf_fx_q20); Scale_sig32(st->old_pitch_buf_fx, 2 * NB_SUBFR16k + 2, -Q4); #else @@ -2051,7 +2051,7 @@ ivas_error acelp_core_dec_ivas_fx( move16(); } - addBassPostFilter_fx(tmp_bpf_error_signal_fx, tmp, realBuffer_fx, imagBuffer_fx, st->cldfbBPF); + addBassPostFilter_ivas_fx(tmp_bpf_error_signal_fx, tmp, realBuffer_fx, imagBuffer_fx, st->cldfbBPF); // Fixed to float /*for (i = 0; i < CLDFB_NO_COL_MAX; i++) @@ -2365,7 +2365,7 @@ ivas_error acelp_core_dec_ivas_fx( tmp = nSamples; move16(); } - addBassPostFilter_fx(tmp_bpf_error_signal_fx + st->L_frame - nSamples, tmp, realBuffer_fx, imagBuffer_fx, st->cldfbBPF); + addBassPostFilter_ivas_fx(tmp_bpf_error_signal_fx + st->L_frame - nSamples, tmp, realBuffer_fx, imagBuffer_fx, st->cldfbBPF); Scale_sig32(st->cldfbBPF->cldfb_state_fx, cldfb_state_offset, -(q_bpf_error_signal - Q10)); //Q10 diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index 5161773da54e7883ff11e26e2564f6af24270b86..8a4bcdc6216955bf1d88ba6f5c6cb631c87b2c1b 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -53,7 +53,7 @@ static void decod_gen_voic_core_switch( Decoder_State *st, const int16_t L_frame * * ACELP core decoder in the first ACELP->HQ switching frame *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED ivas_error acelp_core_switch_dec( Decoder_State *st, /* i/o: decoder state structure */ float *synth_subfr_out, /* o : synthesized ACELP subframe */ diff --git a/lib_dec/amr_wb_dec.c b/lib_dec/amr_wb_dec.c index 11d7372f084174eb2c87494734124073500d5c57..457b7bb720ec36dc711d7bc900421a394d270eba 100644 --- a/lib_dec/amr_wb_dec.c +++ b/lib_dec/amr_wb_dec.c @@ -46,14 +46,14 @@ #include "prot_fx2.h" #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------* - * amr_wb_dec_flt() + * amr_wb_dec() * * AMR-WB decoder *------------------------------------------------------------------*/ -ivas_error amr_wb_dec_flt( +ivas_error amr_wb_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 : synthesis output */ @@ -819,12 +819,12 @@ ivas_error amr_wb_dec_flt( #endif /*------------------------------------------------------------------* - * amr_wb_dec_init_flt() + * amr_wb_dec_init() * * AMR-WB decoder initialization *------------------------------------------------------------------*/ -void amr_wb_dec_init_flt( +void amr_wb_dec_init( AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ ) { diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index 8d6c2f5d4ee59c359dbcd96375148f2e76b40bcf..1018a2cd4eb0e3bc22f53196561e27a7d49fceb3 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -9,7 +9,7 @@ #include "prot_fx1.h" #include "prot_fx2.h" #include "basop_util.h" /* Function prototypes */ - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * amr_wb_dec_fx() * @@ -1090,12 +1090,12 @@ ivas_error amr_wb_dec_fx( return error; } /*------------------------------------------------------------------* - * amr_wb_dec_init() + * amr_wb_dec_init_fx() * * AMR-WB decoder initialization *------------------------------------------------------------------*/ -void amr_wb_dec_init( +void amr_wb_dec_init_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */ ) { @@ -1125,3 +1125,5 @@ void amr_wb_dec_init( move16(); return; } + +#endif \ No newline at end of file diff --git a/lib_dec/ari_dec.c b/lib_dec/ari_dec.c index 95103ddf17816725d15714283e357d908759d146..b8604b6e6ac80a6c631b60335e4a3a22538c9371 100644 --- a/lib_dec/ari_dec.c +++ b/lib_dec/ari_dec.c @@ -100,7 +100,7 @@ int16_t ari_start_decoding_14bits_prm_ivas( return bp; } -Word16 ari_start_decoding_14bits_prm_fx_ivas( +Word16 ari_start_decoding_14bits_prm_ivas_fx( const Word16 *ptr, Word16 bp, Tastat *s diff --git a/lib_dec/ari_dec_fx.c b/lib_dec/ari_dec_fx.c index c7b52aa7b25128a73d3b2dab882708e9baa95b73..32e48b5f47d3f9c569e9b8224e06bde4f4c8d0f9 100644 --- a/lib_dec/ari_dec_fx.c +++ b/lib_dec/ari_dec_fx.c @@ -14,7 +14,7 @@ * Ari decode 14 bits routines -------------------------------------------------------------*/ -Word16 ari_decode_overflow(Tastat *s) +Word16 ari_decode_overflow_fx(Tastat *s) { return L_sub(L_sub(s->high, 1), s->low) <= 0; } @@ -25,7 +25,7 @@ Word16 ari_decode_overflow(Tastat *s) * \param[i/o] st * \param[o] s */ -void ari_start_decoding_14bits( +void ari_start_decoding_14bits_fx( Decoder_State *st, Tastat *s ) @@ -41,7 +41,7 @@ void ari_start_decoding_14bits( move32(); } -Word16 ari_start_decoding_14bits_prm( +Word16 ari_start_decoding_14bits_prm_fx( const Word16 *ptr, Word16 bp, Tastat *s @@ -72,7 +72,7 @@ Word16 ari_start_decoding_14bits_prm( return add(bp,i); } -static Word16 ari_lookup_s17( +static Word16 ari_lookup_s17_fx( Word32 cum, Word32 range, UWord16 const *cum_freq @@ -130,7 +130,7 @@ static Word16 ari_lookup_s17( return extract_l(p - cum_freq); } -static Word16 ari_lookup_s27( +static Word16 ari_lookup_s27_fx( Word32 cum, Word32 range, UWord16 const *cum_freq @@ -148,7 +148,7 @@ static Word16 ari_lookup_s27( range_l = extract_l(L_and(range,0x7FFF)); range_h = extract_l(L_shr(range,15)); - /* begin change when compared with ari_decode_14bits_s17_ext, + /* begin change when compared with ari_decode_14bits_s17_ext_fx, starting with line: tmp = L_multi31x16_X2(range_h, range_l, p[8]); */ il = 0; move16(); @@ -229,7 +229,7 @@ static Word16 ari_lookup_s27( return il; } -static Word16 ari_lookup_bit( +static Word16 ari_lookup_bit_fx( Word32 cum, Word32 range, UWord16 const *cum_freq @@ -256,7 +256,7 @@ static Word16 ari_lookup_bit( return symbol; } -static Word16 ari_decode_14bits_ext( +static Word16 ari_decode_14bits_ext_fx( Decoder_State *st, Tastat *s, UWord16 const *cum_freq, @@ -326,30 +326,30 @@ static Word16 ari_decode_14bits_ext( /** * \brief Only for 17 symbols with new extended Tables */ -Word16 ari_decode_14bits_s17_ext(Decoder_State *st, Tastat *s, UWord16 const *cum_freq) +Word16 ari_decode_14bits_s17_ext_fx(Decoder_State *st, Tastat *s, UWord16 const *cum_freq) { - return ari_decode_14bits_ext(st, s, cum_freq, ari_lookup_s17); + return ari_decode_14bits_ext_fx(st, s, cum_freq, ari_lookup_s17_fx); } /** * \brief Only for 27 symbols with new extended Tables */ -Word16 ari_decode_14bits_s27_ext(Decoder_State *st, Tastat *s, UWord16 const *cum_freq) +Word16 ari_decode_14bits_s27_ext_fx(Decoder_State *st, Tastat *s, UWord16 const *cum_freq) { - return ari_decode_14bits_ext(st, s, cum_freq, ari_lookup_s27); + return ari_decode_14bits_ext_fx(st, s, cum_freq, ari_lookup_s27_fx); } /** * \brief Only for decoding one bit with uniform probability: * the equivalent cum_freq table used is {16384, 8192, 0} */ -Word16 ari_decode_14bits_bit_ext(Decoder_State *st, Tastat *s) +Word16 ari_decode_14bits_bit_ext_fx(Decoder_State *st, Tastat *s) { static const UWord16 cum_freq[3] = {16384, 8192, 0}; - return ari_decode_14bits_ext(st, s, cum_freq, ari_lookup_bit); + return ari_decode_14bits_ext_fx(st, s, cum_freq, ari_lookup_bit_fx); } -static Word16 ari_lookup_pow(Tastat *s, Word16 base) +static Word16 ari_lookup_pow_fx(Tastat *s, Word16 base) { Word32 cum, range; Word16 symbol; @@ -427,7 +427,7 @@ static Word16 ari_lookup_pow(Tastat *s, Word16 base) return symbol; } -static Word16 ari_lookup_sign(Tastat *s, Word16 base) +static Word16 ari_lookup_sign_fx(Tastat *s, Word16 base) { Word32 cum, range; Word16 symbol; @@ -456,7 +456,7 @@ static Word16 ari_lookup_sign(Tastat *s, Word16 base) return symbol; } -static Word16 ari_decode_14bits_notbl( +static Word16 ari_decode_14bits_notbl_fx( Word16 *ptr, Word16 bp, Word16 bits, @@ -500,7 +500,7 @@ static Word16 ari_decode_14bits_notbl( test(); test(); test(); - IF ((lookup_fn != ari_lookup_sign) && !(NE_16(bp, bits)||!((EQ_32(s->low,low))&&(EQ_32(s->high,L_sub(high,1)))&&(EQ_32(s->value,value))))) + IF ((lookup_fn != ari_lookup_sign_fx) && !(NE_16(bp, bits)||!((EQ_32(s->low,low))&&(EQ_32(s->high,L_sub(high,1)))&&(EQ_32(s->value,value))))) { /* This should not happen except of bit errors. */ s->high = 0; @@ -526,7 +526,7 @@ static Word16 ari_decode_14bits_notbl( } /*------------------------------------------------------------------------ - * Function: ari_decode_14bits_pow + * Function: ari_decode_14bits_pow_fx * * Decode a symbol which follows the exponential distribution. That is, * symbols are in the following intervals @@ -535,18 +535,18 @@ static Word16 ari_decode_14bits_notbl( * p(x = q>0) = exp(- (q-0.5)*base* 2) - exp(- (q+0.5)*base*2 ) * *-------------------------------------------------------------------------*/ -Word16 ari_decode_14bits_pow(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s, Word16 base) +Word16 ari_decode_14bits_pow_fx(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s, Word16 base) { - return ari_decode_14bits_notbl(ptr, bp, bits, res, s, base, ari_lookup_pow); + return ari_decode_14bits_notbl_fx(ptr, bp, bits, res, s, base, ari_lookup_pow_fx); } /*------------------------------------------------------------------------ - * Function: ari_decode_14bits_sign + * Function: ari_decode_14bits_sign_fx * * Decode a sign with equal probabilities. *-------------------------------------------------------------------------*/ -Word16 ari_decode_14bits_sign(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s) +Word16 ari_decode_14bits_sign_fx(Word16 *ptr, Word16 bp, Word16 bits, Word16 *res, Tastat *s) { - return ari_decode_14bits_notbl(ptr, bp, bits, res, s, 0, ari_lookup_sign); + return ari_decode_14bits_notbl_fx(ptr, bp, bits, res, s, 0, ari_lookup_sign_fx); } diff --git a/lib_dec/ari_hm_dec.c b/lib_dec/ari_hm_dec.c index ebb57567bdce79b4bb97f1e17dba5825bd376e4a..d0069e5c3d31f100403db9df9f57a05af060e7c9 100644 --- a/lib_dec/ari_hm_dec.c +++ b/lib_dec/ari_hm_dec.c @@ -44,7 +44,7 @@ #include "rom_com.h" #include "wmc_auto.h" #include "prot_fx2.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * DecodeIndex() * diff --git a/lib_dec/arith_coder_dec.c b/lib_dec/arith_coder_dec.c index 90ed66764d2c81124e67ba7cd29b270c46b89ac5..c1be77e57e06c139c6f0242505197f24f25e8e66 100644 --- a/lib_dec/arith_coder_dec.c +++ b/lib_dec/arith_coder_dec.c @@ -47,13 +47,13 @@ #include "prot_fx2.h" /*-------------------------------------------------------* - * tcx_arith_decode_flt() + * tcx_arith_decode() * * *-------------------------------------------------------*/ /*! r: number of bits consumed */ -static int16_t tcx_arith_decode_flt( +static int16_t tcx_arith_decode( const int16_t L_frame, /* i : number of spectral lines */ const Word16 envelope[], /* i : scaled envelope (Q15-e) */ Word16 envelope_e, /* i : scaled envelope exponent (Q0) */ @@ -116,7 +116,7 @@ static int16_t tcx_arith_decode_flt( return bp; } -static Word16 tcx_arith_decode_fx( +static Word16 tcx_arith_decode_ivas_fx( const Word16 L_frame, /* i : number of spectral lines */ const Word16 envelope[], /* i : scaled envelope (Q15-e) */ Word16 envelope_e, /* i : scaled envelope exponent (Q0) */ @@ -133,7 +133,7 @@ static Word16 tcx_arith_decode_fx( Word16 tmp; Word32 L_tmp; - bp = ari_start_decoding_14bits_prm_fx_ivas( prm, 0, &as ); + bp = ari_start_decoding_14bits_prm_ivas_fx( prm, 0, &as ); tmp = sub(envelope_e, 1); @@ -187,12 +187,12 @@ static Word16 tcx_arith_decode_fx( /*-------------------------------------------------------* - * tcx_arith_decode_envelope_flt() + * tcx_arith_decode_envelope() * * *-------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) -void tcx_arith_decode_envelope_flt( +#ifndef IVAS_FLOAT_FIXED +void tcx_arith_decode_envelope( Decoder_State *st, /* i/o: coder state */ float q_spectrum[], /* o : quantised MDCT coefficients */ const int16_t L_frame, /* i : frame or MDCT length */ @@ -274,7 +274,7 @@ void tcx_arith_decode_envelope_flt( envelope = (Word16 *) env; tcx_arith_scale_envelope_flt( L_spec, L_spec_core, env, target_bits, low_complexity, envelope, &envelope_e ); - *arith_bits = tcx_arith_decode_flt( L_spec, envelope, envelope_e, target_bits, prm, q_spectrum ); + *arith_bits = tcx_arith_decode( L_spec, envelope, envelope_e, target_bits, prm, q_spectrum ); /* safety check in case of bit errors */ if ( *arith_bits < 0 ) @@ -291,7 +291,7 @@ void tcx_arith_decode_envelope_flt( return; } #endif -void tcx_arith_decode_envelope_fx( +void tcx_arith_decode_envelope_ivas_fx( Decoder_State *st, /* i/o: coder state */ Word32 q_spectrum[], /* o : quantised MDCT coefficients */ Word16 *q_spectrum_e, /* o : MDCT exponent */ @@ -388,7 +388,7 @@ void tcx_arith_decode_envelope_fx( envelope = (Word16 *) env; tcx_arith_scale_envelope( L_spec, L_spec_core, env, target_bits, low_complexity, envelope, &envelope_e ); - *arith_bits = tcx_arith_decode_fx( L_spec, envelope, envelope_e, target_bits, prm, q_spectrum, q_spectrum_e ); + *arith_bits = tcx_arith_decode_ivas_fx( L_spec, envelope, envelope_e, target_bits, prm, q_spectrum, q_spectrum_e ); move16(); /* safety check in case of bit errors */ diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index 05696b29858eae7c5e6c836d3ca5fb46d68f1aba..7cc34f46e8ac03240d4cbaf67decaf6c0d0e0980 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -11,7 +11,7 @@ #include "prot_fx2.h" /* Returns: number of bits consumed */ -static Word16 tcx_arith_decode( +static Word16 tcx_arith_decode_fx( Word16 L_frame, /* i: number of spectral lines Q0 */ const Word16 envelope[], /* i: scaled envelope Q15-e */ Word16 envelope_e, /* i: scaled envelope exponent Q0 */ @@ -33,7 +33,7 @@ static Word16 tcx_arith_decode( #endif - bp = ari_start_decoding_14bits_prm(prm, 0, &as); + bp = ari_start_decoding_14bits_prm_fx(prm, 0, &as); tmp = sub(envelope_e, 1+15); L_tmp = L_deposit_l(0); @@ -49,7 +49,7 @@ static Word16 tcx_arith_decode( exp_k = round_fx(expfp(envelope[k], tmp)); } /* decode line magnitude */ - bp = ari_decode_14bits_pow(prm, bp, target_bits, &q, &as, exp_k); + bp = ari_decode_14bits_pow_fx(prm, bp, target_bits, &q, &as, exp_k); if (q == 0) { @@ -57,7 +57,7 @@ static Word16 tcx_arith_decode( } IF (q != 0) /* line is non-zero, decode sign */ { - bp = ari_decode_14bits_sign(prm, bp, target_bits, &s, &as); + bp = ari_decode_14bits_sign_fx(prm, bp, target_bits, &s, &as); #ifdef BASOP_NOGLOB L_tmp = L_macNs_co(L_tmp, q, k, &Carry, &Overflow); @@ -71,7 +71,7 @@ static Word16 tcx_arith_decode( move32(); } - IF (ari_decode_overflow(&as)) + IF (ari_decode_overflow_fx(&as)) { if( LT_16(bp, target_bits)) /* safety check in case of bit errors */ { @@ -93,7 +93,7 @@ static Word16 tcx_arith_decode( return bp; } -void tcx_arith_decode_envelope( +void tcx_arith_decode_envelope_fx( Word32 q_spectrum[], /* o: quantised MDCT coefficients Q31-e */ Word16 *q_spectrum_e, /* o: MDCT exponent Q0 */ Word16 L_frame, /* i: frame or MDCT length Q0 */ @@ -195,7 +195,7 @@ void tcx_arith_decode_envelope( tcx_arith_scale_envelope(L_spec, L_spec_core, env, target_bits, low_complexity, envelope, &envelope_e); - *arith_bits = tcx_arith_decode(L_spec, envelope, envelope_e, target_bits, prm, q_spectrum, q_spectrum_e, nf_seed); + *arith_bits = tcx_arith_decode_fx(L_spec, envelope, envelope_e, target_bits, prm, q_spectrum, q_spectrum_e, nf_seed); move16(); /* safety check in case of bit errors */ diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index fec418241fcc0c351de5191e4f76e6f3c3755a1e..0084c44107a855cee8d8a38eaf66004fef31de59 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -74,7 +74,7 @@ static int16_t Pit_track( const float syn[], int16_t T ); * * Initialisation of postfiltering variables *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void bass_psfilter_init( BPF_DEC_HANDLE hBPF /* o : BPF data handle */ ) @@ -97,7 +97,7 @@ void bass_psfilter_init( * * Perform low-frequency postfiltering *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void bass_psfilter( BPF_DEC_HANDLE hBPF, /* o : BPF data handle */ const int16_t Opt_AMR_WB, /* i : AMR-WB IO flag */ @@ -517,7 +517,7 @@ void addBassPostFilter( } #ifdef IVAS_FLOAT_FIXED -void addBassPostFilter_fx( +void addBassPostFilter_ivas_fx( const Word32 *harm_timeIn_fx, // Qx const Word16 samplesToProcess, Word32 **rAnalysis_fx, // Qx - 5 @@ -727,7 +727,7 @@ Word16 res_bpf_adapt_fx( return res_bpf_flag; } #endif // IVAS_FLOAT_FIXED -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * bpf_pitch_coherence() * @@ -768,7 +768,7 @@ void bpf_pitch_coherence( return; } #endif -void bpf_pitch_coherence_fx( +void bpf_pitch_coherence_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word32 pitch_buf[] /* i : pitch for every subfr [0,1,2,3] */ ) diff --git a/lib_dec/cng_dec.c b/lib_dec/cng_dec.c index 7548747a85d35d2b60393ce6e8eee7abff13519a..3952cf8f18955a3c88a962a9d020429115eb6fea 100644 --- a/lib_dec/cng_dec.c +++ b/lib_dec/cng_dec.c @@ -46,7 +46,7 @@ /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED static void shb_CNG_decod( Decoder_State *st, const float *synth, float *shb_synth, const int16_t sid_bw ); @@ -55,7 +55,7 @@ static void shb_CNG_decod( Decoder_State *st, const float *synth, float *shb_syn * * Decoding of CNG parameters *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void CNG_dec( Decoder_State *st, /* i/o: State structure */ const int16_t last_element_mode, /* i : last element mode */ @@ -530,7 +530,7 @@ void CNG_dec( } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * swb_CNG_dec() * @@ -780,7 +780,7 @@ void td_cng_dec_init_flt( hTdCngDec->cng_ener_seed = RANDOM_INITSEED; hTdCngDec->cng_ener_seed1 = RANDOM_INITSEED; hTdCngDec->old_enr_index = -1; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hTdCngDec->Enew = 0.0f; mvr2r(st->lsp_old, st->lspCNG, M); #endif diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 85d6e9247a4df18cdbadf3bee412607c4350e6f1..3cb24a1b5cac69e1e6ed709715707f56a3148d09 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -102,7 +102,7 @@ void open_decoder_LPD_flt( st->nb_subfr = NB_SUBFR; } st->bits_frame = (int16_t) ( ( (float) st->L_frame / (float) st->fscale ) * (float) FSCALE_DENOM / 128.0f * (float) total_brate / 100.0f + 0.49f ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->TcxBandwidth_float = getTcxBandwidth_flt(bwidth); #endif st->narrowBand = (bwidth == NB) ? 1 : 0; @@ -130,7 +130,7 @@ void open_decoder_LPD_flt( st->pit_res_max_past = st->pit_res_max; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*Preemphasis param*/ if (st->fscale < (16000 * FSCALE_DENOM) / 12800) { @@ -157,7 +157,7 @@ void open_decoder_LPD_flt( { st->gamma_float = GAMMA1_FLT; } -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED /* LPC quantization */ if (st->sr_core <= INT_FS_16k && st->tcxonly == 0) @@ -180,7 +180,7 @@ void open_decoder_LPD_flt( /* Initialize TBE */ st->prev_coder_type = GENERIC; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if (st->hBWE_TD != NULL) { set_f(st->hBWE_TD->prev_lsf_diff, 0.5f, LPC_SHB_ORDER - 2); @@ -201,7 +201,7 @@ void open_decoder_LPD_flt( { if (!is_init || st->element_mode != IVAS_CPE_MDCT) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED init_tcx_cfg(st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac_float, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag); #endif @@ -213,7 +213,7 @@ void open_decoder_LPD_flt( } } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if (st->hTECDec != NULL) { resetTecDec(st->hTECDec); @@ -242,7 +242,7 @@ void open_decoder_LPD_flt( st->last_is_cng = 0; st->rate_switching_reset = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if (st->hTcxDec != NULL) { reset_tcx_overl_buf(st->hTcxDec); @@ -254,10 +254,10 @@ void open_decoder_LPD_flt( } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_zero(st->syn_float, M + 1); set_zero(st->mem_syn_r_float, L_SYN_MEM); -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED mem_syn_r_size_old = 0; /* just to avoid MSVC warnings */ mem_syn_r_size_new = 0; /* just to avoid MSVC warnings */ @@ -267,7 +267,7 @@ void open_decoder_LPD_flt( else { /* Reset old_synth in case of core sampling rate switching and Mode 1/2 switching*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if (st->hTcxDec != NULL && ((st->L_frame != st->last_L_frame) || (st->last_codec_mode == MODE1 && st->element_mode == EVS_MONO))) { set_zero(st->hTcxDec->old_synth_float, OLD_SYNTH_INTERNAL_DEC); @@ -277,7 +277,7 @@ void open_decoder_LPD_flt( mem_syn_r_size_old = (int16_t)(1.25 * st->last_L_frame / 20.f); mem_syn_r_size_new = (int16_t)(1.25 * st->L_frame / 20.f); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*Reset LPC mem*/ if ((st->L_frame != st->last_L_frame) || (st->last_core == AMR_WB_CORE) || (st->last_core == HQ_CORE)) { @@ -295,7 +295,7 @@ void open_decoder_LPD_flt( /*Mode 1/2 switching*/ if (st->last_codec_mode == MODE1 && st->element_mode == EVS_MONO) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED mvr2r(st->lsp_old, st->lspold_uw_float, M); mvr2r(st->lsf_old, st->lsfold_uw_float, M); set_zero(st->syn_float, M); @@ -311,7 +311,7 @@ void open_decoder_LPD_flt( { /* Switching from Mode 1 ACELP */ st->last_core_bfi = ACELP_CORE; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED acelp_plc_mdct_transition(st); #endif } @@ -331,13 +331,13 @@ void open_decoder_LPD_flt( /*Reset of ACELP memories*/ st->rate_switching_reset = 1; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->tilt_code = TILT_CODE_FLT; set_zero(st->old_exc, L_EXC_MEM_DEC); set_zero(st->mem_syn2, M); set_zero(st->syn_float, 1 + M); #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*OLA -> zero */ if (st->hTcxDec != NULL) { @@ -347,7 +347,7 @@ void open_decoder_LPD_flt( #endif if (st->hTcxCfg != NULL) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED mvr2r(st->hHQ_core->old_out + NS2SA(st->output_Fs, N_ZERO_MDCT_NS), st->hTcxDec->syn_OverlFB_float, st->hTcxCfg->tcx_mdct_window_lengthFB); #endif st->hTcxCfg->last_aldo = 1; /*It was previously ALDO*/ @@ -381,7 +381,7 @@ void open_decoder_LPD_flt( /*Interpolation of ACELP memories*/ /* convert quantized LSP vector */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->rate_switching_reset = lsp_convert_poly(st->lsp_old, st->L_frame, 0); lsp2a_stab(st->lsp_old, st->old_Aq_12_8, M); @@ -403,7 +403,7 @@ void open_decoder_LPD_flt( st->rate_switching_reset = 1; /*reset partly some memories*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->tilt_code = TILT_CODE_FLT; if (!st->last_con_tcx) { @@ -415,7 +415,7 @@ void open_decoder_LPD_flt( /*Size of LPC syn memory*/ lerp_flt(st->mem_syn_r_float + L_SYN_MEM - mem_syn_r_size_old, st->mem_syn_r_float + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old); mvr2r(st->mem_syn_r_float + L_SYN_MEM - M, st->mem_syn2, M); -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED } /* update of lsf_old only needed in BASOP */ /* else if( !st->tcxonly && (st->L_frame == L_FRAME16k) && (st->last_total_brate > ACELP_32k) ) */ @@ -437,7 +437,7 @@ void open_decoder_LPD_flt( /* bass pf reset */ st->bpf_gain_param = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if (st->hBPF != NULL) { set_f(st->hBPF->pst_old_syn, 0, NBPSF_PIT_MAX); @@ -448,7 +448,7 @@ void open_decoder_LPD_flt( { /* do nothing */ } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED else if (st->last_codec_mode == MODE2) { if (!st->tcxonly) @@ -497,7 +497,7 @@ void open_decoder_LPD_flt( { st->hTcxDec->old_synth_float[st->hTcxDec->old_synth_len - 1] = st->syn_float[M]; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if (st->hBPF != NULL) { st->hBPF->pst_old_syn[NBPSF_PIT_MAX - 1] = st->syn_float[M]; @@ -507,7 +507,7 @@ void open_decoder_LPD_flt( } #endif /* lsf and lsp initialization */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if (st->ini_frame == 0) { mvr2r(st->lsp_old, st->lspold_uw_float, M); @@ -520,7 +520,7 @@ void open_decoder_LPD_flt( st->seed_tcx_plc = RANDOM_INITSEED; st->plcBackgroundNoiseUpdated = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->past_gpit_float = 0.0f; st->past_gcode_float = 0.0f; @@ -532,22 +532,22 @@ void open_decoder_LPD_flt( mvr2r(st->lsp_old, st->old_lsp_q_cng_float, M); set_zero(st->mem_syn_unv_back_float, M); st->last_gain_syn_deemph_float = 1.f; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED if (st->last_codec_mode == MODE1 || st->ini_frame == 0) { /* this assumes that MODE1 fades out in the frequency domain - otherwise some data from MODE1 would be needed here */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->last_concealed_gain_syn_deemph_float = 1.f; if (hTcxDec != NULL) { hTcxDec->conceal_eof_gain_float = 1.0f; } -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED } /* Post processing */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_zero(st->mem_Aq_float, NB_SUBFR16k * (M + 1)); st->lp_ener_bfi = 60.0f; @@ -567,12 +567,12 @@ void open_decoder_LPD_flt( { st->hTcxDec->noise_filling_index[0] = st->hTcxDec->noise_filling_index[1] = 0; st->hTcxDec->tnsActive[0] = st->hTcxDec->tnsActive[1] = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f(st->hTcxDec->ltpGainMemory, 0.0f, N_LTP_GAIN_MEMS); #endif } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED mvr2r(st->lsf_old, st->lsf_adaptive_mean, M); mvr2r(st->lsf_old, st->lsfoldbfi0, M); mvr2r(st->lsf_old, st->lsfoldbfi1, M); @@ -587,25 +587,25 @@ void open_decoder_LPD_flt( if (st->prev_bfi) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /* calculate energy at the end of the previous frame */ if (st->core == ACELP_CORE && st->last_core == HQ_CORE) { fer_energy(st->hTcxDec->L_frameTCX, UNVOICED_CLAS, st->previoussynth, -1, &st->enr_old, 1); } -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED } else { st->last_good = UNVOICED_CLAS; /* last good received frame for concealment */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->enr_old = 0.0f; /* energy at the end of the previous frame */ -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->lp_gainc = 0.0f; st->lp_gainp = 0.0f; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED if (st->hTcxDec != NULL) { @@ -615,7 +615,7 @@ void open_decoder_LPD_flt( { st->hTcxDec->NoiseLevelIndex_bfi = PLC_MIN_STAT_BUFF_SIZE - 1; st->hTcxDec->CurrLevelIndex_bfi = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->hTcxDec->CngLevelBackgroundTrace_bfi = PLC_MIN_CNG_LEV_FLT; st->hTcxDec->LastFrameLevel_bfi = PLC_MIN_CNG_LEV_FLT; set_f(st->hTcxDec->NoiseLevelMemory_bfi, PLC_MIN_CNG_LEV_FLT, PLC_MIN_STAT_BUFF_SIZE); @@ -627,7 +627,7 @@ void open_decoder_LPD_flt( -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED for (i = 0; i < 2 * NB_SUBFR16k + 2; i++) { st->old_pitch_buf[i] = (float)st->pit_min; @@ -638,18 +638,18 @@ void open_decoder_LPD_flt( st->mem_pitch_gain_float[i] = 1.f; } st->old_fpitch_float = (float)st->pit_min; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED st->rate_switching_init = 1; st->reset_mem_AR = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /* For phase dispersion */ set_zero(st->dispMem, 8); st->voice_fac_float = -1; /* purely unvoiced */ -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED /* TCX-LTP */ if (hTcxLtpDec != NULL) @@ -660,9 +660,9 @@ void open_decoder_LPD_flt( /* TCX */ if (hTcxDec != NULL) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->old_fpitchFB_float = (float)hTcxDec->pit_min_TCX; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED if (st->ini_frame == 0 || (st->last_codec_mode == MODE1 && st->element_mode == EVS_MONO)) { @@ -674,7 +674,7 @@ void open_decoder_LPD_flt( hTcxDec->envWeighted = 0; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if (st->hBPF != NULL) { st->hBPF->pst_mem_deemp_err = 0.0f; @@ -746,13 +746,13 @@ void open_decoder_LPD_flt( { st->hTcxCfg->fIsTNSAllowed = getTnsAllowed(is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode); } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if (hTcxDec != NULL) { hTcxDec->tcxltp_second_last_pitch_float = st->old_fpitch_float; hTcxDec->tcxltp_third_last_pitch_float = st->old_fpitch_float; } -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED if ( ( total_brate == ACELP_9k60 || total_brate == ACELP_16k40 || total_brate == ACELP_24k40 ) && st->element_mode == EVS_MONO ) { @@ -769,7 +769,7 @@ void open_decoder_LPD_flt( if ( hTcxDec != NULL ) { hTcxDec->enableTcxLpc = 1; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hTcxDec->old_gaintcx_bfi_float = 0.0f; #endif hTcxDec->tcx_hm_LtpPitchLag = -1; @@ -797,7 +797,7 @@ void tcxltp_dec_init( const int16_t pit_max, const int32_t sr_core ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hTcxLtpDec->tcxltp_gain_float = 0.0f; #endif hTcxLtpDec->tcxltp = getTcxLtp( sr_core ); @@ -834,7 +834,7 @@ void tcxltp_dec_init( * * Reset TCX core overlap buffers *-----------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void reset_tcx_overl_buf( TCX_DEC_HANDLE hTcxDec /* i/o: TCX decoder handle */ ) @@ -867,7 +867,7 @@ void reset_tcx_overl_buf_fx( * * Prepare MDCT OLA memories in TCX/HQ after ACELP PLC *-----------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void acelp_plc_mdct_transition( Decoder_State *st /* i/o: Decoder state */ ) diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 2b4952cdc62b90688ca5e0698923cbc15cf8acf5..0c271d9c0d6fa7f08d513d6c816c58d7ef8d5e10 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -18,7 +18,7 @@ * * Initialization of state variables *-----------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void open_decoder_LPD( Decoder_State *st, const Word32 total_brate, @@ -1808,11 +1808,11 @@ void open_decoder_LPD_ivas_fx( { concealment_init_ivas_fx( st->hTcxDec->L_frameTCX, st->hPlcInfo ); //---------------- To be removed later : Only initializations -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->hPlcInfo->outx_new_n1 = 0.0f; st->hPlcInfo->nsapp_gain = 0.0f; #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->hPlcInfo->nsapp_gain_n = 0.0f; st->hPlcInfo->ener_mean = 59.4260f; st->hPlcInfo->ener = 0.0f; @@ -1840,7 +1840,7 @@ void open_decoder_LPD_ivas_fx( st->hTonalMDCTConc->lastBlockData.tonalConcealmentActive = 0; st->hTonalMDCTConc->lastBlockData.nSamples = 0; TonalMDCTConceal_Init_ivas_fx( st->hTonalMDCTConc, st->hTcxDec->L_frameTCX, st->L_frame, FDNS_NPTS, st->hTcxCfg ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED //st->hTonalMDCTConc->pTCI = (TonalComponentsInfo *) st->hTonalMDCTConc->timeDataBuffer_float; st->hTonalMDCTConc->pTCI = &st->hTonalMDCTConc->pTCI1; st->hTonalMDCTConc->lastPitchLag_float = 0; @@ -1848,7 +1848,7 @@ void open_decoder_LPD_ivas_fx( st->hTonalMDCTConc->last_block_nrg_flt = 0.0f; st->hTonalMDCTConc->curr_noise_nrg_flt = 0.0f; st->hTonalMDCTConc->faded_signal_nrg_flt = 0.0f; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED st->hTonalMDCTConc->secondLastPcmOut_float = &st->hTonalMDCTConc->timeDataBuffer_float[( 3 * L_FRAME_MAX ) / 2 - imult1616( 3, shr( s_min( L_FRAME_MAX, st->hTcxDec->L_frameTCX ), 1 ) )]; st->hTonalMDCTConc->lastPcmOut_float = &st->hTonalMDCTConc->timeDataBuffer_float[( 3 * L_FRAME_MAX ) / 2 - s_min( L_FRAME_MAX, st->hTcxDec->L_frameTCX )]; //---------------To be removed later @@ -1900,3 +1900,4 @@ void open_decoder_LPD_ivas_fx( return; } #endif // IVAS_FLOAT_FIXED +#endif \ No newline at end of file diff --git a/lib_dec/core_dec_reconf.c b/lib_dec/core_dec_reconf.c index 9f3354b09b67958068c45e947beaf03044a7f999..c8aaad9da922bbebb4c7e8d0465fdf763baf8aab 100644 --- a/lib_dec/core_dec_reconf.c +++ b/lib_dec/core_dec_reconf.c @@ -41,7 +41,7 @@ #include "rom_dec.h" #include "wmc_auto.h" #include "prot_fx2.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * reconfig_decoder_LPD_ivas() * @@ -140,7 +140,7 @@ void reconfig_decoder_LPD_ivas( newLen = st->L_frame / 2; oldLen = L_frame_old / 2; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if ( st->hTcxDec != NULL ) { lerp_flt( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl_float, newLen, oldLen ); @@ -170,17 +170,17 @@ void reconfig_decoder_LPD_ivas( oldLen = L_SYN_MEM_CLAS_ESTIM; newLen = L_SYN_MEM_CLAS_ESTIM * st->L_frame / st->last_L_frame; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED lerp_flt(&st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - oldLen], &st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - newLen], newLen, oldLen); -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED } } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED else { set_zero(st->mem_syn_clas_estim, L_SYN_MEM_CLAS_ESTIM); } -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED } } diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index 5f6f16c35124d6c8c256ba9bfd128ade68e0bf61..5905f1557eef3a8eeb7dad99f6d76fce4a97cae2 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -64,7 +64,7 @@ void open_decoder_LPD_ivas_fx( Word16* Q_old_outLB, Word16* Q_old_Aq_12_8); #endif // IVAS_FLOAT_FIXED -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void mode_switch_decoder_LPD_flt( Decoder_State *st, /* i/o: decoder state structure */ const int16_t bwidth, /* i : audio bandwidth */ @@ -155,7 +155,7 @@ void mode_switch_decoder_LPD_flt( { st->narrowBand = 0; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->TcxBandwidth_float = getTcxBandwidth_flt( bwidth ); #endif if ( st->hTcxCfg != NULL ) @@ -175,7 +175,7 @@ void mode_switch_decoder_LPD_flt( frame_size = FrameSizeConfig[frame_size_index].frame_net_bits; reconfig_decoder_LPD_ivas( st, frame_size, bwidth, total_brate, st->last_L_frame ); -#if ( defined EVS_FLOAT ) || !( defined IVAS_FLOAT_FIXED ) +#ifndef IVAS_FLOAT_FIXED if ( hTcxDec->envWeighted && !hTcxDec->enableTcxLpc ) { mvr2r( st->lspold_uw_float, st->lsp_old, M ); @@ -187,7 +187,7 @@ void mode_switch_decoder_LPD_flt( lsp2lsf( st->lsp_old, st->lsfoldbfi1, M, st->sr_core ); mvr2r( st->lsfoldbfi1, st->lsfoldbfi0, M ); mvr2r( st->lsfoldbfi1, st->lsf_adaptive_mean, M ); -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED if ( st->igf && st->hBWE_TD != NULL ) { @@ -200,7 +200,7 @@ void mode_switch_decoder_LPD_flt( } else { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( st->hBWE_TD->state_lpc_syn, 0.0f, LPC_SHB_ORDER ); set_f( st->hBWE_TD->state_syn_shbexc, 0.0f, L_SHB_LAHEAD ); set_f( st->hBWE_TD->mem_stp_swb, 0.0f, LPC_SHB_ORDER ); @@ -221,7 +221,7 @@ void mode_switch_decoder_LPD_flt( { if ( st->tec_tfa == 0 && st->hTECDec != NULL ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_zero( st->hTECDec->loBuffer_flt, MAX_TEC_SMOOTHING_DEG ); #endif #ifdef IVAS_FLOAT_FIXED diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 95c92a80910a81af028ac0683e261447657ae85a..1f15288bf7cf186653d32f324490b792e1d6fc95 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -53,7 +53,7 @@ * Local prototypes *---------------------------------------------------------------------*/ -#if !(defined IVAS_FLOAT_FIXED) || (defined EVS_FLOAT) +#ifndef IVAS_FLOAT_FIXED static void core_switch_lb_upsamp( Decoder_State *st, float *output ); static void smoothTransitionDtxToTcx( float synth[], const int16_t output_frame, const int16_t delay_comp ); #endif @@ -421,7 +421,7 @@ ivas_error core_switching_pre_dec_ivas_fx( st->lp_gainc_fx = extract_h( Sqrt32( st->lp_ener_fx, &exp ) ); /*Q=15-exp*/ st->lp_gainc_fx = shr( st->lp_gainc_fx, 12 - exp ); /*Q3*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) /*To be removed later: floating point initializations*/ +#ifndef IVAS_FLOAT_FIXED /*To be removed later: floating point initializations*/ st->last_voice_factor = 0; #endif st->last_voice_factor_fx = 0; @@ -493,7 +493,7 @@ ivas_error core_switching_pre_dec_ivas_fx( st->lp_gainc_fx = extract_h( Sqrt32( st->lp_ener_fx, &exp ) ); /*Q=15-exp*/ st->lp_gainc_fx = shr( st->lp_gainc_fx, 12 - exp ); /*Q3*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->last_voice_factor = 0; #endif // st->last_voice_factor_fx = 0; @@ -698,7 +698,7 @@ ivas_error core_switching_pre_dec_ivas_fx( return error; } #endif // IVAS_FLOAT_FIXED -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED ivas_error core_switching_pre_dec( Decoder_State *st, /* i/o: decoder state structure */ const int16_t output_frame, /* i : frame length */ @@ -1192,7 +1192,7 @@ ivas_error core_switching_pre_dec( return error; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * core_switching_post_dec() * @@ -1602,7 +1602,7 @@ ivas_error core_switching_post_dec( * Preprocessing in the first HQ frame after ACELP frame * Modify bit allocation for HQ core by removing ACELP subframe budget *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void core_switching_hq_prepare_dec( Decoder_State *st, /* i/o: decoder state structure */ int16_t *num_bits, /* i/o: bit budget update */ @@ -1850,7 +1850,7 @@ void bandwidth_switching_detect_ivas_fx( * * Band-width switching pre-processing *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void bw_switching_pre_proc( Decoder_State *st, /* i/o: decoder state structure */ const float *old_syn_12k8_16k, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ @@ -2106,8 +2106,7 @@ void ivas_bw_switching_pre_proc_fx( * Resample HQ/TCX-LB to the output sampling rate (8/16/32/48 kHz) *---------------------------------------------------------------------*/ -//#ifdef EVS_FLOAT -#if !(defined IVAS_FLOAT_FIXED) || (defined EVS_FLOAT) +#ifndef IVAS_FLOAT_FIXED static void core_switch_lb_upsamp( Decoder_State *st, /* i/o: Decoder state */ float *output /* i/o: LB synth/upsampled LB synth */ @@ -2218,7 +2217,7 @@ static void core_switch_lb_upsamp_fx( /* analysis and add the BPF error signal */ IF( st->p_bpf_noise_buf_32 ) { - addBassPostFilter_fx( st->p_bpf_noise_buf_32, st->bpf_off ? 0 : i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbBPF->no_channels ), realBuffer_fx, imagBuffer_fx, st->cldfbBPF ); + addBassPostFilter_ivas_fx( st->p_bpf_noise_buf_32, st->bpf_off ? 0 : i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbBPF->no_channels ), realBuffer_fx, imagBuffer_fx, st->cldfbBPF ); } /* set output mask for upsampling */ @@ -2258,7 +2257,7 @@ static void core_switch_lb_upsamp_fx( #define TRANSITION_SMOOTHING_LEN_32k 31 #define TRANSITION_SMOOTHING_LEN_48k 47 -#if !(defined IVAS_FLOAT_FIXED) || (defined EVS_FLOAT) +#ifndef IVAS_FLOAT_FIXED static void smoothTransitionDtxToTcx( float synth[], /* i/o: synthesis */ const int16_t output_frame, /* i : output frame length */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 3bfc1a4f0a622b3a509cce0d91d580f92665d0bd..8105c391841d9619f188e228402a96fe849b933c 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -2207,7 +2207,7 @@ static void core_switch_lb_upsamp_fx( /* analysis and add the BPF error signal */ IF( st->p_bpf_noise_buf_32 ) { - addBassPostFilter_fx( st->p_bpf_noise_buf_32, st->bpf_off ? 0 : i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbBPF->no_channels ), realBuffer_fx, imagBuffer_fx, st->cldfbBPF ); + addBassPostFilter_ivas_fx( st->p_bpf_noise_buf_32, st->bpf_off ? 0 : i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbBPF->no_channels ), realBuffer_fx, imagBuffer_fx, st->cldfbBPF ); } /* set output mask for upsampling */ diff --git a/lib_dec/dec_LPD.c b/lib_dec/dec_LPD.c index a307cba3a0b4b0ec27d05d40383bddc21de97a28..54f06355d654c9a67a3c0e54e9f6f1f05ebbf4a1 100644 --- a/lib_dec/dec_LPD.c +++ b/lib_dec/dec_LPD.c @@ -52,7 +52,7 @@ * * Core decoder MODE2 *--------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void decoder_LPD_flt( Decoder_State *st, /* i/o: decoder memory state pointer */ float signal_out[], /* o : signal with LPD delay (7 subfrs) */ diff --git a/lib_dec/dec_ace.c b/lib_dec/dec_ace.c index a643e05c23848349b5f9a68387ef67e0d250f4c2..f6e9f9c32161e85ce2576f8124644f6ffb561be5 100644 --- a/lib_dec/dec_ace.c +++ b/lib_dec/dec_ace.c @@ -40,7 +40,7 @@ #include #include "rom_com.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * decoder_acelp_flt() * diff --git a/lib_dec/dec_acelp_tcx_main.c b/lib_dec/dec_acelp_tcx_main.c index 149c1206eb4266972f205e51c743660c394bbaaf..ce6dc681b33e53e8ad298e5ca551cb75c25b1465 100644 --- a/lib_dec/dec_acelp_tcx_main.c +++ b/lib_dec/dec_acelp_tcx_main.c @@ -41,7 +41,7 @@ #include "options.h" #include "stat_dec.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * decode_frame_type_flt() * diff --git a/lib_dec/dec_amr_wb.c b/lib_dec/dec_amr_wb.c index 7ddb784cc923faa357fc33f9264840b211f3c525..495af31628ea8b02ba77950ab3551d1f7b8be058 100644 --- a/lib_dec/dec_amr_wb.c +++ b/lib_dec/dec_amr_wb.c @@ -46,7 +46,7 @@ * * Decode excitation signal in AMR-WB IO mode *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void decod_amr_wb( Decoder_State *st, /* i/o: decoder static memory */ const float *Aq, /* i : LP filter coefficients */ diff --git a/lib_dec/dec_gen_voic.c b/lib_dec/dec_gen_voic.c index a62b3f40864fa814d0b8fb3aff70e1922c252adc..eb2ff8f988f2360091788f08611406f7b8d7535e 100644 --- a/lib_dec/dec_gen_voic.c +++ b/lib_dec/dec_gen_voic.c @@ -40,7 +40,7 @@ #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * decod_gen_voic() * diff --git a/lib_dec/dec_higher_acelp.c b/lib_dec/dec_higher_acelp.c index 0d6856b84f4bb3a7b4ec6c4ffb7431d84495384d..03f4deff9d6bd5e8cb6d8723259a9b228ca1a802 100644 --- a/lib_dec/dec_higher_acelp.c +++ b/lib_dec/dec_higher_acelp.c @@ -50,7 +50,7 @@ * * Transform domain contribution decoding *-----------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void transf_cdbk_dec( Decoder_State *st, /* i/o: decoder state structure */ const int16_t harm_flag_acelp, /* i : harmonic flag for higher rates ACELP */ diff --git a/lib_dec/dec_nelp.c b/lib_dec/dec_nelp.c index 80e86881f8c2ec5bc31929e2393e63dcbafb8625..a9cddbf159bb4b2003554bba09c43e78d7f3a76f 100644 --- a/lib_dec/dec_nelp.c +++ b/lib_dec/dec_nelp.c @@ -39,7 +39,7 @@ #include "cnst.h" #include "prot.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * decod_nelp() * diff --git a/lib_dec/dec_pit_exc.c b/lib_dec/dec_pit_exc.c index 431bdf9b41e16051d470cc4721321ad75beb9a60..7c95ecde165a339906e2cbcf24a7c0de36d0c466 100644 --- a/lib_dec/dec_pit_exc.c +++ b/lib_dec/dec_pit_exc.c @@ -46,7 +46,7 @@ * * Decode pitch-only contribution (used by the GSC technology) *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void dec_pit_exc( Decoder_State *st, /* i/o: decoder static memory */ const int16_t L_frame, /* i : length of the frame */ diff --git a/lib_dec/dec_post.c b/lib_dec/dec_post.c index a8ea1fa10472c66514c722c2d3dbac314450667d..075746dda06046ef3f5d718e942e8eafd068e7ee 100644 --- a/lib_dec/dec_post.c +++ b/lib_dec/dec_post.c @@ -75,7 +75,7 @@ static void Dec_formant_postfilt( PFSTAT *pfstat, const float *signal_ptr, const * * Post-filter initialization *--------------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void Init_post_filter_ivas( PFSTAT_HANDLE hPFstat /* i/o: post-filter state memories handle */ ) @@ -110,7 +110,7 @@ void Init_post_filter_ivas( * * Main routine to perform post filtering of NB signals *--------------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void nb_post_filt_ivas( const int16_t L_frame, /* i : frame length */ const int16_t L_subfr, /* i : sub-frame length */ @@ -185,7 +185,7 @@ void nb_post_filt_ivas( * * WB and SWB formant post-filtering *--------------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void formant_post_filt_ivas( PFSTAT_HANDLE hPFstat, /* i/o: Post filter related memories */ float *synth_in, /* i : 12k8 synthesis */ @@ -316,7 +316,7 @@ void formant_post_filt_ivas( * 1. search around 1st subframe delay (3 integer values) * 2. search around best integer with fract. delays (1/8) *----------------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED static void Dec_postfilt( const int16_t L_subfr, /* i : sub-frame length */ PFSTAT *pfstat, /* i/o: Post filter related memories */ @@ -402,7 +402,7 @@ static void Dec_postfilt( * k1 = 1st parcor calculated on {hi} * gamma3 = gamma3_minus if k1<0, gamma3_plus if k1>0 *----------------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED static void Dec_formant_postfilt( PFSTAT_HANDLE hPFstat, /* i/o: states strucure */ const float *signal_ptr, /* i : input signal (pointer to current subframe */ diff --git a/lib_dec/dec_ppp.c b/lib_dec/dec_ppp.c index 5e2d86a69cfc47b43fd048429f88ec4542475558..12237849a6f31408c6e94213d8849edee3aa81b4 100644 --- a/lib_dec/dec_ppp.c +++ b/lib_dec/dec_ppp.c @@ -39,7 +39,7 @@ #include "cnst.h" #include "prot.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * decod_ppp() * diff --git a/lib_dec/dec_prm.c b/lib_dec/dec_prm.c index 296a15cf98d63cc28acd85d861452e733cd5e08a..19d3856a1e5de7af0f1aed25d337bd8002b5f88e 100644 --- a/lib_dec/dec_prm.c +++ b/lib_dec/dec_prm.c @@ -402,7 +402,7 @@ void getLPCparam_ivas( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * getTCXparam_ivas() * @@ -767,7 +767,7 @@ void dec_prm_hm_ivas( * * decode parameters according to selected mode * *-----------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void dec_prm_ivas( Decoder_State *st, /* i/o: decoder memory state */ int16_t param[], /* o : decoded parameters */ diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index f38d285a7d546f818624e2200be2dd8e5f5888ea..71776c40016ce250393bdd60474f49b07203bb04 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -51,7 +51,7 @@ #include "debug.h" #endif // !IVAS_FLOAT_FIXED_UNIT_TESTING -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * decoder_tcx_flt() * @@ -118,7 +118,7 @@ void decoder_tcx_flt( * * *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void decoder_tcx_post_flt( Decoder_State *st, /* i/o: decoder memory state */ float *synth, /* i/o: synthesis */ @@ -260,9 +260,9 @@ 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 ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->bfi_pitch = st->old_fpitch_float; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#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]; @@ -887,13 +887,13 @@ void decoder_tcx_invQ( 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_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 ); + 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_flt( 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 ); + 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; @@ -1456,7 +1456,7 @@ void decoder_tcx_noisefilling( #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * decoder_tcx_noiseshaping_igf() * @@ -1749,7 +1749,7 @@ void decoder_tcx_tns_fx( } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * decoder_tcx_imdct() * diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index b726fa3c1e490faf7113d1f64bdd32d8d4003e8d..fb963993b18a38dd03f41a1d8b64c3b7a62643c7 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -363,7 +363,7 @@ void decoder_tcx( move16(); } - tcx_arith_decode_envelope( + tcx_arith_decode_envelope_fx( x, &x_e, L_frame, L_spec, @@ -3842,7 +3842,7 @@ void decoder_tcx_invQ_fx( prm_sqQ = prm_target + 1; move16(); - tcx_arith_decode_envelope_fx( st, x, 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 ); + tcx_arith_decode_envelope_ivas_fx( st, x, 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 ); hTcxDec->resQBits[frame_cnt] = *prm_target - arith_bits; move16(); diff --git a/lib_dec/dec_tran.c b/lib_dec/dec_tran.c index 65878183e15280237484c10c9e54ac484836be92..ed158a00f5ba35b87a076e5a6ad9cbedfdf2e021 100644 --- a/lib_dec/dec_tran.c +++ b/lib_dec/dec_tran.c @@ -45,7 +45,7 @@ * * Decode transition (TC) frames *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void decod_tran( Decoder_State *st, /* i/o: decoder static memory */ const int16_t L_frame, /* i : length of the frame */ diff --git a/lib_dec/dec_uv.c b/lib_dec/dec_uv.c index 34866754ac0349c76b1b2cc2f0af4f293532a047..c5b52d986a6c8a2fdd01e402f4d5eb2a4be946d8 100644 --- a/lib_dec/dec_uv.c +++ b/lib_dec/dec_uv.c @@ -38,7 +38,7 @@ #include "options.h" #include "prot.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * decod_unvoiced() * diff --git a/lib_dec/dlpc_stoch.c b/lib_dec/dlpc_stoch.c index 332e7cddbf9bac5c4a5dab52677a10e1f099205c..9e86d5efcd1f64dea7a025a40a2704d244d096b3 100644 --- a/lib_dec/dlpc_stoch.c +++ b/lib_dec/dlpc_stoch.c @@ -47,7 +47,7 @@ * * *------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void lpc_unquantize_flt( Decoder_State *st, float *lsf, diff --git a/lib_dec/er_dec_acelp.c b/lib_dec/er_dec_acelp.c index 01eb2389a32d405cb018f988f9871987705b4fa3..ddc0f08224323ae179c3061ce1569de66b5dcf86 100644 --- a/lib_dec/er_dec_acelp.c +++ b/lib_dec/er_dec_acelp.c @@ -40,7 +40,7 @@ #include #include "prot.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * con_acelp_flt() * diff --git a/lib_dec/er_dec_tcx.c b/lib_dec/er_dec_tcx.c index e6b31d69dedfab16226a9e26e93e2b0059cd6e7e..9d1abdb32f9dfa86bb68414491589cb68b97d6f9 100644 --- a/lib_dec/er_dec_tcx.c +++ b/lib_dec/er_dec_tcx.c @@ -44,7 +44,7 @@ #include "rom_dec.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * con_tcx_flt() * diff --git a/lib_dec/er_util.c b/lib_dec/er_util.c index 9ff9543f8118811a89a7d3380a56f5314603fc3c..55fb7fc9bac080bb2a23017fc5e2f0b65388ba46 100644 --- a/lib_dec/er_util.c +++ b/lib_dec/er_util.c @@ -42,7 +42,7 @@ #include "stat_com.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * minimumStatistics_flt() * diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 2f9e2e22ea4faa0f4d670f06984455e124ce62b7..6afa86c005613e9d2363f59fb8deb0521431ce4d 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -46,7 +46,7 @@ #include "prot_fx2.h" #include "ivas_prot_fx.h" #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * evs_dec_flt() * diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index abd09dd818cb55df8bdc40ea96396612c218ad83..48101b320eb637554341ad2df60d4433923d68ee 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -74,7 +74,7 @@ /*------------------------------------------------------------------- * Local fucntions declarations *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#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 ); #endif // IVAS_FLOAT_FIXED @@ -130,7 +130,7 @@ void initFdCngDec_flt( /* Set some counters and flags */ hFdCngDec->flag_dtx_mode = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hFdCngDec->lp_noise_float = -20.f; hFdCngDec->lp_speech_float = 25.f; @@ -151,13 +151,13 @@ void initFdCngDec_flt( #endif set_s( hFdCngDec->msLocalMinFlag, 0, NPART_SHAPING ); set_s( hFdCngDec->msNewMinFlag, 0, NPART_SHAPING ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hFdCngDec->msPsdFirstMoment_float, 0.0f, NPART_SHAPING ); set_f( hFdCngDec->msPsdSecondMoment_float, 0.0f, NPART_SHAPING ); #endif hFdCngDec->msPeriodogBufPtr = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hFdCngDec->msPeriodogBuf_float, 0.0f, MSBUFLEN * NPART_SHAPING ); set_f( hFdCngDec->msLogPeriodog_float, 0.0f, NPART_SHAPING ); set_f( hFdCngDec->msLogNoiseEst_float, 0.0f, NPART_SHAPING ); @@ -165,7 +165,7 @@ void initFdCngDec_flt( #endif hFdCngDec->nFFTpart_shaping = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hFdCngDec->hFdCngCom->sidNoiseEstLp_flt, 0.0f, NPART ); set_f( hFdCngDec->smoothed_psd, 0.0f, L_FRAME16k ); set_f( hFdCngDec->msPeriodog_ST, 0.0f, NPART_SHAPING ); @@ -173,7 +173,7 @@ void initFdCngDec_flt( hFdCngDec->ms_last_inactive_bwidth = NB; hFdCngDec->ms_cnt_bw_up = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hFdCngDec->cna_LR_LT = 0.5f; hFdCngDec->cna_ILD_LT = 0.0f; #endif @@ -182,27 +182,29 @@ void initFdCngDec_flt( hFdCngDec->cna_nbands = CNA_INIT_NBANDS; mvs2s( cna_init_bands, hFdCngDec->cna_band_limits, CNA_INIT_NBANDS + 1 ); - hFdCngDec->cna_act_fact_fx = MAX_WORD16; - hFdCngDec->cna_rescale_fact_fx = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) + +#ifndef IVAS_FLOAT_FIXED hFdCngDec->cna_act_fact = 1.0f; hFdCngDec->cna_rescale_fact = 0.0f; +#else + hFdCngDec->cna_act_fact_fx = MAX_WORD16; + hFdCngDec->cna_rescale_fact_fx = 0; #endif hFdCngDec->cna_seed = 5687; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_zero( hFdCngDec->cna_cm, STEREO_DFT_BAND_MAX ); set_zero( hFdCngDec->cna_g_state, STEREO_DFT_BAND_MAX ); #endif st->CNG_mode = -1; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED mvr2r(st->lsp_old, st->lspCNG, M); -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * configureFdCngDec_flt() * @@ -564,7 +566,7 @@ void configureFdCngDec_fx( FOR ( j = 0; j < hsCom->nCLDFBpart; j++ ) { hsCom->CLDFBpart[j] = sub( hsCom->part[j + hsCom->nFFTpart], sub( hsCom->stopFFTbin, hsCom->startBand ) ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hsCom->CLDFBpsize_inv_flt[j] = hsCom->psize_inv_flt[j + hsCom->nFFTpart]; // TODO remove floating point dependency #endif hsCom->CLDFBpsize_inv[j] = hsCom->psize_inv[j + hsCom->nFFTpart]; @@ -598,7 +600,7 @@ void configureFdCngDec_fx( hsCom->olapWinAna_fx = olapWinAna512_fx; hsCom->fftSineTab_fx = NULL; hsCom->olapWinSyn_fx = olapWinSyn256_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /* TODO: remove floating point dependency */ hsCom->fftSineTab_flt = NULL; hsCom->olapWinAna_flt = olapWinAna512; @@ -613,7 +615,7 @@ void configureFdCngDec_fx( hsCom->olapWinAna_fx = olapWinAna640_fx; hsCom->fftSineTab_fx = fftSineTab640_fx; hsCom->olapWinSyn_fx = olapWinSyn320_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /* remove floating point dependency */ hsCom->fftSineTab_flt = fftSineTab640; hsCom->olapWinAna_flt = olapWinAna640; @@ -663,7 +665,7 @@ void deleteFdCngDec_flt( * * Apply the CLDFB-based CNG at the decoder *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void ApplyFdCng_flt( float *timeDomainInput, float *powerSpectrum, @@ -1264,7 +1266,7 @@ static void perform_noise_estimation_dec_flt( * * Decode the FD-CNG bitstream *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void FdCng_decodeSID_flt( Decoder_State *st /* i/o: decoder state structure */ ) @@ -1448,7 +1450,7 @@ void FdCng_decodeSID_ivas_fx( * * *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void noisy_speech_detection_flt( HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: FD_CNG structure */ const int16_t vad, /* i : VAD flag */ @@ -1485,7 +1487,7 @@ void noisy_speech_detection_flt( * * Generate the comfort noise based on the target noise level *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void generate_comfort_noise_dec_flt( float **bufferReal, /* o : Real part of input bands */ float **bufferImag, /* o : Imaginary part of input bands */ @@ -1747,7 +1749,7 @@ void generate_comfort_noise_dec_flt( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * generate_comfort_noise_dec_hf_flt() * @@ -2200,7 +2202,7 @@ void generate_masking_noise_update_seed_flt( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * generate_masking_noise_mdct_flt() * @@ -2607,7 +2609,7 @@ void generate_stereo_masking_noise_16fx( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * generate_masking_noise_hf_cldfb() * @@ -2862,7 +2864,7 @@ void generate_masking_noise_lb_dirac_fx( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * generate_masking_noise_hf_cldfb() * diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 7d57d9e843f5a7b2101761a57cb4dbbe9976bbf6..b856b1af25da9ec138585b7057a8b0a0fdec3513 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -263,7 +263,9 @@ void initFdCngDec( hFdCngDec->hFdCngCom->fftBuffer_exp = 0; hFdCngDec->hFdCngCom->periodog_exp = 0; set32_fx(hFdCngDec->smoothed_psd_fx, 0, L_FRAME16k); +#ifdef IVAS_FLOAT_FIXED hFdCngDec->q_smoothed_psd = Q4; +#endif #ifdef IVAS_CODE_CNG set_f(hFdCngDec->hFdCngCom->sidNoiseEstLp, 0.0f, NPART); diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index 140241660b96e3b78c309f5a41a4bbcacaf89f42..abdbc52f6a15d52d75fcc6a12e7546c964a00c39 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -48,7 +48,7 @@ * * Decode audio (AC) frames *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void decod_audio( Decoder_State *st, /* i/o: decoder static memory */ float dct_epit[], /* o : GSC excitation in DCT domain */ diff --git a/lib_dec/hf_synth.c b/lib_dec/hf_synth.c index 25f94331caeec4e912d7cdaf0a7ad727b7bac9e4..2267d44d8f79713af77fbf7bc9d303ce85598105 100644 --- a/lib_dec/hf_synth.c +++ b/lib_dec/hf_synth.c @@ -63,7 +63,7 @@ static void envelope( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const int32_t core_brate, c static void AdaptiveStartBand( int16_t *start_band, const int32_t core_brate, const float *lsf, const float voicing_fac, const int16_t clas, int16_t *voicing_flag, int16_t *start_band_old, float *OptCrit_old ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * hf_synth_init() * @@ -119,7 +119,7 @@ void hf_synth_amr_wb_init( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * hf_synth_amr_wb_reset() * @@ -882,7 +882,7 @@ static void AdaptiveStartBand( } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * hf_synth_reset() * diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index d642249df7d81a83ac23d1b5c2048049449477dd..244aa115e22788b4900565efa9718996eb396004 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -54,7 +54,7 @@ * * HQ core decoder *--------------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void hq_core_dec( Decoder_State *st, /* i/o: decoder state structure */ float synth[], /* o : output synthesis */ @@ -666,11 +666,11 @@ void HQ_core_dec_init_flt( hHQ_core->oldHqVoicing = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hHQ_core->prev_noise_level, 0.0f, 2 ); #endif hHQ_core->prev_R = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE ); #endif set_s( hHQ_core->prev_SWB_peak_pos, 0, SPT_SHORTEN_SBNUM ); @@ -685,21 +685,21 @@ void HQ_core_dec_init_flt( //hHQ_core->energy_lt = 300.0f; hHQ_core->HqVoicing = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hHQ_core->fer_samples, 0, L_FRAME48k ); set_f( hHQ_core->prev_env, 0, SFM_N_WB ); set_f( hHQ_core->prev_normq, 0, SFM_N_WB ); #endif hHQ_core->prev_hqswb_clas = HQ_NORMAL; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hHQ_core->last_ni_gain, 0, BANDS_MAX ); set_f( hHQ_core->last_env, 0, BANDS_MAX ); #endif hHQ_core->last_max_pos_pulse = 0; hHQ_core->prev_frm_hfe2 = 0; hHQ_core->prev_stab_hfe2 = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hHQ_core->prev_ni_ratio = 0.5f; set_f( hHQ_core->prev_En_sb, 0.0f, NB_SWB_SUBBANDS ); #endif @@ -709,7 +709,7 @@ void HQ_core_dec_init_flt( * HQ FEC *----------------------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hHQ_core->X_sav, 0.0f, PH_ECU_SPEC_SIZE ); #endif hHQ_core->num_p = 0; @@ -717,20 +717,20 @@ void HQ_core_dec_init_flt( hHQ_core->ni_seed_forfec = 0; hHQ_core->last_fec = 0; hHQ_core->ph_ecu_HqVoicing = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hHQ_core->oldgapsynth, 0.0f, L_FRAME48k ); hHQ_core->env_stab = 0.75f; #endif hHQ_core->mem_norm_hqfec[0] = 31; set_s( hHQ_core->mem_norm_hqfec + 1, 39, SFM_N_ENV_STAB - 1 ); hHQ_core->mem_env_delta_hqfec = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hHQ_core->env_stab_plc = 0.0f; set_f( hHQ_core->env_stab_state_p, 1.0f / NUM_ENV_STAB_PLC_STATES, NUM_ENV_STAB_PLC_STATES ); #endif hHQ_core->envstabplc_hocnt = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hHQ_core->mag_chg_1st, 1.0f, LGW_MAX ); set_f( hHQ_core->Xavg, 0.0f, LGW_MAX ); hHQ_core->beta_mute = BETA_MUTE_FAC_INI_FLT; @@ -746,7 +746,7 @@ void HQ_core_dec_init_flt( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * HQ_nbfec_init_flt() * diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index 2c3fe933291a08fd699961d329bc0cdd04a2b414..60daf629b7cea54ff4bf50870fae191ba7ea4a2c 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -11,7 +11,7 @@ #include "prot.h" #include "ivas_prot_fx.h" #endif - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- * hq_core_dec() * @@ -585,7 +585,7 @@ void hq_core_dec_fx( return; } -#ifdef IVAS_FLOAT_FIXED + void ivas_hq_core_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure fx */ Word16 synth[], /* o : output synthesis */ @@ -1195,7 +1195,7 @@ void ivas_hq_core_dec_fx( } return; } -#endif + /*-------------------------------------------------------------------* * hq_core_dec_init() @@ -1203,7 +1203,7 @@ void ivas_hq_core_dec_fx( * Initialize HQ core state structure *-------------------------------------------------------------------*/ -void HQ_core_dec_init( +void HQ_core_dec_init_fx( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ) { @@ -1295,12 +1295,12 @@ void HQ_core_dec_init( } /*-------------------------------------------------------------------* - * HQ_nbfec_init() + * HQ_nbfec_init_fx() * * Initialize HQ NB FEC state structure *-------------------------------------------------------------------*/ -void HQ_nbfec_init( +void HQ_nbfec_init_fx( HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle */ ) { @@ -1346,3 +1346,5 @@ void HQ_nbfec_init( return; } + +#endif \ No newline at end of file diff --git a/lib_dec/hq_hr_dec.c b/lib_dec/hq_hr_dec.c index 4ecdfb91462b0734a935c23bc332cddacaf9bc8b..a814232b35ce6b9a2421f0db788036eee69c5e39 100644 --- a/lib_dec/hq_hr_dec.c +++ b/lib_dec/hq_hr_dec.c @@ -40,7 +40,7 @@ #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * hq_pred_hb_bws() * diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index 90b5d0f05e5462e98edfd254a87cb9c21fd5eb62..1a2e0266b592fa1e935656ad8e6f5e0cbbc18808 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -63,7 +63,7 @@ static void spt_shorten_domain_set_dec( Decoder_State *st, const int16_t p2a_fla * * HQ low rate decoding routine *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void hq_lr_dec( Decoder_State *st, /* i/o: decoder state structure */ float yout[], /* o : transform-domain output coefs. */ diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c index 390d99e1513a7b3f5cf9f287bfcf238403c8e360..621ea8546a00be298dffed20047e0497c2df9d46 100644 --- a/lib_dec/igf_dec.c +++ b/lib_dec/igf_dec.c @@ -303,7 +303,7 @@ static void IGF_setLinesToZero_flt( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * IGF_prep_flt() * @@ -1121,7 +1121,7 @@ int16_t IGFDecReadLevel_flt( return IGFAllZero; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * IGFDecApplyMono_flt() * @@ -1355,7 +1355,7 @@ void IGFDecApplyStereo_flt( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * IGFDecSetMode_flt() * @@ -1440,7 +1440,7 @@ void IGFDecUpdateInfo_flt( hIGFDec->flag_sparse = &hIGFDec->flag_sparseBuf[0]; hIGFDec->infoTCXNoise = &hIGFDec->infoTCXNoiseBuf[0]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[0]; hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[0]; #endif @@ -1469,7 +1469,7 @@ void IGFDecUpdateInfo_flt( } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * IGFDecReplicateTCX10State_flt() * @@ -1494,7 +1494,7 @@ void IGFDecReplicateTCX10State_flt( } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * IGFDecCopyLPCFlatSpectrum_flt() * @@ -1583,7 +1583,7 @@ void IGFDecRestoreTCX10SubFrameData_flt( hIGFDec->flatteningTrigger = hPrivateData->igf_flatteningTrigger_subframe[subFrameIdx]; hIGFDec->flag_sparse = &hIGFDec->flag_sparseBuf[subFrameIdx * ( N_MAX_TCX - IGF_START_MN ) / 2]; hIGFDec->infoTCXNoise = &hIGFDec->infoTCXNoiseBuf[subFrameIdx * ( IGF_START_MX ) / 2]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[subFrameIdx * ( N_MAX_TCX - IGF_START_MN ) / 2]; hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[subFrameIdx * IGF_START_MX / 2]; #endif @@ -1609,18 +1609,18 @@ void init_igf_dec_flt( ) { set_c( (int8_t *) ( hIGFDec->infoTCXNoiseBuf ), 0, IGF_START_MX ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hIGFDec->igfData.pSpecFlatBuf, 0, IGF_START_MX ); #endif hIGFDec->igfData.igfInfo.nfSeedBuf[0] = 9733; hIGFDec->igfData.igfInfo.nfSeedBuf[1] = 9733; hIGFDec->igfData.igfInfo.nfSeed = &hIGFDec->igfData.igfInfo.nfSeedBuf[0]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[0]; #endif hIGFDec->flag_sparse = &hIGFDec->flag_sparseBuf[0]; hIGFDec->infoTCXNoise = &hIGFDec->infoTCXNoiseBuf[0]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[0]; #endif return; diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 9a3aaa8e17880c284a4c433be7a7d74eac752b55..39092931258b8164ad5811662d771b7ce9829cbe 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -4050,7 +4050,7 @@ void IGFDecUpdateInfo_ivas_fx( hIGFDec->igfData.pSpecFlat = &hIGFDec->igfData.pSpecFlatBuf_fx[0]; /* TODO: remove float init */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[0]; hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[0]; #endif @@ -4238,7 +4238,7 @@ void IGFDecRestoreTCX10SubFrameData_fx( hIGFDec->igfData.pSpecFlat = &hIGFDec->igfData.pSpecFlatBuf_fx[subFrameIdx * IGF_START_MX / 2]; /* TODO: remove float init */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hIGFDec->virtualSpec_float = &hIGFDec->virtualSpecBuf[subFrameIdx * ( N_MAX_TCX - IGF_START_MN ) / 2]; hIGFDec->igfData.pSpecFlat_float = &hIGFDec->igfData.pSpecFlatBuf[subFrameIdx * IGF_START_MX / 2]; #endif diff --git a/lib_dec/igf_scf_dec_fx.c b/lib_dec/igf_scf_dec_fx.c index 23ac1c9588f3eb857d04b9d4f2b6a6e1c4f80f5f..2a4d4cad2834bc11d48868eb3d86b693791f3473 100644 --- a/lib_dec/igf_scf_dec_fx.c +++ b/lib_dec/igf_scf_dec_fx.c @@ -78,7 +78,7 @@ static Word16 arith_decode_bits_fx( { x = lshl(x, 1); /* decode one bit using the new raw AC function */ - bit = ari_decode_14bits_bit_ext(st, &hPrivateData->acState); + bit = ari_decode_14bits_bit_ext_fx(st, &hPrivateData->acState); if (bit != 0) { x = s_or(x, 1); @@ -101,7 +101,7 @@ static Word16 arith_decode_residual_fx( /* decode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ - val = ari_decode_14bits_s27_ext(st, &hPrivateData->acState, cumulativeFrequencyTable); + val = ari_decode_14bits_s27_ext_fx(st, &hPrivateData->acState, cumulativeFrequencyTable); /* meaning of the values of val: */ /* esc_{0} IGF_MIN_ENC_SEPARATE ... IGF_MAX_ENC_SEPARATE esc_{IGF_SYMBOLS_IN_TABLE - 1} */ @@ -193,7 +193,7 @@ static void decode_sfe_vector_fx( { /* (t == 0) && (f == 0) */ /* decode one of the IGF_SYMBOLS_IN_TABLE == 27 alphabet symbols using the new raw AC function */ - res = ari_decode_14bits_s27_ext(st, &hPrivateData->acState, (const UWord16*) hPrivateData->cf_se00); + res = ari_decode_14bits_s27_ext_fx(st, &hPrivateData->acState, (const UWord16*) hPrivateData->cf_se00); pred = arith_decode_bits_fx(hPrivateData, st, 2); /* LSBs as 2 bit raw */ x[f] = add(shl(res, 2), pred); @@ -314,7 +314,7 @@ void IGFSCFDecoderDecode( /* insert data */ hPublicData->bitsRead = st->next_bit_pos; move16(); - ari_start_decoding_14bits(st, &hPublicData->acState); /* start AC decoding */ + ari_start_decoding_14bits_fx(st, &hPublicData->acState); /* start AC decoding */ /* check if coder needs a reset and do it if necessary */ IF (indepFlag != 0) diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 4092bc41856f3970af99af2c20c6e298dbf408dd..4a171d0af9eadd2513bc5961c64c7f746426010b 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -375,7 +375,7 @@ ivas_error init_decoder( /* HQ core initialization */ #ifdef IVAS_FLOAT_FIXED - HQ_core_dec_init( st->hHQ_core ); + HQ_core_dec_init_fx( st->hHQ_core ); #endif HQ_core_dec_init_flt( st->hHQ_core ); @@ -488,7 +488,7 @@ ivas_error init_decoder( } /* AMR-WB IO init */ - amr_wb_dec_init_flt( st->hAmrwb_IO ); + amr_wb_dec_init( st->hAmrwb_IO ); /* AMR-WB IO HF synth init */ hf_synth_amr_wb_init( st->hAmrwb_IO ); @@ -807,7 +807,7 @@ void reset_preecho_dec( HQ_DEC_HANDLE hHQ_core /* i/o: HQ decoder handle */ ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hHQ_core->memfilt_lb = 0; hHQ_core->mean_prev_hb = 0; hHQ_core->smoothmem = 1; diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 4a4d9a3a7d355df6766bc0b167e148d4a11e3d02..a33df105ddf65c588509505f8a7044370bd1431b 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -13,7 +13,7 @@ #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" #endif - +#ifdef IVAS_FLOAT_FIXED #define IVAS_FLOAT_FIXED_TO_BE_REMOVED /*----------------------------------------------------------------------* @@ -418,7 +418,7 @@ ivas_error init_decoder_fx( } /* HQ core initialization */ - HQ_core_dec_init(st_fx->hHQ_core); + HQ_core_dec_init_fx(st_fx->hHQ_core); IF (EQ_16(st_fx->element_mode, EVS_MONO)) { @@ -427,7 +427,7 @@ ivas_error init_decoder_fx( { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ NB FEC\n")); } - HQ_nbfec_init(st_fx->hHQ_nbfec); + HQ_nbfec_init_fx(st_fx->hHQ_nbfec); } ELSE { @@ -601,7 +601,7 @@ ivas_error init_decoder_fx( } /* AMR-WB IO init */ - amr_wb_dec_init(st_fx->hAmrwb_IO); + amr_wb_dec_init_fx(st_fx->hAmrwb_IO); /* AMR-WB IO HF synth init */ hf_synth_amr_wb_init_fx(st_fx->hAmrwb_IO); @@ -831,7 +831,7 @@ ivas_error init_decoder_fx( } -#ifdef IVAS_FLOAT_FIXED + ivas_error init_decoder_ivas_fx( Decoder_State *st_fx, /* o: Decoder static variables structure */ const Word16 idchan, /* i : channel ID */ @@ -969,7 +969,7 @@ ivas_error init_decoder_ivas_fx( set16_fx(st_fx->old_exc_fx, 0, L_EXC_MEM_DEC); //++To be removed -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED mvr2r( GEWB_Ave, st_fx->lsf_old, M ); lsf2lsp( st_fx->lsf_old, st_fx->lsp_old, M, INT_FS_12k8 ); #endif//IVAS_FLOAT_FIXED @@ -985,7 +985,7 @@ ivas_error init_decoder_ivas_fx( st_fx->use_acelp_preq = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st_fx->stab_fac = 0.0f; st_fx->mem_deemph = 0.0f; set_f(st_fx->mem_syn1, 0, M); @@ -993,7 +993,7 @@ ivas_error init_decoder_ivas_fx( st_fx->stab_fac_smooth = 0.0f; set_f(st_fx->agc_mem2, 0, 2); set_f(st_fx->mem_syn3, 0, M); -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED //st_fx->stab_fac_smooth_lt = 0.0f; //st_fx->log_energy_diff_lt = 0.0f; @@ -1197,7 +1197,7 @@ ivas_error init_decoder_ivas_fx( return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for GSC\n")); } #ifdef ISM_DISABLE // To be removed when fixed version is available. -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if ( st_fx->ivas_format != ISM_FORMAT ) { GSC_dec_init_ivas(st_fx->hGSCDec); @@ -1222,7 +1222,7 @@ ivas_error init_decoder_ivas_fx( return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FEC WI\n")); } #ifdef ISM_DISABLE // To be removed when fixed version is available. -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if ( st_fx->ivas_format != ISM_FORMAT ) { set_f(st_fx->hWIDec->old_exc2, 0, L_EXC_MEM); @@ -1249,7 +1249,7 @@ ivas_error init_decoder_ivas_fx( return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for NB/formant postflter\n")); } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED Init_post_filter_ivas(st_fx->hPFstat); st_fx->psf_lp_noise = 0.0f; #endif @@ -1375,7 +1375,7 @@ ivas_error init_decoder_ivas_fx( #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. HQ_core_dec_init_flt(st_fx->hHQ_core); #endif - HQ_core_dec_init(st_fx->hHQ_core); + HQ_core_dec_init_fx(st_fx->hHQ_core); IF(EQ_16(st_fx->element_mode, EVS_MONO)) { @@ -1384,12 +1384,12 @@ ivas_error init_decoder_ivas_fx( { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ NB FEC\n")); } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. HQ_nbfec_init_flt(st_fx->hHQ_nbfec); #endif #endif - HQ_nbfec_init(st_fx->hHQ_nbfec); + HQ_nbfec_init_fx(st_fx->hHQ_nbfec); } ELSE { @@ -1511,7 +1511,7 @@ ivas_error init_decoder_ivas_fx( return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HR BWE\n")); } #ifdef ISM_DISABLE // To be removed when fixed version is available. -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if ( st_fx->ivas_format != ISM_FORMAT ) { hr_bwe_dec_init_flt(st_fx->hBWE_FD_HR); @@ -1540,14 +1540,14 @@ ivas_error init_decoder_ivas_fx( if ( st_fx->ivas_format != ISM_FORMAT ) { /* AMR-WB IO init */ - amr_wb_dec_init_flt(st_fx->hAmrwb_IO); + amr_wb_dec_init(st_fx->hAmrwb_IO); /* AMR-WB IO HF synth init */ hf_synth_amr_wb_init(st_fx->hAmrwb_IO); } #endif /* AMR-WB IO init */ - amr_wb_dec_init(st_fx->hAmrwb_IO); + amr_wb_dec_init_fx(st_fx->hAmrwb_IO); /* AMR-WB IO HF synth init */ hf_synth_amr_wb_init_fx(st_fx->hAmrwb_IO); @@ -1602,7 +1602,7 @@ ivas_error init_decoder_ivas_fx( { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for BPF\n")); } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED bass_psfilter_init(st_fx->hBPF); #endif bass_psfilter_init_fx(st_fx->hBPF); @@ -1715,7 +1715,7 @@ ivas_error init_decoder_ivas_fx( { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SC-VBR\n")); } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if ( st_fx->ivas_format != ISM_FORMAT ) { sc_vbr_dec_init_flt(st_fx->hSC_VBR); @@ -1786,7 +1786,7 @@ ivas_error init_decoder_ivas_fx( return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxDec\n")); } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f(st_fx->hTcxDec->FBTCXdelayBuf_float, 0.0f, 111); // st_fx->hTcxDec->old_synthFB = st_fx->hTcxDec->synth_history + NS2SA(st_fx->output_Fs, PH_ECU_MEM_NS); @@ -1993,7 +1993,7 @@ ivas_error init_decoder_ivas_fx( return error; } -#endif + /*----------------------------------------------------------------------* @@ -2023,12 +2023,12 @@ void reset_preecho_dec_fx( } /*----------------------------------------------------------------------* - * destroy_cldfb_decoder() + * destroy_cldfb_decoder_fx() * * Free memory which was allocated in init_decoder() *----------------------------------------------------------------------*/ -void destroy_cldfb_decoder( +void destroy_cldfb_decoder_fx( Decoder_State *st_fx /* o: Decoder static variables structure */ ) { @@ -2048,3 +2048,4 @@ void destroy_cldfb_decoder( return; } +#endif \ No newline at end of file diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 389a14d20a0695b44e0b7cb51411af16b011d8d7..809bc7ad48503ed39d3d2bf0694bc2fe782d457e 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -2179,7 +2179,7 @@ void ivas_binRenderer( return; } - +#ifdef IVAS_FLOAT_FIXED void ivas_binRenderer_fx( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ @@ -2303,4 +2303,6 @@ void ivas_binRenderer_fx( } pop_wmops(); return; -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 7d5a85cd5b0f2dcca7b8ef361f6a28853a0f00fa..a14984704fb27a4d329309fa5f2582ec97612ecf 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -1902,7 +1902,7 @@ ivas_error ivas_core_dec( } st->old_bwe_delay = tmps; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if ( st->hBWE_TD != NULL ) { //mvr2r( hb_synth[n], st->hBWE_TD->old_hb_synth, output_frame ); diff --git a/lib_dec/ivas_decision_matrix_dec.c b/lib_dec/ivas_decision_matrix_dec.c index 3e6b18cdcf409da1907b42350bd4c26a352483bc..9477675909409ba1225df795af51951b136c0d3a 100644 --- a/lib_dec/ivas_decision_matrix_dec.c +++ b/lib_dec/ivas_decision_matrix_dec.c @@ -53,7 +53,7 @@ static Word16 get_next_index_4_by_15[16] = 0, 2184, 4369, 6553, 8738, 10922, 13107, 15291, 17476, 19660, 21845, 24029, 26214, 28398, 30583, 32767 }; #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void ivas_decision_matrix_dec( Decoder_State *st, /* i/o: decoder state structure */ int16_t *sharpFlag, /* o : formant sharpening flag */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7ffcf246c3e82e961cb21359949209905071f58e..d683d65aa2a2a2cb36eb88a8521f40050ea5ef62 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -70,7 +70,7 @@ ivas_error ivas_dec_setup( Word16 *data /* o : output synthesis signal */ ) { -#if 1 /*TODO:To be removed later*/ +#ifdef IVAS_FLOAT_FIXED/*TODO:To be removed later*/ RENDER_CONFIG_DATA *hRendCfg = st_ivas->hRenderConfig; HRTFS_CREND_HANDLE hSetOfHRTF = st_ivas->hSetOfHRTF; IF( hSetOfHRTF ) @@ -740,7 +740,7 @@ ivas_error ivas_dec_setup( st->total_brate = ACELP_8k00; /* only temporary initialization - this is needed for get_next_indice() in the frame following NO_DATA frame */ } -#if 1 /*Cleanup changes: fixed to float*/ +#ifdef IVAS_FLOAT_FIXED/*Cleanup changes: fixed to float*/ IF( st_ivas->hCrendWrapper != NULL ) { st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); @@ -1145,7 +1145,7 @@ ivas_error ivas_init_decoder_front( * * Initialize IVAS decoder state structure *-------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED ivas_error ivas_init_decoder( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -1226,22 +1226,15 @@ ivas_error ivas_init_decoder( IF ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) { -#ifdef IVAS_FLOAT_FIXED ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); ivas_mcmasa_set_separate_channel_mode_fx( &( st_ivas->hOutSetup.separateChannelEnabled ), &( st_ivas->hOutSetup.separateChannelIndex ), ivas_total_brate ); -#else - ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); - - ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hOutSetup.separateChannelEnabled ), &( st_ivas->hOutSetup.separateChannelIndex ), ivas_total_brate ); -#endif } ivas_renderer_select( st_ivas ); IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { -#ifdef IVAS_FLOAT_FIXED FOR(int ind = 0; ind < MAX_OUTPUT_CHANNELS; ind++) { st_ivas->hLsSetupCustom->ls_azimuth_fx[ind] = (Word32)(st_ivas->hLsSetupCustom->ls_azimuth[ind] * (1 << 22)); @@ -1256,9 +1249,6 @@ ivas_error ivas_init_decoder( } ELSE -#else - IF ( ( error = ivas_ls_custom_output_init( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1268,11 +1258,7 @@ ivas_error ivas_init_decoder( IF ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) { -#ifdef IVAS_FLOAT_FIXED ivas_mcmasa_set_separate_channel_mode_fx( &( st_ivas->hIntSetup.separateChannelEnabled ), &( st_ivas->hIntSetup.separateChannelIndex ), ivas_total_brate ); -#else - ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hIntSetup.separateChannelEnabled ), &( st_ivas->hIntSetup.separateChannelIndex ), ivas_total_brate ); -#endif IF ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.separateChannelEnabled ) { @@ -1501,11 +1487,7 @@ ivas_error ivas_init_decoder( return error; } -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_masa_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) -#else - IF ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1725,11 +1707,7 @@ ivas_error ivas_init_decoder( } } -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_masa_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) -#else - IF ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1875,22 +1853,15 @@ ivas_error ivas_init_decoder( { Word32 brate_sce, brate_cpe; -#ifdef IVAS_FLOAT_FIXED ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); -#else - ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); -#endif IF ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { return error; } -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_masa_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) -#else - IF ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) -#endif + { return error; } @@ -1922,11 +1893,8 @@ ivas_error ivas_init_decoder( } } -#ifdef IVAS_FLOAT_FIXED + ivas_mcmasa_split_brate_fx( st_ivas->hOutSetup.separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); -#else - ivas_mcmasa_split_brate( st_ivas->hOutSetup.separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); -#endif FOR ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { @@ -1988,19 +1956,15 @@ ivas_error ivas_init_decoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); } -#ifdef IVAS_FLOAT_FIXED IF( ( st_ivas->mem_hp20_out_fx = (Word32 **) malloc( n * sizeof(Word32 * ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); } -#endif // IVAS_FLOAT_FIXED } ELSE { st_ivas->mem_hp20_out = NULL; -#ifdef IVAS_FLOAT_FIXED st_ivas->mem_hp20_out_fx = NULL; -#endif // IVAS_FLOAT_FIXED } FOR ( i = 0; i < n; i++ ) @@ -2011,15 +1975,12 @@ ivas_error ivas_init_decoder( } set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM ); -#ifdef IVAS_FLOAT_FIXED - IF((st_ivas->mem_hp20_out_fx[i] = (Word32 *)malloc((L_HP20_MEM + 2) * sizeof(Word32))) == NULL) { return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n")); } set32_fx(st_ivas->mem_hp20_out_fx[i], 0, L_HP20_MEM + 2); -#endif // IVAS_FLOAT_FIXED } /*-------------------------------------------------------------------* @@ -2067,34 +2028,21 @@ ivas_error ivas_init_decoder( } granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); -#ifdef IVAS_FLOAT_FIXED + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); -#else - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); -#endif // IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED + IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) -#else - IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) -#endif { return error; } } ELSE IF( st_ivas->renderer_type == RENDERER_MC ) { -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_ls_setup_conversion_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#else - IF( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } ELSE IF ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { @@ -2120,7 +2068,7 @@ ivas_error ivas_init_decoder( } #if 1 /*Cleanup changes: fixed to float*/ - IF( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) + IF(st_ivas->hCrendWrapper!=NULL && st_ivas->hCrendWrapper->hHrtfCrend != NULL ) { st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); st_ivas->hCrendWrapper->hHrtfCrend->latency_s = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->latency_s_fx, 31 ); @@ -2133,17 +2081,10 @@ ivas_error ivas_init_decoder( { granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); -#ifdef IVAS_FLOAT_FIXED n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); -#else - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); -#endif // IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED + IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ) != IVAS_ERR_OK ) -#else - IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2152,17 +2093,9 @@ ivas_error ivas_init_decoder( { granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); -#ifdef IVAS_FLOAT_FIXED n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); -#else - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); -#endif -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) -#else - IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2208,17 +2141,10 @@ ivas_error ivas_init_decoder( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_ism_renderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#else - IF ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } IF ( st_ivas->ivas_format == SBA_ISM_FORMAT ) @@ -2255,22 +2181,14 @@ ivas_error ivas_init_decoder( } } -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_create_lfe_dec_fx( &st_ivas->hLFE, output_Fs, binauralization_delay_ns ) ) != IVAS_ERR_OK ) -#else - IF( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, output_Fs, binauralization_delay_ns ) ) != IVAS_ERR_OK ) -#endif // IVAS_FLOAT_FIXED { return error; } set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); -#ifndef IVAS_FLOAT_FIXED - set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); -#else set32_fx( st_ivas->hLFE->prevsynth_buf_fx, 0, LFE_PLC_BUFLEN ); set32_fx( st_ivas->hLFE->prior_out_buffer_fx, 0, L_FRAME48k ); -#endif // IVAS_FLOAT_FIXED } @@ -2278,11 +2196,7 @@ ivas_error ivas_init_decoder( * CLDFB handles for rendering *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); -#else - ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); -#endif // IVAS_FLOAT_FIXED FOR ( i = 0; i < numCldfbAnalyses; i++ ) { @@ -2311,7 +2225,47 @@ ivas_error ivas_init_decoder( /* CLDFB Interpolation weights */ IF ( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) && !st_ivas->sba_dirac_stereo_flag && st_ivas->hDecoderConfig->nchan_out != 1 ) { +#ifdef IVAS_FLOAT_FIXED +#if 1 + Word16 Q_cldfbSynDec = Q11; + FOR( i = 0; i < 16; i++ ) + { + IF( st_ivas->cldfbAnaDec[i] ) + floatToFixed_arrL( st_ivas->cldfbAnaDec[i]->cldfb_state, st_ivas->cldfbAnaDec[i]->cldfb_state_fx, 11, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); + } + IF( st_ivas->hSpar ) + { + st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q = Q_factor_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, 16 ); + floatToFixed_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q, 16 ); + } + IF( st_ivas->cldfbSynDec[0] ) + { + floatToFixed_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q_cldfbSynDec, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ); + } +#endif + ivas_spar_get_cldfb_gains_fx( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); +#if 1 + FOR( i = 0; i < st_ivas->cldfbAnaDec[0]->cldfb_state_length; i++ ) + st_ivas->cldfbAnaDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbAnaDec[0]->cldfb_state_fx[i], 16 ); // Scaling down from 27 to 11 + FOR( i = 0; i < st_ivas->cldfbSynDec[0]->cldfb_state_length; i++ ) + st_ivas->cldfbSynDec[0]->cldfb_state_fx[i] = L_shr( st_ivas->cldfbSynDec[0]->cldfb_state_fx[i], 21 - Q_cldfbSynDec ); // Scaling down from 21 to Q_cldfbSynDec + FOR( i = 0; i < 16; i++ ) + { + IF( st_ivas->cldfbAnaDec[i] ) + fixedToFloat_arrL( st_ivas->cldfbAnaDec[i]->cldfb_state_fx, st_ivas->cldfbAnaDec[i]->cldfb_state, 11, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); + } + IF( st_ivas->cldfbSynDec[0] ) + { + fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); + } + IF( st_ivas->hSpar ) + { + fixedToFloat_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, st_ivas->hSpar->hFbMixer->cldfb_cross_fade, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q, 16 ); + } +#endif +#else ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); +#endif } /*-----------------------------------------------------------------* @@ -2331,17 +2285,9 @@ ivas_error ivas_init_decoder( { /* no module has yet open the TC buffer, open a default one */ -#ifdef IVAS_FLOAT_FIXED n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); -#else - n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); -#endif -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#else - IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2350,11 +2296,7 @@ ivas_error ivas_init_decoder( IF ( st_ivas->hTcBuffer == NULL ) { /* we need the handle anyway, but without the buffer*/ -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ) ) != IVAS_ERR_OK ) -#else - IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -2374,9 +2316,7 @@ ivas_error ivas_init_decoder( /*-----------------------------------------------------------------* * Allocate floating-point output audio buffers *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED st_ivas->p_out_len = ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); -#endif // IVAS_FLOAT_FIXED FOR ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) { @@ -2385,7 +2325,6 @@ ivas_error ivas_init_decoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); } -#ifdef IVAS_FLOAT_FIXED set_zero(st_ivas->p_output_f[n], 48000 / FRAMES_PER_SEC); IF ( ( st_ivas->p_output_fx[n] = (Word32 *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( Word32 ) ) ) == NULL ) { @@ -2393,21 +2332,1126 @@ ivas_error ivas_init_decoder( } set32_fx(st_ivas->p_output_fx[n], 0, 48000 / FRAMES_PER_SEC); -#endif + } FOR ( ; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { st_ivas->p_output_f[n] = NULL; -#ifdef IVAS_FLOAT_FIXED st_ivas->p_output_fx[n] = NULL; -#endif } return error; } +#else +ivas_error ivas_init_decoder( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + Word16 i, n, k; + Word16 sce_id, cpe_id; + Word16 numCldfbAnalyses, numCldfbSyntheses; + Word16 granularity, n_channels_transport_jbm; + Word32 output_Fs, ivas_total_brate; + Word32 binauralization_delay_ns; + AUDIO_CONFIG output_config; + DECODER_CONFIG_HANDLE hDecoderConfig; + ivas_error error; + Word32 ism_total_brate; + + error = IVAS_ERR_OK; + + output_Fs = st_ivas->hDecoderConfig->output_Fs; + hDecoderConfig = st_ivas->hDecoderConfig; + output_config = hDecoderConfig->output_config; + ivas_total_brate = hDecoderConfig->ivas_total_brate; + + hDecoderConfig->last_ivas_total_brate = ivas_total_brate; + st_ivas->last_active_ivas_total_brate = ivas_total_brate; + + /*-----------------------------------------------------------------* + * Set number of output channels for EXTERNAL output config. + *-----------------------------------------------------------------*/ + + IF ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + { + IF ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + hDecoderConfig->nchan_out = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 ); + hDecoderConfig->nchan_out += st_ivas->nchan_ism; + } + ELSE IF ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + hDecoderConfig->nchan_out = st_ivas->nchan_transport + st_ivas->nchan_ism; + } + ELSE IF ( !( st_ivas->ism_mode == ISM_MODE_PARAM ) ) + { + hDecoderConfig->nchan_out = st_ivas->nchan_transport; + } + + st_ivas->hOutSetup.nchan_out_woLFE = hDecoderConfig->nchan_out; + } + + /*-----------------------------------------------------------------* + * Set output and intern setup & renderer selection + *-----------------------------------------------------------------*/ + + st_ivas->intern_config = output_config; + + ivas_output_init( &( st_ivas->hOutSetup ), output_config ); + + IF ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { + st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; + st_ivas->intern_config = IVAS_AUDIO_CONFIG_7_1_4; + st_ivas->hOutSetup.output_config = st_ivas->intern_config; + st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( st_ivas->intern_config ); + } + + IF ( st_ivas->ivas_format == SBA_ISM_FORMAT && output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + { + st_ivas->hOutSetup.ambisonics_order = SBA_HOA3_ORDER; + st_ivas->intern_config = IVAS_AUDIO_CONFIG_HOA3; + st_ivas->hOutSetup.output_config = IVAS_AUDIO_CONFIG_HOA3; + st_ivas->hOutSetup.nchan_out_woLFE = audioCfg2channels( IVAS_AUDIO_CONFIG_HOA3 ); + } + + /* Only initialize transport setup if it is used */ + IF ( st_ivas->transport_config != IVAS_AUDIO_CONFIG_INVALID ) + { + ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); + } + + IF ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) + { + ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); + + ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hOutSetup.separateChannelEnabled ), &( st_ivas->hOutSetup.separateChannelIndex ), ivas_total_brate ); + } + + ivas_renderer_select( st_ivas ); + + IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + IF ( ( error = ivas_ls_custom_output_init( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); + + IF ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) + { + ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hIntSetup.separateChannelEnabled ), &( st_ivas->hIntSetup.separateChannelIndex ), ivas_total_brate ); + + IF ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.separateChannelEnabled ) + { + st_ivas->hLsSetupCustom->separate_ch_found = 0; + IF ( st_ivas->hOutSetup.nchan_out_woLFE >= MCMASA_MIN_SPEAKERS_SEPARATE_CENTER ) + { + /* check for a speaker at (0, 0) if minimum speaker count is available */ + FOR ( i = 0; i < st_ivas->hOutSetup.nchan_out_woLFE; i++ ) + { + IF ( st_ivas->hOutSetup.ls_azimuth[i] == 0.0f && st_ivas->hOutSetup.ls_elevation[i] == 0.0f ) + { + st_ivas->hIntSetup.separateChannelIndex = i; + st_ivas->hLsSetupCustom->separate_ch_found = 1; + BREAK; + } + } + } + } + } + + /*-----------------------------------------------------------------* + * Allocate and initialize SCE/CPE and other handles + *-----------------------------------------------------------------*/ + + IF ( st_ivas->ivas_format == MONO_FORMAT ) + { + st_ivas->nSCE = 1; /* in mono, there is always only one SCE */ + st_ivas->nCPE = 0; + st_ivas->nchan_transport = 1; + sce_id = 0; + + IF ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + ELSE IF ( st_ivas->ivas_format == STEREO_FORMAT ) + { + st_ivas->nchan_transport = CPE_CHANNELS; + st_ivas->intern_config = IVAS_AUDIO_CONFIG_STEREO; + + st_ivas->nSCE = 0; + st_ivas->nCPE = 1; /* in stereo, there is always only one CPE */ + cpe_id = 0; + + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < st_ivas->nchan_transport; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + + /* init EFAP for custom LS output and set hTransSetup */ + IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hOutSetup.ls_azimuth, st_ivas->hOutSetup.ls_elevation, st_ivas->hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_output_init( &( st_ivas->hTransSetup ), IVAS_AUDIO_CONFIG_STEREO ); + } + } + ELSE IF ( st_ivas->ivas_format == ISM_FORMAT ) + { + Word32 element_brate_tmp[MAX_NUM_OBJECTS]; + + st_ivas->nSCE = st_ivas->nchan_transport; /* "st_ivas->nchan_transport" is known from ivas_dec_setup */ + st_ivas->nCPE = 0; + st_ivas->ism_extmeta_active = -1; + st_ivas->ism_extmeta_cnt = 0; + + IF ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; + st_ivas->nSCE = MAX_PARAM_ISM_WAVE; + + IF ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nSCE, element_brate_tmp ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + IF ( ( error = create_sce_dec( st_ivas, sce_id, element_brate_tmp[sce_id] ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + + st_ivas->hSCE[sce_id]->hCoreCoder[0]->is_ism_format = 1; + } + + st_ivas->hISMDTX.sce_id_dtx = 0; + + IF ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2 = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed3; + } + else if ( st_ivas->ism_mode == ISM_MODE_DISC ) + { + for ( sce_id = 0; sce_id < st_ivas->nSCE; ++sce_id ) + { + st_ivas->hSCE[sce_id]->hCoreCoder[0]->hFdCngDec->hFdCngCom->seed2 = 2 + sce_id; + } + } + } + ELSE IF ( st_ivas->ivas_format == SBA_FORMAT ) + { + IF ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) + { + IF ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ),st_ivas->ivas_format ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO ) + { + IF ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; + } + ELSE + { + Word16 band_grouping[IVAS_MAX_NUM_BANDS + 1]; + + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + IF ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) + { + st_ivas->hSpar->enc_param_start_band = 0; + + set_c( (Word8 *) st_ivas->hQMetaData->twoDirBands, (Word8) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); + st_ivas->hQMetaData->numTwoDirBands = (UWord8) st_ivas->hQMetaData->q_direction[0].cfg.nbands; + } + + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (Word16) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); + } + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); + + FOR ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + IF ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + + FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + /* create CPE element for DFT Stereo like upmix */ + IF ( st_ivas->sba_dirac_stereo_flag && st_ivas->nCPE == 0 ) + { + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + 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; + } + + IF ( st_ivas->nCPE > 1 ) + { + IF ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* set CNA/CNG flags */ + ivas_sba_set_cna_cng_flag( st_ivas ); + } + ELSE IF ( st_ivas->ivas_format == MASA_FORMAT ) + { + /* if we start in ISM_MODE_NONE in MASA_ISM, that appears as normal MASA, but we may change to a mode with ISMs */ + st_ivas->ism_extmeta_active = -1; + st_ivas->ism_extmeta_cnt = 0; + IF ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + IF ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + FOR ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + IF ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + + FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + /* set CNA/CNG flags */ + ivas_sba_set_cna_cng_flag( st_ivas ); + } + ELSE IF ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + Word32 temp_brate[MAX_SCE]; + st_ivas->ism_extmeta_active = -1; + st_ivas->ism_extmeta_cnt = 0; + + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); + + IF ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) + { + IF ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ), st_ivas->ivas_format ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_MONO ) + { + IF ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; + } + ELSE + { + Word16 band_grouping[IVAS_MAX_NUM_BANDS + 1]; + + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + IF ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) + { + st_ivas->hSpar->enc_param_start_band = 0; + + set_c( (Word8 *) st_ivas->hQMetaData->twoDirBands, (Word8) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); + st_ivas->hQMetaData->numTwoDirBands = (UWord8) st_ivas->hQMetaData->q_direction[0].cfg.nbands; + } + + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (Word16) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); + } + + FOR ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + IF ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + + IF ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + st_ivas->nCPE += ( st_ivas->nchan_ism + 1 ) >> 1; + st_ivas->element_mode_init = IVAS_CPE_MDCT; + } + + FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + /* create CPE element for DFT Stereo like upmix */ + IF ( st_ivas->sba_dirac_stereo_flag && st_ivas->nCPE == 0 ) + { + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + 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; + } + + IF ( st_ivas->nCPE > 1 ) + { + IF ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + IF ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, temp_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( ( error = ivas_osba_data_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* set CNA/CNG flags */ + ivas_sba_set_cna_cng_flag( st_ivas ); + } + ELSE IF ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + st_ivas->ism_extmeta_active = -1; + st_ivas->ism_extmeta_cnt = 0; + + IF ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + k = 0; + ism_total_brate = 0; + WHILE ( LT_16(k, SIZE_IVAS_BRATE_TBL) && NE_32(ivas_total_brate, ivas_brate_tbl[k] )) + { + k++; + } + + IF ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) + { + /* one separated object */ + st_ivas->nSCE = 1; + + ism_total_brate = sep_object_brate[k - 2][0]; + IF ( ( error = create_sce_dec( st_ivas, 0, ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[0]->hCoreCoder[0] ); + + IF ( ( error = ivas_ism_metadata_dec_create( st_ivas, 1, NULL ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE IF ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + Word32 temp_brate[MAX_SCE]; + st_ivas->nSCE = st_ivas->nchan_ism; /* number of objects */ + + FOR ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + temp_brate[sce_id] = sep_object_brate[k - 2][st_ivas->nSCE - 1]; + ism_total_brate += temp_brate[sce_id]; + + IF ( ( error = create_sce_dec( st_ivas, sce_id, temp_brate[sce_id] ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + + IF ( ( error = ivas_ism_metadata_dec_create( st_ivas, st_ivas->nchan_ism, temp_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( ( error = ivas_omasa_data_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + IF ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[0]->hCoreCoder[n] ); + } + } + ELSE IF ( st_ivas->ivas_format == MC_FORMAT ) + { + IF ( st_ivas->mc_mode == MC_MODE_MCT ) + { + /* init EFAP for custom LS setup */ + IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); + st_ivas->nSCE = 0; + st_ivas->nCPE = st_ivas->nchan_transport / CPE_CHANNELS; + + st_ivas->element_mode_init = IVAS_CPE_MDCT; + + FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) * CPE_CHANNELS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + IF ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE IF ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + /* init EFAP for custom LS setup */ + IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + st_ivas->nSCE = 0; + st_ivas->nCPE = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS / CPE_CHANNELS; + st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; + + IF ( ( error = ivas_mc_paramupmix_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->element_mode_init = IVAS_CPE_MDCT; + + FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / ( st_ivas->nchan_transport - 1 ) * CPE_CHANNELS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + IF ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE IF ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + /* init EFAP for custom LS setup */ + IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hLsSetupCustom->ls_azimuth, st_ivas->hLsSetupCustom->ls_elevation, st_ivas->hLsSetupCustom->num_spk, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = ivas_param_mc_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + IF ( GT_16(st_ivas->nCPE, 1 )) + { + IF ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + ELSE IF ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { + Word32 brate_sce, brate_cpe; + + ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); + + IF ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( ( error = ivas_masa_dec_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); + + IF ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_MCMASA_MONO_STEREO ) + { + IF ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.separateChannelEnabled && !st_ivas->hLsSetupCustom->separate_ch_found ) + { + /* If no speaker matching the separated channel, compute panning gains for the separated channel. */ + IF ( st_ivas->hVBAPdata == NULL ) + { + /* Distribute signal to all channels if VBAP is not properly initialized. */ + set_f( st_ivas->hLsSetupCustom->separate_ch_gains, inv_sqrt( st_ivas->hLsSetupCustom->num_spk ), st_ivas->hLsSetupCustom->num_spk ); + } + ELSE + { + vbap_determine_gains( st_ivas->hVBAPdata, st_ivas->hLsSetupCustom->separate_ch_gains, 0, 0, 0 ); + } + } + + ivas_mcmasa_split_brate( st_ivas->hOutSetup.separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); + + FOR ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) + { + IF ( ( error = create_sce_dec( st_ivas, sce_id, brate_sce ) ) != IVAS_ERR_OK ) + { + return error; + } + + reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + } + + FOR ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) + { + st_ivas->element_mode_init = IVAS_CPE_MDCT; /* element_mode_init was IVAS_SCE for SCE initialization */ + + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, brate_cpe ) ) != IVAS_ERR_OK ) + { + return error; + } + + FOR ( n = 0; n < CPE_CHANNELS; n++ ) + { + reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); + } + } + + /* create CPE element for DFT Stereo like upmix */ + IF ( st_ivas->sba_dirac_stereo_flag ) + { + IF ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + { + return error; + } + + 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; + } + + /* set CNA/CNG flags */ + IF ( EQ_16(st_ivas->nchan_transport, 1) && ( ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) + { + st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; + st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; + } + } + } + + + /*-----------------------------------------------------------------* + * Allocate and initialize HP20 filter memories + *-----------------------------------------------------------------*/ + + /* set number of output channels used for synthesis/decoding */ + n = getNumChanSynthesis( st_ivas ); + + IF ( GT_16(n, 0 )) + { + IF ( ( st_ivas->mem_hp20_out = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + } + ELSE + { + st_ivas->mem_hp20_out = NULL; + } + + FOR ( i = 0; i < n; i++ ) + { + IF ( ( st_ivas->mem_hp20_out[i] = (float *) malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + + set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM ); + } + + /*-------------------------------------------------------------------* + * Allocate and initialize rendering handles + *--------------------------------------------------------------------*/ + + IF ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + + IF ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + /* ParamISM is handled separately from other common config */ + ELSE IF ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) + { + IF ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) + { + IF ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE IF ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + IF ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + IF ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + IF ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL, st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + + IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE IF ( st_ivas->renderer_type == RENDERER_MC ) + { + IF ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE IF ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) + { + IF ( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE IF ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + IF ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->ivas_format == MC_FORMAT && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) + { + IF ( ( error = efap_init_data( &( st_ivas->hEFAPdata ), st_ivas->hIntSetup.ls_azimuth, st_ivas->hIntSetup.ls_elevation, st_ivas->hIntSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, + st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; + + IF ( ( st_ivas->ivas_format == MC_FORMAT ) && ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) + { + granularity = NS2SA( output_Fs, CLDFB_SLOT_NS ); + + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + + IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, MC_PARAMUPMIX_MAX_INPUT_CHANS, MC_PARAMUPMIX_MAX_INPUT_CHANS, granularity ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); + + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + + IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + IF ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + IF ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + /* Allocate TD renderer for the objects in DISC mode */ + IF ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + IF ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( st_ivas->renderer_type == RENDERER_DIRAC && ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) + { + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + IF ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + IF ( ( st_ivas->ivas_format == ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) && + ( st_ivas->ism_mode == ISM_MODE_DISC || st_ivas->ism_mode == ISM_SBA_MODE_DISC ) && + ( st_ivas->renderer_type == RENDERER_TD_PANNING || + st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX || + st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || + st_ivas->renderer_type == RENDERER_OSBA_STEREO || + st_ivas->renderer_type == RENDERER_OSBA_AMBI || + st_ivas->renderer_type == RENDERER_OSBA_LS || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || + st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) + { + IF ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + IF ( ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + /* Allocate TD renderer for the objects in DISC mode */ + IF ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + /*-----------------------------------------------------------------* + * LFE handles for rendering after rendering to adjust LFE delay to binaural filter delay + *-----------------------------------------------------------------*/ + + IF ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + binauralization_delay_ns = st_ivas->binaural_latency_ns; + IF ( st_ivas->hBinRenderer != NULL ) + { + IF ( st_ivas->hBinRenderer->render_lfe ) + { + { + /* Account for filterbank delay */ + binauralization_delay_ns += IVAS_FB_DEC_DELAY_NS; + } + } + ELSE + { + binauralization_delay_ns = 0; + } + } + + IF ( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, output_Fs, binauralization_delay_ns ) ) != IVAS_ERR_OK ) + { + return error; + } + + set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); + set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); + } + + /*-----------------------------------------------------------------* + * CLDFB handles for rendering + *-----------------------------------------------------------------*/ + + ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); + + FOR ( i = 0; i < numCldfbAnalyses; i++ ) + { + IF ( ( error = openCldfb_ivas( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + FOR ( ; i < MAX_INTERN_CHANNELS; i++ ) + { + st_ivas->cldfbAnaDec[i] = NULL; + } + + FOR ( i = 0; i < numCldfbSyntheses; i++ ) + { + IF ( ( error = openCldfb_ivas( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + { + return error; + } + } + FOR ( ; i < MAX_OUTPUT_CHANNELS; i++ ) + { + st_ivas->cldfbSynDec[i] = NULL; + } + + /* CLDFB Interpolation weights */ + IF ( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) && !st_ivas->sba_dirac_stereo_flag && st_ivas->hDecoderConfig->nchan_out != 1 ) + { + ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); + } + + /*-----------------------------------------------------------------* + * Allocate and initialize limiter struct + *-----------------------------------------------------------------*/ + + IF ( ( error = ivas_limiter_open( &st_ivas->hLimiter, hDecoderConfig->nchan_out, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + + /*-----------------------------------------------------------------* + * Allocate and initialize JBM struct + buffer + *-----------------------------------------------------------------*/ + + IF ( st_ivas->hTcBuffer == NULL ) + + { + /* no module has yet open the TC buffer, open a default one */ + n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels( st_ivas ); + + IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( st_ivas->hTcBuffer == NULL ) + { + /* we need the handle anyway, but without the buffer*/ + IF ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ) ) != IVAS_ERR_OK ) + { + return error; + } + } + + IF ( st_ivas->hJbmMetadata == NULL ) + { + IF ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + { + IF ( ( error = ivas_jbm_dec_metadata_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + + /*-----------------------------------------------------------------* + * Allocate floating-point output audio buffers + *-----------------------------------------------------------------*/ + + FOR ( n = 0; n < ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); n++ ) + { + /* note: these are intra-frame heap memories */ + IF ( ( st_ivas->p_output_f[n] = (float *) malloc( ( 48000 / FRAMES_PER_SEC ) * sizeof( float ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point output audio buffer!\n" ) ); + } + } + + FOR ( ; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) + { + st_ivas->p_output_f[n] = NULL; + } + + + return error; +} +#endif /*------------------------------------------------------------------------- * destroy_core_dec() diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 1c9b6c021e8e8462cab9877140428b8ab4c9d377..94f4718d80619e1617fe2769114c8acdfecc4297 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -376,7 +376,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx( return error; } #endif - +#ifdef IVAS_FLOAT_FIXED static ivas_error ivas_ism_bitrate_switching_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ @@ -405,23 +405,11 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* temporarily set the ism mode back to the old one, otherwise this can give wrong results*/ ism_mode = st_ivas->ism_mode; st_ivas->ism_mode = last_ism_mode; -#ifdef IVAS_FLOAT_FIXED ivas_init_dec_get_num_cldfb_instances_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); -#else - ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); -#endif // IVAS_FLOAT_FIXED st_ivas->ism_mode = ism_mode; -#ifdef IVAS_FLOAT_FIXED nchan_out_buff_old = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); -#else - nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); -#endif // IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED if ( ( error = ivas_ism_config_fx( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -432,27 +420,18 @@ static ivas_error ivas_ism_bitrate_switching_dec( * Allocate, initialize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_corecoder_dec_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_corecoder_dec_reconfig( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, ( st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * HP20 memories *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED if ( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) { return error; } -#endif // IVAS_FLOAT_FIXED if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) { @@ -492,15 +471,11 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv render what still fits in the new granularity */ -#ifdef IVAS_FLOAT_FIXED tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); -#else - tc_granularity_new = ivas_jbm_dec_get_render_granularity_flt( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs ); -#endif if ( tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity ) { -#ifdef IVAS_FLOAT_FIXED + #if 1 /*Float to fixed conversion*/ DECODER_TC_BUFFER_HANDLE hTcBuffer; hTcBuffer = st_ivas->hTcBuffer; @@ -660,12 +635,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( } } #endif -#else - if ( ( error = ivas_jbm_dec_flush_renderer( st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED + } /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity ) @@ -701,7 +671,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* Open the TD Binaural renderer */ if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL ) { -#ifdef IVAS_FLOAT_FIXED #if 1 /*Cleanup changes: float to fixed */ Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src; @@ -773,12 +742,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( SrcSpatial_p->DirAtten.ConeOuterGain = fix_to_float( SrcSpatial_p->DirAtten.ConeOuterGain_fx, Q30 ); } #endif -#else - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED + if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( ( error = ivas_reverb_open( &st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL,st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) @@ -793,17 +757,10 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* close the ISM renderer and reinitialize */ ivas_ism_renderer_close( &st_ivas->hIsmRendererData ); -#ifdef IVAS_FLOAT_FIXED IF ( ( error = ivas_ism_renderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_ism_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) @@ -833,7 +790,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef IVAS_FLOAT_FIXED /* open the parametric binaural renderer */ if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { @@ -852,13 +808,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( fixedToFloat_arrL(st_ivas->hHrtfParambin->parametricReverberationEneCorrections_fx, st_ivas->hHrtfParambin->parametricReverberationEneCorrections, 31, CLDFB_NO_CHANNELS_MAX ); fixedToFloat_arrL(st_ivas->hHrtfParambin->parametricEarlyPartEneCorrection_fx, st_ivas->hHrtfParambin->parametricEarlyPartEneCorrection, 28, CLDFB_NO_CHANNELS_MAX ); #endif -#else - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - -#endif // IVAS_FLOAT_FIXED IF ( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; @@ -867,11 +816,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( /* Close the TD Binaural renderer */ if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { -#ifdef IVAS_FLOAT_FIXED ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); -#else - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); -#endif // IVAS_FLOAT_FIXED st_ivas->hHrtfTD = NULL; if ( st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) @@ -908,7 +853,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( * CLDFB instances *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED #if 1 /*Cleanup changes: float to fixed*/ Word16 i, Q_cldfbSynDec = 21; FOR( i = 0; i < 16; i++ ) @@ -942,12 +886,6 @@ static ivas_error ivas_ism_bitrate_switching_dec( fixedToFloat_arrL( st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); } #endif -#else - if ( ( error = ivas_cldfb_dec_reconfig( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FOAT_FIXED /*-----------------------------------------------------------------* * floating-point output audio buffers @@ -956,12 +894,10 @@ static ivas_error ivas_ism_bitrate_switching_dec( { nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); -#ifdef IVAS_FLOAT_FIXED IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) { return error; } -#endif // IVAS_FLOAT_FIXED if ( ( error = ivas_output_buff_dec( st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) { return error; @@ -1016,7 +952,309 @@ static ivas_error ivas_ism_bitrate_switching_dec( return error; } +#else +static ivas_error ivas_ism_bitrate_switching_dec( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t nchan_transport_old, /* i : last number of transport channels */ + const ISM_MODE last_ism_mode, /* i : last ISM mode */ + uint16_t *nSamplesRendered, /* o : number of samples rendered */ + int16_t *data /* o : output synthesis signal */ +) +{ + ivas_error error; + int32_t element_brate_tmp[MAX_NUM_OBJECTS]; + int16_t nSCE_old, nCPE_old; + int16_t numCldfbAnalyses_old, numCldfbSyntheses_old, ism_mode; + TC_BUFFER_MODE tc_buffer_mode_new; + int16_t tc_nchan_tc_new; + int16_t tc_nchan_allocate_new; + int16_t tc_granularity_new; + int16_t nchan_out_buff, nchan_out_buff_old; + AUDIO_CONFIG intern_config_old; + IVAS_OUTPUT_SETUP hIntSetupOld; + RENDERER_TYPE renderer_type_old; + + error = IVAS_ERR_OK; + nCPE_old = st_ivas->nCPE; + nSCE_old = st_ivas->nSCE; + + /* temporarily set the ism mode back to the old one, otherwise this can give wrong results*/ + ism_mode = st_ivas->ism_mode; + st_ivas->ism_mode = last_ism_mode; + ivas_init_dec_get_num_cldfb_instances(st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old); + st_ivas->ism_mode = ism_mode; + nchan_out_buff_old = ivas_get_nchan_buffers_dec(st_ivas, -1, -1); + + if ((error = ivas_ism_config(st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0)) != IVAS_ERR_OK) + { + return error; + } + + st_ivas->nSCE = st_ivas->nchan_transport; + + /*-----------------------------------------------------------------* + * Allocate, initialize, and configure SCE/CPE/MCT handles + *-----------------------------------------------------------------*/ + + if ((error = ivas_corecoder_dec_reconfig(st_ivas, nSCE_old, nCPE_old, nchan_transport_old, 0, st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport, (st_ivas->hDecoderConfig->ivas_total_brate / st_ivas->nchan_transport) * CPE_CHANNELS)) != IVAS_ERR_OK) + { + return error; + } + + /*-----------------------------------------------------------------* + * HP20 memories + *-----------------------------------------------------------------*/ + + if ((error = ivas_hp20_dec_reconfig(st_ivas, nchan_transport_old)) != IVAS_ERR_OK) + { + return error; + } + + /* save old IntSetup, might be needed for JBM flushing...*/ + intern_config_old = st_ivas->intern_config; + hIntSetupOld = st_ivas->hIntSetup; + tc_granularity_new = 1; + renderer_type_old = st_ivas->renderer_type; + + /*-----------------------------------------------------------------* + * Initialize the needed renderer struct and destroy the unnecessary renderer struct + *-----------------------------------------------------------------*/ + + /* select the renderer */ + ivas_renderer_select(st_ivas); + ivas_output_init(&(st_ivas->hIntSetup), st_ivas->intern_config); + + if ((st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC) && (st_ivas->ism_mode == ISM_MODE_DISC)) + { + ivas_output_init(&(st_ivas->hIntSetup), st_ivas->hDecoderConfig->output_config); + } + + { + /* transfer subframe info from DirAC or ParamMC to central tc buffer */ + if (last_ism_mode == ISM_MODE_PARAM && st_ivas->hSpatParamRendCom != NULL && (st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE)) + { + st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; + st_ivas->hTcBuffer->subframes_rendered = st_ivas->hSpatParamRendCom->subframes_rendered; + st_ivas->hTcBuffer->num_slots = st_ivas->hSpatParamRendCom->num_slots; + st_ivas->hTcBuffer->slots_rendered = st_ivas->hSpatParamRendCom->slots_rendered; + mvs2s(st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS); + } + + /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv + render what still fits in the new granularity */ + tc_granularity_new = ivas_jbm_dec_get_render_granularity_flt(st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs); + + if (tc_granularity_new < st_ivas->hTcBuffer->n_samples_granularity) + { + if ((error = ivas_jbm_dec_flush_renderer(st_ivas, tc_granularity_new, renderer_type_old, intern_config_old, &hIntSetupOld, MC_MODE_NONE, last_ism_mode, nSamplesRendered, data)) != IVAS_ERR_OK) + { + return error; + } + } + /* JBM: when granularity goes up set samples to discard at the beginning of the frame */ + else if (tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity) + { + if ((error = ivas_jbm_dec_set_discard_samples(st_ivas)) != IVAS_ERR_OK) + { + return error; + } + } + } + + if (st_ivas->ism_mode != last_ism_mode) + { + /* EFAP handle */ + efap_free_data(&st_ivas->hEFAPdata); + } + + /*-----------------------------------------------------------------* + * Switching between ParamISM and DiscISM + *-----------------------------------------------------------------*/ + + /* switching from ParamISM to DiscISM */ + if (st_ivas->ism_mode == ISM_MODE_DISC && last_ism_mode == ISM_MODE_PARAM) + { + /* Deallocate the ParamISM struct */ + ivas_param_ism_dec_close(&(st_ivas->hParamIsmDec), &(st_ivas->hSpatParamRendCom), st_ivas->hDecoderConfig->output_config); + + if (st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB + ) + { + /* close the parametric binaural renderer */ + ivas_dirac_dec_close_binaural_data(&st_ivas->hDiracDecBin); + /* Open the TD Binaural renderer */ + if (st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL) + { + if ((error = ivas_td_binaural_open(st_ivas)) != IVAS_ERR_OK) + { + return error; + } + if (st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) + { + if ((error = ivas_reverb_open(&st_ivas->hReverb, st_ivas->hDecoderConfig->output_config, NULL, st_ivas->hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs)) != IVAS_ERR_OK) + { + return error; + } + } + } + } + else + { + /* close the ISM renderer and reinitialize */ + ivas_ism_renderer_close(&st_ivas->hIsmRendererData); + + if ((error = ivas_ism_renderer_open(st_ivas)) != IVAS_ERR_OK) + { + return error; + } + } + + if (st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) + { + /* close the parametric binaural renderer */ + ivas_dirac_dec_close_binaural_data(&st_ivas->hDiracDecBin); + + /* Open Crend Binaural renderer */ + if ((error = ivas_rend_openCrend(&(st_ivas->hCrendWrapper), st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs)) != IVAS_ERR_OK) + { + return error; + } + + st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; + } + } + + /* switching from Discrete ISM to ParamISM */ + if (st_ivas->ism_mode == ISM_MODE_PARAM && last_ism_mode == ISM_MODE_DISC) + { + /* Allocate and initialize the ParamISM struct */ + if ((error = ivas_param_ism_dec_open(st_ivas)) != IVAS_ERR_OK) + { + return error; + } + + if (st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB + ) + { + /* open the parametric binaural renderer */ + if ((error = ivas_dirac_dec_binaural_copy_hrtfs(&st_ivas->hHrtfParambin)) != IVAS_ERR_OK) + { + return error; + } + + if ((error = ivas_dirac_dec_init_binaural_data(st_ivas, st_ivas->hHrtfParambin)) != IVAS_ERR_OK) + { + return error; + } + + /* Close the TD Binaural renderer */ + if (st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE) + { + ivas_td_binaural_close(&st_ivas->hBinRendererTd); + st_ivas->hHrtfTD = NULL; + + if (st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB) + { + ivas_reverb_close(&st_ivas->hReverb); + } + } + } + else + { + /* Close the ISM renderer */ + ivas_ism_renderer_close(&st_ivas->hIsmRendererData); + } + + if (st_ivas->hOutSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) + { + /* open the parametric binaural renderer */ + if ((error = ivas_dirac_dec_binaural_copy_hrtfs(&st_ivas->hHrtfParambin)) != IVAS_ERR_OK) + { + return error; + } + + if ((error = ivas_dirac_dec_init_binaural_data(st_ivas, st_ivas->hHrtfParambin)) != IVAS_ERR_OK) + { + return error; + } + + /* close the crend binaural renderer */ + ivas_rend_closeCrend(&(st_ivas->hCrendWrapper)); + } + } + + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + + if ((error = ivas_cldfb_dec_reconfig(st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old)) != IVAS_ERR_OK) + { + return error; + } + + /*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ + + { + nchan_out_buff = ivas_get_nchan_buffers_dec(st_ivas, -1, -1); + + if ((error = ivas_output_buff_dec(st_ivas->p_output_f, nchan_out_buff_old, nchan_out_buff)) != IVAS_ERR_OK) + { + return error; + } + } + + /*-----------------------------------------------------------------* + * JBM TC buffers + *-----------------------------------------------------------------*/ + { + int16_t tc_nchan_full_new; + DECODER_TC_BUFFER_HANDLE hTcBuffer; + + hTcBuffer = st_ivas->hTcBuffer; + tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode(st_ivas); + tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels(st_ivas); + tc_nchan_allocate_new = tc_nchan_tc_new; + tc_nchan_full_new = tc_nchan_tc_new; + + if (st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC) + { + tc_nchan_allocate_new = 2 * BINAURAL_CHANNELS; + tc_nchan_full_new = tc_nchan_allocate_new; + } + + if (st_ivas->ism_mode == ISM_MODE_PARAM && (st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM)) + { + tc_nchan_full_new = 0; + } + + /* reconfigure buffer */ + if (hTcBuffer->tc_buffer_mode != tc_buffer_mode_new || hTcBuffer->nchan_transport_jbm != tc_nchan_tc_new || + hTcBuffer->nchan_buffer_full != tc_nchan_full_new || hTcBuffer->nchan_transport_internal != tc_nchan_allocate_new) + { + if ((error = ivas_jbm_dec_tc_buffer_reconfigure(st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new)) != IVAS_ERR_OK) + { + return error; + } + } + + /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ + if (st_ivas->hSpatParamRendCom != NULL) + { + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + + mvs2s(st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS); + } + } + + return error; +} +#endif /*------------------------------------------------------------------------- * ivas_ism_dec_config() diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 319ddf6eef6d7bf95e36f29d46dae038d45d8f79..f983c974f82d042be7093753a78a533f508e0afb 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -1792,7 +1792,7 @@ static int16_t decode_radius( return idx_radius; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_dec() * diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 7b18f4fc8911df416621fb93b4671881569d95b0..9a8c961bdd2bf8c008f4c484e0467f9de2cc4982 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -3827,7 +3827,7 @@ ivas_error ivas_jbm_dec_tc( /* HP filtering */ for ( n = 0; n < min( nchan_out, st_ivas->nchan_transport ); n++ ) { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + hp20_flt( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hDecoderConfig->nchan_out == 1 ) @@ -3877,7 +3877,7 @@ ivas_error ivas_jbm_dec_tc( } /* HP filtering */ - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + hp20_flt( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) @@ -3975,7 +3975,7 @@ ivas_error ivas_jbm_dec_tc( /* HP filtering */ for ( n = 0; n < nchan_remapped; n++ ) { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + hp20_flt( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } if ( st_ivas->ivas_format == SBA_FORMAT ) @@ -4063,7 +4063,7 @@ ivas_error ivas_jbm_dec_tc( /* HP filtering */ for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + hp20_flt( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) @@ -4155,7 +4155,7 @@ ivas_error ivas_jbm_dec_tc( /* HP filtering */ for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + hp20_flt( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } nchan_remapped = ivas_sba_remapTCs( &p_output[sba_ch_idx], st_ivas, output_frame ); @@ -4206,7 +4206,7 @@ ivas_error ivas_jbm_dec_tc( { if ( n != LFE_CHANNEL ) { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + hp20_flt( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } } @@ -4247,7 +4247,7 @@ ivas_error ivas_jbm_dec_tc( { if ( n != LFE_CHANNEL ) { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + hp20_flt( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } } @@ -4289,7 +4289,7 @@ ivas_error ivas_jbm_dec_tc( /* HP filtering */ for ( n = 0; n < st_ivas->nchan_transport; n++ ) { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + hp20_flt( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } /* Rendering */ @@ -4338,7 +4338,7 @@ ivas_error ivas_jbm_dec_tc( else if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) { /* Delay the separated channel to sync with the DirAC rendering */ - delay_signal( p_output[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); + delay_signal_float( p_output[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); } } else @@ -4367,7 +4367,7 @@ ivas_error ivas_jbm_dec_tc( /* HP filtering */ for ( n = 0; n < getNumChanSynthesis( st_ivas ); n++ ) { - hp20( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); + hp20_flt( p_output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); } if ( st_ivas->renderer_type == RENDERER_MCMASA_MONO_STEREO ) @@ -4425,7 +4425,7 @@ ivas_error ivas_jbm_dec_tc( * * Feed decoded transport channels and metadata to the IVAS JBM renderer routine *--------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void ivas_jbm_dec_feed_tc_to_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ @@ -4474,7 +4474,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( { if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { -#ifdef IVAS_FLOAT_FIXED ivas_dirac_dec_set_md_map_fx( st_ivas, n_render_timeslots ); #if 1 /*Float to fix */ PARAM_ISM_DEC_HANDLE hParamIsmDec; @@ -4528,10 +4527,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( hSpatParamRendCom->energy_ratio2[sf_idx][bin_idx] = fixedToFloat( hSpatParamRendCom->energy_ratio2_fx[sf_idx][bin_idx], 15 ); } } -#endif -#else - ivas_dirac_dec_set_md_map( st_ivas, n_render_timeslots ); - ivas_param_ism_params_to_masa_param_mapping( st_ivas ); #endif } else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) @@ -4541,17 +4536,11 @@ void ivas_jbm_dec_feed_tc_to_renderer( } else /* ISM_MODE_DISC */ { - -#ifdef IVAS_FLOAT_FIXED ivas_ism_dec_digest_tc_fx( st_ivas ); -#else - ivas_ism_dec_digest_tc( st_ivas ); -#endif } } else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) { -#ifdef IVAS_FLOAT_FIXED #if 1 Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; @@ -4773,20 +4762,14 @@ void ivas_jbm_dec_feed_tc_to_renderer( fixedToFloat_arrL(st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize); } #endif -#else - ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); -#endif + } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { -#ifdef IVAS_FLOAT_FIXED ivas_ism_dec_digest_tc_fx( st_ivas ); -#else - ivas_ism_dec_digest_tc( st_ivas ); -#endif /* delay the objects here for all renderers where it is needed */ if ( @@ -4808,7 +4791,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( { n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); } -#ifdef IVAS_FLOAT_FIXED + #if 1 Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; @@ -5029,15 +5012,12 @@ void ivas_jbm_dec_feed_tc_to_renderer( fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); } #endif -#else - ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); -#endif + } } else { ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); -#ifdef IVAS_FLOAT_FIXED #if 1 Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; @@ -5257,9 +5237,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( //fixedToFloat_arrL( st->hFdCngDec->hFdCngCom->exc_cng_32fx, st->hFdCngDec->hFdCngCom->exc_cng_flt, 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); } -#endif -#else - ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #endif } } @@ -5269,7 +5246,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( { n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); } -#ifdef IVAS_FLOAT_FIXED #if 1 Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; @@ -5489,17 +5465,10 @@ void ivas_jbm_dec_feed_tc_to_renderer( //fixedToFloat_arrL( st->hFdCngDec->hFdCngCom->exc_cng_32fx, st->hFdCngDec->hFdCngCom->exc_cng_flt, 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); } -#endif -#else - ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); #endif if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { -#ifdef IVAS_FLOAT_FIXED ivas_ism_dec_digest_tc_fx( st_ivas ); -#else - ivas_ism_dec_digest_tc( st_ivas ); -#endif } } else if ( st_ivas->ivas_format == MC_FORMAT ) @@ -5529,7 +5498,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { -#ifdef IVAS_FLOAT_FIXED + #if 1 Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, j, b, i_ts, num_out_ch = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; @@ -5750,23 +5719,163 @@ void ivas_jbm_dec_feed_tc_to_renderer( fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); } #endif + } + } + + pop_wmops(); + return; +} #else +void ivas_jbm_dec_feed_tc_to_renderer( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ + int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ + float *data /* i : transport channels */ +) +{ + float data_f[MAX_CLDFB_DIGEST_CHANNELS][MAX_JBM_L_FRAME48k]; /* 'float' buffer for transport channels that will be directly converted with the CLDFB */ + float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS]; + int16_t n, n_render_timeslots; + + push_wmops( "ivas_jbm_dec_feed_tc_to_rendererer" ); + for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ ) + { + p_data_f[n] = &data_f[n][0]; + } + + + if ( st_ivas->hDecoderConfig->Opt_tsm ) + { + ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data, p_data_f ); + } + else + { + *nSamplesResidual = 0; + } + n_render_timeslots = st_ivas->hTcBuffer->n_samples_available / st_ivas->hTcBuffer->n_samples_granularity; + + if ( st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_BUFFER ) + { + ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); + + if ( ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + { + ivas_jbm_masa_sf_to_slot_map( st_ivas, n_render_timeslots ); + } + } + else if ( st_ivas->ivas_format == STEREO_FORMAT ) + { + ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); + } + else if ( st_ivas->ivas_format == ISM_FORMAT ) + { + /* Rendering */ + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_set_md_map( st_ivas, n_render_timeslots ); + + ivas_param_ism_params_to_masa_param_mapping( st_ivas ); + } + else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_param_ism_dec_digest_tc( st_ivas, n_render_timeslots, p_data_f ); + } + } + else /* ISM_MODE_DISC */ + { + ivas_ism_dec_digest_tc( st_ivas ); + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + { + ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); + } + else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + ivas_ism_dec_digest_tc( st_ivas ); + + /* delay the objects here for all renderers where it is needed */ + if ( + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || + st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || + st_ivas->renderer_type == RENDERER_OSBA_AMBI || + st_ivas->renderer_type == RENDERER_OSBA_LS || + st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL + ) + { + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + delay_signal_float( st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hSbaIsmData->delayBuffer[n], st_ivas->hSbaIsmData->delayBuffer_size ); + } + } + + if ( !st_ivas->sba_dirac_stereo_flag ) + { + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); + } + + ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); + } + } + else + { + ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); + + ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); + } + } + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); + } + + ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); + + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + { + ivas_ism_dec_digest_tc( st_ivas ); + } + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); + } + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + ivas_mc_paramupmix_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); + } + else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + ivas_param_mc_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, p_data_f ); + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { ivas_sba_dec_digest_tc( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); -#endif } } pop_wmops(); return; } - +#endif /*--------------------------------------------------------------------------* * ivas_dec_render() * * Principal IVAS JBM rendering routine *--------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED ivas_error ivas_jbm_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const uint16_t nSamplesAsked, /* i : number of samples wanted */ @@ -5784,14 +5893,12 @@ ivas_error ivas_jbm_dec_render( ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS] = { NULL }; float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS] = { NULL }; -#ifdef IVAS_FLOAT_FIXED Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; Word32 tmp_buffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k] = { 0 }; Word32 *p_temp_fx[MAX_OUTPUT_CHANNELS]; Word32 *p_tc_fx[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; Word16 subframe_len, gd_bits, exp, nchan_in, i, j; const Word16 output_q_factor = Q11; -#endif SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; push_wmops( "ivas_dec_render" ); @@ -5809,32 +5916,24 @@ ivas_error ivas_jbm_dec_render( for ( n = 0; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { p_output[n] = st_ivas->p_output_f[n]; -#ifdef IVAS_FLOAT_FIXED p_output_fx[n] = st_ivas->p_output_fx[n]; -#endif } -#ifdef IVAS_FLOAT_FIXED for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_temp_fx[i] = tmp_buffer_fx[i]; } -#endif if ( !st_ivas->hDecoderConfig->Opt_tsm ) { for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) { p_tc[n] = p_output[n]; -#ifdef IVAS_FLOAT_FIXED p_tc_fx[n] = p_output_fx[n]; -#endif } for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { st_ivas->hTcBuffer->tc[n] = p_output[n]; -#ifdef IVAS_FLOAT_FIXED st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; -#endif } } else @@ -5842,9 +5941,7 @@ ivas_error ivas_jbm_dec_render( for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) { p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; -#ifdef IVAS_FLOAT_FIXED p_tc_fx[n] = &st_ivas->hTcBuffer->tc_fx[n][st_ivas->hTcBuffer->n_samples_rendered]; -#endif } } @@ -5870,7 +5967,6 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_BUFFER ) { -#ifdef IVAS_FLOAT_FIXED Word16 slot_size, slots_to_render, tmp, e, slots_rendered, nSamplesRendered_tmp; slot_size = st_ivas->hTcBuffer->n_samples_granularity; @@ -5893,9 +5989,7 @@ ivas_error ivas_jbm_dec_render( { fixedToFloat_arrL( p_output_fx[ind], p_output[ind], Q11, s_max( *nSamplesRendered, nSamplesAskedLocal ) ); } -#else - ivas_jbm_dec_tc_buffer_playout( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output ); -#endif + } else if ( st_ivas->ivas_format == STEREO_FORMAT ) { @@ -5903,7 +5997,6 @@ ivas_error ivas_jbm_dec_render( if ( st_ivas->renderer_type == RENDERER_MC ) { *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); -#ifdef IVAS_FLOAT_FIXED Word16 q = Q16; q = q - find_guarded_bits_fx( st_ivas->nchan_transport ); FOR( i = 0; i < st_ivas->nchan_transport; ++i ) @@ -5922,9 +6015,6 @@ ivas_error ivas_jbm_dec_render( { fixedToFloat_arrL( p_output_fx[i], p_output[i], q, *nSamplesRendered ); } -#else - ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc, p_output ); -#endif } } else if ( st_ivas->ivas_format == ISM_FORMAT ) @@ -5939,7 +6029,6 @@ ivas_error ivas_jbm_dec_render( else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); -#ifdef IVAS_FLOAT_FIXED for ( int lp = 0; lp < L_FRAME48k; lp++ ) { p_output_fx[0][lp] = (Word32) ( p_output[0][lp] * ( 1u << 11 ) ); @@ -5952,13 +6041,9 @@ ivas_error ivas_jbm_dec_render( p_output[0][lp] = (float) p_output_fx[0][lp] / ( 1u << 11 ); p_output[1][lp] = (float) p_output_fx[1][lp] / ( 1u << 11 ); } -#else - ivas_apply_non_diegetic_panning( p_output, st_ivas->hDecoderConfig->non_diegetic_pan_gain, *nSamplesRendered ); -#endif } else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { -#ifdef IVAS_FLOAT_FIXED Word32 output_fx_tmp[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS][L_FRAME48k]; Word16 ch; Word32 *p_output_fx_tmp[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; @@ -6026,14 +6111,10 @@ ivas_error ivas_jbm_dec_render( } /*-----------------------------------------fix 2 flt--------------------------------------------*/ -#else - ivas_param_ism_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); -#endif if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { /* Convert CICP19 -> Ambisonics */ -#ifdef IVAS_FLOAT_FIXED #if 1 Word16 Q_in_buffer_td = 31; FOR( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ ) @@ -6044,7 +6125,7 @@ ivas_error ivas_jbm_dec_render( { floatToFixed_arrL( p_output[i], p_output_fx[i], Q_in_buffer_td, *nSamplesRendered ); } -#endif // IVAS_FLOAT_FIXED +#endif ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_fx, p_output_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); #if 1 FOR( i = 0; i < ( st_ivas->hOutSetup.ambisonics_order + 1 ) * ( st_ivas->hOutSetup.ambisonics_order + 1 ); i++ ) @@ -6052,9 +6133,6 @@ ivas_error ivas_jbm_dec_render( fixedToFloat_arrL( p_output_fx[i], p_output[i], Q_in_buffer_td - 3, *nSamplesRendered ); } #endif -#else - ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif // IVAS_FLOAT_FIXED } } } @@ -6066,7 +6144,6 @@ ivas_error ivas_jbm_dec_render( if ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ -#ifdef IVAS_FLOAT_FIXED Word16 q = 11; FOR( Word16 ind1 = 0; ind1 < s_max( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max( st_ivas->nchan_transport, st_ivas->nchan_ism ) ); ind1++ ) { @@ -6106,14 +6183,9 @@ ivas_error ivas_jbm_dec_render( st_ivas->hIsmMetaData[ind1]->azimuth = (float) ( st_ivas->hIsmMetaData[ind1]->azimuth_fx ) / (float) ( 1 << 22 ); st_ivas->hIsmMetaData[ind1]->elevation = (float) ( st_ivas->hIsmMetaData[ind1]->elevation_fx ) / (float) ( 1 << 22 ); } - -#else - ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); -#endif } else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { -#ifdef IVAS_FLOAT_FIXED for ( int lp = 0; lp < L_FRAME48k; lp++ ) { p_output_fx[0][lp] = (Word32) ( p_output[0][lp] * ( 1u << 11 ) ); @@ -6126,14 +6198,10 @@ ivas_error ivas_jbm_dec_render( p_output[0][lp] = (float) p_output_fx[0][lp] / ( 1u << 11 ); p_output[1][lp] = (float) p_output_fx[1][lp] / ( 1u << 11 ); } -#else - ivas_apply_non_diegetic_panning( p_output, st_ivas->hDecoderConfig->non_diegetic_pan_gain, *nSamplesRendered ); -#endif } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ -#ifdef IVAS_FLOAT_FIXED FOR( i = 0; i < 15; i++ ) { FOR( j = 0; j < 16; j++ ) @@ -6166,15 +6234,11 @@ ivas_error ivas_jbm_dec_render( st_ivas->hIsmRendererData->prev_gains_fx[i][j] = L_shl( st_ivas->hIsmRendererData->prev_gains_fx[i][j], 1 ); // Q29 -> Q30 } } -#else - ivas_ism2sba_sf( st_ivas->hTcBuffer->tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); -#endif // IVAS_FLOAT_FIXED } /* Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef IVAS_FLOAT_FIXED for ( i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++ ) { for ( j = 0; j < L_FRAME48k; j++ ) @@ -6199,16 +6263,9 @@ ivas_error ivas_jbm_dec_render( p_output[i][j] = fixedToFloat( p_output_fx[i][j], Q11 ); } } -#else - if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef IVAS_FLOAT_FIXED st_ivas->hCrendWrapper->p_io_qfactor = &st_ivas->hCrendWrapper->io_qfactor; subframe_len = st_ivas->hTcBuffer->subframe_nbslots[0] * st_ivas->hTcBuffer->n_samples_granularity; gd_bits = find_guarded_bits_fx( subframe_len ); @@ -6237,12 +6294,6 @@ ivas_error ivas_jbm_dec_render( p_output[i][j] = fixed_to_float( p_temp_fx[i][j], *st_ivas->hCrendWrapper->p_io_qfactor ); } } -#else - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, NULL, NULL, st_ivas->hTcBuffer, p_output, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } } } @@ -6277,7 +6328,6 @@ ivas_error ivas_jbm_dec_render( } else { -#ifdef IVAS_FLOAT_FIXED for ( n = 0; n < st_ivas->p_out_len; n++ ) { floatToFixed_arr32( p_output[n], p_output_fx[n], Q11, 960 ); @@ -6353,7 +6403,7 @@ ivas_error ivas_jbm_dec_render( { return error; } -#ifdef IVAS_FLOAT_FIXED /*Fixed to float */ +#if 1 /*Fixed to float */ for ( n = 0; n < st_ivas->p_out_len; n++ ) { fixedToFloat_arrL( p_output_fx[n], p_output[n], 11, 960 ); @@ -6399,12 +6449,6 @@ ivas_error ivas_jbm_dec_render( } } #endif -#else - if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED } } else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) @@ -6439,7 +6483,6 @@ ivas_error ivas_jbm_dec_render( { if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { -#ifdef IVAS_FLOAT_FIXED for ( n = 0; n < st_ivas->p_out_len; n++ ) { floatToFixed_arr32( p_output[n], p_output_fx[n], 11, 960 ); @@ -6584,12 +6627,6 @@ ivas_error ivas_jbm_dec_render( p_output[i][j] = fixedToFloat( p_output_fx[i][j], Q11 ); } } -#endif -#else - if ( ( error = ivas_osba_dirac_td_binaural_jbm( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) - { - return error; - } #endif } else if ( st_ivas->renderer_type == RENDERER_OSBA_STEREO ) @@ -6606,7 +6643,6 @@ ivas_error ivas_jbm_dec_render( } /* render objects */ -#ifdef IVAS_FLOAT_FIXED Word16 q = 15; FOR( Word16 ind1 = 0; ind1 < s_max( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max( st_ivas->nchan_transport, st_ivas->nchan_ism ) ); ind1++ ) { @@ -6649,10 +6685,6 @@ ivas_error ivas_jbm_dec_render( st_ivas->hIsmMetaData[ind1]->elevation = (float) ( st_ivas->hIsmMetaData[ind1]->elevation_fx ) / (float) ( 1 << 22 ); } -#else - ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); -#endif - /* add already rendered SBA part */ for ( n = 0; n < nchan_out; n++ ) { @@ -6668,7 +6700,6 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/ { -#ifdef IVAS_FLOAT_FIXED for ( n = 0; n < st_ivas->p_out_len; n++ ) { floatToFixed_arr32( p_output[n], p_output_fx[n], Q11, 960 ); @@ -6744,7 +6775,7 @@ ivas_error ivas_jbm_dec_render( { return error; } -#ifdef IVAS_FLOAT_FIXED /*Fixed to float */ +#if 1 /*Fixed to float */ for ( n = 0; n < st_ivas->p_out_len; n++ ) { fixedToFloat_arrL( p_output_fx[n], p_output[n], 11, 960 ); @@ -6790,12 +6821,6 @@ ivas_error ivas_jbm_dec_render( } } #endif -#else - if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output[st_ivas->nchan_ism] ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED for ( n = 0; n < st_ivas->nchan_ism; n++ ) { @@ -6804,7 +6829,6 @@ ivas_error ivas_jbm_dec_render( } else { -#ifdef IVAS_FLOAT_FIXED for ( n = 0; n < st_ivas->p_out_len; n++ ) { floatToFixed_arr32( p_output[n], p_output_fx[n], Q11, 960 ); @@ -6880,7 +6904,7 @@ ivas_error ivas_jbm_dec_render( { return error; } -#ifdef IVAS_FLOAT_FIXED /*Fixed to float */ +#if 1 /*Fixed to float */ for ( n = 0; n < st_ivas->p_out_len; n++ ) { fixedToFloat_arrL( p_output_fx[n], p_output[n], 11, 960 ); @@ -6926,12 +6950,6 @@ ivas_error ivas_jbm_dec_render( } } #endif -#else - if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED } } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) @@ -6940,7 +6958,6 @@ ivas_error ivas_jbm_dec_render( } else { -#ifdef IVAS_FLOAT_FIXED for ( n = 0; n < st_ivas->p_out_len; n++ ) { floatToFixed_arr32( p_output[n], p_output_fx[n], Q11, 960 ); @@ -7016,7 +7033,7 @@ ivas_error ivas_jbm_dec_render( { return error; } -#ifdef IVAS_FLOAT_FIXED /*Fixed to float */ +#if 1 /*Fixed to float */ for ( n = 0; n < st_ivas->p_out_len; n++ ) { fixedToFloat_arrL( p_output_fx[n], p_output[n], 11, 960 ); @@ -7060,12 +7077,6 @@ ivas_error ivas_jbm_dec_render( } } #endif -#else - if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) { @@ -7098,7 +7109,6 @@ ivas_error ivas_jbm_dec_render( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef IVAS_FLOAT_FIXED st_ivas->hCrendWrapper->p_io_qfactor = &st_ivas->hCrendWrapper->io_qfactor; subframe_len = st_ivas->hTcBuffer->subframe_nbslots[0] * st_ivas->hTcBuffer->n_samples_granularity; gd_bits = find_guarded_bits_fx( subframe_len ); @@ -7137,22 +7147,10 @@ ivas_error ivas_jbm_dec_render( } } -#else - if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, - &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : p_tc, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) - - - { - return error; - } - - ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); -#ifdef IVAS_FLOAT_FIXED Word16 q = Q16; q = q - find_guarded_bits_fx( st_ivas->nchan_transport ); FOR( i = 0; i < st_ivas->nchan_transport; ++i ) @@ -7171,9 +7169,7 @@ ivas_error ivas_jbm_dec_render( { fixedToFloat_arrL( p_output_fx[i], p_output[i], q, *nSamplesRendered ); } -#else - ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc, p_output ); -#endif + } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { @@ -7181,7 +7177,6 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef IVAS_FLOAT_FIXED #if 1 /* TODO: remove float to fix conversions: */ for ( i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++ ) { @@ -7209,14 +7204,7 @@ ivas_error ivas_jbm_dec_render( } } #endif -#else - if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif -#ifdef IVAS_FLOAT_FIXED Word16 q = Q16; q = q - find_guarded_bits_fx( *nSamplesRendered ); FOR( i = 0; i < st_ivas->nchan_transport; ++i ) @@ -7234,9 +7222,6 @@ ivas_error ivas_jbm_dec_render( fixedToFloat_arrL( p_tc_fx[i], p_tc[i], q, *nSamplesRendered ); fixedToFloat_arrL( p_output_fx[i], p_output[i], q, *nSamplesRendered ); } -#else - ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); -#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) @@ -7281,7 +7266,6 @@ ivas_error ivas_jbm_dec_render( if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && !st_ivas->hDecoderConfig->Opt_Headrotation ) { { -#ifdef IVAS_FLOAT_FIXED Word16 q = Q16; q = q - find_guarded_bits_fx( *nSamplesRendered ); FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, MC_PARAMUPMIX_MAX_INPUT_CHANS ); ++i ) @@ -7295,14 +7279,10 @@ ivas_error ivas_jbm_dec_render( { fixedToFloat_arrL( p_output_fx[i], p_output[i], q, *nSamplesRendered ); } -#else - ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); -#endif } } else if ( st_ivas->renderer_type == RENDERER_MC ) { -#ifdef IVAS_FLOAT_FIXED Word16 q = Q16; q = q - find_guarded_bits_fx( MC_PARAMUPMIX_MAX_INPUT_CHANS ); FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, MC_PARAMUPMIX_MAX_INPUT_CHANS ); ++i ) @@ -7321,9 +7301,6 @@ ivas_error ivas_jbm_dec_render( { fixedToFloat_arrL( p_output_fx[i], p_output[i], q, *nSamplesRendered ); } -#else - ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, *nSamplesRendered, p_output, p_output ); -#endif } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { @@ -7336,7 +7313,6 @@ ivas_error ivas_jbm_dec_render( return error; } -#ifdef IVAS_FLOAT_FIXED Word16 q = Q16; q = q - find_guarded_bits_fx( *nSamplesRendered ); FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, MC_PARAMUPMIX_MAX_INPUT_CHANS ); ++i ) @@ -7350,9 +7326,6 @@ ivas_error ivas_jbm_dec_render( { fixedToFloat_arrL( p_output_fx[i], p_output[i], q, *nSamplesRendered ); } -#else - ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); -#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -7436,7 +7409,6 @@ ivas_error ivas_jbm_dec_render( if ( st_ivas->ivas_format != MONO_FORMAT ) { #ifndef DISABLE_LIMITER -#ifdef IVAS_FLOAT_FIXED Word16 ch_idx; exp = 16; for ( ch_idx = 0; ch_idx < MAX_CICP_CHANNELS; ch_idx++ ) @@ -7464,13 +7436,9 @@ ivas_error ivas_jbm_dec_render( p_output[ch_idx][j] = ( (float) p_output_fx[ch_idx][j] / ( 1 << exp ) ); } } -#else - ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, *nSamplesRendered, st_ivas->BER_detect ); -#endif #endif } } -#ifdef IVAS_FLOAT_FIXED Word16 q_p_output = Q11; FOR( i = 0; i < nchan_out; i++ ) { @@ -7483,9 +7451,6 @@ ivas_error ivas_jbm_dec_render( { } -#else - ivas_syn_output( p_output, *nSamplesRendered, nchan_out, data ); -#endif *nSamplesAvailableNext = st_ivas->hTcBuffer->n_samples_available; @@ -7493,7 +7458,478 @@ ivas_error ivas_jbm_dec_render( pop_wmops(); return IVAS_ERR_OK; } +#else +ivas_error ivas_jbm_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const uint16_t nSamplesAsked, /* i : number of samples wanted */ + uint16_t *nSamplesRendered, /* o : number of samples rendered */ + uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ + int16_t *data /* o : output synthesis signal */ +) +{ + int16_t n, nchan_out; + int16_t nchan_transport; + int16_t nchan_remapped; + int32_t output_Fs; + AUDIO_CONFIG output_config; + int16_t nSamplesAskedLocal; + ivas_error error; + float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; + float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; + + push_wmops( "ivas_dec_render" ); + /*----------------------------------------------------------------* + * Initialization of local vars after struct has been set + *----------------------------------------------------------------*/ + + hSpatParamRendCom = st_ivas->hSpatParamRendCom; + output_Fs = st_ivas->hDecoderConfig->output_Fs; + nchan_out = st_ivas->hDecoderConfig->nchan_out; + nchan_transport = st_ivas->hTcBuffer->nchan_transport_jbm; + output_config = st_ivas->hDecoderConfig->output_config; + nSamplesAskedLocal = nSamplesAsked + st_ivas->hTcBuffer->n_samples_discard; + + for ( n = 0; n < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) + { + p_output[n] = st_ivas->p_output_f[n]; + } + + if ( !st_ivas->hDecoderConfig->Opt_tsm ) + { + for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) + { + p_tc[n] = p_output[n]; + } + + for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ ) + { + st_ivas->hTcBuffer->tc[n] = p_output[n]; + } + } + else + { + for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) + { + p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; + } + } + + /*----------------------------------------------------------------* + * Update combined orientation access index + *----------------------------------------------------------------*/ + + if ( st_ivas->hCombinedOrientationData != NULL ) + { + /* take the discard samples into account here to make sure head rotation stays on the correct 5ms grid */ + st_ivas->hCombinedOrientationData->cur_subframe_samples_rendered_start -= st_ivas->hTcBuffer->n_samples_discard; + + ivas_combined_orientation_set_to_start_index( st_ivas->hCombinedOrientationData ); + } + + /*----------------------------------------------------------------* + * Rendering + *----------------------------------------------------------------*/ + + if ( st_ivas->ivas_format == UNDEFINED_FORMAT ) + { + assert( 0 ); + } + else if ( st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_BUFFER ) + { + ivas_jbm_dec_tc_buffer_playout( st_ivas, nSamplesAskedLocal, nSamplesRendered, p_output ); + } + else if ( st_ivas->ivas_format == STEREO_FORMAT ) + { + /* Rendering */ + if ( st_ivas->renderer_type == RENDERER_MC ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc, p_output ); + } + } + else if ( st_ivas->ivas_format == ISM_FORMAT ) + { + /* Rendering */ + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, st_ivas->nchan_transport, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + ivas_apply_non_diegetic_panning( p_output, st_ivas->hDecoderConfig->non_diegetic_pan_gain, *nSamplesRendered ); + } + else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_param_ism_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + /* Convert CICP19 -> Ambisonics */ + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + } + } + else /* ISM_MODE_DISC */ + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + + /* Loudspeaker or Ambisonics rendering */ + if ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ + ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); + } + else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) + { + ivas_apply_non_diegetic_panning( p_output, st_ivas->hDecoderConfig->non_diegetic_pan_gain, *nSamplesRendered ); + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ + ivas_ism2sba_sf( st_ivas->hTcBuffer->tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); + } + + /* Binaural rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, st_ivas->hDecoderConfig, NULL, NULL, NULL, st_ivas->hTcBuffer, p_output, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + } + else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) + { + nchan_remapped = nchan_transport; + + /* Loudspeakers, Ambisonics or Binaural rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); + } + else if ( st_ivas->ivas_format == MASA_FORMAT ) + { + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + for ( n = 0; n < nchan_remapped; n++ ) + { + mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); + } + if ( ( error = ivas_sba_linear_renderer( p_output, *nSamplesRendered, nchan_remapped, 0, output_config, st_ivas->hOutSetup ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->renderer_type == RENDERER_DIRAC ) + { + ivas_dirac_dec_render( st_ivas, nchan_remapped, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + } + } + else + { + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + { + nchan_remapped = st_ivas->nchan_transport; + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) + { + if ( ( error = ivas_omasa_dirac_td_binaural_jbm( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else + { + ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); + } + } + else if ( st_ivas->renderer_type == RENDERER_DIRAC ) + { + ivas_omasa_dirac_rend_jbm( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); + } + } + else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + { + nchan_remapped = nchan_transport; + + /* Loudspeakers, Ambisonics or Binaural rendering */ + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + { + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + { + if ( ( error = ivas_osba_dirac_td_binaural_jbm( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->renderer_type == RENDERER_OSBA_STEREO ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + + /* shift SBA channels to avoid overwrite by ISM upmix in 1 object case and non-TSM unified channel memory*/ + if ( st_ivas->nchan_ism == 1 && st_ivas->hDecoderConfig->Opt_tsm == 0 ) + { + mvr2r( p_tc[2], p_output[3], *nSamplesRendered ); + mvr2r( p_tc[1], p_output[2], *nSamplesRendered ); + p_tc[1] = p_output[2]; + p_tc[2] = p_output[3]; + } + + /* render objects */ + ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); + + /* add already rendered SBA part */ + for ( n = 0; n < nchan_out; n++ ) + { + v_add( p_output[n], p_tc[n + st_ivas->nchan_ism], p_output[n], *nSamplesRendered ); + } + } + else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) + { + if ( ( error = ivas_osba_render_sf( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } + } + else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/ + { + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output[st_ivas->nchan_ism] ) ) != IVAS_ERR_OK ) + { + return error; + } + + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); + } + } + else + { + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } + } + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) + { + ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); + } + else + { + if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ) ) != IVAS_ERR_OK ) + { + return error; + } + + if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + { + for ( n = st_ivas->hIntSetup.nchan_out_woLFE - 1; n >= 0; n-- ) + { + mvr2r( p_output[n], p_output[n + st_ivas->nchan_ism], *nSamplesRendered ); + } + for ( n = 0; n < st_ivas->nchan_ism; n++ ) + { + set_zero( p_output[n], *nSamplesRendered ); + } + } + } + } + else if ( st_ivas->ivas_format == MC_FORMAT ) + { + if ( st_ivas->mc_mode == MC_MODE_MCT ) + { + int16_t crendInPlaceRotation = FALSE; + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_FOA || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA2 || st_ivas->intern_config == IVAS_AUDIO_CONFIG_HOA3 ) ) + { + if ( ( st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe ) < ( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe ) ) + { + crendInPlaceRotation = TRUE; + ivas_mc2sba( st_ivas->hTransSetup, p_tc, p_output, *nSamplesRendered, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); + } + } + + /* Rendering */ + if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) + { + + if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, + &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : p_tc, p_output, *nSamplesRendered, output_Fs ) ) != IVAS_ERR_OK ) + + + { + return error; + } + + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_MC ) + { + *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); + ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_mc2sba( st_ivas->hIntSetup, p_tc, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_tc, p_output ); + } + } + else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + { + ivas_mc_paramupmix_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_tc, p_output ); + + + /* Rendering */ + if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && !st_ivas->hDecoderConfig->Opt_Headrotation ) + { + { + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); + } + } + else if ( st_ivas->renderer_type == RENDERER_MC ) + { + ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, *nSamplesRendered, p_output, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) + { + if ( ( error = ivas_td_binaural_renderer( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK ) + { + return error; + } + + ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, p_output, p_output ); + } + } + else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + { + ivas_param_mc_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + } + else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + { + int16_t offset = hSpatParamRendCom->slots_rendered * hSpatParamRendCom->slot_size; + nchan_remapped = st_ivas->nchan_transport; + + if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); + } + else if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) /* rendering to CICPxx and Ambisonics */ + { + ivas_dirac_dec_render( st_ivas, nchan_remapped, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) + { + /* we still need to copy the separate channel if available */ + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); + } + + ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f ); + } + else if ( st_ivas->intern_config == IVAS_AUDIO_CONFIG_5_1 && ( output_config == IVAS_AUDIO_CONFIG_5_1_2 || output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1 ) ) + { + for ( n = st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; n < st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; n++ ) + { + set_zero( p_output[n], *nSamplesRendered ); + } + } + } + + /* copy discrete C and TD LFE from internal TC to output */ + if ( st_ivas->hOutSetup.separateChannelEnabled ) + { + if ( output_config == IVAS_AUDIO_CONFIG_5_1 || output_config == IVAS_AUDIO_CONFIG_7_1 || + output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || + output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) + { + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL] + offset, p_output[LFE_CHANNEL], *nSamplesRendered ); + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); + } + else if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) + { + /* Delay the separated channel to sync with the DirAC rendering */ + mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); + } + } + } + } + + /*----------------------------------------------------------------* + * Write IVAS output channels + * - compensation for saturation + * - float to integer conversion + *----------------------------------------------------------------*/ + + st_ivas->hTcBuffer->n_samples_available -= *nSamplesRendered; + st_ivas->hTcBuffer->n_samples_rendered += *nSamplesRendered; + + /* update global combined orientation start index */ + ivas_combined_orientation_update_start_index( st_ivas->hCombinedOrientationData, *nSamplesRendered ); + + if ( st_ivas->hTcBuffer->n_samples_discard > 0 ) + { + for ( n = 0; n < min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); n++ ) + { + p_output[n] += st_ivas->hTcBuffer->n_samples_discard; + } + *nSamplesRendered -= st_ivas->hTcBuffer->n_samples_discard; + st_ivas->hTcBuffer->n_samples_discard = 0; + } + + { + if ( st_ivas->ivas_format != MONO_FORMAT ) + { +#ifndef DISABLE_LIMITER + ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, *nSamplesRendered, st_ivas->BER_detect ); +#endif + } + } + + ivas_syn_output( p_output, *nSamplesRendered, nchan_out, data ); + + + *nSamplesAvailableNext = st_ivas->hTcBuffer->n_samples_available; + + pop_wmops(); + return IVAS_ERR_OK; +} +#endif /*--------------------------------------------------------------------------* * ivas_jbm_dec_dec_flush_renderer() diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 7efec9664a753984a6068fcbe568526c188122da..82b54b48dc2af2f8f3b0a9258c6a5c4d3a551cd2 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -3995,6 +3995,7 @@ void fixedToFloat_arrL_check (Word32 *i, float *f, Word16 Q, Word16 l) } } } +#ifdef IVAS_FLOAT_FIXED void ivas_spar_param_to_masa_param_mapping_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -4418,7 +4419,7 @@ void ivas_spar_param_to_masa_param_mapping_fx( return; } - +#else void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -4639,8 +4640,8 @@ void ivas_spar_param_to_masa_param_mapping( return; } - - +#endif +#ifdef IVAS_FLOAT_FIXED /* Estimate FOA properties: foaCov = mixMtx * inCov * mixMtx' */ static void compute_foa_cov_matrix_fx( Word32 foaCov_fx[FOA_CHANNELS][FOA_CHANNELS], /* o : Estimated FOA covariance matrix */ @@ -4679,7 +4680,7 @@ static void compute_foa_cov_matrix_fx( return; } - +#else static void compute_foa_cov_matrix( float foaCov[FOA_CHANNELS][FOA_CHANNELS], /* o : Estimated FOA covariance matrix */ float inCov[FOA_CHANNELS][FOA_CHANNELS], /* i : Input covariance matrix */ @@ -4718,6 +4719,7 @@ static void compute_foa_cov_matrix( return; } +#endif static void create_masa_ext_out_meta( MASA_DECODER *hMasa, IVAS_QMETADATA_HANDLE hQMetaData, diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 60c23232de45cda2c4773e864dfac5c9acc3a772..e72aadc1e32669172c0895086843faac8f356830 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -1044,5 +1044,909 @@ static void get_ec_data( return; } +#else + + +/*-----------------------------------------------------------------------* + * Local arrays + *-----------------------------------------------------------------------*/ + + /* boxes = { 0 1 2 3 [4 6] [5 7] [8 10] [9 11] }; */ +const int16_t MC_PARAMUPMIX_CHIDX1[MC_PARAMUPMIX_COMBINATIONS] = { 0, 1, 4, 5 }; +const int16_t MC_PARAMUPMIX_CHIDX2[MC_PARAMUPMIX_COMBINATIONS] = { 2, 3, 6, 7 }; + + +/*-----------------------------------------------------------------------* + * Local function prototypes + *-----------------------------------------------------------------------*/ + +static void ps_pred_process_sf(MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_TC_BUFFER_HANDLE hTcBuffer, float qmf_mod_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float *param_interpol, const int16_t ch, const int16_t slots_rendered); + +static void ivas_mc_paramupmix_dec_sf(Decoder_Struct *st_ivas, float *output_f[MAX_OUTPUT_CHANNELS]); + +static void ivas_param_upmix_dec_decorr_subframes(Decoder_Struct *st_ivas, const int16_t nSamplesForRendering); + +static int16_t huff_read(Decoder_State *st, const int16_t(*ht)[2]); + +static void huffman_decode(Decoder_State *st, const PAR_TYPE parType, int32_t *vq); + +static void dequant_alpha(int32_t *vq, float *v); + +static void dequant_beta(int32_t *aq, int32_t *bq, float *beta); + +static void get_ec_data(Decoder_State *st, const PAR_TYPE parType, int32_t *parQ, int32_t *alphaQEnv, float ab[IVAS_MAX_NUM_BANDS]); + + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_read_BS() + * + * Read the ParamUpmix MC metadata + *------------------------------------------------------------------------*/ + +void ivas_mc_paramupmix_dec_read_BS( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_State *st0, /* i/o: decoder state structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + int16_t *nb_bits /* o : number of bits written */ +) +{ + int16_t i, k; + int32_t alpha_quant[IVAS_MAX_NUM_BANDS]; + int16_t nb_bits_read_orig; + int16_t next_bit_pos_orig, last_bit_pos; + uint16_t bstr_meta[MAX_BITS_METADATA], *bit_stream_orig; + + push_wmops("mc_paramupmix_read_bs"); + *nb_bits = 0; + + if (st0->bfi) + { + for (i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++) + { + for (k = 0; k < IVAS_MAX_NUM_BANDS; k++) + { + hMCParamUpmix->alphas[i][k] = hMCParamUpmix->alpha_prev[i][k]; + hMCParamUpmix->betas[i][k] = hMCParamUpmix->beta_prev[i][k]; + } + } + hMCParamUpmix->first_frame = 1; + } + else /* if (!st->bfi) */ + { + bit_stream_orig = st0->bit_stream; + next_bit_pos_orig = st0->next_bit_pos; + last_bit_pos = (int16_t)((st_ivas->hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC) - 1); + nb_bits_read_orig = 0; + last_bit_pos -= nb_bits_read_orig; /* reverse the bitstream for easier reading of indices */ + for (i = 0; i < min(MAX_BITS_METADATA, last_bit_pos); i++) + { + bstr_meta[i] = st_ivas->bit_stream[last_bit_pos - i]; + } + st0->bit_stream = bstr_meta; + st0->next_bit_pos = 0; + st0->bits_frame = min(MAX_BITS_METADATA, last_bit_pos + 1); + st0->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; /* to avoid BER detect */ + + for (i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++) + { + get_ec_data(st0, ALPHA, hMCParamUpmix->alpha_quant[i], alpha_quant, hMCParamUpmix->alphas[i]); + + get_ec_data(st0, BETA, hMCParamUpmix->beta_quant[i], alpha_quant, hMCParamUpmix->betas[i]); + } + *nb_bits += st0->next_bit_pos; + st0->bit_stream = bit_stream_orig; + st0->next_bit_pos = next_bit_pos_orig; + + if (hMCParamUpmix->first_frame) + { + for (i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++) + { + mvr2r(hMCParamUpmix->alphas[i], hMCParamUpmix->alpha_prev[i], IVAS_MAX_NUM_BANDS); + mvr2r(hMCParamUpmix->betas[i], hMCParamUpmix->beta_prev[i], IVAS_MAX_NUM_BANDS); + } + hMCParamUpmix->first_frame = 0; + } + } + + pop_wmops(); + return; +} + + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_digest_tc() + * + * + *------------------------------------------------------------------------*/ + +void ivas_mc_paramupmix_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels*/ + const int16_t nSamplesForRendering /* i : number of samples provided */ +) +{ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + hMCParamUpmix = st_ivas->hMCParamUpmix; + assert(hMCParamUpmix); + push_wmops("ivas_mc_paramupmix_dec_digest_tc"); + + ivas_param_upmix_dec_decorr_subframes(st_ivas, nSamplesForRendering); + + /* adapt subframes */ + ivas_jbm_dec_td_renderers_adapt_subframes(st_ivas); + + ivas_jbm_dec_get_adapted_linear_interpolator(DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator); + + pop_wmops(); + return; +} + + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_render() + * + * + *------------------------------------------------------------------------*/ + +void ivas_mc_paramupmix_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ + uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ + uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + float *input_f[], /* i : core-coder transport channels */ + float *output_f[] /* i/o: synthesized core-coder transport channels */ +) +{ + int16_t slots_to_render, first_sf, last_sf, subframe_idx; + uint16_t slot_size, ch; + float *output_f_local[MAX_OUTPUT_CHANNELS]; + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + + hMCParamUpmix = st_ivas->hMCParamUpmix; + assert(hMCParamUpmix); + + push_wmops("ivas_mc_paramupmix_dec_render"); + + for (ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++) + { + output_f_local[ch] = output_f[ch]; + } + + slot_size = st_ivas->hTcBuffer->n_samples_granularity; + + /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ + slots_to_render = min(st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, nSamplesAsked / slot_size); + *nSamplesRendered = slots_to_render * slot_size; + first_sf = st_ivas->hTcBuffer->subframes_rendered; + last_sf = first_sf; + + for (ch = 0; ch < MAX_TRANSPORT_CHANNELS; ch++) + { + mvr2r(input_f[ch], output_f_local[ch], *nSamplesRendered); + } + + while (slots_to_render > 0) + { + slots_to_render -= st_ivas->hTcBuffer->subframe_nbslots[last_sf]; + last_sf++; + } + { + + for (ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++) + { + mvr2r(hMCParamUpmix->alpha_prev[ch], hMCParamUpmix->alpha_sf[ch], IVAS_MAX_NUM_BANDS); + mvr2r(hMCParamUpmix->beta_prev[ch], hMCParamUpmix->beta_sf[ch], IVAS_MAX_NUM_BANDS); + } + + for (subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++) + { + int16_t n_samples_sf = slot_size * st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; + + ivas_mc_paramupmix_dec_sf(st_ivas, output_f_local); + + for (ch = 0; ch < min(MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec(st_ivas, -1, -1)); ch++) + { + output_f_local[ch] += n_samples_sf; + } + + /* update combined orientation access index */ + ivas_combined_orientation_update_index(st_ivas->hCombinedOrientationData, n_samples_sf); + } + + for (ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++) + { + mvr2r(hMCParamUpmix->alphas[ch], hMCParamUpmix->alpha_prev[ch], IVAS_MAX_NUM_BANDS); + mvr2r(hMCParamUpmix->betas[ch], hMCParamUpmix->beta_prev[ch], IVAS_MAX_NUM_BANDS); + } + } + + *nSamplesAvailable = (st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered) * slot_size; + + pop_wmops(); + return; +} + + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_open() + * + * Open Parametric MC decoder handle + *-------------------------------------------------------------------------*/ + +ivas_error ivas_mc_paramupmix_dec_open( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +) +{ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + int32_t output_Fs; + int16_t nchan_transport; + uint16_t i; + ivas_error error; + + error = IVAS_ERR_OK; + + /*-----------------------------------------------------------------* + * prepare library opening + *-----------------------------------------------------------------*/ + + if ((hMCParamUpmix = (MC_PARAMUPMIX_DEC_HANDLE)malloc(sizeof(MC_PARAMUPMIX_DEC_DATA))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param-Upmix MC\n")); + } + output_Fs = st_ivas->hDecoderConfig->output_Fs; + hMCParamUpmix->first_frame = 1; + st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; + nchan_transport = st_ivas->nchan_transport; + + switch (nchan_transport) + { + case 8: + st_ivas->nCPE = 4; + st_ivas->nSCE = 0; + st_ivas->element_mode_init = IVAS_CPE_MDCT; + break; + } + + hMCParamUpmix->hoa_encoder = NULL; + + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ + + hMCParamUpmix->num_freq_bands = (int16_t)(output_Fs * INV_CLDFB_BANDWIDTH + 0.5f); + + for (i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++) + { + ivas_td_decorr_dec_open(&(hMCParamUpmix->hTdDecorr[i]), output_Fs, 2, 1); + } + + for (i = 0; i < MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; i++) + { + if ((hMCParamUpmix->pcm_delay[i] = (float *)malloc(NS2SA(output_Fs, IVAS_FB_DEC_DELAY_NS) * sizeof(float))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for delay buffer\n")); + } + set_zero(hMCParamUpmix->pcm_delay[i], NS2SA(output_Fs, IVAS_FB_DEC_DELAY_NS)); + } + + /* Head or external rotation */ + if ((st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) && (st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation)) + { + if ((hMCParamUpmix->hoa_encoder = (float *)malloc(st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof(float))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n")); + } + compute_hoa_encoder_mtx(st_ivas->hTransSetup.ls_azimuth, st_ivas->hTransSetup.ls_elevation, hMCParamUpmix->hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER); + } + + /* allocate transport channels*/ + hMCParamUpmix->free_param_interpolator = 0; + hMCParamUpmix->param_interpolator = NULL; + + if ((hMCParamUpmix->param_interpolator = (float *)malloc(MAX_JBM_CLDFB_TIMESLOTS * sizeof(float))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n")); + } + hMCParamUpmix->free_param_interpolator = 1; + + ivas_jbm_dec_get_adapted_linear_interpolator(DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator); + + if (st_ivas->hTcBuffer == NULL) + { + int16_t nchan_to_allocate; + int16_t nchan_tc; + TC_BUFFER_MODE buffer_mode; + + buffer_mode = TC_BUFFER_MODE_RENDERER; + nchan_tc = ivas_jbm_dec_get_num_tc_channels(st_ivas); + nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; + + if (st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_STEREO || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_MONO) + { + buffer_mode = TC_BUFFER_MODE_BUFFER; + nchan_tc = st_ivas->hDecoderConfig->nchan_out; + nchan_to_allocate = nchan_tc; + } + else if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC) + { + nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; + } + + if ((error = ivas_jbm_dec_tc_buffer_open(st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA(st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS))) != IVAS_ERR_OK) + { + return error; + } + } + st_ivas->hMCParamUpmix = hMCParamUpmix; + + return error; +} + + +/*------------------------------------------------------------------------- + * ivas_mc_paramupmix_dec_close() + * + * Close ParamUpmix MC memories + *------------------------------------------------------------------------*/ + +void ivas_mc_paramupmix_dec_close( + MC_PARAMUPMIX_DEC_HANDLE *hMCParamUpmix /* i/o: Parametric MC decoder handle */ +) +{ + int16_t i; + + if (hMCParamUpmix == NULL || *hMCParamUpmix == NULL) + { + return; + } + for (i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++) + { + ivas_td_decorr_dec_close(&((*hMCParamUpmix)->hTdDecorr[i])); + } + for (i = 0; i < MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; i++) + { + if ((*hMCParamUpmix)->pcm_delay[i] != NULL) + { + free((*hMCParamUpmix)->pcm_delay[i]); + } + } + if ((*hMCParamUpmix)->param_interpolator != NULL) + { + if ((*hMCParamUpmix)->free_param_interpolator == 1) + { + free((*hMCParamUpmix)->param_interpolator); + } + } + if ((*hMCParamUpmix)->hoa_encoder != NULL) + { + free((*hMCParamUpmix)->hoa_encoder); + (*hMCParamUpmix)->hoa_encoder = NULL; + } + free(*hMCParamUpmix); + + *hMCParamUpmix = NULL; + + return; +} + + +/*------------------------------------------------------------------------- + * paramupmix_td_decorr_process_jbm() + * + * + *------------------------------------------------------------------------*/ + +static void paramupmix_td_decorr_process_jbm( + ivas_td_decorr_state_t *hTdDecorr[], /* i/o: SPAR Covar. decoder handle */ + float *pcm_in[], /* i : input audio channels */ + float **pp_out_pcm, /* o : output audio channels */ + const int16_t output_frame /* i : output frame length */ +) +{ + int16_t j, k; + int16_t offset; + float in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k]; + + offset = (int16_t)(output_frame * FRAMES_PER_SEC * IVAS_DECORR_PARM_LOOKAHEAD_TAU); + + /* Look-ahead delay */ + for (k = 0; k < MC_PARAMUPMIX_COMBINATIONS; k++) + { + mvr2r(pcm_in[k], pp_out_pcm[k], output_frame); + delay_signal_float(pp_out_pcm[k], output_frame, hTdDecorr[k]->look_ahead_buf, offset); + + /* In ducking gains */ + if (hTdDecorr[k]->ducking_flag) + { + ivas_td_decorr_get_ducking_gains(hTdDecorr[k]->pTrans_det, pcm_in[k], in_duck_gain, out_duck_gain, output_frame, 0); + + for (j = 0; j < output_frame; j++) + { + pp_out_pcm[k][j] = pp_out_pcm[k][j] * in_duck_gain[j]; + } + } + + /* All pass delay section */ + ivas_td_decorr_APD_iir_filter(&hTdDecorr[k]->APD_filt_state[0], pp_out_pcm[k], hTdDecorr[k]->num_apd_sections, output_frame); + + /* Out ducking gains */ + if (hTdDecorr[k]->ducking_flag) + { + for (j = 0; j < output_frame; j++) + { + pp_out_pcm[k][j] = pp_out_pcm[k][j] * out_duck_gain[j]; + } + } + } + + return; +} + + +/*------------------------------------------------------------------------- + * ivas_param_upmix_dec_decorr_subframes() + * + * + *------------------------------------------------------------------------*/ + +static void ivas_param_upmix_dec_decorr_subframes( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const int16_t nSamplesForRendering) +{ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + float *pPcm_tmp[MC_PARAMUPMIX_COMBINATIONS]; + float *p_tc[MC_PARAMUPMIX_COMBINATIONS]; + int16_t nchan_internal, ch; + int16_t nSamplesLeftForTD, default_frame; + + hMCParamUpmix = st_ivas->hMCParamUpmix; + assert(hMCParamUpmix); + + push_wmops("ivas_param_upmix_dec_decorr_subframes"); + + /* TD decorrelator */ + default_frame = (int16_t)(st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC); + nSamplesLeftForTD = nSamplesForRendering; + nchan_internal = MC_PARAMUPMIX_COMBINATIONS; + + for (ch = 0; ch < nchan_internal; ch++) + { + pPcm_tmp[ch] = st_ivas->hTcBuffer->tc[ch + 8]; + p_tc[ch] = st_ivas->hTcBuffer->tc[ch + 4]; + } + + while (nSamplesLeftForTD) + { + int16_t nSamplesToDecorr = min(nSamplesLeftForTD, default_frame); + + paramupmix_td_decorr_process_jbm(hMCParamUpmix->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr); + + for (ch = 0; ch < nchan_internal; ch++) + { + p_tc[ch] += nSamplesToDecorr; + } + + nSamplesLeftForTD -= nSamplesToDecorr; + } + + pop_wmops(); + return; +} + + +/*****************************************************************************************/ +/* local functions */ +/*****************************************************************************************/ + +static void ps_pred_process_sf( + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, + DECODER_TC_BUFFER_HANDLE hTcBuffer, + float qmf_mod_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* in/out */ + float qmf_mod_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* in/out */ + float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + float *param_interpol, + const int16_t ch, + const int16_t slots_rendered) +{ + float vmre, vmim, vsre, vsim; + int16_t iqmf, ipar, ismp, iismp; + float alpha_smp, beta_smp; + float *alpha1, *alpha2; + float *beta1, *beta2; + float *alpha_prev = hMCParamUpmix->alpha_prev[ch]; + float *beta_prev = hMCParamUpmix->beta_prev[ch]; + float *alpha_sf = hMCParamUpmix->alpha_sf[ch]; + float *beta_sf = hMCParamUpmix->beta_sf[ch]; + float dalpha, dbeta, ifac; + float alpha_start[IVAS_MAX_NUM_BANDS], beta_start[IVAS_MAX_NUM_BANDS]; + + const int16_t qmf_to_par_band[] = { + 0, 1, 2, 3, 4, 5, 5, 6, 6, 7, + 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, + 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 + }; + + mvr2r(alpha_sf, alpha_start, IVAS_MAX_NUM_BANDS); + mvr2r(beta_sf, beta_start, IVAS_MAX_NUM_BANDS); + for (iqmf = 0; iqmf < CLDFB_NO_CHANNELS_MAX; iqmf++) + { + ipar = qmf_to_par_band[iqmf]; + alpha1 = alpha_prev; + beta1 = beta_prev; + + ismp = 0; + alpha2 = hMCParamUpmix->alphas[ch]; + beta2 = hMCParamUpmix->betas[ch]; + alpha_smp = alpha_start[ipar]; + beta_smp = beta_start[ipar]; + + for (iismp = 0; iismp < hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered]; iismp++) + { + if ((slots_rendered == 0) && (iismp == 0)) + { + ifac = param_interpol[iismp]; + } + else + { + ifac = param_interpol[iismp] - param_interpol[iismp - 1]; + } + dalpha = (alpha2[ipar] - alpha1[ipar]) * ifac; + dbeta = (beta2[ipar] - beta1[ipar]) * ifac; + + alpha_smp += dalpha; + beta_smp += dbeta; + + vmre = qmf_mod_re[ismp][iqmf]; + vmim = qmf_mod_im[ismp][iqmf]; + vsre = qmf_side_re[ismp][iqmf]; + vsim = qmf_side_im[ismp][iqmf]; + + qmf_side_re[ismp][iqmf] = alpha_smp * vmre + beta_smp * vsre; + qmf_side_im[ismp][iqmf] = alpha_smp * vmim + beta_smp * vsim; + + ismp++; + } + alpha_sf[ipar] = alpha_smp; + beta_sf[ipar] = beta_smp; + } + + return; +} + + +static void ivas_mc_paramupmix_dec_sf( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + float *output_f[MAX_OUTPUT_CHANNELS] /* i/o: synthesized core-coder transport channels */ +) +{ + int16_t i, ch, slot_idx, k; + float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ + /*CLDFB*/ + float Cldfb_RealBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + int16_t noparamupmix_delay, n_samples_rendered; + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; + int16_t subframeIdx, idx_in, maxBand; + float Cldfb_RealBuffer_subfr[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_subfr[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + + hMCParamUpmix = st_ivas->hMCParamUpmix; + assert(hMCParamUpmix); + push_wmops("ivas_mc_paramupmix_dec_sf"); + + for (i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++) + { + pPcm_temp[2 * i] = output_f[i + 4]; /* un-decorrelated */ + pPcm_temp[2 * i + 1] = output_f[i + 8]; /* decorrelated */ + } + + /* CLDFB Analysis*/ + for (ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++) + { + /* slot loop for gathering the input data */ + for (slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++) + { + cldfbAnalysis_ts_ivas(&(pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx]), Cldfb_RealBuffer[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], hMCParamUpmix->num_freq_bands, st_ivas->cldfbAnaDec[ch]); + } + } + for (ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++) + { + ps_pred_process_sf(hMCParamUpmix, + st_ivas->hTcBuffer, + Cldfb_RealBuffer[2 * ch], /* in/out */ + Cldfb_ImagBuffer[2 * ch], + Cldfb_RealBuffer[2 * ch + 1], /* in/out decorr */ + Cldfb_ImagBuffer[2 * ch + 1], + &hMCParamUpmix->param_interpolator[st_ivas->hTcBuffer->slots_rendered], + ch, + st_ivas->hTcBuffer->slots_rendered); + + /*-- m, s -> l, r ----------------------------*/ + for (slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++) + { + for (k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) + { + float qlre = Cldfb_RealBuffer[2 * ch][slot_idx][k]; + float qlim = Cldfb_ImagBuffer[2 * ch][slot_idx][k]; + float qrre = Cldfb_RealBuffer[2 * ch + 1][slot_idx][k]; + float qrim = Cldfb_ImagBuffer[2 * ch + 1][slot_idx][k]; + + Cldfb_RealBuffer[2 * ch][slot_idx][k] = qlre + qrre; + Cldfb_ImagBuffer[2 * ch][slot_idx][k] = qlim + qrim; + Cldfb_RealBuffer[2 * ch + 1][slot_idx][k] = qlre - qrre; + Cldfb_ImagBuffer[2 * ch + 1][slot_idx][k] = qlim - qrim; + } + } + } + + if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) + { + maxBand = (int16_t)((CLDFB_NO_CHANNELS_MAX * st_ivas->hDecoderConfig->output_Fs) / 48000); + subframeIdx = st_ivas->hTcBuffer->subframes_rendered; + /* fastconv binaural rendering and CLDFB synthesis */ + /* cldfb analysis of non-coupled, non-LFE channels */ + idx_in = 0; + for (ch = 0; ch < MC_PARAMUPMIX_MAX_INPUT_CHANS - 2 * MC_PARAMUPMIX_COMBINATIONS; ch++) + { + if (st_ivas->hIntSetup.index_lfe[0] != ch) + { + pPcm_temp[ch] = output_f[ch]; + /* slot loop for gathering the input data */ + for (slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++) + { + cldfbAnalysis_ts_ivas(&(pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx]), + Cldfb_RealBuffer_subfr[idx_in][slot_idx], + Cldfb_ImagBuffer_subfr[idx_in][slot_idx], + maxBand, st_ivas->cldfbAnaDec[2 * MC_PARAMUPMIX_COMBINATIONS + idx_in]); + } + idx_in++; + } + } + + /* copy and reorder cldfb analysis of coupled channels */ + for (ch = 0; ch < MAX_PARAM_SPATIAL_SUBFRAMES; ch++) + { + for (slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++) + { + mvr2r(Cldfb_RealBuffer[MC_PARAMUPMIX_CHIDX1[ch]][slot_idx], Cldfb_RealBuffer_subfr[idx_in][slot_idx], CLDFB_NO_CHANNELS_MAX); + mvr2r(Cldfb_ImagBuffer[MC_PARAMUPMIX_CHIDX1[ch]][slot_idx], Cldfb_ImagBuffer_subfr[idx_in][slot_idx], CLDFB_NO_CHANNELS_MAX); + mvr2r(Cldfb_RealBuffer[MC_PARAMUPMIX_CHIDX2[ch]][slot_idx], Cldfb_RealBuffer_subfr[idx_in + 1][slot_idx], CLDFB_NO_CHANNELS_MAX); + mvr2r(Cldfb_ImagBuffer[MC_PARAMUPMIX_CHIDX2[ch]][slot_idx], Cldfb_ImagBuffer_subfr[idx_in + 1][slot_idx], CLDFB_NO_CHANNELS_MAX); + } + idx_in += 2; + } + + if (st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV) + { + for (slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++) + { + ivas_param_mc_mc2sba_cldfb(st_ivas->hTransSetup, hMCParamUpmix->hoa_encoder, slot_idx, Cldfb_RealBuffer_subfr, Cldfb_ImagBuffer_subfr, maxBand, GAIN_LFE); + } + } + + + /* Implement binaural rendering */ + ivas_binRenderer(st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], + Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, + Cldfb_RealBuffer_subfr, + Cldfb_ImagBuffer_subfr); + + + /* Implement CLDFB synthesis */ + for (ch = 0; ch < BINAURAL_CHANNELS; ch++) + { + float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + + for (slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++) + { + RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch][slot_idx]; + ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch][slot_idx]; + } + + cldfbSynthesis_ivas(RealBuffer, ImagBuffer, &(output_f[ch][0]), maxBand * st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], st_ivas->cldfbSynDec[ch]); + } + } + else + { + /* boxes = { 0 1 2 3 [4 6] [5 7] [8 10] [9 11] }; */ + pPcm_temp[0] = output_f[4]; + pPcm_temp[1] = output_f[6]; + pPcm_temp[2] = output_f[5]; + pPcm_temp[3] = output_f[7]; + pPcm_temp[4] = output_f[8]; + pPcm_temp[5] = output_f[10]; + pPcm_temp[6] = output_f[9]; + pPcm_temp[7] = output_f[11]; + + /* CLDFB synthesis */ + for (ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++) + { + for (slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++) + { + float *ptr_im[1], *ptr_re[1]; + ptr_re[0] = Cldfb_RealBuffer[ch][slot_idx]; + ptr_im[0] = Cldfb_ImagBuffer[ch][slot_idx]; + + cldfbSynthesis_ivas(ptr_re, ptr_im, &(pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx]), + hMCParamUpmix->num_freq_bands, st_ivas->cldfbSynDec[ch]); + } + } + /* adjust delay of other channels */ + noparamupmix_delay = NS2SA(st_ivas->hDecoderConfig->output_Fs, IVAS_FB_DEC_DELAY_NS); + n_samples_rendered = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered] * hMCParamUpmix->num_freq_bands; + if (n_samples_rendered > noparamupmix_delay) + { + for (ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++) + { + float tmp_buf[L_SUBFRAME5MS_48k]; + mvr2r(&output_f[ch][n_samples_rendered - noparamupmix_delay], tmp_buf, noparamupmix_delay); + mvr2r(output_f[ch], &output_f[ch][noparamupmix_delay], n_samples_rendered - noparamupmix_delay); + mvr2r(hMCParamUpmix->pcm_delay[ch], output_f[ch], noparamupmix_delay); + mvr2r(tmp_buf, hMCParamUpmix->pcm_delay[ch], noparamupmix_delay); + } + } + else + { + for (ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++) + { + float tmp_buf[L_SUBFRAME5MS_48k]; + mvr2r(&output_f[ch][0], tmp_buf, n_samples_rendered); + mvr2r(hMCParamUpmix->pcm_delay[ch], output_f[ch], n_samples_rendered); + mvr2r(&hMCParamUpmix->pcm_delay[ch][n_samples_rendered], &hMCParamUpmix->pcm_delay[ch][0], noparamupmix_delay - n_samples_rendered); + mvr2r(tmp_buf, &hMCParamUpmix->pcm_delay[ch][noparamupmix_delay - n_samples_rendered], n_samples_rendered); + } + } + } + + st_ivas->hTcBuffer->slots_rendered += st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; + st_ivas->hTcBuffer->subframes_rendered++; + + pop_wmops(); + return; +} + + +static int16_t huff_read( + Decoder_State *st, + const int16_t(*ht)[2]) +{ + int16_t node = 0; + uint16_t next_bit = 0; + + do + { + next_bit = st->bit_stream[st->next_bit_pos]; + st->next_bit_pos++; + node = ht[node][next_bit]; + } while (node > 0); + + return -(node + 1); +} + + +static void huffman_decode( + Decoder_State *st, + const PAR_TYPE parType, + int32_t *vq) +{ + const int16_t(*huff_node_table)[2]; + int16_t iv, nquant, offset; + + nquant = 0; + switch (parType) + { + case ALPHA: + nquant = ivas_mc_paramupmix_alpha_quant_table.nquant; + break; + case BETA: + nquant = ivas_mc_paramupmix_beta_quant_table[0].nquant; + break; + default: + assert(0); + } + + offset = nquant - 1; /* range of df [-(nquant - 1), nquant - 1] */ + + st->next_bit_pos++; + switch (parType) + { + case ALPHA: + huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.alpha; + break; + case BETA: + huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.beta; + break; + default: + huff_node_table = NULL; + assert(0); + } + vq[0] = huff_read(st, huff_node_table); + + switch (parType) + { + case ALPHA: + huff_node_table = ivas_mc_paramupmix_huff_nodes_df.alpha; + break; + case BETA: + huff_node_table = ivas_mc_paramupmix_huff_nodes_df.beta; + break; + default: + assert(0); + } + + for (iv = 1; iv < IVAS_MAX_NUM_BANDS; iv++) + { + vq[iv] = huff_read(st, huff_node_table) + vq[iv - 1] - offset; + } + + return; +} + + +static void dequant_alpha( + int32_t *vq, + float *v) +{ + int16_t iv; + const ACPL_QUANT_TABLE *quant_table = &ivas_mc_paramupmix_alpha_quant_table; + + for (iv = 0; iv < IVAS_MAX_NUM_BANDS; iv++) + { + v[iv] = quant_table->data[vq[iv]]; + } + + return; +} + + +static void dequant_beta( + int32_t *aq, + int32_t *bq, + float *beta) +{ + int16_t iv; + const ACPL_QUANT_TABLE *quant_table; + + for (iv = 0; iv < IVAS_MAX_NUM_BANDS; iv++) + { + quant_table = &ivas_mc_paramupmix_beta_quant_table[ivas_param_upmx_mx_qmap[aq[iv]]]; + beta[iv] = quant_table->data[bq[iv]]; + } + + return; +} + + +static void get_ec_data( + Decoder_State *st, + const PAR_TYPE parType, + int32_t *parQ, + int32_t *alphaQEnv, + float ab[IVAS_MAX_NUM_BANDS]) +{ + huffman_decode(st, parType, parQ); + + if (parType == ALPHA) + { + dequant_alpha(parQ, ab); + mvl2l(parQ, alphaQEnv, (int16_t)IVAS_MAX_NUM_BANDS); + } + else + { + dequant_beta(alphaQEnv, parQ, ab); + } + + return; +} + #endif \ No newline at end of file diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 215774f4a94430503230a1105c1c4abcb38e3d81..dd50a7ff120d9a246aeec3cf15b0df841f6fd450 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -2586,7 +2586,7 @@ static ivas_error ivas_mc_dec_reconfig( #ifdef IVAS_FLOAT_FIXED init_igf_dec( st->hIGFDec ); #if 1/*TODO: To be removed later(floating point initialization)*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; set_f( st->hIGFDec->igfData.pSpecFlatBuf, 0, IGF_START_MX ); @@ -2610,7 +2610,11 @@ static ivas_error ivas_mc_dec_reconfig( #if 1 HQ_core_dec_init_flt( st->hHQ_core ); #endif - HQ_core_dec_init(st->hHQ_core); +#ifdef IVAS_FLOAT_FIXED + HQ_core_dec_init_fx(st->hHQ_core); +#endif // IVAS_FLOAT_FIXED + + } /* check if we have a doubly used hTxcCfg, if so, allocate a distint one for the old MCT LFE channel */ @@ -2935,7 +2939,7 @@ static ivas_error ivas_mc_dec_reconfig( } else if ( st_ivas->hCrendWrapper == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) { -#if 1 /*Cleanup changes: float to fixed*/ +#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ RENDER_CONFIG_DATA *hRendCfg = st_ivas->hRenderConfig; HRTFS_CREND_HANDLE hSetOfHRTF = st_ivas->hSetOfHRTF; IF( hSetOfHRTF ) @@ -2976,8 +2980,8 @@ static ivas_error ivas_mc_dec_reconfig( { return error; } -#if 1 /*Cleanup changes: fixed to float*/ - IF( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) +#ifdef IVAS_FLOAT_FIXED/*Cleanup changes: fixed to float*/ + IF(st_ivas->hCrendWrapper && st_ivas->hCrendWrapper->hHrtfCrend != NULL ) { st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); st_ivas->hCrendWrapper->hHrtfCrend->latency_s = fixedToFloat( st_ivas->hCrendWrapper->hHrtfCrend->latency_s_fx, 31 ); diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index a5b542fa743629babed45c43ba63122e75d72c86..f6c4f3b33ea52c33e10692e2f7c55c77737f0c5b 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -235,7 +235,7 @@ static void dec_prm_tcx_sidebits_fx( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED static void dec_prm_tcx_sidebits( int16_t param[], /* o : decoded parameters */ Decoder_State *st, /* i/o: decoder memory state */ @@ -412,7 +412,7 @@ static void dec_prm_tcx_spec_fx( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED static void dec_prm_tcx_spec( Decoder_State *st, /* i/o: decoder memory state */ int16_t param[], /* o : decoded parameters */ @@ -672,7 +672,7 @@ void ivas_mdct_dec_side_bits_frame_channel_fx( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void ivas_mdct_dec_side_bits_frame_channel( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ @@ -2045,7 +2045,7 @@ void ivas_mdct_core_reconstruct_fx( #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * ivas_mdct_core_tns_ns() * diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index 4b2d93c35edbf21ad59953c0148a8036b9aff1cf..0c41700104e8fa14b91e3fb0b4c95045b4022c63 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -50,7 +50,7 @@ * - in CPE_DFT, post-processing on output channels * - in CPE_TD, post-processing on decoded channels before upmixing *-------------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void ivas_post_proc( SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index c9707338b7f4edbe17fa528d476b93b925ccf70e..65294906b1baf2f10a1ba61a8c19b01d5395f3f9 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -895,7 +895,7 @@ ivas_error ivas_sba_dec_reconfigure( return error; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ivas_sba_dec_digest_tc() * diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index d49c292a8d98d4c18ba519d8a883179ace7e31f5..e867dbaf88b5abd2eb94d02cee858f894a4ae255 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -346,7 +346,7 @@ ivas_error create_sce_dec( { st->is_ism_format = 1; } -#ifdef EVS_FLOAT +#ifndef IVAS_FLOAT_FIXED IF ( ( error = init_decoder( st, 0, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) #else if ( ( error = init_decoder_fx(st, EVS_MONO) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index 168be610c0a668df876df3fcccf3235aa7dc2a5b..d863391886c01cc7fc8c01a14984e75e88f7d912 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -426,7 +426,7 @@ ivas_error create_sce_dec( } } -//#ifdef EVS_FLOAT +//#ifndef IVAS_FLOAT_FIXED // IF( ( error = init_decoder_ivas_fx( st, 0, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) //#else // IF( ( error = init_decoder_fx( st, EVS_MONO ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 94dd189973d0e66ff774e2791874f41307bfe4ba..716c9570d38504e06a8b07a760d35c318d3b4a09 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -787,6 +787,7 @@ static Word16 get_random_number_fx( Word16 *seed ) { Word16 x = own_random2_fx( *seed ); + *seed = x; return x; } #endif // IVAS_FLOAT_FIXED @@ -1018,7 +1019,7 @@ void ivas_spar_get_cldfb_gains_fx( /* compute time-domain cross-fade for considered time slots*/ tmp_idx = sub( cf_start, imult1616( cf_cldfb_start, stride ) ); Word32 pFilterbank_cross_fade_fx[192];// Temporarily added to stored fixed value of hSpar->hFbMixer->pFilterbank_cross_fade_fx - floatToFixed_arrL( (Float32 *) hSpar->hFbMixer->pFilterbank_cross_fade, pFilterbank_cross_fade_fx, 31, cf_len ); + floatToFixed_arrL( hSpar->hFbMixer->pFilterbank_cross_fade, pFilterbank_cross_fade_fx, 31, cf_len ); FOR( sample = 0; sample < cf_len; sample++ ) { tgt_fx[tmp_idx++] = pFilterbank_cross_fade_fx[sample]; @@ -1068,7 +1069,7 @@ void ivas_spar_get_cldfb_gains_fx( /* target is synthesis output times the cross-fade window*/ FOR( sample = 0; sample < num_samples; sample++ ) { - tgt_fx[sample] = Mult_32_32( tgt_fx[sample], L_add( T_fx[sample][0], L_add( T_fx[sample][1], T_fx[sample][2] ) ) ); + tgt_fx[sample] = L_shl(Mult_32_32( tgt_fx[sample], L_add( T_fx[sample][0], L_add( T_fx[sample][1], T_fx[sample][2] ) ) ),10);/*Q31*/ } /* compute matrices */ FOR ( slot_row = 0; slot_row < num_cf_slots; slot_row++ ) @@ -1078,7 +1079,7 @@ void ivas_spar_get_cldfb_gains_fx( Tt_T_fx[slot_row][slot_col] = 0; FOR ( sample = 0; sample < num_samples; sample++ ) { - Tt_T_fx[slot_row][slot_col] =L_add( Tt_T_fx[slot_row][slot_col], Mult_32_32(T_fx[sample][slot_row],T_fx[sample][slot_col] ) ); + Tt_T_fx[slot_row][slot_col] =L_add( Tt_T_fx[slot_row][slot_col], Mult_32_32(L_shl(T_fx[sample][slot_row],8), L_shl(T_fx[sample][slot_col],8) ) );/*Q58-Q31*/ } } } @@ -1094,7 +1095,7 @@ void ivas_spar_get_cldfb_gains_fx( Tt_tgt_fx[slot_row] = L_add(Tt_tgt_fx[slot_row],Mult_32_32(T_fx[sample][slot_row] , tgt_fx[sample])); } } - Word16 output_q = 0; + Word16 output_q = 27; matrix_inverse_fx( Tt_T_fx, Tt_T_inv_fx, num_cf_slots, &output_q ); /* compute the optimal coefficients */ FOR ( slot_row = 0; slot_row < num_cf_slots; slot_row++ ) @@ -1104,8 +1105,9 @@ void ivas_spar_get_cldfb_gains_fx( { tmp = L_add(tmp,Mult_32_32(Tt_T_inv_fx[slot_row][slot_col] , Tt_tgt_fx[slot_col])); } - weights_fx[add(cf_cldfb_start , slot_row)] = s_max( s_min( (Word16)tmp, (1<< (output_q-20)) ), 0 ); + weights_fx[add(cf_cldfb_start , slot_row)] = L_shr(L_max( L_min( tmp, L_shl(1, (output_q-10)) ), 0 ), output_q - 10- Q_weights);/*Q_weights*/ } + hSpar->hFbMixer->cldfb_cross_fade_q = Q_weights; cldfb_reset_memory_fx( cldfbSynDec0 ); cldfb_reset_memory_fx( cldfbAnaDec0 ); @@ -1687,6 +1689,7 @@ static ivas_error ivas_spar_dec_MD( * * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static Word16 ivas_spar_get_cldfb_slot_gain_fx( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ @@ -1774,6 +1777,7 @@ static Word16 ivas_spar_get_cldfb_slot_gain_fx( return weight_fx; } +#endif static float ivas_spar_get_cldfb_slot_gain( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ @@ -1825,13 +1829,12 @@ static float ivas_spar_get_cldfb_slot_gain( } - /*-------------------------------------------------------------------* * ivas_spar_get_parameters() * * *-------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void ivas_spar_get_parameters_fx( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ @@ -1890,7 +1893,7 @@ void ivas_spar_get_parameters_fx( return; } - +#endif void ivas_spar_get_parameters( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ @@ -1944,7 +1947,6 @@ void ivas_spar_get_parameters( return; } - /*-------------------------------------------------------------------* * ivas_spar_get_skip_mat() * diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 2a0f4457cbafc376be6d559745d0819f3ee38e0e..4c0440547ec526894203dfff27c9fb2508900dec 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -453,7 +453,7 @@ typedef struct stereo_td_dec_data_structure int16_t tdm_lp_reuse_flag; /* Flag that indicate if it is possible to reuse the LP coefficient from the primary channel or not */ int16_t tdm_low_rate_mode; /* secondary channel low rate mode flag */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float tdm_Pri_pitch_buf[NB_SUBFR]; #endif Word16 tdm_Pri_pitch_buf_fx[NB_SUBFR]; @@ -627,7 +627,7 @@ typedef struct stereo_icbwe_dec_data_structure Word16 icbweM2Ref_prev_fx; /* Q14 */ #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float nlExc16k[L_FRAME16k]; float mixExc16k[L_FRAME16k]; float shbSynthRef[L_FRAME16k]; @@ -638,7 +638,7 @@ typedef struct stereo_icbwe_dec_data_structure Word16 shbSynthRef_fx[L_FRAME16k]; /* Q(st->prev_Qx) */ #endif Word16 MSFlag; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lpSHBRef[LPC_SHB_ORDER + 1]; float gshapeRef[NUM_SHB_SUBFR]; float gFrameRef; @@ -1049,7 +1049,7 @@ typedef struct sce_dec_data_structure /* core coder handle */ DEC_CORE_HANDLE hCoreCoder[1]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_hb_synth[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* HB synthesis synchro buffer */ #endif float *save_synth; @@ -1082,7 +1082,7 @@ typedef struct cpe_dec_data_structure int16_t stereo_switching_counter; int16_t NbFrameMod; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lt_es_em; #endif /* core coder handle */ @@ -1098,7 +1098,7 @@ typedef struct cpe_dec_data_structure STEREO_CNG_DEC_HANDLE hStereoCng; /* Stereo CNG data structure */ int16_t nchan_out; /* number of output channels (1: mono dmx, 2: default stereo) */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_hb_synth[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; float *prev_synth_chs[CPE_CHANNELS]; #endif @@ -1131,7 +1131,7 @@ typedef struct cpe_dec_data_structure #endif /* buffers used for fading between MDCT and DFT Stereo */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_out_mdct[STEREO_MDCT2DFT_FADE_LEN_48k]; float old_outLB_mdct[2 * STEREO_MDCT2DFT_FADE_LEN_48k]; #endif diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 8858b52ef500f1d20ea12df7c7354ddb4350e3d7..03b0c9fec65081247030da423af708deefff4177 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -138,7 +138,7 @@ void stereo_dft_dec_reset_fx( hStereoDft->stab_fac_smooth_res_fx = 0; move16(); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED bass_psfilter_init( hStereoDft->hBpf ); #endif tcxltp_dec_init( hStereoDft->hTcxLtpDec, 0, MODE1, IVAS_CPE_DFT, PIT_MAX, 12800 ); diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 536f216c7307a073ce5b9c63dee834c020bf76a6..989d3a3eabdfca1087ac8c8d4eafb352a20600ef 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -63,7 +63,7 @@ static ivas_error allocate_CoreCoder_TCX( DEC_CORE_HANDLE st /* i/o: Core decoder state structure */ ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if ( st->hTcxDec == NULL ) { if ( ( st->hTcxDec = (TCX_DEC_HANDLE) malloc( sizeof( TCX_DEC_DATA ) ) ) == NULL ) @@ -190,7 +190,7 @@ static ivas_error allocate_CoreCoder_TCX_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for HQ core\n" ) ); } - HQ_core_dec_init( st->hHQ_core ); + HQ_core_dec_init_fx( st->hHQ_core ); #if 1 // TODO: To be removed later HQ_core_dec_init_flt( st->hHQ_core ); #endif @@ -349,7 +349,7 @@ static ivas_error allocate_CoreCoder_fx( st->psf_lp_noise_fx = 0; move16(); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED Init_post_filter_ivas( st->hPFstat ); st->psf_lp_noise = 0.0f; #endif @@ -1398,7 +1398,7 @@ ivas_error stereo_memory_dec_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HQ core\n" ) ); } - HQ_core_dec_init( st->hHQ_core ); + HQ_core_dec_init_fx( st->hHQ_core ); #if 1 // TODO: to be removed later HQ_core_dec_init_flt( st->hHQ_core ); #endif @@ -3318,10 +3318,10 @@ void stereo_switching_dec( sts[1]->prev_bfi = sts[0]->prev_bfi; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f(sts[1]->old_pitch_buf, (float)L_SUBFR, 2 * NB_SUBFR16k); sts[1]->old_fpitchFB_float = 2 * (float) L_SUBFR; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED // fix need to do correctly set32_fx( sts[1]->old_pitch_buf_fx, L_deposit_h( L_SUBFR ), 2 * NB_SUBFR16k ); @@ -3374,9 +3374,9 @@ void stereo_switching_dec( mvr2r( sts[0]->hHQ_core->old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); //mvr2r( sts[0]->hTcxDec->old_syn_Overl_float, sts[1]->hTcxDec->old_syn_Overl_float, 256 ); #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED mvr2r(sts[0]->delay_buf_out, sts[1]->delay_buf_out, HQ_DELTA_MAX * HQ_DELAY_COMP); -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED // 32bit buffer Copy32( sts[0]->hHQ_core->oldOut_fx, sts[1]->hHQ_core->oldOut_fx, L_FRAME48k ); @@ -3408,7 +3408,7 @@ void stereo_switching_dec( sts[1]->pit_res_max = sts[0]->pit_res_max; sts[1]->pit_res_max_past = sts[0]->pit_res_max_past; sts[1]->hTcxDec->L_frameTCX = sts[0]->hTcxDec->L_frameTCX; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED sts[1]->hTcxDec->conceal_eof_gain_float = sts[0]->hTcxDec->conceal_eof_gain_float; #endif sts[1]->hTcxDec->conceal_eof_gain = sts[0]->hTcxDec->conceal_eof_gain; @@ -4151,7 +4151,7 @@ static Word32 ncross_corr_self_fx( c_c_fx_return = (Word32)c_c_fx; return c_c_fx_return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Function smooth_dft2td_transition() * diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 70b2bd2944b18cbb129e7294307d2f510bf334da..d46fa681e6ad39eb7b8ac907bfcfd1f2bb86f0a5 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -156,7 +156,7 @@ void stereo_tcx_init_dec_fx( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void stereo_tcx_init_dec( Decoder_State *st, /* i/o: decoder state structure */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ @@ -1579,7 +1579,7 @@ static void dec_prm_tcx( return; } #endif // IVAS_FLOAT_FIXED -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * Function stereo_tcx_dec_mode_switch_reconf() * diff --git a/lib_dec/ivas_td_low_rate_dec.c b/lib_dec/ivas_td_low_rate_dec.c index 17ece8eb856e10eb604e118aa1a12b74a90c31ee..4b8ed6467a62947a2c3c38eefa15b9efdc46487b 100644 --- a/lib_dec/ivas_td_low_rate_dec.c +++ b/lib_dec/ivas_td_low_rate_dec.c @@ -42,7 +42,7 @@ #include "prot_fx2.h" #include "ivas_prot.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tdm_low_rate_dec() * @@ -357,7 +357,7 @@ void tdm_low_rate_dec_fx( * * Decode generic (GC), 2 subframes mode *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void decod_gen_2sbfr( Decoder_State *st, /* i/o: decoder static memory */ const int16_t sharpFlag, /* i : formant sharpening flag */ diff --git a/lib_dec/jbm_jb4sb.c b/lib_dec/jbm_jb4sb.c index 640c322839b08adf39bb2415763186c5079230d5..f0a01be30b475639d616990d0b2e124b66f36106 100644 --- a/lib_dec/jbm_jb4sb.c +++ b/lib_dec/jbm_jb4sb.c @@ -862,16 +862,16 @@ static void JB4_adaptActivePlayout( { IF ( convertToLateLoss ) { -#ifdef EVS_FLOAT +#ifndef IVAS_FLOAT_FIXED JB4_dropFromBuffer( h ); #else JB4_dropFromBuffer( h ); h->nLostOrStretched = L_add( h->nLostOrStretched, 1 ); -#endif // EVS_FLOAT +#endif } ELSE IF ( dropEarly ) { -#ifdef EVS_FLOAT +#ifndef IVAS_FLOAT_FIXED JB4_dropFromBuffer( h ); ++h->nLostOrStretched; #else diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 29e736952537fe63611fa3d5e66fc21edcb68a4c..f57b003075ef9d55275e599ffe651ac8f8b0fa50 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -338,7 +338,7 @@ bool apa_set_rate( /* (the resulting maximum pitch is then p_min+l_search = 240 samples at 16 kHz) */ ps->l_search = ( ps->rate / 80 ) * ps->num_channels; -#if 1//ndef EVS_FLOAT +#if 1 ps->win_fx = pcmdsp_window_hann_640; move16(); ps->l_halfwin_fx = 320; @@ -1486,7 +1486,7 @@ static bool shrink_frm( /* only 2nd input frame is used */ frm_in += l_frm; -#if 1//ndef EVS_FLOAT +#if 1 Word16 frm_in_fx[960*4]; for ( i = 0; i < l_frm/*960*ps->num_channels*/; i++ ) { @@ -1502,7 +1502,7 @@ static bool shrink_frm( } /* calculate overlap position */ -#if 1//ndef EVS_FLOAT +#ifdef IVAS_FLOAT_FIXED if ( isSilence_fx( frm_in_fx, l_seg, 10 ) ) #else if ( isSilence( frm_in, l_seg, 10 ) ) @@ -1542,7 +1542,7 @@ static bool shrink_frm( else { /* find synch */ -#if 1//ndef EVS_FLOAT +#if 1 Word16 energyQ8; Word32 qualityQ16=0; //ps->signalScaleForCorrelation += 2; @@ -1596,16 +1596,6 @@ static bool shrink_frm( { return 1; } -#if 0//def EVS_FLOAT - if ( ps->evs_compat_mode == true ) - { - overlapAddEvs( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); - } - else - { - overlapAdd_ivas( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); - } -#else Word16 frm_out_fx[960*8]; IF ( ps->evs_compat_mode == true ) { @@ -1618,7 +1608,6 @@ static bool shrink_frm( } for ( i = 0; i < l_seg; i++ ) frm_out[i] = (float)frm_out_fx[i]; -#endif // EVS_FLOAT } else { @@ -1762,7 +1751,7 @@ static bool extend_frm( over[n] = 0; /* don't search/overlap (just copy down) */ } } -#if 1//ndef EVS_FLOAT +#if 1 Word16 frm_in_fx[1920*2*2*2]; Word16 max_flag = 0; for ( i = 0; i < 2*l_frm; i++ ) @@ -1782,12 +1771,12 @@ static bool extend_frm( frm_in_fx[i] = (Word16) frm_in[i]; } } -#endif // !EVS_FLOAT +#endif if ( over[n] ) { /* calculate overlap position */ -#if 1//ndef EVS_FLOAT +#ifdef IVAS_FLOAT_FIXED if ( isSilence_fx( frm_in_fx, l_seg, 10 ) ) #else if ( isSilence( frm_in, l_seg, 10 ) ) @@ -1807,7 +1796,7 @@ static bool extend_frm( } else { -#if 1//ndef EVS_FLOAT +#if 1 Word16 energyQ8=0,*frmInScaled; Word32 qualityQ16=0; frmInScaled = ps->frmInScaled; @@ -1879,16 +1868,6 @@ static bool extend_frm( fadeOut = frm_in + l_frm + xtract[n - 1] + l_seg; fadeIn = frm_in + l_frm + xtract[n]; out = frm_out + ( n - 2 ) * l_seg; -#if 0//def EVS_FLOAT - if ( ps->evs_compat_mode == true ) - { - overlapAddEvs( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); - } - else - { - overlapAdd_ivas( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); - } -#else Word16 fadeOut_fx[960*8], fadeIn_fx[960*8], out_fx[960*8]; for ( i = 0; i < l_seg; i++ ) { @@ -1906,7 +1885,6 @@ static bool extend_frm( } for ( i = 0; i < l_seg; i++ ) out[i] = (float) out_fx[i]; -#endif // EVS_FLOAT } else { diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.c b/lib_dec/jbm_pcmdsp_similarityestimation.c index 6bb1c3eee061817fb0d5b7188e4bbc8095230617..a90d4412c17bee8e2e3ca28da446063f1dbb809d 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation.c @@ -66,7 +66,6 @@ float cross_correlation_self( return c_c; } -#if 1//ndef EVS_FLOAT void scaleSignal16( const Word16 *src, Word16 *dst, Word16 n, Word16 rightShift ) { Word16 i; @@ -77,7 +76,6 @@ void scaleSignal16( const Word16 *src, Word16 *dst, Word16 n, Word16 rightShift move16(); } } -#endif // !EVS_FLOAT /* Calculates cross correlation coefficient for template segment. */ Word32 cross_correlation_subsampled_self_fx( const Word16 *signal, Word16 x, diff --git a/lib_dec/jbm_pcmdsp_window.c b/lib_dec/jbm_pcmdsp_window.c index b4cfb9eb1a9ed4d74d4f6a20960293c68a104e52..40a2a366480a62107ce1cd568e6e6db3ba4cd2c8 100644 --- a/lib_dec/jbm_pcmdsp_window.c +++ b/lib_dec/jbm_pcmdsp_window.c @@ -76,7 +76,6 @@ void hannWindow( * Overlap/Add of two signal with a given window *-----------------------------------------------------------------------*/ -#if 1//ndef EVS_FLOAT void overlapAdd( const Word16 *fadeOut, const Word16 *fadeIn, Word16 *out, Word16 n, Word16 nChannels, const Word16 *fadeOutWin, const Word16 *fadeInWin, Word16 hannIncrementor ) { Word32 fdOutVal, fdInVal; @@ -102,7 +101,7 @@ void overlapAdd( const Word16 *fadeOut, const Word16 *fadeIn, Word16 *out, Word1 } } } -#endif // EVS_FLOAT + void overlapAdd_ivas( const float *fadeOut, const float *fadeIn, diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 1c3f4593ac898285d7cf2f1663eeee47fd66cd45..6433f5a7a4f77d002e1f1a7178b23d559938f52d 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2757,17 +2757,17 @@ static ivas_error evs_dec_main( { p_output[ch] = st_ivas->p_output_f[ch]; } -#ifndef EVS_FLOAT +#ifdef IVAS_FLOAT_FIXED Word16 output_16[L_FRAME48k]; -#endif // !EVS_FLOAT +#endif /* run the main EVS decoding routine */ if ( hCoreCoder[0]->codec_mode == MODE1 ) { if ( hCoreCoder[0]->Opt_AMR_WB ) { -#ifdef EVS_FLOAT - if ( ( error = amr_wb_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0] ) ) != IVAS_ERR_OK ) +#ifndef IVAS_FLOAT_FIXED + if ( ( error = amr_wb_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0] ) ) != IVAS_ERR_OK ) #else if ( ( error = amr_wb_dec_fx(output_16, hCoreCoder[0]) ) != IVAS_ERR_OK ) #endif @@ -2777,7 +2777,7 @@ static ivas_error evs_dec_main( } else { -#ifdef EVS_FLOAT +#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 ) #else if ( ( error = evs_dec_fx(hCoreCoder[0], output_16, FRAMEMODE_NORMAL) ) != IVAS_ERR_OK ) @@ -2791,7 +2791,7 @@ static ivas_error evs_dec_main( { if ( hCoreCoder[0]->bfi == 0 ) { -#ifdef EVS_FLOAT +#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 ) #else if ( ( error = evs_dec_fx(hCoreCoder[0], output_16, FRAMEMODE_NORMAL)) != IVAS_ERR_OK ) @@ -2802,7 +2802,7 @@ static ivas_error evs_dec_main( } else if ( hCoreCoder[0]->bfi == 2 ) { -#ifdef EVS_FLOAT +#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 ) #else if ( ( error = evs_dec_fx(hCoreCoder[0], output_16, FRAMEMODE_FUTURE)) != IVAS_ERR_OK ) @@ -2813,7 +2813,7 @@ static ivas_error evs_dec_main( } else { -#ifdef EVS_FLOAT +#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 ) #else if ( ( error = evs_dec_fx(hCoreCoder[0], output_16, FRAMEMODE_MISSING)) != IVAS_ERR_OK ) @@ -2832,7 +2832,7 @@ static ivas_error evs_dec_main( v_multc( p_output[0], mixer_rigth, p_output[1], nOutSamples ); v_multc( p_output[0], mixer_left, p_output[0], nOutSamples ); } -#ifndef EVS_FLOAT +#ifdef IVAS_FLOAT_FIXED for (int i = 0; i < nOutSamples; i++) { p_output[0][i] = output_16[i]; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index d4864d2500cd6e0da5e14a8cec9801d1d6da0d9f..334bf62421da72bf7313555084fdb901ceccfb0c 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -2231,13 +2231,13 @@ ivas_error IVAS_DEC_VoIP_GetSamples( { return IVAS_ERR_UNKNOWN; } -#ifndef EVS_FLOAT +#ifdef IVAS_FLOAT_FIXED if ( GT_16( maxScaling, 20 ) ) { maxScaling = 20; move16(); } -#endif // !EVS_FLOAT +#endif maxScaling = maxScaling * hDecoderConfig->output_Fs / 1000; /* avoid time scaling multiple times in one sound card slot */ @@ -2857,17 +2857,17 @@ static ivas_error evs_dec_main( { p_output[ch] = st_ivas->p_output_f[ch]; } -#ifndef EVS_FLOAT +#ifdef IVAS_FLOAT_FIXED Word16 output_16[L_FRAME48k]; -#endif // !EVS_FLOAT +#endif /* run the main EVS decoding routine */ IF( EQ_16( hCoreCoder[0]->codec_mode, MODE1 ) ) { IF( hCoreCoder[0]->Opt_AMR_WB ) { -#ifdef EVS_FLOAT - IF( ( error = amr_wb_dec_flt( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0] ) ) != IVAS_ERR_OK ) +#ifndef IVAS_FLOAT_FIXED + IF( ( error = amr_wb_dec( hCoreCoder[0], st_ivas->mem_hp20_out[0], p_output[0] ) ) != IVAS_ERR_OK ) #else IF( ( error = amr_wb_dec_fx( output_16, hCoreCoder[0] ) ) != IVAS_ERR_OK ) #endif @@ -2877,7 +2877,7 @@ static ivas_error evs_dec_main( } ELSE { -#ifdef EVS_FLOAT +#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 ) #else IF( ( error = evs_dec_fx( hCoreCoder[0], output_16, FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) @@ -2891,7 +2891,7 @@ static ivas_error evs_dec_main( { IF( EQ_16( hCoreCoder[0]->bfi, 0 ) ) { -#ifdef EVS_FLOAT +#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 ) #else IF( ( error = evs_dec_fx( hCoreCoder[0], output_16, FRAMEMODE_NORMAL ) ) != IVAS_ERR_OK ) @@ -2902,7 +2902,7 @@ static ivas_error evs_dec_main( } ELSE IF( EQ_16( hCoreCoder[0]->bfi, 2 ) ) { -#ifdef EVS_FLOAT +#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 ) #else IF( ( error = evs_dec_fx( hCoreCoder[0], output_16, FRAMEMODE_FUTURE ) ) != IVAS_ERR_OK ) @@ -2913,7 +2913,7 @@ static ivas_error evs_dec_main( } ELSE { -#ifdef EVS_FLOAT +#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 ) #else IF( ( error = evs_dec_fx( hCoreCoder[0], output_16, FRAMEMODE_MISSING ) ) != IVAS_ERR_OK ) @@ -2932,7 +2932,7 @@ static ivas_error evs_dec_main( v_multc( p_output[0], mixer_rigth, p_output[1], nOutSamples ); v_multc( p_output[0], mixer_left, p_output[0], nOutSamples ); } -#ifndef EVS_FLOAT +#ifdef IVAS_FLOAT_FIXED FOR( Word16 i = 0; i < nOutSamples; i++ ) { p_output[0][i] = output_16[i]; diff --git a/lib_dec/lsf_dec.c b/lib_dec/lsf_dec.c index 11ed2e25f79172fd3b9b06a47a50b2bbaaa9c643..5ae2b382e53385b2af64e06a0d052b2c35162320 100644 --- a/lib_dec/lsf_dec.c +++ b/lib_dec/lsf_dec.c @@ -60,7 +60,7 @@ static void dqlsf_CNG( Decoder_State *st, float *lsf_q ); * * LSF decoder *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void lsf_dec( Decoder_State *st, /* i/o: State structure */ const int16_t tc_subfr, /* i : TC subframe index */ diff --git a/lib_dec/nelp_dec.c b/lib_dec/nelp_dec.c index d65de698588b18808a0f7666bac52bb2932e3de6..4f0c346f122851394a4e14e2bcd315e3df87d5b3 100644 --- a/lib_dec/nelp_dec.c +++ b/lib_dec/nelp_dec.c @@ -47,7 +47,7 @@ * * NELP decoder *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void nelp_decoder( Decoder_State *st, /* i/o: decoder static memory */ float *exc_nelp, /* o : adapt. excitation/total exc*/ diff --git a/lib_dec/pitch_extr.c b/lib_dec/pitch_extr.c index 941f4711b205c8a84c75a142ac5f2e0bec613dcf..8f13c5d13ba9ead7300f9077b9de723547bde979 100644 --- a/lib_dec/pitch_extr.c +++ b/lib_dec/pitch_extr.c @@ -44,7 +44,7 @@ #include "basop_util.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * Pitch prediction for frame erasure using linear fitting * *-----------------------------------------------------------------*/ diff --git a/lib_dec/post_dec.c b/lib_dec/post_dec.c index 4b8d13eaacb251ad7cf62ecd15040b7d97533349..4d9270dfb1b716f9bbb73f440c169c1201929d5d 100644 --- a/lib_dec/post_dec.c +++ b/lib_dec/post_dec.c @@ -53,7 +53,7 @@ static void bass_pf_1sf_delay( float *syn, const int16_t *T_sf, const float *gai * * Perform post-processing *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void post_decoder_flt( Decoder_State *st, /* i/o: decoder memory state pointer */ float synth_buf[], @@ -340,7 +340,7 @@ static void bass_pf_1sf_delay( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * cldfb_synth_set_bandsToZero_flt() * diff --git a/lib_dec/rst_dec.c b/lib_dec/rst_dec.c index f3b744c7be5b3756f996c27c703f60857b81aa9b..f84802ab10a86f8a53296acc13ad22673ebb486b 100644 --- a/lib_dec/rst_dec.c +++ b/lib_dec/rst_dec.c @@ -47,7 +47,7 @@ * * Reset decoder static variables in case of CNG frame *----------------------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void CNG_reset_dec( Decoder_State *st, /* i/o: decoder state structure */ float *pitch_buf, /* o : floating pitch for each subframe */ diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 3b6e633373212426afd34fc37105ecb4d83ace66..21cbd69b8a1fbd7f54edbee95b4ca52119776871 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -84,7 +84,7 @@ typedef struct Word16 olapBufferAna[FFTLEN]; Word16 olapBufferSynth2[FFTLEN]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msPeriodog_float[NPART_SHAPING]; /* Periodogram */ #endif Word32 msPeriodog[NPART_SHAPING]; /* Periodogram */ @@ -92,55 +92,55 @@ typedef struct Word16 msPeriodog_exp; /* Common exponent for fft and cldfb energies */ Word16 msPeriodog_exp_fft; Word16 msPeriodog_exp_cldfb; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msBminWin_float[NPART_SHAPING]; #endif Word32 msBminWin[NPART_SHAPING]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msBminSubWin_float[NPART_SHAPING]; #endif Word32 msBminSubWin[NPART_SHAPING]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msPsd_float[NPART_SHAPING]; /* Power Spectral Density estimate (i.e., smoothed periodogram) */ #endif Word16 msPsd[NPART_SHAPING]; /* Power Spectral Density estimate (i.e., smoothed periodogram) */ Word32 msPsd_fx[NPART_SHAPING]; /* Power Spectral Density estimate (i.e., smoothed periodogram) */ Word16 msPsd_exp_fft; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msAlpha_float[NPART_SHAPING]; /* Optimal smoothing parameter */ #endif Word32 msAlpha[NPART_SHAPING]; /* Optimal smoothing parameter */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msMinBuf_float[MSNUMSUBFR * NPART_SHAPING]; /* Buffer of minima */ #endif Word32 msMinBuf[MSNUMSUBFR*NPART_SHAPING]; /* Buffer of minima */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msCurrentMinOut_float[NPART_SHAPING]; #endif Word32 msCurrentMinOut[NPART_SHAPING]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msCurrentMin_float[NPART_SHAPING]; #endif Word32 msCurrentMin[NPART_SHAPING]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msCurrentMinSubWindow_float[NPART_SHAPING]; #endif Word32 msCurrentMinSubWindow[NPART_SHAPING]; int16_t msLocalMinFlag[NPART_SHAPING]; int16_t msNewMinFlag[NPART_SHAPING]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msPsdFirstMoment_float[NPART_SHAPING]; #endif Word16 msPsdFirstMoment[NPART_SHAPING]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msPsdSecondMoment_float[NPART_SHAPING]; #endif Word32 msPsdSecondMoment[NPART_SHAPING]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msNoiseFloor_float[NPART_SHAPING]; /* Estimated noise floor */ #endif Word16 msNoiseFloor[NPART_SHAPING]; /* Estimated noise floor */ @@ -149,11 +149,11 @@ typedef struct Word32 msNoiseEst[NPART_SHAPING]; /* Estimated noise level */ Word16 msNoiseEst_exp; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msLogPeriodog_float[NPART_SHAPING]; /* Periodogram */ #endif Word16 msLogPeriodog[NPART_SHAPING]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msLogNoiseEst_float[NPART_SHAPING]; /* Estimated noise level */ #endif Word16 msLogNoiseEst[NPART_SHAPING]; @@ -171,7 +171,7 @@ typedef struct Word16 psize_inv_shaping[NPART_SHAPING]; /* Inverse of partition sizes */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float psize_shaping_float[NPART_SHAPING]; /* Partition sizes */ float psize_inv_shaping_float[NPART_SHAPING]; /* Inverse of partition sizes */ float bandNoiseShape_float[FFTLEN2]; /* CNG spectral shape computed at the decoder */ @@ -180,14 +180,14 @@ typedef struct Word32 bandNoiseShape[FFTLEN2]; /* CNG spectral shape computed at the decoder */ Word16 bandNoiseShape_exp; /* exponent of bandNoiseShape */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float partNoiseShape_float[NPART]; /* CNG spectral shape computed at the decoder */ #endif Word32 partNoiseShape[NPART]; /* CNG spectral shape computed at the decoder */ Word16 partNoiseShape_exp; /* exponent of partNoiseShape */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float smoothed_psd[L_FRAME16k]; /* stereo CNA - periodogram smoothed with IIR filter */ float msPeriodog_ST[NPART_SHAPING]; /* stereo CNA - short-term periodogram */ #endif @@ -195,15 +195,15 @@ typedef struct Word16 msPeriodog_ST_exp; /* exponent of stereo CNA - short-term periodogram */ int16_t ms_last_inactive_bwidth; /* stereo CNA - bandwidth from the last inactive frame */ int16_t ms_cnt_bw_up; /* stereo CNA - downward counter of frames since the last NB->WB switch */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float cna_LR_LT; /* stereo CNA - long-term L/R correlation factor calculated on stereo upmix */ #endif Word16 cna_LR_LT_fx; /* stereo CNA - long-term L/R correlation factor calculated on stereo upmix */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float cna_ILD_LT; /* stereo CNA - long-term ILD factor calculated on stereo upmix */ #endif Word16 cna_ILD_LT_fx; /* stereo CNA - long-term ILD factor calculated on stereo upmix */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float cna_g_state[STEREO_DFT_BAND_MAX]; /* stereo CNA - side gains from the last inactive frame */ float cna_cm[STEREO_DFT_BAND_MAX]; /* stereo CNA - coherence from the last inactive frame */ #endif @@ -212,28 +212,28 @@ typedef struct int16_t cna_nbands; /* stereo CNA - number of frequency bands used by the CNA in DFT stereo mode */ int16_t cna_band_limits[STEREO_DFT_BAND_MAX + 1]; /* stereo CNA - band limits used by the CNA in DFT stereo mode */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float cna_act_fact; /* stereo CNA - long-term signal activity factor (0-1) */ #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float cna_rescale_fact; /* stereo CNA - CN energy re-scaling factor to maintain decoded energy */ #endif int16_t cna_seed; /* stereo CNA - seed for random CN generator */ int16_t flag_dtx_mode; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lp_speech_float; #endif Word32 lp_speech; /* format: Q9.23 */ Word16 q_lp_speech; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lp_noise_float; #endif Word32 lp_noise; /* format: Q9.23 */ Word16 q_lp_noise; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float msPeriodogBuf_float[MSBUFLEN * NPART_SHAPING]; #endif Word16 msPeriodogBuf[MSBUFLEN*NPART_SHAPING]; @@ -268,44 +268,44 @@ typedef struct int16_t Transient[MAX_POST_LEN]; int16_t TCX_Tonality[DEC_STATE_LEN]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float outx_new_n1; #endif Word16 outx_new_n1_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float nsapp_gain; #endif Word16 nsapp_gain_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float nsapp_gain_n; #endif Word16 nsapp_gain_n_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float data_reci2[L_FRAME_MAX]; #endif Word32 data_reci2_fx[L_FRAME_MAX]; Word16 data_reci2_scale; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float data_noise_float[L_FRAME_MAX]; #endif Word16 data_noise[L_FRAME_MAX]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ener_mean; #endif Word32 ener_mean_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ener; #endif Word32 ener_fx; int16_t zp; Word16 zp_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float recovery_gain_float; #endif Word16 recovery_gain; /*outside waveformadjustment: Q14 - insinde waveformadjustment: Q15*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float step_concealgain; #endif Word16 step_concealgain_fx; @@ -358,7 +358,7 @@ typedef struct Word16 phaseDiff[MAX_NUMBER_OF_IDX]; // Q12 /* This one can be stored with 16 bits in range 0..2*PI */ Word16 phase_currentFramePredicted[MAX_NUMBER_OF_IDX*GROUP_LENGTH]; // Q13 /* This one can be stored with 16 bits in range [-pi;pi] 2Q13, but the code has to be adapted to use moduo(2*PI) after adding */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED Float32 phaseDiff_float[MAX_NUMBER_OF_IDX]; /* This one can be stored with 16 bits in range 0..2*PI */ Float32 phase_currentFramePredicted_float[MAX_NUMBER_OF_IDX * GROUP_LENGTH]; /* This one can be stored with 16 bits in range 0..2*PI, but the code has to be adapted to use moduo(2*PI) after adding */ @@ -387,9 +387,9 @@ typedef struct tonalmdctconceal int16_t nNonZeroSamples; int16_t nScaleFactors; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lastPitchLag_float; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word32 lastPitchLag; blockData lastBlockData; @@ -421,29 +421,29 @@ typedef struct tonalmdctconceal float scaleFactorsBackground_flt[FDNS_NPTS]; //Word16 scaleFactorsBackground[FDNS_NPTS]; Word32 scaleFactorsBackground_fx[FDNS_NPTS]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float scf_fadeout_flt; #endif Word16 scf_fadeout; PsychoacousticParameters *psychParams; PsychoacousticParameters psychParamsTCX20; PsychoacousticParameters psychParamsTCX10; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float last_block_nrg_flt; #endif Word32 last_block_nrg; Word16 last_block_nrg_exp; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float curr_noise_nrg_flt; #endif Word32 curr_noise_nrg; Word16 curr_noise_nrg_exp; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float faded_signal_nrg_flt; #endif Word32 faded_signal_nrg; Word16 faded_signal_nrg_exp; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float nFramesLost_float; #endif Word16 nFramesLost; @@ -486,13 +486,13 @@ typedef struct igfdec_private_data_struct IGF_INFO igfInfo; /* envelope reconstruction: */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float igf_sN_float[IGF_MAX_SFB]; /* only with short blocks as static needed */ #endif Word32 igf_sN[IGF_MAX_SFB]; /* Q31 | only with short blocks as static needed */ Word16 igf_sN_e[IGF_MAX_SFB]; /* | exponent for igf_sN */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float igf_pN_float[IGF_MAX_SFB]; /* only with short blocks as static needed */ #endif Word32 igf_pN[IGF_MAX_SFB]; /* Q31 | only with short blocks as static needed */ @@ -506,7 +506,7 @@ typedef struct igfdec_private_data_struct int16_t igf_flatteningTrigger_subframe[IGF_MAX_SUBFRAMES]; /* spectral whitening: */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float *pSpecFlat_float; float pSpecFlatBuf[IGF_START_MX]; #endif @@ -520,7 +520,7 @@ typedef struct igfdec_private_data_struct int16_t prevWhiteningLevel[IGF_MAX_TILES]; /* needed for concealment */ int16_t currWhiteningLevel_subframe[IGF_MAX_SUBFRAMES][IGF_MAX_TILES]; int16_t prevWhiteningLevel_subframe[IGF_MAX_SUBFRAMES][IGF_MAX_TILES]; /* needed for concealment */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float totalNoiseNrg_float; #endif Word32 totalNoiseNrg; @@ -530,7 +530,7 @@ typedef struct igfdec_private_data_struct Word16 headroom_TCX_noise_white; Word16 headroom_TCX_noise; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float totalNoiseNrg_off_float; #endif Word32 totalNoiseNrg_off; @@ -559,7 +559,7 @@ typedef struct igfdec_instance_struct Word16 infoTCXNoise_evs[IGF_START_MX]; int16_t *flag_sparse; int16_t flag_sparseBuf[N_MAX_TCX - IGF_START_MN]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float *virtualSpec_float; // needed in MCT path float virtualSpecBuf[N_MAX_TCX - IGF_START_MN]; #endif @@ -579,7 +579,7 @@ typedef struct igfdec_instance_struct typedef struct tec_dec_structure { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float pGainTemp[CLDFB_NO_COL_MAX]; float loBuffer_flt[CLDFB_NO_COL_MAX + MAX_TEC_SMOOTHING_DEG]; #endif @@ -602,7 +602,7 @@ typedef struct tcx_ltp_dec_structure { /* TCX-LTP */ int16_t tcxltp; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float tcxltp_gain_float; #endif Word16 tcxltp_gain; @@ -628,9 +628,9 @@ typedef struct tcx_ltp_dec_structure int16_t tcxltp_pitch_int_post_prev; int16_t tcxltp_pitch_fr_post_prev; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float tcxltp_gain_post_prev_float; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 tcxltp_gain_post_prev; int16_t tcxltp_filt_idx_prev; @@ -648,10 +648,10 @@ typedef struct tcx_dec_structure int16_t envWeighted; /* are is{p,f}_old[] weighted or not? */ /* tonal PLC */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float tcxltp_second_last_pitch_float; float tcxltp_third_last_pitch_float; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word32 tcxltp_second_last_pitch; Word32 tcxltp_third_last_pitch; @@ -666,57 +666,57 @@ typedef struct tcx_dec_structure int16_t pit_max_TCX; int16_t L_frameTCX; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_excFB[L_FRAME48k]; /* old excitation FB */ #endif Word16 old_excFB_fx[L_FRAME48k]; /* old excitation FB */ int16_t old_synth_len; int16_t old_synth_lenFB; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_synth_float[OLD_SYNTH_INTERNAL_DEC]; /* synthesis memory */ #endif Word16 old_synth[OLD_SYNTH_INTERNAL_DEC]; /* synthesis memory */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float synth_history[L_PROT48k + L_FRAME_MAX]; /* unified synthesis memory */ #endif Word16 synth_history_fx[L_PROT48k + L_FRAME_MAX]; /*TCX unified synthesis memory */ Word16 q_synth_history_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float *old_synthFB; #endif Word16* old_synthFB_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float *prev_good_synth; #endif Word16* prev_good_synth_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_syn_Overl_float[L_FRAME32k / 2]; #endif Word16 old_syn_Overl[L_FRAME32k / 2]; Word32 old_syn_Overl_32[L_FRAME32k / 2]; Word16 Q_old_syn_Overl; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float syn_Overl_TDAC_float[L_FRAME32k / 2]; #endif Word16 syn_Overl_TDAC[L_FRAME32k / 2]; Word16 Q_syn_Overl_TDAC; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float syn_Overl_TDACFB_float[L_FRAME_MAX / 2]; #endif Word16 syn_Overl_TDACFB[L_FRAME_MAX / 2]; Word16 Q_syn_Overl_TDACFB; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float syn_Overl_float[L_FRAME32k / 2]; #endif Word16 syn_Overl[L_FRAME32k / 2]; Word16 Q_syn_Overl; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float syn_OverlFB_float[L_FRAME_MAX / 2]; #endif Word16 syn_OverlFB[L_FRAME_MAX / 2]; Word16 Q_syn_OverlFB; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float FBTCXdelayBuf_float[111]; /* 2.3125ms at 48kHz -> 111 samples */ #endif Word16 FBTCXdelayBuf[111]; /* 2.3125ms at 48kHz -> 111 samples */ @@ -729,7 +729,7 @@ typedef struct tcx_dec_structure /* PLC */ int16_t noise_filling_index[NB_DIV]; /* PLC - last decoded noise filling index */ int16_t tnsActive[NB_DIV]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ltpGainMemory[N_LTP_GAIN_MEMS]; /* for smoothing noiseTransWidth */ #endif Word16 ltpGainMemory_fx[N_LTP_GAIN_MEMS]; /* Q15 */ @@ -739,7 +739,7 @@ typedef struct tcx_dec_structure //Word32 CngLevelBackgroundTrace_bfi_fx; /* PLC - long term gain estimate for background level, used for PLC fade out */ //Word16 CngLevelBackgroundTrace_bfi_exp; /* state variables for the minimum statistics used for PLC */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float CngLevelBackgroundTrace_bfi; /* PLC - long term gain estimate for background level, used for PLC fade out */ float NoiseLevelMemory_bfi[PLC_MIN_STAT_BUFF_SIZE]; #endif @@ -751,7 +751,7 @@ typedef struct tcx_dec_structure Word16 conCngLevelBackgroundTrace; /* Q15 long term gain estimate for background level, used for PLC fade out */ Word16 conCngLevelBackgroundTrace_e; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float LastFrameLevel_bfi; #endif #ifdef IVAS_FLOAT_FIXED @@ -762,7 +762,7 @@ typedef struct tcx_dec_structure Word16 conNoiseLevelIndex; /*Q0*/ Word16 conCurrLevelIndex; /*Q0*/ Word16 conLastFrameLevel, conLastFrameLevel_e;/*Q15*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_gaintcx_bfi_float; float conceal_eof_gain_float; #endif @@ -772,22 +772,22 @@ typedef struct tcx_dec_structure #ifdef IVAS_FLOAT_FIXED //Word32 conceal_eof_gain32; /*have been created for further calculation */ #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float damping_float; #endif Word16 damping; /* 1Q14 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float gainHelper_float; #endif Word16 gainHelper, gainHelper_e; /*can be >1*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float stepCompensate_float; #endif Word16 stepCompensate, stepCompensate_e; int16_t tcxConceal_recalc_exc; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float cummulative_damping_tcx_float; #endif Word16 cummulative_damping_tcx; @@ -808,7 +808,7 @@ typedef struct gsc_dec_structure int16_t cor_strong_limit; /* AC mode (GSC) - Indicator about high spectral correlation per band */ //Word16 cor_strong_limit; /* AC mode (GSC) - Indicator about high spectral correlation per band */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_y_gain[MBANDS_GN16k]; /* AC mode (GSC) - AR mem for low rate gain quantization */ #endif Word16 old_y_gain_fx[MBANDS_GN16k]; /* AC mode (GSC) - AR mem for low rate gain quantization */ @@ -816,17 +816,17 @@ typedef struct gsc_dec_structure int16_t noise_lev; /* AC mode (GSC) - noise level */ //Word16 noise_lev; /* AC mode (GSC) - noise level Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lt_ener_per_band[MBANDS_GN16k]; #endif Word16 lt_ener_per_band_fx[MBANDS_GN16k]; /* Q12 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float Last_frame_ener; /* AC mode (GSC) - last frame energy */ #endif Word32 Last_frame_ener_fx; /* AC mode (GSC) - last frame energy */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float Last_GSC_spectrum[L_FRAME16k]; /* AC mode (GSC) - Last good GSC spectrum */ #endif Word16 Last_GSC_spectrum_fx[L_FRAME16k]; /* AC mode (GSC) - Last good GSC spectrum */ @@ -834,12 +834,12 @@ typedef struct gsc_dec_structure int16_t Last_GSC_pit_band_idx; /* AC mode (GSC) - Last pitch band index */ //Word16 Last_GSC_pit_band_idx; /* AC mode (GSC) - Last pitch band index Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float last_exc_dct_in[L_FRAME16k]; /* AC mode (GSC) - previous excitation */ #endif Word16 last_exc_dct_in_fx[L_FRAME16k]; /* AC mode (GSC) - previous excitation */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float last_ener; /* AC mode (GSC) - previous energy */ #endif Word16 last_ener_fx; /* AC mode (GSC) - previous energy */ @@ -857,12 +857,12 @@ typedef struct gsc_dec_structure typedef struct WI_dec_structure { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_exc2[L_EXC_MEM]; /* FEC - old excitation2 used in fast recovery */ #endif Word16 old_exc2_fx[L_EXC_MEM]; /* FEC - old excitation2 used in fast recovery */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_syn2[L_EXC_MEM]; /* FEC - old syn speech used in fast recovery */ #endif Word16 old_syn2_fx[L_EXC_MEM]; /* FEC - old syn speech used in fast recovery */ @@ -880,7 +880,7 @@ typedef struct WI_dec_structure typedef struct ld_music_postfilt_structure { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float LDm_mem_etot; /* LD music post-filter - total energy memory */ #endif Word16 LDm_mem_etot_fx; /* LD music post-filter - total energy memory */ @@ -894,37 +894,37 @@ typedef struct ld_music_postfilt_structure int16_t LDm_nb_thr_3; //Word16 LDm_nb_thr_3; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float dct_post_old_exc[DCT_L_POST - OFFSET2]; #endif Word16 dct_post_old_exc_fx[DCT_L_POST - OFFSET2]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float LDm_thres[4]; /* LD music post-filter - Classification threshold */ #endif Word16 LDm_thres_fx[4]; /* LD music post-filter - Classification threshold */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float LDm_lt_diff_etot[MAX_LT]; /* LD music post-filter - long-term total energy variation */ #endif Word16 LDm_lt_diff_etot_fx[MAX_LT]; /* LD music post-filter - long-term total energy variation */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float LDm_enh_lp_gbin[VOIC_BINS_HR]; /* LD music post-filter - smoothed suppression gain, per bin FFT */ #endif Word16 LDm_enh_lp_gbin_fx[VOIC_BINS_HR]; /* LD music post-filter - smoothed suppression gain, per bin FFT */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float LDm_enh_lf_EO[VOIC_BINS_HR]; /* LD music post-filter - old per bin E for previous half frame */ #endif Word32 LDm_enh_lf_EO_fx[VOIC_BINS_HR]; /* LD music post-filter - old per bin E for previous half frame */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float LDm_enh_min_ns_gain; /* LD music post-filter - minimum suppression gain */ #endif Word16 LDm_enh_min_ns_gain_fx; /* LD music post-filter - minimum suppression gain */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float LDm_bckr_noise[MBANDS_GN_LD]; /* LD music post-filter - background noise estimation per critical band */ #endif Word32 LDm_bckr_noise_fx[MBANDS_GN_LD]; /* LD music post-filter - background noise estimation per critical band */ @@ -946,17 +946,17 @@ typedef struct ld_music_postfilt_structure typedef struct bass_postfilt_structure { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float pst_old_syn[NBPSF_PIT_MAX]; /* Bass post-filter - old synthesis buffer 1 */ #endif Word16 pst_old_syn_fx[NBPSF_PIT_MAX]; /* Bass post-filter - old synthesis buffer 1 Q_syn2-1*/ Word16 q_pst_old_syn; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float pst_mem_deemp_err; /* Bass post-filter - filter memory of noise LP filter */ #endif Word16 pst_mem_deemp_err_fx; /* Bass post-filter - filter memory of noise LP filter Q_syn2-1*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float pst_lp_ener; /* Bass post-filter - long-term energy */ #endif Word16 pst_lp_ener_fx; /* Bass post-filter - long-term energy Q8*/ @@ -966,11 +966,11 @@ typedef struct bass_postfilt_structure int16_t vibrato_hist[L_TRACK_HIST]; /* Bass post-filter - History of frames declared as vibrato */ //Word16 vibrato_hist[L_TRACK_HIST]; /* Bass post-filter - History of frames declared as vibrato */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float psf_att; /* Bass post-filter - post filter attenuation factor */ #endif Word16 psf_att_fx; /* Bass post-filter - post filter attenuation factor */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_mean_pit[L_TRACK_HIST]; /* Bass post-filter - average pitch memory */ #endif Word16 mem_mean_pit_fx[L_TRACK_HIST]; /* Bass post-filter - average pitch memory */ @@ -988,7 +988,7 @@ typedef struct td_cng_dec_structure { int16_t cng_seed; /* DTX/CNG - seed for white noise random generator */ // Word16 cng_seed; /*CNG and DTX - seed for white noise random generator*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float Enew; /* DTX/CNG - decoded residual energy */ #endif Word32 Enew_fx; /* CNG and DTX - decoded residual energy Q6*/ @@ -1013,15 +1013,15 @@ typedef struct td_cng_dec_structure int32_t ho_sid_bw; /* DTX/CNG - SID bandwidth flags */ //Word32 ho_sid_bw; /* CNG and DTX - SID bandwidth flags */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ho_lsp_hist[HO_HIST_SIZE * M]; /* DTX/CNG - old LSP buffer for averaging */ #endif Word16 ho_lsp_hist_fx[HO_HIST_SIZE * M]; /* CNG and DTX - old LSP buffer for averaging */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ho_ener_hist[HO_HIST_SIZE]; /* DTX/CNG - energy buffer for averaging */ #endif Word32 ho_ener_hist_fx[HO_HIST_SIZE]; /* CNG and DTX - energy buffer for averaging */ /*Q6 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ho_env_hist[HO_HIST_SIZE * NUM_ENV_CNG]; #endif Word32 ho_env_hist_fx[HO_HIST_SIZE * NUM_ENV_CNG]; @@ -1036,15 +1036,15 @@ typedef struct td_cng_dec_structure int16_t ho_circ_ptr; /* DTX/CNG - pointer for averaging buffers */ //Word16 ho_circ_ptr; /* CNG and DTX - pointer for averaging buffers */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ho_lsp_circ[HO_HIST_SIZE * M]; /* DTX/CNG - old LSP buffer for averaging */ #endif Word16 ho_lsp_circ_fx[HO_HIST_SIZE * M]; /* CNG and DTX - old LSP buffer for averaging */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ho_ener_circ[HO_HIST_SIZE]; /* DTX/CNG - energy buffer for averaging */ #endif Word32 ho_ener_circ_fx[HO_HIST_SIZE]; /* CNG and DTX - energy buffer for averaging */ /* Q6 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ho_env_circ[HO_HIST_SIZE * NUM_ENV_CNG]; #endif Word32 ho_env_circ_fx[HO_HIST_SIZE * NUM_ENV_CNG]; @@ -1059,24 +1059,24 @@ typedef struct td_cng_dec_structure int16_t act_cnt2; /* DTX/CNG - counter of active frames for CNG_mode switching */ // Word16 act_cnt2; /* DTX/CNG - counter of active frames for CNG_mode switching */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_env[20]; #endif Word32 old_env_fx[20]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lp_env[20]; #endif Word32 lp_env_fx[20]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float exc_mem[24]; #endif Word16 exc_mem_fx[24]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float exc_mem1[30]; #endif Word16 exc_mem1_fx[30]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float interpol_3_2_cng_dec[INTERP_3_2_MEM_LEN]; /* SWB DTX/CNG parameters */ @@ -1085,17 +1085,17 @@ typedef struct td_cng_dec_structure float shb_lpcCNG[LPC_SHB_ORDER + 1]; #endif Word16 shb_lpcCNG_fx[LPC_SHB_ORDER + 1]; /* Assumed in Q12 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float shb_cng_gain; #endif Word16 shb_cng_gain_fx; /* Assumed in Q8 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float wb_cng_ener; float last_wb_cng_ener; float last_shb_cng_ener; #endif int16_t swb_cng_seed; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lsp_shb_prev_prev[LPC_SHB_ORDER]; float lsp_shb_prev[LPC_SHB_ORDER]; #endif @@ -1116,7 +1116,7 @@ typedef struct td_cng_dec_structure #endif int16_t burst_cnt; //Word16 burst_cnt; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float last_shb_ener; #endif #ifdef IVAS_FLOAT_FIXED @@ -1141,11 +1141,11 @@ typedef struct sc_vbr_dec_structure //Word16 firstTime_voiceddec; /*Q0*/ /* DTFS variables */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float dtfs_dec_a[MAXLAG_WI]; #endif Word16 dtfs_dec_a_fx[MAXLAG_WI]; /*Variable Q format in dtfs_dec_Q*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float dtfs_dec_b[MAXLAG_WI]; #endif Word16 dtfs_dec_b_fx[MAXLAG_WI]; /*Variable Q format in dtfs_dec_Q*/ @@ -1159,27 +1159,27 @@ typedef struct sc_vbr_dec_structure int16_t dtfs_dec_nH_4kHz; //Word16 dtfs_dec_nH_4kHz; /*Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float dtfs_dec_upper_cut_off_freq_of_interest; #endif Word16 dtfs_dec_upper_cut_off_freq_of_interest_fx; /*Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float dtfs_dec_upper_cut_off_freq; #endif Word16 dtfs_dec_upper_cut_off_freq_fx; /*Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ph_offset_D; #endif Word16 ph_offset_D_fx; /* normalized by 2Pi Q15*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lastLgainD; /* previous gain value for the low band */ #endif Word16 lastLgainD_fx; /* previous gain value for the low band Q11*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lastHgainD; /* previous gain value for the high band */ #endif Word16 lastHgainD_fx; /* previous gain value for the high band Q11 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lasterbD[NUM_ERB_WB]; /* previous amplitude spectrum (ERB) */ #endif Word16 lasterbD_fx[NUM_ERB_WB]; /* previous amplitude spectrum (ERB) Q13*/ @@ -1187,24 +1187,24 @@ typedef struct sc_vbr_dec_structure Word16 dtfs_dec_Q; /*Q0*/ /* NELP decoder variables */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float bp1_filt_mem_nb_dec[14]; #endif Word32 bp1_filt_mem_nb_dec_fx[14]; /* qfm currently Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float bp1_filt_mem_wb_dec[8]; #endif Word16 bp1_filt_mem_wb_dec_fx[8]; /* qfm currently Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float shape1_filt_mem_dec[20]; #endif Word16 shape1_filt_mem_dec_fx[10]; /* qfm currently Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float shape2_filt_mem_dec[20]; #endif Word16 shape2_filt_mem_dec_fx[10]; /* qfm currently Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float shape3_filt_mem_dec[20]; #endif Word16 shape3_filt_mem_dec_fx[10]; /* qfm currently Q0*/ @@ -1228,7 +1228,7 @@ typedef struct hq_nbfec_structure int16_t prev_last_core; /* !!! note: the parameter is identical to last_core in IVAS */ //Word16 prev_last_core; /* !!! note: the parameter is identical to last_core in IVAS */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float diff_energy; #endif Word16 diff_energy_fx; @@ -1249,27 +1249,27 @@ typedef struct hq_nbfec_structure int16_t old_Min_ind; //Word16 old_Min_ind; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_auOut_2fr[L_FRAME8k * 2]; #endif Word16 old_auOut_2fr_fx[L_FRAME8k * 2]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_out_pha[2][N_LEAD_NB]; /* FEC for HQ Core, 0-phase matching old_out, 1-overlapping original old_out and phase matching old_out*/ #endif Word16 old_out_pha_fx[2][N_LEAD_NB]; /* FEC for HQ Core, 0-phase matching old_out, 1-overlapping original old_out and phase matching old_out*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float ynrm_values[MAX_SB_NB][MAX_PGF]; #endif Word32 ynrm_values_fx[MAX_SB_NB][MAX_PGF]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float r_p_values[MAX_SB_NB][MAX_ROW]; #endif Word32 r_p_values_fx[MAX_SB_NB][MAX_ROW]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float Norm_gain[SFM_N_NB]; #endif Word16 Norm_gain_fx[SFM_N_NB]; @@ -1281,7 +1281,7 @@ typedef struct hq_nbfec_structure int16_t HQ_FEC_seed; //Word16 HQ_FEC_seed; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float energy_MA_Curr[2]; #endif Word16 energy_MA_Curr_fx[2]; @@ -1292,17 +1292,17 @@ typedef struct hq_nbfec_structure int16_t prev_sign_switch_2[HQ_FEC_SIGN_SFM]; //Word16 prev_sign_switch_2[HQ_FEC_SIGN_SFM]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_coeffs[L_FRAME8k]; /* HQ core - old coefficients (for FEC) */ #endif Word32 old_coeffs_fx[L_FRAME8k]; /* HQ core - old coefficients (for FEC) */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float oldIMDCTout[L_FRAME8k / 2]; #endif Word32 oldIMDCTout_fx[L_FRAME8k / 2]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_oldauOut[L_FRAME8k]; #endif Word16 prev_oldauOut_fx[L_FRAME8k]; @@ -1354,7 +1354,7 @@ typedef struct hq_dec_structure //int16_t no_att_hangover; Word16 no_att_hangover; /* Q0 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float energy_lt; #endif Word32 energy_lt_fx; /* Q13 */ @@ -1362,7 +1362,7 @@ typedef struct hq_dec_structure //int16_t hq_generic_seed; Word16 hq_generic_seed; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_noise_level[2]; #endif Word16 prev_noise_level_fx[2]; /* Q15 */ @@ -1373,7 +1373,7 @@ typedef struct hq_dec_structure //int16_t prev_R; /* the table of bit allocation of last frame */ Word16 prev_R; /* the table of bit allocation of last frame */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_coeff_out[L_HQ_WB_BWE]; /* the highest coefficients of last frame */ #endif int16_t prev_SWB_peak_pos[SPT_SHORTEN_SBNUM]; @@ -1384,18 +1384,18 @@ typedef struct hq_dec_structure //int16_t HqVoicing; Word16 HqVoicing; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float fer_samples[L_FRAME48k]; #endif Word16 fer_samples_fx[L_FRAME48k]; Word16 Q_fer_samples; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_normq[SFM_N_WB]; /* previous norms */ #endif Word32 prev_normq_fx[SFM_N_WB]; /* Q14 */ /* previous norms */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_env[SFM_N_WB]; /* previous noise envelopes */ #endif Word32 prev_env_fx[SFM_N_WB]; /* previous noise envelopes */ @@ -1403,12 +1403,12 @@ typedef struct hq_dec_structure Word16 prev_env_Q[SFM_N_WB]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float last_ni_gain[BANDS_MAX]; #endif Word32 last_ni_gain_fx[BANDS_MAX]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float last_env[BANDS_MAX]; #endif Word16 last_env_fx[BANDS_MAX]; @@ -1417,32 +1417,32 @@ typedef struct hq_dec_structure Word16 last_max_pos_pulse; /* pre-echo reduction */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float memfilt_lb; #endif Word16 memfilt_lb_fx; /* Q0 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mean_prev_hb; #endif Word32 mean_prev_hb_fx; /* Q0 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float smoothmem; #endif Word16 smoothmem_fx; /* Q15 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mean_prev; #endif Word32 mean_prev_fx; /* Q0 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mean_prev_nc; #endif Word32 mean_prev_nc_fx; /* Q0 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float wmold_hb; #endif Word16 wmold_hb_fx; /* Q15 */ @@ -1458,12 +1458,12 @@ typedef struct hq_dec_structure //int16_t prev_stab_hfe2; Word16 prev_stab_hfe2; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_ni_ratio; #endif Word16 prev_ni_ratio_fx; /* 15 */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_En_sb[NB_SWB_SUBBANDS]; #endif Word16 prev_En_sb_fx[NB_SWB_SUBBANDS]; /* QsEn(4) */ @@ -1476,7 +1476,7 @@ typedef struct hq_dec_structure //int16_t time_offs; Word16 time_offs; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float X_sav[PH_ECU_SPEC_SIZE]; #endif Word16 X_sav_fx[PH_ECU_SPEC_SIZE]; @@ -1489,12 +1489,12 @@ typedef struct hq_dec_structure //int16_t plocs[MAX_PLOCS]; Word16 plocs[MAX_PLOCS]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float plocsi[MAX_PLOCS]; #endif Word32 plocsi_fx[MAX_PLOCS]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float env_stab; #endif Word16 env_stab_fx; @@ -1505,12 +1505,12 @@ typedef struct hq_dec_structure //int16_t mem_env_delta_hqfec; Word16 mem_env_delta_hqfec; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float env_stab_plc; #endif Word16 env_stab_plc_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float env_stab_state_p[NUM_ENV_STAB_PLC_STATES]; #endif Word16 env_stab_state_p_fx[NUM_ENV_STAB_PLC_STATES]; @@ -1518,17 +1518,17 @@ typedef struct hq_dec_structure //int16_t envstabplc_hocnt; Word16 envstabplc_hocnt; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mag_chg_1st[LGW_MAX]; /* i/o: per band magnitude modifier for transients*/ #endif Word16 mag_chg_1st_fx[LGW_MAX]; /* i/o: per band magnitude modifier for transients*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float Xavg[LGW_MAX]; /* Frequency group average gain to fade to */ #endif Word16 Xavg_fx[LGW_MAX]; /* Frequency group average gain to fade to */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float beta_mute; /* Factor for long-term mute */ #endif Word16 beta_mute_fx; /* Factor for long-term mute */ @@ -1542,7 +1542,7 @@ typedef struct hq_dec_structure //int16_t oldHqVoicing; Word16 oldHqVoicing; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float oldgapsynth[L_FRAME48k]; #endif Word16 oldgapsynth_fx[L_FRAME48k]; @@ -1567,7 +1567,7 @@ typedef struct zero_bwe_dec_structure { int16_t seed2; /* HF (6-7kHz) BWE - seed for random signal generator */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_hp400[4]; /* HF (6-7kHz) BWE - hp400 filter memory */ float mem_hf[( L_FIR - 1 )]; /* HF (6-7kHz) BWE - band-pass filter memory */ @@ -1600,18 +1600,18 @@ typedef struct zero_bwe_dec_structure typedef struct td_bwe_dec_structure { /* states for the filters used in generating SHB excitation from WB excitation */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float state_lpc_syn[LPC_SHB_ORDER]; #endif Word16 state_lpc_syn_fx[LPC_SHB_ORDER]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_csfilt[2]; #endif Word32 mem_csfilt_fx[2]; /* states for the filters used in generating SHB signal from SHB excitation*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float state_syn_shbexc[L_SHB_LAHEAD]; float syn_overlap[L_SHB_LAHEAD]; /* overlap buffer used to Adjust SHB Frame Gain*/ #endif @@ -1621,28 +1621,28 @@ typedef struct td_bwe_dec_structure Word32 syn_overlap_fx_32[L_SHB_LAHEAD]; /* overlap buffer used to Adjust SHB Frame Gain*/ /* previous frame parameters for frame error concealment */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lsp_prevfrm[LPC_SHB_ORDER]; #endif Word16 lsp_prevfrm_fx[LPC_SHB_ORDER]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float GainFrame_prevfrm; #endif Word32 GainFrame_prevfrm_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float GainShape_Delay[NUM_SHB_SUBFR / 2]; #endif Word16 GainShape_Delay_fx[NUM_SHB_SUBFR / 2]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float GainAttn; #endif Word16 GainAttn_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_bwe_exc[PIT16k_MAX * 2]; /* old excitation */ #endif Word16 old_bwe_exc_fx[PIT16k_MAX * 2]; /*Q_exc*/ @@ -1650,7 +1650,7 @@ typedef struct td_bwe_dec_structure int16_t bwe_seed[2]; //Word16 bwe_seed[2]; /*Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float bwe_non_lin_prev_scale; #endif Word32 bwe_non_lin_prev_scale_fx; @@ -1660,27 +1660,27 @@ typedef struct td_bwe_dec_structure -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float genSHBsynth_Hilbert_Mem[HILBERT_MEM_SIZE]; #endif Word32 genSHBsynth_Hilbert_Mem_fx[HILBERT_MEM_SIZE]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_genSHBexc_filt_down_shb[( 2 * ALLPASSSECTIONS_STEEP + 1 )]; #endif Word16 mem_genSHBexc_filt_down_shb_fx[2 * ALLPASSSECTIONS_STEEP + 1]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_genSHBexc_filt_down_wb2[( 2 * ALLPASSSECTIONS_STEEP + 1 )]; #endif Word16 mem_genSHBexc_filt_down_wb2_fx[2 * ALLPASSSECTIONS_STEEP + 1]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_genSHBexc_filt_down_wb3[( 2 * ALLPASSSECTIONS_STEEP + 1 )]; #endif Word16 mem_genSHBexc_filt_down_wb3_fx[2 * ALLPASSSECTIONS_STEEP + 1]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float genSHBsynth_state_lsyn_filt_shb_local[2 * ALLPASSSECTIONS_STEEP]; #endif Word16 genSHBsynth_state_lsyn_filt_shb_local_fx[2 * ALLPASSSECTIONS_STEEP]; @@ -1704,12 +1704,12 @@ typedef struct td_bwe_dec_structure Word16 state_32and48k_WB_upsample_fx[2 * ALLPASSSECTIONS_STEEP]; /* !!! this memory in FLP is called mem_resamp_HB */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_pow_exc16kWhtnd; /* power of the LB excitation signal in the previous frame */ #endif //Word16 prev_pow_exc16kWhtnd_fx; /* power of the LB excitation signal in the previous frame */ - Don't use this Word32 prev_pow_exc16kWhtnd_fx32; /* power of the LB excitation signal in the previous frame */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_mix_factor; /* mixing factor in the previous frame */ #endif Word16 prev_mix_factor_fx; /* mixing factor in the previous frame */ @@ -1717,34 +1717,34 @@ typedef struct td_bwe_dec_structure int16_t syn_dm_phase; //Word16 syn_dm_phase; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float fbbwe_hpf_mem[4][4]; #endif Word32 fbbwe_hpf_mem_fx[4][4]; Word16 fbbwe_hpf_mem_fx_Q[4]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_wb_bwe_frame_pow; #endif Word32 prev_wb_bwe_frame_pow_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_swb_bwe_frame_pow; #endif Word32 prev_swb_bwe_frame_pow_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_ener; #endif Word32 prev_ener_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_GainShape; #endif Word16 prev_GainShape_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float fb_state_lpc_syn[LPC_SHB_ORDER]; #endif Word16 fb_state_lpc_syn_fx[LPC_SHB_ORDER]; @@ -1754,75 +1754,75 @@ typedef struct td_bwe_dec_structure //Word16 prev_Q_bwe_exc; //Word16 prev_Q_synth; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float fb_tbe_demph; #endif Word16 fb_tbe_demph_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_fbbwe_ratio; #endif Word16 prev_fbbwe_ratio_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float tbe_demph; #endif Word16 tbe_demph_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float tbe_premph; #endif Word16 tbe_premph_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_stp_swb[LPC_SHB_ORDER]; #endif Word16 mem_stp_swb_fx[LPC_SHB_ORDER]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float *ptr_mem_stp_swb; #endif Word16* ptr_mem_stp_swb_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float gain_prec_swb; #endif Word16 gain_prec_swb_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_zero_swb[LPC_SHB_ORDER]; #endif Word16 mem_zero_swb_fx[LPC_SHB_ORDER]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float swb_lsp_prev_interp[LPC_SHB_ORDER]; #endif Word16 swb_lsp_prev_interp_fx[LPC_SHB_ORDER]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev1_shb_ener_sf, prev2_shb_ener_sf, prev3_shb_ener_sf, prev_res_shb_gshape, prev_mixFactors; #endif Word32 prev1_shb_ener_sf_fx, prev2_shb_ener_sf_fx, prev3_shb_ener_sf_fx; Word16 prev_res_shb_gshape_fx, prev_mixFactors_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float tilt_mem; /* Formant factor adaptation tilt smoothing memory */ #endif Word16 tilt_mem_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_lsf_diff[LPC_SHB_ORDER - 2]; #endif Word16 prev_lsf_diff_fx[LPC_SHB_ORDER - 2]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_tilt_para; #endif Word16 prev_tilt_para_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float cur_sub_Aq[M + 1]; #endif Word16 cur_sub_Aq_fx[M + 1]; @@ -1862,7 +1862,7 @@ typedef struct td_bwe_dec_structure int16_t idxGain; //Word16 idxGain; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_core_synth[L_FRAME16k]; #endif Word16 old_core_synth_fx[L_FRAME16k]; @@ -1875,12 +1875,12 @@ typedef struct td_bwe_dec_structure Word16 int_3_over_2_tbemem_dec_fx[INTERP_3_2_MEM_LEN]; Word32 int_3_over_2_tbemem_dec_fx_32[INTERP_3_2_MEM_LEN]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_hb_synth[L_FRAME48k]; #endif Word16 old_hb_synth_fx[L_FRAME48k]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float tilt_swb_fec; /* FEC - SWB TBE TILT */ #endif Word16 tilt_swb_fec_fx; /* FEC - SWB TBE TILT */ @@ -1898,7 +1898,7 @@ typedef struct fd_bwe_dec_structure { Word16 old_wtda_wb_fx_exp; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_wtda_swb[L_FRAME48k]; #endif Word16 L_old_wtda_swb_fx[L_FRAME48k]; @@ -1906,12 +1906,12 @@ typedef struct fd_bwe_dec_structure Word16 old_wtda_swb_fx_exp; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_syn_12k8_16k[NS2SA( 16000, DELAY_FD_BWE_ENC_NS )]; #endif Word16 old_syn_12k8_16k_fx[NS2SA(16000, DELAY_FD_BWE_ENC_NS)]; /*Q_syn2-1*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_deemph_old_syn; #endif Word16 mem_deemph_old_syn_fx; @@ -1919,17 +1919,17 @@ typedef struct fd_bwe_dec_structure int16_t prev_mode; //Word16 prev_mode; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_SWB_fenv[SWB_FENV]; #endif //Word16 prev_SWB_fenv_fx[SWB_FENV]; // Don't use this. Use prev_SWB_fenv_fx present in Decoder_State -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_Energy; #endif Word16 prev_Energy_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_Energy_wb; #endif Word32 prev_Energy_wb_fx; @@ -1945,19 +1945,19 @@ typedef struct fd_bwe_dec_structure int16_t prev_frica_flag; //Word16 prev_frica_flag; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_imdct[L_FRAME48k]; #endif Word16 mem_imdct_fx[L_FRAME48k]; Word16 mem_imdct_exp_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_td_energy; #endif Word16 prev_td_energy_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_weight; #endif Word16 prev_weight_fx; @@ -1965,12 +1965,12 @@ typedef struct fd_bwe_dec_structure int16_t prev_flag; //Word16 prev_flag; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float last_wb_bwe_ener; #endif //Word16 last_wb_bwe_ener_fx; // Don't use this. Use last_wb_bwe_ener_fx present in Decoder_State -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_fb_ener_adjust; #endif //Word16 prev_fb_ener_adjust_fx; // Don't use this. Use prev_fb_ener_adjust_fx present in Decoder_State @@ -1994,7 +1994,7 @@ typedef struct hr_swb_bwe_dec_structure int16_t bwe_highrate_seed; Word16 bwe_highrate_seed_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float t_audio_prev[2 * END_FREQ_BWE_FULL_FB / FRAMES_PER_SEC - NUM_NONTRANS_START_FREQ_COEF]; #endif Word16 t_audio_prev_fx[2 * END_FREQ_BWE_FULL_FB / 50 - NUM_NONTRANS_START_FREQ_COEF]; @@ -2004,7 +2004,7 @@ typedef struct hr_swb_bwe_dec_structure int16_t old_is_transient_hr_bwe; Word16 old_is_transient_hr_bwe_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_EnergyLT; #endif Word32 L_mem_EnergyLT_fx; @@ -2224,7 +2224,7 @@ typedef struct Decoder_State Word16 tilt_code_fx; /* tilt of code Q15*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_exc[L_EXC_MEM_DEC]; /* old excitation */ float lsp_old[M]; /* old LSP vector at the end of the frame */ float lsf_old[M]; /* old LSF vector at the end of the frame */ @@ -2265,7 +2265,7 @@ typedef struct Decoder_State int16_t safety_net; //Word16 safety_net; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float stab_fac; /* LSF stability factor */ float stab_fac_smooth; /* low-pass filtered stability factor */ float agc_mem2[2]; /* memory of AGC for saturation control */ @@ -2301,7 +2301,7 @@ typedef struct Decoder_State Word32 gc_threshold_fx; /* Noise enhancer - threshold for gain_code Q16*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float gc_threshold; /* Noise enhancer - threshold for gain_code */ float dispMem[8]; /* Noise enhancer - phase dispersion algorithm memory */ #endif @@ -2329,7 +2329,7 @@ typedef struct Decoder_State Word16 Q_stat_noise; /* Q of Exc_pe */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float min_alpha; /* Stationary noise UV modification - minimum alpha */ float lspold_s[M]; /* Stationary noise UV modification - old LSP vector */ float ge_sm; /* Stationary noise UV modification - smoothed excitation gain */ @@ -2351,7 +2351,7 @@ typedef struct Decoder_State int16_t seed; /* FEC - seed for random generator for excitation */ //Word16 seed_fx; /* FEC - seed for random generator for excitation Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lp_ener_bfi; /* FEC - long-term active-signal average energy */ float lp_ener; /* FEC - low-pass filtered energy */ #endif @@ -2366,13 +2366,13 @@ typedef struct Decoder_State Word32 enr_old_fx; /* FEC - energy of the concealed frame Q0*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lp_gainp; /* FEC - low-pass filtered pitch gain */ float lp_gainc; /* FEC - low-pass filtered code gain */ float enr_old; /* FEC - energy of the concealed frame */ float bfi_pitch; /* FEC - pitch for FEC */ float old_pitch_buf[2 * NB_SUBFR16k + 2]; /* FEC - buffer of old subframe pitch values */ -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 bfi_pitch_fx; /* FEC - pitch for FEC */ int16_t bfi_pitch_frame; /* FEC - frame length when pitch for FEC is saved */ @@ -2395,7 +2395,7 @@ typedef struct Decoder_State int16_t prev_nbLostCmpt; /* FEC - compt for number of consecutive lost frame at the previous frame*/ int16_t mode_lvq; /* FEC - index for LSF mean vector*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_enr_LP_float; /* FEC - LP filter gain */ float lp_ener_FEC_av_float; /* FEC - averaged voiced signal energy */ float lp_ener_FEC_max_float; /* FEC - averaged voiced signal energy */ @@ -2422,9 +2422,9 @@ typedef struct Decoder_State int16_t relax_prev_lsf_interp; //Word16 relax_prev_lsf_interp; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM]; /* FEC - memory of the synthesis signal for frame class estimation */ -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 mem_syn_clas_estim_fx[L_SYN_MEM_CLAS_ESTIM]; /* FEC - memory of the synthesis signal for frame class estimation */ int16_t bpf_off; /* Bass post-filter - do not use BPF when this flag is set to 1 */ @@ -2447,7 +2447,7 @@ typedef struct Decoder_State int16_t last_active_bandsToZero_bwdec; int16_t last_flag_filter_NB; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float perc_bwddec_float; float avg_nrg_LT_float; float ng_ener_ST; /* Noise gate - short-term energy */ @@ -2480,12 +2480,12 @@ typedef struct Decoder_State Word16 psf_lp_noise_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_preemp_preQ; /* ACELP@16kHz - prequantizer preemhasis memory */ float psf_lp_noise; /* NB post-filter - long-term noise */ float last_voice_factor; float prev_synth_buffer[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS )]; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 last_voice_factor_fx; /* Q6*/ @@ -2512,9 +2512,9 @@ typedef struct Decoder_State int16_t CNG_mode; /* DTX/CNG - mode for DTX configuration */ //Word16 CNG_mode_fx; /* DTX/CNG - mode for DTX configuration */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lspCNG[M]; /* DTX/CNG - LP filtered ISPs */ -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 lspCNG_fx[M]; /* CNG and DTX - LP filtered ISPs Q15*/ int16_t active_cnt; @@ -2548,7 +2548,7 @@ typedef struct Decoder_State Word16 prev_gain_pit_dec_fx; /*Q14*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float prev_gain_pit_dec; float prev_tilt_code_dec; float tilt_code_dec[NB_SUBFR16k]; @@ -2610,7 +2610,7 @@ typedef struct Decoder_State Word32 previoussynth_fx_32[L_FRAME48k]; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float previoussynth[L_FRAME48k]; /* note: only 60+111 out of 960 samples are needed in IVAS (for ACELP->TCX switching */ float old_synth_sw[NS2SA(48000, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS)]; /* note: buffer used only in EVS mono */ #endif // 0 @@ -2623,7 +2623,7 @@ typedef struct Decoder_State Word16 old_Aq_12_8_fx[M + 1]; /* Q12 old Aq[] for core switching */ Word32 old_Aq_12_8_fx_32[M + 1]; /* Q28 old Aq[] for core switching */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float delay_buf_out[HQ_DELTA_MAX * HQ_DELAY_COMP]; float old_Aq_12_8[M + 1]; /* old Aq[] for core switching */ float old_Es_pred; /* old Es_pred for core switching */ @@ -2651,7 +2651,7 @@ typedef struct Decoder_State Word16 tilt_swb_fx; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float hb_prev_synth_buffer[NS2SA( 48000, DELAY_BWE_TOTAL_NS )]; float tilt_wb; float tilt_swb; @@ -2686,10 +2686,10 @@ typedef struct Decoder_State int16_t bws_cnt1; // Word16 bws_cnt1; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float attenu1; float t_audio_q[L_FRAME]; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 attenu_fx; int16_t last_inner_frame; @@ -2818,7 +2818,7 @@ typedef struct Decoder_State int16_t seed_tcx_plc; /* seed memory (for random function in TCX PLC) */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lsfold_uw_float[M]; /* old lsf (unweighted) */ float lspold_uw_float[M]; /* old lsp (unweighted) */ float past_gpit_float; /* past gain of pitch (for frame recovery) */ @@ -2853,7 +2853,7 @@ typedef struct Decoder_State int16_t plcBackgroundNoiseUpdated; /* flag: Is background noise estimate updated? */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_syn_unv_back_float[M]; /* filter memory for unvoiced synth */ float last_gain_syn_deemph_float; float last_concealed_gain_syn_deemph_float; @@ -2885,14 +2885,14 @@ typedef struct Decoder_State /*Preemphasis factor*/ Word16 preemph_fac; /*0Q15*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*Preemphasis factor*/ float preemph_fac_float; float gamma_float; /*for AMR-WB like 6.4 to 7 kHz upsampling and noise filling*/ float mem_Aq_float[NB_SUBFR16k * ( M + 1 )]; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 gamma; @@ -2911,14 +2911,14 @@ typedef struct Decoder_State int16_t clas_dec; /* PLC - frame class at the decoder */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float old_fpitch_float; /* PLC - last pitch of previous frame (as transmitted) */ float old_fpitchFB_float; /* PLC - last pitch of previous FB frame (depends on output sr) */ float mem_pitch_gain_float[2 * NB_SUBFR16k + 2]; /* PLC - Pitch gain memory */ float cummulative_damping_float; float cngTDLevel_float; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 mem_pitch_gain[2 * NB_SUBFR16k + 2]; /* Pitch gain memory Q14 */ int16_t plc_use_future_lag; /* PLC - flag indicating if info (pitch lag / pitch gain) about future frame is usable */ @@ -2946,14 +2946,14 @@ typedef struct Decoder_State int16_t numlpc; /* Bandwidth */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float TcxBandwidth_float; #endif Word16 TcxBandwidth; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float voice_fac_float; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 voice_fac; int16_t tcxonly; @@ -2969,9 +2969,9 @@ typedef struct Decoder_State int16_t second_last_core; /* parameters for switching */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float mem_syn_r_float[L_SYN_MEM]; /*LPC synthesis memory needed for rate switching*/ -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word16 mem_syn_r[L_SYN_MEM]; /*LPC synthesis memory needed for rate switching*/ int16_t rate_switching_reset; @@ -2998,9 +2998,9 @@ typedef struct Decoder_State int16_t flag_cna; int16_t last_flag_cna; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float lp_noise_float; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED Word32 lp_noise; int16_t seed_acelp; diff --git a/lib_dec/stat_noise_uv_dec.c b/lib_dec/stat_noise_uv_dec.c index ed0faa4b999894d7a5be7d575a4ff162db5f8a7c..ec7381ba2ea650b67481fefe47fff20549d3f59b 100644 --- a/lib_dec/stat_noise_uv_dec.c +++ b/lib_dec/stat_noise_uv_dec.c @@ -38,7 +38,7 @@ #include "options.h" #include "prot.h" #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------* * stat_noise_uv_dec() * diff --git a/lib_dec/swb_bwe_dec.c b/lib_dec/swb_bwe_dec.c index 551ad48b5148ed0d2d26b78ffd8131d4349f78fd..84569e12ca1723a5d16a000109ac501dbd564d3c 100644 --- a/lib_dec/swb_bwe_dec.c +++ b/lib_dec/swb_bwe_dec.c @@ -49,7 +49,7 @@ #include "prot_fx1.h" #endif // IVAS_FLOAT_FIXED -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * para_pred_bws() * @@ -531,7 +531,7 @@ static int16_t WB_BWE_gain_deq( return ( mode ); } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * wb_bwe_dec_flt() * @@ -847,7 +847,7 @@ int16_t swb_bwe_gain_deq_flt( * * SWB BWE decoder *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void swb_bwe_dec_flt( Decoder_State *st, /* i/o: decoder state structure */ const float output[], /* i : synthesis @internal Fs */ diff --git a/lib_dec/swb_bwe_dec_hr.c b/lib_dec/swb_bwe_dec_hr.c index d4b1847663fb52117501394a5b1db07dbeddc587..5d090e7088ccab3ec7ab946dd07d6e71eed2062c 100644 --- a/lib_dec/swb_bwe_dec_hr.c +++ b/lib_dec/swb_bwe_dec_hr.c @@ -49,7 +49,7 @@ * * HR SWB BWE decoder *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void swb_bwe_dec_hr( Decoder_State *st, /* i/o: decoder state structure */ const float *syn_12k8_16k, /* i : ACELP core synthesis @16kHz */ diff --git a/lib_dec/swb_bwe_dec_lr.c b/lib_dec/swb_bwe_dec_lr.c index f7d7fc0439f49d8538ae27525ecb1063e769b351..320308981c2aa5318794816aa986f61e024f533d 100644 --- a/lib_dec/swb_bwe_dec_lr.c +++ b/lib_dec/swb_bwe_dec_lr.c @@ -84,7 +84,7 @@ static void DecodeSWBGenericParameters( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * DecodeSWBSubbands() * @@ -236,7 +236,7 @@ static void DecodeSWBSubbands( } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * swb_bwe_dec_lr() * diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index d2dc4cc8745812c35378295dd5ff59ab8525d648..d930ea19add1f90ae9d4eb7d54d423a6a537307f 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -71,7 +71,7 @@ void ResetSHBbuffer_Dec( ) { int16_t i; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED float f; float inc; @@ -147,7 +147,7 @@ void ResetSHBbuffer_Dec( set_f( hBWE_TD->state_lsyn_filt_dwn_shb, 0, 2 * ALLPASSSECTIONS_STEEP ); set_f( hBWE_TD->mem_resamp_HB, 0, INTERP_3_1_MEM_LEN ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /* States for the local synthesis filters */ set_f( hBWE_TD->syn_overlap, 0, L_SHB_LAHEAD ); @@ -225,7 +225,7 @@ void ResetSHBbuffer_Dec( #endif set_f( hBWE_TD->old_tbe_synth, 0, L_SHB_TRANSITION_LENGTH ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hBWE_TD->tilt_swb_fec = 0.0f; #endif #ifdef IVAS_FLOAT_FIXED @@ -234,7 +234,7 @@ void ResetSHBbuffer_Dec( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * wb_tbe_dec() * @@ -2718,7 +2718,7 @@ void ivas_swb_tbe_dec_fx( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * swb_tbe_dec() * @@ -4237,7 +4237,7 @@ static void dequantizeSHBparams( } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * fb_tbe_dec() * @@ -4397,7 +4397,7 @@ void tbe_read_bitstream( } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * GenTransition() * @@ -4520,7 +4520,7 @@ void GenTransition_fixed( return; } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * GenTransition_WB() * @@ -4633,7 +4633,7 @@ void GenTransition_WB_fixed( } #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * void TBEreset_dec() * @@ -4650,7 +4650,7 @@ void TBEreset_dec( if ( st->last_core != ACELP_CORE ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->old_bwe_exc, 0.0f, PIT16k_MAX * 2 ); hBWE_TD->bwe_non_lin_prev_scale = 0.f; #endif @@ -4662,14 +4662,14 @@ void TBEreset_dec( } if ( st->bwidth == WB ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED wb_tbe_extras_reset( hBWE_TD->mem_genSHBexc_filt_down_wb2, hBWE_TD->mem_genSHBexc_filt_down_wb3 ); #endif #ifdef IVAS_FLOAT_FIXED wb_tbe_extras_reset_fx( hBWE_TD->mem_genSHBexc_filt_down_wb2_fx, hBWE_TD->mem_genSHBexc_filt_down_wb3_fx ); #endif wb_tbe_extras_reset_synth( hBWE_TD->state_lsyn_filt_shb, hBWE_TD->state_lsyn_filt_dwn_shb, hBWE_TD->mem_resamp_HB ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->mem_genSHBexc_filt_down_shb, 0, 7 ); set_f( hBWE_TD->state_lpc_syn, 0, 10 ); set_f( hBWE_TD->state_syn_shbexc, 0, L_SHB_LAHEAD / 4 ); @@ -4680,7 +4680,7 @@ void TBEreset_dec( set_val_Word16( hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD / 4 ); #endif set_f( hBWE_TD->syn_overlap, 0, L_SHB_LAHEAD ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->mem_csfilt, 0, 2 ); #endif #ifdef IVAS_FLOAT_FIXED @@ -4689,7 +4689,7 @@ void TBEreset_dec( } else if ( st->bwidth == SWB || st->bwidth == FB ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED swb_tbe_reset( hBWE_TD->mem_csfilt, hBWE_TD->mem_genSHBexc_filt_down_shb, hBWE_TD->state_lpc_syn, hBWE_TD->syn_overlap, hBWE_TD->state_syn_shbexc, &( hBWE_TD->tbe_demph ), &( hBWE_TD->tbe_premph ), hBWE_TD->mem_stp_swb, &( hBWE_TD->gain_prec_swb ) ); set_f( hBWE_TD->GainShape_Delay, 0, NUM_SHB_SUBFR / 2 ); @@ -4702,7 +4702,7 @@ void TBEreset_dec( set_f( hBWE_TD->int_3_over_2_tbemem_dec, 0.f, INTERP_3_2_MEM_LEN ); set_f( hBWE_TD->mem_resamp_HB_32k, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hBWE_TD->prev_pow_exc16kWhtnd = 1.0f; hBWE_TD->prev_mix_factor = 1.0f; @@ -4719,11 +4719,11 @@ void TBEreset_dec( { if ( st->hBWE_FD != NULL ) { -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED st->hBWE_FD->prev_fb_ener_adjust = 0.0f; #endif } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->fb_state_lpc_syn, 0, LPC_SHB_ORDER ); hBWE_TD->fb_tbe_demph = 0; fb_tbe_reset_synth( hBWE_TD->fbbwe_hpf_mem, &hBWE_TD->prev_fbbwe_ratio ); @@ -4754,7 +4754,7 @@ void td_bwe_dec_init( int16_t i; /* init. SHB buffers */; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->old_bwe_exc, 0.0f, ( PIT16k_MAX * 2 ) ); #endif #ifdef IVAS_FLOAT_FIXED @@ -4763,7 +4763,7 @@ void td_bwe_dec_init( hBWE_TD->bwe_seed[0] = 23; /* 1; */ hBWE_TD->bwe_seed[1] = 59; /* 10000; */ set_f( hBWE_TD->old_bwe_exc_extended, 0.0f, NL_BUFF_OFFSET ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hBWE_TD->bwe_non_lin_prev_scale = 0; set_f(hBWE_TD->genSHBsynth_Hilbert_Mem, 0.0f, HILBERT_MEM_SIZE); @@ -4778,7 +4778,7 @@ void td_bwe_dec_init( #endif hBWE_TD->syn_dm_phase = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hBWE_TD->prev_fbbwe_ratio = 1.0f; hBWE_TD->prev_wb_bwe_frame_pow = 0.001f; hBWE_TD->prev_swb_bwe_frame_pow = 0.001f; @@ -4792,7 +4792,7 @@ void td_bwe_dec_init( /* reset SHB buffers */ ResetSHBbuffer_Dec( hBWE_TD, extl ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED if ( output_Fs == 48000 ) { set_f( hBWE_TD->fbbwe_hpf_mem[0], 0, 4 ); @@ -4817,7 +4817,7 @@ void td_bwe_dec_init( set_f( hBWE_TD->mem_resamp_HB_32k, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); set32_fx( hBWE_TD->mem_resamp_HB_32k_fx_32, 0, 2 * ALLPASSSECTIONS_STEEP + 1 ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hBWE_TD->tilt_mem = 0.0f; set_f( hBWE_TD->prev_lsf_diff, 0.5f, LPC_SHB_ORDER - 2 ); hBWE_TD->prev_tilt_para = 0.0f; @@ -4834,7 +4834,7 @@ void td_bwe_dec_init( set_f( hBWE_TD->int_3_over_2_tbemem_dec, 0.0f, INTERP_3_2_MEM_LEN ); /* TD BWE post-processing */ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hBWE_TD->ptr_mem_stp_swb = hBWE_TD->mem_stp_swb + LPC_SHB_ORDER - 1; set_f( hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER ); diff --git a/lib_dec/tcx_utils_dec.c b/lib_dec/tcx_utils_dec.c index 4d2cda73528aec545ae5ff0f3f517e643f3992ed..8747c6baba46b170e7321da019f250359fc41724 100644 --- a/lib_dec/tcx_utils_dec.c +++ b/lib_dec/tcx_utils_dec.c @@ -47,7 +47,7 @@ * * *--------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void tcx_decoder_memory_update_flt( Decoder_State *st, /* i/o: decoder memory state */ const float *xn_buf, /* i/o: mdct output buffer used also as temporary buffer */ diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index 9314ae06cf1894d53c231c2da58ee654933655e8..e87dd91cb21c62734a9bd98efb7bc20b6ad39bd7 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -70,7 +70,7 @@ ivas_error TonalMDCTConceal_Init_ivas( assert( ( hTonalMDCTConc->nScaleFactors == nScaleFactors ) || ( hTonalMDCTConc->nSamples != nSamples ) ); /* If nSamples doesn't change then also nScaleFactors must stay the same */ hTonalMDCTConc->tcx_cfg = hTcxCfg; -#if (defined EVS_FLOAT) || (!defined IVAS_FLOAT_FIXED ) +#ifndef IVAS_FLOAT_FIXED hTonalMDCTConc->lastBlockData.spectralData_float = hTonalMDCTConc->spectralDataBuffers_float[0]; hTonalMDCTConc->secondLastBlockData.spectralData_float = hTonalMDCTConc->spectralDataBuffers_float[1]; hTonalMDCTConc->secondLastPowerSpectrum_float = hTonalMDCTConc->secondLastBlockData.spectralData_float; @@ -86,9 +86,9 @@ ivas_error TonalMDCTConceal_Init_ivas( hTonalMDCTConc->secondLastBlockData.blockIsConcealed = 0; hTonalMDCTConc->pTCI = (TonalComponentsInfo *) hTonalMDCTConc->timeDataBuffer_float; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hTonalMDCTConc->lastPitchLag_float = 0; -#endif // #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#endif // #ifndef IVAS_FLOAT_FIXED if ( hTonalMDCTConc->nSamples != nSamples ) { @@ -101,13 +101,13 @@ ivas_error TonalMDCTConceal_Init_ivas( set_zero( hTonalMDCTConc->scaleFactorsBackground_flt, FDNS_NPTS ); set32_fx( hTonalMDCTConc->scaleFactorsBackground_fx, 0, FDNS_NPTS ); -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hTonalMDCTConc->scf_fadeout_flt = 1.0f; #endif PsychoacousticParameters_Init( INT_FS_16k, L_FRAME16k, 64, 1, 1, &hTonalMDCTConc->psychParamsTCX20 ); PsychoacousticParameters_Init( INT_FS_16k, L_FRAME16k / 2, 64, 0, 1, &hTonalMDCTConc->psychParamsTCX10 ); hTonalMDCTConc->psychParams = NULL; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hTonalMDCTConc->last_block_nrg_flt = 0.0f; hTonalMDCTConc->curr_noise_nrg_flt = 0.0f; hTonalMDCTConc->faded_signal_nrg_flt = 0.0f; @@ -125,7 +125,7 @@ ivas_error TonalMDCTConceal_Init_ivas( return IVAS_ERR_OK; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void TonalMDCTConceal_SaveFreqSignal_ivas( TonalMDCTConcealPtr hTonalMDCTConc, const float *mdctSpectrum, @@ -458,7 +458,7 @@ static void CalcMDXT( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void TonalMDCTConceal_Detect_ivas( const TonalMDCTConcealPtr hTonalMDCTConc, const float pitchLag, @@ -1473,7 +1473,7 @@ void TonalMdctConceal_create_concealment_noise_ivas( #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void TonalMdctConceal_whiten_noise_shape_ivas( Decoder_State *st, const int16_t L_frame, diff --git a/lib_dec/updt_dec.c b/lib_dec/updt_dec.c index 3f37a73144e880505efcc0534f8aae1269066407..fafad2f8571a9b277c282fdd572c1039c7fe3b8c 100644 --- a/lib_dec/updt_dec.c +++ b/lib_dec/updt_dec.c @@ -42,7 +42,7 @@ #include "cnst.h" #include #include "wmc_auto.h" -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * updt_dec() * @@ -319,7 +319,7 @@ void updt_IO_switch_dec( /* AMR-WB IO init */ mvr2r( st->hAmrwb_IO->lt_diff_etot, tmpF, MAX_LT ); - amr_wb_dec_init_flt( st->hAmrwb_IO ); + amr_wb_dec_init( st->hAmrwb_IO ); mvr2r( tmpF, st->hAmrwb_IO->lt_diff_etot, MAX_LT ); hf_synth_amr_wb_reset( st->hAmrwb_IO, st->hBWE_zero ); diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c index e24c95e12ad0e7bca2a85f97792b284acdb87687..a9576c88dc76d43683fe2016a753f4ce944f1442 100644 --- a/lib_dec/updt_dec_fx.c +++ b/lib_dec/updt_dec_fx.c @@ -345,7 +345,7 @@ void updt_IO_switch_dec_fx( } Copy(st_fx->hAmrwb_IO->lt_diff_etot_fx, tmp_buf, MAX_LT); - amr_wb_dec_init(st_fx->hAmrwb_IO); + amr_wb_dec_init_fx(st_fx->hAmrwb_IO); Copy(tmp_buf, st_fx->hAmrwb_IO->lt_diff_etot_fx, MAX_LT); hf_synth_amr_wb_reset_fx(st_fx->hBWE_zero, st_fx->hAmrwb_IO); diff --git a/lib_dec/voiced_dec.c b/lib_dec/voiced_dec.c index 37d6db9d51518ae21a31a592a9e37646593d29ee..acd98de402aa77e349ef3165470227f6d911dc8e 100644 --- a/lib_dec/voiced_dec.c +++ b/lib_dec/voiced_dec.c @@ -47,7 +47,7 @@ * * Voiced decoder for SC-VBR *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED ivas_error ppp_voiced_decoder( Decoder_State *st, /* i/o: state structure */ float *out, /* o : residual signal */ @@ -246,7 +246,7 @@ ivas_error ppp_voiced_decoder( * * Initialize SC-VBR decoder *---------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void sc_vbr_dec_init_flt( SC_VBR_DEC_HANDLE hSC_VBR /* i/o: SC-VBR decoder handle */ ) diff --git a/lib_dec/waveadjust_fec_dec.c b/lib_dec/waveadjust_fec_dec.c index 6038ea775962258e29737aa239a79e3e545ccb36..c5b041d22bc7d93548cee59c35c886479626caed 100644 --- a/lib_dec/waveadjust_fec_dec.c +++ b/lib_dec/waveadjust_fec_dec.c @@ -455,7 +455,7 @@ static void add_noise( return; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED static int16_t waveform_adj( T_PLCInfo_HANDLE hPlcInfo, float *overlapbuf, @@ -548,7 +548,7 @@ static int16_t waveform_adj( * waveform_adj2() * *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void waveform_adj2( T_PLCInfo_HANDLE hPlcInfo, float *overlapbuf, @@ -679,19 +679,19 @@ void concealment_init( hPlcInfo->L_frameTCX = L_frameTCX; hPlcInfo->Pitch = 0; hPlcInfo->T_bfi = 0; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hPlcInfo->outx_new_n1 = 0.0f; hPlcInfo->nsapp_gain = 0.0f; #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hPlcInfo->nsapp_gain_n = 0.0f; hPlcInfo->ener_mean = 59.4260f; #endif -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hPlcInfo->ener = 0.0f; #endif hPlcInfo->zp = L_frameTCX; -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED hPlcInfo->recovery_gain_float = 0.0f; hPlcInfo->step_concealgain = 0.0f; #endif @@ -712,7 +712,7 @@ void concealment_init( { hPlcInfo->Transient[i] = 1; } -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED for ( i = 0; i < L_FRAME_MAX; i++ ) { hPlcInfo->data_reci2[i] = 0; @@ -727,7 +727,7 @@ void concealment_init( * * *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void concealment_decode( const int16_t core, float *invkoef, @@ -762,7 +762,7 @@ void concealment_decode( * * *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void concealment_update( const int16_t bfi, const int16_t core, @@ -820,7 +820,7 @@ void concealment_update( * * *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void concealment_update2( const float *outx_new, @@ -845,7 +845,7 @@ void concealment_update2( * * *-------------------------------------------------------------------*/ -#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) +#ifndef IVAS_FLOAT_FIXED void concealment_signal_tuning( Decoder_State *st, const int16_t bfi, diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index d4757ad4db2f7d527db973837fdf30653e8296d6..aef6dc7d6b83e93f7be095c27bbe8bbc0a9da81d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -284,6 +284,7 @@ ivas_error ivas_dirac_dec_init_binaural_data( return error; } #else + Word16 frequency_axis[CLDFB_NO_CHANNELS_MAX]; ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); if ((error = ivas_dirac_dec_decorr_open(&(hDiracDecBin->h_freq_domain_decorr_ap_params), diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index c0750a26a3809815cd51c4dbed770a9a0949f452..3926c985b9a9ec88596dccc20f1c3bfca14c604e 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -432,10 +432,17 @@ ivas_error TDREND_MIX_Init( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) ); } - if ( ( error = DefaultBSplineModel( hBinRendererTd->HrFiltSet_p, output_Fs ) ) != IVAS_ERR_OK ) +#ifdef IVAS_FLOAT_FIXED + if ( ( error = DefaultBSplineModel_fx( hBinRendererTd->HrFiltSet_p, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#else + if ( ( error = DefaultBSplineModel( hBinRendererTd->HrFiltSet_p, output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif *hHrtfTD = hBinRendererTd->HrFiltSet_p; } else diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c index 241abef79b2b1a679d7af42c7f60541c70c012ff..e76cadc3737a56e6983916ecb3d2eed4b0eb0665 100644 --- a/lib_rend/ivas_reverb_filter_design.c +++ b/lib_rend/ivas_reverb_filter_design.c @@ -190,7 +190,7 @@ static void calc_min_phase( return; } - +#ifdef IVAS_FLOAT_FIXED static void calc_min_phase_fx( rv_fftwf_type_complex_fx *pSpectrum, const Word16 fft_size, @@ -359,6 +359,7 @@ static void calc_min_phase_fx( return; } +#endif /*-------------------------------------------------------------------* * calc_min_phase_filter() * @@ -396,7 +397,7 @@ static void calc_min_phase_filter( return; } - +#ifdef IVAS_FLOAT_FIXED static void calc_min_phase_filter_fx( rv_fftwf_type_complex_fx *pH_flt, const Word16 fft_size, @@ -429,6 +430,7 @@ static void calc_min_phase_filter_fx( return; } +#endif /*-------------------------------------------------------------------* * apply_window_fft() * @@ -482,7 +484,7 @@ static void apply_window_fft( return; } - +#ifdef IVAS_FLOAT_FIXED static void apply_window_fft_fx( rv_fftwf_type_complex_fx *pH_flt, const Word32 *pWindow, @@ -554,6 +556,7 @@ static void apply_window_fft_fx( return; } +#endif /*-------------------------------------------------------------------* * response_step_limit() * @@ -842,7 +845,7 @@ int16_t ivas_reverb_calc_color_filters( return 0; } - +#ifdef IVAS_FLOAT_FIXED Word16 ivas_reverb_calc_color_filters_fx( const Word32 *pTargetL, const Word32 *pTargetR, @@ -883,6 +886,7 @@ Word16 ivas_reverb_calc_color_filters_fx( return 0; } +#endif /*-------------------------------------------------------------------* * ivas_reverb_calc_correl_filters() * @@ -926,7 +930,7 @@ int16_t ivas_reverb_calc_correl_filters( return 0; } - +#ifdef IVAS_FLOAT_FIXED Word16 ivas_reverb_calc_correl_filters_fx( Word32 *pTargetICC, //input in Q30 const Word32 *pWindow, //input in Q30 @@ -976,6 +980,7 @@ Word16 ivas_reverb_calc_correl_filters_fx( return 0; } +#endif /*-------------------------------------------------------------------* * ivas_reverb_calc_color_levels() * diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index bb2a94de2ab2f4e32431d8d4d41e62e6f922927c..34b32587703b3e58d693c29e41c3b84ce897ee65 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -48,6 +48,7 @@ * * Render prototype audio signals using SBA mixing matrices *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void ivas_sba_prototype_renderer_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -248,7 +249,7 @@ void ivas_sba_prototype_renderer_fx( return; } - +#else void ivas_sba_prototype_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -407,3 +408,4 @@ void ivas_sba_prototype_renderer( return; } +#endif \ No newline at end of file diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 037c04dbd9eff49cfac40250dba33ef21596de30..8ecc530fea263dec70d4a5ff6a0a9704c63004c6 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2095,7 +2095,7 @@ static ivas_error setRendInputActiveIsm( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { -#if 1 /*Cleanup changes: float to fixed*/ +#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ IF( hRendCfg ) { hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); @@ -2126,8 +2126,8 @@ static ivas_error setRendInputActiveIsm( { return error; } -#if 1 /*Cleanup changes: fixed to float*/ - IF(inputIsm->crendWrapper->hHrtfCrend != NULL ) +#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: fixed to float*/ + IF(inputIsm->crendWrapper && inputIsm->crendWrapper->hHrtfCrend != NULL ) { inputIsm->crendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( inputIsm->crendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); inputIsm->crendWrapper->hHrtfCrend->latency_s = fixedToFloat( inputIsm->crendWrapper->hHrtfCrend->latency_s_fx, 31 ); @@ -3583,6 +3583,16 @@ static ivas_error initMcBinauralRendering( { return error; } + +#if 1 /*Fixed to float conversions */ + FOR( Word16 k = 0; k < add( extract_l( L_shr(inputMc->hReverb->fft_size, 1 ) ), 1 ); k++ ) + { + (inputMc->hReverb)->fft_filter_correl_0.fft_spectrum[k] = (float) (inputMc->hReverb)->fft_filter_correl_0.fft_spectrum_fx[k] / ONE_IN_Q31; + (inputMc->hReverb)->fft_filter_color_0.fft_spectrum[k] = (float) (inputMc->hReverb)->fft_filter_color_0.fft_spectrum_fx[k] / ONE_IN_Q31; + (inputMc->hReverb)->fft_filter_correl_1.fft_spectrum[k] = (float) (inputMc->hReverb)->fft_filter_correl_1.fft_spectrum_fx[k] / ONE_IN_Q31; + (inputMc->hReverb)->fft_filter_color_1.fft_spectrum[k] = (float) (inputMc->hReverb)->fft_filter_color_1.fft_spectrum_fx[k] / ONE_IN_Q31; + } +#endif #else if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { @@ -3594,7 +3604,7 @@ static ivas_error initMcBinauralRendering( else if ( !useTDRend && inputMc->crendWrapper == NULL ) { /* open CREND */ -#if 1 /*Cleanup changes: float to fixed*/ +#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: float to fixed*/ IF( hRendCfg ) { hRendCfg->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRendCfg->roomAcoustics.acousticPreDelay, 27 ); @@ -3625,8 +3635,9 @@ static ivas_error initMcBinauralRendering( { return error; } -#if 1 /*Cleanup changes: fixed to float*/ - IF( inputMc->crendWrapper->hHrtfCrend != NULL ) +#ifdef IVAS_FLOAT_FIXED /*Cleanup changes: fixed to float*/ + IF(inputMc->crendWrapper && inputMc->crendWrapper->hHrtfCrend != NULL ) + { inputMc->crendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( inputMc->crendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); inputMc->crendWrapper->hHrtfCrend->latency_s = fixedToFloat( inputMc->crendWrapper->hHrtfCrend->latency_s_fx, 31 ); @@ -4234,7 +4245,7 @@ static ivas_error updateSbaPanGains( } #if 1 /*Cleanup changes: fixed to float*/ - IF( inputSba->crendWrapper->hHrtfCrend != NULL ) + IF( inputSba->crendWrapper != NULL && inputSba->crendWrapper->hHrtfCrend != NULL) { inputSba->crendWrapper->hHrtfCrend->gain_lfe = fixedToFloat( inputSba->crendWrapper->hHrtfCrend->gain_lfe_fx, 14 ); inputSba->crendWrapper->hHrtfCrend->latency_s = fixedToFloat( inputSba->crendWrapper->hHrtfCrend->latency_s_fx, 31 );