From 32825a463cbf5aa8a9cb5514b81a25b96cce2e7c Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 29 May 2024 13:34:00 +0530 Subject: [PATCH] Warnings fix for float-build, intermediate cleanup in renderer --- apps/renderer.c | 14 +++++ lib_com/hp50.c | 2 + lib_com/ivas_prot.h | 4 ++ lib_com/ivas_spar_com.c | 16 ++--- lib_com/lerp.c | 2 +- lib_com/longarith.c | 2 + lib_com/prot_fx2.h | 2 + lib_com/swb_tbe_com.c | 4 ++ lib_com/tools_fx.c | 6 +- lib_dec/FEC_clas_estim_fx.c | 2 + lib_dec/avq_dec_fx.c | 2 + lib_dec/bass_psfilter_fx.c | 2 + lib_dec/core_dec_switch.c | 8 +-- lib_dec/dec_acelp_tcx_main.c | 10 ++-- lib_dec/ivas_init_dec.c | 10 ++-- lib_dec/ivas_ism_param_dec.c | 2 +- lib_dec/ivas_jbm_dec.c | 2 +- lib_dec/ivas_ls_custom_dec.c | 4 ++ lib_dec/ivas_mc_param_dec.c | 6 +- lib_dec/ivas_mdct_core_dec.c | 1 - lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 2 +- lib_dec/ivas_stereo_cng_dec.c | 3 +- lib_dec/ivas_stereo_mdct_stereo_dec.c | 2 +- lib_dec/ivas_stereo_td_dec.c | 2 + lib_dec/jbm_pcmdsp_apa.c | 14 +++-- lib_dec/jbm_pcmdsp_similarityestimation.c | 2 + lib_dec/lib_dec_fx.c | 14 ----- lib_dec/swb_tbe_dec.c | 3 +- lib_enc/ivas_init_enc.c | 3 +- lib_enc/ivas_ism_metadata_enc.c | 4 ++ lib_enc/ivas_spar_encoder.c | 4 +- lib_enc/ivas_spar_md_enc.c | 5 +- lib_enc/ivas_stereo_dft_enc.c | 2 + lib_enc/lib_enc.c | 12 ++-- lib_rend/ivas_objectRenderer_hrFilt.c | 2 +- lib_rend/ivas_reverb_filter_design.c | 20 ++++--- lib_rend/lib_rend.c | 72 +++++++++-------------- lib_util/ism_file_reader.c | 14 +++-- 38 files changed, 163 insertions(+), 118 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 49fbee9dd..dc4091ece 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -2561,6 +2561,9 @@ void getMetadataFromFileReader( #ifdef IVAS_FLOAT_FIXED objectMetadataBuffer->positions[objIdx].azimuth_fx = (Word32)(ismMetadata.azimuth * (1<<22)); objectMetadataBuffer->positions[objIdx].elevation_fx = (Word32)(ismMetadata.elevation * (1 << 22)); + objectMetadataBuffer->positions[objIdx].radius_fx = (Word16)(ismMetadata.radius * (1 << 9)); + objectMetadataBuffer->positions[objIdx].yaw_fx = (Word32)(ismMetadata.yaw * (1 << 22)); + objectMetadataBuffer->positions[objIdx].pitch_fx = (Word32)(ismMetadata.pitch * (1 << 22)); #endif // DEBUG objectMetadataBuffer->positions[objIdx].azimuth = ismMetadata.azimuth; @@ -2626,6 +2629,13 @@ static void IsmPositionProvider_getNextFrame( objectMetadataBuffer->positions[objIdx].radius = 1.0f; objectMetadataBuffer->positions[objIdx].yaw = 0.0f; objectMetadataBuffer->positions[objIdx].pitch = 0.0f; +#ifdef IVAS_FLOAT_FIXED + objectMetadataBuffer->positions[objIdx].azimuth_fx = 0; + objectMetadataBuffer->positions[objIdx].elevation_fx = 0; + objectMetadataBuffer->positions[objIdx].radius_fx = 512; + objectMetadataBuffer->positions[objIdx].yaw_fx = 0; + objectMetadataBuffer->positions[objIdx].pitch_fx = 0; +#endif objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0; } @@ -2657,6 +2667,10 @@ static void IsmPositionProvider_getNextFrame( /* Clamp pitch to lie within [-90, 90] range (can't be wrapped easily) */ objectMetadataBuffer->positions[objIdx].pitch = min( max( objectMetadataBuffer->positions[objIdx].pitch, -90 ), 90 ); +#ifdef IVAS_FLOAT_FIXED + objectMetadataBuffer->positions[objIdx].yaw_fx = (Word32)objectMetadataBuffer->positions[objIdx].yaw * (1 << Q22); + objectMetadataBuffer->positions[objIdx].pitch_fx = (Word32)objectMetadataBuffer->positions[objIdx].pitch * (1 << Q22); +#endif } ++positionProvider->frameCounter; diff --git a/lib_com/hp50.c b/lib_com/hp50.c index 48c3de609..890b12d4c 100644 --- a/lib_com/hp50.c +++ b/lib_com/hp50.c @@ -437,6 +437,7 @@ void hp20(Word16 signal[], /* i/o: signal to filter any * } +#ifdef IVAS_FLOAT_FIXED void hp20_fix32( Word32 signal_fx[], const Word16 lg, @@ -580,3 +581,4 @@ void hp20_fix32( return; } +#endif \ No newline at end of file diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c902cac9b..e762c13d5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -6830,7 +6830,11 @@ ivas_error ivas_ls_custom_output_init( void ivas_ls_custom_setup( IVAS_OUTPUT_SETUP_HANDLE hOutSetup, /* o : IVAS output setup handle */ +#ifdef IVAS_FLOAT_FIXED LSSETUP_CUSTOM_STRUCT *hLsSetupCustom /* i : Custom loudspeaker setup handle */ +#else + const LSSETUP_CUSTOM_STRUCT *hLsSetupCustom /* i : Custom loudspeaker setup handle */ +#endif // IVAS_FLOAT_FIXED ); #endif diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 624d8e345..c178fcc80 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -84,8 +84,8 @@ * Static functions declaration *------------------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED -static void ivas_get_pred_coeffs( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ppPred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ppDM_Fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], const int16_t in_chans, const int16_t start_band, const int16_t end_band, const int16_t active_w, const int16_t active_w_vlbr, const int16_t dtx_vad, const int16_t from_dirac, const int16_t dyn_active_w_flag, const int16_t res_ind ); static void ivas_get_pred_coeffs_fx( Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word32 ppPred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], @@ -101,21 +101,23 @@ static void ivas_get_pred_coeffs_fx( const Word16 res_ind, Word16 *q_pred_coeffs, Word16 *q_dm_fv_re ); +static void ivas_reorder_array_fx(Word32 in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS], const Word16 in_chans, const Word16 order[IVAS_SPAR_MAX_CH], Word32 ***mixer_mat, const Word16 start_band, const Word16 end_band); +static void ivas_get_Wscaling_factor_fx(Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 q_cov_real, Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], Word16 q_pred_coeffs_re, Word32 ***mixer_mat, Word16 q_mixer_mat, const Word16 start_band, const Word16 end_band, const Word16 dtx_vad, const Word16 num_ch, const Word16 *pNum_dmx, const Word16 bands_bw, const Word16 active_w, const Word16 active_w_vlbr, Word32 *pWscale, Word16 *q_pWscale, const Word16 dyn_active_w_flag); +static void ivas_calc_post_pred_per_band_fx(Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 q_cov_real, Word32 ***mixer_mat, Word16 q_mixer_mat, const Word16 num_ch, const Word16 band_idx, Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *q_postpred_cov_re); +static Word16 ivas_is_mat_inv_fx(Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], Word16 q_in_re, const Word16 dim); +static void ivas_calc_mat_inv_fx(Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], Word16 q_in_re, const Word16 dim, Word32 out_re[MAX_MAT_DIM][MAX_MAT_DIM], Word16 *q_out_re); +#endif +static void ivas_get_pred_coeffs( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ppPred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ppDM_Fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], const int16_t in_chans, const int16_t start_band, const int16_t end_band, const int16_t active_w, const int16_t active_w_vlbr, const int16_t dtx_vad, const int16_t from_dirac, const int16_t dyn_active_w_flag, const int16_t res_ind ); static void ivas_reorder_array( float in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS], const int16_t in_chans, const int16_t order[IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t start_band, const int16_t end_band ); -static void ivas_reorder_array_fx(Word32 in_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS], const Word16 in_chans, const Word16 order[IVAS_SPAR_MAX_CH], Word32 ***mixer_mat, const Word16 start_band, const Word16 end_band); static void ivas_get_Wscaling_factor( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], float ***mixer_mat, const int16_t start_band, const int16_t end_band, const int16_t dtx_vad, const int16_t num_ch, const int16_t *pNum_dmx, const int16_t bands_bw, const int16_t active_w, const int16_t active_w_vlbr, float *pWscale, const int16_t dyn_active_w_flag ); -static void ivas_get_Wscaling_factor_fx(Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 q_cov_real, Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], Word16 q_pred_coeffs_re, Word32 ***mixer_mat, Word16 q_mixer_mat, const Word16 start_band, const Word16 end_band, const Word16 dtx_vad, const Word16 num_ch, const Word16 *pNum_dmx, const Word16 bands_bw, const Word16 active_w, const Word16 active_w_vlbr, Word32 *pWscale, Word16 *q_pWscale, const Word16 dyn_active_w_flag ); static void ivas_calc_post_pred_per_band( float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], float ***mixer_mat, const int16_t num_ch, const int16_t band_idx, float postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH] ); -static void ivas_calc_post_pred_per_band_fx(Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 q_cov_real, Word32 ***mixer_mat, Word16 q_mixer_mat, const Word16 num_ch, const Word16 band_idx, Word32 postpred_cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], Word16 *q_postpred_cov_re); static int16_t ivas_is_mat_inv( float in_re[MAX_MAT_DIM][MAX_MAT_DIM], const int16_t dim ); -static Word16 ivas_is_mat_inv_fx(Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], Word16 q_in_re, const Word16 dim); static void ivas_calc_mat_inv( float in_re[MAX_MAT_DIM][MAX_MAT_DIM], const int16_t dim, float out_re[MAX_MAT_DIM][MAX_MAT_DIM] ); -static void ivas_calc_mat_inv_fx(Word32 in_re[MAX_MAT_DIM][MAX_MAT_DIM], Word16 q_in_re, const Word16 dim, Word32 out_re[MAX_MAT_DIM][MAX_MAT_DIM], Word16 *q_out_re); /*-----------------------------------------------------------------------------------------* * Function ivas_get_bw_idx_from_sample_rate() @@ -6604,6 +6606,7 @@ void ivas_spar_set_bitrate_config( return; } +#ifdef IVAS_FLOAT_FIXED static Word32 ceil32_fx(Word32 var1, Word16 q) { Word32 ans, temp; @@ -6614,7 +6617,6 @@ static Word32 ceil32_fx(Word32 var1, Word16 q) ELSE return L_add(ans, 1); } -#ifdef IVAS_FLOAT_FIXED void ivas_spar_set_bitrate_config_fx( ivas_spar_md_com_cfg *pSpar_md_cfg, /* i/o: SPAR MD config. handle */ const Word16 table_idx, /* i : config. table index */ diff --git a/lib_com/lerp.c b/lib_com/lerp.c index abda17551..5bbc1b1c4 100644 --- a/lib_com/lerp.c +++ b/lib_com/lerp.c @@ -384,6 +384,7 @@ static void lerp_proc(const Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word } +#ifdef IVAS_FLOAT_FIXED static void lerp_proc32(Word32 *f, Word32 *f_out, Word16 bufferNewSize, Word16 bufferOldSize) { @@ -479,7 +480,6 @@ static void lerp_proc32(Word32 *f, Word32 *f_out, Word16 bufferNewSize, Word16 b } -#ifdef IVAS_FLOAT_FIXED static void L_lerp_proc_fx( const Word32 *f_fx, Word32 *f_out_fx, const Word16 bufferNewSize, const Word16 bufferOldSize ); diff --git a/lib_com/longarith.c b/lib_com/longarith.c index 78def0889..cdca65cc6 100644 --- a/lib_com/longarith.c +++ b/lib_com/longarith.c @@ -136,6 +136,7 @@ void longshiftright( return; } +#ifdef IVAS_FLOAT_FIXED void longshr( UWord32 a[], Word16 bits, @@ -158,6 +159,7 @@ void longshr( return; } +#endif /*-------------------------------------------------------------------* * longshiftleft() diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index b883b924e..0e0b04047 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -4579,11 +4579,13 @@ void longshiftleft( const int16_t len /* i : length of vector a[] and d[] */ ); +#ifdef IVAS_FLOAT_FIXED void longshr( UWord32 a[], Word16 bits, Word16 len ); +#endif // IVAS_FLOAT_FIXED //gs_bitallocation.c void bands_and_bit_alloc_fx( diff --git a/lib_com/swb_tbe_com.c b/lib_com/swb_tbe_com.c index b27fb86b2..1755a8f82 100644 --- a/lib_com/swb_tbe_com.c +++ b/lib_com/swb_tbe_com.c @@ -56,7 +56,9 @@ static void create_random_vector( float output[], const int16_t length, int16_t seed[] ); static void flip_spectrum( const float input[], float output[], const int16_t length ); static void Hilbert_transform( float tmp_R[], float tmp_I[], float *tmpi_R, float *tmpi_I, const int16_t length, const int16_t HB_stage_id ); +#ifdef IVAS_FLOAT_FIXED static void Hilbert_transform_fx_32(Word32 tmp_R[], Word32 tmp_I[], Word32 *tmpi_R, Word32 *tmpi_I, const Word16 length, const Word16 HB_stage_id); +#endif static void Estimate_mix_factors( const float *shb_res, const float *exc16kWhtnd, const float *White_exc16k, const float pow1, const float pow22, float *vf_modified, int16_t *vf_ind ); /*-------------------------------------------------------------------* @@ -411,6 +413,7 @@ static void Hilbert_transform( return; } +#ifdef IVAS_FLOAT_FIXED static void Hilbert_transform_fx_32( Word32 tmp_R[], /* i: Real component of HB */ Word32 tmp_I[], /* i: Real component of HB */ @@ -468,6 +471,7 @@ static void Hilbert_transform_fx_32( } } } +#endif /*-------------------------------------------------------------------* * flip_spectrum() diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index c7e150611..0f0065a3d 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -1378,6 +1378,7 @@ void conv_fx( * All vectors are of length L. Only the first L samples of the * convolution are considered. *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED #ifdef BASOP_NOGLOB /*Critical overflow */ Flag conv_fx_32( #else @@ -1409,7 +1410,7 @@ void conv_fx_32( return Overflow; #endif } - +#endif Word16 var_fx( /* o: variance of vector Qx*/ const Word16 *x, /* i: input vector Qx*/ const Word16 Qx, @@ -3805,7 +3806,7 @@ void delay_signal_fx( return; } - +#ifdef IVAS_FLOAT_FIXED void delay_signal_q_adj_fx( Word32 x[], /* i/o: signal to be delayed */ const int16_t len, /* i : length of the input signal */ @@ -3834,6 +3835,7 @@ void delay_signal_q_adj_fx( return; } +#endif // IVAS_FLOAT_FIXED void v_add_fx( const Word32 x1[], /* i : Input vector 1 */ diff --git a/lib_dec/FEC_clas_estim_fx.c b/lib_dec/FEC_clas_estim_fx.c index 74606fb86..abeaf4ca9 100644 --- a/lib_dec/FEC_clas_estim_fx.c +++ b/lib_dec/FEC_clas_estim_fx.c @@ -13,8 +13,10 @@ /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static Word16 FEC_dec_class_fx( Decoder_State *st_fx, Word32 *enr_q); static void Corre(const Word16 *x,const Word16 *y,const Word16 l,Word16 *gain); +#endif /*---------------------------------------------------------------------* * Local Constants diff --git a/lib_dec/avq_dec_fx.c b/lib_dec/avq_dec_fx.c index 62a551909..9f0d0416b 100644 --- a/lib_dec/avq_dec_fx.c +++ b/lib_dec/avq_dec_fx.c @@ -15,7 +15,9 @@ * Local prototypes *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void read_cv_fx( Decoder_State *st, UWord16 *I, Word16 *kv, Word16 nq, Word16 *nbits ); +#endif /*-----------------------------------------------------------------* * AVQ_demuxdec() diff --git a/lib_dec/bass_psfilter_fx.c b/lib_dec/bass_psfilter_fx.c index 36655d691..95bece13e 100644 --- a/lib_dec/bass_psfilter_fx.c +++ b/lib_dec/bass_psfilter_fx.c @@ -22,7 +22,9 @@ /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static Word16 Pit_track_fx(Word16 syn[], Word16 T); +#endif /*---------------------------------------------------------------------* * bass_psfilter_init() diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index 2fe543ca8..7e81b04cc 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -135,7 +135,7 @@ else { st->narrowBand = 0; } - st->TcxBandwidth = getTcxBandwidth_flt(bwidth); + st->TcxBandwidth_float = getTcxBandwidth_flt(bwidth); if (st->hTcxCfg != NULL) { @@ -157,8 +157,8 @@ reconfig_decoder_LPD_ivas(st, frame_size, bwidth, total_brate, st->last_L_frame) if (hTcxDec->envWeighted && !hTcxDec->enableTcxLpc) { - mvr2r(st->lspold_uw, st->lsp_old, M); - mvr2r(st->lsfold_uw, st->lsf_old, M); + mvr2r(st->lspold_uw_float, st->lsp_old, M); + mvr2r(st->lsfold_uw_float, st->lsf_old, M); hTcxDec->envWeighted = 0; } @@ -190,7 +190,7 @@ if (bwidth == SWB && (total_brate == ACELP_16k40 || total_brate == ACELP_24k40) { if (st->tec_tfa == 0 && st->hTECDec != NULL) { - set_zero(st->hTECDec->loBuffer, MAX_TEC_SMOOTHING_DEG); + set_zero(st->hTECDec->loBuffer_flt, MAX_TEC_SMOOTHING_DEG); } st->tec_tfa = 1; } diff --git a/lib_dec/dec_acelp_tcx_main.c b/lib_dec/dec_acelp_tcx_main.c index f04ce92f9..adc2dfb76 100644 --- a/lib_dec/dec_acelp_tcx_main.c +++ b/lib_dec/dec_acelp_tcx_main.c @@ -220,24 +220,24 @@ static void decode_frame_type_flt( configureFdCngDec(st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode); if (st->last_L_frame != st->L_frame && st->L_frame <= L_FRAME16k && st->last_L_frame <= L_FRAME16k) { - lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->L_frame * 2, st->last_L_frame * 2); + lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->L_frame * 2, st->last_L_frame * 2); if (st->m_frame_type == SID_FRAME && st->hFdCngDec->hFdCngCom->frame_type_previous != ACTIVE_FRAME) { - lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth, st->hFdCngDec->hFdCngCom->olapBufferSynth, st->L_frame * 2, st->last_L_frame * 2); + lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->L_frame * 2, st->last_L_frame * 2); lerp_flt(hStereoCng->olapBufferSynth22, hStereoCng->olapBufferSynth22, st->L_frame * 2, st->last_L_frame * 2); if (st->L_frame == L_FRAME) { for (n = 0; n < st->L_frame * 2; n++) { - st->hFdCngDec->hFdCngCom->olapBufferSynth[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth[n] * 1.25f; + st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] * 1.25f; } } else { for (n = 0; n < st->L_frame * 2; n++) { - st->hFdCngDec->hFdCngCom->olapBufferSynth[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth[n] / 1.25f; + st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] / 1.25f; } } } @@ -246,7 +246,7 @@ static void decode_frame_type_flt( if (st->bwidth != st->last_bwidth) { st->hFdCngDec->hFdCngCom->msFrCnt_init_counter = 0; - st->hFdCngDec->hFdCngCom->init_old = FLT_MAX; + st->hFdCngDec->hFdCngCom->init_old_flt = FLT_MAX; } if (st->tcxonly) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index a6900e22e..a702332e8 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -3907,7 +3907,7 @@ ivas_error ivas_init_decoder( for ( i = 0; i < numCldfbAnalyses; i++ ) { - if ( ( error = openCldfb( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + if ( ( error = openCldfb_ivas( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } @@ -3919,7 +3919,7 @@ ivas_error ivas_init_decoder( for ( i = 0; i < numCldfbSyntheses; i++ ) { - if ( ( error = openCldfb( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + if ( ( error = openCldfb_ivas( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } @@ -4157,7 +4157,7 @@ void destroy_core_dec( DEC_CORE_HANDLE hCoreCoder /* i/o: core decoder structure */ ) { - destroy_cldfb_decoder( hCoreCoder ); + destroy_cldfb_decoder_flt( hCoreCoder ); if ( hCoreCoder->hGSCDec != NULL ) { @@ -4737,7 +4737,7 @@ void ivas_destroy_dec( { if ( st_ivas->cldfbAnaDec[i] != NULL ) { - deleteCldfb( &( st_ivas->cldfbAnaDec[i] ) ); + deleteCldfb_ivas( &( st_ivas->cldfbAnaDec[i] ) ); } } @@ -4745,7 +4745,7 @@ void ivas_destroy_dec( { if ( st_ivas->cldfbSynDec[i] != NULL ) { - deleteCldfb( &( st_ivas->cldfbSynDec[i] ) ); + deleteCldfb_ivas( &( st_ivas->cldfbSynDec[i] ) ); } } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 7811f5bec..5a6f04949 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -2370,7 +2370,7 @@ void ivas_param_ism_dec_digest_tc( float RealBuffer[CLDFB_NO_CHANNELS_MAX]; float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - cldfbAnalysis_ts( &( transport_channels_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + cldfbAnalysis_ts_ivas( &( transport_channels_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); mvr2r( RealBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); mvr2r( ImagBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands ); } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 865d4d906..ce35f0b0e 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2126,7 +2126,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } - free(data_fx); #endif #else ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data, p_data_f ); @@ -2943,6 +2942,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( #endif } } + free( data_fx ); pop_wmops(); return; diff --git a/lib_dec/ivas_ls_custom_dec.c b/lib_dec/ivas_ls_custom_dec.c index e10eab771..58254892a 100644 --- a/lib_dec/ivas_ls_custom_dec.c +++ b/lib_dec/ivas_ls_custom_dec.c @@ -106,7 +106,11 @@ ivas_error ivas_ls_custom_open_fx( #ifndef IVAS_FLOAT_FIXED void ivas_ls_custom_setup( IVAS_OUTPUT_SETUP_HANDLE hOutSetup, /* o : IVAS output setup handle */ +#ifdef IVAS_FLOAT_FIXED LSSETUP_CUSTOM_STRUCT *hLsSetupCustom /* i : Custom loudspeaker setup handle */ // Removed const temporarily. Can be added later. +#else + const LSSETUP_CUSTOM_STRUCT *hLsSetupCustom /* i : Custom loudspeaker setup handle */ // Removed const temporarily. Can be added later. +#endif // IVAS_FLOAT_FIXED ) { hOutSetup->output_config = IVAS_AUDIO_CONFIG_LS_CUSTOM; diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 9db6b9ae6..f200a8545 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -81,8 +81,9 @@ typedef struct parameter_band_mapping_struct #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 +#else static void ivas_param_mc_dec_init_fx( PARAM_MC_DEC_HANDLE hParamMC, const Word16 nchan_in, const Word16 nchan_out ); +#endif #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 ); @@ -104,7 +105,7 @@ static void ivas_param_mc_dequantize_cov( PARAM_MC_DEC_HANDLE hDirAC, float *ild #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 +#else static void ivas_param_mc_get_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ @@ -120,6 +121,7 @@ static void ivas_param_mc_get_mixing_matrices_fx( const Word16 nX, /* i : number of transport channels */ const Word16 nY_cov /* i : number of covariance synthesis output channels */ ); +#endif #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 diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index e04332462..4d6248f45 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -1649,7 +1649,6 @@ void ivas_mdct_core_reconstruct( float *synthFB; /* TCX */ float xn_buf[L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX]; - Word16 xn_buf_fx[2040] = { 0 }; int16_t tcx_offset[CPE_CHANNELS]; int16_t tcx_offsetFB[CPE_CHANNELS]; int16_t left_rect[CPE_CHANNELS]; diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index c34ba020f..09343b736 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -1200,7 +1200,7 @@ void ivas_sba_dirac_stereo_smooth_parameters_fx( // The Q format of mixer_mat_prev_fx is Q30 so applying the left shift. hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS] = L_add_sat(Mpy_32_16_1(hStereoDft->mixer_mat_smooth_fx[i][j][b + k * IVAS_MAX_NUM_BANDS], beta), - L_shl(Mpy_32_16_1(hMdDec->mixer_mat_prev_fx[i_hist][i][j][b], sub((Word16)0x7FFF, beta)), Q1)); + L_shl_sat(Mpy_32_16_1(hMdDec->mixer_mat_prev_fx[i_hist][i][j][b], sub((Word16)0x7FFF, beta)), Q1)); move32(); } } diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index e2e0c238c..93817a5b1 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -1985,7 +1985,7 @@ static void FindEmEs( return; } -#endif +#else static void FindEmEs_fx( const Word32 *ch1_fx, /* i : Left channel */ @@ -2049,6 +2049,7 @@ static void FindEmEs_fx( *lt_es_em_fx = L_add( Mpy_32_32( 858993459, *lt_es_em_fx ), Mpy_32_32( 1288490188, es_em_fx ) ); return; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index 866e53366..256b3efeb 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -960,7 +960,7 @@ ivas_error initMdctStereoDtxData( #ifdef IVAS_FLOAT_FIXED st->cldfbSyn->scale = (Word16) ( st->cldfbSyn->scale_flt * ( 1u << norm_s( (Word16) st->cldfbSyn->scale_flt ) ) ); initFdCngDec_ivas_fx( st, st->cldfbSyn->scale ); -#endif IVAS_FLOAT_FIXED +#endif } IF ( EQ_16( st->first_CNG, 0 ) ) diff --git a/lib_dec/ivas_stereo_td_dec.c b/lib_dec/ivas_stereo_td_dec.c index 5a10a04c3..25e578a58 100644 --- a/lib_dec/ivas_stereo_td_dec.c +++ b/lib_dec/ivas_stereo_td_dec.c @@ -779,6 +779,7 @@ Word32 inv_time[960 + 1] = { 2255760, 2253393, 2251031, 2248674, 2246321, 2243974, 2241632, 2239294, 2236962 }; +#ifdef IVAS_FLOAT_FIXED static void tdm_upmix_fade_fx( Word32 Left_fx[], /* o : left channel */ Word32 Right_fx[], /* o : right channel */ @@ -871,6 +872,7 @@ static void tdm_upmix_fade_fx( return; } +#endif // IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * stereo_tdm_combine() * diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 8652b3034..f91c4c310 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -150,6 +150,7 @@ Word16 apa_getQualityIncreaseForLowEnergy_fx(Word16 energydB); #ifndef IVAS_FLOAT_FIXED static float apa_getQualityIncreaseForLowEnergy( float energydB ); #endif +#ifdef IVAS_FLOAT_FIXED static Word8 logarithmic_search_fx( const apa_state_t *ps, const Word16 *signal, @@ -162,7 +163,7 @@ static Word8 logarithmic_search_fx( const apa_state_t *ps, Word16 css, Word16 *synchpos ); -#ifndef IVAS_FLOAT_FIXED +#else 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 @@ -176,6 +177,7 @@ static bool shrink_frm( apa_state_t *ps, const float frm_in[], uint16_t maxScali static bool extend_frm( apa_state_t *ps, const float frm_in[], float frm_out[], uint16_t *l_frm_out ); +#ifdef IVAS_FLOAT_FIXED static Word16 find_synch_fx( apa_state_t *ps, const Word16 *in, Word16 l_in, @@ -187,6 +189,7 @@ static Word16 find_synch_fx( apa_state_t *ps, Word16 *energydBQ8, Word32 *qualityQ16, Word16 *synch_pos ); +#endif // IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * Public functions @@ -1246,7 +1249,7 @@ static void get_scaling_quality( return; } -#endif +#else static void get_scaling_quality_fx(const apa_state_t * ps, @@ -1351,6 +1354,7 @@ static void get_scaling_quality_fx(const apa_state_t * ps, *qualityQ16 = L_add(*qualityQ16, L_shl(L_deposit_l(apa_getQualityIncreaseForLowEnergy_fx(*energydBQ8)), 8)); } +#endif Word16 apa_corrEnergy2dB_fx(Word32 energy, Word16 energyExp, Word16 corr_len) { @@ -1542,7 +1546,7 @@ static bool logarithmic_search( return 0; } -#endif +#else static Word8 logarithmic_search_fx(const apa_state_t * ps, @@ -1629,6 +1633,7 @@ static Word8 logarithmic_search_fx(const apa_state_t * ps, } WHILE(GT_16(css, 2)); return 0; } +#endif /* ******************************************************************************** * @@ -1701,7 +1706,7 @@ static bool find_synch( return 0; } -#endif +#else static Word16 find_synch_fx( apa_state_t *ps, const Word16 *in, @@ -1743,6 +1748,7 @@ static Word16 find_synch_fx( apa_state_t *ps, return 0; } +#endif /* ******************************************************************************** * diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.c b/lib_dec/jbm_pcmdsp_similarityestimation.c index a90d4412c..3863c0c7c 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation.c @@ -66,6 +66,7 @@ float cross_correlation_self( return c_c; } +#ifdef IVAS_FLOAT_FIXED void scaleSignal16( const Word16 *src, Word16 *dst, Word16 n, Word16 rightShift ) { Word16 i; @@ -76,6 +77,7 @@ void scaleSignal16( const Word16 *src, Word16 *dst, Word16 n, Word16 rightShift move16(); } } +#endif /* Calculates cross correlation coefficient for template segment. */ Word32 cross_correlation_subsampled_self_fx( const Word16 *signal, Word16 x, diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 2dcf5ab8a..f3614d3ce 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1111,8 +1111,6 @@ static ivas_error IVAS_DEC_Setup( Word16 SrcInd[MAX_NUM_TDREND_CHANNELS]; Word16 num_src = 0; Word16 i; - Word16 old_ism_mode = ivas_omasa_ism_mode_select(st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->nchan_ism); - Word16 new_ism_mode = ivas_omasa_ism_mode_select(st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_ism); IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && (!(EQ_16(st_ivas->ini_active_frame, 0) && NE_32(ivas_total_brate, FRAME_NO_DATA) && LT_32(ivas_total_brate, MASA_STEREO_MIN_BITRATE) && EQ_16(st_ivas->nCPE, 1))) && st_ivas->bit_stream[(ivas_total_brate / FRAMES_PER_SEC) - 1] && st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT && ((GT_32(ivas_total_brate, IVAS_SID_5k2) && NE_32(ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate)) || EQ_16(st_ivas->ini_active_frame, 0))) { 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)) @@ -1168,8 +1166,6 @@ static ivas_error IVAS_DEC_Setup( IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && (!(EQ_16(st_ivas->ini_active_frame, 0) && NE_32(ivas_total_brate, FRAME_NO_DATA) && LT_32(ivas_total_brate, MASA_STEREO_MIN_BITRATE) && EQ_16(st_ivas->nCPE, 1))) && st_ivas->bit_stream[(ivas_total_brate / FRAMES_PER_SEC) - 1] && st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format != MASA_FORMAT && ((GT_32(ivas_total_brate, IVAS_SID_5k2) && NE_32(ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate)) && EQ_16(st_ivas->ini_active_frame, 0))) { - IF (old_ism_mode != new_ism_mode && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC) - { // Float to fix conversions for ivas_td_binaural_open_fx IF (st_ivas->ism_mode == ISM_MASA_MODE_DISC) { @@ -1196,11 +1192,8 @@ static ivas_error IVAS_DEC_Setup( floatToFixed_arrL(st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q11, sub(st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels)); } } - } IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && st_ivas->ivas_format == MASA_ISM_FORMAT && GT_16(st_ivas->ini_frame, 0) && (GT_32(ivas_total_brate, IVAS_SID_5k2) && NE_32(ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate)) && EQ_16(st_ivas->ini_active_frame, 0)) { - IF(old_ism_mode != new_ism_mode && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC) - { IF(st_ivas->ism_mode == ISM_MASA_MODE_DISC) { FOR(i = 0; i < 4; i++) @@ -1227,7 +1220,6 @@ static ivas_error IVAS_DEC_Setup( floatToFixed_arrL(st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q11, sub(st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels)); } } - } IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && (st_ivas->ivas_format == MC_FORMAT)) { IF(st_ivas->hTcBuffer) @@ -1336,8 +1328,6 @@ static ivas_error IVAS_DEC_Setup( } IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && (!(EQ_16(st_ivas->ini_active_frame, 0) && NE_32(ivas_total_brate, FRAME_NO_DATA) && LT_32(ivas_total_brate, MASA_STEREO_MIN_BITRATE) && EQ_16(st_ivas->nCPE, 1))) && st_ivas->bit_stream[(ivas_total_brate / FRAMES_PER_SEC) - 1] && st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format != MASA_FORMAT && ((GT_32(ivas_total_brate, IVAS_SID_5k2) && NE_32(ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate)) || EQ_16(st_ivas->ini_active_frame, 0))) { - IF(NE_16(new_ism_mode, old_ism_mode) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC) - { IF(EQ_16(st_ivas->ism_mode, ISM_MASA_MODE_DISC)) { Word16 nchan_rend = num_src; @@ -1366,12 +1356,9 @@ static ivas_error IVAS_DEC_Setup( fixedToFloat_arrL(st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q11, sub(st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels)); } } - } IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && st_ivas->ivas_format == MASA_ISM_FORMAT && GT_16(st_ivas->ini_frame, 0) && (GT_32(ivas_total_brate, IVAS_SID_5k2) && NE_32(ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate)) && EQ_16(st_ivas->ini_active_frame, 0)) { - IF(NE_16(new_ism_mode, old_ism_mode) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC) - { IF(EQ_16(st_ivas->ism_mode, ISM_MASA_MODE_DISC)) { Word16 nchan_rend = num_src; @@ -1398,7 +1385,6 @@ static ivas_error IVAS_DEC_Setup( IF(st_ivas->cldfbSynDec[0]) { fixedToFloat_arrL(st_ivas->cldfbSynDec[0]->cldfb_state_fx, st_ivas->cldfbSynDec[0]->cldfb_state, Q11, sub(st_ivas->cldfbSynDec[0]->p_filter_length, st_ivas->cldfbSynDec[0]->no_channels)); - } } } diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index 824311873..a6e9c72a3 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -457,7 +457,7 @@ void wb_tbe_dec( return; } -#endif +#else static void calc_tilt_bwe_fx_loc( const Word32 *sp_fx, /* i : input signal */ Word32 *tilt_fx, /* o : signal tilt */ @@ -918,6 +918,7 @@ static void find_max_mem_dec( *n_mem3 = s_max( tempQ15, 0 ); /* --------------------------------------------------------------*/ } +#endif // IVAS_FLOAT_FIXED void find_max_mem_dec_m3( Decoder_State *st, diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 0fc02c8b1..0ef9e6065 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -279,7 +279,7 @@ void copy_encoder_config( return; } - +#ifdef IVAS_FLOAT_FIXED void copy_encoder_config_fx( Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ Encoder_State *st_fx, /* o : encoder state structure */ @@ -312,6 +312,7 @@ void copy_encoder_config_fx( return; } +#endif // IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_initialize_handles_enc() diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index ebaa58e83..2154f3042 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -822,7 +822,11 @@ ivas_error ivas_ism_metadata_enc_create( st_ivas->hIsmMetaData[ch]->q_azimuth_old = 0.0f; st_ivas->hIsmMetaData[ch]->q_elevation_old = 0.0f; +#ifdef IVAS_FLOAT_FIXED + ivas_ism_reset_metadata_enc( st_ivas->hIsmMetaData[ch] ); +#else ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); +#endif st_ivas->hIsmMetaData[ch]->last_azimuth = 0.0f; st_ivas->hIsmMetaData[ch]->last_elevation = 0.0f; diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index c07e5baad..fab245c3d 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[] ); -#ifndef IVAS_FLOAT_FIXED +#if 0 static Word16 Q_factor_L_abs( float x ); #endif -#ifndef IVAS_FLOAT_FIXED +#if 0 Word16 Q_factor_L_abs( float x ) { Word16 Q = 31; diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 33f28aa24..20fa21c9c 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -71,7 +71,9 @@ static int16_t ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR static int16_t ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t strat, const int32_t ivas_total_brate ); static void ivas_spar_set_enc_config( ivas_spar_md_enc_state_t *hMdEnc, int16_t *max_freq_per_chan, const int16_t nchan_transport, float *pFC, const int16_t nchan_inp ); +#ifdef IVAS_FLOAT_FIXED static void ivas_spar_set_enc_config_fx( ivas_spar_md_enc_state_t *hMdEnc, Word16 *max_freq_per_chan, const Word16 nchan_transport, Word32 *pFC, const Word16 nchan_inp ); +#endif // IVAS_FLOAT_FIXED static void ivas_select_next_strat( ivas_strats_t prior_strat, ivas_strats_t cs[MAX_QUANT_STRATS], const int16_t dmx_switch, const int16_t dtx_vad ); @@ -481,7 +483,7 @@ static void ivas_spar_set_enc_config( return; } - +#ifdef IVAS_FLOAT_FIXED static void ivas_spar_set_enc_config_fx( ivas_spar_md_enc_state_t *hMdEnc, Word16 *max_freq_per_chan, @@ -523,6 +525,7 @@ static void ivas_spar_set_enc_config_fx( return; } +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_band_limit_dmx_matrix() * diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 5d8dea5ff..0b919e3b0 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -64,7 +64,9 @@ *------------------------------------------------------------------------*/ static void stereo_dft_enc_open( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, const int32_t input_Fs, const int16_t max_bwidth ); +#ifdef IVAS_FLOAT_FIXED static void stereo_dft_enc_open_fx( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, const Word32 input_Fs, const Word16 max_bwidth ); +#endif // IVAS_FLOAT_FIXED static void stereo_dft_enc_compute_prm( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, float *DFT_L, float *DFT_R, int16_t k_offset, int16_t flag_quant, const int16_t sp_aud_decision0, const int16_t vad_flag, float *bin_nrgL, float *bin_nrgR, float *dot_prod_nrg_ratio ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 02aff644c..f068626cb 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -65,20 +65,22 @@ struct IVAS_ENC * Local functions *---------------------------------------------------------------------*/ -static ivas_error configureEncoder( IVAS_ENC_HANDLE hIvasEnc, const int32_t inputFs, const int32_t initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); +#ifdef IVAS_FLOAT_FIXED static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); +static ivas_error setBandwidth_fx(IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_BANDWIDTH maxBandwidth); +static ivas_error setChannelAwareConfig_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); +static ivas_error sanitizeBandwidth_fx(const IVAS_ENC_HANDLE hIvasEnc); +static ivas_error sanitizeBitrateISM_fx(const ENCODER_CONFIG_HANDLE hEncoderConfig, const bool extMetadataApi); +#endif // IVAS_FLOAT_FIXED +static ivas_error configureEncoder(IVAS_ENC_HANDLE hIvasEnc, const int32_t inputFs, const int32_t initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig); static ivas_error setBandwidth( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_BANDWIDTH maxBandwidth ); -static ivas_error setBandwidth_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_BANDWIDTH maxBandwidth ); static ivas_error setBitrate( IVAS_ENC_HANDLE hIvasEnc, const int32_t totalBitrate ); static ivas_error setChannelAwareConfig( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); -static ivas_error setChannelAwareConfig_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); static int16_t getInputBufferSize( const Encoder_Struct *st_ivas ); static ivas_error doCommonConfigureChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error doCommonSetterChecks( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBandwidth( const IVAS_ENC_HANDLE hIvasEnc ); -static ivas_error sanitizeBandwidth_fx( const IVAS_ENC_HANDLE hIvasEnc ); static ivas_error sanitizeBitrateISM( const ENCODER_CONFIG_HANDLE hEncoderConfig, const bool extMetadataApi ); -static ivas_error sanitizeBitrateISM_fx( const ENCODER_CONFIG_HANDLE hEncoderConfig, const bool extMetadataApi ); static void init_encoder_config( ENCODER_CONFIG_HANDLE hEncoderConfig ); static void resetIsmMetadataProvidedFlags( IVAS_ENC_HANDLE hIvasEnc ); static ivas_error bandwidthApiToInternal( const IVAS_ENC_BANDWIDTH maxBandwidth, int16_t *internalMaxBandwidth ); diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c index 681a407bb..0104b3c7d 100644 --- a/lib_rend/ivas_objectRenderer_hrFilt.c +++ b/lib_rend/ivas_objectRenderer_hrFilt.c @@ -217,7 +217,6 @@ void GetFilterFromAngle_fx( return; } -#endif static Word32 round_fixed( /* o : Output value Q0 */ Word32 num, /* i : Input value */ @@ -246,6 +245,7 @@ static Word32 round_fixed( /* o : Output value Q0 */ } return num; } +#endif /*-------------------------------------------------------------------* * GenerateFilter() diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c index 817b5873b..a4a09dd4c 100644 --- a/lib_rend/ivas_reverb_filter_design.c +++ b/lib_rend/ivas_reverb_filter_design.c @@ -632,7 +632,7 @@ static void response_step_limit( return; } -#endif +#else static void response_step_limit_fx( Word32 *X, @@ -720,7 +720,7 @@ static void response_step_limit_fx( } return; } - +#endif /*-------------------------------------------------------------------* * ivas_reverb_define_window_fft() * @@ -766,7 +766,7 @@ void ivas_reverb_define_window_fft( return; } -#endif +#else void ivas_reverb_define_window_fft_fx( Word32 *pWindow, //output in Q31 @@ -812,6 +812,8 @@ void ivas_reverb_define_window_fft_fx( return; } +#endif + /*-------------------------------------------------------------------* * apply_window_fft() * @@ -1103,7 +1105,7 @@ void ivas_reverb_calc_color_levels( return; } -#endif +#else void ivas_reverb_calc_color_levels_fx( const Word32 output_Fs, @@ -1244,6 +1246,8 @@ void ivas_reverb_calc_color_levels_fx( free(pTarget_color_R_e); return; } +#endif + /*-------------------------------------------------------------------* * ivas_reverb_interpolate_acoustic_data() * @@ -1301,7 +1305,7 @@ void ivas_reverb_interpolate_acoustic_data( return; } -#endif +#else void ivas_reverb_interpolate_acoustic_data_fx( const Word16 input_table_size, @@ -1365,6 +1369,7 @@ void ivas_reverb_interpolate_acoustic_data_fx( return; } +#endif /*-------------------------------------------------------------------* * ivas_reverb_get_hrtf_set_properties() * @@ -1541,7 +1546,7 @@ void ivas_reverb_get_hrtf_set_properties( return; } -#endif +#else void ivas_reverb_get_hrtf_set_properties_fx( Word32 **ppHrtf_set_L_re, @@ -1732,4 +1737,5 @@ void ivas_reverb_get_hrtf_set_properties_fx( } return; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ec4b580a2..01944f9c2 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2137,8 +2137,12 @@ static IVAS_ISM_METADATA defaultObjectPosition( pos.azimuth_fx = 0; pos.elevation_fx = 0; - -#if 1/*TODO: To be removed*/ + pos.radius_fx = ONE_IN_Q9; + pos.spread_fx = 0; + pos.gainFactor_fx = ONE_IN_Q31; + pos.yaw_fx = 0; + pos.pitch_fx = 0; +#if 0/*TODO: To be removed*/ pos.azimuth = 0.0f; pos.elevation = 0.0f; pos.radius = 1.0f; @@ -2441,19 +2445,19 @@ static ivas_error setRendInputActiveIsm( return IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED; } - if ( ( error = allocateInputBaseBufferData( &inputIsm->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) - { - return error; - } -#if 0 - initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData, MAX_BUFFER_LENGTH ); -#endif #ifdef IVAS_FLOAT_FIXED if ( ( error = allocateInputBaseBufferData_fx( &inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) { return error; } initRendInputBase_fx( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData_fx, MAX_BUFFER_LENGTH ); +#else + if ( ( error = allocateInputBaseBufferData( &inputIsm->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + { + return error; + } + + initRendInputBase( &inputIsm->base, inConfig, id, rendCtx, inputIsm->bufferData, MAX_BUFFER_LENGTH ); #endif inputIsm->firstFrameRendered = FALSE; @@ -4747,7 +4751,11 @@ static ivas_error initSbaPanGainsForMcOut( ivas_output_init( &hOutSetup, outConfig ); break; case IVAS_AUDIO_CONFIG_LS_CUSTOM: +#ifdef IVAS_FLOAT_FIXED + ivas_ls_custom_setup( &hOutSetup, (LSSETUP_CUSTOM_STRUCT *)outSetupCustom ); +#else ivas_ls_custom_setup( &hOutSetup, outSetupCustom ); +#endif break; default: assert( !"Invalid speaker config" ); @@ -8955,20 +8963,9 @@ static ivas_error renderIsmToBinaural( Word16 exp = *outAudio.pq_fact; push_wmops( "renderIsmToBinaural" ); /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ -#ifdef IVAS_FLOAT_FIXED - ism_md_subframe_update_ext = round_fx(div_l(ismInput->ism_metadata_delay_ms_fx, (1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES))); -#else - ism_md_subframe_update_ext = (Word16) roundf( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );/*To be cleaned up later*/ -#endif + ism_md_subframe_update_ext = div_l(ismInput->ism_metadata_delay_ms_fx, (1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES)); copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpTDRendBuffer ); -#if 1 - ismInput->currentPos.azimuth_fx = floatToFixed(ismInput->currentPos.azimuth, Q22); - ismInput->currentPos.elevation_fx = floatToFixed(ismInput->currentPos.elevation, Q22); - ismInput->currentPos.spread_fx = floatToFixed(ismInput->currentPos.spread, Q22); - ismInput->currentPos.yaw_fx = floatToFixed(ismInput->currentPos.yaw, Q22); - ismInput->currentPos.pitch_fx = floatToFixed(ismInput->currentPos.pitch, Q22); - ismInput->currentPos.radius_fx = float_to_fix16(ismInput->currentPos.radius, Q9); -#endif + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { Scale_sig32(tmpTDRendBuffer[i], L_FRAME48k, sub(11, exp)); @@ -9423,41 +9420,30 @@ static ivas_error renderIsmToBinauralReverb( push_wmops( "renderIsmToBinauralRoom" ); /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */ -#ifdef IVAS_FLOAT_FIXED - ism_md_subframe_update_ext = round_fx(div_l(ismInput->ism_metadata_delay_ms_fx, (1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES))); -#else - ism_md_subframe_update_ext = (Word16) roundf( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );/*ism_metadata_delay_ms :To be replaced later*/ -#endif + ism_md_subframe_update_ext = div_l( ismInput->ism_metadata_delay_ms_fx, ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); copyBufferTo2dArray_fx( ismInput->base.inputBuffer, tmpRendBuffer_fx ); -#if 1 - ismInput->currentPos.azimuth_fx = floatToFixed(ismInput->currentPos.azimuth, Q22); - ismInput->currentPos.elevation_fx = floatToFixed(ismInput->currentPos.elevation, Q22); - ismInput->currentPos.spread_fx = floatToFixed(ismInput->currentPos.spread, Q22); - ismInput->currentPos.yaw_fx = floatToFixed(ismInput->currentPos.yaw, Q22); - ismInput->currentPos.pitch_fx = floatToFixed(ismInput->currentPos.pitch, Q22); - ismInput->currentPos.radius_fx = float_to_fix16(ismInput->currentPos.radius, Q9); -#endif + FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - Scale_sig32(tmpRendBuffer_fx[i], L_FRAME48k, sub(11, exp)); + Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, sub( 11, exp ) ); } - IF ( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer_fx , &exp) ) != IVAS_ERR_OK ) + IF( ( error = ivas_td_binaural_renderer_ext_fx( &ismInput->tdRendWrapper, ismInput->base.inConfig, NULL, ismInput->base.ctx.pCombinedOrientationData, &ismInput->currentPos, ismInput->hReverb, ism_md_subframe_update_ext, *ismInput->base.ctx.pOutSampleRate, outAudio.config.numSamplesPerChannel, tmpRendBuffer_fx, &exp ) ) != IVAS_ERR_OK ) { return error; } FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - Scale_sig32(tmpRendBuffer_fx[i], L_FRAME48k, -sub(11, exp)); + Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, -sub( 11, exp ) ); } IF( ismInput->hReverb != NULL ) { - FOR ( i = 0; i < outAudio.config.numChannels; i++ ) + FOR( i = 0; i < outAudio.config.numChannels; i++ ) { - FOR ( Word16 j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) - tmpRendBuffer_fx[i][j] = L_shl( tmpRendBuffer_fx[i][j], 2 ); + FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel; j++ ) + tmpRendBuffer_fx[i][j] = L_shl( tmpRendBuffer_fx[i][j], 2 ); } } accumulate2dArrayToBuffer_fx( tmpRendBuffer_fx, &outAudio ); @@ -12576,10 +12562,6 @@ ivas_error IVAS_REND_MergeMasaMetadata( #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; - Word16 *inEne2_e; if ( hIvasRend == NULL ) { diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index 768398b8d..6fd11ed06 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -150,11 +150,6 @@ ivas_error IsmFileReader_readNextFrame( /* Invalid number of metadata parameters (2-7 supported) */ return IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT; } -#ifdef IVAS_FLOAT_FIXED - ismMetadata->azimuth_fx = floatToFixed( meta_prm[0], Q22 ); - ismMetadata->elevation_fx = floatToFixed( meta_prm[1], Q22 ); -#endif // IVAS_FLOAT_FIXED - ismMetadata->azimuth = meta_prm[0]; ismMetadata->elevation = meta_prm[1]; ismMetadata->radius = meta_prm[2]; @@ -163,6 +158,15 @@ ivas_error IsmFileReader_readNextFrame( ismMetadata->yaw = meta_prm[5]; ismMetadata->pitch = meta_prm[6]; ismMetadata->non_diegetic_flag = (int16_t) meta_prm[7]; +#ifdef IVAS_FLOAT_FIXED + ismMetadata->azimuth_fx = floatToFixed( meta_prm[0], Q22 ); + ismMetadata->elevation_fx = floatToFixed( meta_prm[1], Q22 ); + ismMetadata->radius_fx = (Word16)floatToFixed(meta_prm[2], Q9); + ismMetadata->spread_fx = floatToFixed(meta_prm[3], Q22); + ismMetadata->gainFactor_fx = floatToFixed(meta_prm[4], Q31); + ismMetadata->yaw_fx = floatToFixed(meta_prm[5], Q22); + ismMetadata->pitch_fx = floatToFixed(meta_prm[6], Q22); +#endif /* verify whether the read metadata values are in an expected range */ if ( ( ismMetadata->non_diegetic_flag ) != 0 && ( ismMetadata->non_diegetic_flag != 1 ) ) -- GitLab