From 70e802e18a3eb576056d9cefb049fa1f3086aec2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 16 May 2024 19:17:03 +0530 Subject: [PATCH] Warnings fixes for MSVS and Linux --- apps/decoder.c | 12 +- lib_com/basop32.c | 2 +- lib_com/basop32.h | 1 + lib_com/bits_alloc_fx.c | 1 + lib_com/bitstream_fx.c | 1 + lib_com/enr_1_az.c | 1 + lib_com/fd_cng_com.c | 4 + lib_com/fd_cng_com_fx.c | 1 + lib_com/float_to_fix_ops.c | 70 ++- lib_com/guided_plc_util.c | 4 + lib_com/interpol.c | 2 + lib_com/ivas_agc_com_fx.c | 20 +- lib_com/ivas_fb_mixer.c | 64 +++ lib_com/ivas_ism_com.c | 1 + lib_com/ivas_masa_com.c | 3 +- lib_com/ivas_omasa_com.c | 5 +- lib_com/ivas_prot.h | 2 + lib_com/ivas_prot_fx.h | 16 +- lib_com/ivas_qspherical_com.c | 1 + lib_com/ivas_rom_com.c | 35 ++ lib_com/ivas_rom_com.h | 9 + lib_com/ivas_sns_com_fx.c | 5 +- lib_com/ivas_spar_com.c | 4 +- lib_com/ivas_stereo_td_bit_alloc.c | 5 +- lib_com/longarith.c | 4 + lib_com/lpc_tools.c | 1 + lib_com/modif_fs.c | 1 + lib_com/modif_fs_fx.c | 1 + lib_com/mslvq_com.c | 2 + lib_com/options.h | 1 + lib_com/prot.h | 4 + lib_com/prot_fx1.h | 4 + lib_com/prot_fx2.h | 10 +- lib_com/rom_com.c | 116 ++--- lib_com/swb_bwe_com_fx.c | 4 - lib_com/swb_tbe_com_fx.c | 26 +- lib_com/syn_filt_fx.c | 2 +- lib_com/tcx_ltp.c | 20 +- lib_com/tools.c | 1 + lib_com/tools_fx.c | 11 +- lib_com/window_fx.c | 7 +- lib_dec/FEC.c | 8 + lib_dec/FEC_HQ_phase_ecu.c | 38 +- lib_dec/LD_music_post_filter.c | 11 +- lib_dec/acelp_core_dec_ivas_fx.c | 6 +- lib_dec/acelp_core_switch_dec.c | 2 + lib_dec/arith_coder_dec.c | 6 +- lib_dec/bass_psfilter.c | 4 + lib_dec/core_dec_init.c | 19 +- lib_dec/core_dec_init_fx.c | 6 +- lib_dec/core_switching_dec.c | 140 +----- lib_dec/dec_post.c | 28 ++ lib_dec/dec_tcx.c | 1 + lib_dec/dec_tcx_fx.c | 4 +- lib_dec/fd_cng_dec_fx.c | 16 +- lib_dec/hf_synth.c | 25 +- lib_dec/hf_synth_fx.c | 44 +- lib_dec/hq_core_dec_fx.c | 10 +- lib_dec/hq_lr_dec.c | 26 +- lib_dec/igf_dec.c | 15 +- lib_dec/ivas_core_dec.c | 41 +- lib_dec/ivas_cpe_dec.c | 9 +- lib_dec/ivas_cpe_dec_fx.c | 14 +- lib_dec/ivas_dirac_dec.c | 17 +- lib_dec/ivas_dirac_output_synthesis_cov.c | 15 +- lib_dec/ivas_init_dec.c | 32 +- lib_dec/ivas_ism_dec.c | 485 +------------------ lib_dec/ivas_ism_param_dec.c | 6 +- lib_dec/ivas_jbm_dec.c | 135 +++--- lib_dec/ivas_masa_dec.c | 6 +- lib_dec/ivas_mc_param_dec.c | 80 ++- lib_dec/ivas_mct_dec.c | 20 +- lib_dec/ivas_omasa_dec.c | 10 +- lib_dec/ivas_out_setup_conversion.c | 4 + lib_dec/ivas_qmetadata_dec.c | 6 +- lib_dec/ivas_sba_dec.c | 12 +- lib_dec/ivas_sba_rendering_internal.c | 8 +- lib_dec/ivas_spar_decoder.c | 10 +- lib_dec/ivas_spar_md_dec.c | 17 +- lib_dec/ivas_stereo_cng_dec.c | 8 +- lib_dec/ivas_stereo_dft_dec.c | 4 + lib_dec/ivas_stereo_dft_dec_fx.c | 18 +- lib_dec/ivas_stereo_dft_plc_fx.c | 4 +- lib_dec/ivas_stereo_eclvq_dec.c | 1 + lib_dec/ivas_stereo_esf_dec.c | 2 +- lib_dec/ivas_stereo_mdct_core_dec.c | 7 +- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 4 + lib_dec/ivas_stereo_switching_dec.c | 2 + lib_dec/ivas_stereo_td_dec.c | 2 + lib_dec/ivas_tcx_core_dec.c | 2 + lib_dec/jbm_pcmdsp_apa.c | 51 +- lib_dec/lsf_dec.c | 4 + lib_dec/post_dec.c | 4 + lib_dec/swb_bwe_dec.c | 2 + lib_dec/swb_bwe_dec_fx.c | 1 + lib_dec/swb_bwe_dec_lr.c | 2 + lib_dec/swb_tbe_dec.c | 20 +- lib_dec/swb_tbe_dec_fx.c | 9 +- lib_dec/tonalMDCTconcealment.c | 2 + lib_dec/tonalMDCTconcealment_fx.c | 8 +- lib_dec/waveadjust_fec_dec.c | 19 +- lib_dec/waveadjust_fec_dec_fx.c | 3 +- lib_enc/ACcontextMapping_enc_fx.c | 2 +- lib_enc/enc_acelp_fx.c | 18 + lib_enc/enc_gain_fx.c | 3 + lib_enc/guided_plc_enc_fx.c | 2 +- lib_enc/igf_scf_enc_fx.c | 16 +- lib_enc/ivas_core_pre_proc_front.c | 4 +- lib_enc/ivas_init_enc.c | 1 + lib_enc/ivas_spar_encoder.c | 4 +- lib_enc/tcx_ltp_enc_fx.c | 2 +- lib_enc/tcx_utils_enc_fx.c | 2 +- lib_enc/vad_proc_fx.c | 4 +- lib_rend/ivas_crend.c | 4 +- lib_rend/ivas_dirac_ana.c | 4 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 20 +- lib_rend/ivas_dirac_decorr_dec.c | 4 + lib_rend/ivas_dirac_onsets_dec.c | 30 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 301 +++++------- lib_rend/ivas_dirac_rend.c | 8 +- lib_rend/ivas_limiter.c | 4 +- lib_rend/ivas_masa_merge.c | 4 +- lib_rend/ivas_mcmasa_ana.c | 13 + lib_rend/ivas_objectRenderer.c | 13 +- lib_rend/ivas_objectRenderer_mix.c | 6 +- lib_rend/ivas_objectRenderer_vec.c | 1 + lib_rend/ivas_omasa_ana.c | 3 +- lib_rend/ivas_orient_trk.c | 8 +- lib_rend/ivas_reflections.c | 3 +- lib_rend/ivas_reverb.c | 3 +- lib_rend/ivas_reverb_filter_design.c | 26 +- lib_rend/ivas_reverb_utils.c | 6 + lib_rend/ivas_rom_TdBinauralRenderer.c | 4 +- lib_rend/ivas_rotation.c | 13 +- lib_rend/ivas_vbap.c | 2 +- lib_rend/lib_rend.c | 36 +- 136 files changed, 1227 insertions(+), 1346 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 8c7c2c99f..5c7bf1765 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1518,7 +1518,11 @@ static ivas_error decodeG192( bool needNewFrame; int16_t nSamplesRendered, nSamplesRendered_loop, nSamplesToRender; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; - IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; +#ifdef IVAS_FLOAT_FIXED + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0,0 }, { 0, 0, 0, 0, 0, 0, 0 } }; +#else + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0, }, { 0, 0,0 }, { 0, 0, 0 } }; +#endif int16_t vec_pos_update, vec_pos_len; @@ -2085,7 +2089,11 @@ static ivas_error decodeVoIP( IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; - IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; +#ifdef IVAS_FLOAT_FIXED + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0,0 }, { 0, 0, 0, 0, 0, 0, 0 } }; +#else + IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0, }, { 0, 0,0 }, { 0, 0, 0 } }; +#endif int16_t vec_pos_update, vec_pos_len; int16_t nOutSamples = 0; diff --git a/lib_com/basop32.c b/lib_com/basop32.c index d9f2875be..d55338764 100644 --- a/lib_com/basop32.c +++ b/lib_com/basop32.c @@ -3685,7 +3685,7 @@ Word16 i_mult_o(Word16 a, Word16 b, Flag* Overflow) { #ifdef ORIGINAL_G7231 return a * b; #else - Word32 register c = a * b; + register Word32 c = a * b; return saturate_o(c, Overflow); #endif } diff --git a/lib_com/basop32.h b/lib_com/basop32.h index 372348816..535b08d09 100644 --- a/lib_com/basop32.h +++ b/lib_com/basop32.h @@ -241,6 +241,7 @@ Word16 norm_s( Word16 var1 ); /* Word16 div_s( Word16 var1, Word16 var2 ); /* Short division, 18 */ Word32 div_w(Word32 L_num, Word32 L_den); Word16 norm_l( Word32 L_var1 ); /* Long norm, 1 */ +Word32 L_sat(Word32 L_var1); /* Long saturation, 4 */ #endif /* BASOP_NOGLOB */ diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index 8190378b7..6f31adeef 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -7,6 +7,7 @@ #include "options.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #include "basop_util.h" #include "rom_com.h" diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index c75094595..5b70971d3 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -40,6 +40,7 @@ #include "options.h" #include "ivas_cnst.h" /* Common constants */ #include "prot_fx2.h" /* Function prototypes */ +#include "ivas_prot_fx.h" #include "basop_util.h" #include "rom_com.h" #include "mime.h" diff --git a/lib_com/enr_1_az.c b/lib_com/enr_1_az.c index 6d6cbf20d..4bd1ab543 100644 --- a/lib_com/enr_1_az.c +++ b/lib_com/enr_1_az.c @@ -39,6 +39,7 @@ #include "cnst.h" #include "prot.h" #include "wmc_auto.h" +#include "prot_fx2.h" /*-------------------------------------------------------------------* * enr_1_Az() diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index c99088fcd..7f8411445 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -51,7 +51,9 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void mhvals_flt( const int16_t d, float *m ); +#endif static void getmidbands( int16_t *part, const int16_t npart, int16_t *midband, float *psize_flt, float *psize_inv_flt ); @@ -1215,6 +1217,7 @@ void SynthesisSTFT_dirac_fx( * Compute some values used in the bias correction of the minimum statistics algorithm *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void mhvals_flt( const int16_t d, float *m ) @@ -1254,6 +1257,7 @@ static void mhvals_flt( return; } +#endif /*------------------------------------------------------------------- * rand_gauss_flt() diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index a559680b1..a02bc15f4 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -11,6 +11,7 @@ #include "rom_com.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #define DELTA_SHIFT 2 #define DELTA_SHIFT_LD64 67108864l/*DELTA_SHIFT/64.0 Q31*/ diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 883f3ba54..9da36155b 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -80,8 +80,8 @@ void floatToFixed_arr32( float *f, Word32 *i, Word16 Q, Word16 l ) float fixedToFloat_32( Word32 number, Word16 Q ) { float val = 0.0f; - assert( fabs( Q ) <= 63 ); - if ( fabs( Q ) > 31 ) + assert( abs_s( Q ) <= 63 ); + if (abs_s( Q ) > 31 ) { if ( Q > 0 ) { @@ -102,8 +102,8 @@ float fixedToFloat_32( Word32 number, Word16 Q ) Word32 floatToFixed_32( float number, Word16 Q ) { float val = 0.0f; - assert( fabs( Q ) <= 63 ); - if ( fabs( Q ) > 31 ) + assert(abs_s( Q ) <= 63 ); + if (abs_s( Q ) > 31 ) { if ( Q > 0 ) { @@ -312,18 +312,16 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( { //H_IGF_GRID hGrid; - IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; - hPrivateData = &st->hIGFDec->igfData; + //IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; + //hPrivateData = &st->hIGFDec->igfData; //H_IGF_INFO hIGFInfo = &hPrivateData->igfInfo; //ACELP_config *pConfigAcelp = &( st->acelp_cfg ); Word16 i = 0, - Q_old_synth = 0, Q_syn = 0,/* Q_synth_history = 0,*/ /*Q_fer_samples = 0,*/ + //Q_syn = 0,/* Q_synth_history = 0,*/ /*Q_fer_samples = 0,*/ Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//, //Q_pst_old_syn = 0, //delay_comp = 0; - Word16 Q_lsf_cng = Q_factor( 6400 ); - if ( tofix ) { //hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM]; @@ -352,7 +350,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( //st->hTcxDec->Q_syn_Overl = Q_factor_arr( st->hTcxDec->syn_Overl_float, L_FRAME32k / 2 ) - 1; //st->hTcxDec->Q_syn_Overl_TDACFB = Q_factor_arr( st->hTcxDec->syn_Overl_TDACFB_float, L_FRAME32k / 2 ); //st->hTcxDec->Q_syn_OverlFB = Q_factor_arr( st->hTcxDec->syn_OverlFB_float, L_FRAME_MAX / 2 ); - Q_old_synth = Q_syn; + //Q_old_synth = Q_syn; //Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX ); //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); @@ -430,12 +428,12 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); //hGrid->fFactor_flt = fixedToFloat( hGrid->fFactor, 14 ); //hGrid->lFactor_flt = fixedToFloat( hGrid->lFactor, 14 ); - IF( st->hIGFDec ) - { - //st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; - //st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; - //st->hIGFDec->igfData.igfInfo.nfSeed = &st->hIGFDec->igfData.igfInfo.nfSeedBuf[0]; - } + //IF( st->hIGFDec ) + //{ + // //st->hIGFDec->virtualSpec_float = &st->hIGFDec->virtualSpecBuf[0]; + // //st->hIGFDec->igfData.pSpecFlat_float = &st->hIGFDec->igfData.pSpecFlatBuf[0]; + // //st->hIGFDec->igfData.igfInfo.nfSeed = &st->hIGFDec->igfData.igfInfo.nfSeedBuf[0]; + //} //st->TcxBandwidth_float = fixedToFloat( st->TcxBandwidth, 15 ); //IF( st->hBWE_TD != NULL ) @@ -445,7 +443,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( //} IF( st->hTcxDec ) { - Q_old_synth = Q_syn; + //Q_old_synth = Q_syn; //Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX ); //st->hTcxDec->Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); @@ -487,7 +485,6 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( fixedToFloat_arrL( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->cldfb_state, Q_cldfbSynHB_cldfb_state, st->cldfbSynHB->cldfb_state_length ); } - Q_lsf_cng = Q_factor( 6400 ); IF( st->hTcxLtpDec != NULL ) { //Q_tcxltp_mem_in = Q_factor_arr( st->hTcxLtpDec->tcxltp_mem_in_float, TCXLTP_MAX_DELAY ); @@ -514,16 +511,18 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( { TCX_LTP_DEC_HANDLE hTcxLtpDec = st->hTcxLtpDec; TCX_DEC_HANDLE hTcxDec = st->hTcxDec; - Word16 i=0, bfi=0; - IF(EQ_32(frameMode, FRAMEMODE_NORMAL)) - { - bfi = 0; - } + Word16 i = 0; //bfi = 0; - IF(EQ_32(frameMode, FRAMEMODE_MISSING)) - { - bfi = 1; - } + UNUSED_PARAM(frameMode); + //IF(EQ_32(frameMode, FRAMEMODE_NORMAL)) + //{ + // bfi = 0; + //} + + //IF(EQ_32(frameMode, FRAMEMODE_MISSING)) + //{ + // bfi = 1; + //} bool reconf = ( st->bits_frame_nominal != st->last_bits_frame_nominal ) || ( st->bwidth != st->last_bwidth ) || ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) || @@ -532,12 +531,12 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( { //H_IGF_GRID hGrid; - IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; - hPrivateData = &st->hIGFDec->igfData; + //IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData; + //hPrivateData = &st->hIGFDec->igfData; //H_IGF_INFO hIGFInfo = &hPrivateData->igfInfo; //ACELP_config *pConfigAcelp = &( st->acelp_cfg ); Word16 /*i = 0,*/ - Q_old_synth = 0, Q_syn = 0, Q_synth_history = 0, Q_old_exc = 0,/* Q_fer_samples = 0,*/ + /* Q_syn = 0,*/ /* Q_fer_samples = 0,*/ Q_cldfbAna_cldfb_state = 0, Q_cldfbBPF_cldfb_state = 0, Q_cldfbSyn_cldfb_state = 0, Q_cldfbSynHB_cldfb_state = 0;//, //Q_pst_old_syn = 0, //delay_comp = 0; @@ -563,7 +562,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //delay_comp = NS2SA_fx2( st->output_Fs, DELAY_CLDFB_NS ); /*CLDFB delay*/ //st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); //st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); - Q_syn = 0; + //Q_syn = 0; IF( st->hTcxDec ) { @@ -572,8 +571,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //st->hTcxDec->Q_syn_Overl = 0; //st->hTcxDec->Q_syn_Overl_TDACFB = 0; //st->hTcxDec->Q_syn_OverlFB = 0; - Q_old_synth = 0; - Q_synth_history = 0; + //Q_old_synth = 0; //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 ); @@ -634,8 +632,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( } else { - Q_old_exc = st->Q_exc; - Q_syn = st->Q_syn; + //Q_syn = st->Q_syn; //hGrid = &hIGFInfo->grid[IGF_GRID_LB_NORM]; //fixedToFloat_arr( &hGrid->whiteningThreshold[0][0], &hGrid->whiteningThreshold_flt[0][0], 13, IGF_MAX_TILES * 2 ); //hGrid->gFactor_flt = fixedToFloat( hGrid->gFactor, 14 ); @@ -664,8 +661,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //} IF( st->hTcxDec ) { - Q_old_synth = Q_syn; - Q_synth_history = 0; + //Q_old_synth = Q_syn; //st->hTcxDec->Q_old_syn_Overl = st->Q_syn + 1; //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 ); diff --git a/lib_com/guided_plc_util.c b/lib_com/guided_plc_util.c index 910c114e2..a38b1f96d 100644 --- a/lib_com/guided_plc_util.c +++ b/lib_com/guided_plc_util.c @@ -44,7 +44,9 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void reorder_lsfs_flt( float *lsf, float min_dist, const int16_t n, const int32_t sr_core ); +#endif /*-------------------------------------------------------------------* @@ -236,6 +238,7 @@ void modify_lsf_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void reorder_lsfs_flt( float *lsf, /* i/o: vector of lsfs in the frequency domain (0..0.5)*/ float min_dist, /* i : minimum required distance */ @@ -321,3 +324,4 @@ static void reorder_lsfs_flt( return; } +#endif \ No newline at end of file diff --git a/lib_com/interpol.c b/lib_com/interpol.c index 7969b8ab2..c90aa9f0e 100644 --- a/lib_com/interpol.c +++ b/lib_com/interpol.c @@ -41,6 +41,8 @@ #include "rom_com.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "prot_fx_enc.h" + /*-------------------------------------------------------------------* * interpolation() * diff --git a/lib_com/ivas_agc_com_fx.c b/lib_com/ivas_agc_com_fx.c index ceb4f5950..20a045973 100644 --- a/lib_com/ivas_agc_com_fx.c +++ b/lib_com/ivas_agc_com_fx.c @@ -107,25 +107,25 @@ void ivas_agc_calcGainParams_fx( UWord16 *maxAttExp, const Word16 numCoeffs ) { - Word16 totExp; - Word16 Bm; - Word16 nbits; + //Word16 totExp; + //Word16 Bm; + //Word16 nbits; - nbits = NBITS_DIFFG; + //nbits = NBITS_DIFFG; assert( EQ_16( numCoeffs, IVAS_SPAR_MAX_DMX_CHS ) ); *absEmin = s_max( ABS_EMIN_MAX, LOG2_NUMCOEFF_SQRKMAX ); - totExp = add( add( *absEmin, AGC_EMAX ), 1 ); + //totExp = add( add( *absEmin, AGC_EMAX ), 1 ); /**betaE = (UWord16)ceilf(logf(totExp) * INV_LOG_2);*/ *betaE = (UWord16) LOG2_4; /*Bm = (UWord16)ceilf(logf((AGC_EMAX + 1 + 1)) * INV_LOG_2);*/ - Bm = 1; + //Bm = 1; - IF( GT_16( nbits, 0 ) ) - { - Bm = s_min( AGC_BITS_PER_CH - 1, NBITS_DIFFG ); - } + //IF( GT_16( nbits, 0 ) ) + //{ + // Bm = s_min( AGC_BITS_PER_CH - 1, NBITS_DIFFG ); + //} /**maxAttExp = ((UWord16) powf( 2, Bm ) ) - 2;*/ *maxAttExp = sub( shl( 2, 1 ), 2 ); diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index e7cdc7c5b..78b6afcbc 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -48,6 +48,9 @@ static void ivas_get_active_bins( const int16_t **pActive_bins, const int16_t ** static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im, float **ppNew_FRs_re, float **ppNew_FRs_im, const int16_t *pActive_bins, const int16_t *pStart_offset, const int16_t num_bands, const int16_t delay, const int32_t sampling_rate ); static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate ); static ivas_error ivas_fb_mixer_get_window( const int16_t fade_len, const int32_t sampling_rate, const float **pWindow ); +#ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_fb_mixer_get_window_fx( const Word16 fade_len, const Word32 sampling_rate, const Word16 **pWindow ); +#endif /*-----------------------------------------------------------------------------------------* @@ -1111,6 +1114,13 @@ static ivas_error ivas_filterbank_setup( return error; } +#ifdef IVAS_FLOAT_FIXED + if ( ( error = ivas_fb_mixer_get_window_fx( pCfg->fade_len, sampling_rate, &( hFbMixer->pFilterbank_cross_fade_fx ) ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif + if ( pCfg->num_out_chans > 0 ) { ivas_filterbank_t *pFb = hFbMixer->pFb; @@ -1271,6 +1281,60 @@ static ivas_error ivas_fb_mixer_get_window( return error; } +#ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_fb_mixer_get_window_fx( + const Word16 fade_len, /* i : window fading length in samples */ + const Word32 sampling_rate, /* i : sampling rate */ + const Word16 **pWindow /* o : pointer to the window coefficents */ +) +{ + ivas_error error; + + error = IVAS_ERR_OK; + + IF ( EQ_16( fade_len, NS2SA( sampling_rate, DELAY_FB_4_NS ) ) ) + { + SWITCH ( sampling_rate ) + { + case 48000: + *pWindow = ivas_fb_cf_4ms_48k_fx; + BREAK; + case 32000: + *pWindow = ivas_fb_cf_4ms_32k_fx; + break; + case 16000: + *pWindow = ivas_fb_cf_4ms_16k_fx; + break; + default: + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unsupported Sampling frequency!" ); + } + } + ELSE IF ( EQ_16( fade_len, NS2SA( sampling_rate, DELAY_FB_1_NS ) ) ) + { + SWITCH ( sampling_rate ) + { + case 48000: + *pWindow = ivas_fb_cf_1ms_48k_fx; + BREAK; + case 32000: + *pWindow = ivas_fb_cf_1ms_32k_fx; + BREAK; + case 16000: + *pWindow = ivas_fb_cf_1ms_16k_fx; + BREAK; + default: + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Unsupported Sampling frequency!" ); + } + } + ELSE + { + IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Incorrect FB window fade len (%f ms)\n", ( fade_len / 1000000.f ) ); + } + + return error; +} + +#endif static const float *ivas_get_cheby_ramp( const int16_t delay ) diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 7f4db1398..b3b8b0b34 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -42,6 +42,7 @@ #include "wmc_auto.h" #include "ivas_prot_fx.h" #include "prot_fx1.h" +#include "prot_fx2.h" #define IVAS_FLOAT_FIXED_TO_BE_REMOVED diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 4fa9f5701..0a7e7967b 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -42,6 +42,7 @@ #include "wmc_auto.h" #include "ivas_rom_com_fx.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" /*--------------------------------------------------------------- @@ -1831,7 +1832,7 @@ void ivas_omasa_modify_masa_energy_ratios( void ivas_omasa_modify_masa_energy_ratios_fx( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] /* Q30 */ ) + Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] /* Q30 */ ) { Word16 i, m, d, b; diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index a5a8af1cd..d7b0c9e33 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -40,6 +40,7 @@ #include "ivas_rom_com.h" #include "rom_com.h" #include +#include "prot_fx2.h" /*--------------------------------------------------------------- * Local constants @@ -904,8 +905,8 @@ static Word16 get_bits_ism( Word32 val ) void calculate_nbits_meta_fx( const Word16 nchan_ism, - const Word32 q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], // Q30 - const Word32 masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q30 + Word32 q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], // Q30 + Word32 masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q30 const Word16 numSf, const Word16 numCodingBands, Word16 *bits_ism, diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index b5522fb5d..42ef2c05f 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1621,6 +1621,7 @@ void stereo_dft_dec_synthesize( const int16_t output_frame /* i : output frame length */ ); +#ifndef IVAS_FLOAT_FIXED void stereo_dft_dec( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ Decoder_State *st0, /* i/o: decoder state structure */ @@ -1635,6 +1636,7 @@ void stereo_dft_dec( const int16_t nchan_transport, /* i : number of transpor channels */ const int16_t num_md_sub_frames /* i : number of MD subframes */ ); +#endif void stereo_dft_res_ecu( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: Decoder DFT stereo handle */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index e6c840fef..4d63129c5 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -164,7 +164,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx( void ivas_omasa_modify_masa_energy_ratios_fx( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] // Q30 + Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] // Q30 ); Word32 calculate_cpe_brate_MASA_ISM_fx( @@ -1827,6 +1827,20 @@ Word16 set_ACELP_flag_IVAS( const Word16 cng_type /* i : CNG type */ ); +void ivas_calc_c_p_coeffs_fx( + ivas_spar_md_t *pSparMd, + Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 q_cov_real, + const Word16 i_ts, + Word32 ***mixer_mat, + Word16 q_mixer_mat, + const Word16 num_ch, + const Word16 num_dmx, + const Word16 band_idx, + const Word16 dtx_vad, + const Word16 compute_p_flag, + const Word16 dyn_active_w_flag ); + Word16 is_SIDrate( const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); diff --git a/lib_com/ivas_qspherical_com.c b/lib_com/ivas_qspherical_com.c index 3d6ad98b1..c7cbe3aba 100644 --- a/lib_com/ivas_qspherical_com.c +++ b/lib_com/ivas_qspherical_com.c @@ -40,6 +40,7 @@ #include "prot.h" #include "cnst.h" #include "wmc_auto.h" +#include "ivas_prot_fx.h" /*------------------------------------------------------------------------- diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 39fb8cd23..9fb0c9c6e 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -6416,6 +6416,24 @@ const float ivas_fb_cf_4ms_16k[IVAS_FB_4MS_16K_SAMP] = 0.9664963994f, 0.9747640903f, 0.9818880329f, 0.9878510650f, 0.9926388212f, 0.9962397673f, 0.9986452283f, 0.9998494093f, }; +#ifdef IVAS_FLOAT_FIXED +const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP] = +{ +0, 4, 13, 26, 44, 66, 92, 123, 158, 197, 241, 289, 341, 398, 458, 524, 593, 667, 744, 826, 913, 1003, 1097, 1196, 1298, 1405, 1516, 1630, 1749, 1871, 1998, 2128, 2262, 2400, 2541, 2687, 2836, 2988, 3144, 3304, 3467, 3634, 3804, 3977, 4154, 4334, 4517, 4704, 4893, 5086, 5282, 5480, 5682, 5886, 6094, 6304, 6516, 6732, 6949, 7170, 7393, 7618, 7846, 8076, 8308, 8542, 8779, 9017, 9258, 9500, 9744, 9990, 10238, 10487, 10738, 10990, 11244, 11499, 11756, 12014, 12273, 12533, 12794, 13056, 13319, 13582, 13847, 14112, 14378, 14644, 14911, 15178, 15446, 15713, 15981, 16249, 16518, 16786, 17054, 17321, 17589, 17856, 18123, 18389, 18655, 18920, 19185, 19448, 19711, 19973, 20234, 20494, 20753, 21011, 21268, 21523, 21777, 22029, 22280, 22529, 22777, 23023, 23267, 23509, 23750, 23988, 24225, 24459, 24691, 24921, 25149, 25374, 25597, 25818, 26035, 26251, 26463, 26673, 26881, 27085, 27287, 27485, 27681, 27874, 28063, 28250, 28433, 28613, 28790, 28963, 29133, 29300, 29463, 29623, 29779, 29931, 30080, 30226, 30367, 30505, 30639, 30769, 30896, 31018, 31137, 31251, 31362, 31469, 31571, 31670, 31764, 31854, 31941, 32023, 32100, 32174, 32243, 32309, 32369, 32426, 32478, 32526, 32570, 32609, 32644, 32675, 32701, 32723, 32741, 32754, 32763, 32767, +}; + +const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP] = +{ + 1, 11, 30, 60, 99, 149, 208, 276, 355, 443, 541, 648, 765, 891, 1026, 1171, 1325, 1488, 1660, 1840, 2030, 2228, 2435, 2650, 2873, 3105, 3345, 3592, 3847, 4110, 4380, 4657, 4941, 5233, 5530, 5835, 6146, 6463, 6786, 7115, 7449, 7789, 8134, 8483, 8838, 9197, 9561, 9928, 10300, 10675, 11054, 11435, 11820, 12208, 12598, 12990, 13385, 13781, 14179, 14578, 14978, 15379, 15780, 16182, 16585, 16987, 17388, 17789, 18189, 18588, 18986, 19382, 19777, 20169, 20559, 20947, 21332, 21713, 22092, 22467, 22839, 23206, 23570, 23929, 24284, 24633, 24978, 25318, 25652, 25981, 26304, 26621, 26932, 27237, 27534, 27826, 28110, 28387, 28657, 28920, 29175, 29422, 29662, 29894, 30117, 30332, 30539, 30737, 30927, 31107, 31279, 31442, 31596, 31741, 31876, 32002, 32119, 32226, 32324, 32412, 32491, 32559, 32618, 32668, 32707, 32737, 32756, 32766, +}; + +const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP] = +{ +4, 44, 123, 241, 398, 593, 826, 1097, 1405, 1749, 2128, 2541, 2988, 3467, 3977, 4517, 5086, 5682, 6304, 6949, 7618, 8308, 9017, 9744, 10487, 11244, 12014, 12794, 13582, 14378, 15178, 15981, 16786, 17589, 18389, 19185, 19973, 20753, 21523, 22280, 23023, 23750, 24459, 25149, 25818, 26463, 27085, 27681, 28250, 28790, 29300, 29779, 30226, 30639, 31018, 31362, 31670, 31941, 32174, 32369, 32526, 32644, 32723, 32763, +}; +#endif + + const float ivas_fb_fcs_12band_1ms[IVAS_FB_BANDS_12] = { 0.0083333333f, 0.0250000000f, 0.0416666667f, 0.0583333333f, @@ -6542,6 +6560,23 @@ const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP] = 0.5490085702f, 0.6451423386f, 0.7356983684f, 0.8171966421f, 0.8865052267f, 0.9409606322f, 0.9784701679f, 0.9975923633f, }; +#ifdef IVAS_FLOAT_FIXED +const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP] = +{ + 8, 78, 218, 427, 705, 1050, 1460, 1934, 2470, 3066, 3718, 4425, 5184, 5990, 6840, 7732, 8660, 9622, 10612, 11627, 12663, 13715, 14778, 15847, 16920, 17989, 19052, 20104, 21140, 22155, 23145, 24107, 25035, 25927, 26777, 27583, 28342, 29049, 29701, 30297, 30833, 31307, 31717, 32062, 32340, 32549, 32689, 32759, +}; + +const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP] = +{ + 19, 177, 491, 957, 1573, 2330, 3224, 4244, 5381, 6624, 7960, 9378, 10864, 12403, 13979, 15580, 17187, 18788, 20364, 21903, 23389, 24807, 26143, 27386, 28523, 29543, 30437, 31194, 31810, 32276, 32590, 32748, +}; + +const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP] = +{ +78, 705, 1934, 3718, 5990, 8660, 11627, 14778, 17989, 21140, 24107, 26777, 29049, 30833, 32062, 32689, + }; + +#endif const float ivas_fb_fr_12band_1ms_re[IVAS_FB_12_1MS_LEN] = { diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 360d5095a..e82ffe9b1 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -520,6 +520,15 @@ extern const float ivas_fb_cf_1ms_32k[IVAS_FB_1MS_32K_SAMP]; extern const float ivas_fb_cf_4ms_16k[IVAS_FB_4MS_16K_SAMP]; extern const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP]; +#ifdef IVAS_FLOAT_FIXED +extern const Word16 ivas_fb_cf_4ms_48k_fx[IVAS_FB_4MS_48K_SAMP]; +extern const Word16 ivas_fb_cf_1ms_48k_fx[IVAS_FB_1MS_48K_SAMP]; +extern const Word16 ivas_fb_cf_4ms_32k_fx[IVAS_FB_4MS_32K_SAMP]; +extern const Word16 ivas_fb_cf_1ms_32k_fx[IVAS_FB_1MS_32K_SAMP]; +extern const Word16 ivas_fb_cf_4ms_16k_fx[IVAS_FB_4MS_16K_SAMP]; +extern const Word16 ivas_fb_cf_1ms_16k_fx[IVAS_FB_1MS_16K_SAMP]; +#endif + extern const float ivas_fb_resp_cheby_ramp_32del[IVAS_FB_1MS_32K_SAMP + 1]; extern const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1]; diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index e1c22014a..d04de5815 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -42,6 +42,7 @@ #include #include #include "wmc_auto.h" +#include "ivas_prot_fx.h" /*------------------------------------------------------------------- @@ -284,7 +285,7 @@ void sns_shape_spectrum_fx( const Word16 L_frame /* i : frame length */ ) { - Word16 i, n, k, tmp_k, bw, q_tmp, shift, min_shift = 63; + Word16 i, n, k, tmp_k, bw, q_tmp = 0, shift, min_shift = 63; Word64 L64_tmp[L_FRAME48k]; const UWord8 nBands = pPsychParams->nBands; const UWord8 *bandLengths = pPsychParams->bandLengths; @@ -337,7 +338,7 @@ void sns_shape_spectrum_fx( } } tmp_k = k; - q_tmp = q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); + q_tmp = sub( add( add( *q_spectrum, q_scf_int ), min_shift ), 32 ); IF( GT_16( q_tmp, 30 ) ) { q_tmp = 30; diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index d9994bc39..2f867f212 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -3192,7 +3192,7 @@ void ivas_get_spar_md_from_dirac_fx( { idx = remix_order[i + ndm] - ndm; //P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; - P_dir_fact_fx[idx] = ( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); + P_dir_fact_fx[idx] = Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); //P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[1] ); if ( P_dir_fact_fx[idx] == 0 ) { @@ -3208,7 +3208,7 @@ void ivas_get_spar_md_from_dirac_fx( { idx = remix_order[i + ndm] - ndm; //P_dir_fact[idx] = hSpar_md->band_coeffs[start_band - 1].P_re[i] * hSpar_md->band_coeffs[start_band - 1].P_re[i]; - P_dir_fact_fx[idx] = ( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); + P_dir_fact_fx[idx] = Mpy_32_32( hSpar_md->band_coeffs[start_band - 1].P_re_fx[i], hSpar_md->band_coeffs[start_band - 1].P_re_fx[i] ); //P_dir_fact[idx] = P_dir_fact[idx] / max( IVAS_FLT_EPS, P_norm[2] ); if ( P_dir_fact_fx[idx] == 0 ) { diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 84aaff86c..d9ec5ada7 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -43,6 +43,7 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #endif @@ -1018,8 +1019,8 @@ static void tdm_SCh_LSF_intra_pred_tri_diag_mat_fx( lsf_tmp_ptr1_fx = lsf_tmp_ptr2_fx; *lsf_SCh_ptr_fx = mult_r((*lsf_tmp_ptr1_fx), (*prd_ptr_fx)); - *lsf_tmp_ptr1_fx++; - *prd_ptr_fx++; + lsf_tmp_ptr1_fx++; + prd_ptr_fx++; *lsf_SCh_ptr_fx = add( mult_r( ( *lsf_tmp_ptr1_fx), ( *prd_ptr_fx) ), *lsf_SCh_ptr_fx); v_add_16( lsf_SCh_fx, lsf_mean_out_fx, lsf_SCh_fx, M ); diff --git a/lib_com/longarith.c b/lib_com/longarith.c index 8f7acc21b..78def0889 100644 --- a/lib_com/longarith.c +++ b/lib_com/longarith.c @@ -39,6 +39,10 @@ #include "options.h" #include "prot.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_prot_fx.h" +#include "prot_fx2.h" +#endif /*-------------------------------------------------------------------* diff --git a/lib_com/lpc_tools.c b/lib_com/lpc_tools.c index 410478579..e4f0e5038 100644 --- a/lib_com/lpc_tools.c +++ b/lib_com/lpc_tools.c @@ -42,6 +42,7 @@ #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" +#include "prot_fx2.h" /*-----------------------------------------------------------------* * Local constants diff --git a/lib_com/modif_fs.c b/lib_com/modif_fs.c index a05f39601..caa84ae75 100644 --- a/lib_com/modif_fs.c +++ b/lib_com/modif_fs.c @@ -41,6 +41,7 @@ #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" +#include "prot_fx2.h" /*-------------------------------------------------------------------* * modify_Fs() diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index be45576b7..c426b5556 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -11,6 +11,7 @@ #include #include "rom_enc.h" /* prototypes */ #include "basop_util.h" +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------* * Local functions diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index 77fb370a7..d5ae13697 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -41,6 +41,8 @@ #include "prot.h" #include "wmc_auto.h" #include "ivas_prot.h" +#include "prot_fx2.h" +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------* * Local function prototypes diff --git a/lib_com/options.h b/lib_com/options.h index d8f609b72..0c348e36b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -113,6 +113,7 @@ //#define DBG_WAV_WRITER #define EVS_FLOAT_ENC //#define DUMPS_ENABLED +//#define WMOPS #define FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION #define IVAS_CNST #define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused EVS parameters to remove warnings, these parameters will be used in IVAS */ diff --git a/lib_com/prot.h b/lib_com/prot.h index d55404f79..b4ef842c5 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -9204,6 +9204,10 @@ int16_t DecodeTnsFilterOrderSWBTCX10_flt( Decoder_State *st, const int16_t index //int16_t GetTnsFilterOrderBitsSWBTCX20_flt( const int16_t value, const int16_t index ); //int16_t EncodeTnsFilterOrderSWBTCX20_flt( const int16_t value, const int16_t index ); int16_t DecodeTnsFilterOrderSWBTCX20_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); + +int16_t EncodeTnsFilterOrderSWBTCX10_flt(const int16_t value, const int16_t index); + +int16_t GetTnsFilterOrderBitsSWBTCX10_flt(const int16_t value, const int16_t index); //int16_t GetTnsFilterOrderBits_flt( const int16_t value, const int16_t index ); //int16_t EncodeTnsFilterOrder_flt( const int16_t value, const int16_t index ); int16_t DecodeTnsFilterOrder_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); diff --git a/lib_com/prot_fx1.h b/lib_com/prot_fx1.h index 9ddacf686..87e20a37d 100644 --- a/lib_com/prot_fx1.h +++ b/lib_com/prot_fx1.h @@ -576,6 +576,10 @@ Word16 lin_interp_fx( Word16 ceil_log_2( UWord64 val ); +Word32 imax_pos_fx( + const Word32 *y /* i : Input vector for peak interpolation */ +); + #ifdef IVAS_FLOAT_FIXED void re8_k2y_fx( const Word16 *k, /* i : Voronoi index k[0..7] */ diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index 100904a3f..b3535e585 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -5336,6 +5336,12 @@ void tcx_ltp_get_lpc( const Word16 order ); +void tcx_ltp_get_lpc_fx( + Word32 *x, + const Word16 L, + Word32 *A, + const Word16 order ); + void predict_signal( const Word16 excI[], /* i : i excitation buffer */ Word16 excO[], /* o : output excitation buffer */ @@ -9184,8 +9190,8 @@ void save_synthesis_hq_fec_fx( ); void calculate_nbits_meta_fx( const Word16 nchan_ism, - const Word32 q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], // Q30 - const Word32 masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q30 + Word32 q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], // Q30 + Word32 masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], // Q30 const Word16 numSf, const Word16 numCodingBands, Word16 *bits_ism, diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index 695c93c96..256fc16d7 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -10933,74 +10933,74 @@ const Word16 msNoiseSlopeMax[4] = { 32767/*2.f Q14*/, 26214/*1.6f Q14*/, 21299 const SCALE_SETUP scaleTableStereo[SIZE_SCALE_TABLE_STEREO] = { - { 1, 0, 8000, -5.5f, -704/*-5.5f Q7*/ }, - { 1, 8000, 9600, -5.0f, -640/*-5.0f Q7*/ }, - { 1, 9600, 13200, -4.0f, -512/*-4.0f Q7*/ }, - { 1, 13200, 16400, -3.0f, -384/*-3.0f Q7*/ }, - { 1, 16400, 24400, -1.6f, -204/*-1.6f Q7*/ }, - { 1, 24400, 32000, -0.2f, -26/*-1.6f Q7*/ }, - { 1, 32000,512001, 0.0f, 0 /*0.0f Q7*/ }, - - { 2, 0, 8000, -0.9f , -115/*-0.9f Q7*/}, - { 2, 8000, 9600, -0.65f, -83/*-0.65f Q7*/}, - { 2, 9600, 13200, -2.0f , -256/*-2.0f Q7*/}, - { 2, 13200, 16400, -3.0f , -384/*-3.0f Q7*/}, - { 2, 16400, 24400, -0.8f , -102/*-0.8f Q7*/}, - { 2, 24400, 32000, -0.25f, -32/*-0.25f Q7*/}, - { 2, 32000,512001, 0.0f , 0/* 0.0f Q7*/} + { 1, 0, 8000, -5.5f, -704/*-5.5f Q7*/, -704 }, + { 1, 8000, 9600, -5.0f, -640/*-5.0f Q7*/, -640 }, + { 1, 9600, 13200, -4.0f, -512/*-4.0f Q7*/, -512 }, + { 1, 13200, 16400, -3.0f, -384/*-3.0f Q7*/, -384 }, + { 1, 16400, 24400, -1.6f, -204/*-1.6f Q7*/, -204 }, + { 1, 24400, 32000, -0.2f, -26/*-1.6f Q7*/, -26 }, + { 1, 32000,512001, 0.0f, 0 /*0.0f Q7*/, 0 }, + + { 2, 0, 8000, -0.9f , -115/*-0.9f Q7*/, -115 }, + { 2, 8000, 9600, -0.65f, -83/*-0.65f Q7*/, -83 }, + { 2, 9600, 13200, -2.0f , -256/*-2.0f Q7*/, -256 }, + { 2, 13200, 16400, -3.0f , -384/*-3.0f Q7*/, -384 }, + { 2, 16400, 24400, -0.8f , -102/*-0.8f Q7*/, -102 }, + { 2, 24400, 32000, -0.25f, -32/*-0.25f Q7*/, -32 }, + { 2, 32000,512001, 0.0f , 0/* 0.0f Q7*/, 0 } }; #if 0 //scaleTableStereo recheck extended from scaleTableMono #endif const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO] = { - { 0, 0, 8000, -5.5f, -704/*-5.5f Q7*/ }, - { 0, 8000, 9600, -5.0f, -640/*-5.0f Q7*/ }, - { 0, 9600, 13200, -4.0f, -512/*-4.0f Q7*/ }, - { 0, 13200, 16400, -3.0f, -384/*-3.0f Q7*/ }, - { 0, 16400, 24400, -1.5f, -192/*-1.5f Q7*/ }, - { 0, 24400,128001, -0.5f, -64/*-0.5f Q7*/ }, - - { 1, 0, 8000, -5.5f , -704/*-5.5f Q7*/}, - { 1, 8000, 9600, -5.0f , -640/*-5.0f Q7*/}, - { 1, 9600, 13200, -1.55f, -198/*-1.55f Q7*/}, - { 1, 13200, 16400, -3.0f , -384/*-3.0f Q7*/}, - { 1, 16400, 24400, -0.6f , -77/*-0.6f Q7*/}, - { 1, 24400, 32000, -0.2f , -26/*-0.2f Q7*/}, - { 1, 32000,128001, 0.0f , 0/* 0.0f Q7*/}, - - { 2, 0, 8000, -0.9f , -115/*-0.9f Q7*/}, - { 2, 8000, 9600, -0.65f, -83/*-0.65f Q7*/}, - { 2, 9600, 13200, -2.0f , -256/*-2.0f Q7*/}, - { 2, 13200, 16400, -3.0f , -384/*-3.0f Q7*/}, - { 2, 16400, 24400, -0.8f , -102/*-0.8f Q7*/}, - { 2, 24400, 32000, -0.25f, -32/*-0.25f Q7*/}, - { 2, 32000,128001, 0.0f , 0/* 0.0f Q7*/} + { 0, 0, 8000, -5.5f, -704/*-5.5f Q7*/, -704 }, + { 0, 8000, 9600, -5.0f, -640/*-5.0f Q7*/, -640 }, + { 0, 9600, 13200, -4.0f, -512/*-4.0f Q7*/, -512 }, + { 0, 13200, 16400, -3.0f, -384/*-3.0f Q7*/, -384 }, + { 0, 16400, 24400, -1.5f, -192/*-1.5f Q7*/, -192 }, + { 0, 24400,128001, -0.5f, -64/*-0.5f Q7*/, -64 }, + + { 1, 0, 8000, -5.5f , -704/*-5.5f Q7*/, -704 }, + { 1, 8000, 9600, -5.0f , -640/*-5.0f Q7*/, -640 }, + { 1, 9600, 13200, -1.55f, -198/*-1.55f Q7*/, -198 }, + { 1, 13200, 16400, -3.0f , -384/*-3.0f Q7*/,-384 }, + { 1, 16400, 24400, -0.6f , -77/*-0.6f Q7*/, -77 }, + { 1, 24400, 32000, -0.2f , -26/*-0.2f Q7*/, -26 }, + { 1, 32000,128001, 0.0f , 0/* 0.0f Q7*/, 0 }, + + { 2, 0, 8000, -0.9f , -115/*-0.9f Q7*/, -115 }, + { 2, 8000, 9600, -0.65f, -83/*-0.65f Q7*/, -83 }, + { 2, 9600, 13200, -2.0f , -256/*-2.0f Q7*/, -256 }, + { 2, 13200, 16400, -3.0f , -384/*-3.0f Q7*/, -384 }, + { 2, 16400, 24400, -0.8f , -102/*-0.8f Q7*/, -102 }, + { 2, 24400, 32000, -0.25f, -32/*-0.25f Q7*/, -32 }, + { 2, 32000,128001, 0.0f , 0/* 0.0f Q7*/,0 } }; const SCALE_SETUP scaleTable_cn_only[SIZE_SCALE_TABLE_CN] = { - { 0, 0, 8000, -3.5f, 20295/*1.2387211385 Q14*/ /*-3.5f*/ }, - { 0, 8000, 9600, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/ }, - { 0, 9600, 13200, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 0, 13200, 16400, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/ }, - { 0, 16400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/ }, - - { 1, 0, 8000, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/ }, - { 1, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 1, 9600, 13200, -1.5f, 6759/*0.4125375748 Q14*/ /*-1.5f*/ }, - { 1, 13200, 16400, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 1, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/ }, - { 1, 24400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/ }, - - { 2, 0, 8000, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 2, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/ }, - { 2, 9600, 13200, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/ }, - { 2, 13200, 16400, -1.0f, 4242/*0.2589254379 Q14*/ /*-1.0f*/ }, - - { 2, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/ }, - { 2, 24400, 32000, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/ }, - { 2, 32000,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/ } + { 0, 0, 8000, -3.5f, 20295/*1.2387211385 Q14*/ /*-3.5f*/, 20295 }, + { 0, 8000, 9600, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 }, + { 0, 9600, 13200, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 0, 13200, 16400, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 }, + { 0, 16400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, + + { 1, 0, 8000, -3.0f, 16306/*0.9952622652 Q14*/ /*-3.0f*/, 16306 }, + { 1, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 1, 9600, 13200, -1.5f, 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 }, + { 1, 13200, 16400, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 1, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 }, + { 1, 24400,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, + + { 2, 0, 8000, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 2, 8000, 9600, -2.5f, 12751/*0.7782794237 Q14*/ /*-2.5f*/, 12751 }, + { 2, 9600, 13200, -2.0f, 9583/*0.5848932266 Q14*/ /*-2.0f*/, 9583 }, + { 2, 13200, 16400, -1.0f, 4242/*0.2589254379 Q14*/ /*-1.0f*/, 4242 }, + + { 2, 16400, 24400, -0.5f, 1999/*0.1220184565 Q14*/ /*-0.5f*/, 1999 }, + { 2, 24400, 32000, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 }, + { 2, 32000,128001, 0.0f, 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 } }; #if 0 //scaleTable_cn_dirac recheck extended from scaleTable_cn_only diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index f1cae97fe..f50094e78 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -744,14 +744,10 @@ Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 */ Word16 sign = 0; const Word32 *ptr; Word16 exp2, tmp_exp; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif BASOP_SATURATE_WARNING_OFF_EVS /* this is required for adaptative precision energy summation loop, do not remove */ - Overflow = 0; move16(); exp2 = 0; move16(); diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index ea5cbcd09..300433048 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -3056,7 +3056,31 @@ void GenShapedSHBExcitation_ivas_fx( } else #else - UNUSED_PARAM(Env_error_part, Env_error, EnvSHBres_4k, c5_part, c1, den, c3_part, c0, delta, c3, c2_part, c1_part, EnvWhiteExc16k, g2, c5, c4_part, EnvWhiteExc16k_4k, c2, g, cbsize, g1, EnvExc16kWhtnd, c0_part, EnvExc16kWhtnd_4k, c4); + UNUSED_PARAM(Env_error_part); + UNUSED_PARAM(Env_error); + UNUSED_PARAM(EnvSHBres_4k); + UNUSED_PARAM(c5_part); + UNUSED_PARAM(c1); + UNUSED_PARAM(den); + UNUSED_PARAM(c3_part); + UNUSED_PARAM(c0); + UNUSED_PARAM(delta); + UNUSED_PARAM(c3); + UNUSED_PARAM(c2_part); + UNUSED_PARAM(c1_part); + UNUSED_PARAM(EnvWhiteExc16k); + UNUSED_PARAM(g2); + UNUSED_PARAM(c5); + UNUSED_PARAM(c4_part); + UNUSED_PARAM(EnvWhiteExc16k_4k); + UNUSED_PARAM(c2); + UNUSED_PARAM(g); + UNUSED_PARAM(cbsize); + UNUSED_PARAM(g1); + UNUSED_PARAM(EnvExc16kWhtnd); + UNUSED_PARAM(c0_part); + UNUSED_PARAM(EnvExc16kWhtnd_4k); + UNUSED_PARAM(c4); #endif { Estimate_mix_factors_fx(shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc, White_exc16k, diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index 7a858fac3..a3bc741bd 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -91,7 +91,7 @@ static Word32 syn_kern_10_fx(Word32 L_tmp, const Word32 a[], const Word32 y[]) return syn_kern_2_fx(L_tmp, a + 8, y - 8); } -Word32 syn_kern_16_fx(Word32 L_tmp, const Word32 a[], const Word32 y[]) +static Word32 syn_kern_16_fx(Word32 L_tmp, const Word32 a[], const Word32 y[]) { L_tmp = syn_kern_8_fx(L_tmp, a, y); return syn_kern_8_fx(L_tmp, a + 8, y - 8); diff --git a/lib_com/tcx_ltp.c b/lib_com/tcx_ltp.c index e4c86f2b1..78558964f 100644 --- a/lib_com/tcx_ltp.c +++ b/lib_com/tcx_ltp.c @@ -53,6 +53,7 @@ * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_get_lpc_flt( float *input, const int16_t length, @@ -83,6 +84,7 @@ static void tcx_ltp_get_lpc_flt( return; } +#endif /*------------------------------------------------------------------- @@ -91,6 +93,7 @@ static void tcx_ltp_get_lpc_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_get_zir_flt( float *zir, const int16_t length, @@ -158,6 +161,7 @@ static void tcx_ltp_get_zir_flt( return; } +#endif /*------------------------------------------------------------------- @@ -214,6 +218,7 @@ void predict_signal_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_flt( float *synth_ltp, float *synth, @@ -273,7 +278,7 @@ static void tcx_ltp_synth_filter_flt( return; } - +#endif /*------------------------------------------------------------------- * tcx_ltp_synth_filter_zir_flt() @@ -281,6 +286,7 @@ static void tcx_ltp_synth_filter_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_zir_flt( float *synth_ltp, float *synth, @@ -334,6 +340,7 @@ static void tcx_ltp_synth_filter_zir_flt( return; } +#endif /*------------------------------------------------------------------- @@ -342,6 +349,7 @@ static void tcx_ltp_synth_filter_zir_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_fadein_flt( float *synth_ltp, float *synth, @@ -408,6 +416,7 @@ static void tcx_ltp_synth_filter_fadein_flt( return; } +#endif /*------------------------------------------------------------------- @@ -416,6 +425,7 @@ static void tcx_ltp_synth_filter_fadein_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_fadeout_flt( float *synth_ltp, float *synth, @@ -479,6 +489,7 @@ static void tcx_ltp_synth_filter_fadeout_flt( return; } +#endif /*------------------------------------------------------------------- @@ -548,6 +559,7 @@ int16_t tcx_ltp_decode_params_flt( * * ---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_10_flt( float *out, float *in, @@ -604,6 +616,7 @@ static void tcx_ltp_synth_filter_10_flt( return; } +#endif /*------------------------------------------------------------------- @@ -612,6 +625,7 @@ static void tcx_ltp_synth_filter_10_flt( * ---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_01_flt( float *out, float *in, @@ -668,6 +682,7 @@ static void tcx_ltp_synth_filter_01_flt( return; } +#endif #define MAX_TCX_LTP_FILTER_LEN 8 #define MAX_TRANSITION_LEN 240 /* L_FRAME_48K / 4 */ @@ -683,6 +698,7 @@ static void tcx_ltp_synth_filter_01_flt( * the current update interval with scaling from 0 towards non-zero gain ---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tcx_ltp_synth_filter_11_unequal_pitch_flt( float *out, float *in, @@ -794,7 +810,7 @@ static void tcx_ltp_synth_filter_11_unequal_pitch_flt( return; } - +#endif /*------------------------------------------------------------------- * tcx_ltp_post_flt() diff --git a/lib_com/tools.c b/lib_com/tools.c index 943507c10..f91a2081a 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -40,6 +40,7 @@ #include "prot.h" #include "prot_fx2.h" #include "wmc_auto.h" +#include "prot_fx1.h" /*------------------------------------------------------------------* * own_random() diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 955338c2b..c7e150611 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -50,6 +50,9 @@ #include "basop_util.h" #include "basop32.h" #include "wmc_auto.h" +#include "prot_fx_enc.h" +#include "prot.h" +#include "ivas_prot_fx.h" #define INV_BANDS10 3277 /* 1/10 in Q15 */ #define INV_BANDS9 3641 /* 1/9 in Q15 */ @@ -63,9 +66,13 @@ Word32 float_to_fix( float number, Word32 Q ) { assert( Q >= 0 ); if (number == 1.0f && Q == Q31) + { return ONE_IN_Q31; - if(isnan(number)) - number = 0; + } + if (isnan(number)) + { + number = 0; + } assert( fabs( number ) < pow( 2, 31 - Q ) ); Word32 ret = (Word32) ( number * ( (UWord32) 1 << Q ) ); return ret; diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index a32033be1..eaff59c07 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -19,6 +19,7 @@ #define P92_0Q15 30147 /* ~=round(0.92*2^15) */ #include "options.h" #include "rom_basop_util.h" +#include "prot_fx2.h" void ham_cos_window( @@ -85,11 +86,11 @@ void ham_cos_window_ivas( const Word16 n2 /* i: */ ) { - Word16 cc_fx, cte_fx; + Word16 cc_fx; Word16 i; // cte = PI2 / (float) ( 2 * n1 - 1 ); - cte_fx = div_s(1, sub(shl(n1, 1), 1)); + //cte_fx = div_s(1, sub(shl(n1, 1), 1)); cc_fx = 0; move16(); for ( i = 0; i < n1; i++ ) @@ -99,7 +100,7 @@ void ham_cos_window_ivas( } // cte = PI2 / (float) ( 4 * n2 - 1 ); - cte_fx = div_s(1, sub(shl(n2, 2), 1)); + //cte_fx = div_s(1, sub(shl(n2, 2), 1)); cc_fx = 0; move16(); for ( i = 0; i < n2; i++ ) diff --git a/lib_dec/FEC.c b/lib_dec/FEC.c index c05d32b87..3f19f35eb 100644 --- a/lib_dec/FEC.c +++ b/lib_dec/FEC.c @@ -47,9 +47,13 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void gain_dec_bfi( float *past_qua_en ); +#endif +#ifndef IVAS_FLOAT_FIXED static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word16 new_pit, Word16 Tc, Word16 L_frame ); +#endif /*-------------------------------------------------------------------* * FEC_exc_estim() @@ -488,6 +492,7 @@ void FEC_exc_estim( * next frame *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void gain_dec_bfi( float *past_qua_en /* i/o: gain quantization memory (4 words) */ ) @@ -517,6 +522,7 @@ static void gain_dec_bfi( return; } +#endif #define WMC_TOOL_SKIP @@ -526,6 +532,7 @@ static void gain_dec_bfi( * calculates some conditions for Pulse resynchronization to take place *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, @@ -574,4 +581,5 @@ static void pulseRes_preCalc( return; } +#endif #undef WMC_TOOL_SKIP diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index ba2856625..5208ca9b2 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -88,8 +88,10 @@ * Local functions *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t rand_phase( const int16_t seed, float *sin_F, float *cos_F ); static float imax2_jacobsen_mag( const float *y_re, const float *y_im ); +#endif /*-------------------------------------------------------------------* * mult_rev2() @@ -97,6 +99,7 @@ static float imax2_jacobsen_mag( const float *y_re, const float *y_im ); * Multiplication of two vectors second vector is multiplied in reverse order *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void mult_rev2( const float x1[], /* i : Input vector 1 */ const float x2[], /* i : Input vector 2 */ @@ -113,6 +116,7 @@ static void mult_rev2( return; } +#endif /*-------------------------------------------------------------------* @@ -121,6 +125,7 @@ static void mult_rev2( * Square magnitude of fft spectrum *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fft_spec2( float x[], /* i/o: Input vector: complex spectrum -> square magnitude spectrum */ const int16_t N /* i : Vector length */ @@ -138,6 +143,7 @@ static void fft_spec2( return; } +#endif /*------------------------------------------------------------------* * rand_phase() @@ -145,6 +151,7 @@ static void fft_spec2( * randomized phase in form of sin and cos components *------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: Updated seed from RNG */ static int16_t rand_phase( const int16_t seed, /* i : RNG seed */ @@ -176,6 +183,7 @@ static int16_t rand_phase( return seed2; } +#endif /*----------------------------------------------------------------------------- * imax2_jacobsen_mag() @@ -183,6 +191,7 @@ static int16_t rand_phase( * refine peak interpolation using jacobsen and periodic speca ana windows *----------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: The location, relative to the middle of the 3 given data point, of the maximum. (Q15)*/ float imax2_jacobsen_mag( const float *y_re, /* i : The 3 given data points. real part order -1 0 1 */ @@ -243,6 +252,7 @@ float imax2_jacobsen_mag( return posi; } +#endif /*------------------------------------------------------------------* @@ -251,6 +261,7 @@ float imax2_jacobsen_mag( * Transient analysis *------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void trans_ana( const float *xfp, /* i : Input signal */ float *mag_chg, /* i/o: Magnitude modification */ @@ -432,6 +443,7 @@ static void trans_ana( return; } +#endif /*------------------------------------------------------------------* @@ -694,6 +706,7 @@ float imax_pos( * Spectral analysis *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void spec_ana( const float *prevsynth, /* i : Input signal */ int16_t *plocs, /* o : The indicies of the identified peaks */ @@ -931,6 +944,7 @@ static void spec_ana( return; } +#endif /*-------------------------------------------------------------------* * subst_spec() @@ -938,6 +952,7 @@ static void spec_ana( * Substitution spectrum calculation *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void subst_spec( const int16_t *plocs, /* i : The indicies of the identified peaks */ const float *plocsi, /* i : Interpolated positions of the identified peaks */ @@ -1251,6 +1266,7 @@ static void subst_spec( return; } +#endif /*-------------------------------------------------------------------------- * rec_wtda() @@ -1258,6 +1274,7 @@ static void subst_spec( * Windowing and TDA of reconstructed frame *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void rec_wtda( float *X, /* i/o: ECU frame / unwindowed ECU frame */ float *ecu_rec, /* o : Reconstructed frame in tda domain */ @@ -1366,6 +1383,7 @@ static void rec_wtda( return; } +#endif /*-------------------------------------------------------------------------- @@ -1374,6 +1392,7 @@ static void rec_wtda( * Frame reconstruction *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void rec_frame( float *X, /* i/o: FFT spectrum / IFFT of spectrum */ float *ecu_rec, /* o : Reconstructed frame in tda domain */ @@ -1415,6 +1434,7 @@ static void rec_frame( return; } +#endif /*-------------------------------------------------------------------------- @@ -1423,6 +1443,7 @@ static void rec_frame( * FIR downsampling filter *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fir_dwn( const float x[], /* i : input vector */ const float h[], /* i : impulse response of the FIR filter */ @@ -1475,6 +1496,7 @@ static void fir_dwn( return; } +#endif /*-------------------------------------------------------------------------- @@ -1483,6 +1505,7 @@ static void fir_dwn( * Pitch/correlation analysis and adaptive analysis frame length calculation *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fec_ecu_pitch( const float *prevsynth, /* i : previous synthesis */ float *prevsynth_LP, /* o : down-sampled synthesis */ @@ -1608,6 +1631,7 @@ static void fec_ecu_pitch( return; } +#endif /*-------------------------------------------------------------------------- @@ -1617,6 +1641,7 @@ static void fec_ecu_pitch( * next power of 2 using linear interpolation. *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fec_ecu_dft( const float *prevsynth_LP, /* i : Downsampled past synthesis (2*160 samples) */ const int16_t N, /* i : Analysis frame length in 8 kHz (corr. max) */ @@ -1674,6 +1699,7 @@ static void fec_ecu_dft( return; } +#endif /*--------------------------------------------------------------------------* * singenerator() @@ -1681,7 +1707,7 @@ static void fec_ecu_dft( * fast cosinus generator Amp*cos(2*pi*freq+phi) *--------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void singenerator( const int16_t L, /* i : size of output */ const float cosfreq, /* i : cosine of 1-sample dephasing at the given frequency */ @@ -1731,6 +1757,7 @@ static void singenerator( return; } +#endif /*-------------------------------------------------------------------------- @@ -1739,6 +1766,7 @@ static void singenerator( * ECU frame sinusoid generation *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void sinusoidal_synthesis( const float *Tfr, /* i : DFT coefficients, real part */ const float *Tfi, /* i : DFT coefficients, imag part */ @@ -1862,6 +1890,7 @@ static void sinusoidal_synthesis( return; } +#endif /*-------------------------------------------------------------------------- * fec_noise_filling() @@ -1874,6 +1903,7 @@ static void sinusoidal_synthesis( * it to be inserted into wtda *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fec_noise_filling( const float *prevsynth, /* i : Past synthesis buffer (length 2*L) */ float *synthesis, /* i/o: Sinusoidal ECU / Sinusoidal ECU + noise */ @@ -1989,7 +2019,7 @@ static void fec_noise_filling( return; } - +#endif /*-------------------------------------------------------------------------- * fec_alg() @@ -1998,6 +2028,7 @@ static void fec_noise_filling( * length *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void fec_alg( const float *prevsynth, /* i : previous synthesis */ const float *prevsynth_LP, /* i : down-sampled synthesis */ @@ -2031,6 +2062,7 @@ static void fec_alg( return; } +#endif /*-------------------------------------------------------------------------- @@ -2039,6 +2071,7 @@ static void fec_alg( * Main routine for HQ phase ECU *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void hq_phase_ecu( const float *prevsynth, /* i : buffer of previously synthesized signal */ float *ecu_rec, /* o : reconstructed frame in tda domain */ @@ -2130,6 +2163,7 @@ static void hq_phase_ecu( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index a17dcdfb6..494fa1357 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -64,11 +64,12 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void spectrum_mod_dct( float data[], const float lf_E[], float lf_EO[], const float noiseE[], const float minGain, float lp_gbin[], const int16_t music_flag, int16_t min_band, const float MAX_GN, const int16_t max_band ); - static void analy_sp_dct( const float dct_in[], float dct_buf[], float *fr_bands, float *lf_E, float *etot ); - 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 ); +#endif + #ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------* @@ -366,6 +367,7 @@ void LD_music_post_filter( * spectrum enhancement according to the output of signal_type_clas() *---------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void spectrum_mod_dct( float data[], /* i/o: DCT spectrum */ const float lf_E[], /* i : per bin E for first 46 bins (without DC) */ @@ -520,6 +522,7 @@ static void spectrum_mod_dct( return; } +#endif /*----------------------------------------------------------------------------------* * analy_sp_dct() @@ -527,6 +530,7 @@ static void spectrum_mod_dct( * Spectral analysis of the current synthesized frame *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void analy_sp_dct( const float dct_in[], /* i : input DCT spectrum */ float dct_buf[], /* i : output DCT spectrum */ @@ -553,6 +557,7 @@ static void analy_sp_dct( return; } +#endif /*------------------------------------------------------------------------* * find_enr_dct) @@ -561,6 +566,7 @@ static void analy_sp_dct( * The energy is normalized by the number of frequency bins in a channel *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void find_enr_dct( const float data[], /* i : fft result, for the format see fft_rel.c */ float band[], /* o : per band energy */ @@ -623,6 +629,7 @@ void find_enr_dct( return; } +#endif /*------------------------------------------------------------------------* * Prep_music_postP() diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index b7de77632..7787b4420 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -1971,8 +1971,8 @@ void acelp_decoder_state_float2fix(Decoder_State *st/*, STEREO_CNG_DEC_HANDLE hS old_len_ana = st->cldfbAna->p_filter_length - st->cldfbAna->no_channels; old_len_bpf = st->cldfbBPF->p_filter_length - st->cldfbBPF->no_channels; - Word16 new_len; - new_len = 9 * (int16_t)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f); + //Word16 new_len; + //new_len = 9 * (int16_t)(st->L_frame * FRAMES_PER_SEC * INV_CLDFB_BANDWIDTH + 0.5f); floatToFixed_arrL(st->cldfbAna->cldfb_state, st->cldfbAna->cldfb_state_fx, Q11, old_len_ana); floatToFixed_arrL(st->cldfbBPF->cldfb_state, st->cldfbBPF->cldfb_state_fx, Q10, old_len_bpf); if(st->cldfbSynHB) @@ -2017,7 +2017,7 @@ void acelp_decoder_state_fix2float(Decoder_State *st) { (st->element_mode == IVAS_CPE_TD)) && (!st->BER_detect)) || ((st->element_mode == IVAS_CPE_TD || st->element_mode == IVAS_CPE_DFT) && (st->hFdCngDec->hFdCngCom->active_frame_counter > 0)) || ((st->bfi == 1) && (st->nbLostCmpt == 1)))) || - (st->m_frame_type == ZERO_FRAME) && (st != NULL && st->cng_type == LP_CNG) + ((st->m_frame_type == ZERO_FRAME) && (st != NULL && st->cng_type == LP_CNG)) ) { fixedToFloat_arrL(st->hFdCngDec->msNoiseEst, st->hFdCngDec->msNoiseEst_float, Q31 - st->hFdCngDec->msNoiseEst_exp, st->hFdCngDec->npart_shaping); diff --git a/lib_dec/acelp_core_switch_dec.c b/lib_dec/acelp_core_switch_dec.c index 8e3be6097..e0391ac47 100644 --- a/lib_dec/acelp_core_switch_dec.c +++ b/lib_dec/acelp_core_switch_dec.c @@ -45,7 +45,9 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void decod_gen_voic_core_switch( Decoder_State *st, const int16_t L_frame, const int16_t sharpFlag, const float *Aq, float *exc, const int32_t core_brate ); +#endif /*-------------------------------------------------------------------* diff --git a/lib_dec/arith_coder_dec.c b/lib_dec/arith_coder_dec.c index c1be77e57..12abd4d92 100644 --- a/lib_dec/arith_coder_dec.c +++ b/lib_dec/arith_coder_dec.c @@ -53,6 +53,7 @@ *-------------------------------------------------------*/ /*! r: number of bits consumed */ +#ifndef IVAS_FLOAT_FIXED static int16_t tcx_arith_decode( const int16_t L_frame, /* i : number of spectral lines */ const Word16 envelope[], /* i : scaled envelope (Q15-e) */ @@ -115,6 +116,7 @@ static int16_t tcx_arith_decode( return bp; } +#endif static Word16 tcx_arith_decode_ivas_fx( const Word16 L_frame, /* i : number of spectral lines */ @@ -131,13 +133,13 @@ static Word16 tcx_arith_decode_ivas_fx( Tastat as; UWord16 exp_k; Word16 tmp; - Word32 L_tmp; + //Word32 L_tmp; bp = ari_start_decoding_14bits_prm_ivas_fx( prm, 0, &as ); tmp = sub(envelope_e, 1); - L_tmp = L_deposit_l(0); + //L_tmp = L_deposit_l(0); FOR (k = 0; k < L_frame; k++) { diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index f7c8c7863..ac9a9d608 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -67,7 +67,9 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t Pit_track( const float syn[], int16_t T ); +#endif /*---------------------------------------------------------------------* * bass_psfilter_init() @@ -405,6 +407,7 @@ void bass_psfilter( *---------------------------------------------------------------------*/ /*! r: Pitch */ +#ifndef IVAS_FLOAT_FIXED static int16_t Pit_track( const float syn[], /* i : synthesis [-NBPSF_PIT_MAX..L_HALFR16k] */ int16_t T /* i : pitch period (>= PIT_MIN) */ @@ -449,6 +452,7 @@ static int16_t Pit_track( return ( T ); } +#endif /*---------------------------------------------------------------------* diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index c5001197f..7c773725e 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -58,10 +58,18 @@ void open_decoder_LPD( const int16_t is_init /* i : indicate call during initialization */ ) { +#ifndef IVAS_FLOAT_FIXED int16_t mem_syn_r_size_old; int16_t mem_syn_r_size_new; +#endif +#ifndef IVAS_FLOAT_FIXED int16_t fscaleFB; - int16_t encoderLookahead, encoderLookaheadFB; +#endif + +#ifndef IVAS_FLOAT_FIXED + int16_t encoderLookahead; + int16_t encoderLookaheadFB; +#endif TCX_LTP_DEC_HANDLE hTcxLtpDec = st->hTcxLtpDec; TCX_DEC_HANDLE hTcxDec = st->hTcxDec; @@ -72,7 +80,9 @@ void open_decoder_LPD( st->sr_core = getCoreSamplerateMode2_flt( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); st->fscale = sr2fscale( st->sr_core ); +#ifndef IVAS_FLOAT_FIXED fscaleFB = sr2fscale( st->output_Fs ); +#endif /* initializing variables for frame lengths etc. right in the beginning */ st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); @@ -105,8 +115,11 @@ void open_decoder_LPD( st->TcxBandwidth_float = getTcxBandwidth_flt(bwidth); #endif st->narrowBand = (bwidth == NB) ? 1 : 0; + +#ifndef IVAS_FLOAT_FIXED encoderLookahead = (L_LOOK_12k8 * st->fscale) / FSCALE_DENOM; encoderLookaheadFB = (L_LOOK_12k8 * fscaleFB) / FSCALE_DENOM; +#endif if (st->element_mode == IVAS_CPE_MDCT) { @@ -258,8 +271,10 @@ void open_decoder_LPD( set_zero(st->mem_syn_r_float, L_SYN_MEM); #endif // #ifndef IVAS_FLOAT_FIXED +#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 */ +#endif st->con_tcx = 0; } @@ -273,8 +288,10 @@ void open_decoder_LPD( } #endif /*Compute size of old and new memories*/ +#ifndef IVAS_FLOAT_FIXED 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); +#endif #ifndef IVAS_FLOAT_FIXED /*Reset LPC mem*/ diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index c6baf3efd..eb47d3849 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1110,7 +1110,7 @@ void open_decoder_LPD_ivas_fx( Word16 mem_syn_r_size_new; Word16 mem_syn_r_size_old; Word16 fscaleFB; - Word16 encoderLookahead, encoderLookaheadFB; + //Word16 encoderLookahead, encoderLookaheadFB; BPF_DEC_HANDLE hBPF; TD_BWE_DEC_HANDLE hBWE_TD; TCX_LTP_DEC_HANDLE hTcxLtpDec; @@ -1174,8 +1174,8 @@ void open_decoder_LPD_ivas_fx( st->narrowBand = 1; } // To be replaced with basops - encoderLookahead = mult( L_LOOK_12k8<<6 , st->fscale ); - encoderLookaheadFB = mult(L_LOOK_12k8<<6 , fscaleFB ); + //encoderLookahead = mult( L_LOOK_12k8<<6 , st->fscale ); + //encoderLookaheadFB = mult(L_LOOK_12k8<<6 , fscaleFB ); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { st->pit_res_max = initPitchLagParameters( INT_FS_12k8, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max ); diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index ef01cc2bd..f0afb5983 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -57,10 +57,6 @@ 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 -#ifdef IVAS_FLOAT_FIXED -static void core_switch_lb_upsamp_fx( Decoder_State *st, Word32 *output ); -static void smoothTransitionDtxToTcx_fx( Word32 synth[], const int16_t output_frame, const int16_t delay_comp ); -#endif /*---------------------------------------------------------------------* * core_switching_pre_dec() @@ -2142,77 +2138,6 @@ static void core_switch_lb_upsamp( return; } #endif -#ifdef IVAS_FLOAT_FIXED -static void core_switch_lb_upsamp_fx( - Decoder_State *st, /* i/o: Decoder state */ - Word32 *output /* i/o: LB synth/upsampled LB synth */ -) -{ - Word16 i; - Word32 *realBuffer_fx[CLDFB_OVRLP_MIN_SLOTS], *imagBuffer_fx[CLDFB_OVRLP_MIN_SLOTS]; - Word32 realBufferTmp_fx[CLDFB_OVRLP_MIN_SLOTS][CLDFB_NO_CHANNELS_MAX]; - Word32 imagBufferTmp_fx[CLDFB_OVRLP_MIN_SLOTS][CLDFB_NO_CHANNELS_MAX]; - - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - FOR( i = 0; i < CLDFB_OVRLP_MIN_SLOTS; i++ ) - { - set32_fx( realBufferTmp_fx[i], 0, CLDFB_NO_CHANNELS_MAX ); - set32_fx( imagBufferTmp_fx[i], 0, CLDFB_NO_CHANNELS_MAX ); - realBuffer_fx[i] = realBufferTmp_fx[i]; - imagBuffer_fx[i] = imagBufferTmp_fx[i]; - } - - /* check if the CLDFB works on the right sample rate */ - IF( NE_16( ( st->cldfbAna->no_channels * st->cldfbAna->no_col ), st->L_frame ) ) - { - resampleCldfb_ivas_fx( st->cldfbAna, L_mult0( st->L_frame, FRAMES_PER_SEC ) ); - - IF( st->cldfbBPF != NULL && LE_16( st->L_frame, L_FRAME16k ) ) - { - resampleCldfb_ivas_fx( st->cldfbBPF, L_mult0( st->L_frame, FRAMES_PER_SEC ) ); - } - - IF( GT_16( st->ini_frame, 0 ) ) - { - st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ); - move16(); - } - } - /* analysis of the synthesis at internal sampling rate */ - cldfbAnalysis_ivas_fx( output, realBuffer_fx, imagBuffer_fx, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbAna->no_channels ), st->cldfbAna ); - - /* analysis and add the BPF error signal */ - IF( st->p_bpf_noise_buf_32 ) - { - 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 */ - IF( EQ_16( st->bwidth, NB ) ) - { - /* set NB mask for upsampling */ - st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, 10 ); - } - ELSE IF( NE_16( st->cldfbSyn->bandsToZero, sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ) ) ) - { - /* in case of BW switching, re-init to default */ - st->cldfbSyn->bandsToZero = sub( st->cldfbSyn->no_channels, st->cldfbAna->no_channels ); - move16(); - } - - /* synthesis of the combined signal */ - cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, output, i_mult( CLDFB_OVRLP_MIN_SLOTS, st->cldfbSyn->no_channels ), st->cldfbSyn ); - - /* save synthesis - needed in case of core switching */ - IF( st->hTcxDec != NULL ) - { - Copy32( output, st->previoussynth_fx_32, st->hTcxDec->L_frameTCX ); - } - - return; -} -#endif - /*---------------------------------------------------------------------* * smoothTransitionDtxToTcx() @@ -2280,67 +2205,4 @@ static void smoothTransitionDtxToTcx( return; } -#endif -#ifdef IVAS_FLOAT_FIXED -static void smoothTransitionDtxToTcx_fx( - Word32 synth[], /* i/o: synthesis */ - const Word16 output_frame, /* i : output frame length */ - const Word16 delay_comp /* i : delay compensation in samples */ -) -{ - Word16 i, filter_len; - Word16 w, step, fade_in; - Word32 mem; - Word32 smoothing_input_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; - Word32 smoothing_out_buffer[2 * NS2SA( 48000, DELAY_CLDFB_NS ) + TRANSITION_SMOOTHING_LEN_48k]; - - filter_len = TRANSITION_SMOOTHING_LEN_16k; - IF( EQ_16( output_frame, L_FRAME32k ) ) - { - filter_len = TRANSITION_SMOOTHING_LEN_32k; - } - ELSE IF( EQ_16( output_frame, L_FRAME48k ) ) - { - filter_len = TRANSITION_SMOOTHING_LEN_48k; - } - - /* prepare buffer */ - FOR( i = 0; i < filter_len / 2; i++ ) - { - smoothing_input_buffer[i] = synth[0]; - } - Copy32( synth, smoothing_input_buffer + filter_len / 2, add( shl( delay_comp, 1 ), shr( filter_len, 1 ) ) ); - - /* apply Mean filter */ - w = div_s( 1, filter_len ); - mem = sum32_fx( smoothing_input_buffer, filter_len ); - FOR( i = 0; i < 2 * delay_comp; i++ ) - { - smoothing_out_buffer[i] = Mpy_32_16_1( mem, w ); - move32(); - mem = L_add( mem, L_sub( smoothing_input_buffer[i + filter_len], smoothing_input_buffer[i] ) ); - } - - /* apply fades around transition */ - step = div_s( 1, delay_comp ); - step = shr( step, 2 ); - fade_in = extract_l( 0 ); - FOR( i = 0; i < delay_comp; i++ ) - { - synth[i] = L_add( Mpy_32_16_1( smoothing_out_buffer[i], fade_in ), Mpy_32_16_1( synth[i], sub( ONE_IN_Q15 - 1, fade_in ) ) ); - move32(); - fade_in = add( fade_in, step ); - } - - fade_in = 0; - FOR( ; i < 2 * delay_comp; i++ ) - { - synth[i] = L_add( Mpy_32_16_1( synth[i], fade_in ), Mpy_32_16_1( smoothing_out_buffer[i], sub( ONE_IN_Q15 - 1, fade_in ) ) ); - move32(); - fade_in = add( fade_in, step ); - } - - - return; -} -#endif +#endif \ No newline at end of file diff --git a/lib_dec/dec_post.c b/lib_dec/dec_post.c index a38a4155c..8c2059322 100644 --- a/lib_dec/dec_post.c +++ b/lib_dec/dec_post.c @@ -53,21 +53,37 @@ * Local function prototypes *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void Dec_postfilt( const int16_t L_subfr, PFSTAT *pfstat, const int16_t t0, const float *signal_ptr, const float *coeff, float *sig_out, const float gamma1, const float gamma2, const float gain_factor, const int16_t disable_hpf ); +#endif +#ifndef IVAS_FLOAT_FIXED static void pst_ltp( const int16_t t0, const float *ptr_sig_in, float *ptr_sig_pst0, float gain_factor, const int16_t L_subfr ); +#endif +#ifndef IVAS_FLOAT_FIXED static void search_del( const int16_t t0, const float *ptr_sig_in, int16_t *ltpdel, int16_t *phase, float *num_gltp, float *den_gltp, float *y_up, int16_t *off_yup, const int16_t L_subfr ); +#endif +#ifndef IVAS_FLOAT_FIXED static void filt_plt( const float *s_in, const float *s_ltp, float *s_out, const float gain_plt, const int16_t L_subfr ); +#endif +#ifndef IVAS_FLOAT_FIXED static void compute_ltp_l( const float *s_in, const int16_t ltpdel, const int16_t phase, float *y_up, float *num, float *den, const int16_t L_subfr ); +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t select_ltp( const float num1, const float den1, const float num2, const float den2 ); +#endif +#ifndef IVAS_FLOAT_FIXED static void modify_pst_param( const float psf_lp_noise, float *g1, float *g2, const int16_t coder_type, float *gain_factor ); +#endif +#ifndef IVAS_FLOAT_FIXED static void Dec_formant_postfilt( PFSTAT *pfstat, const float *signal_ptr, const float *coeff, float *sig_out, const float gamma1, const float gamma2, const int16_t l_subfr ); +#endif /*--------------------------------------------------------------------------* @@ -455,6 +471,7 @@ static void Dec_formant_postfilt( * Perform harmonic postfilter *----------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void pst_ltp( const int16_t t0, /* i : pitch delay given by coder */ const float *ptr_sig_in, /* i : postfilter input filter (residu2) */ @@ -522,6 +539,7 @@ static void pst_ltp( return; } +#endif /*---------------------------------------------------------------------------- * search_del() @@ -529,6 +547,7 @@ static void pst_ltp( * Computes best (shortest) integer LTP delay + fine search *---------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void search_del( const int16_t t0, /* i : pitch delay given by coder */ const float *ptr_sig_in, /* i : input signal (with delay line) */ @@ -809,6 +828,7 @@ static void search_del( return; } +#endif /*---------------------------------------------------------------------------- * filt_plt() @@ -816,6 +836,7 @@ static void search_del( * Perform long term postfilter *----------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void filt_plt( const float *s_in, /* i : input signal with past */ const float *s_ltp, /* i : filtered signal with gain 1 */ @@ -836,6 +857,7 @@ static void filt_plt( return; } +#endif /*---------------------------------------------------------------------------- * compute_ltp_l() @@ -844,6 +866,7 @@ static void filt_plt( * with long interpolation filter *----------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void compute_ltp_l( const float *s_in, /* i : input signal with past */ const int16_t ltpdel, /* i : delay factor */ @@ -896,6 +919,7 @@ static void compute_ltp_l( return; } +#endif /*---------------------------------------------------------------------------- * select_ltp() @@ -906,6 +930,7 @@ static void compute_ltp_l( *----------------------------------------------------------------------------*/ /*! r: 1 = 1st gain, 2 = 2nd gain */ +#ifndef IVAS_FLOAT_FIXED static int16_t select_ltp( const float num1, /* i : numerator of gain1 */ const float den1, /* i : denominator of gain1 */ @@ -927,6 +952,7 @@ static int16_t select_ltp( return ( 1 ); } } +#endif /*------------------------------------------------------------------------------------ @@ -935,6 +961,7 @@ static int16_t select_ltp( * Modify gamma1 and gamma2 values in function of the long-term noise level *-----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void modify_pst_param( const float psf_lp_noise, /* i : Long term noise energy */ float *g1, /* o : Gamma1 used in post filter */ @@ -994,3 +1021,4 @@ static void modify_pst_param( return; } +#endif diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index dabf190f2..aa9170ca7 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -47,6 +47,7 @@ #include "ivas_rom_com.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #ifndef IVAS_FLOAT_FIXED_UNIT_TESTING #include "debug.h" #endif // !IVAS_FLOAT_FIXED_UNIT_TESTING diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index a841e75e9..2b8d3209c 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3084,14 +3084,14 @@ void IMDCT_ivas_fx( Word16 buf_fx[L_FRAME_MAX / 4]; Word16 window_buf_fx[L_FRAME_MAX / 4]; Word32 r_fx[M + 1]; - Word16 q_r, q_old_Aq_12_8, q_buf; + Word16 q_r, q_buf; /* get the first 5 ms of non-aliased TCX syntesis */ mvs2s( xn_buf_fx + add(shr(overlap, 1), shl(acelp_mem_len, 1)), &buf_fx[0], analysis_len ); q_buf = q_win; move16(); - q_old_Aq_12_8 = 28; + //q_old_Aq_12_8 = 28; move16(); ham_cos_window_ivas( &window_buf_fx[0], analysis_len / 2, analysis_len / 2 ); diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index b2d730deb..3aece14b8 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -1207,11 +1207,11 @@ Word16 ApplyFdCng_ivas_fx( #endif Word64 W_tmp; Word16 L_frame, last_L_frame; - Word32 *sidNoiseEst; + //Word32 *sidNoiseEst; hFdCngDec = st->hFdCngDec; hFdCngCom = hFdCngDec->hFdCngCom; - sidNoiseEst = hFdCngCom->sidNoiseEst; + //sidNoiseEst = hFdCngCom->sidNoiseEst; /* limit L_frame and core fs values for MDCT-Stereo modes which can have higher core sampling than 16kHz, but use a downsampled buffer */ L_frame = s_min( st->L_frame, L_FRAME16k ); @@ -1703,11 +1703,11 @@ Word16 ApplyFdCng_ivas_fx( } ELSE { - IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) ) - { - sidNoiseEst = hFdCngCom->sidNoiseEstLp; - move16(); - } + //IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) ) + //{ + // sidNoiseEst = hFdCngCom->sidNoiseEstLp; + // move16(); + //} /* Interpolate the CLDFB band levels from the SID (partition) levels */ IF( GT_16( hFdCngCom->regularStopBand, hFdCngCom->numCoreBands ) ) { @@ -1789,7 +1789,7 @@ Word16 ApplyFdCng_ivas_fx( { IF( !( hFdCngCom->msFrCnt_init_counter < hFdCngCom->msFrCnt_init_thresh ) ) { - sidNoiseEst = hFdCngCom->sidNoiseEstLp; + //sidNoiseEst = hFdCngCom->sidNoiseEstLp; s2 = negate( sub( WORD32_BITS, 1 ) ); move16(); diff --git a/lib_dec/hf_synth.c b/lib_dec/hf_synth.c index 2267d44d8..66b39ade4 100644 --- a/lib_dec/hf_synth.c +++ b/lib_dec/hf_synth.c @@ -51,17 +51,29 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void hp400_12k8( float signal[], const int16_t lg, float mem[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void filt_6k_7k( float signal[], const int16_t lg, float mem[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void hf_synthesis( ZERO_BWE_DEC_HANDLE hBWE_zero, const int32_t core_brate, const int16_t output_frame, const float Aq[], const float exc[], float synth[], float synth16k[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void hf_synthesis_amr_wb( const int32_t core_brate, const int16_t output_subfr, const float Ap[], float exc16k[], float synth_out[], float *mem_syn_hf, float *delay_syn_hf, float *mem_hp_interp, float p_r, float hf_gain_i, float til, float voice_factors, const float exc[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void envelope( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const int32_t core_brate, const float Aq[], float Ap[], float *r, float tilt0, float tilt, float voice_factor ); +#endif +#ifndef IVAS_FLOAT_FIXED 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 ); +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -489,6 +501,7 @@ void hf_synth_amr_wb( * - Set energy of high band *-----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void hf_synthesis_amr_wb( const int32_t core_brate, /* i : core bitrate */ const int16_t output_subfr, /* i : output sub-frame length */ @@ -573,6 +586,7 @@ static void hf_synthesis_amr_wb( return; } +#endif /*-----------------------------------------------------------------------------------* @@ -581,6 +595,7 @@ static void hf_synthesis_amr_wb( * *-----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t EnhanceClass( const float qq, const float pp, @@ -621,6 +636,7 @@ static int16_t EnhanceClass( return ( *unvoicing_flag && qq > pp ); } +#endif /*-----------------------------------------------------------------------------------* * envelope() @@ -628,6 +644,7 @@ static int16_t EnhanceClass( * *-----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void envelope( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const int32_t core_brate, /* i : core bitrate */ @@ -763,6 +780,7 @@ static void envelope( return; } +#endif /*---------------------------------------------------------------------* * AdaptiveStartBand() @@ -770,6 +788,7 @@ static void envelope( * adaptively select the start band of bandwidth extension *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void AdaptiveStartBand( int16_t *start_band, /* o : start point of copied band */ const int32_t core_brate, /* i : core bitrate */ @@ -880,7 +899,7 @@ static void AdaptiveStartBand( return; } - +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -1095,6 +1114,7 @@ static void hf_synthesis( * float a[3] = {1.000000000, 1.787109375, -0.864257812}; *-----------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void hp400_12k8( float signal[], /* i/o: signal */ const int16_t lg, /* i : length of signal */ @@ -1130,6 +1150,7 @@ static void hp400_12k8( return; } +#endif /*-------------------------------------------------------------------* * filt_6k_7k() @@ -1141,6 +1162,7 @@ static void hp400_12k8( * (gain = 4.0) *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void filt_6k_7k( float signal[], /* i/o: signal */ const int16_t lg, /* i : signal length */ @@ -1179,3 +1201,4 @@ static void filt_6k_7k( return; } +#endif diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index af60516cf..c62767ab8 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -8,6 +8,7 @@ #include "prot_fx2.h" /* Function prototypes */ #include "rom_com.h" /* Static table prototypes */ #include "basop32.h" +#include "prot.h" /*---------------------------------------------------------------------* * Local constants @@ -49,38 +50,37 @@ static void AdaptiveStartBand_fx( Word16 *start_band, const Word32 rate, const *-------------------------------------------------------------------*/ void hf_synth_init_fx( - ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ + ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ ) { - hBWE_zero->seed2 = RANDOM_INITSEED; - set16_fx( hBWE_zero->mem_hf_fx, 0, ( L_FIR - 1 ) ); - set16_fx( hBWE_zero->mem_syn_hf_fx, 0, M ); - set16_fx( hBWE_zero->mem_hp400_fx, 0, 4 ); - set16_fx( hBWE_zero->delay_syn_hf_fx, 0, NS2SA( 16000, DELAY_CLDFB_NS ) ); - set16_fx( hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN ); - - return; + hBWE_zero->seed2 = RANDOM_INITSEED; + set16_fx(hBWE_zero->mem_hf_fx, 0, (L_FIR - 1)); + set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); + set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); + set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); + set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); + + return; } - void hf_synth_reset_fx( - ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ + ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */ ) { - Word16 i; + Word16 i; - FOR(i = 0; i < L_FRAME16k; i++) - { - Random(&hBWE_zero->seed2); - } + FOR(i = 0; i < L_FRAME16k; i++) + { + Random(&hBWE_zero->seed2); + } - set16_fx(hBWE_zero->mem_hf_fx, 0, ( L_FIR - 1 ) ); - set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); - set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); /* TBV -> mem_hp400_fx has a length of 6, but only 4 values initialized in EVS ??? */ + set16_fx(hBWE_zero->mem_hf_fx, 0, (L_FIR - 1)); + set16_fx(hBWE_zero->mem_syn_hf_fx, 0, M); + set16_fx(hBWE_zero->mem_hp400_fx, 0, 4); /* TBV -> mem_hp400_fx has a length of 6, but only 4 values initialized in EVS ??? */ - set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); - set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); + set16_fx(hBWE_zero->delay_syn_hf_fx, 0, NS2SA(16000, DELAY_CLDFB_NS)); + set16_fx(hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN); - return; + return; } /*---------------------------------------------------------------------* diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index f1d5e40cb..a3d31ee09 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -623,10 +623,10 @@ void ivas_hq_core_dec_fx( TCX_DEC_HANDLE hTcxDec; TCX_CONFIG_HANDLE tcx_cfg; Word16 index, left_rect, tcx_offsetFB, overlapFB, L_frameTCX; - Word16 tcx_offset, overlap, L_frame, fscaleFB; + Word16 tcx_offset, overlap, L_frame; Word16 L_frameTCX_glob, L_frame_glob; Word16 acelp_zir[L_FRAME_MAX / 2]; - Word16 encoderLookahead, encoderLookaheadFB; + //Word16 encoderLookahead, encoderLookaheadFB; Word16 hq_recovery_flag; Word16 mdctWindowLength; Word16 mdctWindowLengthFB; @@ -923,9 +923,9 @@ void ivas_hq_core_dec_fx( L_spec = hTcxDec->L_frameTCX; move16(); st_fx->fscale = sr2fscale( st_fx->sr_core ); - fscaleFB = sr2fscale( st_fx->output_Fs ); - encoderLookahead = ( L_LOOK_12k8 * st_fx->fscale ) / FSCALE_DENOM; - encoderLookaheadFB = ( L_LOOK_12k8 * fscaleFB ) / FSCALE_DENOM; + //fscaleFB = sr2fscale( st_fx->output_Fs ); + //encoderLookahead = ( L_LOOK_12k8 * st_fx->fscale ) / FSCALE_DENOM; + //encoderLookaheadFB = ( L_LOOK_12k8 * fscaleFB ) / FSCALE_DENOM; mdctWindowLength = getMdctWindowLength( st_fx->fscale ); mdctWindowLengthFB = (int16_t) ( mdctWindowLength * st_fx->output_Fs / st_fx->sr_core ); IF( core_switching_flag ) diff --git a/lib_dec/hq_lr_dec.c b/lib_dec/hq_lr_dec.c index 1a2e0266b..302d0ba15 100644 --- a/lib_dec/hq_lr_dec.c +++ b/lib_dec/hq_lr_dec.c @@ -49,14 +49,21 @@ * Local function prototypes *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t p2a_threshold_dequant( Decoder_State *st, int16_t *p2a_flags, const int16_t bands, const int16_t p2a_bands ); +#endif +#ifndef IVAS_FLOAT_FIXED static void mdct_spectrum_fine_gain_dec( Decoder_State *st, float y2[], const int16_t band_start[], const int16_t band_end[], const int16_t k_sort[], const int16_t bands, const Word32 L_qint, const int16_t Ngq, const int16_t gqlevs, const int16_t gqbits ); +#endif +#ifndef IVAS_FLOAT_FIXED static float band_energy_dequant( Decoder_State *st, float band_energy[], const int16_t bands, const Word32 L_qint, const Word16 eref_fx, const int16_t is_transient ); +#endif +#ifndef IVAS_FLOAT_FIXED static void spt_shorten_domain_set_dec( Decoder_State *st, const int16_t p2a_flags[], const int16_t new_band_start[], const int16_t new_band_end[], const int16_t new_band_width[], const int16_t bands, int16_t band_start[], int16_t band_end[], int16_t band_width[], int16_t *bit_budget ); - +#endif /*-------------------------------------------------------------------* * hq_lr_dec() @@ -954,6 +961,7 @@ void hq_lr_dec( * Huffman decoding of differential energies *--------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: bits */ static int16_t small_symbol_dec_tran( Decoder_State *st, /* i/o: decoder state structure */ @@ -980,6 +988,7 @@ static int16_t small_symbol_dec_tran( return ( bits ); } +#endif /*-------------------------------------------------------------------------- @@ -988,6 +997,7 @@ static int16_t small_symbol_dec_tran( * Huffman decoding of differential energies (MSB and LSB) *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: bits */ static int16_t small_symbol_dec( Decoder_State *st, /* i/o: decoder state structure */ @@ -1025,7 +1035,9 @@ static int16_t small_symbol_dec( return ( bits ); } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- * decode_huff_8s() * @@ -1048,6 +1060,7 @@ static int16_t decode_huff_8s( return ( -*hufftab ); } +#endif /*-------------------------------------------------------------------------- @@ -1056,6 +1069,7 @@ static int16_t decode_huff_8s( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: bits */ static int16_t large_symbol_dec( Decoder_State *st, /* i/o: decoder state structure */ @@ -1162,6 +1176,7 @@ static int16_t large_symbol_dec( return cntbits; /* xx bits for diff. energies + 1 bit for LC coding mode */ } +#endif /*--------------------------------------------------------------------------* @@ -1170,6 +1185,7 @@ static int16_t large_symbol_dec( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float band_energy_dequant( Decoder_State *st, /* i/o: decoder state structure */ float band_energy[], @@ -1245,6 +1261,7 @@ static float band_energy_dequant( return ( deng_bits ); } +#endif /*--------------------------------------------------------------------------* @@ -1253,6 +1270,7 @@ static float band_energy_dequant( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t p2a_threshold_dequant( Decoder_State *st, /* i/o: decoder state structure */ int16_t *p2a_flags, @@ -1275,7 +1293,7 @@ static int16_t p2a_threshold_dequant( return ( j ); } - +#endif /*--------------------------------------------------------------------------* * mdct_spectrum_fine_gain_dec() @@ -1283,6 +1301,7 @@ static int16_t p2a_threshold_dequant( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void mdct_spectrum_fine_gain_dec( Decoder_State *st, /* i/o: decoder state structure */ float y2[], @@ -1346,6 +1365,7 @@ static void mdct_spectrum_fine_gain_dec( return; } +#endif /*--------------------------------------------------------------------------* * spt_shorten_domain_set_dec() @@ -1353,6 +1373,7 @@ static void mdct_spectrum_fine_gain_dec( * update the shorten band information based on p2a analysis *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void spt_shorten_domain_set_dec( Decoder_State *st, /* i : decoder state structure */ const int16_t p2a_flags[], /* i : p2a anlysis information */ @@ -1390,3 +1411,4 @@ static void spt_shorten_domain_set_dec( return; } +#endif \ No newline at end of file diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c index c9251d4d6..494780d7b 100644 --- a/lib_dec/igf_dec.c +++ b/lib_dec/igf_dec.c @@ -55,6 +55,7 @@ *-------------------------------------------------------------------*/ /*! r: number of noise bands */ +#ifndef IVAS_FLOAT_FIXED static int16_t IGF_replaceTCXNoise_1_flr( const float *in, /* i : MDCT spectrum */ const uint8_t *TCXNoise, /* i : tcx noise indicator vector */ @@ -82,6 +83,7 @@ static int16_t IGF_replaceTCXNoise_1_flr( return noise; } +#endif /*-------------------------------------------------------------------* @@ -90,6 +92,7 @@ static int16_t IGF_replaceTCXNoise_1_flr( * replaces TCX noise *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_replaceTCXNoise_2_flt( float *in, /* i/o: MDCT spectrum */ const uint8_t *TCXNoise, /* i : tcx noise indicator vector */ @@ -127,7 +130,7 @@ static void IGF_replaceTCXNoise_2_flt( return; } - +#endif /*-------------------------------------------------------------------* * IGF_replaceTCXNoise_2_new_flt() @@ -135,6 +138,7 @@ static void IGF_replaceTCXNoise_2_flt( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_replaceTCXNoise_2_new_flt( float *in, /* i/o: MDCT spectrum */ const uint8_t *TCXNoise, /* i : tcx noise indicator vector */ @@ -183,6 +187,7 @@ static void IGF_replaceTCXNoise_2_new_flt( return; } +#endif /*-------------------------------------------------------------------* @@ -228,6 +233,7 @@ static void IGF_decode_whitening_level_flt( * square the MDCT spectrum *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_getMDCTSquare_flt( const int16_t startLine, /* i : start MDCT subband index */ const int16_t stopLine, /* i : stop MDCT subband index */ @@ -244,6 +250,7 @@ static void IGF_getMDCTSquare_flt( return; } +#endif /*-------------------------------------------------------------------* @@ -252,6 +259,7 @@ static void IGF_getMDCTSquare_flt( * calculate energy per SFB *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_calcSfbEnergy_flt( const int16_t startSfb, /* i : start sfb index */ const int16_t stopSfb, /* i : stop sfb index */ @@ -275,6 +283,7 @@ static void IGF_calcSfbEnergy_flt( return; } +#endif /*-------------------------------------------------------------------* @@ -283,6 +292,7 @@ static void IGF_calcSfbEnergy_flt( * set power spectrum values to zero, needed for energy calculation *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_setLinesToZero_flt( const int16_t startLine, /* i : start MDCT subband index */ const int16_t stopLine, /* i : stop MDCT subband index */ @@ -302,6 +312,7 @@ static void IGF_setLinesToZero_flt( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -953,6 +964,7 @@ static void IGF_getWhiteSpectralData_flt( * refines the IGF grid *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void IGF_RefineGrid_flt( H_IGF_GRID hGrid /* i/o: IGF grid handle */ ) @@ -986,6 +998,7 @@ static void IGF_RefineGrid_flt( return; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 27e9a3ede..cd013cff6 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -47,41 +47,6 @@ #include "ivas_prot_fx.h" #endif - -#ifdef IVAS_FLOAT_FIXED -static Word16 norm_arr_l(float *arr, int size); -static Word16 norm(float num); - -static Word16 norm(float num) { - if ((Word32)num == 0) return 31; - return norm_l((Word32)num); -} -static Word16 norm_arr_l(float *arr, int size) -{ - Word16 q = 31; - for (int i = 0; i < size; i++) - if (arr[i] != 0) - { - q = min(q, norm(arr[i])); - } - return q; -} -static Word16 s_norm(float num) { - if ((Word16)num == 0) return 15; - return norm_s((Word16)num); -} -static Word16 norm_arr_s(float *arr, int size) -{ - Word16 q = 15; - for (int i = 0; i < size; i++) - if (arr[i] != 0) - { - q = min(q, s_norm(arr[i])); - } - return q; -} -#endif - /*-------------------------------------------------------------------* * ivas_core_dec() * @@ -986,8 +951,8 @@ ivas_error ivas_core_dec( Q_synth_fx = 0; move16(); - TD_BWE_DEC_HANDLE hBWE_TD; - hBWE_TD = st->hBWE_TD; + //TD_BWE_DEC_HANDLE hBWE_TD; + //hBWE_TD = st->hBWE_TD; FD_BWE_DEC_HANDLE hBWE_FD; hBWE_FD = st->hBWE_FD; @@ -1152,7 +1117,7 @@ ivas_error ivas_core_dec( Scale_sig( tmp_buffer_fx, L_FRAME48k, Q11 - Q_white_exc ); stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q ); #ifdef MSAN_FIX - IF( !( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) || ( NE_16( st->core, ACELP_CORE ) || EQ_16( st->extl, -1 ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( hCPE->hCoreCoder[0]->tdm_LRTD_flag, 0 ) ) ) ) ) + IF( !( ( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && EQ_16( hCPE->nchan_out, 1 ) ) || ( NE_16( st->core, ACELP_CORE ) || EQ_16( st->extl, -1 ) || ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) && NE_16( hCPE->hCoreCoder[0]->tdm_LRTD_flag, 0 ) ) ) ) ) { Scale_sig32( hb_synth_32_fx[0], output_frame, sub( Q11, q ) ); Scale_sig32( hb_synth_32_fx[1], output_frame, sub( Q11, q ) ); diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index a86493ba4..0bcb595dc 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -51,9 +51,13 @@ * Local function prototypes *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void read_stereo_mode_and_bwidth( CPE_DEC_HANDLE hCPE, const Decoder_Struct *st_ivas ); +#endif +#ifndef IVAS_FLOAT_FIXED static void stereo_mode_combined_format_dec( const Decoder_Struct *st_ivas, CPE_DEC_HANDLE hCPE ); +#endif /*--------------------------------------------------------------------------* @@ -966,6 +970,7 @@ void destroy_cpe_dec( * Read stereo technology info & audio bandwidth *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void read_stereo_mode_and_bwidth( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ const Decoder_Struct *st_ivas /* i : decoder main structure */ @@ -1073,7 +1078,7 @@ static void read_stereo_mode_and_bwidth( return; } - +#endif /*------------------------------------------------------------------------- * stereo_mode_combined_format_dec() @@ -1081,6 +1086,7 @@ static void read_stereo_mode_and_bwidth( * Set stereo format in a combined format *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void stereo_mode_combined_format_dec( const Decoder_Struct *st_ivas, /* i : decoder main structure */ CPE_DEC_HANDLE hCPE /* i/o: CPE handle */ @@ -1119,3 +1125,4 @@ static void stereo_mode_combined_format_dec( return; } +#endif diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index bf2c88053..4c763fcc0 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -122,11 +122,11 @@ ivas_error ivas_cpe_dec_fx( #if 1 // Float to fix conversions float maxim = 0; - Word16 q_output_mem, q_buff_LBTCX_mem, q_input_mem_LB, q_old_out = 31, q_old_out_LB = 31, q_tcxltp_mem_in_float; - q_output_mem = 11; + Word16 q_old_out = 31, q_old_out_LB = 31; + //q_output_mem = 11; maxim = 0; - q_buff_LBTCX_mem = 11; - q_input_mem_LB = q_buff_LBTCX_mem; + //q_buff_LBTCX_mem = 11; + //q_input_mem_LB = q_buff_LBTCX_mem; maxim = 0; q_old_out = Q11; FOR( Word16 ind1 = 0; ind1 < 2; ind1++ ) @@ -160,7 +160,7 @@ ivas_error ivas_cpe_dec_fx( hCPE->hCoreCoder[ind1]->hHQ_core->q_old_outLB_fx = q_old_out_LB; } } - q_tcxltp_mem_in_float = 11; + //q_tcxltp_mem_in_float = 11; FOR( Word16 ind2 = 0; ind2 < 2; ind2++ ) { IF( hCPE->hCoreCoder[ind2] && hCPE->hCoreCoder[ind2]->cldfbSyn ) @@ -675,7 +675,7 @@ ivas_error ivas_cpe_dec_fx( IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; - FOR( int ii = 0; ii < sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ); ii++ ) + FOR( int ii = 0; ii < (int) ( sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] )); ii++ ) { hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft; } @@ -698,7 +698,7 @@ ivas_error ivas_cpe_dec_fx( IF( EQ_16( hCPE->hStereoDft->first_frame, 1 ) ) { hCPE->hStereoDft->q_smoothed_nrg = hCPE->hStereoDft->q_dft; - FOR( int ii = 0; ii < sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] ); ii++ ) + FOR( int ii = 0; ii < (int) (sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx ) / sizeof( hCPE->hStereoDft->q_DFT_past_DMX_fx[0] )); ii++ ) { hCPE->hStereoDft->q_DFT_past_DMX_fx[ii] = hCPE->hStereoDft->q_dft; } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 2cb597e7d..88761d954 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -265,7 +265,7 @@ static ivas_error ivas_dirac_rend_config_fx( hDirACRend->hOutSetup = st_ivas->hIntSetup; nchan_out_woLFE = hDirACRend->hOutSetup.nchan_out_woLFE; - IF( hDirACRend->hOutSetup.ls_azimuth_fx != NULL && hDirACRend->hOutSetup.ls_elevation != NULL ) + IF( hDirACRend->hOutSetup.ls_azimuth_fx != NULL && hDirACRend->hOutSetup.ls_elevation_fx != NULL ) { Copy32( hDirACRend->hOutSetup.ls_azimuth_fx, ls_azimuth_fx, nchan_out_woLFE ); Copy32( hDirACRend->hOutSetup.ls_elevation_fx, ls_elevation_fx, nchan_out_woLFE ); @@ -1760,15 +1760,15 @@ ivas_error ivas_dirac_dec_config_fx( { IF( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params == NULL ) { - float frequency_axis[CLDFB_NO_CHANNELS_MAX]; + //float frequency_axis[CLDFB_NO_CHANNELS_MAX]; #ifdef IVAS_FLOAT_FIXED Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, st_ivas->hDecoderConfig->output_Fs, st_ivas->hSpatParamRendCom->num_freq_bands ); - FOR( int i = 0; i < st_ivas->hSpatParamRendCom->num_freq_bands; i++ ) + /*FOR( int i = 0; i < st_ivas->hSpatParamRendCom->num_freq_bands; i++ ) { frequency_axis[i] = (float) frequency_axis_fx[i]; - } + }*/ IF( ( error = ivas_dirac_dec_decorr_open_fx( &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_params ), &( st_ivas->hDiracDecBin->h_freq_domain_decorr_ap_state ), st_ivas->hSpatParamRendCom->num_freq_bands, BINAURAL_CHANNELS, BINAURAL_CHANNELS, DIRAC_SYNTHESIS_PSD_LS, frequency_axis_fx, BINAURAL_CHANNELS, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) @@ -3587,7 +3587,9 @@ void ivas_dirac_dec_render_sf_fx( int16_t subframe_idx; int16_t slot_idx, index_slot; int16_t hodirac_flag; +#ifndef IVAS_FLOAT_FIXED float *p_Rmat; +#endif int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; /*CLDFB: last output channels reserved to LFT for CICPx*/ @@ -3689,13 +3691,11 @@ void ivas_dirac_dec_render_sf_fx( IF( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[st_ivas->hCombinedOrientationData->subframe_idx] ) { - p_Rmat = &st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][0][0]; p_Rmat_fx = &st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][0][0]; floatToFixed_arrL32( &st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][0][0], p_Rmat_fx, Q29, 9 ); } ELSE { - p_Rmat = 0; p_Rmat_fx = 0; } IF( EQ_16( hDirACRend->panningConf, DIRAC_PANNING_VBAP ) ) @@ -4518,7 +4518,7 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirAC->hConfig->dec_param_estim ) { Word16 fac = BASOP_Util_Divide3232_Scale( 1, hSpatParamRendCom->subframe_nbslots[subframe_idx], &exp ); - Word32 flag = 0; + Flag flag = 0; move32(); fac = shl_o( fac, exp, &flag ); @@ -4945,7 +4945,6 @@ void ivas_dirac_dec_render_sf_fx( #endif /* Determine encoding quality based additional smoothing factor */ #ifdef IVAS_FLOAT_FIXED - float qualityBasedSmFactor = 1.0f; Word32 qualityBasedSmFactor_fx = ONE_IN_Q31; move32(); @@ -4956,8 +4955,6 @@ void ivas_dirac_dec_render_sf_fx( qualityBasedSmFactor_fx = L_deposit_h( st_ivas->hMasa->data.dir_decode_quality_fx ); // Q31 qualityBasedSmFactor_fx = Mpy_32_32( qualityBasedSmFactor_fx, qualityBasedSmFactor_fx ); // (Q31, Q31) -> Q31 } - - qualityBasedSmFactor = fixedToFloat( qualityBasedSmFactor_fx, Q31 ); #else float qualityBasedSmFactor = 1.0f; diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index dd9cf413c..6c4c75e86 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -299,6 +299,15 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( /* cov buffers */ for ( idx = 0; idx < num_param_bands; idx++ ) { + + if ( ( h_dirac_output_synthesis_state->cx_old[idx] = (float *) malloc( nchan_in * nchan_in * sizeof(float) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } + if ( ( h_dirac_output_synthesis_state->cy_old[idx] = (float *) malloc( nchan_out * nchan_out * sizeof(float) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); + } if ( ( h_dirac_output_synthesis_state->mixing_matrix_old[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); @@ -315,6 +324,8 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { + h_dirac_output_synthesis_state->cx_old[idx] = NULL; + h_dirac_output_synthesis_state->cy_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; } @@ -1619,7 +1630,6 @@ Word16 computeMixingMatrices_fx( Word16 mixing_matrix_e; - Word16 Cr_buff_e[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; Word16 Cr_fx_e; @@ -2111,13 +2121,10 @@ Word16 computeMixingMatrices_fx( } /* Avoid Meaningless negative main diagonal elements */ - Cr_buff_e[i + i * lengthCy] = exp; IF(BASOP_Util_Cmp_Mant32Exp(Cr_fx[i + i * lengthCy], exp, 0, 0) < 0) { Cr_fx[i + i * lengthCy] = 0; move16(); - Cr_buff_e[i + i * lengthCy] = 0; - move16(); } } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7023c3741..46f510cfa 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -201,7 +201,7 @@ ivas_error ivas_dec_setup( DECODER_CONFIG_HANDLE hDecoderConfig=NULL; Word16 numch_out_dirac=0; SPAR_DEC_HANDLE hSpar = NULL; - Word16 numch_in, numch_out, num_md_sub_frames; + Word16 numch_in; IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) @@ -225,15 +225,15 @@ ivas_error ivas_dec_setup( } } hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + //uint16_t nchan_internal; + //nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); hDecoderConfig = st_ivas->hDecoderConfig; numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; + //numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -1055,6 +1055,10 @@ ivas_error ivas_init_decoder_front( { set_zero((st_ivas->hLsSetupCustom)->ls_azimuth, MAX_OUTPUT_CHANNELS ); set_zero((st_ivas->hLsSetupCustom)->ls_elevation, MAX_OUTPUT_CHANNELS ); +#ifdef IVAS_FLOAT_FIXED + set_zero_fx((st_ivas->hLsSetupCustom)->ls_azimuth_fx, MAX_OUTPUT_CHANNELS ); + set_zero_fx((st_ivas->hLsSetupCustom)->ls_elevation_fx, MAX_OUTPUT_CHANNELS ); +#endif //set_f( ( st_ivas->hLsSetupCustom )->separate_ch_gains, 0.0f, MAX_OUTPUT_CHANNELS ); } ELSE @@ -1339,6 +1343,12 @@ ivas_error ivas_init_decoder_fx( st_ivas->hOutSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; st_ivas->hIntSetup.ls_azimuth = st_ivas->hLsSetupCustom->ls_azimuth; st_ivas->hIntSetup.ls_elevation = st_ivas->hLsSetupCustom->ls_elevation; +#ifdef IVAS_FLOAT_FIXED + st_ivas->hOutSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; + st_ivas->hOutSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; + st_ivas->hIntSetup.ls_azimuth_fx = st_ivas->hLsSetupCustom->ls_azimuth_fx; + st_ivas->hIntSetup.ls_elevation_fx = st_ivas->hLsSetupCustom->ls_elevation_fx; +#endif } ELSE @@ -1414,8 +1424,8 @@ ivas_error ivas_init_decoder_fx( IF ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { /*float2fix block: to be removed*/ - floatToFixed_arrL( (float *) st_ivas->hOutSetup.ls_azimuth, (Word32 *) st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); - floatToFixed_arrL( (float *) st_ivas->hOutSetup.ls_elevation, (Word32 *) st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); + //( (float *) st_ivas->hOutSetup.ls_azimuth, (Word32 *) st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); + //floatToFixed_arrL( (float *) st_ivas->hOutSetup.ls_elevation, (Word32 *) st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hOutSetup.nchan_out_woLFE ); /*float2fix block end*/ IF ( ( error = efap_init_data_fx( &( st_ivas->hEFAPdata ), st_ivas->hOutSetup.ls_azimuth_fx, st_ivas->hOutSetup.ls_elevation_fx, st_ivas->hOutSetup.nchan_out_woLFE, EFAP_MODE_EFAP ) ) != IVAS_ERR_OK ) { @@ -1491,8 +1501,8 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) { /*float2fix block: to be removed*/ - floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); - floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + //floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + //floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); /*float2fix end*/ IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { @@ -1648,8 +1658,8 @@ ivas_error ivas_init_decoder_fx( IF ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) { /*float2fix block: to be removed*/ - floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); - floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + //floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_azimuth, (Word32 *)st_ivas->hOutSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.ambisonics_order); + //floatToFixed_arrL((float *)st_ivas->hOutSetup.ls_elevation, (Word32 *)st_ivas->hOutSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.ambisonics_order); /*float2fix end*/ IF ( ( error = ivas_sba_get_hoa_dec_matrix_fx( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 338314583..ce704794f 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -376,490 +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 */ - 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_ivas_fx( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); - st_ivas->ism_mode = ism_mode; - nchan_out_buff_old = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); - - 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 ) - { - return error; - } - - st_ivas->nSCE = st_ivas->nchan_transport; - - /*-----------------------------------------------------------------* - * Allocate, initialize, and configure SCE/CPE/MCT handles - *-----------------------------------------------------------------*/ - - 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; - } - - /*-----------------------------------------------------------------* - * HP20 memories - *-----------------------------------------------------------------*/ - if ( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) - { - return error; - } - - //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( 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 1 /*Float to fixed conversion*/ - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; - IF( st_ivas->hCombinedOrientationData ) - FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 3; ind2++ ) - { - st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); - } - } - if ( st_ivas->hSbaIsmData ) - { - for ( Word16 ch_idx = 0; ch_idx < st_ivas->hSbaIsmData->delayBuffer_nchan; ch_idx++ ) - { - floatToFixed_arr32( st_ivas->hSbaIsmData->delayBuffer[ch_idx], st_ivas->hSbaIsmData->delayBuffer_fx[ch_idx], Q11, st_ivas->hSbaIsmData->delayBuffer_size ); - } - } - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - DECODER_CONFIG_HANDLE hDecoderConfig; - hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in, numch_out, num_md_sub_frames; - ; - Word16 numch_out_dirac = hDecoderConfig->nchan_out; - IF( hSpar ) - { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; - numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - hSpar->hMdDec->Q_mixer_mat = Q30; - for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); - } - } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - { - for ( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - } - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] = float_to_fix( st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] ,Q11 ); - } - } - } - } - Word16 n_tc; - if (st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - n_tc = st_ivas->nchan_ism; - else - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for (int ch = 0; ch < n_tc; ch++) - { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); - } -#endif - if ( ( error = ivas_jbm_dec_flush_renderer_fx( 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; - } -#if 1 /*Fixed to float */ - if ( hTcBuffer->tc_buffer ) - fixedToFloat_arrL( hTcBuffer->tc_buffer_fx, hTcBuffer->tc_buffer, Q11, hTcBuffer->tc_buff_len ); - IF( hSpar ) - { - FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) - { - st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] ) / ( 1LL << ( Q11 ) ) ); /*Rounding off*/ - } - } - // fix2float (to be cleaned) - IF( ( LT_32( hDecoderConfig->ivas_total_brate, IVAS_24k4 ) ) && ( ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA2 ) ) || ( EQ_16( hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) ) ) - { - fixedToFloat_arr( hSpar->hMdDec->smooth_fac_fx, hSpar->hMdDec->smooth_fac, Q15, IVAS_MAX_NUM_BANDS ); - FOR( Word16 i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - { - fixedToFloat_arrL( hSpar->hMdDec->smooth_buf_fx[i], hSpar->hMdDec->smooth_buf[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - } - } - // fix2float end - FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) - { - IF( st_ivas->cldfbSynDec[out_ch] ) - { - FOR( Word16 i = 0; i < st_ivas->cldfbSynDec[out_ch]->p_filter_length; i++ ) - { - st_ivas->cldfbSynDec[out_ch]->cldfb_state[i] = ( (float) ( st_ivas->cldfbSynDec[out_ch]->cldfb_state_fx[i] ) / (float) ( 1LL << ( Q11 ) ) ); - } - } - } - } -#endif - - } - /* 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 ) - { - Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; - Word16 num_src; - IF ( ( error = ivas_td_binaural_open_fx( st_ivas , SrcInd, &num_src ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 // Cleanup changes for ivas_td_binaural_open: fixed to float - Word16 nchan_rend = num_src; - IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && NE_16( st_ivas->transport_config, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) - { - nchan_rend--; /* Skip LFE channel -- added to the others */ - } - FOR( Word16 nS = 0; nS < nchan_rend; nS++ ) - { - TDREND_SRC_t *Src_p = st_ivas->hBinRendererTd->Sources[SrcInd[nS]]; - IF( Src_p->SrcSpatial_p != NULL ) - { - FOR( Word16 nC = 0; nC < SPAT_BIN_MAX_INPUT_CHANNELS; nC++ ) - { - fixedToFloat_arrL( Src_p->SrcSpatial_p->Pos_p_fx + nC * 3, Src_p->SrcSpatial_p->Pos_p + nC * 3, Q31, 3 ); - fixedToFloat_arrL( Src_p->SrcSpatial_p->Front_p_fx + nC * 3, Src_p->SrcSpatial_p->Front_p + nC * 3, Q30, 3 ); - } - Src_p->SrcSpatial_p->q_Pos_p = Q31; - } - TDREND_SRC_SPATIAL_t *SrcSpatial_p = st_ivas->hBinRendererTd->Sources[nS]->SrcSpatial_p; - fixedToFloat_arrL( SrcSpatial_p->Pos_p_fx, SrcSpatial_p->Pos_p, Q31, 3 ); - fixedToFloat_arrL( SrcSpatial_p->Front_p_fx, SrcSpatial_p->Front_p, Q30, 3 ); - SrcSpatial_p->q_Pos_p = Q31; - } -#endif - - if ( st_ivas->hIntSetup.output_config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - if ( ( error = ivas_reverb_open_fx( &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 ) - { - return error; - } - } - } - } - else - { - /* close the ISM renderer and reinitialize */ - ivas_ism_renderer_close( &st_ivas->hIsmRendererData ); - - IF ( ( error = ivas_ism_renderer_open_fx( 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_fx( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1/*Cleanup Changes for ivas_dirac_dec_binaural_copy_hrtfs_fx*/ - FOR(Word16 i = 0; i < BINAURAL_CHANNELS; i++ ) - { - FOR(Word16 j = 0; j < HRTF_SH_CHANNELS; j++ ) - { - fixedToFloat_arr(st_ivas->hHrtfParambin->hrtfShCoeffsRe_fx[i][j], st_ivas->hHrtfParambin->hrtfShCoeffsRe[i][j], 15, HRTF_NUM_BINS ); - fixedToFloat_arr(st_ivas->hHrtfParambin->hrtfShCoeffsIm_fx[i][j], st_ivas->hHrtfParambin->hrtfShCoeffsIm[i][j], 14, HRTF_NUM_BINS ); - } - } - fixedToFloat_arrL(st_ivas->hHrtfParambin->parametricReverberationTimes_fx, st_ivas->hHrtfParambin->parametricReverberationTimes, 31, CLDFB_NO_CHANNELS_MAX ); - 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 - IF ( ( error = ivas_dirac_dec_init_binaural_data_fx( 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_fx( &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 1 /*Cleanup changes: float to fixed*/ - Word16 i, Q_cldfbSynDec = 21; - 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, CLDFB_NO_COL_MAX ); - 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, CLDFB_NO_COL_MAX ); - } - IF( st_ivas->cldfbSynDec[0] ) - { - Q_cldfbSynDec = s_min( Q_cldfbSynDec, Q_factor_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, sub( st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels ) ) ); - floatToFixed_arrL( st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q_cldfbSynDec, sub( st_ivas->cldfbAnaDec[i]->p_filter_length, st_ivas->cldfbAnaDec[i]->no_channels ) ); - } -#endif - IF ( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 1 /*CCleanup changes:fixed to float changes*/ - 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 ) ); - } -#endif - - /*-----------------------------------------------------------------* - * floating-point output audio buffers - *-----------------------------------------------------------------*/ - - { - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); - - IF( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ) != IVAS_ERR_OK ) - { - return error; - } - 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; -} -#else +#ifndef 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 */ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index eb6e5a174..823eaae5f 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -364,6 +364,7 @@ static void ivas_param_ism_collect_slot_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_param_ism_collect_slot( PARAM_ISM_DEC_HANDLE hParamIsmDec, /* i/o: decoder ParamISM handle */ float *Cldfb_RealBuffer_in, @@ -393,6 +394,7 @@ static void ivas_param_ism_collect_slot( return; } +#endif static void ivas_param_ism_compute_mixing_matrix( const int16_t nchan_ism, /* i : number of ISM channels */ @@ -2495,7 +2497,7 @@ static void ivas_ism_param_dec_render_sf_fx( /* CLDFB Synthesis */ idx_in = 0; idx_lfe = 0; - Word16 tmp_buff_Q[MAX_OUTPUT_CHANNELS]; + //Word16 tmp_buff_Q[MAX_OUTPUT_CHANNELS]; FOR ( ch = 0; ch < nchan_out; ch++ ) { @@ -2507,7 +2509,7 @@ static void ivas_ism_param_dec_render_sf_fx( { idx_lfe = add(idx_lfe,1); } - tmp_buff_Q[ch] = 0; + //tmp_buff_Q[ch] = 0; } ELSE { diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 8b335e463..3e52052fa 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -58,7 +58,9 @@ static void ivas_jbm_dec_copy_tc( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *data, float *tc_digest_f[] ); +#ifndef IVAS_FLOAT_FIXED static void ivas_jbm_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, uint16_t *nSamplesRendered, float *output[] ); +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_jbm_dec_tc_buffer_playout_fx( Decoder_Struct *st_ivas, const UWord16 nSamplesAsked, UWord16 *nSamplesRendered, Word32 *output_fx[] ); @@ -582,15 +584,15 @@ ivas_error ivas_jbm_dec_tc( Scale_sig32( p_output_fx[i], output_frame, sub( Q14, Q11 ) ); } SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - Word16 num_bands_out, nchan_transport; - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + Word16 nchan_transport; + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx ), ( p_output_fx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -606,11 +608,11 @@ ivas_error ivas_jbm_dec_tc( #ifdef IVAS_FLOAT_FIXED { Word16 q; - float max_val = 0.0; - int i_max_val_op; + //float max_val = 0.0; + //int i_max_val_op; hCPE = st_ivas->hCPE[0]; hSCE = st_ivas->hSCE[0]; - i_max_val_op = (int) max_val; + //i_max_val_op = (int) max_val; s = 0; FOR( i = 0; i < 2; i++ ) { @@ -795,19 +797,19 @@ ivas_error ivas_jbm_dec_tc( Word16 ch; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; Word16 Q_p_output = 14; - Word16 num_bands_out, nchan_transport; - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + Word16 nchan_transport; + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; FOR( ch = 0; ch < nchan_transport; ch++ ) { Scale_sig32( p_output_fx[ch], output_frame, sub( Q_p_output, Q11 ) ); } - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, p_output_fx, st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); #if 1 /*Fixed to float changes */ @@ -1248,15 +1250,15 @@ ivas_error ivas_jbm_dec_tc( #ifdef IVAS_FLOAT_FIXED #if 1 /*Float to Fixed changes */ SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - Word16 num_bands_out, nchan_transport; - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + Word16 nchan_transport; + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_agc_dec_process_fx( st_ivas->hSpar->hAgcDec, ( p_output_fx + sba_ch_idx ), ( p_output_fx + sba_ch_idx ), st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -1389,19 +1391,19 @@ ivas_error ivas_jbm_dec_tc( Word16 ch; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; Word16 Q_p_output = 14; - Word16 num_bands_out, nchan_transport; - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + Word16 nchan_transport; + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; nchan_out = nchan_transport; FOR( ch = 0; ch < nchan_transport; ch++ ) { Scale_sig32( p_output_fx[sba_ch_idx + ch], output_frame, sub( Q_p_output, Q11 ) ); } - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_sba_mix_matrix_determiner_fx( st_ivas->hSpar, &p_output_fx[sba_ch_idx], st_ivas->bfi, nchan_remapped, output_frame, num_md_sub_frames ); #if 1 @@ -2179,11 +2181,11 @@ ivas_error ivas_jbm_dec_tc( { #ifdef IVAS_FLOAT_FIXED Word16 q; - float max_val = 0.0; - int i_max_val_op; + //float max_val = 0.0; + //int i_max_val_op; hCPE = st_ivas->hCPE[0]; hSCE = st_ivas->hSCE[0]; - i_max_val_op = (int) max_val; + //i_max_val_op = (int) max_val; s = 0; FOR( i = 0; i < 2; i++ ) { @@ -3265,16 +3267,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( else if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) { #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -3427,16 +3429,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( } #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -3564,16 +3566,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( { ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -3703,16 +3705,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); } #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + // num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -3951,16 +3953,16 @@ void ivas_jbm_dec_feed_tc_to_renderer( { #if 1 - Word16 num_in_ch = 0, num_bands_out = 0, nchan_transport = 0, num_md_sub_frames = 0, num_out_ch = 0; + Word16 nchan_transport = 0; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) { - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); + //num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) { @@ -4332,7 +4334,7 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_BUFFER ) { - Word16 slot_size, slots_to_render, tmp, e, slots_rendered, nSamplesRendered_tmp; + Word16 slot_size, slots_to_render, tmp, e, nSamplesRendered_tmp; slot_size = st_ivas->hTcBuffer->n_samples_granularity; @@ -4340,7 +4342,7 @@ ivas_error ivas_jbm_dec_render( tmp = BASOP_Util_Divide1616_Scale( nSamplesAsked, slot_size, &e ); tmp = shr( tmp, sub( 15, e ) ); slots_to_render = s_min( sub( st_ivas->hTcBuffer->num_slots, st_ivas->hTcBuffer->slots_rendered ), tmp ); - slots_rendered = add( st_ivas->hTcBuffer->slots_rendered, slots_to_render ); + //slots_rendered = add( st_ivas->hTcBuffer->slots_rendered, slots_to_render ); nSamplesRendered_tmp = (UWord16) L_mult0( slots_to_render, slot_size ); FOR( Word16 ind = 0; ind < st_ivas->hTcBuffer->nchan_transport_jbm; ind++ ) { @@ -4698,8 +4700,10 @@ ivas_error ivas_jbm_dec_render( #if 1 /*Float to fixed conversion*/ SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; +#ifndef MSAN_FIX uint16_t nchan_internal; nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); +#endif Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; @@ -5660,7 +5664,7 @@ ivas_error ivas_jbm_dec_render( #ifdef IVAS_FLOAT_FIXED #if 1//ftf changes int16_t channel_active_fx[MAX_OUTPUT_CHANNELS]; - uint16_t nchan_out_init; + //uint16_t nchan_out_init; Word16 nchan_out_cov; Word16 nchan_out_cldfb = 0; @@ -5668,7 +5672,7 @@ ivas_error ivas_jbm_dec_render( Word16 nchan_transport_tmp = st_ivas->nchan_transport; output_Fs = st_ivas->hDecoderConfig->output_Fs; Word16 nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - nchan_out_init = nchan_out_transport; + //nchan_out_init = nchan_out_transport; if (st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM) { @@ -8666,7 +8670,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( * * *--------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void ivas_jbm_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, @@ -8699,6 +8703,7 @@ static void ivas_jbm_dec_tc_buffer_playout( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_jbm_dec_tc_buffer_playout_fx( @@ -9191,7 +9196,7 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( { Word32 *cldfb_real_buffer_fx; Word32 *cldfb_imag_buffer_fx; - Word16 cldfb_real_e, cldfb_imag_e; + //Word16 cldfb_real_e, cldfb_imag_e; Word16 cldfb_ch, slot_idx, num_freq_bands; cldfb_real_buffer_fx = NULL; @@ -9202,9 +9207,9 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( IF( EQ_16( (Word16) st_ivas->ivas_format, (Word16) ISM_FORMAT ) ) { cldfb_real_buffer_fx = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_fx; - cldfb_real_e = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_exp; + //cldfb_real_e = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc_exp; cldfb_imag_buffer_fx = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_fx; - cldfb_imag_e = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_exp; + //cldfb_imag_e = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc_exp; num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands; ivas_ism_param_dec_tc_gain_ajust_fx( st_ivas, output_frame, output_frame / 2, tc_fx, &Q_tc ); @@ -9214,9 +9219,9 @@ void ivas_jbm_dec_copy_tc_no_tsm_fx( ELSE IF( EQ_16( (Word16) st_ivas->ivas_format, (Word16) MC_FORMAT ) ) { cldfb_real_buffer_fx = st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx; - cldfb_real_e = st_ivas->hParamMC->Cldfb_RealBuffer_tc_e; + //cldfb_real_e = st_ivas->hParamMC->Cldfb_RealBuffer_tc_e; cldfb_imag_buffer_fx = st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx; - cldfb_imag_e = st_ivas->hParamMC->Cldfb_ImagBuffer_tc_e; + //cldfb_imag_e = st_ivas->hParamMC->Cldfb_ImagBuffer_tc_e; num_freq_bands = st_ivas->hParamMC->num_freq_bands; } /* CLDFB Analysis*/ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 006a9240a..06b7ed543 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -108,7 +108,7 @@ static Word16 ivas_decode_masaism_metadata_fx( IVAS_QMETADATA_HANDLE hQMetaData, static void decode_index_slice_fx( Word16 index, Word16 *ratio_idx_ism, const Word16 nchan_ism, const Word16 K ); -static void decode_ism_ratios_fx( UWord16 *bit_stream, Word16 *next_bit_pos, const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const Word16 nchan_ism, const Word16 nbands, const Word16 nblocks, const Word16 idx_separated_object ); +static void decode_ism_ratios_fx( UWord16 *bit_stream, Word16 *next_bit_pos, Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word32 ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const Word16 nchan_ism, const Word16 nbands, const Word16 nblocks, const Word16 idx_separated_object ); static void read_ism_ratio_index_fx( Word16 ratio_ism_idx[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], const Word16 nchan_ism, const Word16 numCodingBands, const Word16 sf, Word16 ratio_ism_idx_prev_sf[MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], UWord16 *bit_stream, Word16 *next_bit_pos, const Word32 *masa_to_total_energy_ratio_fx, const Word16 idx_sep_obj, Word16 *num_zeros ); #endif @@ -2343,7 +2343,7 @@ static ivas_error init_lfe_synth_data_fx( /* Interpolation between slots */ hMasa->hMasaLfeSynth->lfeGainPrev_fx = 0; move16(); - hMasa->hMasaLfeSynth->transportGainPrev_fx = ONE_IN_Q15; + hMasa->hMasaLfeSynth->transportGainPrev_fx = MAX_WORD16; move16(); tmp = BASOP_Util_Divide3232_Scale( output_Fs, FRAMES_PER_SEC * CLDFB_NO_COL_MAX, &tmp_e ); @@ -5117,7 +5117,7 @@ static void decode_ism_ratios( static void decode_ism_ratios_fx( UWord16 *bit_stream, /* i : bitstream */ Word16 *next_bit_pos, /* i/o: position in bitstream */ - const Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : masa_to_total energy ratios */ + Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i : masa_to_total energy ratios */ Word32 ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS], /* o : ISM ratios */ const Word16 n_ism, /* i : number of objects */ const Word16 nbands, /* i : number of subbands */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 1a68db7ee..64f125f30 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -79,10 +79,14 @@ typedef struct parameter_band_mapping_struct * Local function prototypes *-----------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, const int16_t nchan_in, const int16_t nchan_out ); +#endif static void ivas_param_mc_dec_init_fx( PARAM_MC_DEC_HANDLE hParamMC, const Word16 nchan_in, const Word16 nchan_out ); +#ifndef IVAS_FLOAT_FIXED static void param_mc_protoSignalComputation( float *RealBuffer, float *ImagBuffer, float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands ); +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_param_mc_dec_copy_diffuse_proto(PARAM_MC_DEC_HANDLE hParamMC, Word32 Cldfb_buffer_real_fx[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 Cldfb_buffer_imag_fx[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 nY, const Word16 slot_idx); #else @@ -90,11 +94,17 @@ static void ivas_param_mc_dec_copy_diffuse_proto( PARAM_MC_DEC_HANDLE hParamMC, #endif static Word16 ivas_param_mc_range_decoder_LC( UWord16 *bit_buffer, Word16 *x, Word16 *BER_detect, const Word16 sz_seq, const Word16 sz_alphabet, const UWord16 *cft, const UWord16 *sft, const Word16 tot_shift, const Word16 nbbits ); +#ifndef IVAS_FLOAT_FIXED static int16_t ivas_param_mc_uniform_decoder( float *seq, const int16_t sz_seq, const float *alphabet, const int16_t N, uint16_t bit_buffer[PARAM_MC_MAX_BITS] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_dequantize_cov( PARAM_MC_DEC_HANDLE hDirAC, float *ild_q, float *icc_q, const int16_t param_band_index, const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nY, const int16_t nX, float *Cx_state, float *Cproto, float *Cy_state ); +#endif +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); +#endif static void ivas_param_mc_get_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ @@ -113,18 +123,24 @@ static void ivas_param_mc_get_mixing_matrices_fx( #ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); #endif +#ifndef IVAS_FLOAT_FIXED static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float *mixing_matrix[], float *mixing_matrix_res[], const uint16_t nX, const uint16_t nY ); +#endif #ifdef IVAS_FLOAT_FIXED static Word16 ivas_param_mc_uniform_decoder_fx(Word16 *seq, const Word16 sz_seq, const Word16 *alphabet, const Word16 N, UWord16 bit_buffer[PARAM_MC_MAX_BITS]); static void ivas_param_mc_dec_compute_interpolator_fx( const UWord16 bAttackPresent, const UWord16 attackPos, const UWord16 interp_length, Word16 *interpolator ); #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresent, const uint16_t attackPos, const uint16_t interp_length, float *interpolator ); +#endif static void param_mc_set_num_synth_bands( const int32_t output_Fs, PARAM_MC_DEC_HANDLE hParamMC ); +#ifndef IVAS_FLOAT_FIXED static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, const uint16_t nchan_transport, const uint16_t nchan_out_cov, PARAM_MC_DIFF_PROTO_INFO *p_diff_proto_info ); +#endif static void ivas_param_mc_get_param_band_mapping( const int16_t n_target_bands, const int16_t *target_band_grouping, const int16_t n_source_bands, const int16_t *source_band_grouping, PARAM_MC_PARAMETER_BAND_MAPPING *parameter_band_mapping ); @@ -3095,7 +3111,7 @@ void ivas_param_mc_dec_digest_tc_fx( Word32 cx_imag_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 cx_imag_e, tmp_e; - Word16 cldfb_slots, qout = 0; + Word16 qout = 0; Word32 real_part_fx, imag_part_fx, L_tmp1, L_tmp2; @@ -3168,13 +3184,13 @@ void ivas_param_mc_dec_digest_tc_fx( move16(); cx_imag_e = 0; move16(); - cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; + //cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; move16(); - IF (st_ivas->hDecoderConfig->Opt_tsm) - { - cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; - move16(); - } + //IF (st_ivas->hDecoderConfig->Opt_tsm) + //{ + // cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; + // move16(); + //} /* slot loop for gathering the input data */ FOR ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) @@ -3574,8 +3590,10 @@ void ivas_param_mc_dec_render_fx( /* format converter */ Word16 channel_active[MAX_OUTPUT_CHANNELS]; - UWord16 nband_synth, nbands_to_zero; - UWord16 nchan_out_init; + UWord16 nband_synth; +#ifndef MSAN_FIX + UWord16 nchan_out_init, nbands_to_zero; +#endif UWord32 output_Fs; hParamMC = st_ivas->hParamMC; @@ -3586,16 +3604,20 @@ void ivas_param_mc_dec_render_fx( set_s( channel_active, 0, MAX_CICP_CHANNELS ); nchan_transport = st_ivas->nchan_transport; nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; +#ifndef MSAN_FIX nchan_out_init = nchan_out_transport; +#endif output_Fs = st_ivas->hDecoderConfig->output_Fs; IF ( EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV )|| EQ_16(st_ivas->renderer_type , RENDERER_BINAURAL_FASTCONV_ROOM) ) { nchan_out_cldfb = BINAURAL_CHANNELS; set_s( channel_active, 1, nchan_out_cldfb ); +#ifndef MSAN_FIX IF ( st_ivas->hCombinedOrientationData ) { nchan_out_init = MAX_INTERN_CHANNELS; } +#endif nchan_out_cov = add(st_ivas->hTransSetup.nchan_out_woLFE , st_ivas->hTransSetup.num_lfe); } ELSE IF ( EQ_16(hParamMC->synthesis_conf , PARAM_MC_SYNTH_LS_CONV_CLDFB )) @@ -3618,7 +3640,9 @@ void ivas_param_mc_dec_render_fx( /* set everything to zero that will not be decoded */ nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; +#ifndef IVAS_FLOAT_FIXED nbands_to_zero = sub(hParamMC->num_freq_bands , nband_synth); +#endif #ifdef MSAN_FIX FOR ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) #else @@ -3933,8 +3957,10 @@ void ivas_param_mc_dec_render( #endif float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#ifndef IVAS_FLOAT_FIXED float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; +#endif for ( i = 0; i < MAX_INTERN_CHANNELS; i++) { for (int j = 0; j < PARAM_MC_MAX_NSLOTS_IN_SUBFRAME; j++) { for (int k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) { @@ -4261,7 +4287,7 @@ void ivas_param_mc_dec_render( } } - for (i = 0; i < BINAURAL_CHANNELS; i++) + /* for (i = 0; i < BINAURAL_CHANNELS; i++) { for (j = 0; j < hParamMC->subframe_nbslots[subframe_idx]; j++) { @@ -4271,7 +4297,7 @@ void ivas_param_mc_dec_render( Cldfb_ImagBuffer_Binaural[i][j][k] = fix_to_float(Cldfb_ImagBuffer_Binaural_fx[i][j][k], Q6); } } - } + }*/ #else ivas_binRenderer(st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, @@ -4627,6 +4653,7 @@ static void ivas_param_mc_dec_init( * Compute prototypes for decorrelation *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void param_mc_protoSignalComputation( float *RealBuffer, /* i : CLDFB samples of the transport channels (real part) */ float *ImagBuffer, /* i : CLDFB samples of the transport channels (imaginary part) */ @@ -4666,6 +4693,7 @@ static void param_mc_protoSignalComputation( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void param_mc_protoSignalComputation_fx( @@ -4849,6 +4877,7 @@ static Word16 ivas_param_mc_uniform_decoder_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static int16_t ivas_param_mc_uniform_decoder( float *seq, /* o : decoded sequence of float values */ const int16_t sz_seq, /* i : number of values to decode */ @@ -4874,6 +4903,7 @@ static int16_t ivas_param_mc_uniform_decoder( return n_bits; } +#endif /*------------------------------------------------------------------------- @@ -4986,6 +5016,7 @@ static void ivas_param_mc_dec_compute_interpolator_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresent, /* i : flag indicating if we have a transient in the current frame */ const uint16_t attackPos, /* i : position of the transient */ @@ -5013,6 +5044,7 @@ static void ivas_param_mc_dec_compute_interpolator( return; } +#endif /*------------------------------------------------------------------------- @@ -5021,6 +5053,7 @@ static void ivas_param_mc_dec_compute_interpolator( * remove all LFE related values from a covariance matrix *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void remove_lfe_from_cy( const int16_t nY, /* i : dimension of the covariance matrix */ int16_t lfe_indices[PARAM_MC_LOCAL_SZ_LFE_MAP], /* i : LFE index */ @@ -5055,6 +5088,7 @@ static void remove_lfe_from_cy( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void remove_lfe_from_cy_fx( @@ -5504,7 +5538,6 @@ static void ivas_param_mc_get_mixing_matrices_fx( Word32 mixing_matrix_local_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; Word16 Cy_diag_e = 0, mixing_matrix_local_e = 0; Word32 Cproto_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word16 Cproto_buff_e[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; Word16 Cproto_e; Word32 *proto_matrix_ptr_fx; Word32 *Cx_state_fx; @@ -5630,13 +5663,10 @@ static void ivas_param_mc_get_mixing_matrices_fx( FOR (ch_idx1 = 0; ch_idx1 < nY_intern; ch_idx1++) { - Cproto_buff_e[ch_idx1 + ch_idx1 * nY_intern] = Cproto_e; IF (BASOP_Util_Cmp_Mant32Exp( Cproto_fx[ch_idx1 + ch_idx1 * nY_intern], Cproto_e, 0, 0 ) < 0 ) { Cproto_fx[ch_idx1 + ch_idx1 * nY_intern] = 0; move32(); - Cproto_buff_e[ch_idx1 + ch_idx1 * nY_intern] = 0; - move16(); } } @@ -6656,36 +6686,36 @@ static void param_mc_set_num_synth_bands( ) { UWord16 max_param_band_synth; - const UWord16 *param_mc_bands_coded; + const Word16 *param_mc_bands_coded; SWITCH( hParamMC->hMetadataPMC->num_parameter_bands ) { case 20: - param_mc_bands_coded = (UWord16 *) param_mc_bands_coded_20; + param_mc_bands_coded = param_mc_bands_coded_20; BREAK; case 10: - param_mc_bands_coded = (UWord16 *) param_mc_bands_coded_10; + param_mc_bands_coded = param_mc_bands_coded_10; BREAK; case 14: default: - param_mc_bands_coded = (UWord16 *) param_mc_bands_coded_14; + param_mc_bands_coded = param_mc_bands_coded_14; BREAK; } move16(); SWITCH( output_Fs ) { case 8000: - max_param_band_synth = param_mc_bands_coded[NB]; + max_param_band_synth = (UWord16) param_mc_bands_coded[NB]; BREAK; case 16000: - max_param_band_synth = param_mc_bands_coded[WB]; + max_param_band_synth = (UWord16) param_mc_bands_coded[WB]; BREAK; case 32000: - max_param_band_synth = param_mc_bands_coded[SWB]; + max_param_band_synth = (UWord16) param_mc_bands_coded[SWB]; BREAK; case 48000: default: - max_param_band_synth = param_mc_bands_coded[FB]; + max_param_band_synth = (UWord16) param_mc_bands_coded[FB]; BREAK; } move16(); @@ -6914,6 +6944,8 @@ static ivas_error param_mc_get_diff_proto_info_fx( } #endif #undef FLT_ENABLE + +#ifndef IVAS_FLOAT_FIXED static ivas_error param_mc_get_diff_proto_info( const float *proto_mtx, /* i : protoype matrix for the synthesis */ const uint16_t nchan_transport, /* i : number of transport channels */ @@ -7061,7 +7093,7 @@ static ivas_error param_mc_get_diff_proto_info( return IVAS_ERR_OK; } - +#endif /*-------------------------------------------------------------------------* * ivas_param_mc_bs_decode_parameter_values() diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index b16252440..a4bf16d6c 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1358,10 +1358,10 @@ ivas_error ivas_mc_dec_config( { #ifdef IVAS_FLOAT_FIXED #if 1 /*TODO: To be removed(Float to fixed conversion)*/ - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; - RENDERER_TYPE renderer_type_old; - renderer_type_old = st_ivas->renderer_type; + //DECODER_TC_BUFFER_HANDLE hTcBuffer; + //hTcBuffer = st_ivas->hTcBuffer; + //RENDERER_TYPE renderer_type_old; + //renderer_type_old = st_ivas->renderer_type; IF( st_ivas->hCombinedOrientationData ) FOR( Word16 ind1 = 0; ind1 < 3; ind1++ ) { @@ -1370,14 +1370,14 @@ ivas_error ivas_mc_dec_config( st_ivas->hCombinedOrientationData->Rmat_fx[0][ind1][ind2] = (Word32) ( st_ivas->hCombinedOrientationData->Rmat[0][ind1][ind2] * ( 1 << 15 ) ); } } - SPAR_DEC_HANDLE hSpar; - hSpar = st_ivas->hSpar; + //SPAR_DEC_HANDLE hSpar; + //hSpar = st_ivas->hSpar; Word16 nchan_transport_old = st_ivas->nchan_transport; - uint16_t nchan_internal; + //uint16_t nchan_internal; Word32 ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); - DECODER_CONFIG_HANDLE hDecoderConfig; - hDecoderConfig = st_ivas->hDecoderConfig; + //nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + //DECODER_CONFIG_HANDLE hDecoderConfig; + //hDecoderConfig = st_ivas->hDecoderConfig; Word16 n_tc; n_tc = st_ivas->hTcBuffer->nchan_transport_internal; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 8635457e6..b3980c49c 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -348,7 +348,7 @@ ivas_error ivas_omasa_dec_config_fx( DECODER_CONFIG_HANDLE hDecoderConfig = NULL; Word16 numch_out_dirac = 0; SPAR_DEC_HANDLE hSpar = NULL; - Word16 numch_in, numch_out, num_md_sub_frames; + Word16 numch_in; IF(EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM) || EQ_16(st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC)) { IF(EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) && NE_16(st_ivas->ism_mode, ISM_MASA_MODE_DISC)) @@ -372,15 +372,15 @@ ivas_error ivas_omasa_dec_config_fx( } } hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata(st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate); + //uint16_t nchan_internal; + //nchan_internal = ivas_sba_get_nchan_metadata(st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate); hDecoderConfig = st_ivas->hDecoderConfig; numch_out_dirac = hDecoderConfig->nchan_out; IF(hSpar) { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; + //numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; - num_md_sub_frames = ivas_get_spar_dec_md_num_subframes(st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate); + //num_md_sub_frames = ivas_get_spar_dec_md_num_subframes(st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate); for (Word16 in_ch = 0; in_ch < numch_in; in_ch++) { diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index f2960375f..dea30f1e8 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -103,6 +103,7 @@ static void ivas_lssetupconversion_computeEQFactor_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_lssetupconversion_computeEQFactor( float *outputEnergy, float *inputEnergy, @@ -117,6 +118,7 @@ static void ivas_lssetupconversion_computeEQFactor( return; } +#endif #ifdef IVAS_FLOAT_FIXED @@ -192,6 +194,7 @@ static void ivas_lssetupconversion_mdct_init_bands_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_lssetupconversion_mdct_init_bands( const int16_t output_frame, /* i : output frame length */ const int16_t tcx_mode, /* i : tcx mode (TCX10, TCX 20) */ @@ -255,6 +258,7 @@ static void ivas_lssetupconversion_mdct_init_bands( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void get_custom_ls_conversion_matrix_fx( diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index fc870092a..8ebb0f619 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -7309,7 +7309,7 @@ static Word16 read_coherence_data_fx( /* read average index */ read_huf( &bit_pos, bitstream, &av_index, bit_pos, MASA_NO_CV_COH1, huff_code_av_masa, 10 ); /* 10 is MAX_LEN*/ - nbits = ( nbits, sub( bits_GR, bit_pos ) ); + nbits = add( nbits, sub( bits_GR, bit_pos ) ); /* write indexes in metadata structure */ FOR( j = 0; j < coding_subbands; j++ ) @@ -8101,11 +8101,11 @@ static Word16 read_surround_coherence_hr_fx( Word16 j, k, sf; UWord16 byteBuffer; UWord16 idx_sur_coh[MASA_MAXIMUM_CODING_SUBBANDS]; - IVAS_QDIRECTION *q_direction; + //IVAS_QDIRECTION *q_direction; Word16 min_index; Word16 d, idx; coding_subbands = hQMetaData->q_direction[0].cfg.nbands; - q_direction = hQMetaData->q_direction; + //q_direction = hQMetaData->q_direction; bits_sur_coherence = 0; bit_pos = *p_bit_pos; diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index af261f85e..7b1a6c442 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1042,14 +1042,14 @@ ivas_error ivas_sba_dec_reconfigure_fx( } SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); + //uint16_t nchan_internal; + //nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); hDecoderConfig = st_ivas->hDecoderConfig; - Word16 numch_in = 0, numch_out; + Word16 numch_in = 0; Word16 numch_out_dirac = hDecoderConfig->nchan_out; IF( hSpar ) { - numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; + //numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); hSpar->hMdDec->Q_mixer_mat = 30; @@ -1315,12 +1315,12 @@ ivas_error ivas_sba_dec_reconfigure_fx( if ( st_ivas->hBinRenderer == NULL && ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { /*float2fix block: to be removed*/ - if (st_ivas->hIntSetup.ls_azimuth && st_ivas->hIntSetup.ls_azimuth_fx) { + /* if (st_ivas->hIntSetup.ls_azimuth && st_ivas->hIntSetup.ls_azimuth_fx) { floatToFixed_arrL((float *)st_ivas->hIntSetup.ls_azimuth, (Word32 *)st_ivas->hIntSetup.ls_azimuth_fx, Q22, st_ivas->hIntSetup.nchan_out_woLFE); } if (st_ivas->hIntSetup.ls_elevation && st_ivas->hIntSetup.ls_elevation_fx) { floatToFixed_arrL((float *)st_ivas->hIntSetup.ls_elevation, (Word32 *)st_ivas->hIntSetup.ls_elevation_fx, Q22, st_ivas->hIntSetup.nchan_out_woLFE); - } + }*/ /*float2fix block end*/ /* open fastconv binaural renderer */ if ( ( error = ivas_binRenderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 07119019b..52db40217 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -986,11 +986,11 @@ void ivas_sba_mix_matrix_determiner( num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; #ifdef IVAS_FLOAT_FIXED #if 1 /*Float to fixed changes */ - Word16 num_out_ch; - num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_out_ch; + //num_out_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; hSpar->hMdDec->Q_mixer_mat = 31; - Word16 num_in_ch; - num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; + //Word16 num_in_ch; + //num_in_ch = hSpar->hMdDec->spar_md_cfg.num_umx_chs; #endif ivas_spar_dec_gen_umx_mat_fx( hSpar->hMdDec, nchan_transport, num_bands_out, bfi, num_md_sub_frames); #else diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 1e250a383..494a6a035 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -988,6 +988,7 @@ static Word32 matrix_det_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static float matrix_det( const float a00, const float a01, @@ -996,6 +997,7 @@ static float matrix_det( { return a00 * a11 - a01 * a10; } +#endif #ifdef IVAS_FLOAT_FIXED static void matrix_inverse_fx( @@ -1077,6 +1079,7 @@ static void matrix_inverse_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void matrix_inverse( float in[3][3], float out[3][3], @@ -1122,6 +1125,7 @@ static void matrix_inverse( return; } +#endif /*---------------------------------------------------------------------* @@ -1195,11 +1199,11 @@ void ivas_spar_get_cldfb_gains_fx( /* optimization*/ /* 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( (float *)hSpar->hFbMixer->pFilterbank_cross_fade, pFilterbank_cross_fade_fx, Q31, cf_len ); + //Word32 pFilterbank_cross_fade_fx[192];// Temporarily added to stored fixed value of hSpar->hFbMixer->pFilterbank_cross_fade_fx + //floatToFixed_arrL( (float *)hSpar->hFbMixer->pFilterbank_cross_fade, pFilterbank_cross_fade_fx, Q31, cf_len ); FOR( sample = 0; sample < cf_len; sample++ ) { - tgt_fx[tmp_idx++] = pFilterbank_cross_fade_fx[sample]; + tgt_fx[tmp_idx++] = L_deposit_h(hSpar->hFbMixer->pFilterbank_cross_fade_fx[sample]); /* increasing window function */ } FOR( ; tmp_idx < num_samples; tmp_idx++ ) diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 858b542ce..5af8a70b8 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -83,7 +83,9 @@ static void ivas_mat_col_rearrange( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_ static void ivas_mat_col_rearrange_fx( Word32 in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], const int16_t order[IVAS_SPAR_MAX_CH], const int16_t i_ts, Word32 ***mixer_mat, const int16_t bands, const int16_t num_ch ); #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_spar_dec_compute_ramp_down_post_matrix( ivas_spar_md_dec_state_t *hMdDec, const int16_t num_bands, const int16_t bfi, const int16_t num_md_sub_frames ); +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_spar_dec_compute_ramp_down_post_matrix_fx(ivas_spar_md_dec_state_t *hMdDec, const Word16 num_bands, const Word16 bfi, const Word16 num_md_sub_frames); @@ -92,7 +94,9 @@ static void ivas_spar_dec_compute_ramp_down_post_matrix_fx(ivas_spar_md_dec_stat #ifdef IVAS_FLOAT_FIXED static void ivas_spar_md_fill_invalid_bands_fx(ivas_spar_dec_matrices_t *pSpar_coeffs, ivas_spar_dec_matrices_t *pSpar_coeffs_prev, const Word16 *valid_bands, Word16 *base_band_age, const Word16 num_bands, const Word16 num_channels, const Word16 num_md_sub_frames); #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_spar_md_fill_invalid_bands( ivas_spar_dec_matrices_t *pSpar_coeffs, ivas_spar_dec_matrices_t *pSpar_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, const int16_t num_bands, const int16_t numch_out, const int16_t num_md_sub_frames ); +#endif static void ivas_spar_md_fill_invalid_bandcoeffs( ivas_band_coeffs_t *pBand_coeffs, ivas_band_coeffs_t *pBand_coeffs_prev, const int16_t *valid_bands, int16_t *base_band_age, int16_t *first_valid_frame, const int16_t num_bands ); #ifdef IVAS_FLOAT_FIXED @@ -103,7 +107,9 @@ static ivas_error ivas_spar_set_dec_config( ivas_spar_md_dec_state_t *hMdDec, co static void ivas_parse_parameter_bitstream_dtx( ivas_spar_md_t *pSpar_md, Decoder_State *st, const int16_t bw, const int16_t num_bands, int16_t *num_dmx_per_band, int16_t *num_dec_per_band ); +#ifndef IVAS_FLOAT_FIXED static ivas_error ivas_deindex_real_index( const int16_t *index, const int16_t q_levels, const float min_value, const float max_value, float *quant, const int16_t num_ch_dim2 ); +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error ivas_deindex_real_index_fx( const int16_t *index, const int16_t q_levels, const Word32 min_value, const Word32 max_value, Word32 *quant, const int16_t num_ch_dim2 ); #endif @@ -962,7 +968,9 @@ ivas_error ivas_spar_md_dec_init( { int16_t i, j; int16_t nchan_transport; +#ifndef IVAS_FLOAT_FIXED Word32 pFC[IVAS_MAX_NUM_BANDS]; +#endif Word32 *pFC_fx=NULL, PR_minmax_fx[2]; ivas_error error; @@ -977,12 +985,13 @@ ivas_error ivas_spar_md_dec_init( nchan_transport = hMdDec->spar_md_cfg.nchan_transport; - +#ifndef IVAS_FLOAT_FIXED /* get FB coefficients */ FOR (i = 0; i < IVAS_MAX_NUM_BANDS; i++) { pFC[i] = L_shr(Mpy_32_32(ivas_fb_fcs_12band_1ms_fx[i], hDecoderConfig->output_Fs), 1); //Q0 } +#endif IF (EQ_32 (hDecoderConfig->output_Fs, 8000)) { @@ -3669,6 +3678,7 @@ static void ivas_spar_plc_get_band_age( return; } +#ifndef IVAS_FLOAT_FIXED static void ivas_spar_get_plc_interp_weights( int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], int16_t last_valid_band_idx, @@ -3698,6 +3708,7 @@ static void ivas_spar_get_plc_interp_weights( } return; } +#endif static void ivas_spar_get_plc_interp_weights_fx( int16_t valid_band_idx[IVAS_MAX_NUM_BANDS], @@ -4890,7 +4901,7 @@ void ivas_spar_to_dirac_fx( Word32 radius_fx; //float en_ratio, res_pow; Word32 en_ratio_fx, res_pow_fx; - Word16 en_ratio_q, res_pow_q; + Word16 en_ratio_q; int16_t num_slots_in_subfr; int16_t tmp_write_idx_param_band; int16_t tmp_write_idx_band; @@ -5059,7 +5070,7 @@ void ivas_spar_to_dirac_fx( Word32 Pd_temp_res = Mpy_32_32(Pd_fx[0], Pd_fx[0]) + Mpy_32_32(Pd_fx[1], Pd_fx[1]) + Mpy_32_32(Pd_fx[2], Pd_fx[2]);//q = 22+22-31 = 13 //res_pow = w_en_norm + en_ratio + ( Pd[0] * Pd[0] + Pd[1] * Pd[1] + Pd[2] * Pd[2] ); res_pow_fx = L_shr(w_en_norm_fx, (31- q_w_en_norm_fx)-13) + en_ratio_fx + Pd_temp_res; - res_pow_q = 13; + //res_pow_q = 13; res_pow_fx = L_shr(res_pow_fx, 1); //res_pow *= 0.5f; //hMdDec->spar_md.en_ratio_slow[band] = 0.75f * hMdDec->spar_md.en_ratio_slow[band] + 0.25f * en_ratio; diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 23e2d0746..7bc77fd2b 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -850,7 +850,7 @@ static void stereo_dft_generate_comfort_noise_fx( IF( EQ_16( st->cng_type, LP_CNG ) ) { - Word16 q_sqrt, q_div, q_inv_sqrt, rshift_shb = 0, rshift_cng; + Word16 q_sqrt, q_div, rshift_shb = 0, rshift_cng; Word32 min_val; move16(); set_val_Word32( cngNoiseLevel_upd, 0, st->L_frame ); @@ -915,7 +915,7 @@ static void stereo_dft_generate_comfort_noise_fx( // The left shift of q_div and 1 (because of multiplication factor 2.0) is handled below. // by adjusting q_inv_sqrt. minimum_abs32_fx( ptr0, st->L_frame, &min_val ); - q_inv_sqrt = sub( sub( Q31, norm_l( L_abs( min_val ) ) ), add( q_div, 1 ) ); + //q_inv_sqrt = sub( sub( Q31, norm_l( L_abs( min_val ) ) ), add( q_div, 1 ) ); FOR( i = 0; i < shr( st->L_frame, 1 ) - 1; i++ ) { //if ((*ptr1 == 0) && (*ptr2 == 0)) @@ -1543,7 +1543,7 @@ void stereo_cng_dec_update( *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED void stereo_cng_compute_PScorr_fx( - Word32 output_fx0[], /* i : Output signal Qx = 1/*temp*/ + Word32 output_fx0[], /* i : Output signal Qx = 1 temp*/ Word32 output_fx1[], /* i : Output signal Qx*/ Word16 *output_Q, Word32 *c_PS_LT_fx, @@ -1910,6 +1910,7 @@ static void stereo_cng_compute_LRcorr_fx( * Find the energie ratio between the mono and the side *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void FindEmEs( const float *ch1, /* i : Left channel */ const float *ch2, /* i : right channel */ @@ -1940,6 +1941,7 @@ static void FindEmEs( return; } +#endif static void FindEmEs_fx( const Word32 *ch1_fx, /* i : Left channel */ diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index c75400362..9895ea173 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -79,9 +79,13 @@ /*------------------------------------------------------------------------- * Local function prototypes *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void stereo_dft_compute_td_stefi_params( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const float samp_ratio ); +#endif +#ifndef IVAS_FLOAT_FIXED static void stereo_dft_adapt_sf_delay( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, float *pPredGain ); +#endif #ifndef IVAS_FLOAT_FIXED diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 03bb0f511..3ffeb8f65 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -2180,7 +2180,7 @@ static void stereo_dft_compute_td_stefi_params_fx( Word32 wsum; Word32 pred_gain_avg, pred_g; Word16 shift_g; - Word16 q_pred_g, q_pred_gain_avg; + Word16 q_pred_gain_avg; Word32 nrg_DMX, nrg_pred_DMX; Word32 op1; Word16 q_div, q_sqrt; @@ -2256,12 +2256,12 @@ static void stereo_dft_compute_td_stefi_params_fx( IF (GT_16(sub(15, q_div), 15)) { pred_g = L_shl(pred_g, q_div); - q_pred_g = 15; - } - ELSE - { - q_pred_g = sub(15, q_div); + //q_pred_g = 15; } + //ELSE + //{ + // q_pred_g = sub(15, q_div); + //} pred_gain_avg = BASOP_Util_Divide3232_Scale(pred_gain_avg, wsum, &q_div); IF (GT_16(sub(15, q_div), 15)) { @@ -2380,7 +2380,7 @@ void stereo_dft_generate_res_pred_fx( /* variables for enhanced stereo filling */ Word16 norm_fac, q_norm_fac = 0, lim_norm_fac; Word16 q_sqrt; - Word16 alpha, gain_limit; + Word16 alpha; //gain_limit; /* variables for stereo filling */ Word16 d_long, d_short, d_long_ind, d_short_ind; @@ -2395,7 +2395,7 @@ void stereo_dft_generate_res_pred_fx( /* smoothing and limiting parameters */ alpha = hStereoDft->wasTransient ? 0 : (Word16)(0x199A); /* no smoothing after transients */ - gain_limit = 0x7FFF; // 2.0 in Q14 + //gain_limit = 0x7FFF; // 2.0 in Q14 move16(); /* residual prediction only used up to 16 kHz (SWB) */ @@ -2769,7 +2769,7 @@ void stereo_dft_generate_res_pred_fx( FOR ( b = band0; b < nbands_respred; b++ ) { /* TCX/HQ core -> TCX/HQ core: business as usual */ - d_short_ind = STEREO_DFT_PAST_MAX - STEREO_DFT_STEFFI_DELAY_SHORT + b & 1; + d_short_ind = add(sub(STEREO_DFT_PAST_MAX, STEREO_DFT_STEFFI_DELAY_SHORT), b & 1); move16(); d_long_ind = max( 4, (int16_t) ( ( STEREO_DFT_PAST_MAX + 4 - 1 ) * ( (float) b / ( hStereoDft->nbands - 1 ) ) + 0.5f ) ) - 4; move16(); diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index 37d3841e0..318f8e1eb 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -516,7 +516,7 @@ void stereo_dft_res_subst_spec_fx( ) { Word16 i, idx; - Word16 fac; + //Word16 fac; Word32 s1, s2, abs1, abs2, abs3, abs4; Word32 abs_res[( STEREO_DFT_RES_BW_MAX ) / 2]; Word32 Xmax, Xmin; @@ -588,7 +588,7 @@ void stereo_dft_res_subst_spec_fx( abs3 = L_abs( p_mem[2 * i] ); abs4 = L_abs( p_mem[2 * i + 1] ); - fac = MAX_16; + //fac = MAX_16; move16(); /* Low-complex phase matching that brings the angle within pi/4 of the target angle */ test(); diff --git a/lib_dec/ivas_stereo_eclvq_dec.c b/lib_dec/ivas_stereo_eclvq_dec.c index 0e3cdc467..4094ced1a 100644 --- a/lib_dec/ivas_stereo_eclvq_dec.c +++ b/lib_dec/ivas_stereo_eclvq_dec.c @@ -39,6 +39,7 @@ #include #include "prot.h" #include "wmc_auto.h" +#include "ivas_prot_fx.h" /*--------------------------------------------------------------- diff --git a/lib_dec/ivas_stereo_esf_dec.c b/lib_dec/ivas_stereo_esf_dec.c index efec50708..6233f9e25 100644 --- a/lib_dec/ivas_stereo_esf_dec.c +++ b/lib_dec/ivas_stereo_esf_dec.c @@ -205,7 +205,7 @@ void filter_with_allpass_fx( IF( NE_16( q_shift, ap->q_buffer_fx ) ) { - FOR( k = 0; k < sizeof( ap->buffer_fx[0] ) / sizeof( ap->buffer_fx[0][0] ); k++ ) + FOR( k = 0; k < (Word16) ( sizeof( ap->buffer_fx[0] ) / sizeof( ap->buffer_fx[0][0] ) ); k++ ) { D1_fx[k] = L_shr( D1_fx[k], sub( ap->q_buffer_fx, q_shift ) ); move32(); diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index 2a25d8a3b..dbe9f4f95 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -50,10 +50,13 @@ * Local function prototypes *-------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void apply_dmx_weights( CPE_DEC_HANDLE hCPE, float *x[CPE_CHANNELS][NB_DIV], int16_t transform_type_left[NB_DIV], int16_t transform_type_right[NB_DIV] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void run_min_stats( Decoder_State **sts, float *x[CPE_CHANNELS][NB_DIV] ); - +#endif /*-------------------------------------------------------------------* * convert_coeffs_to_higher_res() @@ -148,6 +151,7 @@ void convert_coeffs_to_higher_res( * decode core and MDCT stereo information *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void stereo_mdct_dec_stereo( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t ms_mask[2][MAX_SFB] /* o : bandwise MS mask */ @@ -172,6 +176,7 @@ static void stereo_mdct_dec_stereo( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 09b528233..e730824c5 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -50,7 +50,9 @@ *-------------------------------------------------------------------------*/ static void apply_dmx_weights_fx( CPE_DEC_HANDLE hCPE, Word32 *x[CPE_CHANNELS][NB_DIV], int16_t transform_type_left[NB_DIV], int16_t transform_type_right[NB_DIV] ); +#ifndef IVAS_FLOAT_FIXED static void apply_dmx_weights( CPE_DEC_HANDLE hCPE, float *x[CPE_CHANNELS][NB_DIV], int16_t transform_type_left[NB_DIV], int16_t transform_type_right[NB_DIV] ); +#endif static void run_min_stats_fx( Decoder_State **sts, Word32 *x[CPE_CHANNELS][NB_DIV], Word16 x_e[MAX_CICP_CHANNELS][NB_DIV]); @@ -477,6 +479,7 @@ void stereo_mdct_core_dec_fx( return; } +#ifndef IVAS_FLOAT_FIXED static void apply_dmx_weights( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *x[CPE_CHANNELS][NB_DIV], /* i/o: MDCT Spectrum */ @@ -669,6 +672,7 @@ static void apply_dmx_weights( return; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 029e2bcff..6ba9a2653 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -2866,6 +2866,7 @@ void synchro_synthesis_fx( * Handling of memories in case of CPE modes switching *-------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static Word16 saturate( Word32 L_var1 ) { Word16 var_out; @@ -2892,6 +2893,7 @@ static Word16 saturate( Word32 L_var1 ) return ( var_out ); } +#endif Word32 side_gain_table[32 + 1] = { -ONE_IN_Q31, -2040109440, -1932735232, -1825361152, -1717986944, -1610612736, -1503238528, -1395864320, -1288490240, -1181115904, -1073741824, diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index ceec414f0..5a10a04c3 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -583,6 +583,7 @@ void tdm_upmix_plain_fx( * downmix Left+Right to Primary+Secondary channel with fade in/out *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void tdm_upmix_fade( float Left[], /* o : left channel */ float Right[], /* o : right channel */ @@ -652,6 +653,7 @@ static void tdm_upmix_fade( return; } +#endif Word32 inv_time[960 + 1] = { diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 63eb0eba2..a7eccb6c7 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -52,7 +52,9 @@ #ifndef IVAS_FLOAT_FIXED static void dec_prm_tcx( Decoder_State *st, int16_t param[], int16_t param_lpc[], int16_t *total_nbbits, const int16_t last_element_mode, int16_t *bitsRead ); #endif // !IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void stereo_tcx_dec_mode_switch_reconf( Decoder_State *st, const int16_t MCT_flag, const int16_t last_element_mode ); +#endif #ifdef IVAS_FLOAT_FIXED diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 21d4ec3fa..744bfea7b 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -82,7 +82,7 @@ struct apa_state_t /* Hann window */ float win[APA_BUF_PER_CHANNEL]; - Word16 *win_fx; + const Word16 *win_fx; //const Word16 *win_fx; UWord16 l_halfwin; @@ -141,11 +141,15 @@ struct apa_state_t * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float apa_corrEnergy2dB( float energy, uint16_t corr_len ); +#endif Word16 apa_corrEnergy2dB_fx(Word32 energy, Word16 energyExp, Word16 corr_len); Word16 apa_getQualityIncreaseForLowEnergy_fx(Word16 energydB); +#ifndef IVAS_FLOAT_FIXED static float apa_getQualityIncreaseForLowEnergy( float energydB ); +#endif static Word8 logarithmic_search_fx( const apa_state_t *ps, const Word16 *signal, @@ -157,9 +161,14 @@ static Word8 logarithmic_search_fx( const apa_state_t *ps, Word16 wss, Word16 css, Word16 *synchpos ); + +#ifndef IVAS_FLOAT_FIXED static bool logarithmic_search( const apa_state_t *ps, const float *signal, int16_t s_start, uint16_t inlen, uint16_t offset, uint16_t fixed_pos, uint16_t corr_len, uint16_t wss, uint16_t css, int16_t *synchpos ); +#endif +#ifndef IVAS_FLOAT_FIXED static bool find_synch( apa_state_t *ps, const float *in, uint16_t l_in, int16_t s_start, uint16_t s_len, int16_t fixed_pos, uint16_t corr_len, uint16_t offset, float *energy, float *quality, int16_t *synch_pos ); +#endif static bool copy_frm( apa_state_t *ps, const float frm_in[], float frm_out[], uint16_t *l_frm_out ); @@ -179,18 +188,6 @@ static Word16 find_synch_fx( apa_state_t *ps, Word32 *qualityQ16, Word16 *synch_pos ); -static Word16 norm(float num); - - -static Word16 norm(float num) { - if( ( Word16 ) num == 0 ) { - return 15; - } - else - return norm_s(( Word16 ) num); -} - - /*---------------------------------------------------------------------* * Public functions *---------------------------------------------------------------------*/ @@ -528,7 +525,7 @@ bool apa_set_rate( ps->l_search = ( ps->rate / 80 ) * ps->num_channels; #ifdef IVAS_FLOAT_FIXED - ps->win_fx = (Word16 *)pcmdsp_window_hann_640; + ps->win_fx = pcmdsp_window_hann_640; move16(); ps->l_halfwin = 320; move16(); @@ -536,14 +533,14 @@ bool apa_set_rate( move16(); IF( EQ_32( ps->rate, 48000 ) ) { - ps->win_fx = (Word16 *)pcmdsp_window_hann_960; + ps->win_fx = pcmdsp_window_hann_960; move16(); ps->l_halfwin = 480; move16(); } IF( EQ_32( ps->rate, 24000 ) ) { - ps->win_fx = (Word16 *)pcmdsp_window_hann_960; + ps->win_fx = pcmdsp_window_hann_960; move16(); ps->l_halfwin = 480; move16(); @@ -1155,6 +1152,7 @@ uint8_t apa_exec( * ******************************************************************************** */ +#ifndef IVAS_FLOAT_FIXED static void get_scaling_quality( const apa_state_t *ps, const float *signal, @@ -1248,6 +1246,7 @@ static void get_scaling_quality( return; } +#endif static void get_scaling_quality_fx(const apa_state_t * ps, @@ -1371,6 +1370,7 @@ Word16 apa_corrEnergy2dB_fx(Word32 energy, Word16 energyExp, Word16 corr_len) } /* Converts the correlation energy to dB. */ +#ifndef IVAS_FLOAT_FIXED static float apa_corrEnergy2dB( float energy, uint16_t corr_len ) @@ -1379,9 +1379,11 @@ static float apa_corrEnergy2dB( return energydB; } +#endif /* Increases the calculated quality of signals with low energy. */ +#ifndef IVAS_FLOAT_FIXED static float apa_getQualityIncreaseForLowEnergy( float energydB ) { @@ -1407,6 +1409,7 @@ static float apa_getQualityIncreaseForLowEnergy( return qualIncForLowEnergy; } +#endif Word16 apa_getQualityIncreaseForLowEnergy_fx(Word16 energydBQ8) { @@ -1467,6 +1470,7 @@ Word16 apa_getQualityIncreaseForLowEnergy_fx(Word16 energydBQ8) * ******************************************************************************** */ +#ifndef IVAS_FLOAT_FIXED static bool logarithmic_search( const apa_state_t *ps, const float *signal, @@ -1538,6 +1542,7 @@ static bool logarithmic_search( return 0; } +#endif static Word8 logarithmic_search_fx(const apa_state_t * ps, @@ -1664,6 +1669,7 @@ static Word8 logarithmic_search_fx(const apa_state_t * ps, * ******************************************************************************** */ +#ifndef IVAS_FLOAT_FIXED static bool find_synch( apa_state_t *ps, const float *in, @@ -1695,6 +1701,7 @@ static bool find_synch( return 0; } +#endif static Word16 find_synch_fx( apa_state_t *ps, const Word16 *in, @@ -1818,7 +1825,7 @@ static bool shrink_frm( int16_t xtract, l_rem, s_start, s_end; uint16_t i; uint16_t over; - float energy, quality = 0.0f; + float quality = 0.0f; uint16_t l_frm; uint16_t l_seg; @@ -1851,7 +1858,7 @@ static bool shrink_frm( #endif // !IVAS_FLOAT_FIXED { /* maximum scaling */ - energy = -65; + //energy = -65; quality = 5; if ( ps->evs_compat_mode == false ) { @@ -1890,7 +1897,7 @@ static bool shrink_frm( //ps->signalScaleForCorrelation += 2; scaleSignal16( frm_in_fx, ps->frmInScaled, l_frm, ps->signalScaleForCorrelation ); findSynchResult = find_synch_fx( ps, ps->frmInScaled, l_frm, s_start, (uint16_t) ( s_end - s_start ), 0, l_seg, 0, &energyQ8, &qualityQ16, &xtract ); - energy = fixedToFloat( energyQ8, 8 ); + //energy = fixedToFloat( energyQ8, 8 ); quality = fixedToFloat( qualityQ16, 16 ); //ps->signalScaleForCorrelation -= 2; #else @@ -2149,7 +2156,7 @@ static bool extend_frm( uint16_t over[MAXN + 2]; int16_t l_rem; int16_t s_start = 0; - float energy, quality = 0.0f; + float quality = 0.0f; uint16_t l_frm, l_seg; const float *fadeOut, *fadeIn; float *out; @@ -2265,7 +2272,7 @@ static bool extend_frm( #endif { /* maximum scaling */ - energy = -65; + //energy = -65; quality = 5; xtract[n] = s_start + ps->num_channels; if ( ps->evs_compat_mode == false ) @@ -2289,7 +2296,7 @@ static bool extend_frm( assert( sizeof( ps->frmInScaled ) / sizeof( ps->frmInScaled[0] ) >= 2 * (size_t) l_frm ); scaleSignal16( frm_in_fx, frmInScaled, shl(l_frm, 1), ps->signalScaleForCorrelation ); findSynchResult = find_synch_fx( ps, frmInScaled, 2 * l_frm, s_start, s_end - s_start, sync_start, l_seg, l_frm, &energyQ8, &qualityQ16, &xtract[n] ); - energy = fixedToFloat( energyQ8, 8 ); + //energy = fixedToFloat( energyQ8, 8 ); quality = fixedToFloat( qualityQ16, 16 ); if(max_flag) { diff --git a/lib_dec/lsf_dec.c b/lib_dec/lsf_dec.c index 01ab068f9..e3f13d650 100644 --- a/lib_dec/lsf_dec.c +++ b/lib_dec/lsf_dec.c @@ -50,9 +50,13 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void lsf_mid_dec( Decoder_State *st, const float lsp_new[], const int16_t coder_type, float lsp_mid[] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void dqlsf_CNG( Decoder_State *st, float *lsf_q ); +#endif /*---------------------------------------------------------------------* diff --git a/lib_dec/post_dec.c b/lib_dec/post_dec.c index 4d9270dfb..14c93a311 100644 --- a/lib_dec/post_dec.c +++ b/lib_dec/post_dec.c @@ -45,7 +45,9 @@ * Function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void bass_pf_1sf_delay( float *syn, const int16_t *T_sf, const float *gainT_sf, const int16_t l_frame, const int16_t l_subfr, float *bpf_noise_buf, int16_t *gain_factor_param, const int16_t disable_bpf, float *mem_deemph_err, float *lp_ener ); +#endif /*---------------------------------------------------------------------* @@ -189,6 +191,7 @@ void post_decoder_flt( * Perform low-frequency postfiltering *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void bass_pf_1sf_delay( float *syn, /* i : synthesis to postfilter */ const int16_t *T_sf, /* i : Pitch period for all subframes (T_sf[4]) */ @@ -340,6 +343,7 @@ static void bass_pf_1sf_delay( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * cldfb_synth_set_bandsToZero_flt() diff --git a/lib_dec/swb_bwe_dec.c b/lib_dec/swb_bwe_dec.c index 84569e12c..7d4427f70 100644 --- a/lib_dec/swb_bwe_dec.c +++ b/lib_dec/swb_bwe_dec.c @@ -515,6 +515,7 @@ Word16 para_pred_bws_fx( * Decoding of WB parameters *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static int16_t WB_BWE_gain_deq( Decoder_State *st, /* i/o: decoder state structure */ float *WB_fenv ) @@ -530,6 +531,7 @@ static int16_t WB_BWE_gain_deq( return ( mode ); } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/swb_bwe_dec_fx.c b/lib_dec/swb_bwe_dec_fx.c index f79f1b7fe..a4e8bc3f9 100644 --- a/lib_dec/swb_bwe_dec_fx.c +++ b/lib_dec/swb_bwe_dec_fx.c @@ -9,6 +9,7 @@ #include "prot_fx2.h" #include "rom_com.h" #include "rom_enc.h" +#include "ivas_prot_fx.h" #define MAX_Q_NEW_INPUT 8 #define Q_WTDA_FX 13 diff --git a/lib_dec/swb_bwe_dec_lr.c b/lib_dec/swb_bwe_dec_lr.c index 320308981..fe580269a 100644 --- a/lib_dec/swb_bwe_dec_lr.c +++ b/lib_dec/swb_bwe_dec_lr.c @@ -50,6 +50,7 @@ * Decoding of generic subband coding parameters *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void DecodeSWBGenericParameters( Decoder_State *st, /* i/o: decoder state structure */ int16_t *lagIndices, /* o : lowband index for each subband */ @@ -83,6 +84,7 @@ static void DecodeSWBGenericParameters( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index c9516a549..671e069fe 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -53,11 +53,17 @@ * Local function prototypes *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dequantizeSHBparams( Decoder_State *st, const int16_t extl, int32_t extl_brate, float *Q_lsf, float *Q_subgain, float *Q_framegrain, int16_t *uv_flag, float *Q_shb_ener_sf, float *Q_shb_res_gshape, float *Q_mixFactors, int16_t *MSFlag ); static void Dequant_lower_LSF( const int16_t lsf_idx[], float lsf_q[] ); static void Map_higher_LSF( float lsf_q[], const float m, const float grid_in[] ); static void Dequant_mirror_point( const float lsf_q[], const int16_t m_idx, float *m ); +#endif +void find_max_mem_dec_m3( + Decoder_State *st, + Word16 *n_mem3 +); /*-------------------------------------------------------------------* * ResetSHBbuffer_Dec() @@ -452,7 +458,7 @@ void wb_tbe_dec( return; } #endif -void calc_tilt_bwe_fx_loc( +static void calc_tilt_bwe_fx_loc( const Word32 *sp_fx, /* i : input signal */ Word32 *tilt_fx, /* o : signal tilt */ Word16 *tilt_fx_q, /* o : signal tilt */ @@ -520,7 +526,7 @@ void calc_tilt_bwe_fx_loc( * * SWB TBE decoder, 6 - 14 kHz (or 7.5 - 15.5 kHz) band decoding module *-------------------------------------------------------------------*/ -void rescale_genSHB_mem_dec( +static void rescale_genSHB_mem_dec( Decoder_State *st_fx, Word16 sf ) { @@ -753,7 +759,7 @@ static void gradientGainShape( *GainFrame_fx = Mult_32_16(hBWE_TD->GainFrame_prevfrm_fx, hBWE_TD->GainAttn_fx); /* Q18 */ } -void find_max_mem_dec( +static void find_max_mem_dec( Decoder_State *st_fx, Word16 *n_mem, Word16 *n_mem2 @@ -3733,6 +3739,7 @@ void swb_tbe_dec( * Dequantized the lower LSFs *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void Dequant_lower_LSF( const int16_t lsf_idx[], /* i : LSF indices */ float lsf_q[] /* o : Quantized LSFs */ @@ -3748,6 +3755,7 @@ static void Dequant_lower_LSF( return; } +#endif /*-------------------------------------------------------------------* * Map_higher_LSF() @@ -3755,6 +3763,7 @@ static void Dequant_lower_LSF( * Map the higher LSFs from the lower LSFs *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void Map_higher_LSF( float lsf_q[], /* i/o: Quantized lower LSFs */ const float m, /* i : Mirroring point */ @@ -3804,6 +3813,7 @@ static void Map_higher_LSF( return; } +#endif /*-------------------------------------------------------------------* * Map_higher_LSF() @@ -3811,6 +3821,7 @@ static void Map_higher_LSF( * Map the higher LSFs from the lower LSFs *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void Dequant_mirror_point( const float lsf_q[], /* i/o: Quantized lower LSFs */ const int16_t m_idx, /* i : Mirror point index */ @@ -3821,6 +3832,7 @@ static void Dequant_mirror_point( return; } +#endif /*-------------------------------------------------------------------* * dequantizeSHBparams() @@ -3828,6 +3840,7 @@ static void Dequant_mirror_point( * Dequantize super highband spectral envolope, temporal gains and frame gain *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dequantizeSHBparams( Decoder_State *st, /* i/o: decoder state structure */ const int16_t extl, /* i : extension layer */ @@ -4153,6 +4166,7 @@ static void dequantizeSHBparams( return; } +#endif #ifndef IVAS_FLOAT_FIXED diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 2334893c6..b62bcd3ba 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -32,6 +32,11 @@ static void rescale_genWB_mem( Decoder_State* st_fx, Word16 sf ); static void Dequant_lower_LSF_fx( const Word16 lsf_idx[], Word16 lsf_q[] ); static void Map_higher_LSF_fx( Word16 lsf_q[], const Word16 m, const Word16 grid_in[] ); static void Dequant_mirror_point_fx( const Word16 lsf_q[], const Word16 m_idx, Word16* m ); +Word16 dotp_loc( + const Word16 x[], /* i : vector x[] */ + const Word32 y[], /* i : vector y[] */ + const int16_t n /* i : vector length */ +); /* gain shape concealment code */ static void gradientGainShape(Decoder_State *st_fx, Word16 *GainShape, Word32 *GainFrame); @@ -41,7 +46,7 @@ static void gradientGainShape(Decoder_State *st_fx, Word16 *GainShape, Word32 *G * * Find norm and max in TBE memories and past buffers *-------------------------------------------------------------------*/ -void find_max_mem_dec( +static void find_max_mem_dec( Decoder_State *st_fx, Word16 *n_mem, Word16 *n_mem2 @@ -206,7 +211,7 @@ void find_max_mem_dec( * * Rescale genSHB memories *-------------------------------------------------------------------*/ -void rescale_genSHB_mem_dec( +static void rescale_genSHB_mem_dec( Decoder_State *st_fx, Word16 sf ) { diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index a3b0db6a0..74768cf0e 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -434,6 +434,7 @@ static void CalcPowerSpecAndDetectTonalComponents( } #endif +#ifndef IVAS_FLOAT_FIXED static void CalcMDXT( const TonalMDCTConcealPtr hTonalMDCTConc, const char type, @@ -458,6 +459,7 @@ static void CalcMDXT( return; } +#endif #ifndef IVAS_FLOAT_FIXED void TonalMDCTConceal_Detect_ivas( diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 3fc81c1b1..8ec2abe05 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -729,7 +729,7 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( Flag Overflow = 0; #endif - Word16 nBands; + //Word16 nBands; Word32 invScaleFactors_fx[FDNS_NPTS]; Word16 old_power_spectrum_q, power_spectrum_q; @@ -837,7 +837,7 @@ static void ivas_CalcPowerSpecAndDetectTonalComponents_fx( sns_shape_spectrum_fx( powerSpectrum, &power_spectrum_q, psychParamsCurrent, invScaleFactors_fx, 16, hTonalMDCTConc->nSamplesCore ); power_spectrum_q++; // sns_shape_spectrum(powerSpectrum, psychParamsCurrent, invScaleFactors, hTonalMDCTConc->nSamplesCore); - nBands = psychParamsCurrent->nBands; + //nBands = psychParamsCurrent->nBands; } IF( old_power_spectrum_q < power_spectrum_q ) Scale_sig32( powerSpectrum, hTonalMDCTConc->nSamplesCore, old_power_spectrum_q - power_spectrum_q ); @@ -1195,7 +1195,7 @@ void TonalMDCTConceal_Detect_ivas_fx( Word32 * powerSpectrum = secondLastMDST; Word16 i, powerSpectrum_exp, secondLastMDST_exp, s; Word16 nSamples; - Word16 nBands; + //Word16 nBands; Word32 sns_int_scf_fx[FDNS_NPTS]; nSamples = hTonalMDCTConc->nSamples; @@ -1277,7 +1277,7 @@ void TonalMDCTConceal_Detect_ivas_fx( sns_int_scf_fx[i] = L_shl(hTonalMDCTConc->secondLastBlockData.scaleFactors[i], 1 + hTonalMDCTConc->secondLastBlockData.scaleFactors_exp[i]); // Q16 } sns_shape_spectrum_fx(powerSpectrum, &power_spectrum_q, psychParamsCurrent, sns_int_scf_fx, 16, hTonalMDCTConc->nSamplesCore); - nBands = psychParamsCurrent->nBands; + //nBands = psychParamsCurrent->nBands; } powerSpectrum_exp = getScaleFactor32(powerSpectrum, nSamples); powerSpectrum_exp = sub(powerSpectrum_exp, 3); /*extra 3 bits of headroom for MA filter in getEnvelope*/ diff --git a/lib_dec/waveadjust_fec_dec.c b/lib_dec/waveadjust_fec_dec.c index c5b041d22..1a1acb860 100644 --- a/lib_dec/waveadjust_fec_dec.c +++ b/lib_dec/waveadjust_fec_dec.c @@ -46,6 +46,7 @@ * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void LpFilter2( const float *x, float *y, @@ -64,7 +65,9 @@ static void LpFilter2( return; } +#endif +#ifndef IVAS_FLOAT_FIXED static float harmo( const float *X, const int16_t n, @@ -93,8 +96,9 @@ static float harmo( return ener_harmo / ( ener + EPSILON ); } +#endif - +#ifndef IVAS_FLOAT_FIXED static int16_t Is_Periodic( const float cov_max, const int16_t zp, @@ -141,8 +145,10 @@ static int16_t Is_Periodic( return flag; } +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t zero_pass( const float *s, const int16_t N ) @@ -159,8 +165,10 @@ static int16_t zero_pass( return zp; } +#endif +#ifndef IVAS_FLOAT_FIXED static float sig_tilt( const float *s, const int16_t L_frameTCX ) @@ -178,8 +186,10 @@ static float sig_tilt( return tilt; } +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t pitch_search( float *s, /* lastPcmOut */ float *outx_new, @@ -398,8 +408,10 @@ static int16_t pitch_search( return pitch; } +#endif +#ifndef IVAS_FLOAT_FIXED static int16_t OverlapAdd( float *pitch125_data, float *sbuf, @@ -428,8 +440,9 @@ static int16_t OverlapAdd( return ( n + pitch ); } +#endif - +#ifndef IVAS_FLOAT_FIXED static void add_noise( float *sbuf, float *outx_new_n1, @@ -455,6 +468,8 @@ static void add_noise( return; } +#endif + #ifndef IVAS_FLOAT_FIXED static int16_t waveform_adj( T_PLCInfo_HANDLE hPlcInfo, diff --git a/lib_dec/waveadjust_fec_dec_fx.c b/lib_dec/waveadjust_fec_dec_fx.c index ec7abe07b..d88ced1ce 100644 --- a/lib_dec/waveadjust_fec_dec_fx.c +++ b/lib_dec/waveadjust_fec_dec_fx.c @@ -12,12 +12,13 @@ #include "stat_com.h" #include "rom_com.h" #include "stl.h" /* FOR wmc_tool */ +#include "vad_basop.h" void get_maxConv_and_pitch_x(Word16 *s_LP, Word16 s, Word16 e, Word16 N, Word32 *maxConv, Word16 *maxConv_bits, Word16 *pitch); Word16 get_voicing_x(Word16 *s_LP, Word16 pitch, Word32 covMax,Word16 maxConv_bits, Word16 Framesize); Word32 con_Log10(Word32 i_s32Val, Word16 i_s16Q); - +Word16 Spl_GetScalingSquare_x(const Word16 *in_vector, const Word16 in_vector_length, Word16 times); Word16 vadmin(Word16 a, Word16 b) { diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index be8ab41ae..285d62181 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -587,7 +587,7 @@ Word16 ACcontextMapping_encode2_estimate_no_mem_s17_LC_fx( /* check while condition */ /* MSBs coding */ - lookup = (Word8 *)(&ari_lookup_s17_LC[t] + (1 << (NBITS_CONTEXT+NBITS_RATEQ))); /* address calculation not counted */ + lookup = (const Word8 *)(&ari_lookup_s17_LC[t] + (1 << (NBITS_CONTEXT+NBITS_RATEQ))); /* address calculation not counted */ WHILE (GE_16(s_max(a1, b1), A_THRES)) { pki = lookup[lev1]; diff --git a/lib_enc/enc_acelp_fx.c b/lib_enc/enc_acelp_fx.c index 4ab5dc0a1..f00ef8255 100644 --- a/lib_enc/enc_acelp_fx.c +++ b/lib_enc/enc_acelp_fx.c @@ -23,6 +23,24 @@ static void E_ACELP_codearithp_fx(const Word16 v[], UWord32 *n, UWord32 *ps, Word16 *p); +void E_ACELP_h_vec_corr1(Word16 h[], Word16 vec[], UWord8 track, + Word16 sign[], Word16 (*rrixix)[16], + Word16 cor[], Word16 dn2_pos[], + Word16 nb_pulse); + +void E_ACELP_h_vec_corr2(Word16 h[], Word16 vec[], UWord8 track, + Word16 sign[], Word16 (*rrixix)[16], + Word16 cor[]); + +Word16 E_ACELP_xy1_corr(Word16 xn[], Word16 y1[], ACELP_CbkCorr *g_corr, Word16 norm_flag, Word16 L_subfr, Word16 exp_xn); + +void E_ACELP_codebook_target_update(Word16 *x, Word16 *x2, Word16 *y, + Word16 gain, Word16 L_subfr); + +void E_ACELP_vec_neg(Word16 h[], Word16 h_inv[], Word16 L_subfr); + +void E_ACELP_corrmatrix(Word16 h[], Word16 sign[], Word16 vec[], Word16 rrixix[4][16], Word16 rrixiy[4][256]); + /* * E_ACELP_h_vec_corrx * diff --git a/lib_enc/enc_gain_fx.c b/lib_enc/enc_gain_fx.c index 3cd54b006..fcfe02219 100644 --- a/lib_enc/enc_gain_fx.c +++ b/lib_enc/enc_gain_fx.c @@ -15,6 +15,9 @@ #include "prot_fx2.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ +void E_GAIN_norm_corr(Word16 exc[], Word16 xn[], Word16 h[], + Word16 t_min, Word16 t_max, Word16 corr_norm[], Word16 L_subfr); + /* * E_GAIN_norm_corr * diff --git a/lib_enc/guided_plc_enc_fx.c b/lib_enc/guided_plc_enc_fx.c index a21606c1a..a387d0387 100644 --- a/lib_enc/guided_plc_enc_fx.c +++ b/lib_enc/guided_plc_enc_fx.c @@ -19,7 +19,7 @@ * * *-------------------------------------------------------------------*/ -void coderLookAheadInnovation( +static void coderLookAheadInnovation( Word16 A_3Q12[], /* input: coefficients NxAz[M+1] */ Word16 *pT, /* out: pitch */ PLC_ENC_EVS_HANDLE st, /* i/o: coder memory state */ diff --git a/lib_enc/igf_scf_enc_fx.c b/lib_enc/igf_scf_enc_fx.c index 77b74fd7f..866bae043 100644 --- a/lib_enc/igf_scf_enc_fx.c +++ b/lib_enc/igf_scf_enc_fx.c @@ -108,7 +108,7 @@ static void arith_encode_residual( IGFSCFENC_INSTANCE_HANDLE hPrivateData, /* i/o: instance handle */ Word16 *ptr, /* i/o: pointer to expanded bit buffer, one bit in each Word16 */ Word16 x, /* i: residual value to encode */ - const Word16 *cumulativeFrequencyTable, /* i: cumulative frequency table to be used */ + const UWord16 *cumulativeFrequencyTable, /* i: cumulative frequency table to be used */ Word16 tableOffset /* i: offset used to align the table */ ) { @@ -128,7 +128,7 @@ static void arith_encode_residual( hPrivateData->ptrBitIndex, &hPrivateData->acState_fx, x, - (const UWord16*) cumulativeFrequencyTable + cumulativeFrequencyTable ); return; @@ -142,7 +142,7 @@ static void arith_encode_residual( hPrivateData->ptrBitIndex, &hPrivateData->acState_fx, 0, - (const UWord16*) cumulativeFrequencyTable + cumulativeFrequencyTable ); } ELSE /* x > IGF_MAX_ENC_SEPARATE */ @@ -153,7 +153,7 @@ static void arith_encode_residual( hPrivateData->ptrBitIndex, &hPrivateData->acState_fx, IGF_SYMBOLS_IN_TABLE - 1, - (const UWord16*) cumulativeFrequencyTable + cumulativeFrequencyTable ); } @@ -235,7 +235,7 @@ static void encode_sfe_vector( arith_encode_residual(hPrivateData, ptr, res, - (Word16 *)hPrivateData->cf_se01, + hPrivateData->cf_se01, hPrivateData->cf_off_se01); } ELSE @@ -252,7 +252,7 @@ static void encode_sfe_vector( arith_encode_residual(hPrivateData, ptr, res, - (Word16 *)(hPrivateData->cf_se02 + index1), + hPrivateData->cf_se02 + index1, hPrivateData->cf_off_se02[index2]); } } @@ -267,7 +267,7 @@ static void encode_sfe_vector( arith_encode_residual(hPrivateData, ptr, res, - (Word16 *)hPrivateData->cf_se10, + hPrivateData->cf_se10, hPrivateData->cf_off_se10); } ELSE @@ -291,7 +291,7 @@ static void encode_sfe_vector( arith_encode_residual(hPrivateData, ptr, res, - (Word16 *)(hPrivateData->cf_se11 + index1), + hPrivateData->cf_se11 + index1, hPrivateData->cf_off_se11[index2]); } } diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index d5f4fbf66..011d5df52 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -54,7 +54,7 @@ *--------------------------------------------------------------------*/ static void calculate_energy_buffer( CPE_ENC_HANDLE hCPE, float enerBuffer_dft[], const int16_t no_channels, const int32_t input_Fs ); -#ifdef IVAS_FLOAT_FIXED +#ifdef IVAS_FIXED_ENC static void calculate_energy_buffer_fx( CPE_ENC_HANDLE hCPE, Word64 enerBuffer_dft_fx[], Word16 *enerBuffer_dft_q_fx, const Word16 no_channels, const Word32 input_Fs ); #endif @@ -838,7 +838,7 @@ ivas_error pre_proc_front_ivas( } -#ifdef IVAS_FLOAT_FIXED +#ifdef IVAS_FIXED_ENC /*-------------------------------------------------------------------* * calculate_energy_buffer_fx() * diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index fafd5cb69..0fc02c8b1 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -41,6 +41,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" +#include "prot_fx_enc.h" #endif diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 3227e1017..c07e5baad 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -53,11 +53,11 @@ *--------------------------------------------------------------------*/ static ivas_error ivas_spar_enc_process( Encoder_Struct *st_ivas, const ENCODER_CONFIG_HANDLE hEncoderConfig, BSTR_ENC_HANDLE hMetaData, const int16_t front_vad_flag, float *data_f[] ); -#ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static Word16 Q_factor_L_abs( float x ); #endif -#ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED Word16 Q_factor_L_abs( float x ) { Word16 Q = 31; diff --git a/lib_enc/tcx_ltp_enc_fx.c b/lib_enc/tcx_ltp_enc_fx.c index c8dd7b90c..3d4cb58f3 100644 --- a/lib_enc/tcx_ltp_enc_fx.c +++ b/lib_enc/tcx_ltp_enc_fx.c @@ -69,7 +69,7 @@ static Word32 interpolate_corr( /* o : interpolated value */ return s; } -void tcx_ltp_pitch_search( +static void tcx_ltp_pitch_search( Word16 pitch_ol, Word16 *pitch_int, Word16 *pitch_fr, diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index d9187de41..49e059ab2 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -149,7 +149,7 @@ void ComputeSpectrumNoiseMeasure_fx(const Word32 *powerSpec, } -void detectLowpassFac(const Word32 *powerSpec, Word16 powerSpec_e, Word16 L_frame, Word8 rectWin, Word16 *pLpFac, Word16 lowpassLine) +static void detectLowpassFac(const Word32 *powerSpec, Word16 powerSpec_e, Word16 L_frame, Word8 rectWin, Word16 *pLpFac, Word16 lowpassLine) { Word16 i, tmp; Word32 threshold; diff --git a/lib_enc/vad_proc_fx.c b/lib_enc/vad_proc_fx.c index d01df0897..d487e924d 100644 --- a/lib_enc/vad_proc_fx.c +++ b/lib_enc/vad_proc_fx.c @@ -190,7 +190,7 @@ Word16 vad_init_ivas_fx( hVAD_CLDFB->frameloop = 0; hVAD_CLDFB->lt_snr_org_fx = 33554432; /*Q26 */ hVAD_CLDFB->lf_snr_smooth_fx = 167772155/* 5.0 Q25 */; - hVAD_CLDFB->l_silence_snr_fx = 32768/* 0.5 Q16 */; + hVAD_CLDFB->l_silence_snr_fx = 32767/* 0.5 Q16 */; hVAD_CLDFB->l_speech_snr_fx = 327675/* 5.0 Q16 */; hVAD_CLDFB->l_silence_snr_count = 1; hVAD_CLDFB->l_speech_snr_count = 1; @@ -280,7 +280,7 @@ Word16 vad_init_ivas_fx( return 0; } -void UpdateState( +static void UpdateState( VAD_CLDFB_HANDLE_FX hVAD_CLDFB, /* i/o: CLDFB VAD state */ Word16 vad_flag, /* i : VAD flag */ Word32 frame_energy, /* i : current frame energy */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 5d23db160..e2596eacb 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -3785,8 +3785,8 @@ ivas_error ivas_rend_crendProcessSubframe( /* Rotation in SD for MC -> BINAURAL_ROOM */ ELSE IF ( ( hIntSetup != NULL ) && hIntSetup->is_loudspeaker_setup ) { - Word16 nchan; - nchan = hIntSetup->nchan_out_woLFE + hIntSetup->num_lfe; + //Word16 nchan; + //nchan = hIntSetup->nchan_out_woLFE + hIntSetup->num_lfe; rotateFrame_sd( hCombinedOrientationData, tc_local_fx, subframe_len, *hIntSetup, hEFAPdata, 0 ); diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index a7f86d310..45f561abc 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -476,7 +476,7 @@ static void ivas_dirac_param_est_ana_fx( Word16 q_factor_intensity, q_factor_intensity_old = 0; Word16 q_factor_energy = 0, q_factor_energy_old = 0; Word16 exp = 0, exp_div = 0; - Word16 exp2; + //Word16 exp2; num_freq_bands = hDirAC->nbands; Word16 tmp_e; Word16 tmp = BASOP_Util_Divide3216_Scale( input_frame, CLDFB_NO_COL_MAX, &tmp_e ); @@ -557,7 +557,7 @@ static void ivas_dirac_param_est_ana_fx( /* Power estimation for diffuseness */ computeReferencePower_ana_fx( hDirAC->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, reference_power_fx[ts], num_freq_bands ); //( 2 * ( scale_fact - Q1 ) - 31 - 1 ); // computeReferencePower_ana( hDirAC->band_grouping, Foa_RealBuffer, Foa_ImagBuffer, reference_power[ts], num_freq_bands ); - exp2 = sub( shl( scale_fact, 1 ), 31 ); + //exp2 = sub( shl( scale_fact, 1 ), 31 ); /* Fill buffers of length "averaging_length" time slots for intensity and energy */ hDirAC->index_buffer_intensity = add( ( hDirAC->index_buffer_intensity % DIRAC_NO_COL_AVG_DIFF ), 1 ); /* averaging_length = 32 */ index = hDirAC->index_buffer_intensity; diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 4985fe097..9dc46a56e 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -119,7 +119,9 @@ typedef struct parambin_rend_config_data static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, float *output_f[], const int16_t nchan_transport, const int16_t subframe ); +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_dirac_dec_decorrelate_slot_fx( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const Word16 num_freq_bands, const Word16 slot, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word16 q_inp, Word32 decRe[][CLDFB_NO_CHANNELS_MAX], Word32 decIm[][CLDFB_NO_CHANNELS_MAX] ); @@ -140,12 +142,17 @@ static void adaptTransportSignalsHeadtracked_fx( COMBINED_ORIENTATION_HANDLE hHe static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( COMBINED_ORIENTATION_HANDLE hHeadTrackData, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 nBins, const Word16 nSlots, Word32 Rmat[3][3] ); #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_binaural_process_output( DIRAC_DEC_BIN_HANDLE hDiracDecBin, SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, HANDLE_CLDFB_FILTER_BANK cldfbSynDec[MAX_OUTPUT_CHANNELS], float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t processReverb, const int16_t subframe ); +#endif - +#ifndef IVAS_FLOAT_FIXED static void adaptTransportSignalsHeadtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); +#endif +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); +#endif static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); @@ -1651,6 +1658,8 @@ static void ivas_dirac_dec_binaural_internal( } #endif + +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_BIN_HANDLE hDiracDecBin, const int16_t num_freq_bands, @@ -1704,6 +1713,7 @@ static void ivas_dirac_dec_decorrelate_slot( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_dirac_dec_decorrelate_slot_fx( @@ -3914,6 +3924,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( #endif +#ifndef IVAS_FLOAT_FIXED static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( COMBINED_ORIENTATION_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -4015,6 +4026,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( return; } +#endif static void eig2x2( @@ -5139,7 +5151,7 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( Word32 Enes_fx[2]; Word16 normEnes_fx[2]; Word16 remainderNormEne_fx; - Word16 normEnes_q_fx[2], temp_q = 0, subframeEne_q_fx, ismRatioAcc_q_fx; + Word16 normEnes_q_fx[2], temp_q = 0; Word16 eneMove_q_fx[2], enePreserve_q_fx[2], temp1; Word32 temp; @@ -5171,7 +5183,6 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( } subframeEne_fx = L_add( Enes_fx[0], Enes_fx[1] ); - subframeEne_q_fx = sub( add( *cldfb_buf_q, *cldfb_buf_q ), 31 ); // Q = -19 IF( NE_32( subframeEne_fx, 0 ) ) { @@ -5210,7 +5221,6 @@ void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( ratio = extract_l( hMasaIsmData->energy_ratio_ism_fx[ismDirIndex][dirac_read_idx][bin] ); // Q14 ismRatioAcc_fx = add( ismRatioAcc_fx, ratio ); - ismRatioAcc_q_fx = Q14; move16(); /* Get input and output panning gains */ @@ -6013,7 +6023,7 @@ static void ivas_masa_ext_rend_parambin_internal( hDiracDecBin->q_earlyPartEneCorrection = q_earlyPartEneCorrection; floatToFixed_arr32( hDiracDecBin->earlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection_fx, q_earlyPartEneCorrection, hSpatParamRendCom->num_freq_bands ); floatToFixed_arr32( hDiracDecBin->diffuseFieldCoherence, hDiracDecBin->diffuseFieldCoherence_fx, Q31, hSpatParamRendCom->num_freq_bands ); - FOR( j = 0; j < nBins; j++ ) + FOR( j = 0; j < hSpatParamRendCom->num_freq_bands; j++ ) { f2me( hDiracDecBin->ChCrossRePrev[j], &hDiracDecBin->ChCrossRePrev_fx[j], &hDiracDecBin->ChCrossRePrev_e[j] ); f2me( hDiracDecBin->ChCrossImPrev[j], &hDiracDecBin->ChCrossImPrev_fx[j], &hDiracDecBin->ChCrossImPrev_e[j] ); diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 1e2fc6930..607bbce5e 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -63,7 +63,9 @@ * Local function prototypes *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void get_lattice_coeffs( const int16_t band_index, const int16_t channel_index, float *lattice_coeffs ); +#endif static void lattice2allpass( const int16_t filter_length, const float *lattice_coeffs, float *filter_coeffs_num_real, float *filter_coeffs_den_real ); #ifdef IVAS_FLOAT_FIXED static void get_lattice_coeffs_fx( const Word16 band_index, const Word16 channel_index, Word16 *lattice_coeffs ); @@ -1680,6 +1682,7 @@ void ivas_dirac_dec_decorr_close( *------------------------------------------------------------------------*/ /* get lattice coeffs with phase offset */ +#ifndef IVAS_FLOAT_FIXED static void get_lattice_coeffs( const int16_t band_index, const int16_t channel_index, @@ -1695,6 +1698,7 @@ static void get_lattice_coeffs( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void get_lattice_coeffs_fx( diff --git a/lib_rend/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c index b9f8ddee9..50aaf39f5 100644 --- a/lib_rend/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -144,33 +144,6 @@ Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ } return result; } - -Word32 pow32_fx(Word16 inp, Word16 indx) -{ - Word32 temp_1, temp_2; - IF(EQ_16(indx, 1)) - { - return L_deposit_h(inp); - } - ELSE IF(EQ_16(indx, 0)) - { - return ONE_IN_Q31; - } - ELSE - { - temp_1 = L_mult(inp, inp); // Q31 - temp_2 = temp_1; - FOR(int i = 0; i < (shr(indx, 1)); i++) - { - temp_1 = Mpy_32_32(temp_1, temp_1); // Q31 - } - IF(s_and(indx, 1)) - { - temp_1 = Mpy_32_32(temp_2, temp_1); // Q31 - } - } - return temp_1; -} #endif ivas_error ivas_dirac_dec_onset_detection_open( @@ -335,7 +308,7 @@ void ivas_dirac_dec_onset_detection_process_fx( Word16 tmp_fx; Word32 tmp32_fx; Word32 *p_onset_detector_1_fx, *p_onset_detector_2_fx; - Word16 q_result,e_scale; + Word16 e_scale; p_onset_detector_1_fx = h_dirac_onset_detection_state.onset_detector_1_fx;//Q0 p_onset_detector_2_fx = h_dirac_onset_detection_state.onset_detector_2_fx;//Q0 @@ -371,7 +344,6 @@ void ivas_dirac_dec_onset_detection_process_fx( /*onset filter limited between 0 and 1*/ tmp_fx = BASOP_Util_Divide3232_Scale(*p_onset_detector_2_fx, *p_onset_detector_1_fx, &e_scale); tmp32_fx = L_mult0(tmp_fx, DIRAC_ONSET_GAIN_FX); - q_result = 12 + 15 - e_scale; IF(LT_32(tmp32_fx, 0)) { tmp32_fx = 0; diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index e8260a818..d3759ade4 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -88,7 +88,9 @@ static void computeTargetPSDs_diffuse_subframe( const int16_t num_channels, cons static void computeTargetPSDs_diffuse_with_onsets( const int16_t num_channels, const int16_t num_freq_bands, const int16_t num_decorr_freq_bands, const int16_t *proto_frame_diff_index, const float *diffuse_power_factor, const float *reference_power, const float *diffuse_responses_square, const float *onset_filter, float *cy_auto_diff_smooth ); +#ifndef IVAS_FLOAT_FIXED static void computeAlphaSynthesis( float *alpha_synthesis, const int16_t averaging_length_ms, const float maxAlpha, int16_t *numAlphas, const int16_t slot_size, const int16_t num_freq_bands, const float *frequency_axis, const int32_t output_Fs ); +#endif #ifdef IVAS_FLOAT_FIXED static void computeAlphaSynthesis_fx( Word16 *alpha_synthesis_fx, const int16_t averaging_length_ms, const Word16 maxAlpha_fx, int16_t *numAlphas, const int16_t slot_size, const int16_t num_freq_bands, Word16 *frequency_axis_fx, const int32_t output_Fs ); @@ -1294,15 +1296,12 @@ void ivas_dirac_dec_output_synthesis_process_slot( int16_t diff_start_band; DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; -#ifdef IVAS_FLOAT_FIXED - Word32 *reference_power_fx = NULL, *onset_fx = NULL; - Word16 q_reference_power, q_onset; -#endif h_dirac_output_synthesis_params = &( hDirACRend->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); h_dirac_output_synthesis_state->onset_filter = onset; + /*-----------------------------------------------------------------* * processing *-----------------------------------------------------------------*/ @@ -1365,152 +1364,124 @@ void ivas_dirac_dec_output_synthesis_process_slot( h_dirac_output_synthesis_state->diffuse_power_factor ); } } - else if ( dec_param_estim == TRUE ) - { - /* compute direct responses */ - ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, - hDirACRend, - hVBAPdata, - NULL, - NULL, - azimuth, - elevation, - md_idx, - NULL, - sh_rot_max_order, - p_Rmat, - hodirac_flag ); - - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) + else // ( dec_param_estim == TRUE ) + if ( dec_param_estim == TRUE ) { - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); - v_multc( h_dirac_output_synthesis_state->direct_power_factor, - 0.25f, - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - 0.25f, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); + /* compute direct responses */ + ivas_dirac_dec_compute_directional_responses( hSpatParamRendCom, + hDirACRend, + hVBAPdata, + NULL, + NULL, + azimuth, + elevation, + md_idx, + NULL, + sh_rot_max_order, + p_Rmat, + hodirac_flag ); - /*Direct gain*/ - for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) + if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - int16_t k; - if ( ch_idx != 0 ) - { - float a, b, c; + ivas_dirac_dec_compute_gain_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); - /*Directonal sound gain nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) + + v_multc( h_dirac_output_synthesis_state->direct_power_factor, + 0.25f, + h_dirac_output_synthesis_state->direct_power_factor, + num_freq_bands ); + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + 0.25f, + h_dirac_output_synthesis_state->diffuse_power_factor, + num_freq_bands ); + + /*Direct gain*/ + for ( ch_idx = 0; ch_idx < min( 4, nchan_transport ); ch_idx++ ) + { + int16_t k; + if ( ch_idx != 0 ) { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + float a, b, c; + + /*Directonal sound gain nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; + b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); + c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + } } - for ( ; k < num_freq_bands; k++ ) + else { - a = h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands + k]; - b = reference_power[k + num_freq_bands] / ( reference_power[k + ( ch_idx + 1 ) * num_freq_bands] + EPSILON ); - c = 1.f + ( 1.f / 6.f ) * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ); /*Diffuseness modellling nrg compensation*/ - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( diffuseness[k] * c + ( ( 1.f - diffuseness[k] ) * a * a * b ) ); + /*Diffuseness modellling nrg compensation*/ + for ( k = 0; k < num_freq_bands_diff; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); + } + for ( ; k < num_freq_bands; k++ ) + { + h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); + } } } - else + + /*Directional gain (panning)*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) { - /*Diffuseness modellling nrg compensation*/ - for ( k = 0; k < num_freq_bands_diff; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor_decorr - 1.f ) ); - } - for ( ; k < num_freq_bands; k++ ) - { - h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands + k] += 0.25f * sqrtf( 1.0f + diffuseness[k] * 0.5f * ( h_dirac_output_synthesis_params->diffuse_compensation_factor - 1.f ) ); - } + v_mult( h_dirac_output_synthesis_state->direct_power_factor, + &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], + aux_buf, + num_freq_bands ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], + num_freq_bands ); } - } - /*Directional gain (panning)*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_dir; ch_idx++ ) - { - v_mult( h_dirac_output_synthesis_state->direct_power_factor, - &h_dirac_output_synthesis_state->direct_responses[ch_idx * num_freq_bands], - aux_buf, - num_freq_bands ); + /*Diffuse gain*/ + for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + { + v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, + hDirACRend->diffuse_response_function[ch_idx], + aux_buf, + num_freq_bands_diff ); + + v_add( aux_buf, + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], + num_freq_bands_diff ); + } - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - &h_dirac_output_synthesis_state->cy_cross_dir_smooth[ch_idx * num_freq_bands], - num_freq_bands ); + return; } - - /*Diffuse gain*/ - for ( ch_idx = min( 4, nchan_transport ); ch_idx < num_channels_diff; ch_idx++ ) + else { - v_multc( h_dirac_output_synthesis_state->diffuse_power_factor, - hDirACRend->diffuse_response_function[ch_idx], - aux_buf, - num_freq_bands_diff ); - - v_add( aux_buf, - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - &h_dirac_output_synthesis_state->cy_auto_diff_smooth[ch_idx * num_freq_bands_diff], - num_freq_bands_diff ); + /* compute reference and diffuse power factor for this frame */ + ivas_dirac_dec_compute_power_factors( num_freq_bands, + diffuseness, + h_dirac_output_synthesis_params->max_band_decorr, + h_dirac_output_synthesis_state->direct_power_factor, + h_dirac_output_synthesis_state->diffuse_power_factor ); } - - return; } - else - { - /* compute reference and diffuse power factor for this frame */ - ivas_dirac_dec_compute_power_factors( num_freq_bands, - diffuseness, - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); - } - } diff_start_band = 0; if ( h_dirac_output_synthesis_params->use_onset_filters ) { -#ifdef IVAS_FLOAT_FIXED - h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_q, h_dirac_output_synthesis_params->max_band_decorr ); - - reference_power_fx = hDirACRend->stack_mem.reference_power_fx; - q_reference_power = L_get_q_buf( (float *) reference_power, num_freq_bands ); - floatToFixed_arrL( (float *) reference_power, reference_power_fx, q_reference_power, num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->diffuse_responses_square_q, num_channels_dir ); - - onset_fx = hDirACRend->stack_mem.onset_filter_fx; - q_onset = Q30; - floatToFixed_arrL( (float *) onset, onset_fx, q_onset, ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) ? hDirACRend->num_outputs_diff * num_freq_bands : 2 * num_freq_bands ); -#endif - -#ifdef IVAS_FLOAT_FIXED - computeTargetPSDs_diffuse_with_onsets_fx( num_channels_dir, - num_freq_bands, h_dirac_output_synthesis_params->max_band_decorr, - hDirACRend->proto_index_diff, - h_dirac_output_synthesis_state->diffuse_power_factor_fx, - reference_power_fx, - &q_reference_power, - h_dirac_output_synthesis_state->diffuse_responses_square_fx, - onset_fx, - h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, - &h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); -#else computeTargetPSDs_diffuse_with_onsets( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_params->max_band_decorr, hDirACRend->proto_index_diff, @@ -1519,11 +1490,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( h_dirac_output_synthesis_state->diffuse_responses_square, onset, h_dirac_output_synthesis_state->cy_auto_diff_smooth ); -#endif - -#ifdef IVAS_FLOAT_FIXED - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); -#endif diff_start_band = h_dirac_output_synthesis_params->max_band_decorr; } @@ -1531,66 +1497,14 @@ void ivas_dirac_dec_output_synthesis_process_slot( /* process other PSDs only slot wise for 4 transport channels */ if ( dec_param_estim == TRUE ) { -#ifdef IVAS_FLOAT_FIXED - h_dirac_output_synthesis_state->direct_power_factor_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor_q, num_freq_bands ); - - reference_power_fx = hDirACRend->stack_mem.reference_power_fx; - q_reference_power = L_get_q_buf( (float *) reference_power, num_freq_bands ); - floatToFixed_arrL( (float *) reference_power, reference_power_fx, q_reference_power, num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_dir_smooth, num_channels_dir * num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_cross_dir_smooth, num_channels_dir * num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->direct_responses_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->direct_responses, h_dirac_output_synthesis_state->direct_responses_fx, h_dirac_output_synthesis_state->direct_responses_q, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->direct_responses_square_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->direct_responses_square, h_dirac_output_synthesis_state->direct_responses_square_fx, h_dirac_output_synthesis_state->direct_responses_square_q, num_channels_dir * num_freq_bands ); -#endif - -#ifdef IVAS_FLOAT_FIXED - computeTargetPSDs_direct_fx( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_state->direct_power_factor_fx, reference_power_fx, &q_reference_power, h_dirac_output_synthesis_state->direct_responses_fx, h_dirac_output_synthesis_state->direct_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, &h_dirac_output_synthesis_state->q_cy_cross_dir_smooth ); -#else computeTargetPSDs_direct( num_channels_dir, num_freq_bands, h_dirac_output_synthesis_state->direct_power_factor, reference_power, h_dirac_output_synthesis_state->direct_responses, h_dirac_output_synthesis_state->direct_responses_square, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth ); -#endif -#ifdef IVAS_FLOAT_FIXED - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * num_freq_bands ); - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * num_freq_bands ); -#endif - -#ifdef IVAS_FLOAT_FIXED - h_dirac_output_synthesis_state->diffuse_power_factor_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor_q, num_freq_bands ); - - reference_power_fx = hDirACRend->stack_mem.reference_power_fx; - q_reference_power = L_get_q_buf( (float *) reference_power, num_freq_bands ); - floatToFixed_arrL( (float *) reference_power, reference_power_fx, q_reference_power, num_freq_bands ); - - h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); - - h_dirac_output_synthesis_state->diffuse_responses_square_q = Q31; - floatToFixed_arrL( h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->diffuse_responses_square_q, num_channels_dir ); -#endif - -#ifdef IVAS_FLOAT_FIXED - computeTargetPSDs_diffuse_fx( num_channels_dir, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor_fx, reference_power_fx, &q_reference_power, h_dirac_output_synthesis_state->diffuse_responses_square_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, &h_dirac_output_synthesis_state->q_cy_auto_diff_smooth ); -#else computeTargetPSDs_diffuse( num_channels_dir, num_freq_bands, diff_start_band, h_dirac_output_synthesis_state->diffuse_power_factor, reference_power, h_dirac_output_synthesis_state->diffuse_responses_square, h_dirac_output_synthesis_state->cy_auto_diff_smooth ); -#endif - -#ifdef IVAS_FLOAT_FIXED - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * num_freq_bands ); -#endif } return; } + #ifdef IVAS_FLOAT_FIXED void ivas_dirac_dec_output_synthesis_process_slot_fx( const Word32 *reference_power, /* i : Estimated power */ @@ -3497,7 +3411,8 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( { FOR( l = 0; l < num_freq_bands; l++ ) { - *( p_power_smooth++ ) = L_shr( *p_power_smooth, sub( min_exp, exp_arr[add( i_mult( k, num_freq_bands ), l )] ) ); + *p_power_smooth = L_shr( *p_power_smooth, sub( min_exp, exp_arr[add( i_mult( k, num_freq_bands ), l )] ) ); + p_power_smooth++; move32(); IF( EQ_32( *( p_power_smooth_prev ), EPSILON_FX ) ) { @@ -6104,7 +6019,8 @@ static void computeTargetPSDs_direct_fx( return; } -#else +#endif + static void computeTargetPSDs_direct( const int16_t num_channels, const int16_t num_freq_bands, @@ -6138,7 +6054,6 @@ static void computeTargetPSDs_direct( return; } -#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_direct_subframe_fx( @@ -6252,7 +6167,8 @@ static void computeTargetPSDs_diffuse_fx( return; } -#else +#endif + static void computeTargetPSDs_diffuse( const int16_t num_channels, const int16_t num_freq_bands, @@ -6281,7 +6197,6 @@ static void computeTargetPSDs_diffuse( return; } -#endif #ifdef IVAS_FLOAT_FIXED static void computeTargetPSDs_diffuse_subframe_fx( @@ -6392,7 +6307,7 @@ static void computeTargetPSDs_diffuse_with_onsets_fx( return; } -#else +#endif static void computeTargetPSDs_diffuse_with_onsets( @@ -6434,7 +6349,7 @@ static void computeTargetPSDs_diffuse_with_onsets( return; } -#endif + #ifdef IVAS_FLOAT_FIXED static void computeAlphaSynthesis_fx(Word16 *alpha_synthesis_fx, const Word16 averaging_length_ms, const Word16 maxAlpha_fx, Word16 *numAlphas, const Word16 slot_size, const Word16 num_freq_bands, Word16 *frequency_axis_fx, const Word32 output_Fs) { diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 036b71754..bd0300711 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -2291,7 +2291,7 @@ void initDiffuseResponses_fx( ELSE IF( ivas_format == MC_FORMAT && ( transport_config == IVAS_AUDIO_CONFIG_5_1 || transport_config == IVAS_AUDIO_CONFIG_7_1 ) && output_config == IVAS_AUDIO_CONFIG_7_1_4 ) { num_horizontal_speakers = num_channels - NUM_ELEVATED_SPEAKERS; - var1, exp_var1 = 15; + exp_var1 = 15; var1 = ISqrt16( num_horizontal_speakers, &exp_var1 ); var1 = shr( var1, negate( exp_var1 ) ); // Q15 set16_fx( diffuse_response_function_fx, var1, num_horizontal_speakers ); @@ -2984,7 +2984,7 @@ void protoSignalComputation2_fx( Word32 min_sum_total_ratio_fx, min_sum_total_ratio_db_fx; Word32 sum_total_ratio_fx[MASA_SUM_FREQ_RANGE_BINS]; Word16 q_sum_total_ratio; - Word32 a_fx, b_fx, a2_fx, b2_fx; + Word32 a_fx, b_fx; Word16 interpolatorSpaced_fx, interpolatorDmx_fx; Word32 tempSpaced_fx, tempDmx_fx; Word16 q_shift, min_q_shift, exp, q_temp, temp_q_shift, q_temp2; @@ -3139,9 +3139,9 @@ void protoSignalComputation2_fx( a_fx = 21474836; /*0.01 in Q31*/ /* Temporal smoothing coefficient */ move32(); b_fx = L_sub( ONE_IN_Q31, a_fx ); /* Temporal smoothing coefficient */ - a2_fx = 214748365; /*0.1 in Q31*/ /* Temporal smoothing coefficient */ + //a2_fx = 214748365; /*0.1 in Q31*/ /* Temporal smoothing coefficient */ move32(); - b2_fx = L_sub( ONE_IN_Q31, a2_fx ); /* Temporal smoothing coefficient */ + //b2_fx = L_sub( ONE_IN_Q31, a2_fx ); /* Temporal smoothing coefficient */ IF( GT_16( stereo_type_detect->interpolator, 0 ) ) { diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index f6b0cbc53..1ecf2342b 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -472,7 +472,7 @@ void limiter_process_fx( Word16 apply_limiting, apply_strong_limiting; Word32 **output; Word16 num_channels, q_fact_gain, scale, result; - Word32 sampling_rate, release_constant, compare_value; + Word32 release_constant, compare_value; Word32 div32, gain, frame_gain, attack_constant; /* return early if given nonsensical values */ @@ -487,7 +487,7 @@ void limiter_process_fx( gain = hLimiter->gain_fx; output = hLimiter->channel_ptrs_fx; num_channels = hLimiter->num_channels; - sampling_rate = hLimiter->sampling_rate; + //sampling_rate = hLimiter->sampling_rate; attack_constant = hLimiter->attack_constant_fx; /*-----------------------------------------------------------------* * Find highest absolute peak sample value diff --git a/lib_rend/ivas_masa_merge.c b/lib_rend/ivas_masa_merge.c index cce11afee..cbb826842 100644 --- a/lib_rend/ivas_masa_merge.c +++ b/lib_rend/ivas_masa_merge.c @@ -290,8 +290,7 @@ void diffuse_meta_merge_1x1_fx( ) { Word8 sf, band; - Word16 i, max_e, in1_e[MASA_FREQUENCY_BANDS]; - + Word16 max_e, in1_e[MASA_FREQUENCY_BANDS],i; FOR ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { @@ -304,7 +303,6 @@ void diffuse_meta_merge_1x1_fx( tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta->directToTotalRatio[0][sf][band], (Word16) UINT8_MAX, &scale); energyTimesRatio_fx = Mpy_32_16_r( inEne_fx[sf][band], tmp); energyTimesRatio_e = inEne_e[sf] + scale; - /* target is original MASA diffuseness */ tmp = BASOP_Util_Divide1616_Scale((Word16)inMeta->directToTotalRatio[0][sf][band], (Word16)UINT8_MAX, &scale); total_diff_nrg_fx = Mpy_32_16_r(inEne_fx[sf][band], tmp); diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index 83b4b4fc0..a29800683 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -95,9 +95,14 @@ void ivas_mcmasa_param_est_ana( MCMASA_ANA_HANDLE hMcMasa, float data_f[][L_FRAM static void ivas_mcmasa_dmx( MCMASA_ANA_HANDLE hMcMasa, float data_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_inp ); #endif +#ifndef IVAS_FLOAT_FIXED static void compute_cov_mtx( float sr[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], float si[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], const int16_t freq, const int16_t N, CovarianceMatrix *COVls ); +#endif +#ifndef IVAS_FLOAT_FIXED static void computeVerticalDiffuseness( float **buffer_intensity, const float *buffer_energy, const int16_t num_freq_bands, float *diffuseness ); +#endif + #ifdef IVAS_FLOAT_FIXED static void computeVerticalDiffuseness_fx( Word32 **buffer_intensity, /* i : Intensity vectors */ @@ -128,7 +133,9 @@ static void ivas_mcmasa_dmx_fx( #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, const int16_t numChannels ); +#endif /*--------------------------------------------------------------------------* @@ -2039,6 +2046,7 @@ static void compute_cov_mtx_fx( } #endif /* Compute covariance matrix, i.e., xT * conj(x), and accumulate to the output */ +#ifndef IVAS_FLOAT_FIXED static void compute_cov_mtx( float sr[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Input matrix, real, s[ch][freq] */ float si[MCMASA_MAX_ANA_CHANS][CLDFB_NO_CHANNELS_MAX], /* i : Input matrix, imag, s[ch][freq] */ @@ -2065,6 +2073,7 @@ static void compute_cov_mtx( return; } +#endif /*------------------------------------------------------------------------- * computeVerticalDiffuseness() @@ -2146,6 +2155,7 @@ static void computeVerticalDiffuseness_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void computeVerticalDiffuseness( float **buffer_intensity, /* i : Intensity vectors */ const float *buffer_energy, /* i : Energy */ @@ -2197,6 +2207,7 @@ static void computeVerticalDiffuseness( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void computeEvenLayout_fx( @@ -2261,6 +2272,7 @@ static void computeEvenLayout_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED static void computeEvenLayout( const float *ls_azimuth, float *ls_azimuth_even, @@ -2320,6 +2332,7 @@ static void computeEvenLayout( return; } +#endif /*------------------------------------------------------------------------- * ivas_create_masa_out_meta() diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index a8bf2de31..ba2b6e575 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -53,7 +53,9 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd ); +#endif #ifdef IVAS_FLOAT_FIXED static void TDREND_Clear_Update_flags_fx( @@ -214,7 +216,7 @@ ivas_error ivas_td_binaural_open_unwrap_fx( DirAtten_p->ConeOuterGain_fx = ONE_IN_Q30; move32(); - TDREND_SRC_SPATIAL_t *SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; + //TDREND_SRC_SPATIAL_t *SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; IF( ( error = TDREND_MIX_SRC_SetPos_fx( pBinRendTd, nS, Pos_fx ) ) != IVAS_ERR_OK ) { return error; @@ -227,7 +229,7 @@ ivas_error ivas_td_binaural_open_unwrap_fx( { return error; } - /*TDREND_SRC_SPATIAL_t **/ SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; + /*TDREND_SRC_SPATIAL_t **/ //SrcSpatial_p = pBinRendTd->Sources[nS]->SrcSpatial_p; IF( ( error = TDREND_MIX_SRC_SetDirAtten_fx( pBinRendTd, nS, DirAtten_p ) ) != IVAS_ERR_OK ) { return error; @@ -632,13 +634,13 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx( IF(hReverb != NULL) { - Word16 i, j, exp; + Word16 i, j; Word32 pcm_in_buff[MAX_OUTPUT_CHANNELS][L_FRAME48k]; Word32 pcm_out_buff[BINAURAL_CHANNELS][L_FRAME48k]; Word32 *pcm_in_fx[MAX_OUTPUT_CHANNELS]; Word32 *pcm_out_fx[BINAURAL_CHANNELS]; Word16 nchan_transport = audioCfg2channels(transport_config); - exp = Q7; + //exp = Q7; move16(); FOR(i = 0; i < MAX_OUTPUT_CHANNELS; i++) { @@ -1128,6 +1130,7 @@ static void TDREND_Clear_Update_flags_fx( #endif +#ifndef IVAS_FLOAT_FIXED static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd /* i/o: TD renderer handle */ ) @@ -1143,7 +1146,7 @@ static void TDREND_Clear_Update_flags( return; } - +#endif /*---------------------------------------------------------------------* * TDREND_Update_object_positions_fx() diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index c91f8f6cd..95a36a8db 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -38,6 +38,7 @@ #include "ivas_error.h" #include "wmc_auto.h" #include "ivas_rom_rend.h" +#include "ivas_prot_fx.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx2.h" @@ -61,10 +62,11 @@ /*------------------------------------------------------------------------- * Local functions *-------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static ivas_error DefaultBSplineModel( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, const Word32 output_Fs ); +#else static ivas_error DefaultBSplineModel_fx( TDREND_HRFILT_FiltSet_t *HrFiltSet_p, const Word32 output_Fs ); - +#endif /*-------------------------------------------------------------------* * TDREND_MIX_LIST_SetPos() diff --git a/lib_rend/ivas_objectRenderer_vec.c b/lib_rend/ivas_objectRenderer_vec.c index e389ed74b..79efc7156 100644 --- a/lib_rend/ivas_objectRenderer_vec.c +++ b/lib_rend/ivas_objectRenderer_vec.c @@ -38,6 +38,7 @@ #include "wmc_auto.h" #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" /*-------------------------------------------------------------------* diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index d04bcf475..8ddbae1c2 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -49,7 +49,9 @@ * Local function prototypes *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void ivas_omasa_param_est_ana( OMASA_ANA_HANDLE hOMasa, float data_f[][L_FRAME48k], float elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], float surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const int16_t input_frame, const int16_t nchan_ism ); +#endif #ifndef IVAS_FLOAT_FIXED static void ivas_omasa_dmx( float data_in_f[][L_FRAME48k], const int16_t input_frame, const int16_t nchan_transport, const int16_t nchan_ism, const float ism_azimuth[MAX_NUM_OBJECTS], const float ism_elevation[MAX_NUM_OBJECTS], float prev_gains[][MASA_MAX_TRANSPORT_CHANNELS], const float interpolator[L_FRAME48k] ); @@ -933,7 +935,6 @@ static void ivas_omasa_param_est_ana_fx( computeIntensityVector_ana_fx( hOMasa->band_grouping, Foa_RealBuffer_fx, Foa_ImagBuffer_fx, num_freq_bands, intensity_real_fx ); intensity_q = sub( shl( add(foa_q, Q1), 1 ), 31 ); - direction_q, reference_power_q; computeDirectionVectors_fx( intensity_real_fx[0], intensity_real_fx[1], intensity_real_fx[2], 0, num_freq_bands, direction_vector_fx[0], direction_vector_fx[1], direction_vector_fx[2], &direction_q ); diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 42e7d9509..44c665e1b 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -452,6 +452,7 @@ static void QuaternionConjugate_fx( * Computes an angle between two quaternions *------------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float QuaternionAngle( const IVAS_QUATERNION q1, const IVAS_QUATERNION q2 ) @@ -465,6 +466,7 @@ static float QuaternionAngle( return angle; } +#endif #ifdef IVAS_FLOAT_FIXED static Word32 QuaternionAngle_fx( @@ -1349,9 +1351,9 @@ ivas_error ivas_orient_trk_Process_fx( Word32 cutoffFrequency_fx, cutoff_prod; Word16 q_cutoff_prod = 0; Word32 alpha_fx = float_to_fix( alpha, Q30 ); - pOTR->refRot.q_fact = pOTR->refRot.q_fact = pOTR->refRot.q_fact = pOTR->refRot.q_fact = Q29; - absRot.q_fact = absRot.q_fact = absRot.q_fact = absRot.q_fact = Q29; - pOTR->absAvgRot.q_fact = pOTR->absAvgRot.q_fact = pOTR->absAvgRot.q_fact = pOTR->absAvgRot.q_fact = Q29; + pOTR->refRot.q_fact = Q29; + absRot.q_fact = Q29; + pOTR->absAvgRot.q_fact = Q29; updateRate_fx = float_to_fix( updateRate, Q23 ); // value is 200// absRot.w_fx = float_to_fix( absRot.w, absRot.q_fact); absRot.x_fx = float_to_fix( absRot.x, absRot.q_fact); diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index 2805751e3..1a33dabc7 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -722,7 +722,7 @@ ivas_error ivas_er_compute_reflections( ivas_error error = IVAS_ERR_OK; UWord16 circ_len, i, j; UWord32 tmp_fx, tmp_fx1; - UWord16 tmp_fx_hi, tmp_fx_lo; + UWord16 tmp_fx_lo; reflections->is_ready = 0; move16(); @@ -745,7 +745,6 @@ ivas_error ivas_er_compute_reflections( FOR( j = 0; j < reflections->shoebox_data.n_ref; j++ ) { tmp_fx = reflections->shoebox_data.times.data_fx[j + ( i * reflections->shoebox_data.n_ref )]; - tmp_fx_hi = extract_h( tmp_fx ); tmp_fx_lo = extract_l( tmp_fx ); Mpy_32_16_uu( tmp_fx, (UWord16) reflections->output_Fs_fx, &tmp_fx1, &tmp_fx_lo ); tmp_fx1 = (UWord32) L_add( tmp_fx1, 0x20 ); diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index ef477db36..b85a8cce1 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1360,7 +1360,7 @@ static ivas_error calc_jot_t60_coeffs_fx( Word32 L_tmp; Word16 f0_fx, tmp_fx, lf_target_gain_dB_fx, hf_target_gain_dB_fx, mid_crossing_gain_dB_fx; Word16 lin_gain_lf_fx, lin_gain_hf_fx, shift, expl, exph; - int16_t f_idx, minidx, e = pH_dB_exp; + int16_t f_idx, e = pH_dB_exp; uint16_t n_points_lf, n_points_hf; lf_target_gain_dB_fx = 0; @@ -1369,7 +1369,6 @@ static ivas_error calc_jot_t60_coeffs_fx( Word16 minval_e = 67, exp; Word32 L_tmpl = 0, L_tmph = 0; - minidx = nrFrequencies - 1; n_points_lf = 0; n_points_hf = 0; Word16 minidx_fx = nrFrequencies - 1; diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c index 57dc79860..817b5873b 100644 --- a/lib_rend/ivas_reverb_filter_design.c +++ b/lib_rend/ivas_reverb_filter_design.c @@ -65,6 +65,7 @@ * from the amplitude spectrum of the input. *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void calc_min_phase( rv_fftwf_type_complex *pSpectrum, const int16_t fft_size, @@ -190,6 +191,7 @@ static void calc_min_phase( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void calc_min_phase_fx( rv_fftwf_type_complex_fx *pSpectrum, @@ -367,6 +369,7 @@ static void calc_min_phase_fx( * This function expects only the positive frequency bins up to Nyquist/2 *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void calc_min_phase_filter( rv_fftwf_type_complex *pH_flt, const int16_t fft_size, @@ -397,6 +400,8 @@ static void calc_min_phase_filter( return; } +#endif + #ifdef IVAS_FLOAT_FIXED static void calc_min_phase_filter_fx( rv_fftwf_type_complex_fx *pH_flt, @@ -405,10 +410,11 @@ static void calc_min_phase_filter_fx( { const Word16 spectrum_size = add(shr(fft_size, 1), 1); Word16 idx; - Word16 phase_increment; + //Word16 phase_increment; Word32 pMin_phase[RV_FILTER_MAX_FFT_SIZE]; - phase_increment = 0; UNUSED_PARAM(delay); // delay is 0.0, -PI2 * delay / (float)fft_size; + //phase_increment = 0; + UNUSED_PARAM(delay); // delay is 0.0, -PI2 * delay / (float)fft_size; move16(); Word16 q_pMin_phase; calc_min_phase_fx(pH_flt, fft_size, pMin_phase, &q_pMin_phase); @@ -437,6 +443,7 @@ static void calc_min_phase_filter_fx( * Apply the smoothing (anti-aliasing) window in the time domain *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void apply_window_fft( rv_fftwf_type_complex *pH_flt, const float *pWindow, @@ -484,6 +491,7 @@ static void apply_window_fft( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void apply_window_fft_fx( rv_fftwf_type_complex_fx *pH_flt, @@ -563,6 +571,7 @@ static void apply_window_fft_fx( * Limit the gain vs frequency slope to T db per bin *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void response_step_limit( float *X, const int16_t dim_x, @@ -623,6 +632,7 @@ static void response_step_limit( return; } +#endif static void response_step_limit_fx( Word32 *X, @@ -717,6 +727,7 @@ static void response_step_limit_fx( * Compute a smoothing window used later to avoid aliasing in FFT filters *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_define_window_fft( float *pWindow, const int16_t transitionStart, @@ -755,6 +766,7 @@ void ivas_reverb_define_window_fft( return; } +#endif void ivas_reverb_define_window_fft_fx( Word32 *pWindow, //output in Q31 @@ -807,6 +819,7 @@ void ivas_reverb_define_window_fft_fx( *-------------------------------------------------------------------*/ /* Computes colorations filters for the target frequency responses */ +#ifndef IVAS_FLOAT_FIXED int16_t ivas_reverb_calc_color_filters( const float *pTargetL, const float *pTargetR, @@ -845,6 +858,7 @@ int16_t ivas_reverb_calc_color_filters( return 0; } +#endif #ifdef IVAS_FLOAT_FIXED Word16 ivas_reverb_calc_color_filters_fx( const Word32 *pTargetL, @@ -893,6 +907,7 @@ Word16 ivas_reverb_calc_color_filters_fx( * Compute correlation filters for the target frequency response *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED int16_t ivas_reverb_calc_correl_filters( const float *pTargetICC, const float *pWindow, @@ -930,6 +945,7 @@ int16_t ivas_reverb_calc_correl_filters( return 0; } +#endif #ifdef IVAS_FLOAT_FIXED Word16 ivas_reverb_calc_correl_filters_fx( Word32 *pTargetICC, //input in Q30 @@ -987,6 +1003,7 @@ Word16 ivas_reverb_calc_correl_filters_fx( * Compute the target levels (gains) for the coloration filters *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_calc_color_levels( const int32_t output_Fs, const int16_t freq_count, @@ -1086,6 +1103,7 @@ void ivas_reverb_calc_color_levels( return; } +#endif void ivas_reverb_calc_color_levels_fx( const Word32 output_Fs, @@ -1233,6 +1251,7 @@ void ivas_reverb_calc_color_levels_fx( * Note: the fc frequencies both for the input and the output must be in the ascending order *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_interpolate_acoustic_data( const int16_t input_table_size, const float *pInput_fc, @@ -1282,6 +1301,7 @@ void ivas_reverb_interpolate_acoustic_data( return; } +#endif void ivas_reverb_interpolate_acoustic_data_fx( const Word16 input_table_size, @@ -1352,6 +1372,7 @@ void ivas_reverb_interpolate_acoustic_data_fx( * and frequency-dependent IA coherence. Expects frequency-domain HRTF input *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_get_hrtf_set_properties( float **ppHrtf_set_L_re, float **ppHrtf_set_L_im, @@ -1520,6 +1541,7 @@ void ivas_reverb_get_hrtf_set_properties( return; } +#endif void ivas_reverb_get_hrtf_set_properties_fx( Word32 **ppHrtf_set_L_re, diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index 36ef7a539..7e6af2b58 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -515,11 +515,15 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( float *avg_pwr_right ) { int16_t freq_idx; +#ifndef IVAS_FLOAT_FIXED const int16_t cldfb_freq_halfstep = MAX_SAMPLING_RATE / ( 4 * CLDFB_NO_CHANNELS_MAX ); +#endif float avg_pwr_left_fft[FFT_SPECTRUM_SIZE]; float avg_pwr_right_fft[FFT_SPECTRUM_SIZE]; float input_fc[FFT_SPECTRUM_SIZE]; +#ifndef IVAS_FLOAT_FIXED float output_fc[CLDFB_NO_CHANNELS_MAX]; +#endif ivas_error error; for ( freq_idx = 0; freq_idx < FFT_SPECTRUM_SIZE; freq_idx++ ) @@ -527,10 +531,12 @@ static ivas_error ivas_reverb_get_fastconv_hrtf_set_energies( input_fc[freq_idx] = freq_idx * ( 0.5f * sampling_rate / (float) ( FFT_SPECTRUM_SIZE - 1 ) ); } +#ifndef IVAS_FLOAT_FIXED for ( freq_idx = 0; freq_idx < CLDFB_NO_CHANNELS_MAX; freq_idx++ ) { output_fc[freq_idx] = (float) ( ( 2 * freq_idx + 1 ) * cldfb_freq_halfstep ); } +#endif if ( ( error = ivas_reverb_get_cldfb_hrtf_set_properties( input_audio_config, hHrtfFastConv, use_brir, sampling_rate, avg_pwr_left_fft, avg_pwr_right_fft ) ) != IVAS_ERR_OK ) { diff --git a/lib_rend/ivas_rom_TdBinauralRenderer.c b/lib_rend/ivas_rom_TdBinauralRenderer.c index 91f79fb63..95d0e4514 100644 --- a/lib_rend/ivas_rom_TdBinauralRenderer.c +++ b/lib_rend/ivas_rom_TdBinauralRenderer.c @@ -19513,7 +19513,7 @@ const UWord32 defaultHRIR_rom_EL48_fx[HRTF_MODEL_N_SECTIONS * 470] /*Q28*/ = { 0x00003794,0x000038b9,0x00003d6e,0x0000442f,0x00004cb0,0x000056be,0x00006333,0x000063ac,0x00006094,0x00006dcf,0x000071ea,0x000086f7,0x0000a035,0x0000975b,0x00009e9a,0x0000a5e0,0x0000a79e,0x0000b23a,0x0000bfbc,0x0000abfe,0x0000991b,0x000097d5,0x00008cac,0x00006560,0x00005b16, 0x00004eb9,0x00004ef0,0x00004f16,0x00004fb6,0x0000510d,0x00005600,0x00004f04,0x00004bf4,0x00004a5b,0x0000497c,0x00004a37,0x000049e2,0x00004d5b,0x00004f63,0x00005179,0x00005522,0x00005687,0x00006262,0x00006816,0x00007ec4,0x0000abd6,0x0000706a,0x00008b60,0x0000ca1f,0x0000c5e3, 0x0000bba0,0x0000a655,0x0000b00c,0x0000aaff,0x0000a4e6,0x00007d8e,0x00006765,0x00009e3e,0x00007e4b,0x00007037 -};; +}; const UWord32 defaultHRIR_rom_ER48_fx[HRTF_MODEL_N_SECTIONS * 470] /*Q28*/ = { 0x047ee4d8,0x03f280b8,0x05386b98,0x0472fda0,0x0546eb40,0x076f6d78,0x04382528,0x0488aa00,0x06bd5348,0x0704d428,0x06d60568,0x05f157b8,0x06d09290,0x06f92248,0x06cc8e98,0x0466c600,0x03db67c4,0x07924390,0x048ebf48,0x03f41dd8,0x04657680,0x036a1ca0,0x03cfde2c,0x03e0ba68,0x03f52760, @@ -19573,7 +19573,7 @@ const UWord32 defaultHRIR_rom_ER48_fx[HRTF_MODEL_N_SECTIONS * 470] /*Q28*/ = { 0x0000a003,0x000086bc,0x00007153,0x00006d70,0x0000608f,0x0000634e,0x0000638a,0x000056ba,0x00004cad,0x00004436,0x00003d6e,0x000038b8,0x00003795,0x000039c6,0x0000432a,0x00004dc6,0x00005828,0x000065b6,0x00007d59,0x00006b47,0x000069b6,0x00006ec7,0x00007b81,0x00004eba,0x00005951, 0x0000654d,0x00007d87,0x00009920,0x000067b9,0x00007d2a,0x0000a4b4,0x0000aad5,0x0000b032,0x0000a656,0x0000bb83,0x0000c5fe,0x0000ca75,0x00008ba1,0x000070cc,0x0000ad9f,0x00007f4d,0x00006826,0x00006217,0x00005680,0x0000552a,0x00005176,0x00004f63,0x00004d5c,0x000049e2,0x00004a38, 0x0000497d,0x00004a60,0x00004bf4,0x00004f03,0x00005602,0x0000510f,0x00004fbb,0x00004f07,0x00004f16,0x00007035 -};; +}; const UWord32 defaultHRIR_rom_EL32_fx[HRTF_MODEL_N_SECTIONS * 470] /*Q28*/ = { 0x054a4eb8,0x04f4f0d8,0x05569b70,0x04b47630,0x052be930,0x0558ee78,0x05a21340,0x05c92f10,0x06092e60,0x05a367d8,0x056ef578,0x053967f0,0x050b7040,0x04e48198,0x04c1a078,0x04ab4c58,0x04922828,0x04796a68,0x045da820,0x040c93f8,0x048b76b0,0x046b48d0,0x04a92308,0x0663b628,0x04465358, diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 41dc6a502..e9f05808f 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -44,6 +44,7 @@ #include #include "prot_fx1.h" #include "prot_fx2.h" +#include "ivas_prot_fx.h" #include "debug.h" #include "ivas_rom_binaural_crend_head.h" #define float_to_fixed( n, factor ) ( round( n * ( 1 << factor ) ) ) @@ -99,7 +100,9 @@ static void external_target_interpolation( COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, const int16_t i ); +#ifndef IVAS_FLOAT_FIXED static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ); +#endif #ifdef IVAS_FLOAT_FIXED static bool are_orientations_same_fx( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ); @@ -802,10 +805,10 @@ void rotateAziEle( { dv_r[n] = Rmat[n][0] * dv[0] + Rmat[n][1] * dv[1] + Rmat[n][2] * dv[2]; } - float inter, inter1, inter2; - inter = atan2f( dv_r[1], dv_r[0] ); - inter1 = min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ); - inter2 = max( -180.0f, min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ) ); + //float inter, inter1, inter2; + //inter = atan2f( dv_r[1], dv_r[0] ); + //inter1 = min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ); + //inter2 = max( -180.0f, min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ) ); /*Conversion cartesian to spherical coordinates*/ *azi = (int16_t) roundf( max( -180.0f, min( 180.0f, atan2f( dv_r[1], dv_r[0] ) * _180_OVER_PI ) ) ); if ( isPlanar == 0 ) @@ -2995,6 +2998,7 @@ static bool are_orientations_same_fx( return orientationsAreSame; } #endif +#ifndef IVAS_FLOAT_FIXED static bool are_orientations_same( const IVAS_QUATERNION *orientation1, const IVAS_QUATERNION *orientation2 ) @@ -3012,6 +3016,7 @@ static bool are_orientations_same( return orientationsAreSame; } +#endif /*-----------------------------------------------------------------------* diff --git a/lib_rend/ivas_vbap.c b/lib_rend/ivas_vbap.c index 3c3fd8023..c0e60b6e3 100644 --- a/lib_rend/ivas_vbap.c +++ b/lib_rend/ivas_vbap.c @@ -3718,7 +3718,7 @@ static ivas_error formulate_half_sphere_connections_fx( var2 = dotp_fixed( planeCrossingVec_fx, speaker_node_data[cmp_chB].unit_vec_fx, 3 ); move32(); - final_exp_A, final_exp_B, exp_var1_sq, exp_var2_sq; + //final_exp_A, final_exp_B, exp_var1_sq, exp_var2_sq; var1_sq = Mpy_32_32( var1, var1 ); //(2 * (Q_planeCrossingVec - Q1) ) - Q31 var2_sq = Mpy_32_32( var2, var2 ); exp_var1_sq = shl( ( sub( Q31, sub( Q_planeCrossingVec, Q1 ) ) ), 1 ); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index d5a90e28a..26bbeede5 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -439,6 +439,7 @@ static ivas_error allocateMcLfeDelayBuffer_fx( return IVAS_ERR_OK; } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error allocateMcLfeDelayBuffer( float **lfeDelayBuffer, const int16_t data_size ) @@ -451,6 +452,7 @@ static ivas_error allocateMcLfeDelayBuffer( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static void freeMcLfeDelayBuffer_fx( Word32 **lfeDelayBuffer ) @@ -465,6 +467,7 @@ static void freeMcLfeDelayBuffer_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static void freeMcLfeDelayBuffer( float **lfeDelayBuffer ) { @@ -476,6 +479,7 @@ static void freeMcLfeDelayBuffer( return; } +#endif #ifdef IVAS_FLOAT_FIXED static IVAS_QUATERNION quaternionInit_fx( @@ -1204,6 +1208,7 @@ static ivas_error getSpeakerAzimuths_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error getSpeakerAzimuths( AUDIO_CONFIG config, const float **azimuths ) @@ -1237,6 +1242,7 @@ static ivas_error getSpeakerAzimuths( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error getSpeakerElevations_fx( AUDIO_CONFIG config, @@ -1272,6 +1278,7 @@ static ivas_error getSpeakerElevations_fx( return IVAS_ERR_OK; } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error getSpeakerElevations( AUDIO_CONFIG config, const float **elevations ) @@ -1305,6 +1312,7 @@ static ivas_error getSpeakerElevations( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error getAmbisonicsOrder_fx( @@ -2888,6 +2896,7 @@ static ivas_error initMcPanGainsWithMonoOut_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithMonoOut( input_mc *inputMc ) { @@ -2941,6 +2950,7 @@ static ivas_error initMcPanGainsWithMonoOut( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithStereoLookup_fx( input_mc *inputMc ) @@ -2997,6 +3007,7 @@ static ivas_error initMcPanGainsWithStereoLookup_fx( } #endif +#ifndef IVAS_FLOAT_FIXED static ivas_error initMcPanGainsWithStereoLookup( input_mc *inputMc ) { @@ -3042,6 +3053,7 @@ static ivas_error initMcPanGainsWithStereoLookup( return IVAS_ERR_OK; } +#endif /* Returns 1 (true) if configs A and B are equal, otherwise returns 0 (false). * If both configs are custom LS layouts, layout details are compared to determine equality. */ @@ -4506,7 +4518,7 @@ static ivas_error initSbaPanGainsForMcOut( BREAK; case IVAS_AUDIO_CONFIG_LS_CUSTOM: // ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); - ivas_ls_custom_setup_fx( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *) outSetupCustom ); + ivas_ls_custom_setup_fx( &hOutSetup, outSetupCustom ); BREAK; default: assert( !"Invalid speaker config" ); @@ -5105,7 +5117,11 @@ static void clearInputMasa( freeInputBaseBufferData( &inputMasa->bufferData ); +#ifdef IVAS_FLOAT_FIXED masaPrerendClose_fx( &inputMasa->hMasaPrerend ); +#else + masaPrerendClose( &inputMasa->hMasaPrerend ); +#endif freeMasaExtRenderer( &inputMasa->hMasaExtRend ); initRendInputBase( &inputMasa->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); @@ -7970,7 +7986,7 @@ static ivas_error rotateFrameMc_fx( Word16 nchan; Word16 ch_in, ch_out; Word16 ch_in_woLFE, ch_out_woLFE; - Word32 *readPtr, *writePtr; + Word32 *readPtr, *writePtr = NULL; const Word32 *ls_azimuth, *ls_elevation; rotation_matrix_fx Rmat_fx; rotation_gains_Word32 gains; @@ -8084,12 +8100,12 @@ static ivas_error rotateFrameMc_fx( /* crossfade with previous rotation gains */ FOR( i = 0; i < subframe_len; i++ ) { - *writePtr++ = + *writePtr = L_add( *writePtr, L_add( Mpy_32_32( ( *readPtr ), Mpy_32_32( ( ONE_IN_Q31 - crossfade[i] ), gains_prev[ch_in][ch_out] ) ), Mpy_32_32( ( *readPtr ), Mpy_32_32( crossfade[i], gains[ch_in][ch_out] ) ) ) ); // Qinp -1 - move32(); readPtr++; + writePtr++; } } } @@ -9263,7 +9279,7 @@ static void renderIsmToMasa( Word16 guard_bits = find_guarded_bits_fx( L_FRAME48k ); max_e = input_e[0]; - FOR( Word16 i = 1; i < MAX_NUM_OBJECTS; i++ ) + FOR( i = 1; i < MAX_NUM_OBJECTS; i++ ) { IF( max_e < input_e[0] ) max_e = input_e[i]; @@ -11546,7 +11562,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( { MASA_DECODER_EXT_OUT_META_HANDLE inMeta2; float( *inEne1 )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#ifndef IVAS_FLOAT_FIXED float( *inEne2 )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; +#endif Word32( *inEne1_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word32( *inEne2_fx )[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; Word16 *inEne1_e; @@ -11623,7 +11641,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) { inMeta2 = hIvasRend->inputsIsm->hOMasa->hMasaOut; +#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsIsm->hOMasa->energy ); +#endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &(hIvasRend->inputsIsm->hOMasa->energy_fx); inEne2_e = (hIvasRend->inputsIsm->hOMasa->energy_e); @@ -11638,7 +11658,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { inMeta2 = hIvasRend->inputsMc->hMcMasa->hMasaOut; +#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsMc->hMcMasa->energy ); +#endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsMc->hMcMasa->energy_fx ); inEne2_e = (hIvasRend->inputsMc->hMcMasa->energy_exp); @@ -11651,7 +11673,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) { inMeta2 = hIvasRend->inputsSba->hDirAC->hMasaOut; +#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsSba->hDirAC->energy ); +#endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsSba->hDirAC->energy_fx ); inEne2_e = (hIvasRend->inputsSba->hDirAC->energy_exp); @@ -11664,7 +11688,9 @@ ivas_error IVAS_REND_MergeMasaMetadata( else if ( inputType2 == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) { inMeta2 = hIvasRend->inputsMasa->hMasaPrerend->hMasaOut; +#ifndef IVAS_FLOAT_FIXED inEne2 = &( hIvasRend->inputsMasa->hMasaPrerend->energy ); +#endif #ifdef IVAS_FLOAT_FIXED inEne2_fx = &( hIvasRend->inputsMasa->hMasaPrerend->energy_fx ); inEne2_e = (hIvasRend->inputsMasa->hMasaPrerend->energy_e); -- GitLab