From 077a57433a28f1fa30f7cf9eff304b1d4c800080 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 29 Oct 2024 08:50:46 +0530 Subject: [PATCH] Q info updates for dec and rend files --- lib_com/gs_bitallocation_ivas_fx.c | 1 + lib_com/ivas_cov_smooth.c | 1 + lib_com/ivas_filters.c | 30 +- lib_com/ivas_ism_com.c | 109 +- lib_com/ivas_lfe_com.c | 18 +- lib_com/ivas_masa_com.c | 115 +- lib_com/ivas_mc_param_com.c | 29 +- lib_com/ivas_mct_com.c | 10 +- lib_com/ivas_mdft_imdft.c | 123 +- lib_com/ivas_omasa_com.c | 100 +- lib_com/ivas_pca_tools.c | 137 +- lib_com/ivas_prot.h | 2620 ++------------------ lib_com/ivas_prot_fx.h | 2352 +++++++++++++++++- lib_com/ivas_qmetadata_com.c | 46 +- lib_com/ivas_qspherical_com.c | 58 +- lib_com/ivas_rom_com.c | 233 +- lib_com/ivas_rom_com.h | 270 +- lib_com/ivas_rom_com_fx.c | 33 +- lib_com/ivas_rom_com_fx.h | 6 +- lib_com/ivas_spar_com_quant_util.c | 1 + lib_com/ivas_stereo_ica_com_fx.c | 1 + lib_com/prot_fx.h | 12 +- lib_dec/ACcontextMapping_dec_fx.c | 1 + lib_dec/acelp_core_dec_ivas_fx.c | 1 + lib_dec/ivas_binRenderer_internal.c | 1 + lib_dec/ivas_pca_dec_fx.c | 1 + lib_dec/ivas_qspherical_dec.c | 1 + lib_dec/ivas_range_uni_dec.c | 1 + lib_dec/ivas_sns_dec_fx.c | 1 + lib_dec/ivas_spar_md_dec.c | 2 +- lib_dec/ivas_svd_dec.c | 2 +- lib_dec/ivas_td_low_rate_dec.c | 1 + lib_dec/lsf_dec_fx.c | 1 + lib_enc/cod_tcx.c | 1 + lib_enc/find_uv.c | 1 + lib_enc/ivas_enc_cov_handler.c | 1 + lib_enc/ivas_front_vad.c | 1 + lib_enc/ivas_stereo_adapt_GR_enc.c | 2 +- lib_enc/ivas_stereo_switching_enc.c | 1 + lib_enc/swb_tbe_enc_fx.c | 1 + lib_rend/ivas_crend.c | 1 + lib_rend/ivas_dirac_decorr_dec.c | 1 + lib_rend/ivas_dirac_output_synthesis_dec.c | 1 + lib_rend/ivas_hrtf.c | 1 + lib_rend/ivas_sba_rendering.c | 1 + lib_rend/ivas_vbap.c | 1 + lib_util/hrtf_file_reader.c | 1 + 47 files changed, 3192 insertions(+), 3141 deletions(-) diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index e13d04495..f8a45b4f8 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -10,6 +10,7 @@ #include "ivas_prot.h" /* Function prototypes */ #include "assert.h" /* Debug prototypes */ #include "stl.h" +#include "ivas_prot_fx.h" static void reajust_bits_fx( Word32 *bits_per_bands, const Word16 st_band, const Word16 end_band, const Word16 sum_bit_in, const Word16 bit_bdgt_in ); diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index 143ac2290..d03d548b6 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -37,6 +37,7 @@ #include "wmc_auto.h" #include "prot.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------------------------------* * Local constants diff --git a/lib_com/ivas_filters.c b/lib_com/ivas_filters.c index bc0a2fce2..425149fe0 100644 --- a/lib_com/ivas_filters.c +++ b/lib_com/ivas_filters.c @@ -38,6 +38,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com.h" +#include "ivas_prot_fx.h" #endif /*------------------------------------------------------------------------------------------* @@ -46,7 +47,12 @@ #ifndef IVAS_FLOAT_FIXED static void ivas_iir_2_filter( ivas_filters_process_state_t *filter_state, float *pIn_Out, const int16_t length, const int16_t stage ); #else -static void ivas_iir_2_filter_fx( ivas_filters_process_state_t *filter_state, Word32 *pIn_Out_fx, const Word16 length, const Word16 stage, Word16 *pIn_Out_e ); +static void ivas_iir_2_filter_fx( + ivas_filters_process_state_t *filter_state, + Word32 *pIn_Out_fx, // Q(31-*pIn_Out_e) + const Word16 length, + const Word16 stage, + Word16 *pIn_Out_e ); #endif /*-----------------------------------------------------------------------------------------* * Function ivas_filters_init() @@ -102,7 +108,7 @@ void ivas_filters_init( #else void ivas_filters_init_fx( ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - const Word32 *filt_coeff_fx, /* i : filter coefficients */ + const Word32 *filt_coeff_fx, /* i : filter coefficients Q31- *filt_coeff_e */ const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ const Word16 order ) /* i : filter order */ { @@ -233,7 +239,7 @@ void ivas_filter_process( #else void ivas_filter_process_fx( ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - Word32 *pIn_Out_fx, /* i/o: signal subject to filtering */ + Word32 *pIn_Out_fx, /* i/o: signal subject to filtering Q(q_factor) */ const Word16 length, /* i : filter order */ Word16 q_factor ) { @@ -248,7 +254,7 @@ void ivas_filter_process_fx( /* Scale pIn_Out_fx back to input Q */ FOR( i = 0; i < length; i++ ) { - pIn_Out_fx[i] = L_shr_r_sat( pIn_Out_fx[i], sub( sub( 31, q_factor ), pIn_Out_e[i] ) ); + pIn_Out_fx[i] = L_shr_r_sat( pIn_Out_fx[i], sub( sub( 31, q_factor ), pIn_Out_e[i] ) ); // Q(31-pIn_Out_e[i]) -> Q(q_factor) move32(); } BREAK; @@ -261,7 +267,7 @@ void ivas_filter_process_fx( /* Scale pIn_Out_fx back to input Q */ FOR( i = 0; i < length; i++ ) { - pIn_Out_fx[i] = L_shr_r_sat( pIn_Out_fx[i], sub( sub( 31, q_factor ), pIn_Out_e[i] ) ); + pIn_Out_fx[i] = L_shr_r_sat( pIn_Out_fx[i], sub( sub( 31, q_factor ), pIn_Out_e[i] ) ); // Q(31-pIn_Out_e[i]) -> Q(q_factor) move32(); } BREAK; @@ -308,7 +314,7 @@ static void ivas_iir_2_filter( #else static void ivas_iir_2_filter_fx( ivas_filters_process_state_t *filter_state, - Word32 *pIn_Out_fx, + Word32 *pIn_Out_fx, // Q(31-*pIn_Out_e) const Word16 length, const Word16 stage, Word16 *pIn_Out_e ) @@ -330,23 +336,23 @@ static void ivas_iir_2_filter_fx( tmp_pIn_buf_i_e = pIn_Out_e[i]; move16(); - L_tmp_prod = Mpy_32_32( filter_state->num_fx[stage][0], pIn_fx[i] ); + L_tmp_prod = Mpy_32_32( filter_state->num_fx[stage][0], pIn_fx[i] ); // Q31 -(pIn_Out_e[i]+ filter_state->num_e[stage][0]) L_prod_e = add( pIn_Out_e[i], filter_state->num_e[stage][0] ); - pOut_fx[i] = BASOP_Util_Add_Mant32Exp( filter_state->state_fx[stage][0], filter_state->state_e[stage][0], L_tmp_prod, L_prod_e, &pIn_Out_e[i] ); + pOut_fx[i] = BASOP_Util_Add_Mant32Exp( filter_state->state_fx[stage][0], filter_state->state_e[stage][0], L_tmp_prod, L_prod_e, &pIn_Out_e[i] ); // Q31 - pIn_Out_e[i] move32(); FOR( j = 1; j < filter_state->filt_len; j++ ) { - L_tmp_prod = Mpy_32_32( filter_state->num_fx[stage][j], tmp_pIn_buf_i_fx ); + L_tmp_prod = Mpy_32_32( filter_state->num_fx[stage][j], tmp_pIn_buf_i_fx ); // Q31-L_prod_e L_prod_e = add( filter_state->num_e[stage][j], tmp_pIn_buf_i_e ); - L_tmp = BASOP_Util_Add_Mant32Exp( filter_state->state_fx[stage][j], filter_state->state_e[stage][j], L_tmp_prod, L_prod_e, &L_tmp_e ); + L_tmp = BASOP_Util_Add_Mant32Exp( filter_state->state_fx[stage][j], filter_state->state_e[stage][j], L_tmp_prod, L_prod_e, &L_tmp_e ); // Q31 - L_tmp_e - L_tmp_prod = Mpy_32_32( filter_state->den_fx[stage][j], pOut_fx[i] ); + L_tmp_prod = Mpy_32_32( filter_state->den_fx[stage][j], pOut_fx[i] ); // Q31 - ( pIn_Out_e[i]+filter_state->den_e[stage][j] ) L_prod_e = add( pIn_Out_e[i], filter_state->den_e[stage][j] ); - filter_state->state_fx[stage][j - 1] = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, L_negate( L_tmp_prod ), L_prod_e, &filter_state->state_e[stage][j - 1] ); + filter_state->state_fx[stage][j - 1] = BASOP_Util_Add_Mant32Exp( L_tmp, L_tmp_e, L_negate( L_tmp_prod ), L_prod_e, &filter_state->state_e[stage][j - 1] ); // Q31 - filter_state->state_e[stage][j - 1] move32(); } } diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index 583051b23..d871ebe6d 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -52,10 +52,10 @@ #define BITS_ISM_INACTIVE ( BRATE_ISM_INACTIVE / FRAMES_PER_SEC ) #define BETA_ISM_LOW_IMP 0.6f -#define BETA_ISM_LOW_IMP_Q31 ( 1288490189 ) +#define BETA_ISM_LOW_IMP_Q31 ( 1288490189 ) // 0.6 in Q31 #define BETA_ISM_MEDIUM_IMP 0.8f -#define BETA_ISM_MEDIUM_IMP_Q31 ( 1717986918 ) -#define BETA_ISM_MEDIUM_IMP_BY_8_Q31 ( 214748365 ) +#define BETA_ISM_MEDIUM_IMP_Q31 ( 1717986918 ) // 0.8 in Q31 +#define BETA_ISM_MEDIUM_IMP_BY_8_Q31 ( 214748365 ) // 0.8 in Q29 #define MAX_BRATE_TCX_32k 48000 #define BITS_IVAS_512k ( IVAS_512k / FRAMES_PER_SEC ) @@ -74,8 +74,8 @@ #ifdef IVAS_FLOAT_FIXED void bitbudget_to_brate( - const Word16 x[], /* i : bitbudgets */ - Word32 y[], /* o : bitrates */ + const Word16 x[], /* i : bitbudgets Q0 */ + Word32 y[], /* o : bitrates Q0 */ const Word16 N /* i : number of entries to be converted */ ) { @@ -83,7 +83,7 @@ void bitbudget_to_brate( FOR( i = 0; i < N; i++ ) { - y[i] = FRAMES_PER_SEC * x[i]; + y[i] = L_mult0( FRAMES_PER_SEC, x[i] ); move32(); } @@ -466,10 +466,10 @@ ivas_error ivas_ism_config_fx( { /* combined format: decision about bitrates per channel - variable during the session (at one ivas_total_brate) */ // bits_ism = (Word16) ( ism_total_brate / FRAMES_PER_SEC ); - bits_ism = (Word16) Mpy_32_32( 42949673, ism_total_brate ); - tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp ); + bits_ism = (Word16) Mpy_32_32( 42949673, ism_total_brate ); // 42949673 is 1/FRAMES_PER_SEC in Q31 + tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp ); // Q15 - exp set16_fx( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms ); - bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); + bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); // Q0 move16(); /* ISM common signaling bits are counted in MASA MD bit-budget */ @@ -480,17 +480,17 @@ ivas_error ivas_ism_config_fx( // bits_ism = (Word16) ( ism_total_brate / FRAMES_PER_SEC ); // 1 / 50 * 2 ^ 31 -- > 42949673, --> Q31, //(Q31 +Q0) - Q31 --> Q0 - bits_ism = (Word16) Mpy_32_32( 42949673, ism_total_brate ); - tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp ); + bits_ism = (Word16) Mpy_32_32( 42949673, ism_total_brate ); // 42949673 is 1/FRAMES_PER_SEC in Q31 + tmp1 = BASOP_Util_Divide1616_Scale( bits_ism, n_ISms, &exp ); // Q15 - exp set16_fx( bits_element, shr( tmp1, sub( 15, exp ) ), n_ISms ); - bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); + bits_element[n_ISms - 1] = add( bits_element[n_ISms - 1], bits_ism % n_ISms ); // Q0 move16(); bitbudget_to_brate( bits_element, element_brate, n_ISms ); /* count ISm common signaling bits */ IF( hIsmMeta != NULL ) { - nb_bits_metadata[0] = add( nb_bits_metadata[0], add( n_ISms * ISM_METADATA_FLAG_BITS, nchan_ism ) ); + nb_bits_metadata[0] = add( nb_bits_metadata[0], add( imult1616( n_ISms, ISM_METADATA_FLAG_BITS ), nchan_ism ) ); move16(); IF( GE_32( ism_total_brate, ISM_EXTENDED_METADATA_BRATE ) ) @@ -534,9 +534,9 @@ ivas_error ivas_ism_config_fx( IF( nb_bits_metadata != NULL ) { bits_side = sum_s( nb_bits_metadata, n_ISms ); - tmp1 = BASOP_Util_Divide1616_Scale( bits_side, n_ISms, &exp ); - set16_fx( nb_bits_metadata, shr( tmp1, ( 15 - exp ) ), n_ISms ); - nb_bits_metadata[n_ISms - 1] = add( nb_bits_metadata[n_ISms - 1], bits_side % n_ISms ); + tmp1 = BASOP_Util_Divide1616_Scale( bits_side, n_ISms, &exp ); // Q15 - exp + set16_fx( nb_bits_metadata, shr( tmp1, sub( 15, exp ) ), n_ISms ); + nb_bits_metadata[n_ISms - 1] = add( nb_bits_metadata[n_ISms - 1], bits_side % n_ISms ); // Q0 move16(); v_sub_s( bits_element, nb_bits_metadata, bits_CoreCoder, n_ISms ); bitbudget_to_brate( bits_CoreCoder, total_brate, n_ISms ); @@ -629,7 +629,7 @@ ivas_error ivas_ism_config_fx( ELSE IF( EQ_16( ism_imp[ch], ISM_MEDIUM_IMP ) ) { // tmp = (Word16) ( BETA_ISM_MEDIUM_IMP * bits_CoreCoder[ch] ); - tmp = extract_l( Mpy_32_32( BETA_ISM_MEDIUM_IMP_BY_8_Q31, L_shl( bits_CoreCoder[ch], Q3 ) ) ); + tmp = extract_l( Mpy_32_32( BETA_ISM_MEDIUM_IMP_BY_8_Q31, L_shl( bits_CoreCoder[ch], Q3 ) ) ); // Q0 tmp = s_max( limit, tmp ); } ELSE /* ism_imp[ch] == ISM_HIGH_IMP */ @@ -638,7 +638,7 @@ ivas_error ivas_ism_config_fx( move16(); } - diff = add( diff, sub( bits_CoreCoder[ch], tmp ) ); + diff = add( diff, sub( bits_CoreCoder[ch], tmp ) ); // Q0 bits_CoreCoder[ch] = tmp; move16(); } @@ -646,8 +646,8 @@ ivas_error ivas_ism_config_fx( test(); IF( diff > 0 && n_higher > 0 ) { - tmp = BASOP_Util_Divide1616_Scale( diff, n_higher, &exp ); - tmp = shr( tmp, sub( 15, exp ) ); + tmp = BASOP_Util_Divide1616_Scale( diff, n_higher, &exp ); // Q15-exp + tmp = shr( tmp, sub( 15, exp ) ); // Q0 FOR( ch = 0; ch < n_ISms; ch++ ) { IF( flag_higher[ch] ) @@ -696,7 +696,7 @@ ivas_error ivas_ism_config_fx( diff = 0; move16(); limit_high = BITS_MAX_BRATE_TCX_32k; - + move16(); FOR( ch = 0; ch < n_ISms; ch++ ) { tmp = (Word16) s_min( bits_CoreCoder[ch], limit_high ); @@ -788,7 +788,7 @@ void ivas_ism_reset_metadata( move32(); hIsmMeta->pitch_fx = 0; move32(); - hIsmMeta->radius_fx = 1 << 9; + hIsmMeta->radius_fx = ONE_IN_Q9; // Q9 move16(); hIsmMeta->ism_metadata_flag = 0; @@ -811,7 +811,7 @@ void ivas_ism_reset_metadata_enc( move32(); hIsmMeta->pitch_fx = 0; move32(); - hIsmMeta->radius_fx = 1 << 9; // Q9 + hIsmMeta->radius_fx = ONE_IN_Q9; // Q9 move16(); hIsmMeta->ism_metadata_flag = 0; move16(); @@ -897,8 +897,8 @@ Word16 ism_quant_meta_fx( { qlow_fx = borders_fx[1]; move32(); - tmp = BASOP_Util_Divide3232_Scale( L_sub( borders_fx[1], borders_fx[0] ), q_step_border_fx, &tmp_e ); - idx_start = shr( tmp, sub( 15, tmp_e ) ); + tmp = BASOP_Util_Divide3232_Scale( L_sub( borders_fx[1], borders_fx[0] ), q_step_border_fx, &tmp_e ); // Q15-tmp_e + idx_start = shr( tmp, sub( 15, tmp_e ) ); // Q0 step_fx = q_step_fx; move32(); } @@ -906,21 +906,21 @@ Word16 ism_quant_meta_fx( { qlow_fx = borders_fx[2]; move32(); - tmp = BASOP_Util_Divide3232_Scale( L_add( L_sub( borders_fx[3], borders_fx[2] ), L_sub( q_step_border_fx, ONE_IN_Q22 ) ), q_step_border_fx, &tmp_e ); - idx_start = sub( cbsize, add( 1, shr( tmp, sub( 15, tmp_e ) ) ) ); + tmp = BASOP_Util_Divide3232_Scale( L_add( L_sub( borders_fx[3], borders_fx[2] ), L_sub( q_step_border_fx, ONE_IN_Q22 ) ), q_step_border_fx, &tmp_e ); // Q15-tmp_e + idx_start = sub( cbsize, add( 1, shr( tmp, sub( 15, tmp_e ) ) ) ); // Q0 step_fx = q_step_border_fx; move32(); } - tmp = BASOP_Util_Divide3232_Scale( L_sub( val, qlow_fx ), step_fx, &tmp_e ); - tmp = shl( tmp, sub( Q1, sub( 15, tmp_e ) ) ); + tmp = BASOP_Util_Divide3232_Scale( L_sub( val, qlow_fx ), step_fx, &tmp_e ); // Q15-tmp_e + tmp = shl( tmp, sub( Q1, sub( 15, tmp_e ) ) ); // Q0 tmp = add( tmp, 1 ); tmp = shr( tmp, 1 ); - idx = add( idx_start, s_max( 0, s_min( sub( cbsize, 1 ), tmp ) ) ); + idx = add( idx_start, s_max( 0, s_min( sub( cbsize, 1 ), tmp ) ) ); // Q0 // idx = idx_start + (int16_t) max( 0.f, min( cbsize - 1, ( ( val - qlow_fx ) / step_fx + 0.5f ) ) ); - *valQ = L_add( imult3216( step_fx, sub( idx, idx_start ) ), qlow_fx ); + *valQ = L_add( imult3216( step_fx, sub( idx, idx_start ) ), qlow_fx ); // Q0 move32(); return idx; @@ -973,29 +973,29 @@ int16_t ism_quant_meta( /*! r: dequantized value */ #ifdef IVAS_FLOAT_FIXED -Word32 ism_dequant_meta_fx( - const Word16 idx, /* i : quantizer index */ - const Word32 borders_fx[], /* i : level borders */ - const Word32 q_step_fx, /* i : quantization step */ - const Word32 q_step_border_fx, /* i : quantization step at the border */ - const Word16 cbsize /* i : codebook size */ +Word32 ism_dequant_meta_fx( /* o : Q22*/ + const Word16 idx, /* i : quantizer index */ + const Word32 borders_fx[], /* i : level borders Q22*/ + const Word32 q_step_fx, /* i : quantization step Q22 */ + const Word32 q_step_border_fx, /* i : quantization step at the border Q22*/ + const Word16 cbsize /* i : codebook size */ ) { Word16 idx_start, tmp1, tmp2, exp1, exp2; Word32 qlow_fx, step_fx, valQ_fx; tmp1 = BASOP_Util_Divide3232_Scale( L_shr( L_sub( borders_fx[1], borders_fx[0] ), 21 ), L_shr( q_step_border_fx, 21 ), &exp1 ); - tmp1 = shr( tmp1, sub( 15, exp1 ) ); + tmp1 = shr( tmp1, sub( 15, exp1 ) ); // Q0 tmp2 = BASOP_Util_Divide3232_Scale( L_shr( L_sub( borders_fx[3], borders_fx[2] ), 21 ), L_shr( q_step_border_fx, 21 ), &exp2 ); - tmp2 = shr( tmp2, sub( 15, exp2 ) ); + tmp2 = shr( tmp2, sub( 15, exp2 ) ); // Q0 IF( LE_16( idx, tmp1 ) ) { - qlow_fx = borders_fx[0]; + qlow_fx = borders_fx[0]; // Q22 idx_start = 0; - step_fx = q_step_border_fx; + step_fx = q_step_border_fx; // Q22 move32(); move32(); @@ -1003,9 +1003,9 @@ Word32 ism_dequant_meta_fx( } ELSE IF( LE_16( idx, sub( sub( cbsize, 1 ), tmp2 ) ) ) { - qlow_fx = borders_fx[1]; + qlow_fx = borders_fx[1]; // Q22 idx_start = tmp1; - step_fx = q_step_fx; + step_fx = q_step_fx; // Q22 move32(); move32(); @@ -1015,14 +1015,14 @@ Word32 ism_dequant_meta_fx( { qlow_fx = borders_fx[2]; idx_start = (Word16) sub( sub( cbsize, 1 ), tmp2 ); - step_fx = q_step_border_fx; + step_fx = q_step_border_fx; // Q22 move32(); move32(); move16(); } - valQ_fx = L_add( sub( idx, idx_start ) * step_fx, qlow_fx ); + valQ_fx = L_add( sub( idx, idx_start ) * step_fx, qlow_fx ); // Q22 return valQ_fx; } @@ -1129,7 +1129,8 @@ void ivas_param_ism_config_fx( move16(); } - hParamIsm->last_dmx_gain_fx = (Word16) 16384; + hParamIsm->last_dmx_gain_fx = (Word16) 16384; // Q15-last_dmx_gain_e + move16(); hParamIsm->last_dmx_gain_e = 1; move16(); set16_fx( hParamIsm->last_cardioid_left_fx, (Word16) 16384, MAX_NUM_OBJECTS ); @@ -1293,9 +1294,9 @@ void update_last_metadata_fx( { IF( EQ_16( updt_flag[ch], 1 ) ) { - hIsmMeta[ch]->last_azimuth_fx = hIsmMeta[ch]->azimuth_fx; + hIsmMeta[ch]->last_azimuth_fx = hIsmMeta[ch]->azimuth_fx; // Q22 move32(); - hIsmMeta[ch]->last_elevation_fx = hIsmMeta[ch]->elevation_fx; + hIsmMeta[ch]->last_elevation_fx = hIsmMeta[ch]->elevation_fx; // Q22 move32(); } } @@ -1315,16 +1316,16 @@ void ivas_get_ism_sid_quan_bitbudget_fx( const Word16 nchan_ism, /* i : number of objects */ Word16 *nBits_azimuth, /* o : number of Q bits for azimuth */ Word16 *nBits_elevation, /* o : number of Q bits for elevation */ - Word32 *q_step_fx, /* o : quantization step */ - Word32 *q_step_border_fx, /* o : quantization step at the border */ + Word32 *q_step_fx, /* o : quantization step Q22*/ + Word32 *q_step_border_fx, /* o : quantization step at the border Q22*/ Word16 *nBits_coh, /* o : number of Q bits for coherence */ Word16 *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ) { *nBits_azimuth = ISM_DTX_AZI_BITS_HIGH; *nBits_elevation = ISM_DTX_ELE_BITS_HIGH; - *q_step_fx = ISM_Q_STEP_HIGH_FX; - *q_step_border_fx = ISM_Q_STEP_BORDER_HIGH_FX; + *q_step_fx = ISM_Q_STEP_HIGH_FX; // Q22 + *q_step_border_fx = ISM_Q_STEP_BORDER_HIGH_FX; // Q22 *nBits_coh = ISM_DTX_COH_SCA_BITS; *nBits_sce_id = 1; @@ -1339,8 +1340,8 @@ void ivas_get_ism_sid_quan_bitbudget_fx( { *nBits_azimuth = ISM_DTX_AZI_BITS_LOW; *nBits_elevation = ISM_DTX_ELE_BITS_LOW; - *q_step_fx = ISM_Q_STEP_LOW_FX; - *q_step_border_fx = ISM_Q_STEP_BORDER_LOW_FX; + *q_step_fx = ISM_Q_STEP_LOW_FX; // Q22 + *q_step_border_fx = ISM_Q_STEP_BORDER_LOW_FX; // Q22 *nBits_sce_id = 2; move16(); diff --git a/lib_com/ivas_lfe_com.c b/lib_com/ivas_lfe_com.c index 95797ef84..7f68dda86 100644 --- a/lib_com/ivas_lfe_com.c +++ b/lib_com/ivas_lfe_com.c @@ -116,13 +116,13 @@ void ivas_lfe_lpf_select_filt_coeff_fx( SWITCH( sampling_rate ) { case 16000: - *ppFilt_coeff_fx = ivas_lpf_2_butter_16k_fx; + *ppFilt_coeff_fx = ivas_lpf_2_butter_16k_fx; // Q30 BREAK; case 32000: - *ppFilt_coeff_fx = ivas_lpf_2_butter_32k_fx; + *ppFilt_coeff_fx = ivas_lpf_2_butter_32k_fx; // Q30 BREAK; case 48000: - *ppFilt_coeff_fx = ivas_lpf_2_butter_48k_fx; + *ppFilt_coeff_fx = ivas_lpf_2_butter_48k_fx; // Q30 BREAK; default: BREAK; @@ -132,15 +132,15 @@ void ivas_lfe_lpf_select_filt_coeff_fx( SWITCH( sampling_rate ) { case 16000: - *ppFilt_coeff_fx = ivas_lpf_4_butter_16k_sos_fx; + *ppFilt_coeff_fx = ivas_lpf_4_butter_16k_sos_fx; // Q31-ivas_lpf_4_butter_16k_sos_e *ppFilt_coeff_e = ivas_lpf_4_butter_16k_sos_e; BREAK; case 32000: - *ppFilt_coeff_fx = ivas_lpf_4_butter_32k_sos_fx; + *ppFilt_coeff_fx = ivas_lpf_4_butter_32k_sos_fx; // Q31-ivas_lpf_4_butter_32k_sos_e *ppFilt_coeff_e = ivas_lpf_4_butter_32k_sos_e; BREAK; case 48000: - *ppFilt_coeff_fx = ivas_lpf_4_butter_48k_sos_fx; + *ppFilt_coeff_fx = ivas_lpf_4_butter_48k_sos_fx; // Q31-ivas_lpf_4_butter_48k_sos_e *ppFilt_coeff_e = ivas_lpf_4_butter_48k_sos_e; BREAK; default: @@ -172,15 +172,15 @@ void ivas_lfe_window_init_fx( /* Set window coefficients */ IF( EQ_32( sampling_rate, 48000 ) ) { - hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_48k_fx; + hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_48k_fx; // Q31 } ELSE IF( EQ_32( sampling_rate, 32000 ) ) { - hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_32k_fx; + hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_32k_fx; // Q31 } ELSE IF( EQ_32( sampling_rate, 16000 ) ) { - hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_16k_fx; + hLFEWindow->pWindow_coeffs_fx = ivas_lfe_window_coeff_16k_fx; // Q31 } ELSE { diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 5d91190bb..fc19d2dc1 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -63,9 +63,18 @@ static int16_t quantize_theta_masa( float x, const int16_t no_cb, float *xhat ); static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *phi_hat, const int16_t n ); #else -static Word16 quantize_theta_masa_fx( const Word32 x_fx, const Word16 no_cb, Word32 *xhat_fx ); +static Word16 quantize_theta_masa_fx( + const Word32 x_fx, /* i : theta value to be quantized Q22*/ + const Word16 no_cb, /* i : number of codewords */ + Word32 *xhat_fx /* o : quantized value Q22*/ +); -static Word16 quantize_phi_masa_fx( const Word32 phi, const Word16 flag_delta, Word32 *phi_hat, const Word16 n ); +static Word16 quantize_phi_masa_fx( + const Word32 phi_fx, /* i : azimuth value Q22 */ + const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ + Word32 *phi_hat_fx, /* o : quantized azimuth Q22 */ + const Word16 n /* i : azimuth codebook size */ +); static Word32 estim_round[MASA_NO_CIRCLES + 1] = { /* Q0 */ @@ -452,7 +461,7 @@ void ivas_masa_set_elements_fx( *nCPE = 1; move16(); - IF( EQ_16( *element_mode, -1 ) ) + if ( EQ_16( *element_mode, -1 ) ) { *element_mode = IVAS_CPE_DFT; /* To have it initialized in case it was not already. */ move16(); @@ -464,7 +473,7 @@ void ivas_masa_set_elements_fx( test(); test(); test(); - IF( ( EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) && LT_32( L_sub( ivas_total_brate, ism_total_brate ), MIN_BRATE_MDCT_STEREO ) ) + if ( ( EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) && LT_32( L_sub( ivas_total_brate, ism_total_brate ), MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_DFT; move16(); @@ -478,7 +487,7 @@ void ivas_masa_set_elements_fx( *nSCE = 0; move16(); - IF( GT_32( ivas_total_brate, MIN_BRATE_MDCT_STEREO ) ) + if ( GT_32( ivas_total_brate, MIN_BRATE_MDCT_STEREO ) ) { *element_mode = IVAS_CPE_MDCT; move16(); @@ -489,7 +498,7 @@ void ivas_masa_set_elements_fx( test(); test(); test(); - IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) && ( EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_DISC ) ) ) + if ( EQ_16( ivas_format, MASA_ISM_FORMAT ) && ( EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_16( ism_mode, ISM_MASA_MODE_DISC ) ) ) { /* hQMetaData->bits_frame_nominal -= (int16_t) ( ism_total_brate / FRAMES_PER_SEC ); */ tmp = extract_l( Mpy_32_32( ism_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); @@ -818,7 +827,7 @@ void ivas_masa_set_coding_config_fx( test(); test(); test(); - IF( ( GT_32( ivas_total_brate, IVAS_96k ) && !config->joinedSubframes ) || ( GT_32( ivas_total_brate, IVAS_80k ) && config->joinedSubframes ) ) + if ( ( GT_32( ivas_total_brate, IVAS_96k ) && !config->joinedSubframes ) || ( GT_32( ivas_total_brate, IVAS_80k ) && config->joinedSubframes ) ) { idx_bands = sub( idx_bands, 1 ); } @@ -839,7 +848,7 @@ void ivas_masa_set_coding_config_fx( move16(); test(); - IF( EQ_32( ivas_total_brate, IVAS_64k ) && GT_16( config->numberOfDirections, 1 ) ) + if ( EQ_32( ivas_total_brate, IVAS_64k ) && GT_16( config->numberOfDirections, 1 ) ) { /* At 64k, we increase metadata bit budget when there is two directions present. */ config->max_metadata_bits = (UWord16) add( config->max_metadata_bits, MASA_EXTRA_BAND_META_BITS ); @@ -849,7 +858,7 @@ void ivas_masa_set_coding_config_fx( test(); test(); test(); - IF( ( ( EQ_32( ivas_total_brate, IVAS_32k ) && EQ_16( nchan_transport, 2 ) ) || EQ_32( ivas_total_brate, IVAS_48k ) ) && config->joinedSubframes ) + if ( ( ( EQ_32( ivas_total_brate, IVAS_32k ) && EQ_16( nchan_transport, 2 ) ) || EQ_32( ivas_total_brate, IVAS_48k ) ) && config->joinedSubframes ) { /* At 32k and 48k, we increase metadata bit budget when joinedSubframes. */ config->max_metadata_bits = (UWord16) add( config->max_metadata_bits, MASA_SMALL_INC_META_BITS ); @@ -906,7 +915,7 @@ void ivas_masa_set_coding_config_fx( test(); test(); test(); - IF( ( !isMcMasa && LT_32( ivas_total_brate, IVAS_48k ) ) || ( isMcMasa && LT_32( ivas_total_brate, IVAS_16k4 ) ) ) + if ( ( !isMcMasa && LT_32( ivas_total_brate, IVAS_48k ) ) || ( isMcMasa && LT_32( ivas_total_brate, IVAS_16k4 ) ) ) { config->useCoherence = FALSE; move16(); @@ -1262,8 +1271,8 @@ uint16_t index_theta_phi_16( } #else UWord16 index_theta_phi_16_fx( - Word32 *p_theta, /* i/o: input elevation to be indexed */ - Word32 *p_phi, /* i/o: input azimuth to be indexed */ + Word32 *p_theta, /* i/o: input elevation to be indexed Q22 */ + Word32 *p_phi, /* i/o: input azimuth to be indexed Q22 */ const SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ ) { @@ -1274,25 +1283,25 @@ UWord16 index_theta_phi_16_fx( Word32 theta_hat_fx, phi_hat_fx; Word32 theta_fx, phi_fx; - theta_fx = *p_theta; + theta_fx = *p_theta; // Q22 move32(); - phi_fx = *p_phi; + phi_fx = *p_phi; // Q22 move32(); phi_hat_fx = 0; move32(); theta_hat_fx = 0; move32(); - phi_fx = L_add( phi_fx, L_shl( 180, Q22 ) ); + phi_fx = L_add( phi_fx, L_shl( 180, Q22 ) ); // Q22 IF( theta_fx < 0 ) { - abs_theta_fx = L_negate( theta_fx ); + abs_theta_fx = L_negate( theta_fx ); // Q22 sign_th = -1; move16(); } ELSE { - abs_theta_fx = theta_fx; + abs_theta_fx = theta_fx; // Q22 move32(); sign_th = 1; move16(); @@ -1309,7 +1318,7 @@ UWord16 index_theta_phi_16_fx( { id_phi = 0; move16(); - phi_hat_fx = L_shl( 180, Q22 ); + phi_hat_fx = L_shl( 180, Q22 ); // Q22 } } ELSE @@ -1319,12 +1328,12 @@ UWord16 index_theta_phi_16_fx( *p_theta = theta_hat_fx; move32(); - IF( EQ_16( sign_th, -1 ) ) + if ( EQ_16( sign_th, -1 ) ) { - *p_theta = L_negate( theta_hat_fx ); + *p_theta = L_negate( theta_hat_fx ); // Q22 move32(); } - *p_phi = L_sub( phi_hat_fx, L_shl( 180, Q22 ) ); + *p_phi = L_sub( phi_hat_fx, L_shl( 180, Q22 ) ); // Q22 move32(); /* Starting from Equator, alternating positive and negative */ @@ -1337,34 +1346,34 @@ UWord16 index_theta_phi_16_fx( { IF( EQ_16( id_th, sub( gridData->no_theta, 1 ) ) ) { - idx_sph = 65534; + idx_sph = 65534; // Q0 move16(); if ( sign_th < 0 ) { - idx_sph = 65535; + idx_sph = 65535; // Q0 move16(); } } ELSE { - cum_n = cum_n_for_id_th[id_th]; + cum_n = cum_n_for_id_th[id_th]; // Q0 move16(); - cum_n = (UWord16) L_add( cum_n, gridData->no_phi[0] ); + cum_n = (UWord16) L_add( cum_n, gridData->no_phi[0] ); // Q0 IF( sign_th > 0 ) { - cum_n = (UWord16) L_sub( cum_n, shl( gridData->no_phi[id_th], 1 ) ); + cum_n = (UWord16) L_sub( cum_n, shl( gridData->no_phi[id_th], 1 ) ); // Q0 } ELSE { - cum_n = (UWord16) L_sub( cum_n, gridData->no_phi[id_th] ); + cum_n = (UWord16) L_sub( cum_n, gridData->no_phi[id_th] ); // Q0 } - idx_sph = (UWord16) L_add( cum_n, id_phi ); + idx_sph = (UWord16) L_add( cum_n, id_phi ); // Q0 } } - return idx_sph; + return idx_sph; // Q0 } #endif @@ -1412,9 +1421,9 @@ static int16_t quantize_theta_masa( } #else static Word16 quantize_theta_masa_fx( - const Word32 x_fx, /* i : theta value to be quantized */ + const Word32 x_fx, /* i : theta value to be quantized Q22*/ const Word16 no_cb, /* i : number of codewords */ - Word32 *xhat_fx /* o : quantized value */ + Word32 *xhat_fx /* o : quantized value Q22*/ ) { Word16 imin; @@ -1425,7 +1434,7 @@ static Word16 quantize_theta_masa_fx( IF( GE_16( imin, sub( no_cb, 1 ) ) ) { imin = sub( no_cb, 1 ); - diff1_fx = L_sub( x_fx, L_shl( 90, Q22 ) ); + diff1_fx = L_sub( x_fx, L_shl( 90, Q22 ) ); // Q22 diff2_fx = L_sub( x_fx, Mpy_32_16_1( MASA_ANGLE_AT_EQUATOR_DEG_Q31, shl( sub( imin, 1 ), 6 ) ) ); // q31 + q0+6 - 15 = q22 IF( GT_32( L_abs( diff1_fx ), L_abs( diff2_fx ) ) ) { @@ -1435,7 +1444,7 @@ static Word16 quantize_theta_masa_fx( } ELSE { - *xhat_fx = L_shl( 90, Q22 ); + *xhat_fx = L_shl( 90, Q22 ); // Q22 move32(); } } @@ -1505,9 +1514,9 @@ static int16_t quantize_phi_masa( } #else static Word16 quantize_phi_masa_fx( - const Word32 phi_fx, /* i : azimuth value */ + const Word32 phi_fx, /* i : azimuth value Q22 */ const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ - Word32 *phi_hat_fx, /* o : quantized azimuth */ + Word32 *phi_hat_fx, /* o : quantized azimuth Q22 */ const Word16 n /* i : azimuth codebook size */ ) { @@ -1519,7 +1528,7 @@ static Word16 quantize_phi_masa_fx( Word16 tmp_e, delta_phi_e; delta_phi_fx = L_deposit_h( BASOP_Util_Divide1616_Scale( 360, n, &delta_phi_e ) ); - delta_phi_fx = L_shr( delta_phi_fx, sub( sub( 31, delta_phi_e ), 22 ) ); + delta_phi_fx = L_shr( delta_phi_fx, sub( sub( 31, delta_phi_e ), 22 ) ); // Q22 IF( EQ_16( n, 1 ) ) { @@ -1531,7 +1540,7 @@ static Word16 quantize_phi_masa_fx( IF( EQ_16( flag_delta, 1 ) ) { - dd_fx = L_shr( delta_phi_fx, 1 ); + dd_fx = L_shr( delta_phi_fx, 1 ); // Q22 } ELSE { @@ -1541,15 +1550,15 @@ static Word16 quantize_phi_masa_fx( tmp32 = L_add( L_sub( phi_fx, dd_fx ), L_shr( delta_phi_fx, 1 ) ); id_phi = BASOP_Util_Divide3232_Scale( tmp32, delta_phi_fx, &tmp_e ); - id_phi = shr( id_phi, sub( 15, tmp_e ) ); + id_phi = shr( id_phi, sub( 15, tmp_e ) ); // Q0 - IF( EQ_16( id_phi, n ) ) + if ( EQ_16( id_phi, n ) ) { id_phi = 0; move16(); } - IF( EQ_16( id_phi, -1 ) ) + if ( EQ_16( id_phi, -1 ) ) { id_phi = sub( n, 1 ); } @@ -1557,7 +1566,7 @@ static Word16 quantize_phi_masa_fx( *phi_hat_fx = L_add( L_shl( Mpy_32_16_1( delta_phi_fx, id_phi ), 15 ), dd_fx ); // q22 + q0 - 15 = q7 -> q7 + 15 = q22 move32(); - return id_phi; + return id_phi; // Q0 } #endif @@ -1716,8 +1725,8 @@ void deindex_sph_idx( void deindex_sph_idx_fx( const UWord16 sphIndex, /* i : Spherical index */ const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ - Word32 *theta_fx, /* o : Elevation */ - Word32 *phi_fx /* o : Azimuth */ + Word32 *theta_fx, /* o : Elevation Q22*/ + Word32 *phi_fx /* o : Azimuth Q22 */ ) { Word32 ba_crt_fx, del_crt_fx, div_crt_fx, a4_crt_fx; @@ -1788,14 +1797,15 @@ void deindex_sph_idx_fx( tmp32 = Mpy_32_32( a4_crt_fx, L_shl_sat( sphIndex, Q15 ) ); /* Q10 */ tmp32 = L_add( del_crt_fx, tmp32 ); /* Q10 */ tmp16 = Q31 - Q10; - tmp32 = Sqrt32( tmp32, &tmp16 ); - tmp32 = Mpy_32_32( div_crt_fx, tmp32 ); + move16(); + tmp32 = Sqrt32( tmp32, &tmp16 ); // Q31-tmp16 + tmp32 = Mpy_32_32( div_crt_fx, tmp32 ); // Q31-tmp16 tmp32 = L_shr( tmp32, sub( Q8, tmp16 ) ); /* Q23 */ estim_fx = L_add( ba_crt_fx, tmp32 ); /* Q23 */ if ( GT_32( estim_fx, MASA_NO_CIRCLES_Q23 ) ) { - estim_fx = MASA_NO_CIRCLES_Q23; + estim_fx = MASA_NO_CIRCLES_Q23; // Q23 move32(); } @@ -1990,6 +2000,7 @@ Word16 valid_ratio_index_fx( FOR( i = 1; i < len; i++ ) { base[i] = i_mult( base[i - 1], 10 ); + move16(); } sum = 0; move16(); @@ -2075,7 +2086,7 @@ void reconstruct_ism_ratios_fx( q_energy_ratio_ism[i] = L_shl( L_mult( ratio_ism_idx[i], step ), 14 ); // q0 + q15 + 1 + 14 = q30; move32(); - sum = L_add( sum, q_energy_ratio_ism[i] ); + sum = L_add( sum, q_energy_ratio_ism[i] ); // Q30 } q_energy_ratio_ism[nchan_ism - 1] = L_sub( ONE_IN_Q30, sum ); @@ -2207,9 +2218,9 @@ void distribute_evenly_ism( } #else void distribute_evenly_ism_fx( - Word16 *idx, /* o : index values */ - const Word16 K, /* i : sum of indexes */ - const Word16 nchan_ism /* i : number of objects */ + Word16 *idx, /* o : index values Q0 */ + const Word16 K, /* i : sum of indexes Q0*/ + const Word16 nchan_ism /* i : number of objects Q0 */ ) { Word16 i; @@ -2226,7 +2237,7 @@ void distribute_evenly_ism_fx( } ELSE { - idx[i] = idiv1616( K, nchan_ism ); + idx[i] = idiv1616( K, nchan_ism ); // Q0 move16(); } sum = add( sum, idx[i] ); @@ -2238,7 +2249,7 @@ void distribute_evenly_ism_fx( move16(); WHILE( LT_16( sum, K ) ) { - IF( EQ_16( i, nchan_ism ) ) + if ( EQ_16( i, nchan_ism ) ) { i = 0; move16(); diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index 064677bbd..dc26644b9 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -832,7 +832,7 @@ static void ivas_param_mc_set_coding_scheme_fx( hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_cicp6_48_16bits[0]; hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[0]; hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[0]; - hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; /*Q15*/ hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; move16(); hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; @@ -842,7 +842,7 @@ static void ivas_param_mc_set_coding_scheme_fx( hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_cicp6_48_16bits[0]; hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[0]; hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[0]; - hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; /*Q8*/ hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; move16(); hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; @@ -854,7 +854,7 @@ static void ivas_param_mc_set_coding_scheme_fx( hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_cicp12_48_16bits[0]; hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[0]; hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[0]; - hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; /*Q15*/ hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; move16(); hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; @@ -864,7 +864,7 @@ static void ivas_param_mc_set_coding_scheme_fx( hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_cicp12_48_16bits[0]; hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[0]; hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[0]; - hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; /*Q8*/ hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; move16(); hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; @@ -876,7 +876,7 @@ static void ivas_param_mc_set_coding_scheme_fx( hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_cicp14_48_16bits[0]; hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[0]; hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[0]; - hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; /*Q15*/ hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; move16(); hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; @@ -886,7 +886,7 @@ static void ivas_param_mc_set_coding_scheme_fx( hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_cicp14_48_16bits[0]; hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[0]; hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[0]; - hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; /*Q8*/ hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; move16(); hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; @@ -899,7 +899,7 @@ static void ivas_param_mc_set_coding_scheme_fx( hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_combined_48_16bits[0]; hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[0]; hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[0]; - hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; /*Q15*/ hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; move16(); hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; @@ -909,7 +909,7 @@ static void ivas_param_mc_set_coding_scheme_fx( hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_combined_48_16bits[0]; hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[0]; hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[0]; - hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; /*Q8*/ hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; move16(); hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; @@ -920,6 +920,7 @@ static void ivas_param_mc_set_coding_scheme_fx( } hMetadataPMC->num_parameter_bands = ivas_param_mc_get_num_param_bands( mc_ls_setup, ivas_total_brate ); + move16(); return; } @@ -966,7 +967,7 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[0]; hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; #ifdef IVAS_FLOAT_FIXED - hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; // Q15 #endif hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; @@ -977,7 +978,7 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[0]; hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; #ifdef IVAS_FLOAT_FIXED - hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; // Q8 #endif hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; @@ -990,7 +991,7 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[0]; hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; #ifdef IVAS_FLOAT_FIXED - hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; // Q15 #endif hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; @@ -1001,7 +1002,7 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[0]; hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; #ifdef IVAS_FLOAT_FIXED - hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; // Q8 #endif hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; @@ -1015,7 +1016,7 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[0]; hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; #ifdef IVAS_FLOAT_FIXED - hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; + hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; // Q15 #endif hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; hMetadataPMC->icc_coding.uni_bits = PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT; @@ -1026,7 +1027,7 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[0]; hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; #ifdef IVAS_FLOAT_FIXED - hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; + hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; // Q8 #endif hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; hMetadataPMC->ild_coding.uni_bits = PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT; diff --git a/lib_com/ivas_mct_com.c b/lib_com/ivas_mct_com.c index dd7910748..ec8f0907b 100644 --- a/lib_com/ivas_mct_com.c +++ b/lib_com/ivas_mct_com.c @@ -198,7 +198,7 @@ void splitAvailableBitsMCT( void splitAvailableBitsMCT( void **sts, /* i/o: encoder/decoder state structure */ const Word16 total_bits, /* i : total number of available bits */ - const Word16 split_ratio[MCT_MAX_CHANNELS], /* i : ratio for splitting the bits */ + const Word16 split_ratio[MCT_MAX_CHANNELS], /* i : ratio for splitting the bits Q0 */ const Word16 enc_dec, /* i : encoder or decoder flag */ const Word16 nchan /* i : number of channels */ ) @@ -274,7 +274,7 @@ void splitAvailableBitsMCT( { bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel; } - + move16(); IF( NE_32( mct_chan_mode[i], MCT_CHAN_MODE_IGNORE ) ) { assert( split_ratio[i] >= 1 && split_ratio[i] < BITRATE_MCT_RATIO_RANGE ); @@ -282,7 +282,7 @@ void splitAvailableBitsMCT( bits_split = add( bits_split, *bits_frame_channel ); /*determine channel with most bits (energy)*/ - IF( GT_16( *bits_frame_channel, tmp ) ) + if ( GT_16( *bits_frame_channel, tmp ) ) { tmp = *bits_frame_channel; move16(); @@ -311,7 +311,7 @@ void splitAvailableBitsMCT( { bits_frame_channel = &( (Decoder_State *) sts[i] )->bits_frame_channel; } - + move16(); IF( NE_32( mct_chan_mode[i], MCT_CHAN_MODE_IGNORE ) ) { Word32 temp_res; @@ -346,7 +346,7 @@ void splitAvailableBitsMCT( { bits_frame_channel = &( (Decoder_State *) sts[max_chn] )->bits_frame_channel; } - + move16(); *bits_frame_channel = add( *bits_frame_channel, sub( total_bits, bits_split ) ); /*if all channels are silent assign bits to ch 0*/ diff --git a/lib_com/ivas_mdft_imdft.c b/lib_com/ivas_mdft_imdft.c index 579efe5da..0369afa71 100644 --- a/lib_com/ivas_mdft_imdft.c +++ b/lib_com/ivas_mdft_imdft.c @@ -49,6 +49,7 @@ #endif #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" +#include "ivas_prot_fx.h" #endif /*-----------------------------------------------------------------------------------------* @@ -77,33 +78,34 @@ static void ivas_get_mdft_twid_factors_fx( const Word16 length, - const Word32 **ppTwid ) + const Word32 **ppTwid // Q31 +) { SWITCH( length ) { case L_FRAME48k: - *ppTwid = &ivas_mdft_coeff_cos_twid_960_fx[0]; + *ppTwid = &ivas_mdft_coeff_cos_twid_960_fx[0]; // Q31 BREAK; case L_FRAME32k: - *ppTwid = &ivas_mdft_coeff_cos_twid_640_fx[0]; + *ppTwid = &ivas_mdft_coeff_cos_twid_640_fx[0]; // Q31 BREAK; case L_FRAME16k: - *ppTwid = &ivas_mdft_coeff_cos_twid_320_fx[0]; + *ppTwid = &ivas_mdft_coeff_cos_twid_320_fx[0]; // Q31 BREAK; case IVAS_240_PT_LEN: - *ppTwid = &ivas_mdft_coeff_cos_twid_240_fx[0]; + *ppTwid = &ivas_mdft_coeff_cos_twid_240_fx[0]; // Q31 BREAK; case IVAS_160_PT_LEN: - *ppTwid = &ivas_mdft_coeff_cos_twid_160_fx[0]; + *ppTwid = &ivas_mdft_coeff_cos_twid_160_fx[0]; // Q31 BREAK; case IVAS_120_PT_LEN: - *ppTwid = &ivas_mdft_coeff_cos_twid_120_fx[0]; + *ppTwid = &ivas_mdft_coeff_cos_twid_120_fx[0]; // Q31 BREAK; case IVAS_80_PT_LEN: - *ppTwid = &ivas_mdft_coeff_cos_twid_80_fx[0]; + *ppTwid = &ivas_mdft_coeff_cos_twid_80_fx[0]; // Q31 BREAK; case IVAS_40_PT_LEN: - *ppTwid = &ivas_mdft_coeff_cos_twid_40_fx[0]; + *ppTwid = &ivas_mdft_coeff_cos_twid_40_fx[0]; // Q31 BREAK; default: assert( !"Not supported FFT length!" ); @@ -120,27 +122,28 @@ static void ivas_get_mdft_twid_factors_fx( static void ivas_get_imdft_twid_factors_fx( const Word16 length, - const Word32 **ppTwid ) + const Word32 **ppTwid // Q31 +) { SWITCH( length ) { case L_FRAME48k: - *ppTwid = ivas_mdft_coeff_cos_twid_960_fx; + *ppTwid = ivas_mdft_coeff_cos_twid_960_fx; // Q31 BREAK; case L_FRAME32k: - *ppTwid = ivas_mdft_coeff_cos_twid_640_fx; + *ppTwid = ivas_mdft_coeff_cos_twid_640_fx; // Q31 BREAK; case L_FRAME16k: - *ppTwid = ivas_mdft_coeff_cos_twid_320_fx; + *ppTwid = ivas_mdft_coeff_cos_twid_320_fx; // Q31 BREAK; case 240: - *ppTwid = ivas_mdft_coeff_cos_twid_240_fx; + *ppTwid = ivas_mdft_coeff_cos_twid_240_fx; // Q31 BREAK; case 160: - *ppTwid = ivas_mdft_coeff_cos_twid_160_fx; + *ppTwid = ivas_mdft_coeff_cos_twid_160_fx; // Q31 BREAK; case 80: - *ppTwid = ivas_mdft_coeff_cos_twid_80_fx; + *ppTwid = ivas_mdft_coeff_cos_twid_80_fx; // Q31 BREAK; default: assert( !"Not supported FFT length!" ); @@ -268,37 +271,37 @@ static void get_one_by_length( #ifdef IVAS_FLOAT_FIXED static void get_one_by_length_fx( - Word32 *one_by_length, + Word32 *one_by_length, // Q37 const Word16 length ) { IF( EQ_16( length, L_FRAME48k ) ) { - *one_by_length = IVAS_ONE_BY_960_Q37; + *one_by_length = IVAS_ONE_BY_960_Q37; // Q37 move32(); } ELSE IF( EQ_16( length, L_FRAME32k ) ) { - *one_by_length = IVAS_ONE_BY_640_Q37; + *one_by_length = IVAS_ONE_BY_640_Q37; // Q37 move32(); } ELSE IF( EQ_16( length, L_FRAME16k ) ) { - *one_by_length = IVAS_ONE_BY_320_Q37; + *one_by_length = IVAS_ONE_BY_320_Q37; // Q37 move32(); } ELSE IF( EQ_16( length, IVAS_240_PT_LEN ) ) { - *one_by_length = IVAS_ONE_BY_240_Q37; + *one_by_length = IVAS_ONE_BY_240_Q37; // Q37 move32(); } ELSE IF( EQ_16( length, IVAS_160_PT_LEN ) ) { - *one_by_length = IVAS_ONE_BY_160_Q37; + *one_by_length = IVAS_ONE_BY_160_Q37; // Q37 move32(); } ELSE IF( EQ_16( length, IVAS_80_PT_LEN ) ) { - *one_by_length = IVAS_ONE_BY_80_Q37; + *one_by_length = IVAS_ONE_BY_80_Q37; // Q37 move32(); } ELSE @@ -316,32 +319,32 @@ static void get_one_by_length_fx( *-----------------------------------------------------------------------------------------*/ static void ivas_ifft_cplx1_fx( - Word32 *re, - Word32 *im, + Word32 *re, // inp: Qin -> out: Qin + 6 + Word32 *im, // inp: Qin -> out: Qin + 6 const Word16 length ) { Word16 i; Word32 one_by_length, tmp; - get_one_by_length_fx( &one_by_length, length ); + get_one_by_length_fx( &one_by_length, length ); // Q37 /* re-arrange inputs to use fft as ifft */ - re[0] = Mpy_32_32( re[0], one_by_length ); + re[0] = Mpy_32_32( re[0], one_by_length ); // ( Qin + Q37 ) - Q31 -> Qin + 6 move32(); - im[0] = Mpy_32_32( im[0], one_by_length ); + im[0] = Mpy_32_32( im[0], one_by_length ); // ( Qin + Q37 ) - Q31 -> Qin + 6 move32(); FOR( i = 1; i <= length >> 1; i++ ) { - tmp = Mpy_32_32( re[sub( length, i )], one_by_length ); /*stl_arr_index*/ - re[sub( length, i )] = Mpy_32_32( re[i], one_by_length ); /*stl_arr_index*/ + tmp = Mpy_32_32( re[length - i], one_by_length ); /*stl_arr_index Q: ( Qin + Q37 ) - Q31 -> Qin + 6 */ + re[length - i] = Mpy_32_32( re[i], one_by_length ); /*stl_arr_index Q: ( Qin + Q37 ) - Q31 -> Qin + 6 */ move32(); re[i] = tmp; move32(); - tmp = Mpy_32_32( im[sub( length, i )], one_by_length ); /*stl_arr_index*/ - im[sub( length, i )] = Mpy_32_32( im[i], one_by_length ); /*stl_arr_index*/ + tmp = Mpy_32_32( im[length - i], one_by_length ); /*stl_arr_index Q: ( Qin + Q37 ) - Q31 -> Qin + 6 */ + im[length - i] = Mpy_32_32( im[i], one_by_length ); /*stl_arr_index Q: ( Qin + Q37 ) - Q31 -> Qin + 6 */ move32(); - im[i] = tmp; + im[i] = tmp; // Q: ( Qin + Q37 ) - Q31 -> Qin + 6 move32(); } @@ -359,17 +362,17 @@ static void ivas_ifft_cplx1_fx( *-----------------------------------------------------------------------------------------*/ void ivas_mdft_fx( - const Word32 *pIn, /* i : input time-domain signal */ - Word32 *pOut_re, /* o : Real part of MDFT signal */ - Word32 *pOut_im, /* o : Imag. part of MDFT signal */ - const Word16 input_length, /* i : signal length */ - const Word16 mdft_length /* i : MDFT length */ + const Word32 *pIn, /* i : input time-domain signal Qin */ + Word32 *pOut_re, /* o : Real part of MDFT signal Qin */ + Word32 *pOut_im, /* o : Imag. part of MDFT signal Qin */ + const Word16 input_length, /* i : signal length */ + const Word16 mdft_length /* i : MDFT length */ ) { Word32 re[L_FRAME48k]; Word32 im[L_FRAME48k]; Word16 j, len_by_2; - const Word32 *pTwid; + const Word32 *pTwid; // Q31 len_by_2 = shr( mdft_length, 1 ); ivas_get_mdft_twid_factors_fx( mdft_length, &pTwid ); @@ -377,9 +380,9 @@ void ivas_mdft_fx( { FOR( j = 0; j < mdft_length; j++ ) { - re[j] = Mpy_32_32( pIn[j], pTwid[j] ); + re[j] = Mpy_32_32( pIn[j], pTwid[j] ); // ( Qin + Q31 ) - Q31 -> Qin move32(); - im[j] = Mpy_32_32( L_negate( pIn[j] ), pTwid[sub( mdft_length, j )] ); + im[j] = Mpy_32_32( L_negate( pIn[j] ), pTwid[mdft_length - j] ); // ( Qin + Q31 ) - Q31 -> Qin move32(); } } @@ -387,9 +390,9 @@ void ivas_mdft_fx( { FOR( j = 0; j < mdft_length; j++ ) { - re[j] = Msub_32_32( Mpy_32_32( pIn[j], pTwid[j] ), pIn[add( mdft_length, j )], pTwid[sub( mdft_length, j )] ); + re[j] = Msub_32_32( Mpy_32_32( pIn[j], pTwid[j] ), pIn[add( mdft_length, j )], pTwid[mdft_length - j] ); // ( Qin + Q31 ) - Q31 -> Qin move32(); - im[j] = Msub_32_32( Mpy_32_32( L_negate( pIn[j] ), pTwid[sub( mdft_length, j )] ), pIn[add( mdft_length, j )], pTwid[j] ); + im[j] = Msub_32_32( Mpy_32_32( L_negate( pIn[j] ), pTwid[mdft_length - j] ), pIn[mdft_length + j], pTwid[j] ); // ( Qin + Q31 ) - Q31 -> Qin move32(); } } @@ -397,14 +400,14 @@ void ivas_mdft_fx( fft_fx( re, im, mdft_length, 1 ); FOR( j = 0; j < len_by_2; j++ ) { - pOut_re[2 * j] = re[j]; + pOut_re[2 * j] = re[j]; // Qin move32(); - pOut_re[add( imult1616( 2, j ), 1 )] = re[sub( sub( mdft_length, j ), 1 )]; + pOut_re[2 * j + 1] = re[mdft_length - j - 1]; // Qin move32(); - pOut_im[2 * j] = im[j]; + pOut_im[2 * j] = im[j]; // Qin move32(); - pOut_im[add( imult1616( 2, j ), 1 )] = L_negate( im[sub( sub( mdft_length, j ), 1 )] ); + pOut_im[2 * j + 1] = L_negate( im[mdft_length - j - 1] ); // Qin move32(); } return; @@ -419,10 +422,10 @@ void ivas_mdft_fx( *-----------------------------------------------------------------------------------------*/ void ivas_imdft_fx( - const Word32 *pRe, /* i : Real part of MDFT signal */ - const Word32 *pIm, /* i : Imag. part of MDFT signal */ - Word32 *pOut, /* o : output time-domain signal */ - const Word16 length /* i : signal length */ + const Word32 *pRe, /* i : Real part of MDFT signal Qin */ + const Word32 *pIm, /* i : Imag. part of MDFT signal Qin */ + Word32 *pOut, /* o : output time-domain signal Qin */ + const Word16 length /* i : signal length */ ) { Word32 *re_tmp = pOut; @@ -430,32 +433,34 @@ void ivas_imdft_fx( Word32 tmp; Word16 j; Word16 len_by_2; - const Word32 *pTwid; + const Word32 *pTwid; // Q31 len_by_2 = shr( length, 1 ); ivas_get_imdft_twid_factors_fx( length, &pTwid ); FOR( j = 0; j < len_by_2; j++ ) { - re_tmp[j] = pRe[2 * j]; + re_tmp[j] = pRe[2 * j]; // Qin move32(); - re_tmp[add( j, len_by_2 )] = pRe[sub( sub( length, imult1616( 2, j ) ), 1 )]; + re_tmp[j + len_by_2] = pRe[length - 2 * j - 1]; // Qin move32(); - im_tmp[j] = pIm[2 * j]; + im_tmp[j] = pIm[2 * j]; // Qin move32(); - im_tmp[add( j, len_by_2 )] = L_negate( pIm[sub( sub( length, imult1616( 2, j ) ), 1 )] ); + im_tmp[j + len_by_2] = L_negate( pIm[length - 2 * j - 1] ); // Qin move32(); } ivas_ifft_cplx1_fx( re_tmp, im_tmp, length ); + // re_tmp: Qin + 6 + // im_tmp: Qin + 6 FOR( j = 0; j < length; j++ ) { - tmp = Msub_32_32( Mpy_32_32( L_shr( re_tmp[j], Q6 ), pTwid[j] ), L_shr( im_tmp[j], Q6 ), pTwid[sub( length, j )] ); - im_tmp[j] = L_negate( Madd_32_32( Mpy_32_32( L_shr( re_tmp[j], Q6 ), pTwid[sub( length, j )] ), L_shr( im_tmp[j], Q6 ), pTwid[j] ) ); + tmp = Msub_32_32( Mpy_32_32( L_shr( re_tmp[j], Q6 ), pTwid[j] ), L_shr( im_tmp[j], Q6 ), pTwid[length - j] ); // ( ( Qin + Q6 - Q6 ) + Q31 ) - Q31 -> Qin + im_tmp[j] = L_negate( Madd_32_32( Mpy_32_32( L_shr( re_tmp[j], Q6 ), pTwid[length - j] ), L_shr( im_tmp[j], Q6 ), pTwid[j] ) ); // ( ( Qin + Q6 - Q6 ) + Q31 ) - Q31 -> Qin move32(); - re_tmp[j] = tmp; + re_tmp[j] = tmp; // ( ( Qin + Q6 - Q6 ) + Q31 ) - Q31 -> Qin move32(); } return; diff --git a/lib_com/ivas_omasa_com.c b/lib_com/ivas_omasa_com.c index 5dbe03866..037364420 100644 --- a/lib_com/ivas_omasa_com.c +++ b/lib_com/ivas_omasa_com.c @@ -882,7 +882,9 @@ void calculate_nbits_meta( return; } #else -static Word16 get_bits_ism( Word32 val ) +static Word16 get_bits_ism( + Word32 val // Q29 +) { Word16 res; test(); @@ -891,33 +893,41 @@ static Word16 get_bits_ism( Word32 val ) test(); test(); test(); - IF( LE_32( val, 536870912 ) && GT_32( val, 447750340 ) ) + /* Considering only 3 points after decimal point, and replacing the other digits with 9 after that*/ + IF( LE_32( val, 536870912 /*1 (in Q29)*/ ) && GT_32( val, 447750340 /*5/6 (in Q29)*/ ) ) { + // 1 (in Q29) <= val <= 5/6 (in Q29) => res = 0 res = 0; move16(); } - ELSE IF( LE_32( val, 447750340 ) && GT_32( val, 358092897 ) ) + ELSE IF( LE_32( val, 447750340 /* 5/6 (in Q29)*/ ) && GT_32( val, 358092897 /*4/6 (in Q29)*/ ) ) { + // 5/6 (in Q29) <= val <= 4/6 (in Q29) => res = 1 res = 1; move16(); } - ELSE IF( LE_32( val, 358092897 ) && GT_32( val, 268972326 ) ) + ELSE IF( LE_32( val, 358092897 /*4/6 (in Q29)*/ ) && GT_32( val, 268972326 /*3/6 (in Q29)*/ ) ) { + // 4/6 (in Q29) <= val <= 3/6 (in Q29) => res = 2 res = 2; move16(); } - ELSE IF( LE_32( val, 268972326 ) && GT_32( val, 179314884 ) ) + ELSE IF( LE_32( val, 268972326 /*3/6 (in Q29)*/ ) && GT_32( val, 179314884 /* 2/6 (in Q29) */ ) ) { + // 3/6 (in Q29) <= val <= 2/6 (in Q29) => res = 3 res = 3; move16(); } - ELSE IF( LE_32( val, 179314884 ) && GT_32( val, 89657442 ) ) + ELSE IF( LE_32( val, 179314884 /* 2/6 (in Q29) */ ) && GT_32( val, 89657442 /* 1/6 => res (in Q29) */ ) ) { + // 2/6 (in Q29) <= val <= 1/6 => res (in Q29) = 4 res = 4; move16(); } - ELSE IF( LE_32( val, 89657442 ) && GT_32( val, 536870 ) ) + ELSE IF( LE_32( val, 89657442 /* 1/6 => res (in Q29) */ ) && GT_32( val, 536870 /* 0.0009999999 ( in Q29 )*/ ) ) { + // 1/6 (in Q29) <= val <= 0 (in Q29) => res = 5 + // 0.0009999999 in Q29-> 536870 res = 5; move16(); } @@ -952,7 +962,7 @@ void calculate_nbits_meta_fx( { FOR( obj = 0; obj < nchan_ism; obj++ ) { - priority[obj] = L_max( priority[obj], ( Mpy_32_32( q_energy_ratio_ism[sf][band][obj], L_sub( 1073741824 /* 1.0f in Q30 */, masa_to_total_energy_ratio[sf][band] ) ) ) ); // Qx - 1 + priority[obj] = L_max( priority[obj], ( Mpy_32_32( q_energy_ratio_ism[sf][band][obj], L_sub( ONE_IN_Q30 /* 1.0f in Q30 */, masa_to_total_energy_ratio[sf][band] ) ) ) ); // Qx - 1 move32(); } } @@ -960,7 +970,7 @@ void calculate_nbits_meta_fx( } ELSE { - priority[0] = 536870912; /* 1.0f in Q29 */ + priority[0] = ONE_IN_Q29; /* 1.0f in Q29 */ move32(); } @@ -972,12 +982,12 @@ void calculate_nbits_meta_fx( { IF( EQ_16( ism_imp, 3 ) ) { - priority[obj] = 536870912; /* 1.0f in Q29 */ + priority[obj] = ONE_IN_Q29; /* 1.0f in Q29 */ move32(); } ELSE IF( EQ_16( ism_imp, 2 ) ) { - priority[obj] = L_shr( L_add( 536870912, max_p ), 1 ); + priority[obj] = L_shr( L_add( ONE_IN_Q29, max_p ), 1 ); // Q29 move32(); } ELSE @@ -1043,12 +1053,13 @@ void ivas_get_stereo_panning_gains( #define SIN_30_DEGREES_Q15 ( (Word16) 0x4000 ) void get_panning_gain( - const Word16 sinAngleMapped, - Word16 *panningGains ) + const Word16 sinAngleMapped, // Q15 + Word16 *panningGains // Q15 +) { Word16 tbl_len, idx, lim_l, lim_r; - const Word16 *ptr_sin = &ivas_sine_panning_tbl_fx[0]; - const Word16 *ptr_tan_0 = ivas_tan_panning_gain_tbl_fx; + const Word16 *ptr_sin = &ivas_sine_panning_tbl_fx[0]; // Q15 + const Word16 *ptr_tan_0 = ivas_tan_panning_gain_tbl_fx; // Q15 tbl_len = 601; move16(); @@ -1064,17 +1075,17 @@ void get_panning_gain( test(); IF( GE_16( idx, tbl_len ) ) { - panningGains[0] = ptr_tan_0[tbl_len - 1]; + panningGains[0] = ptr_tan_0[tbl_len - 1]; // Q15 move16(); - panningGains[1] = ptr_tan_0[0]; + panningGains[1] = ptr_tan_0[0]; // Q15 move16(); BREAK; } ELSE IF( idx < 0 ) { - panningGains[0] = ptr_tan_0[0]; + panningGains[0] = ptr_tan_0[0]; // Q15 move16(); - panningGains[1] = ptr_tan_0[tbl_len - 1]; + panningGains[1] = ptr_tan_0[tbl_len - 1]; // Q15 move16(); BREAK; } @@ -1082,17 +1093,17 @@ void get_panning_gain( { IF( EQ_16( sinAngleMapped, ptr_sin[idx + 1] ) ) { - panningGains[0] = ptr_tan_0[idx + 1]; + panningGains[0] = ptr_tan_0[idx + 1]; // Q15 move16(); - panningGains[1] = ptr_tan_0[sub( sub( tbl_len, idx ), 2 )]; + panningGains[1] = ptr_tan_0[tbl_len - idx - 2]; // Q15 move16(); BREAK; } ELSE IF( EQ_16( sinAngleMapped, ptr_sin[idx] ) ) { - panningGains[0] = ptr_tan_0[idx]; + panningGains[0] = ptr_tan_0[idx]; // Q15 move16(); - panningGains[1] = ptr_tan_0[sub( sub( tbl_len, idx ), 1 )]; + panningGains[1] = ptr_tan_0[tbl_len - idx - 1]; // Q15 move16(); BREAK; } @@ -1102,16 +1113,16 @@ void get_panning_gain( mid = extract_l( L_shr( L_add( L_deposit_l( ptr_sin[idx] ), L_deposit_l( ptr_sin[idx + 1] ) ), 1 ) ); IF( LE_16( sinAngleMapped, mid ) ) { - panningGains[0] = ptr_tan_0[idx]; + panningGains[0] = ptr_tan_0[idx]; // Q15 move16(); - panningGains[1] = ptr_tan_0[sub( sub( tbl_len, idx ), 1 )]; + panningGains[1] = ptr_tan_0[tbl_len - idx - 1]; // Q15 move16(); } ELSE { - panningGains[0] = ptr_tan_0[idx + 1]; + panningGains[0] = ptr_tan_0[idx + 1]; // Q15 move16(); - panningGains[1] = ptr_tan_0[sub( sub( tbl_len, idx ), 2 )]; + panningGains[1] = ptr_tan_0[tbl_len - idx - 2]; // Q15 move16(); } BREAK; @@ -1132,48 +1143,49 @@ void get_panning_gain( void ivas_get_stereo_panning_gains_fx( - const Word16 aziDeg, - const Word16 eleDeg, - Word16 panningGains[2] ) + const Word16 aziDeg, // Q0 + const Word16 eleDeg, // Q0 + Word16 panningGains[2] // Q15 +) { /* Convert azi and ele to an azi value of the cone of confusion */ - Word16 azAddEl = add( aziDeg, eleDeg ); - Word16 azSubEl = sub( aziDeg, eleDeg ); + Word16 azAddEl = add( aziDeg, eleDeg ); // Q0 + Word16 azSubEl = sub( aziDeg, eleDeg ); // Q0 - const Word16 *ptr_sin_az = ivas_sin_az_fx; + const Word16 *ptr_sin_az = ivas_sin_az_fx; // Q15 WHILE( GT_16( azAddEl, 180 ) ) { - azAddEl = sub( azAddEl, 360 ); + azAddEl = sub( azAddEl, 360 ); // Q0 } WHILE( LT_16( azAddEl, -180 ) ) { - azAddEl = add( azAddEl, 360 ); + azAddEl = add( azAddEl, 360 ); // Q0 } WHILE( GT_16( azSubEl, 180 ) ) { - azSubEl = sub( azSubEl, 360 ); + azSubEl = sub( azSubEl, 360 ); // Q0 } WHILE( LT_16( azSubEl, -180 ) ) { - azSubEl = add( azSubEl, 360 ); + azSubEl = add( azSubEl, 360 ); // Q0 } // sin_az_cos_el = (ptr_sin_az[azAddEl] + ptr_sin_az[azSubEl])/2; Word16 sin_az_cos_el; - sin_az_cos_el = extract_l( L_shr( L_add( L_deposit_l( ptr_sin_az[azAddEl + 180] ), L_deposit_l( ptr_sin_az[azSubEl + 180] ) ), 1 ) ); + sin_az_cos_el = extract_l( L_shr( L_add( L_deposit_l( ptr_sin_az[azAddEl + 180] ), L_deposit_l( ptr_sin_az[azSubEl + 180] ) ), 1 ) ); // Q15 IF( GE_16( sin_az_cos_el, SIN_30_DEGREES_Q15 ) ) - { /* Left side */ - panningGains[0] = (Word16) 0x7fff; + { /* Left side */ + panningGains[0] = (Word16) 0x7fff; // Q15 move16(); - panningGains[1] = 0; + panningGains[1] = 0; // Q15 move16(); } ELSE IF( LE_16( sin_az_cos_el, SIN_NEG_30_DEGREES_Q15 ) ) - { /* Right side */ - panningGains[0] = 0; + { /* Right side */ + panningGains[0] = 0; // Q15 move16(); - panningGains[1] = (Word16) 0x7fff; + panningGains[1] = (Word16) 0x7fff; // Q15 move16(); } ELSE /* Tangent panning law */ diff --git a/lib_com/ivas_pca_tools.c b/lib_com/ivas_pca_tools.c index 4df06a23d..e0fed0fa6 100644 --- a/lib_com/ivas_pca_tools.c +++ b/lib_com/ivas_pca_tools.c @@ -41,6 +41,7 @@ #include "prot.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" +#include "ivas_prot_fx.h" #endif /*---------------------------------------------------------------------* @@ -85,9 +86,10 @@ static Word16 check_bound( Word32 tmp ) #ifdef IVAS_FLOAT_FIXED void eye_matrix_fx( - Word16 *mat, + Word16 *mat, // Q const Word16 n, - const Word16 d ) + const Word16 d // Q +) { Word16 i; @@ -98,7 +100,7 @@ void eye_matrix_fx( } FOR( i = 0; i < n; i++ ) { - mat[add( imult1616( i, n ), i )] = d; + mat[i * n + i] = d; // Q move16(); } @@ -120,7 +122,7 @@ void eye_matrix_fx32( } FOR( i = 0; i < n; i++ ) { - mat[i * n + i] = d; + mat[i * n + i] = d; // Q move32(); } @@ -190,7 +192,7 @@ void cov_subfr_fx( FOR( k = 0; k < n_channels; k++ ) { t_fx = &ptr_sig_fx[k][0]; - s_fx = W_shr( W_mult0_32_32( t_fx[0], t_fx[0] ), 11 ); // Q11 + s_fx = W_shr( W_mult0_32_32( t_fx[0], t_fx[0] ), 11 ); // Q11 + Q11 - Q11 -> Q11 FOR( j = 1; j < len; j++ ) { if ( s_fx != 0 ) @@ -198,7 +200,7 @@ void cov_subfr_fx( t_fx[j] = t_fx[j]; move32(); } - s_fx = W_add( s_fx, W_shr( W_mult0_32_32( t_fx[j], t_fx[j] ), 11 ) ); // Q11 + s_fx = W_add( s_fx, W_shr( W_mult0_32_32( t_fx[j], t_fx[j] ), 11 ) ); // Q11 + Q11 - Q11 -> Q11 } r_fx_64[k * n_channels + k] = s_fx; // Q11 move64(); @@ -211,7 +213,7 @@ void cov_subfr_fx( FOR( l = k + 1; l < n_channels; l++ ) { tt_fx = &ptr_sig_fx[l][0]; - s_fx = W_shr( W_mult0_32_32( t_fx[0], tt_fx[0] ), 11 ); // Q11 + s_fx = W_shr( W_mult0_32_32( t_fx[0], tt_fx[0] ), 11 ); // Q11 + Q11 - Q11 -> Q11 FOR( j = 1; j < len; j++ ) { s_fx = W_add( s_fx, W_shr( W_mult0_32_32( t_fx[j], tt_fx[j] ), 11 ) ); @@ -278,7 +280,7 @@ static void house_refl_fx( const Word16 sizex, Word32 *pu_fx, // Q: pu_q Word16 *pu_fx_q, - Word32 *normu_fx, // Q: q_norm + Word32 *normu_fx, // Q: q_normu Word16 *q_normu ) { Word16 i; @@ -292,7 +294,7 @@ static void house_refl_fx( move64(); FOR( Word16 k = 0; k < sizex; k++ ) { - L64_sum = W_mac_32_32( L64_sum, pu_fx[k], pu_fx[k] ); + L64_sum = W_mac_32_32( L64_sum, pu_fx[k], pu_fx[k] ); // pu_q } Word16 norm = W_norm( L64_sum ); L64_sum = W_shl( L64_sum, norm ); @@ -307,17 +309,17 @@ static void house_refl_fx( IF( ( *normu_fx ) == 0 ) { - pu_fx[0] = SQRT2_FIXED; // same q as other elements + pu_fx[0] = SQRT2_FIXED; // same q as other elements -> Q30 pu_e[0] = 1; move32(); move16(); } ELSE { - tmp = BASOP_Util_Divide3232_Scale( 1073741824, *normu_fx, &exp ); // Q30 + px_q, 1073741824 ->1 in Q30 + tmp = BASOP_Util_Divide3232_Scale( ONE_IN_Q30, *normu_fx, &exp ); // Q30 + px_q, 1073741824 ->1 in Q30 exp = add( exp, sub( 1, sub( 31, normu_q ) ) ); - Word32 rcp_fx = L_deposit_h( tmp ); + Word32 rcp_fx = L_deposit_h( tmp ); // rcp_q Word16 rcp_q = sub( Q31, exp ); rcp_fx = L_shr( rcp_fx, sub( rcp_q, Q31 ) ); // making rcp_fx in Q31 @@ -333,7 +335,7 @@ static void house_refl_fx( IF( pu_fx[0] >= 0 ) { - pu_fx[0] = L_add( pu_fx[0], L_shl( 1, 31 - pu_e[0] ) ); + pu_fx[0] = L_add( pu_fx[0], L_shl( 1, sub( 31, pu_e[0] ) ) ); ( *normu_fx ) = L_negate( *normu_fx ); move32(); @@ -341,7 +343,7 @@ static void house_refl_fx( } ELSE { - pu_fx[0] = L_sub( pu_fx[0], L_shl( 1, 31 - pu_e[0] ) ); + pu_fx[0] = L_sub( pu_fx[0], L_shl( 1, sub( 31, pu_e[0] ) ) ); move32(); } @@ -518,7 +520,7 @@ static void house_qr_fx( { FOR( i = 0; i < n_rows; i++ ) { - pa_fx[i] = A_fx[i * n + c]; + pa_fx[i] = A_fx[i * n + c]; // pA_q move32(); } @@ -527,7 +529,7 @@ static void house_qr_fx( Word16 norm; FOR( Word16 l = 0; l < n_rows - k; l++ ) { - L64_sum = W_mac_32_32( L64_sum, pa_fx[k + l], pu_fx[l] ); + L64_sum = W_mac_32_32( L64_sum, pa_fx[k + l], pu_fx[l] ); // pA_q + pu_fx_q } norm = W_norm( L64_sum ); L64_sum = W_shl( L64_sum, norm ); @@ -550,8 +552,8 @@ static void house_qr_fx( FOR( r = k + 1; r < n_rows; r++ ) { - A_fx[s * n_rows + r] = BASOP_Util_Add_Mant32Exp( A_fx[s * n_rows + r], sub( 31, pA_q ), L_negate( Mpy_32_32( pv_fx[j], pu_fx[i] ) ), add( sub( 31, pu_fx_q ), pv_exp[j] ), &exp2 ); - A_fx[s * n_rows + r] = L_shr_sat( A_fx[s * n_rows + r], sub( sub( 31, exp2 ), pA_q ) ); + A_fx[s * n_rows + r] = BASOP_Util_Add_Mant32Exp( A_fx[s * n_rows + r], sub( 31, pA_q ), L_negate( Mpy_32_32( pv_fx[j], pu_fx[i] ) ), add( sub( 31, pu_fx_q ), pv_exp[j] ), &exp2 ); // exp2 + A_fx[s * n_rows + r] = L_shr_sat( A_fx[s * n_rows + r], sub( sub( 31, exp2 ), pA_q ) ); // pA_q move32(); j = add( j, 1 ); } @@ -571,7 +573,7 @@ static void house_qr_fx( { FOR( i = 0; i < n_rows; i++ ) { - pu_fx[i] = L_shr( U_fx[i * n + k], sub( sub( 31, U_e[i * n + k] ), pu_fx_q ) ); + pu_fx[i] = L_shr( U_fx[i * n + k], sub( sub( 31, U_e[i * n + k] ), pu_fx_q ) ); // pu_fx_q move32(); } @@ -579,7 +581,7 @@ static void house_qr_fx( { FOR( i = 0; i < n_rows; i++ ) { - pa_fx[i] = pQ_fx[i * n + s]; + pa_fx[i] = pQ_fx[i * n + s]; // Q31 move32(); } @@ -711,7 +713,7 @@ void eig_qr_fx( move16(); /* check zero matrix */ - d_fx = dotp_fixed( A_fx, A_fx, n * n ); + d_fx = dotp_fixed( A_fx, A_fx, n * n ); // A_q + A_q - Q31 -> d_q d_q = sub( add( A_q, A_q ), 31 ); if ( d_fx != 0 ) @@ -720,14 +722,14 @@ void eig_qr_fx( move16(); } /* duplicate */ - Copy32( A_fx, Ak_fx, n * n ); + Copy32( A_fx, Ak_fx, n * n ); // A_q /* identity */ set_zero_fx( EV_fx, n * n ); FOR( i = 0; i < n; i++ ) { - EV_fx[i * n + i] = 2147483647; // 1 in Q31 + EV_fx[i * n + i] = ONE_IN_Q31; // 1 in Q31 move32(); } set_zero_fx( Vals_fx, n ); @@ -742,12 +744,12 @@ void eig_qr_fx( FOR( i = 0; i < n; i++ ) { - D_fx[i * n + i] = Vals_fx[i]; + D_fx[i * n + i] = Vals_fx[i]; // A_q move32(); } /* stop condition */ - d_fx = dotp_fixed_guarded( D_fx, D_fx, n * n ); + d_fx = dotp_fixed_guarded( D_fx, D_fx, n * n ); // ( A_q + A_q - 31 ) - find_guarded_bits_fx( n * n ) d_q = sub( sub( add( A_q, A_q ), 31 ), find_guarded_bits_fx( n * n ) ); exp = sub( 31, d_q ); d_fx = Sqrt32( d_fx, &exp ); @@ -761,11 +763,11 @@ void eig_qr_fx( house_qr_fx( Ak_fx, A_q, Qk_fx, Rk_fx, n ); - matrix_product_fx( Qk_fx, n, n, 0, Rk_fx, n, n, 0, Ak_fx ); - matrix_product_mant_exp_fx( Qk_fx, 0, n, n, 0, EV_fx, 0, n, n, 0, D_fx, &exp ); - Scale_sig32( D_fx, imult1616( n, n ), exp ); + matrix_product_fx( Qk_fx, n, n, 0, Rk_fx, n, n, 0, Ak_fx ); // A_q + Q31 - Q31 -> A_q + matrix_product_mant_exp_fx( Qk_fx, 0, n, n, 0, EV_fx, 0, n, n, 0, D_fx, &exp ); // Q31 + Q31 - Q31 -> Q31 + Scale_sig32( D_fx, imult1616( n, n ), exp ); // Q31 - Copy32( D_fx, EV_fx, imult1616( n, n ) ); + Copy32( D_fx, EV_fx, imult1616( n, n ) ); // Q31 } @@ -1056,8 +1058,8 @@ void mat2dquat_fx( /* determine (absolute) left and right terms */ i_ql = 0; i_qr = 0; - ql_max = MIN_16; - qr_max = MIN_16; + ql_max = MIN_16; // Q15 + qr_max = MIN_16; // Q15 move16(); move16(); move16(); @@ -1082,7 +1084,7 @@ void mat2dquat_fx( } - ql[i] = Sqrt16( tmp_l, &tmp_l_e ); + ql[i] = Sqrt16( tmp_l, &tmp_l_e ); // tmp_l_e ql[i] = check_bound( L_shl( ql[i], tmp_l_e ) ); // Q15 move16(); move16(); @@ -1094,13 +1096,13 @@ void mat2dquat_fx( move16(); } - qr[i] = Sqrt16( tmp_r, &tmp_r_e ); + qr[i] = Sqrt16( tmp_r, &tmp_r_e ); // tmp_r_e qr[i] = check_bound( L_shl( qr[i], tmp_r_e ) ); // Q15 move16(); move16(); IF( GT_16( qr[i], qr_max ) ) { - qr_max = qr[i]; + qr_max = qr[i]; // Q15 i_qr = i; move16(); move16(); @@ -1112,7 +1114,7 @@ void mat2dquat_fx( { IF( AM[i_ql * 4 + k] < 0 ) { - qr[k] = negate( qr[k] ); + qr[k] = negate( qr[k] ); // Q15 move16(); } } @@ -1122,7 +1124,7 @@ void mat2dquat_fx( temp = mult( AM[k * 4 + i_qr], mult( ql[k], qr[i_qr] ) ); // Q15 IF( temp < 0 ) { - ql[k] = negate( ql[k] ); + ql[k] = negate( ql[k] ); // Q15 move16(); } } @@ -1241,6 +1243,7 @@ void dquat2mat_fx( dx = mult( d, x ); dy = mult( d, y ); dz = mult( d, z ); + // Q15 m[0] = check_bound( L_sub( L_sub( aw, bx ), L_add( cy, dz ) ) ); move16(); m[1] = check_bound( L_sub( L_sub( cz, dy ), L_add( ax, bw ) ) ); @@ -1504,31 +1507,32 @@ static void norm_quat( #ifdef IVAS_FLOAT_FIXED -static Word32 dotp16_fixed_guarded( const Word16 x[], /* i : vector x[] */ - const Word16 y[], /* i : vector y[] */ - const Word16 n /* i : vector length */ ) +static Word32 dotp16_fixed_guarded( const Word16 x[], /* i : vector x[] Qx */ + const Word16 y[], /* i : vector y[] Qy */ + const Word16 n /* i : vector length */ ) { Word16 i; Word32 suma; Word16 guarded_bits = find_guarded_bits_fx( n ); - suma = L_shr( L_mult( x[0], y[0] ), guarded_bits ); + suma = L_shr( L_mult( x[0], y[0] ), guarded_bits ); // Qx + Qy - guarded_bits FOR( i = 1; i < n; i++ ) { - suma = L_add( suma, L_shr( L_mult( x[i], y[i] ), guarded_bits ) ); + suma = L_add( suma, L_shr( L_mult( x[i], y[i] ), guarded_bits ) ); // Qx + Qy - guarded_bits } return suma; } static void norm_quat_fx( - Word16 *q ) + Word16 *q // Q15 +) { Word32 norm_q; Word16 i, exp1; exp1 = 0; move16(); - norm_q = dotp16_fixed_guarded( q, q, IVAS_PCA_INTERP ); + norm_q = dotp16_fixed_guarded( q, q, IVAS_PCA_INTERP ); // (Q15 + Q15 - Q15) - exp1 exp1 = find_guarded_bits_fx( IVAS_PCA_INTERP ); norm_q = ISqrt32( norm_q, &exp1 ); /*Q(31 - exp)*/ @@ -1562,10 +1566,11 @@ static void quat_nlerp_preproc( #ifdef IVAS_FLOAT_FIXED static void quat_nlerp_preproc_fx( - const Word16 *q0, - const Word16 *q1, - const Word16 alpha, - Word16 *q_slerp ) + const Word16 *q0, // Q15 + const Word16 *q1, // Q15 + const Word16 alpha, // Q15 + Word16 *q_slerp // Q15 +) { Word16 i; Word16 tmp1, tmp2; @@ -1574,12 +1579,13 @@ static void quat_nlerp_preproc_fx( { tmp1 = mult( sub( MAX_16, alpha ), q1[i] ); tmp2 = mult_r( alpha, q0[i] ); - if ( EQ_16( alpha, q0[i] ) && EQ_16( alpha, 32767 ) ) + test(); + if ( EQ_16( alpha, q0[i] ) && EQ_16( alpha, MAX_16 ) ) { - tmp2 = 32767; + tmp2 = MAX_16; move16(); } - q_slerp[i] = add( tmp1, tmp2 ); + q_slerp[i] = add( tmp1, tmp2 ); // Q15 move16(); } @@ -1614,13 +1620,14 @@ void pca_interp_preproc( } #ifdef IVAS_FLOAT_FIXED void pca_interp_preproc_fx( - const Word16 *prev_ql, - const Word16 *prev_qr, - const Word16 *ql, - const Word16 *qr, + const Word16 *prev_ql, // Q15 + const Word16 *prev_qr, // Q15 + const Word16 *ql, // Q15 + const Word16 *qr, // Q15 const Word16 len, - Word16 *ql_interp, - Word16 *qr_interp ) + Word16 *ql_interp, // Q15 + Word16 *qr_interp // Q15 +) { Word16 alpha; Word16 j; @@ -1641,7 +1648,7 @@ void pca_interp_preproc_fx( tmp2 = mult( EVS_PI_FX, alpha ); /* Q13 */ tmp3 = getCosWord16( tmp2 ); /* Q14 */ alpha = sub_sat( ONE_IN_Q14, tmp3 ); /* Q15 */ - alpha = sub( MAX_16, alpha ); + alpha = sub( MAX_16, alpha ); // Q15 quat_nlerp_preproc_fx( prev_ql, ql, alpha, &ql_interp[j * IVAS_PCA_INTERP] ); quat_nlerp_preproc_fx( prev_qr, qr, alpha, &qr_interp[j * IVAS_PCA_INTERP] ); } @@ -1669,11 +1676,11 @@ static Word16 acos_clip_fx( { Word16 ph_fx; - v_fx = check_bounds_s_fx( v_fx, -32767, 32767 ); + v_fx = check_bounds_s_fx( v_fx, -32767, 32767 ); // Q15 Word32 tmp1_fx, tmp2_fx; Word16 tmp1_e, tmp2_e; - tmp1_fx = L_sub( 2147483647, L_deposit_h( mult( v_fx, v_fx ) ) ); // Q31 + tmp1_fx = L_sub( ONE_IN_Q31, L_deposit_h( mult( v_fx, v_fx ) ) ); // Q31 tmp1_e = 0; tmp2_e = 0; move16(); @@ -1718,7 +1725,7 @@ static void sp2cart_fx( Word16 s1, s2, s1s2; Word16 sin_ph3, cos_ph3; - sin_ph3 = cos_ph3 = ph3; + sin_ph3 = cos_ph3 = ph3; // Q12 move16(); move16(); @@ -2063,8 +2070,8 @@ static void q_ang_circ_fx( } assert( ( *index >= 0 ) && ( *index <= ( N - 1 ) ) ); - d_fx = shl( d_fx, sub( 12, sub( 15, d_e ) ) ); - *a_q_fx = extract_l( L_mult0( *index, d_fx ) ); + d_fx = shl( d_fx, sub( 12, sub( 15, d_e ) ) ); // Q12 + *a_q_fx = extract_l( L_mult0( *index, d_fx ) ); // Q12 move16(); return; @@ -2548,9 +2555,9 @@ void pca_dec_s3_fx( assert( index1 > -1 ); - ph1_q_fx = ph1_q_n2_tbl[index1][0]; + ph1_q_fx = ph1_q_n2_tbl[index1][0]; // Q13 move16(); - n2 = ph1_q_n2_tbl[index1][1]; + n2 = ph1_q_n2_tbl[index1][1]; // Q0 move16(); j = L_sub( j, ivas_pca_offset_index1[index1] ); @@ -2576,7 +2583,7 @@ void pca_dec_s3_fx( ELSE { - num_fx = 12868; + num_fx = 12868; // EVS_PI in Q12 move16(); d_fx = BASOP_Util_Divide1616_Scale( num_fx, sub( n2, 1 ), &exp ); /* Q12 */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 75c7d206f..b63a975d3 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -86,10 +86,6 @@ void copy_encoder_config( void ivas_write_format( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -#else -void ivas_write_format_fx( /* i/o: IVAS encoder structure */ - Encoder_Struct *st_ivas -); #endif #ifndef IVAS_FLOAT_FIXED @@ -98,12 +94,6 @@ void ivas_write_format_sid( const int16_t element_mode, /* i : element bitrate */ BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ ); -#else -void ivas_write_format_sid_fx( - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 element_mode, /* i : element bitrate */ - BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ -); #endif ivas_error create_sce_enc( @@ -112,12 +102,6 @@ ivas_error create_sce_enc( const int32_t element_brate /* i : element bitrate */ ); -ivas_error create_sce_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 sce_id, /* i : SCE # identifier */ - const Word32 element_brate /* i : element bitrate */ -); - ivas_error create_evs_sce_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t sce_id, /* i : SCE # identifier */ @@ -130,12 +114,6 @@ ivas_error create_cpe_enc( const int32_t element_brate /* i : element bitrate */ ); -ivas_error create_cpe_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 cpe_id, /* i : CPE # identifier */ - const Word32 element_brate /* i : element bitrate */ -); - ivas_error create_mct_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -180,16 +158,7 @@ ivas_error ivas_sce_enc( const int16_t nb_bits_metadata /* i : number of metadata bits */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_cpe_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const Word16 cpe_id, /* i : CPE # identifier */ - float data_f_ch0[], /* i : input signal for channel 0 */ - float data_f_ch1[], /* i : input signal for channel 1 */ - const Word16 input_frame, /* i : input frame length per channel */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_cpe_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t cpe_id, /* i : CPE # identifier */ @@ -200,6 +169,15 @@ ivas_error ivas_cpe_enc( ); #endif +ivas_error ivas_cpe_enc( + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 cpe_id, /* i : CPE # identifier */ + float data_f_ch0[], /* i : input signal for channel 0 */ + float data_f_ch1[], /* i : input signal for channel 1 */ + const Word16 input_frame, /* i : input frame length per channel */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ +); + ivas_error ivas_mct_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ float *data[MCT_MAX_CHANNELS], /* i : input signal buffers */ @@ -381,15 +359,6 @@ void ivas_syn_output_f( float *synth_out /* o : integer 16 bits synthesis signal */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_syn_output_f_fx( - Word32 *synth[], /* i/o: float synthesis signal */ - const Word16 output_frame, /* i : output frame length (one channel) */ - const Word16 n_channels, /* i : number of output channels */ - Word32 *synth_out /* o : integer 16 bits synthesis signal */ -); -#endif - void ivas_initialize_handles_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -398,10 +367,6 @@ ivas_error ivas_init_encoder( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -ivas_error ivas_init_encoder_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -); - void destroy_core_enc( ENC_CORE_HANDLE hCoreCoder /* i/o: core encoder structure */ ); @@ -426,13 +391,6 @@ ivas_error ivas_init_decoder_front( ivas_error ivas_init_decoder( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_output_buff_dec_fx( - Word32 *p_output_f[], /* i/o: output audio buffers */ - const Word16 nchan_out_buff_old, /* i : previous frame number of output channels */ - const Word16 nchan_out_buff /* i : number of output channels */ -); -#else ivas_error ivas_output_buff_dec( float *p_output_f[], /* i/o: output audio buffers */ @@ -461,12 +419,6 @@ ivas_error ivas_dec_setup( uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ int16_t *data /* o : output synthesis signal */ ); -#else -ivas_error ivas_dec_setup( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ - Word16 *data /* o : output synthesis signal */ -); #endif #ifndef IVAS_FLOAT_FIXED @@ -482,12 +434,7 @@ ivas_error create_cpe_dec( const int32_t element_brate /* i : element bitrate */ ); #endif // !IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED -ivas_error create_mct_dec_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#else // IVAS_FLOAT_FIXED - +#ifndef IVAS_FLOAT_FIXED ivas_error create_mct_dec( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); @@ -497,13 +444,6 @@ ivas_error mct_dec_reconfigure( const uint16_t b_nchan_change /* i : flag indicating different channel count */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error mct_dec_reconfigure_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const UWord16 b_nchan_change /* i : flag indicating different channel count */ -); -#endif - #ifndef IVAS_FLOAT_FIXED void destroy_sce_dec( SCE_DEC_HANDLE hSCE /* i/o: SCE decoder structure */ @@ -518,17 +458,6 @@ void ivas_mct_dec_close( MCT_DEC_HANDLE *hMCT /* i/o: MCT decoder structure */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_corecoder_dec_reconfig_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nSCE_old, /* i : number of SCEs in previous frame */ - Word16 nCPE_old, /* i : number of CPEs in previous frame */ - const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ - const Word16 sba_dirac_stereo_flag_old, /* i : signal stereo rendering using DFT upmix in previous frame */ - const Word32 brate_SCE, /* i : bitrate to be set for the SCEs */ - const Word32 brate_CPE /* i : bitrate to be set for the CPEs */ -); -#endif ivas_error ivas_corecoder_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nSCE_old, /* i : number of SCEs in previous frame */ @@ -538,12 +467,6 @@ ivas_error ivas_corecoder_dec_reconfig( const int32_t brate_SCE, /* i : bitrate to be set for the SCEs */ const int32_t brate_CPE /* i : bitrate to be set for the CPEs */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_hp20_dec_reconfig_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nchan_hp20_old /* i : number of HP20 filters in previous frame*/ -); -#endif // IVAS_FLOAT_FIXED ivas_error ivas_hp20_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -574,11 +497,7 @@ ivas_error ivas_mct_dec( ); /*! r: number of channels to be synthesised */ -#ifdef IVAS_FLOAT_FIXED -Word16 getNumChanSynthesis( - Decoder_Struct *st_ivas /* i : IVAS decoder structure */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t getNumChanSynthesis( Decoder_Struct *st_ivas /* i : IVAS decoder structure */ ); @@ -597,10 +516,6 @@ void destroy_core_dec( void ivas_destroy_dec( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#else -void ivas_destroy_dec_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); #endif void ivas_initialize_handles_dec( @@ -634,19 +549,7 @@ ivas_error ivas_core_enc( const int16_t ivas_format, /* i : IVAS format */ const int16_t flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_core_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ - const int16_t n_channels, /* i : number of channels to be decoded */ - Word32 *output_fx[], /* o : output synthesis signal */ - Word32 outputHB[][L_FRAME48k], /* o : output HB synthesis signal */ - Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ - const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_core_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ @@ -693,22 +596,6 @@ void decod_gen_2sbfr( const float tdm_Pri_pitch_buf[] /* i : pitch values for primary channel */ ); -#ifdef IVAS_FLOAT_FIXED -void decod_gen_2sbfr_ivas_fx( - Decoder_State *st, /* i/o: decoder static memory */ - const Word16 sharpFlag, /* i : formant sharpening flag `Q0*/ - const Word16 *Aq, /* i : LP filter coefficient Q12*/ - Word16 *pitch_buf, /* o : Word16 pitch values for each subframe Q6*/ - Word16 *voice_factors, /* o : voicing factors Q15*/ - Word16 *exc, /* i/o: adapt. excitation exc Q_exc*/ - Word16 *exc2, /* i/o: adapt. excitation/total exc Q_exc*/ - Word16 *bwe_exc, /* o : excitation for SWB TBE Q_exc*/ - Word16 *gain_buf, /* o : Word16 pitch gain for each subframe Q14*/ - const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ - const Word16 tdm_Pri_pitch_buf[] /* i : pitch values for primary channel Q6*/ -); -#endif - void synchro_synthesis( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ @@ -758,6 +645,19 @@ void stereo_tcx_core_dec( ); #endif // !IVAS_FLOAT_FIXED +void stereo_tcx_core_enc( + Encoder_State *st, /* i/o: encoder state structure */ + const float new_samples_12k8[], /* i : buffer of input signal @12.8 kHz */ + const float new_samples_16k[], /* i : buffer of input signal @16 kHz */ + const Word16 Aw_fx[], /* i : weighted A(z) unquant. for subframes, Q12 */ + float lsp_new[], /* i : LSPs at the end of the frame, Q15 */ + float lsp_mid[], /* i : LSPs in the middle of the frame, Q15 */ + Word16 pitch_buf_fx[NB_SUBFR16k], /* o : pitch for each subframe, Q6 */ + const Word16 last_element_mode, /* i : last element mode, Q0 */ + const Word16 vad_hover_flag /* i : VAD hangover flag, Q0 */ +); + + void stereo_tcx_init_dec( Decoder_State *st, /* i/o: decoder state structure */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ @@ -779,27 +679,7 @@ int16_t ivas_smc_gmm( int16_t *high_lpn_flag, /* i/o: sp/mus LPN flag */ const int16_t flag_spitch /* i : flag to indicate very short stable pitch */ ); -#ifdef IVAS_FLOAT_FIXED -/*! r: S/M decision (0=speech or noise,1=unclear,2=music) */ -Word16 ivas_smc_gmm_fx( - Encoder_State *st, /* i/o: state structure */ - STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ - const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ - const Word16 Etot_fx, /* i : total frame energy */ - Word16 lsp_new_fx[M], /* i : LSPs in current frame TODO:For now removing 'const' to avoid warning */ - Word16 cor_map_sum_fx, /* i : correlation map sum (from multi-harmonic anal.) */ - Word32 epsP_fx[M + 1], /* i : LP prediciton error TODO:For now removing 'const' to avoid warning */ - Word32 PS_fx[], /* i : energy spectrum TODO:For now removing 'const' to avoid warning */ - const Word16 non_sta_fx, /* i : unbound non-stationarity */ - const Word16 relE_fx, /* i : relative frame energy */ - Word16 *high_lpn_flag, /* i/o: sp/mus LPN flag */ - const Word16 flag_spitch /* i : flag to indicate very short stable pitch */ - , - Word16 Qfact_PS, - Word16 Q_esp, - Word16 Qfact_PS_past -); -#endif + void ivas_smc_mode_selection( Encoder_State *st, /* i/o: encoder state structure */ const int32_t element_brate, /* i : element bitrate */ @@ -835,26 +715,9 @@ void ivas_decision_matrix_enc( const float enerBuffer[], /* i : energy buffer */ const int16_t last_element_mode /* i : last element mode */ ); -#else -void ivas_decision_matrix_enc_fx( - Encoder_State *st, /* i : encoder state structure */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 fft_buff[], /* i : FFT buffer */ - const Word32 enerBuffer[], /* i : energy buffer */ - Word16 enerBuffer_exp, - const Word16 last_element_mode /* i : last element mode */ -); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_signaling_enc_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ - const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_signaling_enc( Encoder_State *st, /* i/o: encoder state structure */ const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ @@ -964,20 +827,12 @@ void smooth_dft2td_transition( const int16_t output_frame /* i : output frame length */ ); -void smooth_dft2td_transition_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *output_fx[CPE_CHANNELS], /* i/o: synthesis @external Fs Q11*/ - const Word16 output_frame /* i : output frame lenght Q0*/ -); + /*! r: flag indicating a valid bitrate */ int16_t is_IVAS_bitrate( const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); -Word16 is_IVAS_bitrate_fx( - const Word32 ivas_total_brate /* i : IVAS total bitrate */ -); - int16_t is_DTXrate( const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); @@ -1002,35 +857,7 @@ void ivas_imdft( float *pOut, /* o : output time-domain signal */ const int16_t length /* i : signal length */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_mdft_fx( - const Word32 *pIn, /* i : input time-domain signal */ - Word32 *pOut_re, /* o : Real part of MDFT signal */ - Word32 *pOut_im, /* o : Imag. part of MDFT signal */ - const Word16 length, /* i : signal length */ - const Word16 mdft_length /* i : MDFT length */ -); -void ivas_imdft_fx( - const Word32 *pRe, /* i : Real part of MDFT signal */ - const Word32 *pIm, /* i : Imag. part of MDFT signal */ - Word32 *pOut, /* o : output time-domain signal */ - const Word16 length /* i : signal length */ -); -#endif -#ifdef IVAS_FLOAT_FIXED -void TonalMdctConceal_create_concealment_noise_ivas_fx( - Word32 concealment_noise[L_FRAME48k], - Word16 *concealment_noise_exp, - CPE_DEC_HANDLE hCPE, - const Word16 L_frameTCX, - const Word16 L_frame, - const Word16 idchan, - const Word16 subframe_idx, - const Word16 core, - const Word16 crossfade_gain, - const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode); -#endif void TonalMdctConceal_create_concealment_noise_ivas( float concealment_noise[L_FRAME48k], CPE_DEC_HANDLE hCPE, @@ -1061,16 +888,6 @@ int16_t get_igf_startline_flt( float rand_triangular_signed( int16_t *seed ); -#ifdef IVAS_FLOAT_FIXED -Word16 rand_triangular_signed_fx( - Word16 *seed, - Word16 *exp_fac); -#endif -Word64 var_32_fx( - const Word32 *x, /* i : input vector */ - const Word16 len, /* i : length of inputvector */ - Word16 q /* q : q-factor for the array */ -); void dtx_read_padding_bits( DEC_CORE_HANDLE st, @@ -1090,17 +907,13 @@ void ivas_apply_non_diegetic_panning( * JBM prototypes *----------------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_jbm_dec_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *data_fx -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_jbm_dec_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *data /* o : output synthesis signals */ ); #endif + #ifndef IVAS_FLOAT_FIXED ivas_error ivas_jbm_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -1110,19 +923,6 @@ ivas_error ivas_jbm_dec_render( int16_t *data /* o : output synthesis signal */ ); #endif -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_jbm_dec_flush_renderer_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 tc_granularity_new, /* i : new renderer granularity */ - const RENDERER_TYPE renderer_type_old, /* i : old renderer type */ - const AUDIO_CONFIG intern_config_old, /* i : old internal config */ - const IVAS_OUTPUT_SETUP_HANDLE hIntSetupOld, /* i : old internal output setup */ - const MC_MODE mc_mode_old, /* i : old MC mode */ - const ISM_MODE ism_mode_old, /* i : old ISM mode */ - UWord16 *nSamplesRendered, /* o : number of samples flushed */ - Word16 *data /* o : output synthesis signal */ -); -#endif // IVAS_FLOAT_FIXED ivas_error ivas_jbm_dec_flush_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -1142,19 +942,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ float *data /* i/o: transport channels/output synthesis signal */ ); -void ivas_jbm_dec_feed_tc_to_renderer_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nSamplesForRendering, /* i : number of TC samples available for rendering */ - Word16 *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ - Word32 *data /* i/o: transport channels/output synthesis signal */ -); - -void ivas_jbm_dec_feed_tc_to_renderer_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t nSamplesForRendering, /* i : number of TC samples available for rendering */ - int16_t *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ - Word32 *data /* i/o: transport channels/output synthesis signal */ -); ivas_error ivas_jbm_dec_set_discard_samples( Decoder_Struct *st_ivas /* i/o: main IVAS decoder structre */ @@ -1166,13 +953,7 @@ void ivas_jbm_dec_get_adapted_linear_interpolator( float *interpolator /* o : the interpolator */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_jbm_dec_get_adapted_subframes( - const Word16 nCldfbTs, /* i : number of time slots in the current frame */ - Word16 *subframe_nbslots, /* i/o: subframe grid */ - Word16 *nb_subframes /* i/o: number of subframes in the frame */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_jbm_dec_get_adapted_subframes( const int16_t nCldfbTs, /* i : number of time slots in the current frame */ int16_t *subframe_nbslots, /* i/o: subframe grid */ @@ -1180,16 +961,7 @@ void ivas_jbm_dec_get_adapted_subframes( ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_jbm_dec_get_md_map( - const Word16 default_len, /* i : default frame length in metadata slots */ - const Word16 len, /* i : length of the modfied frames in metadata slots */ - const Word16 subframe_len, /* i : default length of a subframe */ - const Word16 offset, /* i : current read offset into the md buffer */ - const Word16 buf_len, /* i : length of the metadata buffer */ - Word16 *map /* o : metadata index map */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_jbm_dec_get_md_map( const int16_t default_len, /* i : default frame length in metadata slots */ const int16_t len, /* i : length of the modfied frames in metadata slots */ @@ -1210,15 +982,7 @@ void ivas_jbm_dec_copy_tc_no_tsm( const int16_t output_frame /* i : output frame size */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_jbm_dec_get_md_map_even_spacing( - const Word16 len, /* i : length of the modfied frames in metadata slots */ - const Word16 subframe_len, /* i : default length of a subframe */ - const Word16 offset, /* i : current read offset into the md buffer */ - const Word16 buf_len, /* i : length of the metadata buffer */ - Word16 *map /* o : metadata index map */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_jbm_dec_get_md_map_even_spacing( const int16_t len, /* i : length of the modfied frames in metadata slots */ const int16_t subframe_len, /* i : default length of a subframe */ @@ -1295,9 +1059,9 @@ ivas_error ivas_ism_config( #ifdef IVAS_FLOAT_FIXED void bitbudget_to_brate( - const Word16 x[], /* i : bitbudgets */ - Word32 y[], /* o : bitrates */ - const Word16 N /* i : number of entries to be converted */ + const Word16 x[], /* i : bitbudgets Q0 */ + Word32 y[], /* o : bitrates Q0 */ + const Word16 N /* i : number of entries to be converted */ ); #else void bitbudget_to_brate( @@ -1321,12 +1085,12 @@ void ivas_ism_reset_metadata_API( /*! r: index of the winning codeword */ #ifdef IVAS_FLOAT_FIXED Word16 ism_quant_meta_fx( - const Word32 val, /* i : scalar value to quantize */ - Word32 *valQ, /* o : quantized value */ - const Word32 borders_fx[], /* i : level borders */ - const Word32 q_step_fx, /* i : quantization step */ - const Word32 q_step_border_fx, /* i : quantization step at the border */ - const Word16 cbsize /* i : codebook size */ + const Word32 val, /* i : scalar value to quantize Q22 */ + Word32 *valQ, /* o : quantized value Q22 */ + const Word32 borders_fx[], /* i : level borders Q22 */ + const Word32 q_step_fx, /* i : quantization step Q22 */ + const Word32 q_step_border_fx, /* i : quantization step at the border Q22 */ + const Word16 cbsize /* i : codebook size */ ); #endif @@ -1348,17 +1112,7 @@ float ism_dequant_meta( const int16_t cbsize /* i : codebook size */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_set_ism_metadata_fx( - ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ - const Word32 azimuth, /* i : azimuth value */ - const Word32 elevation, /* i : elevation value */ - const Word16 radius_meta, /* i : radius */ - const Word32 yaw, /* i : yaw */ - const Word32 pitch, /* i : pitch */ - const Word16 non_diegetic_flag /* i : non-diegetic object flag */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ @@ -1389,25 +1143,7 @@ ivas_error ivas_ism_enc( const int16_t flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_ism_metadata_enc( - Word32 *ism_total_brate, /* i/o: ISM total bitrate */ - const Word16 nchan_ism, /* i : number of ISM channels */ - const Word16 nchan_transport, /* i : number of transport channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - Word16 nb_bits_metadata[], /* o : number of metadata bits */ - const Word16 localVAD[], /* i : VAD flag */ - const Word16 ism_mode, /* i : ISM mode */ - const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ - const Word16 ism_extended_metadata_flag, /* i : Extended metadata flag */ - const Word16 lp_noise_CPE, /* i : LP filtered total noise estimation */ - const Word16 flag_omasa_ener_brate, /* i : less bitrate for objects in OMASA flag */ - Word16 *omasa_stereo_sw_cnt, - const Word16 ini_frame -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_ism_metadata_enc( int32_t *ism_total_brate, /* i/o: ISM total bitrate */ const int16_t nchan_ism, /* i : number of ISM channels */ @@ -1492,15 +1228,8 @@ void ivas_param_ism_config( ivas_error ivas_ism_enc_config( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ - UWord16 *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ - Word16 *data /* o : output synthesis signal */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ @@ -1509,23 +1238,13 @@ ivas_error ivas_ism_dec_config( ); #endif // IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_param_ism_dec_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_param_ism_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_param_ism_dec_close_fx( - PARAM_ISM_DEC_HANDLE *hParamIsmDec, /* i/o: decoder ParamISM handle */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ - const AUDIO_CONFIG output_config /* i : output audio configuration */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_param_ism_dec_close( PARAM_ISM_DEC_HANDLE *hParamIsmDec, /* i/o: decoder ParamISM handle */ SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ @@ -1538,23 +1257,11 @@ void ivas_param_ism_dec( float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_ism_dec_digest_tc_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif void ivas_ism_dec_digest_tc( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_param_ism_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - Word32 *transport_channels[], /* i : synthesized core-coder transport channels/DirAC output */ - Word16 q_tc_in -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_param_ism_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ @@ -1579,19 +1286,6 @@ void ivas_param_ism_dec_render( float *output_f[] /* o : rendered time signal */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_param_ism_dec_render_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - Word32 *output_f_fx[] -); -void ivas_param_ism_params_to_masa_param_mapping_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif - void ivas_param_ism_params_to_masa_param_mapping( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); @@ -1604,19 +1298,6 @@ void ivas_param_ism_params_to_masa_param_mapping( ivas_error ivas_ism_dtx_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -#ifdef IVAS_FLOAT_FIXED -Word16 ivas_ism_dtx_enc_fx( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 nchan_ism, /* i : number of objects */ - const Word16 nchan_transport, /* i : number of transport channels */ - Word16 vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - Word16 md_diff_flag[], /* o : metadata differential flag */ - Word16 *sid_flag /* o : indication of SID frame */ -); -#endif // IVAS_FLOAT_FIXED /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( @@ -1630,12 +1311,6 @@ int16_t ivas_ism_dtx_enc( int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_ism_dtx_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word16 *nb_bits_metadata /* o : number of metadata bits */ -); -#endif // IVAS_FLOAT_FIXED void ivas_ism_dtx_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -1667,14 +1342,6 @@ void ivas_ism_metadata_sid_dec( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t nb_bits_metadata[] /* o : number of metadata bits */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_ism_get_sce_id_dtx_fx( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 input_frame /* i : input frame length per channel */ -); -#endif // IVAS_FLOAT_FIXED void ivas_ism_get_sce_id_dtx( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ @@ -1687,14 +1354,6 @@ void ivas_param_ism_compute_noisy_speech_flag( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_ism_coh_estim_dtx_enc_fx( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 input_frame /* i : input frame length */ -); -#endif // IVAS_FLOAT_FIXED void ivas_ism_coh_estim_dtx_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ @@ -1717,14 +1376,6 @@ void ivas_get_ism_sid_quan_bitbudget( int16_t *nBits_coh, /* o : number of Q bits for coherence */ int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( - SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ - const Word16 sce_id_dtx, /* i : SCE DTX ID */ - const Word16 nchan_transport, /* i : number of transport channels */ - Word16 *Q_cngNoiseLevel -); -#endif // IVAS_FLOAT_FIXED void ivas_ism_dtx_limit_noise_energy_for_near_silence( SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ @@ -1742,34 +1393,15 @@ ivas_error stereo_dft_enc_create( const int16_t max_bwidth /* i : maximum encoded bandwidth */ ); -ivas_error stereo_dft_enc_create_fx( - STEREO_DFT_ENC_DATA_HANDLE *hStereoDft, /* o : encoder DFT stereo handle */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word16 max_bwidth /* i : maximum encoded bandwidth */ -); - void stereo_dft_enc_reset( STEREO_DFT_ENC_DATA_HANDLE hStereoDft /* i/o: encoder stereo handle */ ); -void stereo_dft_enc_reset_fx( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft /* i/o: encoder stereo handle */ -); - void stereo_enc_itd_init( ITD_DATA_HANDLE hItd /* i/o: encoder ITD handle */ ); -void stereo_enc_itd_init_fx( - ITD_DATA_HANDLE hItd /* i/o: encoder ITD handle */ -); - -#ifdef IVAS_FLOAT_FIXED -void stereo_dft_enc_update_fx( - STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ - const Word16 max_bwidth /* i : maximum encoded bandwidth */ -); -#else +#ifndef IVAS_FLOAT_FIXED void stereo_dft_enc_update( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder DFT stereo handle */ const int16_t max_bwidth /* i : maximum encoded bandwidth */ @@ -1840,16 +1472,6 @@ void stereo_dft_cng_side_gain( const int16_t bwidth /* i : audio band-width */ ); -#ifdef IVAS_FLOAT_FIXED -void stereo_dft_quantize_res_gains_fx( - const Word32 *g, //Q31 - const Word32 *r, //Q31 - Word32 *gq, //Q31 - Word32 *rq, //Q31 - Word16 *ig, - Word16 *ir); -#endif - void stereo_dft_quantize_res_gains( const float *g, const float *r, @@ -1858,13 +1480,6 @@ void stereo_dft_quantize_res_gains( int16_t *ig, int16_t *ir ); -#ifdef IVAS_FLOAT_FIXED -void stereo_dft_dequantize_itd_fx( - Word16 *ind, /* Q0 */ - Word32 *out, /* Q15 */ - const Word32 output_Fs /* Q0 */ -); -#endif // IVAS_FLOAT_FIXED void stereo_dft_dequantize_itd( int16_t *ind, @@ -1891,14 +1506,6 @@ void stereo_dft_enc_sid_coh( float *cohBand /* i/o: Coherence per band */ ); #endif -#ifdef IVAS_FLOAT_FIXED -void stereo_dft_dec_sid_coh_fx( - Decoder_State *st, /* i/o: decoder state structure */ - const Word16 nbands, /* i : number of DFT stereo bands Q0*/ - Word16 *coh, /* i/o: coherence Q15*/ - Word16 *nb_bits /* i/o: number of bits read Q0*/ -); -#endif // IVAS_FLOAT_FIXED void stereo_dft_dec_sid_coh( Decoder_State *st, /* i/o: decoder state structure */ @@ -2009,11 +1616,6 @@ float stereo_dft_dmx_swb_nrg( const int16_t frame_length /* i : frame lanegth */ ); -#ifdef IVAS_FLOAT_FIXED -Word16 stereo_dft_sg_recovery_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: Decoder DFT stereo handle */ -); -#endif int16_t stereo_dft_sg_recovery( STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: Decoder DFT stereo handle */ ); @@ -2031,33 +1633,12 @@ int16_t res_bpf_adapt( const float *bpf_error_signal_8k, /* i : BPF modification signal */ float res_buf[STEREO_DFT_N_8k] /* i : residual buffer */ ); -#else // IVAS_FLOAT_FIXED -Word16 res_bpf_adapt_ivas_fx( - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ - const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ - Word32 res_buf[STEREO_DFT_N_8k], /* i : residual buffer Q_res */ - Word16 q_res -); #endif + void bpf_pitch_coherence( Decoder_State *st, /* i/o: decoder state structure */ const float pitch_buf[] /* i : pitch for each subframe [0,1,2,3] */ ); -#ifdef IVAS_FLOAT_FIXED -void stereo_dft_dec_read_BS_fx( - const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ - const Word32 element_brate, /* i : element bitrate Q0*/ - Word32 *total_brate, /* o : total bitrate Q0*/ - Decoder_State *st, /* i/o: decoder state structure */ - STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder stereo handle */ - const Word16 bwidth, /* i : bandwidth Q0*/ - const Word16 output_frame, /* i : output frame length Q0*/ - Word32 res_buf_fx[STEREO_DFT_N_8k], /* o : residual buffer Q0*/ - Word16 *nb_bits, /* o : number of bits read Q0*/ - Word16 *coh_fx, /* i/o: Coherence Q15*/ - const Word16 ivas_format /* i : ivas format Q0*/ -); -#endif // IVAS_FLOAT_FIXED void stereo_dft_dec_read_BS( const int32_t ivas_total_brate, /* i : IVAS total bitrate */ @@ -2117,16 +1698,7 @@ void filter_with_allpass( ); /*! r: used GR order */ -#ifdef IVAS_FLOAT_FIXED -Word16 write_bitstream_adapt_GR( - BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ - const Word16 ind, /* i : bitstream index */ - const Word16 *in, /* i : values to be written in bitstream */ - const Word16 len, /* i : values vector length */ - const Word16 GR_ord, /* i : GR order to be used */ - const Word16 no_GR_ord /* i : speech/music 0/1 */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t write_bitstream_adapt_GR( BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ const int16_t Indice, /* i : identifier for bitstream index */ @@ -2138,24 +1710,7 @@ int16_t write_bitstream_adapt_GR( #endif /*! r: used GR order */ -#ifdef IVAS_FLOAT_FIXED -Word16 adapt_GR_ief_fx( - const Word16 *in, /* i : vector to encode */ - Word16 *in_diff, /* o : encoded symbols in case of differential encoding */ - const Word16 *prev, /* i : previous frame data */ - const Word16 len, /* i : input vector length */ - const Word16 no_symb, /* i : number of symbols */ - Word16 *nbits, /* o : number of used bits */ - Word16 *in_enc, /* o : symbold actually encoded after adapt_GR */ - const Word16 *map0, /* i : mapping array */ - const Word16 no_GR_ord, /* i : number of GR order to try 2: 0,1; 3:0,1,2 */ - Word16 *nbits_diff, /* o : number bits in diff encoding */ - const Word16 side_gain_counter, /* i : number of frames since last abs coding */ - Word16 *side_gain_bitdiff_lp, /* i/o: LP-filtered bit difference between abs/diff */ - Word16 *q_side_gain_bitdiff_lp, /* i/o: Q of LP-filtered bit difference between abs/diff */ - const Word16 try_diff /* i : diff coding allowed 1/0 */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t adapt_GR_ief( const int16_t *in, /* i : vector to encode */ int16_t *in_diff, /* o : encoded symbols in case of differential encoding */ @@ -2173,21 +1728,7 @@ int16_t adapt_GR_ief( ); #endif -#ifdef IVAS_FLOAT_FIXED -Word16 adapt_GR_rpg1_ief( - const Word16 *in, /* i : res pred gains input vector */ - Word16 *in_diff, /* o : encoded symbols in case of differential encoding */ - const Word16 *prev, /* i : previous frame data */ - const Word16 len, /* i : input vector length */ - const Word16 no_symb, /* i : number of symbols */ - Word16 *nbits, /* o : number of used bits */ - Word16 *in_enc, /* o : symbold actually encoded after adapt_GR */ - const Word16 *maps, /* i : mapping array */ - Word16 *nbits_diff, /* o : estimated no of bits for differential encoding */ - const Word16 no_GR_ord, /* i : number of GR order to try 2: 0,1; 3:0,1,2 */ - const Word16 try_diff /* i : diff coding allowed 1/0 */ -); -#else +#ifndef IVAS_FLOAT_FIXED /*! r: used GR order */ int16_t adapt_GR_rpg1_ief( const int16_t *in, /* i : res pred gains input vector */ @@ -2205,14 +1746,7 @@ int16_t adapt_GR_rpg1_ief( #endif /*! r: number of bits written */ -#ifdef IVAS_FLOAT_FIXED -Word16 write_GR1( - BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ - const Word16 ind, /* i : bitstream index */ - const Word16 *in, /* i : data to be encoded */ - const Word16 len /* i : input data length */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t write_GR1( BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ const int16_t ind, /* i : bitstream index */ @@ -2222,15 +1756,7 @@ int16_t write_GR1( #endif /*! r: number of bits written */ -#ifdef IVAS_FLOAT_FIXED -Word16 write_bitstream_GR( - BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ - const Word16 ind, /* i : bitstream index */ - const Word16 *in, /* i : input vector */ - const Word16 len, /* i : input vector length */ - const Word16 GR_ord /* i : GR order */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t write_bitstream_GR( BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ const int16_t ind, /* i : bitstream index */ @@ -2289,12 +1815,6 @@ int16_t read_BS_adapt_GR_sg( ); #endif -void stereo_dft_hybrid_ITD_flag( - STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ - const Word32 input_Fs, /* i : CPE element sampling rate */ - const Word16 hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ -); - void stereo_dft_enc_compute_itd( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ float *DFT_L, @@ -2396,11 +1916,6 @@ void rc_uni_dec_init( uint16_t *bit_buffer, /* i : Bit buffer */ const int16_t max_available_bits /* i : Total maximum bits available */ ); -void rc_uni_dec_init_fx( - RangeUniDecState *rc_st_dec, /* i/o: RC state handle */ - UWord16 *bit_buffer, /* i : Bit buffer */ - const Word16 max_available_bits /* i : Total maximum bits available */ -); /*! r: Read symbol */ uint16_t rc_uni_dec_read_symbol_fastS( @@ -2410,14 +1925,6 @@ uint16_t rc_uni_dec_read_symbol_fastS( const uint16_t alphabet_size, /* i : Number of symbols in the alphabet */ const uint16_t tot_shift /* i : Total frequency as a power of 2 */ ); -/*! r: Read symbol */ -UWord16 rc_uni_dec_read_symbol_fastS_fx( - RangeUniDecState *rc_st_dec, /* i/o: Decoder State */ - const UWord16 cum_freq_table[], /* i : Cumulative frequency up to symbol */ - const UWord16 sym_freq_table[], /* i : Symbol frequency */ - const UWord16 alphabet_size, /* i : Number of symbols in the alphabet */ - const UWord16 tot_shift /* i : Total frequency as a power of 2 */ -); /*! r: Read bit */ uint16_t rc_uni_dec_read_bit( @@ -2442,9 +1949,6 @@ int16_t rc_uni_dec_virtual_finish( RangeUniDecState *rc_st_dec /* i/o: RC state handle */ ); -Word16 rc_uni_dec_virtual_finish_fx( - RangeUniDecState *rc_st_dec /* i/o: RC state handle */ -); /*! r: Total number of bits consumed */ int16_t rc_uni_dec_finish( RangeUniDecState *rc_st_dec /* i/o: RC state handle */ @@ -2519,11 +2023,6 @@ void stereo_tca_init_enc( const int32_t input_Fs /* i : input sampling frequency */ ); -void stereo_tca_init_enc_fx( - STEREO_TCA_ENC_HANDLE hStereoTCA, /* i/o: Stereo ICA handle */ - const Word32 input_Fs /* i : input sampling frequency */ -); - void stereo_tca_enc( CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const int16_t input_frame /* i : length of a frame per channel */ @@ -2539,24 +2038,12 @@ void stereo_tca_dec( const int16_t output_frame /* i : length of a frame per channel */ ); -void stereo_tca_dec_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *synth[CPE_CHANNELS], /* i/o: output synth qsynth*/ - const Word16 output_frame /* i : length of a frame per channel Q0*/ -); - void stereo_tca_scale_R_channel( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *output, /* i/o: output synthesis, R channel */ const int16_t output_frame /* i : frame length */ ); -void stereo_tca_scale_R_channel_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *output_fx, /* i/o: output synthesis, R channel q_out*/ - const Word16 output_frame /* i : frame length Q0*/ -); - void adjustTargetSignal( float *target, const int16_t prevShift, @@ -2565,12 +2052,6 @@ void adjustTargetSignal( const int16_t method ); -void adjustTargetSignal_fx( - Word32 *target_fx, - const Word16 prevShift, - const Word16 currShift, - const Word16 L_shift_adapt, - const Word16 method); /*----------------------------------------------------------------------------------* * IC-BWE Stereo prototypes *----------------------------------------------------------------------------------*/ @@ -2579,10 +2060,6 @@ void stereo_icBWE_init_enc( STEREO_ICBWE_ENC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ ); -void stereo_icBWE_init_enc_fx( - STEREO_ICBWE_ENC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ -); - void spectral_balancer( float *signal, float *mem, @@ -2640,10 +2117,6 @@ int16_t select_stereo_mode( void stereo_classifier_init( STEREO_CLASSIF_HANDLE hStereoClassif /* i/o: stereo classifier structure */ ); -#else -void stereo_classifier_init_fx( - STEREO_CLASSIF_HANDLE hStereoClassif /* i/o: stereo classifier structure */ -); #endif void stereo_classifier_features( @@ -2661,11 +2134,7 @@ void stereo_classifier_features( const int16_t clas /* i : signal class */ ); -#ifdef IVAS_FLOAT_FIXED -void unclr_classifier_dft_fx( - CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ -); -#else +#ifndef IVAS_FLOAT_FIXED void unclr_classifier_dft( CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ ); @@ -2675,13 +2144,7 @@ void unclr_classifier_td( CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ ); #endif -#ifdef IVAS_FLOAT_FIXED -void xtalk_classifier_dft_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const Word16 itd, /* i : ITD from DFT stereo - used as a feature */ - const Word32 gcc_phat[] /* i : GPHAT cross-channel correlation function Q31*/ -); -#endif + void xtalk_classifier_dft( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const int16_t itd, /* i : ITD from DFT stereo - used as a feature */ @@ -2702,35 +2165,19 @@ void stereo_td_init_enc( const int16_t last_element_mode /* i : last element mode */ ); -void stereo_td_init_enc_fx( - STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ - const Word16 last_element_mode /* i : last element mode */ -); #ifndef IVAS_FLOAT_FIXED ivas_error stereo_set_tdm( CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const int16_t input_frame /* i : input frame length per channel */ ); -#else -ivas_error stereo_set_tdm_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const Word16 input_frame, /* i : input frame length per channel */ - Word16 input_q -); #endif + #ifndef IVAS_FLOAT_FIXED void stereo_tdm_prep_dwnmx ( CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const float *input1, /* i : right channel input */ const int16_t input_frame /* i : frame lenght */ ); -#else -void stereo_tdm_prep_dwnmx_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const Word32 *input1, /* i : right channel input */ - const Word16 input_frame, /* i : frame lenght */ - const Word16 input_q /* i : frame lenght */ -); #endif #ifndef IVAS_FLOAT_FIXED @@ -2757,11 +2204,6 @@ void stereo_td_init_dec( const int16_t last_element_mode /* i : last element mode */ ); -void stereo_td_init_dec_fx( - STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ - const Word16 last_element_mode /* i : last element mode Q0*/ -); - void tdm_configure_dec( const int16_t ivas_format, /* i : IVAS format */ const int16_t ism_mode, /* i : ISM mode in combined format */ @@ -2782,18 +2224,6 @@ void tdm_upmix_plain( const int16_t plus_minus_flag /* i : plus/minus flag */ ); -void tdm_upmix_plain_fx( - Word32 Left_fx[], /* o : left channel Qx*/ - Word32 Right_fx[], /* o : right channel Qx*/ - const Word32 PCh_2_L_fx[], /* i : primary channel Qx*/ - const Word32 SCh_2_R_fx[], /* i : secondary channel Qx*/ - const Word32 LR_ratio_fx, /* i : mixing ratio Q31*/ - const Word32 inv_den_LR_ratio_fx, /* i : inverse mixing ration Q31*/ - const Word16 start_index, /* i : start index Q0*/ - const Word16 end_index, /* i : end index Q0*/ - const Word16 plus_minus_flag /* i : plus/minus flag Q0*/ -); - void stereo_tdm_combine( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float *PCh_2_L, /* i/o: Primary channel -> output as L channel */ @@ -2803,29 +2233,7 @@ void stereo_tdm_combine( const int16_t tdm_ratio_idx /* i : TDM ratio index */ ); -void stereo_tdm_combine_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *PCh_2_L_fx, /* i/o: Primary channel -> output as left channel Qx*/ - Word32 *SCh_2_R_fx, /* i/o: Secondary channel -> output as right channel Qx*/ - const Word16 output_frame, /* i : Number of samples Q0*/ - const Word16 flag_HB, /* i : flag to distinguish between core (0) and HB (1) synthesis Q0*/ - const Word16 tdm_ratio_idx /* i : TDM ratio index Q0*/ -); -#ifdef IVAS_FLOAT_FIXED -Word16 tdm_lp_comparison_fx( - STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ - STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ - Encoder_State *st, /* i/o: Encoder structure */ - Word32 *speech_buff, /* i : Current speech frame Q_speech */ - const Word16 *A_PCh_fx, /* i : primary channel LP coefficients Q12*/ - const Word16 *A_SCh_fx, /* i : secondary channel LP coeff. Q12*/ - const Word16 m, /* i : filter length */ - const Word32 *isp_PCh_fx, /* i : primary channel LSPs Q31 */ - const Word32 *isp_SCh_fx, /* i : secondary channel LSPs Q31 */ - const Word16 L_frame, /* i : frame length */ - const Word32 element_brate_wo_meta, /* i : element bitrate without metadata*/ - Word16 Q_speech ); -#else +#ifndef IVAS_FLOAT_FIXED /*! r: replication decision; 1 = Use old LP */ int16_t tdm_lp_comparison( STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ @@ -2860,13 +2268,7 @@ void tdm_configure_enc( const int16_t nb_bits_metadata /* i : number of metadata bits */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error signaling_enc_secondary_fx( - Encoder_State *st, /* i/o: Encoder structure */ - const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag OR LRTD primary channel */ - const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag*/ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error signaling_enc_secondary( Encoder_State *st, /* i/o: Encoder structure */ const int16_t tdm_SM_flag, /* i : channel combination scheme flag */ @@ -2932,21 +2334,6 @@ void tdm_low_rate_enc( const float *lsf_new, /* i : current frame ISF vector */ float *tmp_noise /* o : long-term noise energy */ ); -#else -void tdm_low_rate_enc( - Encoder_State *st, /* i/o: State structure */ - const Word16 Aq[], /* i : 12k8 Lp coefficient */ - const Word16 *res, /* i : residual signal */ // Q_new - Word16 *synth, /* i/o: core synthesis */ // Q_new - Word16 *exc_fx, /* i/o: current non-enhanced excitation */ // Q_new - Word16 *pitch_buf, /* i/o: floating pitch values for each subframe */ // Q6 - Word16 *voice_factors, /* o : voicing factors */ // Q15 - Word16 *bwe_exc_fx, /* o : excitation for SWB TBE */ // Q_new - const Word16 attack_flag, /* i : attck flag */ - const Word16 *lsf_new, /* i : current frame ISF vector */ // x2.56 - Word16 *tmp_noise, /* o : long-term noise energy */ // Q8 - Word16 *Q_new -); #endif /*! r: value of the indice */ @@ -2957,19 +2344,6 @@ uint16_t get_indice_st( const int16_t nb_bits /* i : number of bits to quantize the indice */ ); -#ifdef IVAS_FLOAT_FIXED -void tdm_low_rate_dec_fx( - Decoder_State *st, /* i/o: decoder static memory */ - Word16 dct_epit[], /* o : GSC excitation in DCT domain Q_exc*/ - Word16 *pitch_buf, /* o : Word16 pitch values for each subframe Q6*/ - Word16 *voice_factors, /* o : voicing factors Q15*/ - Word16 *exc, /* i/o: adapt. excitation exc Q_exc*/ - Word16 *exc2, /* i/o: adapt. excitation/total exc Q_exc*/ - Word16 *bwe_exc, /* o : excitation for SWB TBE Q_exc*/ - const Word16 *lsf_new /* i : ISFs at the end of the frame Q8/100 (2.56x)*/ -); -#endif - void tdm_low_rate_dec( Decoder_State *st, /* i/o: decoder static memory */ float dct_epit[], /* o : GSC excitation in DCT domain */ @@ -2981,30 +2355,14 @@ void tdm_low_rate_dec( float *bwe_exc, /* o : excitation for SWB TBE */ const float *lsf_new /* i : ISFs at the end of the frame */ ); -#ifdef IVAS_FLOAT_FIXED -void tdm_SCh_LSF_intra_pred_fx( - const Word32 element_brate, /* i : element bitrate */ - const Word16 *tdm_lsfQ_PCh_fx, /* i : primary channel LSFs */ - Word16 *pred_lsf_SCh_fx /* o : predicted secondary channel LSFs */ -); -#endif + void tdm_SCh_LSF_intra_pred( const int32_t element_brate, /* i : element bitrate */ const float *tdm_lsfQ_PCh, /* i : primary channel LSFs */ float *pred_lsf_SCh /* o : predicted secondary channel LSFs */ ); -#ifdef IVAS_FLOAT_FIXED -void tdm_SCh_lsf_reuse_fx( - const Word16 enc_dec, /* i : encoder/decoder flag */ - const Word32 element_brate, /* i : element bitrate */ - Word16 lsf_new_fx[M], /* i/o: LSFs at the end of the frame */ - Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame */ - const Word16 tdm_lsfQ_PCh_fx[M], /* i : primary channel LSFs */ - const Word16 lsf_wgts_fx[M], /* i : LSF weights */ - Word16 *beta_index /* i/o: quantization index */ -); -#else +#ifndef IVAS_FLOAT_FIXED void tdm_SCh_lsf_reuse( const int16_t enc_dec, /* i : encoder/decoder flag */ const int32_t element_brate, /* i : element bitrate */ @@ -3076,21 +2434,7 @@ void QuantizeTCXSpectrum( float *gain_tcx, /* o : global gain */ int16_t prm[] /* o : tcx parameters */ ); -#ifdef IVAS_FLOAT_FIXED -void EstimateStereoTCXNoiseLevel_fx( - Encoder_State **sts, /* i : state handle */ - Word32 *q_spectrum[CPE_CHANNELS][NB_DIV], /* i : quantized MDCT spectrum */ - Word16 gain_tcx[][NB_DIV], /* i : global gain */ - Word16 gain_tcx_e, /* i : global gain exponent */ - Word16 L_frame[][NB_DIV], /* i : frame length */ - Word16 noiseFillingBorder[][NB_DIV], /* i : noise filling border */ - Word16 hm_active[][NB_DIV], /* i : flag indicating if the harmonic model is active */ - const Word16 ignore_chan[], /* i : flag indicating whether the channel should be ignored */ - Word16 fac_ns[][NB_DIV], /* o : noise filling level */ - Word16 param_core[][NB_DIV * NPRM_DIV], /* o : quantized noise filling level */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -); -#endif + void EstimateStereoTCXNoiseLevel( Encoder_State **sts, /* i : state handle */ float *q_spectrum[CPE_CHANNELS][NB_DIV], /* i : quantized MDCT spectrum */ @@ -3113,17 +2457,7 @@ void TNSAnalysisStereo( int16_t param_core[][NB_DIV * NPRM_DIV], /* o : quantized noise filling level */ const int16_t mct_on /* i : flag mct block (1) or stereo (0) */ ); -#ifdef IVAS_FLOAT_FIXED -void TNSAnalysisStereo_fx( - Encoder_State **sts, /* i : encoder state handle */ - Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* o : MDST spectrum Qx*/ - const Word16 bWhitenedDomain, /* i : whitened domain flag Q0*/ - Word16 tnsSize[CPE_CHANNELS][NB_DIV], /* i : number of tns parameters put into prm Q0*/ - Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i : number of tns bits in the frame Q0*/ - Word16 param_core[][NB_DIV * NPRM_DIV], /* o : TNS parameters Q0*/ - const Word16 mct_on /* i : flag mct block (1) or stereo (0) Q0*/ -); -#endif + void InternalTCXDecoder( Encoder_State *st, /* i/o: state handle */ const int16_t frame_cnt, /* i : frame counter in the super_frame */ @@ -3164,17 +2498,6 @@ void initMdctStereoEncData( const int16_t mem_init /* i : initialize memory after malloc */ ); -void initMdctStereoEncData_fx( - STEREO_MDCT_ENC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 element_mode, /* i : element mode */ - const Word32 element_brate, /* i : element bitrate */ - const Word16 bwidth, /* i : bandwidth */ - const Word16 igf, /* i : flag indicating IGF activity */ - const H_IGF_GRID hIgfGrid, /* i : IGF grid setup */ - const Word16 mem_init /* i : initialize memory after malloc */ -); - ivas_error initMdctItdHandling( STEREO_MDCT_ENC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ const int32_t input_Fs /* i : input sampling rate */ @@ -3209,15 +2532,6 @@ void stereo_mdct_init_igf_start_band( const int32_t element_brate /* i : element bitrate */ ); -#ifdef IVAS_FLOAT_FIXED -void init_tcx_enc_info_fx( - Encoder_State *st, /* i/o: coder memory state */ - Word16 *L_frame, - Word16 *L_frameTCX, - Word16 *L_spec -); -#endif - void init_tcx_enc_info( Encoder_State *st, /* i : coder memory state */ int16_t *L_frame, @@ -3409,12 +2723,6 @@ void SetCurrentPsychParams( const int16_t last_frame_was_concealed_cng, TCX_CONFIG_HANDLE hTcxCfg ); -#else -void SetCurrentPsychParams( - const Word16 core, - const Word16 last_frame_was_concealed_cng, - TCX_CONFIG_HANDLE hTcxCfg -); #endif void stereo_coder_tcx( @@ -3543,32 +2851,7 @@ void dequantize_sns( float snsQ_out[CPE_CHANNELS][NB_DIV][M], Decoder_State **sts ); -#ifdef IVAS_FLOAT_FIXED -void sns_avq_cod_fx( - const Word32 *sns_fx, /* i : Input sns vectors */ - Word16 exp_sns, - const Word32 *snsmid_fx, /* i : Input mid-sns vectors */ - Word16 exp_snsmid, - Word32 *sns_q_fx, /* o : Quantized LFS vectors Q16 */ - Word32 *snsmid_q_fx, /* o : Quantized mid-LFS vectors Q16 */ - Word16 *index, /* o : Quantization indices */ - const Word16 core, /* i : core */ - const Word16 L_frame, - const Word16 low_brate_mode /* i : flag low bit operating mode */ -); - -void sns_avq_cod_stereo_fx( - const Word32 *snsl_fx, /* i : Input sns vector (left channel) */ - Word16 exp_snl, - const Word32 *snsr_fx, /* i : Input sns vector (right channel) */ - Word16 exp_snr, - const Word16 L_frame, - Word32 *snsl_q_fx, /* o : Quantized sns vector (left channel) Q16 */ - Word32 *snsr_q_fx, /* o : Quantized sns vector (right channel) Q16 */ - Word16 *indexl, /* o : Quantization indices (left channel) */ - Word16 *indexr /* o : Quantization indices (right channel) */ -); -#else +#ifndef IVAS_FLOAT_FIXED void sns_avq_cod( const float *sns, /* i : Input sns vectors */ const float *snsmid, /* i : Input mid-sns vectors */ @@ -3632,11 +2915,6 @@ void FdCngEncodeMDCTStereoSID( void FdCngDecodeMDCTStereoSID( CPE_DEC_HANDLE hCPE /* i/o: CPE decoder state structure */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error initMdctStereoDtxData_fx( - CPE_DEC_HANDLE hCPE /* i/o: CPE handle */ -); -#endif // IVAS_FLOAT_FIXED ivas_error initMdctStereoDtxData( CPE_DEC_HANDLE hCPE /* i/o: CPE decoder handle */ @@ -3660,13 +2938,6 @@ void applyDmxMdctStereo( const int16_t output_frame /* i : output frame length */ ); -void applyDmxMdctStereo_fx( - const CPE_DEC_HANDLE hCPE, /* i : CPE handle */ - Word32 *output_fx[CPE_CHANNELS], /* o : output from core decoder q_out*/ - const Word16 output_frame /* i : output frame length Q0*/ -); - - /*----------------------------------------------------------------------------------* * Front-VAD prototypes *----------------------------------------------------------------------------------*/ @@ -3676,19 +2947,9 @@ ivas_error front_vad_create( const ENCODER_CONFIG_HANDLE hEncoderConfig /* i : configuration structure */ ); -ivas_error front_vad_create_fx( - FRONT_VAD_ENC_HANDLE *hFrontVad, /* i/o: front-VAD handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig /* i : configuration structure */ -); - void front_vad_destroy( FRONT_VAD_ENC_HANDLE *hFrontVad /* i/o: front-VAD handle */ ); -#ifdef IVAS_FLOAT_FIXED -void front_vad_destroy_fx( - FRONT_VAD_ENC_HANDLE *hFrontVad /* i/o: front-VAD handle */ -); -#endif ivas_error front_vad( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure, nullable */ @@ -3707,28 +2968,7 @@ ivas_error front_vad( float *PS_out, /* o : energy spectrum */ float *Bin_E_out /* o : log-energy spectrum of the current frame*/ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error front_vad_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure, nullable */ - Encoder_State * st, /* i/o: encoder state structure */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - FRONT_VAD_ENC_HANDLE *hFrontVads, /* i/o: FrontVad handles */ - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - const Word16 input_frame, /* i : frame length */ - Word16 vad_flag_dtx[], /* o : HE-SAD flag with additional DTX HO */ - Word32 fr_bands_fx[][2 * NB_BANDS], /* o : energy in frequency bands Q_buffer[n] + QSCALE + 2 */ - Word16 Etot_LR_fx[], /* o : total energy Left & Right channel Q8 */ - Word32 lf_E_fx[][2 * VOIC_BINS], /* i : per bin spectrum energy in lf, LR channels Q_buffer[n] + QSCALE */ - Word16 localVAD_HE_SAD[], /* o : HE-SAD flag without hangover, LR channels */ - Word16 vad_hover_flag[], /* o : VAD hangover flag */ - Word32 band_energies_LR_fx[2 * NB_BANDS], /* o : energy in critical bands without minimum noise floor E_MIN Q_buffer[1] + QSCALE + 2 - band_ener_guardbits*/ - Word32 *PS_out_fx, /* o : energy spectrum Q_buffer + QSCALE */ - Word16 *Bin_E_out_fx, /* o : log-energy spectrum of the current frame Q7 */ - Word16 Q_inp, - Word16 *Q_buffer, - Word16 Q_add, - Word16 *front_create_flag ); -#endif + ivas_error front_vad_spar( SPAR_ENC_HANDLE hSpar, /* i/o: SPAR encoder structure */ const float *omni_in, /* i : omnidirectional input signal */ @@ -3777,12 +3017,7 @@ void stereo_cna_update_params( const int16_t output_frame, /* i : Output frame length */ const int16_t tdm_ratio_idx /* i : TDM ratio index */ ); -void stereo_cna_update_params_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 *output_fx[CPE_CHANNELS], /* i : Output signal OUTPUT_Q*/ - const Word16 output_frame, /* i : Output frame length Q0*/ - const Word16 tdm_ratio_idx /* i : TDM ratio index Q0*/ -); + void dtx_enc_init( Encoder_State *st, /* i : Encoder state handle */ const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ @@ -3802,23 +3037,6 @@ void mvr2r_inc( const int16_t n /* i : vector size */ ); -#ifdef IVAS_FLOAT_FIXED -void mvr2r_inc_fixed_one( - const Word32 x_fx[], /* i : input vector */ - const Word16 x_inc, /* i : increment for vector x[] */ - Word32 y_fx[], /* o : output vector */ - const Word16 y_inc, /* i : increment for vector y[] */ - const Word16 n /* i : vector size */ -); - -void mvr2r_inc_fixed( - const Word32 x_fx[], /* i : input vector */ - const int16_t x_inc, /* i : increment for vector x[] */ - Word32 y_fx[], /* o : output vector */ - const int16_t y_inc, /* i : increment for vector y[] */ - const int16_t n /* i : vector size */ -); -#endif void v_add_inc( const float x1[], /* i : Input vector 1 */ const int16_t x_inc, /* i : Increment for input vector 1 */ @@ -3829,45 +3047,6 @@ void v_add_inc( const int16_t N /* i : Vector length */ ); -#ifdef IVAS_FLOAT_FIXED -void v_mult_inc_fx( - const Word32 x1_fx[], /* i : Input vector 1 */ - Word16 *x1_q_fx, - const Word16 x1_inc, /* i : Increment for input vector 1 */ - const Word32 x2_fx[], /* i : Input vector 2 */ - Word16 *x2_q_fx, - const Word16 x2_inc, /* i : Increment for input vector 1 */ - Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ - Word16 *y_q_fx, - const Word16 y_inc, /* i : increment for vector y[i] */ - const Word16 N /* i : Vector length */ -); - -void v_add_inc_fx( - const Word32 x1[], /* i : Input vector 1 */ - const Word16 x_inc, /* i : Increment for input vector 1 */ - const Word32 x2[], /* i : Input vector 2 */ - const Word16 x2_inc, /* i : Increment for input vector 2 */ - Word32 y[], /* o : Output vector that contains vector 1 + vector 2 */ - const Word16 y_inc, /* i : increment for vector y[] */ - const Word16 N /* i : Vector length */ -); -Word32 logsumexp_fx( - const Word32 x[], /* i : input array x */ - const Word16 x_e, - const Word16 N /* i : number of elements in array x */ -); -Word32 lin_interp32_fx( - const Word32 x, /* i : the value to be mapped */ - const Word32 x1, /* i : source range interval: low end */ - const Word32 y1, /* i : source range interval: high end */ - const Word32 x2, /* i : target range interval: low */ - const Word32 y2, /* i : target range interval: high */ - const Word16 flag_sat, /* i : flag to indicate whether to apply saturation */ - Word16 *Q_io /*i/o : i/o Q factor of the output*/ -); -#endif - void v_mult_inc( const float x1[], /* i : Input vector 1 */ const int16_t x1_inc, /* i : Increment for input vector 1 */ @@ -3878,21 +3057,6 @@ void v_mult_inc( const int16_t N /* i : Vector length */ ); -#ifdef IVAS_FLOAT_FIXED -void v_addc_fx( - const Word32 x_fx[], /* i : Input vector */ - const Word32 c_fx, /* i : Constant */ - Word32 y_fx[], /* o : Output vector that contains c*x */ - const Word16 N /* i : Vector length */ -); -#endif - -void v_addc_fixed( - const Word32 x[], /* i : Input vector */ - const Word32 c, /* i : Constant */ - Word32 y[], /* o : Output vector that contains c*x */ - const Word16 N /* i : Vector length */ -); void v_addc( const float x[], /* i : Input vector */ const float c, /* i : Constant */ @@ -3900,28 +3064,6 @@ void v_addc( const int16_t N /* i : Vector length */ ); -#ifdef IVAS_FLOAT_FIXED -void v_min_fx( - const Word32 x1_fx[], /* i : Input vector 1 */ - Word16 *x1_q_fx, - const Word32 x2_fx[], /* i : Input vector 2 */ - Word16 *x2_q_fx, - Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ - Word16 *y_q_fx, - const Word16 N /* i : Vector length */ -); - -void v_mult_inc_fixed( - const Word32 x1_fx[], /* i : Input vector 1 */ - const Word16 x1_inc, /* i : Increment for input vector 1 */ - const Word32 x2_fx[], /* i : Input vector 2 */ - const Word16 x2_inc, /* i : Increment for input vector 1 */ - Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ - const Word16 y_inc, /* i : increment for vector y[i] */ - const Word16 N /* i : Vector length */ -); -#endif - void v_min( const float x1[], /* i : Input vector 1 */ const float x2[], /* i : Input vector 2 */ @@ -3929,15 +3071,6 @@ void v_min( const int16_t N /* i : Vector length */ ); -#ifdef IVAS_FLOAT_FIXED -void v_sqrt_fx( - const Word32 x[], /* i : Input vector */ - Word16 exp[], - Word32 y[], /* o : Output vector that contains sqrt(x) */ - const Word16 N /* i : Vector length */ -); -#endif - void v_sqrt( const float x[], /* i : Input vector */ float y[], /* o : Output vector that contains sqrt(x) */ @@ -3950,13 +3083,6 @@ float sumAbs( const int16_t lvec /* i : length of input vector */ ); -#ifdef IVAS_FLOAT_FIXED -Word32 sumAbs_fx( - const Word32 *vec, /* i : input vector */ - const Word16 lvec /* i : length of input vector */ -); -#endif - void mvc2c( const uint8_t x[], /* i : input vector */ uint8_t y[], /* o : output vector */ @@ -3970,42 +3096,6 @@ float dot_product_cholesky( const int16_t N /* i : vector & matrix size */ ); -#ifdef IVAS_FLOAT_FIXED -Word32 dot_product_cholesky_fx( - const Word32 *x, /* i : vector x */ - const Word32 *A, /* i : Cholesky matrix A */ - const Word16 N /* i : vector & matrix size */ -); -Word32 dot_product_cholesky_fixed( - const Word32 *x, /* i : vector x */ - const Word32 *A, /* i : Cholesky matrix A */ - const Word16 N, /* i : vector & matrix size */ - const Word16 exp_x, - const Word16 exp_A, - Word16 *exp_sum ); -#endif - -#ifdef IVAS_FLOAT_FIXED -void v_mult_mat_fx( - Word32 *y_fx, /* o : the product x*A */ - Word16 *y_q_fx, - const Word32 *x_fx, /* i : vector x */ - Word16 *x_q_fx, - const Word32 *A_fx, /* i : matrix A */ - Word16 *A_q_fx, - const Word16 N, /* i : number of rows */ - const Word16 C /* i : number of columns */ -); -void v_mult_mat_fixed( - Word32 *y, /* o : the product x*A */ - const Word32 *x, /* i : vector x */ - const Word32 *A, /* i : matrix A */ - const Word16 Nr, /* i : number of rows */ - const Word16 Nc, /* i : number of columns */ - Word16 guardbits -); -#endif - void v_mult_mat( float *y, /* o : the product x*A */ const float *x, /* i : vector x */ @@ -4044,29 +3134,7 @@ int16_t check_bounds_s( const int16_t high /* i : High limit */ ); -#ifdef IVAS_FLOAT_FIXED -Word16 check_bounds_s_fx( - const Word16 value, /* i : Input value */ - const Word16 low, /* i : Low limit */ - const Word16 high /* i : High limit */ -); -#endif - -Word32 check_bounds_l( - const Word32 value, /* i : Input value */ - const Word32 low, /* i : Low limit */ - const Word32 high /* i : High limit */ -); -#ifdef IVAS_FLOAT_FIXED -ivas_error stereo_memory_enc_fx( - CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ - const int32_t input_Fs, /* i : input sampling rate */ - const int16_t max_bwidth, /* i : maximum audio bandwidth */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const int16_t nchan_transport /* i : number transport chans */ - -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error stereo_memory_enc( CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ const int32_t input_Fs, /* i : input sampling rate */ @@ -4087,20 +3155,15 @@ ivas_error stereo_memory_dec( const MC_MODE mc_mode, /* i : MC mode */ const int16_t nchan_transport /* i : number of transport channels */ ); -#ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED void stereo_switching_enc_fx( CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ Word16 old_input_signal_pri[], /* i : old input signal of primary channel */ const Word16 input_frame, /* i : input frame length */ const Word16 q_inp ); -#else -void stereo_switching_enc( - CPE_ENC_HANDLE hCPE, /* i : CPE structure */ - float old_input_signal_pri[], /* i : old input signal of primary channel */ - const int16_t input_frame /* i : input frame length */ -); #endif + void stereo_switching_dec( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ const Word32 ivas_total_brate /* i : IVAS total bitrate Q0*/ @@ -4115,34 +3178,15 @@ void stereo_td2dft_update( const int16_t output_frame /* i : frame length */ ); -void stereo_td2dft_update_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const Word16 n, /* i : channel number Q0*/ - Word32 output_fx[], /* i/o: synthesis @internal Fs Q11*/ - Word32 synth_fx[], /* i/o: synthesis @output Fs Q11*/ - Word32 hb_synth_fx[], /* i/o: hb synthesis Q11*/ - const Word16 output_frame /* i : frame length Q0*/ -); void stereo_mdct2dft_update( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ float output0[], /* i/o: synthesis @internal Fs, ch0 */ float synth0[] /* i/o: synthesis @output Fs, ch0 */ ); -void stereo_mdct2dft_update_fx( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - Word32 output0_fx[], /* i/o: synthesis @internal Fs, ch0 Q11*/ - Word32 synth0_fx[] /* i/o: synthesis @output Fs, ch0 Q11*/ -); + /*! r: number of bits written */ -#ifdef IVAS_FLOAT_FIXED -Word16 write_GR0( - BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ - const Word16 ind, /* i : bitstream index */ - const Word16 *in, /* i : data to be encoded */ - const Word16 len /* i : input data length */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t write_GR0( BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ const int16_t ind, /* i : bitstream index */ @@ -4292,15 +3336,7 @@ void ivas_mdct_core_tns_ns( const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_mct_core_dec( - MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ - CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */ - const Word16 nCPE, /* i : number of CPEs */ - Word32 *signal_out_fx[], - Word16 q_x[MCT_MAX_CHANNELS] -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_mct_core_dec( MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */ @@ -4369,10 +3405,10 @@ void deindex_sph_idx( float *phi /* o : Azimuth */ ); void deindex_sph_idx_fx( - const UWord16 sphIndex, /* i : Spherical index */ - const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ - Word32 *theta_fx, /* o : Elevation */ - Word32 *phi_fx /* o : Azimuth */ + const UWord16 sphIndex, /* i : Spherical index */ + const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ + Word32 *theta_fx, /* o : Elevation Q22*/ + Word32 *phi_fx /* o : Azimuth Q22 */ ); /*! r: output index for direction */ @@ -4429,18 +3465,8 @@ int16_t ivas_qmetadata_dec_sid_decode( int16_t *element_mode, /* o : element mode */ const int16_t ivas_format /* i : IVAS format */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_qmetadata_to_dirac_fx( - const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ - DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ - MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ - SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const IVAS_FORMAT ivas_format, /* i : IVAS format */ - const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ -); -#else + +#ifndef IVAS_FLOAT_FIXED void ivas_qmetadata_to_dirac( const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ @@ -4452,6 +3478,7 @@ void ivas_qmetadata_to_dirac( int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); #endif + #ifndef IVAS_FLOAT_FIXED ivas_error ivas_qmetadata_open( IVAS_QMETADATA_HANDLE *hQMetaData /* i/o: q_metadata handle */ @@ -4483,13 +3510,6 @@ int16_t masa_sq( const int16_t cb_sz /* i : codebook size */ ); -#ifdef IVAS_FLOAT_FIXED -Word16 masa_sq_fx( - const Word32 in, /* i : input value */ - const Word32 *threshold, /* i : partition */ - const Word16 cb_sz /* i : codebook size */ -); -#endif void ivas_qmetadata_azimuth_elevation_to_direction_vector( const float az, /* i : azimuth */ const float el, /* i : elevation */ @@ -4530,16 +3550,6 @@ uint16_t quantize_direction( const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); -#ifdef IVAS_FLOAT_FIXED -Word16 quantize_direction2D_fx( - Word32 phi, /* i : input azimuth value Q22 */ - const Word16 no_cw, /* i : number of bits */ - Word32 *phi_q, /* o : quantized azimuth value Q22 */ - UWord16 *index_phi, /* o : quantized azimuth index */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ -); -#endif - int16_t quantize_direction2D( float phi, /* i : input azimuth value */ const int16_t no_cw, /* i : number of bits */ @@ -4556,15 +3566,6 @@ float companding_azimuth( const int16_t direction /* i : direction of companding (direct or inverse)*/ ); -#ifdef IVAS_FLOAT_FIXED -Word32 companding_azimuth_fx( - const Word32 azi_fx, /* i : input azimuth value */ - const MC_LS_SETUP mc_format, /* i : input channel format */ - const Word16 theta_flag, /* i : zero/non zero elevation flag */ - const Word16 direction /* i : direction of companding (direct or inverse)*/ -); -#endif - /*! r: index azimuth */ int16_t quantize_phi_chan_lbr( const float phi, /* i : azimuth value */ @@ -4603,21 +3604,7 @@ int16_t quantize_phi( float *phi_hat, /* o : quantized azimuth */ const int16_t n /* i : azimuth codebook size */ ); -#ifdef IVAS_FLOAT_FIXED -Word16 quantize_phi_fx( - Word32 phi, /* i : azimuth value */ - const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ - Word32 *phi_hat, /* o : quantized azimuth */ - const Word16 n /* i : azimuth codebook size */ -); -Word16 quantize_phi_enc_fx( - Word32 phi, /* i : azimuth value */ - const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ - Word32 *phi_hat, /* o : quantized azimuth */ - const Word16 n /* i : azimuth codebook size */ -); -#endif /*! r: decoded elevation value */ float deindex_elevation( uint16_t *id_th, /* i : input index */ @@ -4625,14 +3612,6 @@ float deindex_elevation( const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); -#ifdef IVAS_FLOAT_FIXED -Word32 deindex_elevation_fx( - UWord16 *id_th, /* i : input index */ - const Word16 no_bits, /* i : number of bits for the spherical grid */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ -); -#endif - float deindex_azimuth( int16_t id_phi, /* i : index */ const int16_t no_bits, /* i : number of bits for the spherical grid */ @@ -4641,24 +3620,7 @@ float deindex_azimuth( const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); -#ifdef IVAS_FLOAT_FIXED -Word32 deindex_azimuth_fx( - Word16 id_phi, /* i : index */ - const Word16 no_bits, /* i : number of bits for the spherical grid */ - const Word16 id_th, /* i : elevation index */ - const Word16 remap, /* i : remapping flag */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ -); -void deindex_spherical_component_fx( - const UWord16 sph_idx, /* i : spherical index */ - Word32 *az_fx, /* o : decoded azimuth value */ - Word32 *el_fx, /* o : decoded elevation value */ - UWord16 *az_idx, /* o : azimuth index */ - UWord16 *el_idx, /* o : elevation index */ - const UWord16 no_bits, /* i : number of bits for the spherical grid */ - const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ -); -#else +#ifndef IVAS_FLOAT_FIXED void deindex_spherical_component( const uint16_t sph_idx, /* i : spherical index */ float *az, /* o : decoded azimuth value */ @@ -4713,23 +3675,7 @@ int16_t ivas_chan_project_elevation_index( ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_dirac_param_est_enc( - DIRAC_ENC_HANDLE hDirAC, - IVAS_QDIRECTION *q_direction, - const UWord8 useLowerRes, - Word32 *data_f_fx[], - Word32 **pp_fr_real_fx, - Word32 **pp_fr_imag_fx, - Word16 pp_fr_q, - const Word16 input_frame, - const IVAS_FORMAT ivas_format, - const Word16 hodirac_flag, - const Word16 nchan_fb_in, - Word16 *mono_frame_count, - Word16 *dirac_mono_flag -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_param_est_enc( DIRAC_ENC_HANDLE hDirAC, IVAS_QDIRECTION *q_direction, @@ -4783,14 +3729,8 @@ void ivas_init_dec_get_num_cldfb_instances( int16_t *numCldfbSyntheses /* o : number of CLDFB synthesis instances */ ); #endif // !IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_cldfb_dec_reconfig_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ - Word16 numCldfbAnalyses_old, /* i : number of CLDFB analysis instances in previous frame */ - const Word16 numCldfbSyntheses_old /* i : number of CLDFB synthesis instances in previous frame */ -); -#else + +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_cldfb_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : number of TCs in previous frame */ @@ -4805,20 +3745,6 @@ int16_t ivas_sba_get_order( const int16_t sba_planar /* i : SBA planar flag */ ); -#ifdef IVAS_FLOAT_FIXED -Word16 ivas_sba_get_order_fx( - const Word16 nb_channels, /* i : Number of ambisonic channels */ - const Word16 sba_planar /* i : SBA planar flag */ -); - -#endif - -/*! r: Ambisonic (SBA) order used for analysis and coding */ -Word16 ivas_sba_get_analysis_order( - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ -); - /*! r: number of Ambisonic channels */ int16_t ivas_sba_get_nchan( const int16_t sba_order, /* i : Ambisonic (SBA) order */ @@ -4826,32 +3752,13 @@ int16_t ivas_sba_get_nchan( ); /*! r: number of ambisonics metadata channels */ -#ifdef IVAS_FLOAT_FIXED -Word16 ivas_sba_get_nchan_metadata( - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t ivas_sba_get_nchan_metadata( const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); #endif -void ivas_sba_get_spar_hoa_ch_ind( - const Word16 num_md_chs, /* i : number of MD channels */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - Word16 HOA_md_ind[IVAS_SPAR_MAX_CH] -); - -/*! r: flag indicating to code SPAR HOA MD for all bands */ -void ivas_sba_get_spar_hoa_md_flag( - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - Word16 *spar_hoa_md_flag, - Word16 *spar_hoa_dirac2spar_md_flag -); - void ivas_sba_zero_vert_comp( float *sba_data[], /* i : SBA signals */ const int16_t sba_order, /* i : Ambisonic (SBA) order */ @@ -4865,14 +3772,6 @@ void ivas_sba_getTCs( const int16_t input_frame /* i : frame length */ ); -/*! r: SBA DirAC stereo flag */ -#ifdef IVAS_FLOAT_FIXED -Word16 ivas_sba_remapTCs_fx( - Word32 *sba_data[], /* i/o: SBA signals */ - Decoder_Struct *st_ivas, /* i/o: decoder struct */ - const Word16 output_frame /* i : frame length */ -); -#endif // IVAS_FLOAT_FIXED int16_t ivas_sba_remapTCs( float *sba_data[], /* i/o: SBA signals */ Decoder_Struct *st_ivas, /* i/o: decoder struct */ @@ -4918,27 +3817,13 @@ void ivas_sba2mc_cldfb( const int16_t nb_timeslots, /* i : number of time slots to process */ const float *hoa_dec_mtx /* i : HOA decoding mtx */ ); -#else -void ivas_sba2mc_cldfb_fixed( - IVAS_OUTPUT_SETUP hInSetup, /* i : Format of input layout */ - Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb real part (Q_real) */ - Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part (Q_imag) */ - const Word16 nb_channels_out, /* i : nb of output channels */ - const Word16 nb_bands, /* i : nb of CLDFB bands to process */ - const Word16 nb_timeslots, /* i : number of time slots to process */ - const Word32 *hoa_dec_mtx /* i : HOA decoding mtx */ -); #endif /*----------------------------------------------------------------------------------* * DirAC prototypes *----------------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_dirac_enc_open_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_dirac_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); @@ -4948,33 +3833,14 @@ ivas_error ivas_dirac_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_dirac_enc_close_fx( - DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ - const Word32 input_Fs /* i : input sampling_rate */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_enc_close( DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ const int32_t input_Fs /* i : input sampling_rate */ ); #endif -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_dirac_enc_fx( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ - Word32 *data_f[], /* i/o: SBA channels */ - Word32 **ppIn_FR_real, /* o : real freq domain values */ - Word32 **ppIn_FR_imag, /* o : imag freq domain values */ - Word16 pp_fr_q, - const int16_t input_frame, /* i : input frame length */ - const int16_t dtx_vad, /* i : DTX vad flag */ - const IVAS_FORMAT ivas_format, /* i : ivas format */ - const int16_t hodirac_flag /* i : hodirac flag */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_dirac_enc( DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ @@ -5004,17 +3870,6 @@ void ivas_dirac_config_bands( IVAS_FB_MIXER_HANDLE hFbMdft ); -#ifdef IVAS_FLOAT_FIXED -void ivas_dirac_config_bands_fx( - Word16 *band_grouping, /* o : band grouping */ - const Word16 nbands, /* i : number of bands */ - const Word16 max_band, /* i : maximal band index +1 */ - Word16 *dirac_to_spar_md_bands, /* o : mapping of DirAC parameter band index to SPAR FB band index */ - const Word8 useLowerBandRes, /* i : flag indicating lower band resolution for DirAC */ - const Word16 enc_param_start_band, /* i : band index of first DirAC parameter band */ - IVAS_FB_MIXER_HANDLE hFbMdft -); -#endif void ivas_get_dirac_sba_max_md_bits( const int32_t sba_total_brate, int16_t *bits_frame_nominal, @@ -5063,23 +3918,8 @@ void generate_masking_noise_lb_dirac( const int16_t cna_flag /* i : CNA flag for LB and HB */ ); #ifdef IVAS_FLOAT_FIXED -void generate_masking_noise_lb_dirac_fx( - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - Word32 *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ - const Word16 nCldfbTs, /* i : number of CLDFB slots that will be rendered */ - const Word16 cna_flag /* i : CNA flag for LB and HB */ -); -#endif -#ifdef IVAS_FLOAT_FIXED -void ivas_dirac_dec_close_fx( - DIRAC_DEC_HANDLE *hDirAC_out -); -void ivas_dirac_dec_set_md_map( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nCldfbTs /* i : number of CLDFB time slots */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_dec_set_md_map( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nCldfbTs /* i : number of CLDFB time slots */ @@ -5110,29 +3950,7 @@ void computeDiffuseness_mdft( const uint16_t no_col_avg_diff, float *diffuseness ); -#ifdef IVAS_FLOAT_FIXED -void computeDirectionVectors_fixed( - Word32 *intensity_real_x, - Word32 *intensity_real_y, - Word32 *intensity_real_z, - const Word16 enc_param_start_band, - const Word16 num_frequency_bands, - Word32 *direction_vector_x,/*Q30*/ - Word32 *direction_vector_y,/*Q30*/ - Word32 *direction_vector_z,/*Q30*/ - Word16 i_e /*Exponent of all the intensity buffers*/); -void computeDirectionVectors_fx( - Word32 *intensity_real_x, - Word32 *intensity_real_y, - Word32 *intensity_real_z, - const Word16 enc_param_start_band, - const Word16 num_frequency_bands, - Word32 *direction_vector_x, - Word32 *direction_vector_y, - Word32 *direction_vector_z , - Word16 *q_factor -); -#endif + void computeDirectionVectors( float *intensity_real_x, float *intensity_real_y, @@ -5151,64 +3969,14 @@ void computeDiffuseness( float *diffuseness ); -#ifdef IVAS_FLOAT_FIXED - -void computeDiffuseness_fx( - Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], - const Word32 *buffer_energy, - const Word16 num_freq_bands, - Word32 *diffuseness , - Word16 q_factor_intensity, - Word16 q_factor_energy, - Word16 *out_exp - -); -#endif -#ifdef IVAS_FLOAT_FIXED -void computeDiffuseness_fixed( - Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], - const Word32 *buffer_energy, - const Word16 num_freq_bands, - Word32 *diffuseness , - Word16 *q_factor_intensity, - Word16 *q_factor_energy, - Word16 *q_diffuseness -); -#endif void ivas_dirac_dec_get_response( const int16_t azimuth, const int16_t elevation, float *response, const int16_t ambisonics_order ); -#ifdef IVAS_FLOAT_FIXED -void ivas_dirac_dec_get_response_fx( - const Word16 azimuth, - const Word16 elevation, - Word32 * response, - const Word16 ambisonics_order, - Word16 Q_out); -#endif - -#ifdef IVAS_FLOAT_FIXED -void calculate_hodirac_sector_parameters_fx( - DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ - Word32 RealBuffer_fx[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector (L+1)^2 x N_bins, real part */ - Word32 ImagBuffer_fx[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector, imaginary part */ - Word16 Qfac, /* i : Q-factor of signal vector */ - const Word32 beta_fx, /* i : forgetting factor for average filtering, Q30 */ - const Word16 *band_grouping, /* i : indices of band groups */ - const Word16 N_bands, /* i : number of bands (groups) */ - const Word16 enc_param_start_band, /* i : first band to process */ - Word32 *azi_fx, /* o : array of sector azimuth angles, flat Q23 */ - Word32 *ele_fx, /* o : array of sector elevation angles, flat Q23 */ - Word32 *diff_fx, /* o : array of sector diffuseness values, flat */ - Word16 *diff_exp, /* o : array of sector diffuseness exponents, flat */ - Word32 *ene_fx, /* o : array of sector energy values, flat */ - Word16 *ene_exp /* o : array of sector energy exponents, flat */ -); -#else +#ifndef IVAS_FLOAT_FIXED void calculate_hodirac_sector_parameters( DIRAC_ENC_HANDLE hDirAC, float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ @@ -5224,14 +3992,7 @@ void calculate_hodirac_sector_parameters( ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_mc_paramupmix_enc_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ - Word32 *data_fx[], - const int16_t input_frame /* i : input frame length */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_mc_paramupmix_enc( Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ @@ -5269,17 +4030,7 @@ void ivas_mc_paramupmix_dec_digest_tc( const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ const int16_t nSamplesForRendering /* i : number of samples provided */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_mc_paramupmix_dec_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - Word32 *input_fx[], /* i : core-coder transport channels */ - Word32 *output_fx[] /* i/o: synthesized core-coder transport channels */ -); -#else - +#ifndef IVAS_FLOAT_FIXED void ivas_mc_paramupmix_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -5315,12 +4066,7 @@ void ivas_param_mc_create_full_icc_mapping( ); #endif /*! r: number of IVAS transport channels */ -#ifdef IVAS_FLOAT_FIXED -Word16 ivas_param_mc_getNumTransportChannels( - const Word32 ivas_total_bitrate, /* i : IVAS total bitrate */ - const MC_LS_SETUP mc_ls_setup /* i : MC ls setup */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t ivas_param_mc_getNumTransportChannels( const int32_t ivas_total_bitrate, /* i : IVAS total bitrate */ const MC_LS_SETUP mc_ls_setup /* i : MC ls setup */ @@ -5346,30 +4092,16 @@ void ivas_param_mc_enc( float *data_f[], /* i/o: input/transport MC data */ const int16_t input_frame /* i : input frame length */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_param_mc_dec_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif // IVAS_FLOAT_FIXED ivas_error ivas_param_mc_dec_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_param_mc_dec_reconfig_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif // IVAS_FLOAT_FIXED - ivas_error ivas_param_mc_dec_reconfig( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_param_mc_dec_close_fx( - PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ -); -#else + +#ifndef IVAS_FLOAT_FIXED void ivas_param_mc_dec_close( PARAM_MC_DEC_HANDLE *hParamMC /* i/o: Parametric MC decoder handle */ ); @@ -5390,23 +4122,6 @@ void ivas_param_mc_dec_digest_tc( float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output*/ ); -void ivas_param_mc_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord8 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - Word32 *transport_channels_f_fx[], - Word16 transport_f_e ); - -#ifdef IVAS_FLOAT_FIXED -void ivas_param_mc_dec_render_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - Word32 *output_f_fx[], /* o : rendered time signal */ - Word16 channel_active_fx[MAX_OUTPUT_CHANNELS] -); -#endif - void ivas_param_mc_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -5457,79 +4172,7 @@ int16_t matrix_product( float *Z /* o : resulting matrix after the matrix multiplication */ ); -#ifdef IVAS_FLOAT_FIXED -Word16 matrix_product_mant_exp_fx( - const Word32 *X_fx, /* i : left hand matrix */ - const Word16 X_fx_e, /* i : left hand matrix */ - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y_fx, /* i : right hand matrix */ - const Word16 Y_fx_e, /* i : right hand matrix */ - const Word16 rowsY, /* i : number of rows of the right hand matrix */ - const Word16 colsY, /* i : number of columns of the right hand matrix */ - const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z_fx, /* o : resulting matrix after the matrix multiplication */ - Word16 *Z_fx_e /* o : resulting matrix after the matrix multiplication */ -); - -Word16 matrix_product_fx( - const Word32 *X_fx, /* i : left hand matrix */ - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y_fx, /* i : right hand matrix */ - const Word16 rowsY, /* i : number of rows of the right hand matrix */ - const Word16 colsY, /* i : number of columns of the right hand matrix */ - const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ -); - -Word16 matrix_product_q30_fx( - const Word32 *X_fx, /* i : left hand matrix */ - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y_fx, /* i : right hand matrix */ - const Word16 rowsY, /* i : number of rows of the right hand matrix */ - const Word16 colsY, /* i : number of columns of the right hand matrix */ - const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ -); - -Word16 matrix_product_mant_exp( - const Word32 *X_fx, /* i : left hand matrix */ - const Word16 *X_e, /* i : left hand matrix */ - const Word16 rowsX, /* i : number of rows of the left hand matrix */ - const Word16 colsX, /* i : number of columns of the left hand matrix */ - const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ - const Word32 *Y_fx, /* i : right hand matrix */ - const Word16 *Y_e, /* i : right hand matrix */ - const Word16 rowsY, /* i : number of rows of the right hand matrix */ - const Word16 colsY, /* i : number of columns of the right hand matrix */ - const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ - Word32 *Z_fx, /* o : resulting matrix after the matrix multiplication */ - Word16 *Z_e /* o : resulting matrix after the matrix multiplication */ -); -#endif - -#ifdef IVAS_FLOAT_FIXED -void mat2svdMat_fx( - const Word32 *mat, /* i : matrix as column ordered vector Qx*/ - Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* o : matrix as two-dimensional arry Qx*/ - const Word16 nRows, /* i : number of rows of the matrix Q0*/ - const Word16 mCols, /* i : number of columns of the matrix Q0*/ - const Word16 transpose /* i : flag indication transposition Q0*/ -); - -void svdMat2mat_fx( - Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* i : matrix as two-dimensional arry Qx*/ - Word32 *mat, /* o : matrix as column ordered vector Qx*/ - const Word16 nRows, /* i : number of rows of the matrix Q0*/ - const Word16 mCols /* i : number of columns of the matrix Q0*/ -); -#else - +#ifndef IVAS_FLOAT_FIXED void mat2svdMat( const float *mat, /* i : matrix as column ordered vector */ float svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* o : matrix as two-dimensional arry */ @@ -5600,27 +4243,6 @@ int16_t computeMixingMatrices( float *mixing_matrix, /* o : resulting mixing matrix */ float *Cr /* o : residual covariance matrix */ ); - -#else -Word16 computeMixingMatrices_fx( - const Word16 num_inputs, /* i : number of input channels */ - const Word16 num_outputs, /* i : number of output channels */ - const Word32 *Cx, /* i : input channel covariance matrix */ - Word16 Cx_e, - const Word32 *Cy, /* i : target covariance matrix */ - Word16 Cy_e, - const Word32 *Q, /* i : prototype matrix (usually a upmix matrix) */ - Word16 Q_fx_e, - const Word16 energy_compensation_flag, /* i : flag indicating that the energy compensation should be performed (i.e. no residual mixing matrix will follow) */ - const Word32 reg_Sx_fx, /* i : regularization factor for the input channel singular values */ - Word16 reg_Sx_e, - const Word32 reg_ghat_fx, /* i : regularization factor for the normalization matrix */ - Word16 reg_ghat_e, - Word32 *mixing_matrix_fx, /* o : resulting mixing matrix */ - Word16 *mixing_matrix_out_e, - Word32 *Cr_fx, /* o : residual covariance matrix */ - Word16 *Cr_e -); #endif #ifndef IVAS_FLOAT_FIXED @@ -5632,36 +4254,9 @@ int16_t computeMixingMatricesResidual( const float reg_ghat, /* i : regularization factor for the normalization matrix */ float *mixing_matrix /* o : resulting residual mixing matrix */ ); - -#else -Word16 computeMixingMatricesResidual_fx( - const Word32 num_outputs, /* i : number of output channels */ - const Word32 *Cx_fx, /* i : vector containing the diagonal diffuse prototype covariance */ - const Word16 Cx_e, - const Word32 *Cy_fx, /* i : matrix containing the missing cov (Cr from computeMixingMatrices()) */ - const Word16 Cy_fx_e, - const Word32 reg_Sx_fx, /* i : regularization factor for the input channel singular values */ - const Word16 reg_Sx_e, - const Word32 reg_ghat_fx, /* i : regularization factor for the normalization matrix */ - const Word16 reg_ghat_e, - Word32 *mixing_matrix_fx, /* o : resulting residual mixing matrix */ - Word16 *mixing_matrix_ret_e -); #endif -#ifdef IVAS_FLOAT_FIXED -/*! r: error or success */ -Word16 svd_fx( - Word32 InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) InputMatrix_e*/ - Word16 InputMatrix_e, - Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS], /* o : left singular vectors (U) Q31*/ - Word32 singularValues_fx[MAX_OUTPUT_CHANNELS], /* o : singular values vector (S) singularValues_fx_e*/ - Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* o : right singular vectors (V) Q31*/ - Word16 singularValues_fx_e[MAX_OUTPUT_CHANNELS], - const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ - const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed Q0*/ -); -#else +#ifndef IVAS_FLOAT_FIXED /*! r: error or success */ int16_t svd( float InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) */ @@ -5673,20 +4268,6 @@ int16_t svd( ); #endif -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( - DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ - DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: hanlde for the covariance synthesis state */ - const Word16 max_band_decorr, /* i : uppermost frequency band where decorrelation is applied */ - const Word16 interp_length, /* i : length for interpolating the mixing matrices in time slots */ - const Word16 num_param_bands, /* i : number of parameter bands */ - const Word16 num_param_bands_residual, /* i : number of parameter bands with a residual mixing matrix (i.e. decorrelation */ - const Word16 nchan_in, /* i : number of input (transport) channels */ - const Word16 nchan_out, /* i : number of output channels */ - const Word32 *proto_matrix /* i : the prototype (upmix) matrix (only used if mode == 1) */ -); -#endif // IVAS_FLOAT_FIXED - ivas_error ivas_dirac_dec_output_synthesis_cov_open( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: handle for the covariance synthesis state */ @@ -5699,26 +4280,10 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( const float *proto_matrix /* i : the prototype (upmix) matrix (only used if mode == 1) */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_dirac_dec_output_synthesis_get_interpolator_fx( - DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ - const UWord16 interp_length /* i : interpolator length */ -); -#endif - void ivas_dirac_dec_output_synthesis_get_interpolator( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ const uint16_t interp_length /* i : interpolator length */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_dirac_dec_output_synthesis_cov_init_fx( - DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: pointer to the state of the covariance synthesis */ - const Word16 nchan_in, /* i : number of input (tranport) channels */ - const Word16 nchan_out, /* i : number of output channels */ - const Word16 n_param_bands, /* i : number of total parameter bands */ - const Word16 n_param_bands_res /* i : number of parameter bands with a residual mixing matrix (i.e. decorrelation */ -); -#endif void ivas_dirac_dec_output_synthesis_cov_init( DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: pointer to the state of the covariance synthesis */ @@ -5727,12 +4292,6 @@ void ivas_dirac_dec_output_synthesis_cov_init( const int16_t n_param_bands, /* i : number of total parameter bands */ const int16_t n_param_bands_res /* i : number of parameter bands with a residual mixing matrix (i.e. decorrelation */ ); -#ifdef IVAS_FLOAT_FIXED1 -void ivas_dirac_dec_output_synthesis_cov_close_fx( - DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i : handle for the covariance synthesis parameters */ - DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state /* i/o: handle for the covariance synthesis state */ -); -#endif // IVAS_FLOAT_FIXED void ivas_dirac_dec_output_synthesis_cov_close( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i : handle for the covariance synthesis parameters */ @@ -5764,44 +4323,7 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( - Word32 *Cldfb_RealBuffer_in_fx, - Word32 *Cldfb_ImagBuffer_in_fx, - Word32 Cldfb_RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ - Word32 Cldfb_ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ - Word32 *mixing_matrix_fx[], /* i : parameter band wise mixing matrices (direct part) */ - Word16 *mixing_matrix_e, /* i : parameter band wise mixing matrices (direct part) */ - Word32 *mixing_matrix_res_fx[], /* i : parameter band wise mixing matrices (residual part) */ - Word16 *mixing_matrix_res_e, /* i : parameter band wise mixing matrices (residual part) */ - const UWord16 slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ - const UWord16 slot_idx_tot, /* i : time slot index for the current slot within the frame */ - const Word16 nX, /* i : number of input channels */ - const Word16 nY, /* i : number of output channels */ - PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ -); -#endif - -#ifdef IVAS_FLOAT_FIXED -Word16 computeMixingMatricesISM_fx( - const Word16 num_inputs, - const Word16 num_responses, - const Word16 num_outputs, - const Word32 *responses_fx, - const Word16 responses_e, - const Word32 *ener_fx, - const Word16 ener_e, - const Word32 *Cx_diag_fx, - const Word16 Cx_diag_e, - const Word32 *Cy_diag_fx, - const Word16 Cy_diag_e, - const Word16 *Q_16fx, //Q15 - const Word16 energy_compensation_flag, - const Word32 reg_Sx_fx, - const Word32 reg_ghat_fx, - Word32 *mixing_matrix_fx, - Word16 *mixing_matrix_e); -#else +#ifndef IVAS_FLOAT_FIXED int16_t computeMixingMatricesISM( const int16_t num_inputs, const int16_t num_responses, @@ -5836,11 +4358,6 @@ ivas_error ivas_spar_enc_open( const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); -ivas_error ivas_spar_enc_open_fx( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder handle */ - const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ -); - void ivas_spar_enc_close( SPAR_ENC_HANDLE *hSpar, /* i/o: SPAR encoder handle */ const int32_t input_Fs, /* i : input sampling rate */ @@ -5867,12 +4384,6 @@ void ivas_spar_dec_close( const int32_t output_Fs, /* i : output sampling rate */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); -#else -void ivas_spar_dec_close_fx( - SPAR_DEC_HANDLE *hSpar, /* i/o: SPAR decoder handle */ - const Word32 output_Fs, /* i : output sampling rate */ - const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ -); #endif ivas_error ivas_spar_dec( @@ -5889,16 +4400,6 @@ void ivas_spar_config( int32_t *core_nominal_brate, /* o : core-coding nominal bitrate */ const int16_t sid_format /* i : IVAS format indicator from SID frame */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_sba_linear_renderer_fx( - Word32 *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nchan_in, /* i : number of input ambisonics channels */ - const Word16 nchan_ism, /* i : number of objects */ - const AUDIO_CONFIG output_config, /* i : output audio configuration */ - const IVAS_OUTPUT_SETUP output_setup /* i : output format setup */ -); -#endif // IVAS_FLOAT_FIXED ivas_error ivas_sba_linear_renderer( float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ @@ -5908,17 +4409,6 @@ ivas_error ivas_sba_linear_renderer( const AUDIO_CONFIG output_config, /* i : output audio configuration */ const IVAS_OUTPUT_SETUP output_setup /* i : output format setup */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_sba_mix_matrix_determiner_fx( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - Word32 *output_fx[], /* i/o: transport/output audio channels */ - const Word16 bfi, /* i : BFI flag */ - const Word16 nchan_remapped, /* i : num channels after remapping of TCs */ - const Word16 output_frame, /* i : output frame length */ - const Word16 num_md_sub_frames, /* i : number of subframes in mixing matrix*/ - const Word16 Q_output /* i : Q of transport/output audio channels */ -); -#endif // IVAS_FLOAT_FIXED void ivas_sba_mix_matrix_determiner( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ @@ -5935,10 +4425,6 @@ void ivas_sba_mix_matrix_determiner( int16_t ivas_agc_enc_get_flag( const int16_t nchan_transport /* i : number of transport channels */ ); -#else -Word16 ivas_agc_enc_get_flag( - const Word16 nchan_transport /* i : number of transport channels */ -); #endif ivas_error ivas_spar_agc_enc_open( @@ -5947,34 +4433,10 @@ ivas_error ivas_spar_agc_enc_open( const int16_t nchan_inp /* i : number of input channels */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_spar_agc_enc_open_fx( - ivas_agc_enc_state_t **hAgcEnc, /* i/o: SPAR AGC encoder handle */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word16 nchan_inp /* i : number of input channels */ -); -#endif - void ivas_spar_agc_enc_close( ivas_agc_enc_state_t **hAgcEnc /* i/o: AGC encoder handle */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_spar_agc_enc_close_fx( - ivas_agc_enc_state_t **hAgcEnc /* i/o: SPAR AGC encoder handle */ -); - -void ivas_agc_enc_process_fx( - ivas_agc_enc_state_t *hAgcEnc, /* i/o: AGC encoder handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ - Word32 **ppPcm_in, /* i : input audio channels */ - Word32 **ppPcm_out, /* o : output audio channels */ - const Word16 n_channels, /* i : number of channels */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - Word16 *q_ppPcm -); -#endif - void ivas_agc_enc_process( ivas_agc_enc_state_t *hAgcEnc, /* i/o: AGC encoder handle */ BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ @@ -6000,12 +4462,6 @@ ivas_error ivas_spar_md_enc_init const int16_t sba_order /* i : Ambisonic (SBA) order */ ); -ivas_error ivas_spar_md_enc_init_fx( - ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ -); - void ivas_agc_dec_process( ivas_agc_dec_state_t *hAgcDec, /* i/o: AGC decoder handle */ float *pcm_in[], /* i : input audio channels */ @@ -6072,15 +4528,6 @@ void ivas_spar_set_bitrate_config( const int16_t agc_flag ); -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 */ - const Word16 num_bands, /* i : number of bands */ - const Word16 dirac2spar_md_flag, - const Word16 enc_flag, - const Word16 pca_flag, - const Word16 agc_flag); - void ivas_spar_bitrate_dist( int32_t core_brates_act[], /* o : bitrates per core-coder */ const int16_t nAvailBits, /* i : number of available bits */ @@ -6125,12 +4572,6 @@ void ivas_itda( const int16_t length ); -void ivas_spar_get_cldfb_gains_fx( - SPAR_DEC_HANDLE hSpar, - HANDLE_CLDFB_FILTER_BANK cldfbAnaDec0, - HANDLE_CLDFB_FILTER_BANK cldfbSynDec0, - const DECODER_CONFIG_HANDLE hDecoderConfig -); void ivas_spar_get_cldfb_gains( SPAR_DEC_HANDLE hSpar, HANDLE_CLDFB_FILTER_BANK cldfbAnaDec0, @@ -6144,41 +4585,19 @@ int16_t ivas_is_res_channel( const int16_t ch, /* i : ch index in WYZX ordering */ const int16_t nchan_transport /* i : number of transport channels (1-4) */ ); - -#else -Word16 ivas_is_res_channel( - const Word16 ch, /* i : ch index in WYZX ordering */ - const Word16 nchan_transport /* i : number of transport channels (1-4) */ -); #endif + void ivas_spar_dec_agc_pca( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output[], /* i/o: input/output audio channels */ const Word16 output_frame /* i : output frame length */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_spar_dec_agc_pca_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output[], /* i/o: input/output audio channels */ - const Word16 output_frame /* i : output frame length */ -); -#endif -#ifdef IVAS_FLOAT_FIXED -void ivas_spar_dec_set_render_map_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 nCldfbTs /* i : number of CLDFB time slots */ -); -#endif + void ivas_spar_dec_set_render_map( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nCldfbTs /* i : number of CLDFB time slots */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_spar_dec_set_render_params_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const Word16 n_cldfb_slots /* i : number of cldfb slots in this frame */ -); -#endif + void ivas_spar_dec_set_render_params( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t n_cldfb_slots /* i : number of cldfb slots in this frame */ @@ -6190,34 +4609,12 @@ void ivas_spar_dec_digest_tc( const int16_t nCldfbSlots, /* i : number of CLDFB slots */ const int16_t nSamplesForRendering /* i : number of samples provided */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_spar_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 nCldfbSlots, /* i : number of CLDFB slots */ - const Word16 nSamplesForRendering /* i : number of samples provided */ -); -#endif + void ivas_sba_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nCldfbSlots, /* i : number of CLDFB slots */ const int16_t nSamplesForRendering /* i : number of samples provided */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_sba_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const Word16 nCldfbSlots, /* i : number of CLDFB slots */ - const Word16 nSamplesForRendering /* i : number of samples provided */ -); -ivas_error ivas_sba_dec_render_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ - Word32 *output_fx[], /* o : rendered time signal Q11*/ - Word16 out_len/*Store the length of values in each channel*/ -); -#endif // IVAS_FLOAT_FIXED ivas_error ivas_sba_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -6226,14 +4623,6 @@ ivas_error ivas_sba_dec_render( uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ float *output_f[] /* o : rendered time signal */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_spar_dec_upmixer_sf_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - Word32 *output_fx[], /* o : output audio channels */ - const Word16 nchan_internal, /* i : number of internal channels */ - Word16 out_len -); -#endif // IVAS_FLOAT_FIXED void ivas_spar_dec_upmixer_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -6255,32 +4644,11 @@ ivas_error ivas_spar_md_enc_open( const int16_t sba_order /* i : Ambisonic (SBA) order */ ); -ivas_error ivas_spar_md_enc_open_fx( - ivas_spar_md_enc_state_t **hMdEnc_in, /* i/o: SPAR MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ -); - void ivas_spar_md_enc_close( ivas_spar_md_enc_state_t **hMdEnc /* i/o: SPAR MD encoder handle */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_spar_md_enc_process_fx( - ivas_spar_md_enc_state_t *hMdEnc, /* i/o: SPAR MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - Word32 *cov_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - Word16 *cov_real_q[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - Word32 *cov_dtx_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - Word16 *cov_dtx_real_q[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ - const Word16 dtx_vad, - const Word16 nchan_inp, - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH], /* i : prior mixer_matrix */ - const Word16 dyn_active_w_flag, /* i : flag to indicate dynamic active W */ - const Word16 dirac_mono_flag /* i : flag to indicate mono only mode in SBA */ -); -#else + +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_spar_md_enc_process( ivas_spar_md_enc_state_t *hMdEnc, /* i/o: SPAR MD encoder handle */ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ @@ -6296,51 +4664,69 @@ ivas_error ivas_spar_md_enc_process( ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_create_fullr_dmx_mat_fx( - Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], - Word16 q_pred_coeffs_re, - Word32 dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], - Word16 q_dm_fv_re, - Word32 ***mixer_mat, - Word16 *q_mixer_mat, - const Word16 in_chans, - const Word16 start_band, - const Word16 end_band, - const Word16 active_w, - ivas_spar_md_com_cfg *hMdCfg +void ivas_compute_spar_params( + float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + float dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + const int16_t i_ts, + 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 bands_bw, + const int16_t active_w, + const int16_t active_w_vlbr, + ivas_spar_md_com_cfg *hSparCfg, + ivas_spar_md_t *hSparMd, + float *pWscale, + const int16_t from_dirac, + const int16_t dyn_active_w_flag +); + +void ivas_create_fullr_dmx_mat( + float pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + float dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + float ***mixer_mat, + const int16_t in_chans, + const int16_t start_band, + const int16_t end_band, + const int16_t active_w, + ivas_spar_md_com_cfg *hMdCfg ); -#endif // IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED -void ivas_get_spar_md_from_dirac_fx( - Word32 azi_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], // Q22 - Word32 ele_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], // Q22 - Word32 diffuseness_fx[IVAS_MAX_NUM_BANDS], // Q30 - const Word16 n_ts, - Word32 ***mixer_mat_fx, - Word16 *q_mixer_mat_fx, +void ivas_calc_c_p_coeffs( + ivas_spar_md_t *pSparMd, + float *pppCov_mat_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + const int16_t i_ts, + float ***mixer_mat, + const int16_t num_ch, + const int16_t num_dmx, + const int16_t band_idx, + const int16_t dtx_vad, + const int16_t compute_p_flag, + const int16_t dyn_active_w_flag +); + +void ivas_get_spar_md_from_dirac( + float azi_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], + float ele_dirac[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], + float diffuseness[IVAS_MAX_NUM_BANDS], + const int16_t n_ts, + float ***mixer_mat, ivas_spar_md_t *hSpar_md, ivas_spar_md_com_cfg *hSpar_md_cfg, - const Word16 start_band, - const Word16 end_band, - const Word16 order, - const Word16 dtx_vad, - Word32 Wscale_d[IVAS_MAX_NUM_BANDS], // Q29 - const UWord8 useLowerRes, - const Word16 active_w_vlbr, - const Word16 dyn_active_w_flag + const int16_t start_band, + const int16_t end_band, + const int16_t order, + const int16_t dtx_vad, + float Wscale_d[IVAS_MAX_NUM_BANDS], + const uint8_t useLowerRes, + const int16_t active_w_vlbr, + const int16_t dyn_active_w_flag ); -#endif /*! r: number of MD subframes */ -#ifdef IVAS_FLOAT_FIXED -Word16 ivas_get_spar_dec_md_num_subframes( - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word32 ivas_last_active_brate /* i : IVAS last active bitrate */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t ivas_get_spar_dec_md_num_subframes( const int16_t sba_order, /* i : Ambisonic (SBA) order */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ @@ -6372,15 +4758,6 @@ void ivas_spar_md_dec_close( ivas_spar_md_dec_state_t **hMdDec /* i/o: SPAR MD decoder handle */ ); -void ivas_spar_get_parameters_fx( - SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ - const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ - const Word16 ts, /* i : time slot index */ - const Word16 num_ch_out, /* i : number of channels out */ - const Word16 num_ch_in, /* i : number of channels in */ - const Word16 num_spar_bands, /* i : number of SPAR bands */ - Word32 par_mat_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS] /* o : mixing matrix */ -); void ivas_spar_get_parameters( SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ @@ -6413,14 +4790,7 @@ void ivas_spar_to_dirac( const int16_t bw, /* i : band joining factor */ const int16_t dyn_active_w_flag /* i : dynamic active W flag */ ); -void ivas_spar_to_dirac_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const Word16 dtx_vad, /* i : DTX frame flag */ - const Word16 num_bands_out, /* i : number of output bands */ - const Word16 bw, /* i : band joining factor */ - const Word16 dyn_active_w_flag /* i : dynamic active W flag */ -); + void ivas_spar_update_md_hist( ivas_spar_md_dec_state_t *hMdDec /* i/o: SPAR MD decoder handle */ ); @@ -6429,10 +4799,6 @@ int16_t ivas_spar_chk_zero_coefs( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); -Word16 ivas_spar_chk_zero_coefs_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ -); - void ivas_spar_smooth_md_dtx( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ const int16_t num_bands_out, /* i : number of output bands */ @@ -6444,15 +4810,6 @@ void ivas_spar_setup_md_smoothing( const int16_t num_bands_out, /* i : number of output bands */ const int16_t num_md_sub_frames /* i : number of metadata subframes */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_spar_dec_gen_umx_mat_fx( - ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ - const Word16 nchan_transport, /* i : number of transport channels */ - const Word16 num_bands_out, /* i : number of output bands */ - const Word16 bfi, /* i : bad frame indicator */ - const Word16 num_md_sub_frames -); -#endif // IVAS_FLOAT_FIXED void ivas_spar_dec_gen_umx_mat( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ @@ -6462,21 +4819,7 @@ void ivas_spar_dec_gen_umx_mat( const int16_t num_md_sub_frames ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_spar_covar_enc_open_fx( - ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ - ivas_filterbank_t *pFb, /* i/o: FB handle */ - const Word32 input_Fs, /* i : input sampling rate */ - const Word16 nchan_inp, /* i : number of input channels */ - const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ -); - -void ivas_spar_covar_enc_close_fx( - ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ - const Word16 nchan_inp /* i : number of input channels */ -); -#else +#ifndef IVAS_FLOAT_FIXED /* Covariance module */ ivas_error ivas_spar_covar_enc_open( ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ @@ -6493,30 +4836,7 @@ void ivas_spar_covar_enc_close( ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_enc_cov_handler_process_fx( - ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ - Word32 **ppIn_FR_real, - Word32 **ppIn_FR_imag, - Word16 q_ppIn_FR, - Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - Word16 *q_cov_real[IVAS_SPAR_MAX_CH], - Word32 *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - Word16 *q_cov_dtx_real[IVAS_SPAR_MAX_CH], - ivas_filterbank_t *pFb, /* i/o: FB handle */ - const Word16 start_band, - const Word16 end_band, - const Word16 num_ch, - const Word16 dtx_vad, - const Word16 transient_det[2], - const Word16 HOA_md_ind[IVAS_SPAR_MAX_CH], - Word16 *res_ind, - const Word16 *remix_order, - Word16 *dyn_active_w_flag, - const Word16 nchan_transport, - const Word16 is_sba -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_enc_cov_handler_process( ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ float **ppIn_FR_real, @@ -6538,21 +4858,7 @@ void ivas_enc_cov_handler_process( ); #endif -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_spar_covar_smooth_enc_open_fx( - ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. smoothing handle */ - const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ - ivas_filterbank_t *pFb, /* i/o: FB handle */ - const Word16 nchan_inp, /* i : number of input channels */ - const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ - const Word32 ivas_total_brate /* i : IVAS total bitrate */ -); - -void ivas_spar_covar_smooth_enc_close_fx( - ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. encoder handle */ - const Word16 nchan_inp /* i : number of input channels */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_spar_covar_smooth_enc_open( ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. smoothing handle */ const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ @@ -6568,18 +4874,7 @@ void ivas_spar_covar_smooth_enc_close( ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_cov_smooth_process_fx( - ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */ - Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], - ivas_filterbank_t *pFb, /* i/o: FB handle */ - const Word16 start_band, - const Word16 end_band, - const Word16 num_ch, - const Word16 transient_det[2], - Word16 *q_cov[IVAS_SPAR_MAX_CH] -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_cov_smooth_process( ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */ float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], @@ -6654,17 +4949,6 @@ void ivas_pca_enc( const int16_t n_channels /* i : number of channels */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_pca_enc_fx( - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - PCA_ENC_STATE *hPCA, /* i : PCA encoder structure */ - BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ - Word32 *data_f[8], /* i : input/transformed audio channels Q11 */ - const Word16 input_frame, /* i : input frame length */ - const Word16 n_channels /* i : number of channels */ -); -#endif - void ivas_pca_read_bits( Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ PCA_DEC_STATE *hPCA /* i/o: PCA encoder structure */ @@ -6683,44 +4967,14 @@ void ivas_pca_dec( const int16_t bfi, /* i : bad frame indicator */ float *pcm_out[] /* o : output audio channels */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_pca_read_bits_fx( - Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ - PCA_DEC_STATE *hPCA /* i/o: PCA encoder structure */ -); -void ivas_pca_dec_init_fx( - PCA_DEC_STATE *hPCA /* i/o: PCA decoder structure */ -); - -void ivas_pca_dec_fx( - PCA_DEC_STATE *hPCA, /* i/o: PCA decoder structure */ - const Word16 output_frame, /* i : output frame length */ - const Word16 n_channels, /* i : number of channels */ - const Word32 ivas_total_brate, /* i : IVAS total bitrate */ - const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate */ - const Word16 bfi, /* i : bad frame indicator */ - Word32 *pcm_out[] /* o : output audio channels */ -); -#endif /* PCA utilities */ void eye_matrix( float *mat, const int16_t n, const float d ); -#ifdef IVAS_FLOAT_FIXED -void eye_matrix_fx( - Word16 *mat, - const Word16 n, - const Word16 d -); -void eye_matrix_fx32( - Word32 *mat, // Q - const Word16 n, - const Word32 d ); // Q -#endif void cov_subfr( float **ptr_sig, float *r, @@ -6728,14 +4982,6 @@ void cov_subfr( const int16_t len ); -#ifdef IVAS_FLOAT_FIXED -void cov_subfr_fx( - Word32 **ptr_sig_fx, // Q11 - Word64 *r_fx_64, // Q11 - const Word16 n_channels, - const Word16 len ); -#endif - void eig_qr( const float *A, const int16_t num_iter, @@ -6743,39 +4989,16 @@ void eig_qr( const int16_t n ); -#ifdef IVAS_FLOAT_FIXED -void eig_qr_fx( - const Word32 *A_fx, // A_q - Word16 A_q, - const Word16 num_iter, - Word32 *EV_fx, // Q31 - Word32 *Vals_fx, // A_q - const Word16 n ); -#endif - void exhst_4x4( float *cost_mtx, int16_t *path, const int16_t maximize ); -#ifdef IVAS_FLOAT_FIXED -void exhst_4x4_fx( - Word16 *cost_mtx, // Q - Word16 *path, - const Word16 maximize ); -#endif - float mat_det4( const float *m ); -#ifdef IVAS_FLOAT_FIXED -Word16 mat_det4_fx( - const Word16 *m // Q15 -); -#endif - /* quaternion utilities */ void mat2dquat( const float *a, @@ -6783,14 +5006,6 @@ void mat2dquat( float *qr ); -#ifdef IVAS_FLOAT_FIXED -void mat2dquat_fx( - const Word16 *a, // Q15 - Word16 *ql, // Q15 - Word16 *qr // Q15 -); -#endif - void dquat2mat( const float *ql, const float *qr, @@ -6814,50 +5029,16 @@ void pca_interp_preproc( float *qr_interp ); -#ifdef IVAS_FLOAT_FIXED -void dquat2mat_fx( - const Word16 *ql, - const Word16 *qr, - Word16 *m); - -void quat_shortestpath_fx( - const Word16 *q00, - Word16 *q01, - const Word16 *q10, - Word16 *q11); - -void pca_interp_preproc_fx( - const Word16 *prev_ql, - const Word16 *prev_qr, - const Word16 *ql, - const Word16 *qr, - const Word16 len, - Word16 *ql_interp, - Word16 *qr_interp); -#endif void pca_enc_s3( float *q, int32_t *index ); -#ifdef IVAS_FLOAT_FIXED -void pca_enc_s3_fx( - Word16 *q, // Q15 - Word32 *index -); -#endif - void pca_dec_s3( const int32_t index, float *q ); -#ifdef IVAS_FLOAT_FIXED -void pca_dec_s3_fx( - const Word32 index, - Word16 *q); -#endif - #ifndef IVAS_FLOAT_FIXED int16_t ivas_get_bits_to_encode( int32_t val @@ -6871,17 +5052,6 @@ void ivas_huffman_encode( int16_t *hlen ); -void ivas_spar_huff_coeffs_com_init( - ivas_huff_coeffs_t *pHuff_coeffs, - ivas_spar_md_com_cfg *pSpar_cfg, - const Word16 table_idx, - const Word16 enc_dec); - -void ivas_spar_arith_coeffs_com_init( - ivas_arith_coeffs_t *pArith_coeffs, - ivas_spar_md_com_cfg *pSpar_cfg, - const Word16 table_idx, - const Word16 enc_dec); #ifndef IVAS_FLOAT_FIXED int16_t ivas_arith_encode_cmplx_cell_array( @@ -6920,12 +5090,6 @@ void ivas_ari_start_decoding_14bits_ext_1_lfe( Tastat *s, int16_t *extra_bits_read ); -#else -void ivas_ari_start_decoding_14bits_ext_1_lfe( - Decoder_State *st, - Tastat *s, - Word16 *extra_bits_read -); #endif #ifndef IVAS_FLOAT_FIXED @@ -6934,12 +5098,6 @@ uint16_t ivas_ari_decode_14bits_bit_ext_1_lfe( const uint16_t *cum_freq, int16_t *extra_bits_read ); -#else -UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( - Decoder_State *st, Tastat *s, - const UWord16 *cum_freq, - Word16 *extra_bits_read -); #endif #ifndef IVAS_FLOAT_FIXED @@ -6947,11 +5105,6 @@ void ivas_ari_done_decoding_14bits_ext_1_lfe( Decoder_State *st, const int16_t extra_bits_read ); -#else -void ivas_ari_done_decoding_14bits_ext_1_lfe( - Decoder_State *st, - const Word16 extra_bits_read -); #endif void ivas_ari_done_encoding_14bits( @@ -7003,59 +5156,17 @@ void ivas_quantise_real_values( float *quant, const int16_t dim ); -void ivas_quantise_real_values_fx( - const Word32 *values_fx, - const Word16 q_levels, - const Word32 min_value_fx, - const Word32 max_value_fx, - Word16 *index, - Word32 *quant_fx, - const Word16 dim); - -void ivas_quantise_real_values_enc_fx_varq( - const Word32 *values_fx, - const Word16 q_levels, - const Word32 min_value_fx, - const Word32 max_value_fx, - Word16 *index, - Word32 *quant_fx, - const Word16 dim, - Word16 inp_q ); - -void ivas_quantise_real_values_enc_fx( - const Word32 *values_fx,//Q28 - const Word16 q_levels, - const Word32 min_value_fx,//Q28 - const Word32 max_value_fx,//Q28 - Word16 *index, - Word32 *quant_fx,//Q28 - const Word16 dim); - void ivas_spar_get_uniform_quant_strat( ivas_spar_md_com_cfg *pSpar_md_com_cfg, const int16_t table_idx ); -void ivas_spar_get_uniform_quant_strat_fx( - ivas_spar_md_com_cfg *pSpar_md_com_cfg, - const Word16 table_idx); - void ivas_spar_quant_dtx_init( ivas_spar_md_t *spar_md, float *min_max ); -void ivas_spar_quant_dtx_init_fx( - ivas_spar_md_t *spar_md, - Word32 *min_max -); - -void ivas_spar_quant_dtx_init_fx( - ivas_spar_md_t *spar_md, - Word32 *min_max -); - void ivas_map_prior_coeffs_quant( ivas_spar_md_prev_t *pSpar_md_prior, ivas_spar_md_com_cfg *pSpar_md_cfg, @@ -7063,14 +5174,7 @@ void ivas_map_prior_coeffs_quant( const int16_t nB ); -#ifdef IVAS_FLOAT_FIXED -void ivas_copy_band_coeffs_idx_to_arr( - ivas_band_coeffs_ind_t *pBands_idx, - const Word16 nB, - Word16 *pSymbol_re, - ivas_cell_dim_t *pCell_dims, - const ivas_coeffs_type_t coeff_type); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_copy_band_coeffs_idx_to_arr( ivas_band_coeffs_ind_t *pBands_idx, const int16_t nB, @@ -7080,9 +5184,10 @@ void ivas_copy_band_coeffs_idx_to_arr( ); #endif -void ivas_clear_band_coeffs_fx( - ivas_band_coeffs_t *pband_coeffs, - const UWord16 num_bands); +void ivas_clear_band_coeffs( + ivas_band_coeffs_t *pband_coeffs, + const uint16_t num_bands +); void ivas_clear_band_coeff_idx( ivas_band_coeffs_ind_t *pband_coeff_idx, @@ -7196,14 +5301,7 @@ void distribute_evenly_ism( const int16_t nchan_ism ); -#ifdef IVAS_FLOAT_FIXED -Word16 ivas_qmetadata_DecodeExtendedGR( - UWord16* bitstream, - Word16* index, - const Word16 alph_size, - const Word16 gr_param -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t ivas_qmetadata_DecodeExtendedGR( uint16_t* bitstream, int16_t* index, @@ -7235,11 +5333,7 @@ void ivas_merge_masa_metadata( OMASA_SPATIAL_META_HANDLE hOMasaMeta /* i : ISM-object metadata to be merged with the MASA metadata */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_masa_combine_directions_fx( - MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_masa_combine_directions( MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ ); @@ -7302,7 +5396,7 @@ void ivas_set_qmetadata_maxbit_req( const IVAS_FORMAT ivas_format /* i : IVAS format */ ); -#ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED /*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */ Word16 ivas_get_df_ratio_bits_hodirac( const Word16 index_diff /* i : index of quantized diffuse-to-total ratio */ @@ -7312,16 +5406,6 @@ Word16 ivas_get_df_ratio_bits_hodirac( Word16 ivas_get_df_ratio_bits( const Word16 index_diff /* i : index of quantized diffuse-to-total ratio */ ); -#else -/*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */ -int16_t ivas_get_df_ratio_bits_hodirac( - const int16_t index_diff /* i : Index of quantized diffuse-to-total ratio */ -); - -/*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */ -int16_t ivas_get_df_ratio_bits( - const int16_t index_diff /* i : Index of quantized diffuse-to-total ratio */ -); #endif @@ -7339,14 +5423,6 @@ void invdct4_transform( uint8_t *invdct_v /* o : transformed vector */ ); -#ifdef IVAS_FLOAT_FIXED -void invdct4_transform_fx( - Word32 *v_fx, /* i : input vector */ - UWord8 *invdct_v, /* o : transformed vector */ - Word16 q -); -#endif - #ifndef IVAS_FLOAT_FIXED void update_bits_next_block( IVAS_QDIRECTION *q_direction, /* i/o: qdirection */ @@ -7371,33 +5447,16 @@ void ivas_spar_param_to_masa_param_mapping( const int16_t subframe /* i : Subframe to map */ ); -void ivas_spar_param_to_masa_param_mapping_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ - Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ - Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ - Word16 q_cldfb[6][CLDFB_SLOTS_PER_SUBFRAME], - const Word16 subframe /* i : Subframe to map */ -); - - /*---------------------------------------------------------------------------------* * Binaural FastConv Renderer Prototypes *-----------------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_binRenderer_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_binRenderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_binRenderer_close_fx( - BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_binRenderer_close( BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ ); @@ -7406,24 +5465,12 @@ void ivas_binRenderer_close( void ivas_binaural_hrtf_close( HRTFS_FASTCONV_HANDLE *hHrtfFastConv /* i/o: decoder binaural hrtf handle */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_init_binaural_hrtf_fx( - HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_init_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ ); #endif -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_allocate_binaural_hrtf_fx( - HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ - const AUDIO_CONFIG input_config, /* i : input audio configuration */ - const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ - const RENDERER_TYPE renderer_type, /* i : renderer type */ - const Word16 allocate_init_flag /* i : Memory allocation flag */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_allocate_binaural_hrtf( HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ const AUDIO_CONFIG input_config, /* i : input audio configuration */ @@ -7443,29 +5490,12 @@ void ivas_binRenderer( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ ); -void ivas_binRenderer_fx( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ - const Word16 numTimeSlots, /* i : number of time slots to render */ - Word32 Cldfb_RealBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - Word32 Cldfb_ImagBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ - Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - Word32 ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ - Word16 *Q_in /* i : LS signals exp */ -); - void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ float *input_f[], /* i : transport channels */ float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ ); -void ivas_binaural_add_LFE_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word16 output_frame, /* i : length of input frame */ - Word32 *input_fx[], /* i : transport channels */ - Word32 *output_fx[] /* o : synthesized core-coder transport channels/DirAC output */ -); /*----------------------------------------------------------------------------------* * renderer prototypes @@ -7494,17 +5524,6 @@ void ivas_ism_get_stereo_gains( ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_mc2sba_fx( - IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ - Word32 *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ - Word32 *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 sba_order, /* i : Ambisonic (SBA) order */ - const Word16 gain_lfe /* i : gain for LFE, 0 = ignore LFE */ -); -#endif // IVAS_FLOAT_FIXED - void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ @@ -7513,17 +5532,6 @@ void ivas_mc2sba( const int16_t sba_order, /* i : SBA order */ const float gain_lfe /* i : gain for LFE, 0=ignore LFE */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_param_mc_mc2sba_cldfb_fx( - IVAS_OUTPUT_SETUP hTransSetup, /* i : transported MC Format */ - Word32 *hoa_encoder, /* i : HOA3 encoder for the transported MC format */ - const Word16 slot_idx, /* i : current slot in the subframe */ - Word32 Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: Contains the MC signals (on input) and the HOA3 (on output) */ - Word32 Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: Contains the MC signals (on input) and the HOA3 (on output) */ - const Word16 nBands, /* i : number of synth CLDFB bands */ - const Word16 gain_lfe /* i : gain applied to LFE */ -); -#endif // IVAS_FLOAT_FIXED void ivas_param_mc_mc2sba_cldfb( IVAS_OUTPUT_SETUP hTransSetup, /* i : transported MC Format */ @@ -7535,17 +5543,7 @@ void ivas_param_mc_mc2sba_cldfb( const float gain_lfe /* i : gain applied to LFE */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_ism2sba_sf_fx( - Word32 *buffer_in_fx[], /* i : TC buffer */ - Word32 *buffer_out_fx[], /* o : TD signal buffers */ - ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ - const Word16 num_objects, /* i : number of objects */ - const Word16 n_samples_to_render, /* i : output frame length per channel */ - const Word16 offset, /* i : offset for the interpolatr */ - const Word16 sba_order /* i : Ambisonic (SBA) order */ -); -#else // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED void ivas_ism2sba_sf( float *buffer_in[], /* i : TC buffer */ float *buffer_out[], /* o : TD signal buffers */ @@ -7567,26 +5565,12 @@ void panning_wrap_angles( float *azi_wrapped, /* o : wrapped azimuth component */ float *ele_wrapped /* o : wrapped elevation component */ ); -#ifdef IVAS_FLOAT_FIXED -void panning_wrap_angles_fx( - const Word32 azi_deg, /* i : azimuth in degrees for panning direction (positive left) Q22 */ - const Word32 ele_deg, /* i : elevation in degrees for panning direction (positive up) Q22 */ - Word32 *azi_wrapped, /* o : wrapped azimuth component Q22 */ - Word32 *ele_wrapped /* o : wrapped elevation component Q22 */ -); -#endif + void v_sort_ind( float *x, /* i/o: Vector to be sorted */ int16_t *idx, /* o : Original index positions */ const int16_t len /* i : vector length */ ); -#ifdef IVAS_FLOAT_FIXED -void v_sort_ind_fixed( - Word32 *x, /* i/o: Vector to be sorted */ - Word16 *idx, /* o : Original index positions */ - const Word16 len /* i : vector length */ -); -#endif /*----------------------------------------------------------------------------------* * LS Renderer prototypes @@ -7613,13 +5597,6 @@ void ivas_ls_setup_conversion_process_mdct( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[] /* i/o: output synthesis signal */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_ls_setup_conversion_process_mdct_param_mc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *x_fx[][NB_DIV], /* i/o: Fixed output synthesis signal */ - Word16 x_e[CPE_CHANNELS][NB_DIV]/* i/o: Exponent for output synthesis signal */ -); -#endif // IVAS_FLOAT_FIXED void ivas_ls_setup_conversion_process_mdct_param_mc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -7750,14 +5727,6 @@ void lls_interp_n( const int16_t upd /* i : use 1 to update x[] with the interpolated output*/ ); -void lls_interp_n_fx( - Word16 x_fx[], /* i/o: input/output vector */ - const Word16 N, /* i : length of the input vector */ - Word16 *a_fx, /* o : calculated slope */ - Word16 *b_fx, /* o : calculated offset */ - const Word16 upd /* i : use 1 to update x[] with the interpolated output */ -); - void computeReferencePower_enc( const int16_t *band_grouping, /* i : Band grouping for estimation */ float Cldfb_RealBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Real part of input signal */ @@ -7794,15 +5763,7 @@ void ivas_mono_stereo_downmix_mcmasa( int16_t output_frame /* i : output frame length per channel */ ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_lfe_synth_with_filters_fx( - MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ - Word32 *data_f[], /* o : output signals */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 separateChannelIndex, /* i : separate channel index */ - const Word16 lfeChannelIndex /* i : LFE channel index */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_lfe_synth_with_filters( MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ float *data_f[], /* o : output signals */ @@ -7852,16 +5813,6 @@ void ivas_lfe_enc( BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_lfe_enc_fx( - LFE_ENC_HANDLE hLFE, /* i/o: LFE encoder handle */ - Word32 data_lfe_ch[], /* i : input LFE signal */ - Word16 q_data_lfe_ch, /* i : Q of input LFE signal */ - const Word16 input_frame, /* i : input frame length per channel */ - BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */ -); -#endif // IVAS_FLOAT_FIXED - #ifndef IVAS_FLOAT_FIXED ivas_error ivas_create_lfe_dec( LFE_DEC_HANDLE *hLFE_out, /* o : IVAS LFE decoder structure */ @@ -7903,16 +5854,6 @@ void ivas_lfe_lpf_select_filt_coeff( const float **ppFilt_coeff /* o : filter coefficients */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_lfe_lpf_select_filt_coeff_fx( - const Word32 sampling_rate, /* i : sampling rate */ - const Word16 order, /* i : filter order */ - const Word32 **ppFilt_coeff_fx, /* o : filter coefficients */ - const Word16 **ppFilt_coeff_e /* o : exponents of filter coefficients */ -); -#endif - - void ivas_filters_init( ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ const float *filt_coeff, /* i : filter coefficients */ @@ -7921,11 +5862,10 @@ void ivas_filters_init( #ifdef IVAS_FLOAT_FIXED void ivas_filters_init_fx( - ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - const Word32 *filt_coeff, /* i : filter coefficients */ - const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ - const Word16 order /* i : filter order */ -); + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + const Word32 *filt_coeff_fx, /* i : filter coefficients Q31- *filt_coeff_e */ + const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ + const Word16 order ) ; #endif void ivas_filter_process( @@ -7936,30 +5876,21 @@ void ivas_filter_process( #ifdef IVAS_FLOAT_FIXED void ivas_filter_process_fx( - ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ - Word32 *pIn_Out_fx, /* i : signal subject to filtering */ - const Word16 length, /* i : filter order */ - Word16 q_factor -); + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + Word32 *pIn_Out_fx, /* i/o: signal subject to filtering Q(q_factor) */ + const Word16 length, /* i : filter order */ + Word16 q_factor ); #endif /*----------------------------------------------------------------------------------* * OSBA prototypes *----------------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_osba_enc_open_fx( - Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_osba_enc_open( Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_osba_enc_close_fx( - OSBA_ENC_HANDLE *hOSba /* i/o: encoder OSBA handle */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_osba_enc_close( OSBA_ENC_HANDLE *hOSba /* i/o: encoder OSBA handle */ ); @@ -7979,36 +5910,10 @@ void ivas_osba_enc( const int32_t input_Fs, /* i : input sampling rate */ const int16_t sba_planar /* i : planar SBA flag */ ); -#else -void ivas_osba_enc_fx( - OSBA_ENC_HANDLE hOSba, /* i/o: OSBA encoder handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ - Word32 *data_in_fx[], /* i/o: Input / transport audio signals */ - const int16_t input_frame, /* i : Input frame size */ - const int16_t nchan_ism, /* i : Number of objects for parameter analysis */ - const ISM_MODE ism_mode, /* i : ISM mode */ - const int16_t sba_analysis_order, /* i : SBA order evaluated in DirAC/SPAR encoder */ - const int32_t input_Fs, /* i : input sampling rate */ - const int16_t sba_planar, /* i : planar SBA flag */ - Word16 *q_data - ); #endif ivas_error ivas_osba_data_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_osba_data_open_fx( - Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ -); -ivas_error ivas_osba_dirac_td_binaural_jbm_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - Word32 *output_fx[], /* o : rendered time signal */ - Word16 out_len/*Store the length of values in each channel*/ -); -#endif // IVAS_FLOAT_FIXED ivas_error ivas_osba_dirac_td_binaural_jbm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -8018,14 +5923,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( float *output_f[] /* o : rendered time signal */ ); -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_osba_ism_metadata_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word32 ism_total_brate, /* i : ISM total bitrate */ - Word16 *nchan_ism, /* o : number of ISM separated channels */ - Word16 nb_bits_metadata[] /* o : number of ISM metadata bits */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_osba_ism_metadata_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int32_t ism_total_brate, /* i : ISM total bitrate */ @@ -8033,15 +5931,7 @@ ivas_error ivas_osba_ism_metadata_dec( int16_t nb_bits_metadata[] /* o : number of ISM metadata bits */ ); #endif -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_osba_render_sf_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ - UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ - UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ - Word32 *p_output[] /* o : rendered time signal */ -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_osba_render_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -8050,11 +5940,7 @@ ivas_error ivas_osba_render_sf( float *output_f[] /* o : rendered time signal */ ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_osba_data_close_fx( - SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ -); -#endif + void ivas_osba_data_close( SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ ); @@ -8122,16 +6008,6 @@ void ivas_set_surplus_brate_dec( int32_t *ism_total_brate /* i : ISM total bitrate */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_set_ism_importance_interformat_fx( - const Word32 ism_total_brate, /* i/o: ISms total bitrate */ - const Word16 nchan_transport, /* i : number of transported channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ - const Word16 lp_noise_CPE_fx, /* i : LP filtered total noise estimation */ - Word16 ism_imp[] /* o : ISM importance flags */ -); -#endif void ivas_set_ism_importance_interformat( const int32_t ism_total_brate, /* i/o: ISms total bitrate */ @@ -8235,16 +6111,7 @@ void ivas_omasa_dirac_rend_jbm( float *output_f[] /* o : rendered time signal */ ); #endif -#ifdef IVAS_FLOAT_FIXED -void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( - Decoder_Struct *st_ivas, - Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ - Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ - Word16 *cldfb_buf_q, - const Word16 nBins, - const Word16 subframe -); -#endif + void ivas_omasa_preProcessStereoTransportsForMovedObjects( Decoder_Struct *st_ivas, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], @@ -8286,15 +6153,6 @@ void ivas_omasa_decode_masa_to_total( const int16_t nblocks ); -#ifdef IVAS_FLOAT_FIXED -void ivas_omasa_decode_masa_to_total_fx( - UWord16 *bit_stream, - Word16 *index, - Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], - const Word16 nbands, - const Word16 nblocks); -#endif - void ivas_omasa_modify_masa_energy_ratios( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_MAXIMUM_CODING_SUBBANDS] @@ -8304,26 +6162,12 @@ void ivas_omasa_modify_masa_energy_ratios( /*----------------------------------------------------------------------------------* * TD Binaural Object renderer *----------------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_td_binaural_open_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word16 * SrcInd, /*Temporarily used to store the updated value of SrcInd*/ - Word16 *num_src -); -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_td_binaural_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); #endif // IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_td_binaural_renderer_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Word32 *output[], /* i/o: SCE channels / Binaural synthesis */ - const Word16 output_frame /* i : output frame length */ -); -#endif - ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* i/o: SCE channels / Binaural synthesis */ @@ -8357,15 +6201,6 @@ ivas_error ivas_FB_mixer_open( const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_FB_mixer_close_fx( - IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ - const Word32 sampling_rate, /* i : sampling rate in Hz */ - const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ -); - -#endif - void ivas_FB_mixer_close( IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ const int32_t sampling_rate, /* i : sampling rate in Hz */ @@ -8379,16 +6214,6 @@ void ivas_fb_mixer_pcm_ingest( const int16_t frame_length, /* i : frame length */ const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] ); -#ifdef IVAS_FLOAT_FIXED -void ivas_fb_mixer_pcm_ingest_fx( - IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ - Word32 *pcm_in[], /* i : input audio channels Qq_data_fix[] */ - Word32 **ppOut_pcm, /* o : output audio channels Qq_ppOut_pcm[] */ - const Word16 frame_len, /* i : frame length */ - const Word16 HOA_md_ind[IVAS_SPAR_MAX_CH], - Word16 q_data_fix[MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS], - Word16 *q_ppOut_pcm ); -#endif void ivas_fb_mixer_update_prior_input( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ @@ -8407,17 +6232,7 @@ void ivas_fb_mixer_get_windowed_fr( const int16_t nchan_fb_in /* i : number of analysis channels */ ); -#ifdef IVAS_FLOAT_FIXED -void ivas_fb_mixer_process( - IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ - Word32 ***mixer_mat_fx, /* i : mixer matrix in q_mixer_mat_fx */ - Word16 *q_mixer_mat_fx, /* i : mixer matrix */ - Word32 **ppOut_pcm_fx, /* o : output audio channels in ppOut_pcm_fx resultant */ - Word16 *q_ppOut_pcm_fx, /*ppOut_pcm_fx resultant q*/ - const int16_t frame_len, /* i : frame length in samples */ - int16_t in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i/o: mixing mapping */ -); -#else +#ifndef IVAS_FLOAT_FIXED void ivas_fb_mixer_process( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ float ***mixer_mat, /* i : mixer matrix */ @@ -8442,49 +6257,12 @@ void ivas_fb_mixer_cross_fading( ); /*! r: number of spectral bands */ -#ifdef IVAS_FLOAT_FIXED -Word16 ivas_get_num_bands_from_bw_idx( - const Word16 bwidth /* i : audio bandwidth */ -); -#else +#ifndef IVAS_FLOAT_FIXED int16_t ivas_get_num_bands_from_bw_idx( const int16_t bwidth /* i : audio bandwidth */ ); #endif -#ifdef IVAS_FLOAT_FIXED -/*to be moved to prot_fx1.h*/ -void sns_avq_dec_fx( - Word16 *index, /* i : Quantization indices */ - Word32 SNS_Q[NB_DIV][M], /* o : Quantized SNS vectors */ - Word16 *q_snsq, - const Word16 L_frame, /* i : frame length */ - const Word16 numlpc /* i : Number of sets of lpc */ -); - -void sns_avq_dec_stereo_fx( - Word16 *indexl, /* i : Quantization indices (left channel) */ - Word16 *indexr, /* i : Quantization indices (right channe) */ - const Word16 L_frame, /* i : frame length */ - Word32 *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ - Word16 *q_l, - Word32 *SNS_Qr, /* o : Quantized SNS vectors (right channe) */ - Word16 *q_r ); - -void dequantize_sns_fx( - Word16 indices[CPE_CHANNELS][NPRM_LPC_NEW], - Word32 snsQ_out[CPE_CHANNELS][NB_DIV][M], - Decoder_State **sts ); - -void inverseMS_fx( - const Word16 L_frame, /* i : frame length Q0*/ - Word32 x0[], /* i/o: mid/left channel coefficients Qx*/ - Word32 x1[], /* i/o: side/right channel coefficients Qx*/ - const Word32 norm_fac /* i : normalization factor Q31*/ -); - -#endif - /* clang-format on */ #endif /* IVAS_PROT_H */ diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 4a0e4ddb1..3123d4475 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -121,8 +121,8 @@ Word16 valid_ratio_index_fx( ); UWord16 index_theta_phi_16_fx( - Word32 *p_theta, /* i/o: input elevation to be indexed */ - Word32 *p_phi, /* i/o: input azimuth to be indexed */ + Word32 *p_theta, /* i/o: input elevation to be indexed Q22 */ + Word32 *p_phi, /* i/o: input azimuth to be indexed Q22 */ const SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ ); @@ -138,7 +138,6 @@ void ivas_omasa_rearrange_channels_fx( const Word16 output_frame /* i : output frame length per channel */ ); -#ifdef IVAS_FLOAT_FIXED ivas_error ivas_omasa_ism_metadata_dec_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const Word32 ism_total_brate, /* i : ISM total bitrate */ @@ -159,7 +158,6 @@ ivas_error ivas_td_binaural_renderer_sf_fx( Word32 *output_fx[], /* i/o: SCE channels / Binaural synthesis */ const Word16 n_samples_granularity /* i : granularity of the renderer/buffer */ ); -#endif void ivas_omasa_modify_masa_energy_ratios_fx( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ @@ -186,46 +184,46 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( ); void ivas_dct_windowing_fx( - const Word16 fade_len, - const Word16 full_len, - const Word16 dct_len, - const Word16 zero_pad_len, - const Word32 *pWindow_coeffs, - const Word16 frame_len, - Word32 *pOut_buf, - Word32 *pBuffer_prev, + const Word16 fade_len, /*Q0*/ + const Word16 full_len, /*Q0*/ + const Word16 dct_len, /*Q0*/ + const Word16 zero_pad_len, /*Q0*/ + const Word32 *pWindow_coeffs, /*Q31*/ + const Word16 frame_len, /*Q0*/ + Word32 *pOut_buf, // Q10 + Word32 *pBuffer_prev, // Q10 Word32 *pTemp_lfe ); void ivas_get_twid_factors_fx1( - const Word16 length, - const Word16 **pTwid_re, + const Word16 length, // Q0 + const Word16 **pTwid_re, // Q15 const Word16 **pTwid_im ); Word32 ivas_get_mdct_scaling_gain_fx( const Word16 dct_len_by_2 ); void ivas_imdct_fx( - const Word32 *pIn, - Word32 *pOut, - const Word16 length, + const Word32 *pIn, // Q24 + Word32 *pOut, // q_out Q9 + const Word16 length /*Q0*/, Word16 *q_out ); void ivas_mdct_fx( - const Word32 *pIn, - Word32 *pOut, - const Word16 length, + const Word32 *pIn, // q_out + Word32 *pOut, // q_out + const Word16 length, // Q0 Word16 *q_out ); void ivas_itda_fx( - const Word32 *re, /* i : time alised signal after IDCT */ + const Word32 *re, /* i : time alised signal after IDCT Q24 */ Word32 *pOut, /* o : time domain buffer of size 2*length */ - const Word16 length /* i : length of time alised signal buffer */ + const Word16 length /* i : length of time alised signal buffer Q0 */ ); void ivas_tda_fx( - const Word32 *pIn, /* i : time domain buffer of size 2*length */ - Word32 *pOut, /* o : time domain buffer of size length */ - const Word16 length /* i : length of time alised signal buffer */ + const Word32 *pIn, /* i : time domain buffer of size 2*length Q10*/ + Word32 *pOut, /* o : time domain buffer of size length Q10 */ + const Word16 length /* i : length of time alised signal buffer Q0*/ ); // ivas_agc_dec_fx.c @@ -253,7 +251,6 @@ void ivas_agc_read_bits_fx( const Word16 AGC_flag /* i : AGC on/off flag */ ); -#ifdef IVAS_FLOAT_FIXED // ivas_agc_com_fx.c void ivas_agc_initWindowFunc_fx( Word16 *pWinFunc, @@ -285,7 +282,6 @@ void ECSQ_decode( ECSQ_instance *ecsq_inst, const Word16 N, Word16 *output ); -#endif // IVAS_FLOAT_FIXED // bass_psfilter.c Word16 res_bpf_adapt_fx( @@ -447,7 +443,6 @@ Word16 get_igf_startline( const Word16 L_frameTCX /* i : full band frame length */ ); -#ifdef IVAS_FLOAT_FIXED void stereo_dft_dec_reset_fx( STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ ); @@ -503,8 +498,6 @@ void stereo_dft_generate_res_pred_fx( const Word16 bfi /* i : BFI flag */ ); -#endif - void stereo_dft_dec_analyze_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ const Word32 *input_fx, /* i : input signal */ @@ -565,10 +558,8 @@ void ivas_sba_config_fx( Word16 *element_mode /* o : element mode of the core coder */ ); -#ifdef IVAS_FLOAT_FIXED Word16 ivas_get_bits_to_encode( Word32 val ); -#endif Word16 ivas_get_spar_table_idx_fx( const Word32 ivas_total_brate, /* i : IVAS total bitrate */ @@ -613,7 +604,6 @@ void ivas_ism_param_dec_tc_gain_ajust_fx( Word16 *Q_tc /* i/o : Q of input tc buffer */ ); -#ifdef IVAS_FLOAT_FIXED /*! r: number of bits read */ Word16 read_GR0( const UWord16 *bit_stream, /* i : bitstream to be read */ @@ -667,12 +657,12 @@ Word16 read_flag_EC_DFT( const UWord16 *bit_stream, /* i : bitstream */ Word16 *flag /* o : flag value */ ); -#ifdef IVAS_FLOAT_FIXED + /*file : ivas_mc_param_dec_fx.c*/ Word16 param_mc_get_num_cldfb_syntheses_ivas_fx( Decoder_Struct *st_ivas /* i : Parametric MC handle */ ); -#endif + void ivas_init_dec_get_num_cldfb_instances( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ Word16 *numCldfbAnalyses, /* o : number of CLDFB analysis instances */ @@ -684,7 +674,6 @@ void ivas_init_dec_get_num_cldfb_instances_ivas_fx( Word16 *numCldfbAnalyses, /* o : number of needed CLDFB analysis instances */ Word16 *numCldfbSyntheses /* o : number of needed CLDFB synthesis instances */ ); -#endif Word16 masa_sq_fx( const Word32 in, /* i : input value */ @@ -756,8 +745,8 @@ void ivas_get_ism_sid_quan_bitbudget_fx( const Word16 nchan_ism, /* i : number of objects */ Word16 *nBits_azimuth, /* o : number of Q bits for azimuth */ Word16 *nBits_elevation, /* o : number of Q bits for elevation */ - Word32 *q_step_fx, /* o : quantization step */ - Word32 *q_step_border_fx, /* o : quantization step at the border */ + Word32 *q_step_fx, /* o : quantization step Q22*/ + Word32 *q_step_border_fx, /* o : quantization step at the border Q22*/ Word16 *nBits_coh, /* o : number of Q bits for coherence */ Word16 *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); @@ -775,7 +764,6 @@ void ivas_ism_metadata_sid_dec_fx( Word16 nb_bits_metadata[] /* o : number of metadata bits */ ); -#ifdef IVAS_FLOAT_FIXED // ivas_sce_dec_fx.c ivas_error create_sce_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -827,7 +815,6 @@ void ivas_post_proc_fx( const Word16 output_frame, /* i : output frame length */ const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */ Word16 output_q ); -#endif // ivas_lfe_dec_fx.c @@ -1215,11 +1202,9 @@ void stereo_dft_dec_fx( ); // ivas_stereo_dft_enc.c -#ifdef IVAS_FLOAT_FIXED Word32 stereo_dft_enc_synthesize_fx( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ - // float *output, /* o : output synthesis */ - Word32 *output_fx, /* o : output synthesis Q16 */ + Word32 *output_fx, /* o : output synthesis Q16 */ Word16 *output_start_index, Word16 *output_end_index, const Word16 chan, /* i : channel number */ @@ -1227,7 +1212,6 @@ Word32 stereo_dft_enc_synthesize_fx( const Word32 output_sampling_rate, /* i : output sampling rate */ const Word16 L_frame, /* i : frame length at internal Fs */ Word16 *nrg_out_fx_e ); -#endif void ivas_ls_setup_conversion_fx( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ @@ -2056,13 +2040,10 @@ Word16 is_DTXrate( const Word32 ivas_total_brate /* i : IVAS total bitrate */ ); -#ifdef IVAS_FLOAT_FIXED Word16 ivas_qmetadata_dereorder_generic( const UWord16 uns_value /* i : unsigned value result of ReorderGeneric */ ); -#endif -#ifdef IVAS_FLOAT_FIXED void update_bits_next_block( IVAS_QDIRECTION *q_direction, /* i/o: qdirection */ Word16 *p_diff, /* i/o: bits to be transferred */ @@ -2070,17 +2051,15 @@ void update_bits_next_block( const Word16 max_i, /* i : number of subbands */ const Word16 max_k /* i : n umber of subframes */ ); -#endif UWord32 ivas_syn_output_fx( - Word32 *synth[], /* i/o: float synthesis signal */ + Word32 *synth[], /* i/o: Word32 synthesis signal */ const Word16 q_synth, const Word16 output_frame, /* i : output frame length (one channel) */ const Word16 n_channels, /* i : number of output channels */ Word16 *synth_out /* o : integer 16 bits synthesis signal */ ); -#ifdef IVAS_FLOAT_FIXED void stereo_tcx_core_dec_fx( Decoder_State *st, /* i/o: decoder state structure */ const FRAME_MODE frameMode, /* i : Decoder frame mode */ @@ -2095,7 +2074,6 @@ void stereo_tcx_core_dec_fx( const Word16 nchan_out, /* i : number of output channels */ const IVAS_FORMAT ivas_format /* i : IVAS format */ ); -#endif // IVAS_FLOAT_FIXED void masa_compensate_two_dir_energy_ratio_index_fx( const Word16 ratio_index_1, /* i : Input ratio for direction 1 */ @@ -2105,17 +2083,14 @@ void masa_compensate_two_dir_energy_ratio_index_fx( const Word16 hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); -#ifdef IVAS_FLOAT_FIXED -int16_t stereo_tdm_ener_analysis_fx( +Word16 stereo_tdm_ener_analysis_fx( const Word16 ivas_format, /* i : IVAS format */ CPE_ENC_HANDLE hCPE, /* i : CPE structure */ const Word16 input_frame, /* i : Number of samples */ Word16 *tdm_SM_or_LRTD_Pri, /* o : channel combination scheme flag in TD stereo OR LRTD primary channel */ Word16 *tdm_ratio_idx_SM /* o : TDM ratio index for SM mode */ ); -#endif -#ifdef IVAS_FLOAT_FIXED /*! r: projected azimuth index */ Word16 ivas_dirac_project_azimuth_index( const Word16 az_idx, /* i : azimuth index */ @@ -2142,7 +2117,7 @@ void small_reduction_direction( UWord16 bits_dir[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], const Word16 raw_flag[MASA_MAXIMUM_CODING_SUBBANDS], Word16 *diff ); -#endif + void sort_desc_ind_16_fx( Word16 *s, /* i/o: vector to be sorted Qx*/ @@ -2165,9 +2140,9 @@ ivas_error only_reduce_bits_direction_fx( Word16 *ind_order ); void ivas_qmetadata_azimuth_elevation_to_direction_vector_fx( - const Word32 az, /* i : azimuth */ - const Word32 el, /* i : elevation */ - Word32 *dv /* o : direction vector */ + const Word32 az, /* i : azimuth Q22 */ + const Word32 el, /* i : elevation Q22 */ + Word32 *dv /* o : direction vector Q30 */ ); void ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( @@ -2177,7 +2152,6 @@ void ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( Word32 *el /* o : elevation */ ); -#ifdef IVAS_FLOAT_FIXED ivas_error ivas_qmetadata_open( IVAS_QMETADATA_HANDLE *hQMetaData /* i/o: q_metadata handle */ ); @@ -2281,7 +2255,6 @@ void stereo_dtf_cng_fx( Word16 q_dft /* i : Q factor of the DFT data */ ); -#endif // IVAS_FLOAT_FIXED void ivas_spar_update_md_hist_fx( ivas_spar_md_dec_state_t *hMdDec /* i/o: SPAR MD decoder handle */ @@ -2627,12 +2600,12 @@ Word16 calculate_brate_limit_flag_fx( const Word16 nchan_ism /* i : number of objects */ ); Word16 ism_quant_meta_fx( - const Word32 val, /* i : scalar value to quantize */ - Word32 *valQ, /* o : quantized value */ - const Word32 borders_fx[], /* i : level borders */ - const Word32 q_step_fx, /* i : quantization step */ - const Word32 q_step_border_fx, /* i : quantization step at the border */ - const Word16 cbsize /* i : codebook size */ + const Word32 val, /* i : scalar value to quantize Q22 */ + Word32 *valQ, /* o : quantized value Q22 */ + const Word32 borders_fx[], /* i : level borders Q22 */ + const Word32 q_step_fx, /* i : quantization step Q22 */ + const Word32 q_step_border_fx, /* i : quantization step at the border Q22 */ + const Word16 cbsize /* i : codebook size */ ); /*! r: number of channels to be analysed */ @@ -2690,30 +2663,30 @@ void ivas_ari_encode_14bits_ext_fx( void ms_inv_mask_processing_fx( STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: MDCT encoder structure */ Encoder_State **sts, /* i/o: Encoder state structure */ - int16_t ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ - const int16_t iSubframe, /* i : subframe number */ + Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ + const Word16 iSubframe, /* i : subframe number */ const Word32 x_0_fx[], /* i : spectrum 1 */ const Word32 x_1_fx[], /* i : spectrum 2 */ Word32 x_inv_0_fx[], /* o : inverse spectrum 1 */ Word32 x_inv_1_fx[], /* o : inverse spectrum 2 */ - int16_t maxSfb /* i : number of stereo frequency bands */ + Word16 maxSfb /* i : number of stereo frequency bands */ ); void ms_processing_fx( STEREO_MDCT_ENC_DATA_HANDLE hStereoMdct, /* i/o: Stereo MDCT encoder structure */ Encoder_State **sts, /* i/o: Encoder state structure */ Word16 ms_mask[NB_DIV][MAX_SFB], /* i : bandwise MS mask */ - const int16_t iSubframe, /* i : subframe number */ + const Word16 iSubframe, /* i : subframe number */ Word32 x_0_fx[], /* i/o: spectrum 1 */ Word32 x_1_fx[], /* i/o: spectrum 1 */ Word16 maxSfb /* i : number of stereo frequency bands*/ ); void convertToMS_fx( - const int16_t L_frame, /* i : frame length */ - Word32 x0[], /* i/o: mid/left channel coefficients */ - Word32 x1[], /* i/o: side/right channel coefficients */ - const Word32 norm_fac /* i : normalization factor */ + const Word16 L_frame, /* i : frame length */ + Word32 x0[], /* i/o: mid/left channel coefficients */ + Word32 x1[], /* i/o: side/right channel coefficients */ + const Word32 norm_fac /* i : normalization factor */ ); void FindSplitRatio_fx( @@ -3094,19 +3067,6 @@ void InternalTCXDecoder_fx( Word16 *gain_tcx_q /* o : quantized global gain (at low bitrates) */ ); -void stereo_tcx_core_enc( - Encoder_State *st, /* i/o: encoder state structure */ - const float new_samples_12k8[], /* i : buffer of input signal @12.8 kHz */ - const float new_samples_16k[], /* i : buffer of input signal @16 kHz */ - const Word16 Aw_fx[], /* i : weighted A(z) unquant. for subframes, Q12 */ - float lsp_new[], /* i : LSPs at the end of the frame, Q15 */ - float lsp_mid[], /* i : LSPs in the middle of the frame, Q15 */ - Word16 pitch_buf_fx[NB_SUBFR16k], /* o : pitch for each subframe, Q6 */ - const Word16 last_element_mode, /* i : last element mode, Q0 */ - const Word16 vad_hover_flag /* i : VAD hangover flag, Q0 */ -); - - Word16 transient_analysis_ivas_fx( TRAN_DET_HANDLE hTranDet, /* i : handle transient detection */ const Word16 cor_map_LT[], /* i : LT correlation map Q_cor_map = Qx */ @@ -3194,8 +3154,6 @@ void small_requantize_direction_frame_fx( Word16 bits_dir_bands[MASA_MAXIMUM_CODING_SUBBANDS], Word16 *diff ); -#ifdef IVAS_FLOAT_FIXED - void ivas_param_ism_stereo_dmx_fx( Encoder_Struct *st_ivas, /* i : IVAS encoder structure */ Word32 *data[MAX_NUM_OBJECTS], /* i/o: input signal/stereo dmx Qx */ @@ -3207,7 +3165,6 @@ void ivas_param_ism_enc_fx( Word32 *data[MAX_NUM_OBJECTS], /* i : input signal q_pcm_in */ const Word16 input_frame, /* i : input frame length per channel */ const Word16 q_pcm_in ); -#endif ISM_MODE ivas_ism_mode_select( const Word16 nchan_inp, /* i : number of input objects */ @@ -3226,9 +3183,9 @@ void ivas_fb_mixer_get_windowed_fr_fx( Word32 *pcm_in_fx[], Word32 *frame_f_real_fx[], Word32 *frame_f_imag_fx[], - const int16_t length, /* i : number of new samples in time slot */ - const int16_t mdft_len, /* i : MDFT frame length */ - const int16_t nchan_fb_in, /* i : number of analysis channels */ + const Word16 length, /* i : number of new samples in time slot */ + const Word16 mdft_len, /* i : MDFT frame length */ + const Word16 nchan_fb_in, /* i : number of analysis channels */ Word16 gb ); void ivas_omasa_set_config_fx( OMASA_ENC_HANDLE hOMasa, /* i/o: OMASA encoder handle */ @@ -3547,4 +3504,2211 @@ ivas_error ivas_masa_encode_fx( const Word16 ism_imp, /* i : importance of separated object */ const Word16 flag_omasa_ener_brate /* i : less bitrate for objects in OMASA flag */ ); + +void ivas_write_format_sid_fx( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 element_mode, /* i : element bitrate */ + BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ +); + +void ivas_write_format_fx( /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas ); + +ivas_error create_sce_enc_fx( + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 sce_id, /* i : SCE # identifier */ + const Word32 element_brate /* i : element bitrate */ +); + +ivas_error create_cpe_enc_fx( + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + const Word16 cpe_id, /* i : CPE # identifier */ + const Word32 element_brate /* i : element bitrate */ +); + +void ivas_quantise_real_values_fx( + const Word32 *values_fx, + const Word16 q_levels, + const Word32 min_value_fx, + const Word32 max_value_fx, + Word16 *index, + Word32 *quant_fx, + const Word16 dim ); + +void ivas_quantise_real_values_enc_fx( + const Word32 *values_fx, // Q28 + const Word16 q_levels, + const Word32 min_value_fx, // Q28 + const Word32 max_value_fx, // Q28 + Word16 *index, + Word32 *quant_fx, // Q28 + const Word16 dim ); + +void ivas_quantise_real_values_enc_fx_varq( + const Word32 *values_fx, + const Word16 q_levels, + const Word32 min_value_fx, + const Word32 max_value_fx, + Word16 *index, + Word32 *quant_fx, + const Word16 dim, + Word16 inp_q ); + +void ivas_spar_quant_dtx_init_fx( + ivas_spar_md_t *spar_md, + Word32 *min_max ); + +void ivas_spar_quant_dtx_init_fx( + ivas_spar_md_t *spar_md, + Word32 *min_max ); + +void ivas_copy_band_coeffs_idx_to_arr( + ivas_band_coeffs_ind_t *pBands_idx, + const Word16 nB, + Word16 *pSymbol_re, + ivas_cell_dim_t *pCell_dims, + const ivas_coeffs_type_t coeff_type ); + +void ivas_clear_band_coeffs_fx( + ivas_band_coeffs_t *pband_coeffs, + const UWord16 num_bands ); + +Word16 ivas_qmetadata_DecodeExtendedGR( + UWord16 *bitstream, + Word16 *index, + const Word16 alph_size, + const Word16 gr_param ); + +void ivas_masa_combine_directions_fx( + MASA_ENCODER_HANDLE hMasa /* i/o: MASA encoder handle */ +); + +/*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */ +Word16 ivas_get_df_ratio_bits_hodirac( + const Word16 index_diff /* i : index of quantized diffuse-to-total ratio */ +); + +/*! r: Bits to be used for quantizing distribution ratio of direct-to-total ratios */ +Word16 ivas_get_df_ratio_bits( + const Word16 index_diff /* i : index of quantized diffuse-to-total ratio */ +); + +void invdct4_transform_fx( + Word32 *v_fx, /* i : input vector */ + UWord8 *invdct_v, /* o : transformed vector */ + Word16 q ); + +void ivas_spar_param_to_masa_param_mapping_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ + Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ + Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, imag */ + Word16 q_cldfb[6][CLDFB_SLOTS_PER_SUBFRAME], + const Word16 subframe /* i : Subframe to map */ +); + +ivas_error ivas_binRenderer_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +void ivas_binRenderer_close_fx( + BINAURAL_RENDERER_HANDLE *hBinRenderer /* i/o: decoder binaural renderer handle */ +); + +void ivas_init_binaural_hrtf_fx( + HRTFS_FASTCONV *HrtfFastConv /* i/o: FASTCONV HRTF structure */ +); + +ivas_error ivas_allocate_binaural_hrtf_fx( + HRTFS_FASTCONV *HrtfFastConv, /* i/o: FASTCONV HRTF structure */ + const AUDIO_CONFIG input_config, /* i : input audio configuration */ + const BINAURAL_INPUT_AUDIO_CONFIG bin_input_config, /* i : binaural input audio config */ + const RENDERER_TYPE renderer_type, /* i : renderer type */ + const Word16 allocate_init_flag /* i : Memory allocation flag */ +); + +void ivas_binRenderer_fx( + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ + const Word16 numTimeSlots, /* i : number of time slots to render */ + Word32 Cldfb_RealBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + Word32 Cldfb_ImagBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + Word32 ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + Word16 *Q_in /* i : LS signals exp */ +); + +void ivas_binaural_add_LFE_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word16 output_frame, /* i : length of input frame */ + Word32 *input_fx[], /* i : transport channels */ + Word32 *output_fx[] /* o : synthesized core-coder transport channels/DirAC output */ +); + +void ivas_mc2sba_fx( + IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ + Word32 *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ + Word32 *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word16 gain_lfe /* i : gain for LFE, 0 = ignore LFE */ +); + +void ivas_param_mc_mc2sba_cldfb_fx( + IVAS_OUTPUT_SETUP hTransSetup, /* i : transported MC Format */ + Word32 *hoa_encoder, /* i : HOA3 encoder for the transported MC format */ + const Word16 slot_idx, /* i : current slot in the subframe */ + Word32 Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: Contains the MC signals (on input) and the HOA3 (on output) */ + Word32 Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: Contains the MC signals (on input) and the HOA3 (on output) */ + const Word16 nBands, /* i : number of synth CLDFB bands */ + const Word16 gain_lfe /* i : gain applied to LFE */ +); + +void ivas_ism2sba_sf_fx( + Word32 *buffer_in_fx[], /* i : TC buffer */ + Word32 *buffer_out_fx[], /* o : TD signal buffers */ + ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ + const Word16 num_objects, /* i : number of objects */ + const Word16 n_samples_to_render, /* i : output frame length per channel */ + const Word16 offset, /* i : offset for the interpolatr */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ +); + +void panning_wrap_angles_fx( + const Word32 azi_deg, /* i : azimuth in degrees for panning direction (positive left) Q22 */ + const Word32 ele_deg, /* i : elevation in degrees for panning direction (positive up) Q22 */ + Word32 *azi_wrapped, /* o : wrapped azimuth component Q22 */ + Word32 *ele_wrapped /* o : wrapped elevation component Q22 */ +); + +void v_sort_ind_fixed( + Word32 *x, /* i/o: Vector to be sorted */ + Word16 *idx, /* o : Original index positions */ + const Word16 len /* i : vector length */ +); + +void ivas_ls_setup_conversion_process_mdct_param_mc_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *x_fx[][NB_DIV], /* i/o: Fixed output synthesis signal */ + Word16 x_e[CPE_CHANNELS][NB_DIV] /* i/o: Exponent for output synthesis signal */ +); + +void lls_interp_n_fx( + Word16 x_fx[], /* i/o: input/output vector */ + const Word16 N, /* i : length of the input vector */ + Word16 *a_fx, /* o : calculated slope */ + Word16 *b_fx, /* o : calculated offset */ + const Word16 upd /* i : use 1 to update x[] with the interpolated output */ +); + +void ivas_lfe_synth_with_filters_fx( + MCMASA_LFE_SYNTH_DATA_HANDLE hMasaLfeSynth, /* i/o: LFE synthesis structure for McMASA */ + Word32 *data_f[], /* o : output signals */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 separateChannelIndex, /* i : separate channel index */ + const Word16 lfeChannelIndex /* i : LFE channel index */ +); + +void ivas_lfe_enc_fx( + LFE_ENC_HANDLE hLFE, /* i/o: LFE encoder handle */ + Word32 data_lfe_ch[], /* i : input LFE signal */ + Word16 q_data_lfe_ch, /* i : Q of input LFE signal */ + const Word16 input_frame, /* i : input frame length per channel */ + BSTR_ENC_HANDLE hBstr /* i/o: bitstream handle */ +); + +void ivas_filter_process_fx( + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + Word32 *pIn_Out_fx, /* i : signal subject to filtering */ + const Word16 length, /* i : filter order */ + Word16 q_factor ); + +ivas_error ivas_osba_enc_open_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +); + +void ivas_osba_enc_close_fx( + OSBA_ENC_HANDLE *hOSba /* i/o: encoder OSBA handle */ +); + +void ivas_osba_enc_fx( + OSBA_ENC_HANDLE hOSba, /* i/o: OSBA encoder handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handle */ + Word32 *data_in_fx[], /* i/o: Input / transport audio signals */ + const Word16 input_frame, /* i : Input frame size */ + const Word16 nchan_ism, /* i : Number of objects for parameter analysis */ + const ISM_MODE ism_mode, /* i : ISM mode */ + const Word16 sba_analysis_order, /* i : SBA order evaluated in DirAC/SPAR encoder */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 sba_planar, /* i : planar SBA flag */ + Word16 *q_data ); + +ivas_error ivas_osba_data_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +); +ivas_error ivas_osba_dirac_td_binaural_jbm_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Word32 *output_fx[], /* o : rendered time signal */ + Word16 out_len /*Store the length of values in each channel*/ +); + +ivas_error ivas_osba_ism_metadata_dec_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word32 ism_total_brate, /* i : ISM total bitrate */ + Word16 *nchan_ism, /* o : number of ISM separated channels */ + Word16 nb_bits_metadata[] /* o : number of ISM metadata bits */ +); + +ivas_error ivas_osba_render_sf_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ + Word32 *p_output[] /* o : rendered time signal */ +); + +void ivas_osba_data_close_fx( + SBA_ISM_DATA_HANDLE *hSbaIsmData /* i/o: OSBA rendering handle */ +); + +void ivas_set_ism_importance_interformat_fx( + const Word32 ism_total_brate, /* i/o: ISms total bitrate */ + const Word16 nchan_transport, /* i : number of transported channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ + const Word16 lp_noise_CPE_fx, /* i : LP filtered total noise estimation */ + Word16 ism_imp[] /* o : ISM importance flags */ +); + +void ivas_omasa_preProcessStereoTransportsForMovedObjects_fx( + Decoder_Struct *st_ivas, + Word32 inRe_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ + Word32 inIm_fx[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /*cldfb_buf_q*/ + Word16 *cldfb_buf_q, + const Word16 nBins, + const Word16 subframe ); + + +void ivas_omasa_decode_masa_to_total_fx( + UWord16 *bit_stream, + Word16 *index, + Word32 masa_to_total_energy_ratio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + const Word16 nbands, + const Word16 nblocks ); + + +ivas_error ivas_td_binaural_open_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word16 *SrcInd, /*Temporarily used to store the updated value of SrcInd*/ + Word16 *num_src ); + +ivas_error ivas_td_binaural_renderer_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *output[], /* i/o: SCE channels / Binaural synthesis */ + const Word16 output_frame /* i : output frame length */ +); + +void ivas_FB_mixer_close_fx( + IVAS_FB_MIXER_HANDLE *hFbMixer, /* i/o: FB mixer handle */ + const Word32 sampling_rate, /* i : sampling rate in Hz */ + const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ +); + +void ivas_fb_mixer_pcm_ingest_fx( + IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ + Word32 *pcm_in[], /* i : input audio channels Qq_data_fix[] */ + Word32 **ppOut_pcm, /* o : output audio channels Qq_ppOut_pcm[] */ + const Word16 frame_len, /* i : frame length */ + const Word16 HOA_md_ind[IVAS_SPAR_MAX_CH], + Word16 q_data_fix[MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS], + Word16 *q_ppOut_pcm ); + +void ivas_fb_mixer_process( + IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ + Word32 ***mixer_mat_fx, /* i : mixer matrix in q_mixer_mat_fx */ + Word16 *q_mixer_mat_fx, /* i : mixer matrix */ + Word32 **ppOut_pcm_fx, /* o : output audio channels in ppOut_pcm_fx resultant */ + Word16 *q_ppOut_pcm_fx, /*ppOut_pcm_fx resultant q*/ + const Word16 frame_len, /* i : frame length in samples */ + Word16 in_out_mixer_map[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH] /* i/o: mixing mapping */ +); + +Word16 ivas_get_num_bands_from_bw_idx( + const Word16 bwidth /* i : audio bandwidth */ +); + +void sns_avq_dec_fx( + Word16 *index, /* i : Quantization indices */ + Word32 SNS_Q[NB_DIV][M], /* o : Quantized SNS vectors */ + Word16 *q_snsq, + const Word16 L_frame, /* i : frame length */ + const Word16 numlpc /* i : Number of sets of lpc */ +); + +void sns_avq_dec_stereo_fx( + Word16 *indexl, /* i : Quantization indices (left channel) */ + Word16 *indexr, /* i : Quantization indices (right channe) */ + const Word16 L_frame, /* i : frame length */ + Word32 *SNS_Ql, /* o : Quantized SNS vectors (left channel) */ + Word16 *q_l, + Word32 *SNS_Qr, /* o : Quantized SNS vectors (right channe) */ + Word16 *q_r ); + +void dequantize_sns_fx( + Word16 indices[CPE_CHANNELS][NPRM_LPC_NEW], + Word32 snsQ_out[CPE_CHANNELS][NB_DIV][M], + Decoder_State **sts ); + +void inverseMS_fx( + const Word16 L_frame, /* i : frame length Q0*/ + Word32 x0[], /* i/o: mid/left channel coefficients Qx*/ + Word32 x1[], /* i/o: side/right channel coefficients Qx*/ + const Word32 norm_fac /* i : normalization factor Q31*/ +); + +void ivas_syn_output_f_fx( + Word32 *synth[], /* i/o: Word32 synthesis signal */ + const Word16 output_frame, /* i : output frame length (one channel) */ + const Word16 n_channels, /* i : number of output channels */ + Word32 *synth_out /* o : integer 16 bits synthesis signal */ +); + + +ivas_error ivas_init_encoder_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +ivas_error ivas_output_buff_dec_fx( + Word32 *p_output_f[], /* i/o: output audio buffers */ + const Word16 nchan_out_buff_old, /* i : previous frame number of output channels */ + const Word16 nchan_out_buff /* i : number of output channels */ +); + +ivas_error ivas_dec_setup( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + UWord16 *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ + Word16 *data /* o : output synthesis signal */ +); + +ivas_error create_mct_dec_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +ivas_error mct_dec_reconfigure_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const UWord16 b_nchan_change /* i : flag indicating different channel count */ +); + +ivas_error ivas_corecoder_dec_reconfig_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nSCE_old, /* i : number of SCEs in previous frame */ + Word16 nCPE_old, /* i : number of CPEs in previous frame */ + const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ + const Word16 sba_dirac_stereo_flag_old, /* i : signal stereo rendering using DFT upmix in previous frame */ + const Word32 brate_SCE, /* i : bitrate to be set for the SCEs */ + const Word32 brate_CPE /* i : bitrate to be set for the CPEs */ +); + +ivas_error ivas_hp20_dec_reconfig_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nchan_hp20_old /* i : number of HP20 filters in previous frame*/ +); + +Word16 getNumChanSynthesis( + Decoder_Struct *st_ivas /* i : IVAS decoder structure */ +); + +void ivas_destroy_dec_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +ivas_error ivas_core_dec_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + SCE_DEC_HANDLE hSCE, /* i/o: SCE decoder structure */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ + const Word16 n_channels, /* i : number of channels to be decoded */ + Word32 *output_fx[], /* o : output synthesis signal */ + Word32 outputHB[][L_FRAME48k], /* o : output HB synthesis signal */ + Word32 DFT_fx[CPE_CHANNELS][STEREO_DFT_BUF_MAX], /* o : DFT buffers */ + const Word16 sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ +); + +void decod_gen_2sbfr_ivas_fx( + Decoder_State *st, /* i/o: decoder static memory */ + const Word16 sharpFlag, /* i : formant sharpening flag `Q0*/ + const Word16 *Aq, /* i : LP filter coefficient Q12*/ + Word16 *pitch_buf, /* o : Word16 pitch values for each subframe Q6*/ + Word16 *voice_factors, /* o : voicing factors Q15*/ + Word16 *exc, /* i/o: adapt. excitation exc Q_exc*/ + Word16 *exc2, /* i/o: adapt. excitation/total exc Q_exc*/ + Word16 *bwe_exc, /* o : excitation for SWB TBE Q_exc*/ + Word16 *gain_buf, /* o : Word16 pitch gain for each subframe Q14*/ + const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag Q0*/ + const Word16 tdm_Pri_pitch_buf[] /* i : pitch values for primary channel Q6*/ +); + +Word16 ivas_smc_gmm_fx( + Encoder_State *st, /* i/o: state structure */ + STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ + const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */ + const Word16 Etot_fx, /* i : total frame energy */ + Word16 lsp_new_fx[M], /* i : LSPs in current frame TODO:For now removing 'const' to avoid warning */ + Word16 cor_map_sum_fx, /* i : correlation map sum (from multi-harmonic anal.) */ + Word32 epsP_fx[M + 1], /* i : LP prediciton error TODO:For now removing 'const' to avoid warning */ + Word32 PS_fx[], /* i : energy spectrum TODO:For now removing 'const' to avoid warning */ + const Word16 non_sta_fx, /* i : unbound non-stationarity */ + const Word16 relE_fx, /* i : relative frame energy */ + Word16 *high_lpn_flag, /* i/o: sp/mus LPN flag */ + const Word16 flag_spitch /* i : flag to indicate very short stable pitch */ + , + Word16 Qfact_PS, + Word16 Q_esp, + Word16 Qfact_PS_past ); + +void ivas_signaling_enc_fx( + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ + const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo */ +); + +void smooth_dft2td_transition_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *output_fx[CPE_CHANNELS], /* i/o: synthesis @external Fs Q11*/ + const Word16 output_frame /* i : output frame lenght Q0*/ +); + + +Word16 is_IVAS_bitrate_fx( + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +); + +void ivas_mdft_fx( + const Word32 *pIn, /* i : input time-domain signal Qin */ + Word32 *pOut_re, /* o : Real part of MDFT signal Qin */ + Word32 *pOut_im, /* o : Imag. part of MDFT signal Qin */ + const Word16 length, /* i : signal length */ + const Word16 mdft_length /* i : MDFT length */ +); + +void ivas_imdft_fx( + const Word32 *pRe, /* i : Real part of MDFT signal Qin */ + const Word32 *pIm, /* i : Imag. part of MDFT signal Qin */ + Word32 *pOut, /* o : output time-domain signal Qin */ + const Word16 length /* i : signal length */ +); + +void TonalMdctConceal_create_concealment_noise_ivas_fx( + Word32 concealment_noise[L_FRAME48k], + Word16 *concealment_noise_exp, + CPE_DEC_HANDLE hCPE, + const Word16 L_frameTCX, + const Word16 L_frame, + const Word16 idchan, + const Word16 subframe_idx, + const Word16 core, + const Word16 crossfade_gain, + const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode ); + + +Word16 rand_triangular_signed_fx( + Word16 *seed, + Word16 *exp_fac ); + +Word64 var_32_fx( + const Word32 *x, /* i : input vector */ + const Word16 len, /* i : length of inputvector */ + Word16 q /* q : q-factor for the array */ +); + +ivas_error ivas_jbm_dec_tc_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word32 *data_fx ); + +ivas_error ivas_jbm_dec_flush_renderer_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 tc_granularity_new, /* i : new renderer granularity */ + const RENDERER_TYPE renderer_type_old, /* i : old renderer type */ + const AUDIO_CONFIG intern_config_old, /* i : old internal config */ + const IVAS_OUTPUT_SETUP_HANDLE hIntSetupOld, /* i : old internal output setup */ + const MC_MODE mc_mode_old, /* i : old MC mode */ + const ISM_MODE ism_mode_old, /* i : old ISM mode */ + UWord16 *nSamplesRendered, /* o : number of samples flushed */ + Word16 *data /* o : output synthesis signal */ +); + +void ivas_jbm_dec_feed_tc_to_renderer_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nSamplesForRendering, /* i : number of TC samples available for rendering */ + Word16 *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ + Word32 *data /* i/o: transport channels/output synthesis signal */ +); + +void ivas_jbm_dec_feed_tc_to_renderer_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nSamplesForRendering, /* i : number of TC samples available for rendering */ + Word16 *nSamplesResidual, /* o : number of samples not fitting into the renderer grid and buffer for the next call*/ + Word32 *data /* i/o: transport channels/output synthesis signal */ +); + +void ivas_jbm_dec_get_adapted_subframes( + const Word16 nCldfbTs, /* i : number of time slots in the current frame */ + Word16 *subframe_nbslots, /* i/o: subframe grid */ + Word16 *nb_subframes /* i/o: number of subframes in the frame */ +); + +void ivas_jbm_dec_get_md_map( + const Word16 default_len, /* i : default frame length in metadata slots */ + const Word16 len, /* i : length of the modfied frames in metadata slots */ + const Word16 subframe_len, /* i : default length of a subframe */ + const Word16 offset, /* i : current read offset into the md buffer */ + const Word16 buf_len, /* i : length of the metadata buffer */ + Word16 *map /* o : metadata index map */ +); + +void ivas_jbm_dec_get_md_map_even_spacing( + const Word16 len, /* i : length of the modfied frames in metadata slots */ + const Word16 subframe_len, /* i : default length of a subframe */ + const Word16 offset, /* i : current read offset into the md buffer */ + const Word16 buf_len, /* i : length of the metadata buffer */ + Word16 *map /* o : metadata index map */ +); + +void bitbudget_to_brate( + const Word16 x[], /* i : bitbudgets */ + Word32 y[], /* o : bitrates */ + const Word16 N /* i : number of entries to be converted */ +); + +Word16 ism_quant_meta_fx( + const Word32 val, /* i : scalar value to quantize */ + Word32 *valQ, /* o : quantized value */ + const Word32 borders_fx[], /* i : level borders */ + const Word32 q_step_fx, /* i : quantization step */ + const Word32 q_step_border_fx, /* i : quantization step at the border */ + const Word16 cbsize /* i : codebook size */ +); + +ivas_error ivas_set_ism_metadata_fx( + ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ + const Word32 azimuth, /* i : azimuth value */ + const Word32 elevation, /* i : elevation value */ + const Word16 radius_meta, /* i : radius */ + const Word32 yaw, /* i : yaw */ + const Word32 pitch, /* i : pitch */ + const Word16 non_diegetic_flag /* i : non-diegetic object flag */ +); + +ivas_error ivas_ism_metadata_enc( + Word32 *ism_total_brate, /* i/o: ISM total bitrate */ + const Word16 nchan_ism, /* i : number of ISM channels */ + const Word16 nchan_transport, /* i : number of transport channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + Word16 nb_bits_metadata[], /* o : number of metadata bits */ + const Word16 localVAD[], /* i : VAD flag */ + const Word16 ism_mode, /* i : ISM mode */ + const PARAM_ISM_CONFIG_HANDLE hParamIsm, /* i : Param ISM Config Handle */ + const Word16 ism_extended_metadata_flag, /* i : Extended metadata flag */ + const Word16 lp_noise_CPE, /* i : LP filtered total noise estimation */ + const Word16 flag_omasa_ener_brate, /* i : less bitrate for objects in OMASA flag */ + Word16 *omasa_stereo_sw_cnt, + const Word16 ini_frame ); + +ivas_error ivas_ism_dec_config( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ + UWord16 *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ + Word16 *data /* o : output synthesis signal */ +); + +ivas_error ivas_param_ism_dec_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +void ivas_param_ism_dec_close_fx( + PARAM_ISM_DEC_HANDLE *hParamIsmDec, /* i/o: decoder ParamISM handle */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE *hSpatParamRendCom_out, /* i/o: common spatial renderer data */ + const AUDIO_CONFIG output_config /* i : output audio configuration */ +); + +void ivas_ism_dec_digest_tc_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +void ivas_param_ism_dec_digest_tc_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + Word32 *transport_channels[], /* i : synthesized core-coder transport channels/DirAC output */ + Word16 q_tc_in ); + +void ivas_param_ism_dec_render_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Word32 *output_f_fx[] ); + +void ivas_param_ism_params_to_masa_param_mapping_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +Word16 ivas_ism_dtx_enc_fx( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 nchan_ism, /* i : number of objects */ + const Word16 nchan_transport, /* i : number of transport channels */ + Word16 vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + Word16 md_diff_flag[], /* o : metadata differential flag */ + Word16 *sid_flag /* o : indication of SID frame */ +); + +void ivas_ism_dtx_dec_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Word16 *nb_bits_metadata /* o : number of metadata bits */ +); + +void ivas_ism_get_sce_id_dtx_fx( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 input_frame /* i : input frame length per channel */ +); + +void ivas_ism_coh_estim_dtx_enc_fx( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 input_frame /* i : input frame length */ +); + +void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( + SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder structures */ + const Word16 sce_id_dtx, /* i : SCE DTX ID */ + const Word16 nchan_transport, /* i : number of transport channels */ + Word16 *Q_cngNoiseLevel ); + + +ivas_error stereo_dft_enc_create_fx( + STEREO_DFT_ENC_DATA_HANDLE *hStereoDft, /* o : encoder DFT stereo handle */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 max_bwidth /* i : maximum encoded bandwidth */ +); + +void stereo_dft_enc_reset_fx( + STEREO_DFT_ENC_DATA_HANDLE hStereoDft /* i/o: encoder stereo handle */ +); + +void stereo_enc_itd_init_fx( + ITD_DATA_HANDLE hItd /* i/o: encoder ITD handle */ +); + +void stereo_dft_enc_update_fx( + STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ + const Word16 max_bwidth /* i : maximum encoded bandwidth */ +); + +void stereo_dft_quantize_res_gains_fx( + const Word32 *g, // Q31 + const Word32 *r, // Q31 + Word32 *gq, // Q31 + Word32 *rq, // Q31 + Word16 *ig, + Word16 *ir ); + +void stereo_dft_dequantize_itd_fx( + Word16 *ind, /* Q0 */ + Word32 *out, /* Q15 */ + const Word32 output_Fs /* Q0 */ +); + +Word16 stereo_dft_sg_recovery_fx( + STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: Decoder DFT stereo handle */ +); + +Word16 res_bpf_adapt_ivas_fx( + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ + const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ + Word32 res_buf[STEREO_DFT_N_8k], /* i : residual buffer Q_res */ + Word16 q_res ); + +void stereo_dft_dec_read_BS_fx( + const Word32 ivas_total_brate, /* i : IVAS total bitrate Q0*/ + const Word32 element_brate, /* i : element bitrate Q0*/ + Word32 *total_brate, /* o : total bitrate Q0*/ + Decoder_State *st, /* i/o: decoder state structure */ + STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder stereo handle */ + const Word16 bwidth, /* i : bandwidth Q0*/ + const Word16 output_frame, /* i : output frame length Q0*/ + Word32 res_buf_fx[STEREO_DFT_N_8k], /* o : residual buffer Q0*/ + Word16 *nb_bits, /* o : number of bits read Q0*/ + Word16 *coh_fx, /* i/o: Coherence Q15*/ + const Word16 ivas_format /* i : ivas format Q0*/ +); + +Word16 write_bitstream_adapt_GR( + BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ + const Word16 ind, /* i : bitstream index */ + const Word16 *in, /* i : values to be written in bitstream */ + const Word16 len, /* i : values vector length */ + const Word16 GR_ord, /* i : GR order to be used */ + const Word16 no_GR_ord /* i : speech/music 0/1 */ +); + +Word16 adapt_GR_ief_fx( + const Word16 *in, /* i : vector to encode */ + Word16 *in_diff, /* o : encoded symbols in case of differential encoding */ + const Word16 *prev, /* i : previous frame data */ + const Word16 len, /* i : input vector length */ + const Word16 no_symb, /* i : number of symbols */ + Word16 *nbits, /* o : number of used bits */ + Word16 *in_enc, /* o : symbold actually encoded after adapt_GR */ + const Word16 *map0, /* i : mapping array */ + const Word16 no_GR_ord, /* i : number of GR order to try 2: 0,1; 3:0,1,2 */ + Word16 *nbits_diff, /* o : number bits in diff encoding */ + const Word16 side_gain_counter, /* i : number of frames since last abs coding */ + Word16 *side_gain_bitdiff_lp, /* i/o: LP-filtered bit difference between abs/diff */ + Word16 *q_side_gain_bitdiff_lp, /* i/o: Q of LP-filtered bit difference between abs/diff */ + const Word16 try_diff /* i : diff coding allowed 1/0 */ +); + +Word16 adapt_GR_rpg1_ief( + const Word16 *in, /* i : res pred gains input vector */ + Word16 *in_diff, /* o : encoded symbols in case of differential encoding */ + const Word16 *prev, /* i : previous frame data */ + const Word16 len, /* i : input vector length */ + const Word16 no_symb, /* i : number of symbols */ + Word16 *nbits, /* o : number of used bits */ + Word16 *in_enc, /* o : symbold actually encoded after adapt_GR */ + const Word16 *maps, /* i : mapping array */ + Word16 *nbits_diff, /* o : estimated no of bits for differential encoding */ + const Word16 no_GR_ord, /* i : number of GR order to try 2: 0,1; 3:0,1,2 */ + const Word16 try_diff /* i : diff coding allowed 1/0 */ +); + +Word16 write_GR1( + BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ + const Word16 ind, /* i : bitstream index */ + const Word16 *in, /* i : data to be encoded */ + const Word16 len /* i : input data length */ +); + +Word16 write_bitstream_GR( + BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ + const Word16 ind, /* i : bitstream index */ + const Word16 *in, /* i : input vector */ + const Word16 len, /* i : input vector length */ + const Word16 GR_ord /* i : GR order */ +); + +void stereo_dft_hybrid_ITD_flag( + STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ + const Word32 input_Fs, /* i : CPE element sampling rate */ + const Word16 hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ +); + +void rc_uni_dec_init_fx( + RangeUniDecState *rc_st_dec, /* i/o: RC state handle */ + UWord16 *bit_buffer, /* i : Bit buffer */ + const Word16 max_available_bits /* i : Total maximum bits available */ +); + +UWord16 rc_uni_dec_read_symbol_fastS_fx( + RangeUniDecState *rc_st_dec, /* i/o: Decoder State */ + const UWord16 cum_freq_table[], /* i : Cumulative frequency up to symbol */ + const UWord16 sym_freq_table[], /* i : Symbol frequency */ + const UWord16 alphabet_size, /* i : Number of symbols in the alphabet */ + const UWord16 tot_shift /* i : Total frequency as a power of 2 */ +); + +Word16 rc_uni_dec_virtual_finish_fx( + RangeUniDecState *rc_st_dec /* i/o: RC state handle */ +); + +void unclr_classifier_dft_fx( + CPE_ENC_HANDLE hCPE /* i/o: CPE encoder structure */ +); + +void xtalk_classifier_dft_fx( + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const Word16 itd, /* i : ITD from DFT stereo - used as a feature */ + const Word32 gcc_phat[] /* i : GPHAT cross-channel correlation function Q31*/ +); + +void stereo_td_init_enc_fx( + STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ + const Word16 last_element_mode /* i : last element mode */ +); + +ivas_error stereo_set_tdm_fx( + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const Word16 input_frame, /* i : input frame length per channel */ + Word16 input_q ); + +void stereo_tdm_prep_dwnmx_fx( + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const Word32 *input1, /* i : right channel input */ + const Word16 input_frame, /* i : frame lenght */ + const Word16 input_q /* i : frame lenght */ +); + +void tdm_upmix_plain_fx( + Word32 Left_fx[], /* o : left channel Qx*/ + Word32 Right_fx[], /* o : right channel Qx*/ + const Word32 PCh_2_L_fx[], /* i : primary channel Qx*/ + const Word32 SCh_2_R_fx[], /* i : secondary channel Qx*/ + const Word32 LR_ratio_fx, /* i : mixing ratio Q31*/ + const Word32 inv_den_LR_ratio_fx, /* i : inverse mixing ration Q31*/ + const Word16 start_index, /* i : start index Q0*/ + const Word16 end_index, /* i : end index Q0*/ + const Word16 plus_minus_flag /* i : plus/minus flag Q0*/ +); + +void stereo_tdm_combine_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *PCh_2_L_fx, /* i/o: Primary channel -> output as left channel Qx*/ + Word32 *SCh_2_R_fx, /* i/o: Secondary channel -> output as right channel Qx*/ + const Word16 output_frame, /* i : Number of samples Q0*/ + const Word16 flag_HB, /* i : flag to distinguish between core (0) and HB (1) synthesis Q0*/ + const Word16 tdm_ratio_idx /* i : TDM ratio index Q0*/ +); + +Word16 tdm_lp_comparison_fx( + STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */ + STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */ + Encoder_State *st, /* i/o: Encoder structure */ + Word32 *speech_buff, /* i : Current speech frame Q_speech */ + const Word16 *A_PCh_fx, /* i : primary channel LP coefficients Q12*/ + const Word16 *A_SCh_fx, /* i : secondary channel LP coeff. Q12*/ + const Word16 m, /* i : filter length */ + const Word32 *isp_PCh_fx, /* i : primary channel LSPs Q31 */ + const Word32 *isp_SCh_fx, /* i : secondary channel LSPs Q31 */ + const Word16 L_frame, /* i : frame length */ + const Word32 element_brate_wo_meta, /* i : element bitrate without metadata*/ + Word16 Q_speech ); + +ivas_error signaling_enc_secondary_fx( + Encoder_State *st, /* i/o: Encoder structure */ + const Word16 tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag OR LRTD primary channel */ + const Word16 tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag*/ +); + +void tdm_low_rate_enc( + Encoder_State *st, /* i/o: State structure */ + const Word16 Aq[], /* i : 12k8 Lp coefficient */ + const Word16 *res, + /* i : residual signal */ // Q_new + Word16 *synth, + /* i/o: core synthesis */ // Q_new + Word16 *exc_fx, + /* i/o: current non-enhanced excitation */ // Q_new + Word16 *pitch_buf, + /* i/o: floating pitch values for each subframe */ // Q6 + Word16 *voice_factors, + /* o : voicing factors */ // Q15 + Word16 *bwe_exc_fx, + /* o : excitation for SWB TBE */ // Q_new + const Word16 attack_flag, /* i : attck flag */ + const Word16 *lsf_new, + /* i : current frame ISF vector */ // x2.56 + Word16 *tmp_noise, + /* o : long-term noise energy */ // Q8 + Word16 *Q_new ); + +void tdm_low_rate_dec_fx( + Decoder_State *st, /* i/o: decoder static memory */ + Word16 dct_epit[], /* o : GSC excitation in DCT domain Q_exc*/ + Word16 *pitch_buf, /* o : Word16 pitch values for each subframe Q6*/ + Word16 *voice_factors, /* o : voicing factors Q15*/ + Word16 *exc, /* i/o: adapt. excitation exc Q_exc*/ + Word16 *exc2, /* i/o: adapt. excitation/total exc Q_exc*/ + Word16 *bwe_exc, /* o : excitation for SWB TBE Q_exc*/ + const Word16 *lsf_new /* i : ISFs at the end of the frame Q8/100 (2.56x)*/ +); + +void tdm_SCh_LSF_intra_pred_fx( + const Word32 element_brate, /* i : element bitrate */ + const Word16 *tdm_lsfQ_PCh_fx, /* i : primary channel LSFs */ + Word16 *pred_lsf_SCh_fx /* o : predicted secondary channel LSFs */ +); + +void tdm_SCh_lsf_reuse_fx( + const Word16 enc_dec, /* i : encoder/decoder flag */ + const Word32 element_brate, /* i : element bitrate */ + Word16 lsf_new_fx[M], /* i/o: LSFs at the end of the frame */ + Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame */ + const Word16 tdm_lsfQ_PCh_fx[M], /* i : primary channel LSFs */ + const Word16 lsf_wgts_fx[M], /* i : LSF weights */ + Word16 *beta_index /* i/o: quantization index */ +); + +void EstimateStereoTCXNoiseLevel_fx( + Encoder_State **sts, /* i : state handle */ + Word32 *q_spectrum[CPE_CHANNELS][NB_DIV], /* i : quantized MDCT spectrum */ + Word16 gain_tcx[][NB_DIV], /* i : global gain */ + Word16 gain_tcx_e, /* i : global gain exponent */ + Word16 L_frame[][NB_DIV], /* i : frame length */ + Word16 noiseFillingBorder[][NB_DIV], /* i : noise filling border */ + Word16 hm_active[][NB_DIV], /* i : flag indicating if the harmonic model is active */ + const Word16 ignore_chan[], /* i : flag indicating whether the channel should be ignored */ + Word16 fac_ns[][NB_DIV], /* o : noise filling level */ + Word16 param_core[][NB_DIV * NPRM_DIV], /* o : quantized noise filling level */ + const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ +); + +void TNSAnalysisStereo_fx( + Encoder_State **sts, /* i : encoder state handle */ + Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* o : MDST spectrum Qx*/ + const Word16 bWhitenedDomain, /* i : whitened domain flag Q0*/ + Word16 tnsSize[CPE_CHANNELS][NB_DIV], /* i : number of tns parameters put into prm Q0*/ + Word16 tnsBits[CPE_CHANNELS][NB_DIV], /* i : number of tns bits in the frame Q0*/ + Word16 param_core[][NB_DIV * NPRM_DIV], /* o : TNS parameters Q0*/ + const Word16 mct_on /* i : flag mct block (1) or stereo (0) Q0*/ +); + +void init_tcx_enc_info_fx( + Encoder_State *st, /* i/o: coder memory state */ + Word16 *L_frame, + Word16 *L_frameTCX, + Word16 *L_spec ); + +void SetCurrentPsychParams( + const Word16 core, + const Word16 last_frame_was_concealed_cng, + TCX_CONFIG_HANDLE hTcxCfg ); + +void sns_avq_cod_fx( + const Word32 *sns_fx, /* i : Input sns vectors */ + Word16 exp_sns, + const Word32 *snsmid_fx, /* i : Input mid-sns vectors */ + Word16 exp_snsmid, + Word32 *sns_q_fx, /* o : Quantized LFS vectors Q16 */ + Word32 *snsmid_q_fx, /* o : Quantized mid-LFS vectors Q16 */ + Word16 *index, /* o : Quantization indices */ + const Word16 core, /* i : core */ + const Word16 L_frame, + const Word16 low_brate_mode /* i : flag low bit operating mode */ +); + +void sns_avq_cod_stereo_fx( + const Word32 *snsl_fx, /* i : Input sns vector (left channel) */ + Word16 exp_snl, + const Word32 *snsr_fx, /* i : Input sns vector (right channel) */ + Word16 exp_snr, + const Word16 L_frame, + Word32 *snsl_q_fx, /* o : Quantized sns vector (left channel) Q16 */ + Word32 *snsr_q_fx, /* o : Quantized sns vector (right channel) Q16 */ + Word16 *indexl, /* o : Quantization indices (left channel) */ + Word16 *indexr /* o : Quantization indices (right channel) */ +); + +ivas_error initMdctStereoDtxData_fx( + CPE_DEC_HANDLE hCPE /* i/o: CPE handle */ +); + +void applyDmxMdctStereo_fx( + const CPE_DEC_HANDLE hCPE, /* i : CPE handle */ + Word32 *output_fx[CPE_CHANNELS], /* o : output from core decoder q_out*/ + const Word16 output_frame /* i : output frame length Q0*/ +); + +ivas_error front_vad_create_fx( + FRONT_VAD_ENC_HANDLE *hFrontVad, /* i/o: front-VAD handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig /* i : configuration structure */ +); + +void front_vad_destroy_fx( + FRONT_VAD_ENC_HANDLE *hFrontVad /* i/o: front-VAD handle */ +); + +ivas_error front_vad_fx( + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure, nullable */ + Encoder_State *st, /* i/o: encoder state structure */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + FRONT_VAD_ENC_HANDLE *hFrontVads, /* i/o: FrontVad handles */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const Word16 input_frame, /* i : frame length */ + Word16 vad_flag_dtx[], /* o : HE-SAD flag with additional DTX HO */ + Word32 fr_bands_fx[][2 * NB_BANDS], /* o : energy in frequency bands Q_buffer[n] + QSCALE + 2 */ + Word16 Etot_LR_fx[], /* o : total energy Left & Right channel Q8 */ + Word32 lf_E_fx[][2 * VOIC_BINS], /* i : per bin spectrum energy in lf, LR channels Q_buffer[n] + QSCALE */ + Word16 localVAD_HE_SAD[], /* o : HE-SAD flag without hangover, LR channels */ + Word16 vad_hover_flag[], /* o : VAD hangover flag */ + Word32 band_energies_LR_fx[2 * NB_BANDS], /* o : energy in critical bands without minimum noise floor E_MIN Q_buffer[1] + QSCALE + 2 - band_ener_guardbits*/ + Word32 *PS_out_fx, /* o : energy spectrum Q_buffer + QSCALE */ + Word16 *Bin_E_out_fx, /* o : log-energy spectrum of the current frame Q7 */ + Word16 Q_inp, + Word16 *Q_buffer, + Word16 Q_add, + Word16 *front_create_flag ); + +void stereo_cna_update_params_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *output_fx[CPE_CHANNELS], /* i : Output signal OUTPUT_Q*/ + const Word16 output_frame, /* i : Output frame length Q0*/ + const Word16 tdm_ratio_idx /* i : TDM ratio index Q0*/ +); + +void mvr2r_inc_fixed_one( + const Word32 x_fx[], /* i : input vector */ + const Word16 x_inc, /* i : increment for vector x[] */ + Word32 y_fx[], /* o : output vector */ + const Word16 y_inc, /* i : increment for vector y[] */ + const Word16 n /* i : vector size */ +); + +void mvr2r_inc_fixed( + const Word32 x_fx[], /* i : input vector */ + const Word16 x_inc, /* i : increment for vector x[] */ + Word32 y_fx[], /* o : output vector */ + const Word16 y_inc, /* i : increment for vector y[] */ + const Word16 n /* i : vector size */ +); + +void v_mult_inc_fx( + const Word32 x1_fx[], /* i : Input vector 1 */ + Word16 *x1_q_fx, + const Word16 x1_inc, /* i : Increment for input vector 1 */ + const Word32 x2_fx[], /* i : Input vector 2 */ + Word16 *x2_q_fx, + const Word16 x2_inc, /* i : Increment for input vector 1 */ + Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ + Word16 *y_q_fx, + const Word16 y_inc, /* i : increment for vector y[i] */ + const Word16 N /* i : Vector length */ +); + +void v_add_inc_fx( + const Word32 x1[], /* i : Input vector 1 */ + const Word16 x_inc, /* i : Increment for input vector 1 */ + const Word32 x2[], /* i : Input vector 2 */ + const Word16 x2_inc, /* i : Increment for input vector 2 */ + Word32 y[], /* o : Output vector that contains vector 1 + vector 2 */ + const Word16 y_inc, /* i : increment for vector y[] */ + const Word16 N /* i : Vector length */ +); +Word32 logsumexp_fx( + const Word32 x[], /* i : input array x */ + const Word16 x_e, + const Word16 N /* i : number of elements in array x */ +); +Word32 lin_interp32_fx( + const Word32 x, /* i : the value to be mapped */ + const Word32 x1, /* i : source range interval: low end */ + const Word32 y1, /* i : source range interval: high end */ + const Word32 x2, /* i : target range interval: low */ + const Word32 y2, /* i : target range interval: high */ + const Word16 flag_sat, /* i : flag to indicate whether to apply saturation */ + Word16 *Q_io /*i/o : i/o Q factor of the output*/ +); + +void v_addc_fx( + const Word32 x_fx[], /* i : Input vector */ + const Word32 c_fx, /* i : Constant */ + Word32 y_fx[], /* o : Output vector that contains c*x */ + const Word16 N /* i : Vector length */ +); + +void v_addc_fixed( + const Word32 x[], /* i : Input vector */ + const Word32 c, /* i : Constant */ + Word32 y[], /* o : Output vector that contains c*x */ + const Word16 N /* i : Vector length */ +); + +void v_min_fx( + const Word32 x1_fx[], /* i : Input vector 1 */ + Word16 *x1_q_fx, + const Word32 x2_fx[], /* i : Input vector 2 */ + Word16 *x2_q_fx, + Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ + Word16 *y_q_fx, + const Word16 N /* i : Vector length */ +); + +void v_mult_inc_fixed( + const Word32 x1_fx[], /* i : Input vector 1 */ + const Word16 x1_inc, /* i : Increment for input vector 1 */ + const Word32 x2_fx[], /* i : Input vector 2 */ + const Word16 x2_inc, /* i : Increment for input vector 1 */ + Word32 y_fx[], /* o : Output vector that contains vector 1 .* vector 2 */ + const Word16 y_inc, /* i : increment for vector y[i] */ + const Word16 N /* i : Vector length */ +); + +void v_sqrt_fx( + const Word32 x[], /* i : Input vector */ + Word16 exp[], + Word32 y[], /* o : Output vector that contains sqrt(x) */ + const Word16 N /* i : Vector length */ +); + +Word32 sumAbs_fx( + const Word32 *vec, /* i : input vector */ + const Word16 lvec /* i : length of input vector */ +); + +Word32 dot_product_cholesky_fx( + const Word32 *x, /* i : vector x */ + const Word32 *A, /* i : Cholesky matrix A */ + const Word16 N /* i : vector & matrix size */ +); +Word32 dot_product_cholesky_fixed( + const Word32 *x, /* i : vector x */ + const Word32 *A, /* i : Cholesky matrix A */ + const Word16 N, /* i : vector & matrix size */ + const Word16 exp_x, + const Word16 exp_A, + Word16 *exp_sum ); + +void v_mult_mat_fx( + Word32 *y_fx, /* o : the product x*A */ + Word16 *y_q_fx, + const Word32 *x_fx, /* i : vector x */ + Word16 *x_q_fx, + const Word32 *A_fx, /* i : matrix A */ + Word16 *A_q_fx, + const Word16 N, /* i : number of rows */ + const Word16 C /* i : number of columns */ +); +void v_mult_mat_fixed( + Word32 *y, /* o : the product x*A */ + const Word32 *x, /* i : vector x */ + const Word32 *A, /* i : matrix A */ + const Word16 Nr, /* i : number of rows */ + const Word16 Nc, /* i : number of columns */ + Word16 guardbits ); + +Word32 check_bounds_l( + const Word32 value, /* i : Input value */ + const Word32 low, /* i : Low limit */ + const Word32 high /* i : High limit */ +); + +Word16 check_bounds_s_fx( + const Word16 value, /* i : Input value */ + const Word16 low, /* i : Low limit */ + const Word16 high /* i : High limit */ +); + +ivas_error stereo_memory_enc_fx( + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 max_bwidth, /* i : maximum audio bandwidth */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 nchan_transport /* i : number transport chans */ + +); + +void stereo_switching_enc_fx( + CPE_ENC_HANDLE hCPE, /* i : CPE encoder structure */ + Word16 old_input_signal_pri[], /* i : old input signal of primary channel */ + const Word16 input_frame, /* i : input frame length */ + const Word16 q_inp ); + + +void stereo_td2dft_update_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const Word16 n, /* i : channel number Q0*/ + Word32 output_fx[], /* i/o: synthesis @internal Fs Q11*/ + Word32 synth_fx[], /* i/o: synthesis @output Fs Q11*/ + Word32 hb_synth_fx[], /* i/o: hb synthesis Q11*/ + const Word16 output_frame /* i : frame length Q0*/ +); + +void stereo_mdct2dft_update_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 output0_fx[], /* i/o: synthesis @internal Fs, ch0 Q11*/ + Word32 synth0_fx[] /* i/o: synthesis @output Fs, ch0 Q11*/ +); + +Word16 write_GR0( + BSTR_ENC_HANDLE hBstr, /* i/o: Encoder bitstream handle */ + const Word16 ind, /* i : bitstream index */ + const Word16 *in, /* i : data to be encoded */ + const Word16 len /* i : input data length */ +); + +void ivas_mct_core_dec( + MCT_DEC_HANDLE hMCT, /* i/o: MCT decoder structure */ + CPE_DEC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE decoder structure */ + const Word16 nCPE, /* i : number of CPEs */ + Word32 *signal_out_fx[], + Word16 q_x[MCT_MAX_CHANNELS] ); + +void ivas_qmetadata_to_dirac_fx( + const IVAS_QMETADATA_HANDLE hQMetaData, /* i : frame of MASA q_metadata */ + DIRAC_DEC_HANDLE hDirAC, /* i : DirAC decoder structure */ + MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ + SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + Word16 *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ +); + +Word16 masa_sq_fx( + const Word32 in, /* i : input value */ + const Word32 *threshold, /* i : partition */ + const Word16 cb_sz /* i : codebook size */ +); + +Word16 quantize_direction2D_fx( + Word32 phi, /* i : input azimuth value Q22 */ + const Word16 no_cw, /* i : number of bits */ + Word32 *phi_q, /* o : quantized azimuth value Q22 */ + UWord16 *index_phi, /* o : quantized azimuth index */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ +); + +Word32 companding_azimuth_fx( + const Word32 azi_fx, /* i : input azimuth value */ + const MC_LS_SETUP mc_format, /* i : input channel format */ + const Word16 theta_flag, /* i : zero/non zero elevation flag */ + const Word16 direction /* i : direction of companding (direct or inverse)*/ +); + +Word16 quantize_phi_fx( + Word32 phi, /* i : azimuth value */ + const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ + Word32 *phi_hat, /* o : quantized azimuth */ + const Word16 n /* i : azimuth codebook size */ +); + +Word32 deindex_elevation_fx( + UWord16 *id_th, /* i : input index */ + const Word16 no_bits, /* i : number of bits for the spherical grid */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ +); + +Word32 deindex_azimuth_fx( + Word16 id_phi, /* i : index */ + const Word16 no_bits, /* i : number of bits for the spherical grid */ + const Word16 id_th, /* i : elevation index */ + const Word16 remap, /* i : remapping flag */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ +); +void deindex_spherical_component_fx( + const UWord16 sph_idx, /* i : spherical index */ + Word32 *az_fx, /* o : decoded azimuth value */ + Word32 *el_fx, /* o : decoded elevation value */ + UWord16 *az_idx, /* o : azimuth index */ + UWord16 *el_idx, /* o : elevation index */ + const UWord16 no_bits, /* i : number of bits for the spherical grid */ + const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ +); + +void ivas_dirac_param_est_enc( + DIRAC_ENC_HANDLE hDirAC, + IVAS_QDIRECTION *q_direction, + const UWord8 useLowerRes, + Word32 *data_f_fx[], + Word32 **pp_fr_real_fx, + Word32 **pp_fr_imag_fx, + Word16 pp_fr_q, + const Word16 input_frame, + const IVAS_FORMAT ivas_format, + const Word16 hodirac_flag, + const Word16 nchan_fb_in, + Word16 *mono_frame_count, + Word16 *dirac_mono_flag ); + +ivas_error ivas_cldfb_dec_reconfig_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nchan_transport_old, /* i : number of TCs in previous frame */ + Word16 numCldfbAnalyses_old, /* i : number of CLDFB analysis instances in previous frame */ + const Word16 numCldfbSyntheses_old /* i : number of CLDFB synthesis instances in previous frame */ +); + +Word16 ivas_sba_get_order_fx( + const Word16 nb_channels, /* i : Number of ambisonic channels */ + const Word16 sba_planar /* i : SBA planar flag */ +); + +/*! r: Ambisonic (SBA) order used for analysis and coding */ +Word16 ivas_sba_get_analysis_order( + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ +); + +Word16 ivas_sba_get_nchan_metadata( + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +); + +void ivas_sba_get_spar_hoa_ch_ind( + const Word16 num_md_chs, /* i : number of MD channels */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + Word16 HOA_md_ind[IVAS_SPAR_MAX_CH] ); + +/*! r: flag indicating to code SPAR HOA MD for all bands */ +void ivas_sba_get_spar_hoa_md_flag( + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + Word16 *spar_hoa_md_flag, + Word16 *spar_hoa_dirac2spar_md_flag ); + +Word16 ivas_sba_remapTCs_fx( + Word32 *sba_data[], /* i/o: SBA signals */ + Decoder_Struct *st_ivas, /* i/o: decoder struct */ + const Word16 output_frame /* i : frame length */ +); + +void ivas_sba2mc_cldfb_fixed( + IVAS_OUTPUT_SETUP hInSetup, /* i : Format of input layout */ + Word32 RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb real part (Q_real) */ + Word32 ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part (Q_imag) */ + const Word16 nb_channels_out, /* i : nb of output channels */ + const Word16 nb_bands, /* i : nb of CLDFB bands to process */ + const Word16 nb_timeslots, /* i : number of time slots to process */ + const Word32 *hoa_dec_mtx /* i : HOA decoding mtx */ +); + +void ivas_dirac_config_bands_fx( + Word16 *band_grouping, /* o : band grouping */ + const Word16 nbands, /* i : number of bands */ + const Word16 max_band, /* i : maximal band index +1 */ + Word16 *dirac_to_spar_md_bands, /* o : mapping of DirAC parameter band index to SPAR FB band index */ + const Word8 useLowerBandRes, /* i : flag indicating lower band resolution for DirAC */ + const Word16 enc_param_start_band, /* i : band index of first DirAC parameter band */ + IVAS_FB_MIXER_HANDLE hFbMdft ); + +void ivas_dirac_dec_close_fx( + DIRAC_DEC_HANDLE *hDirAC_out ); + +void generate_masking_noise_lb_dirac_fx( + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + Word32 *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ + const Word16 nCldfbTs, /* i : number of CLDFB slots that will be rendered */ + const Word16 cna_flag /* i : CNA flag for LB and HB */ +); + +void generate_masking_noise_lb_dirac_fx( + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + Word32 *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ + const Word16 nCldfbTs, /* i : number of CLDFB slots that will be rendered */ + const Word16 cna_flag /* i : CNA flag for LB and HB */ +); + +void ivas_dirac_dec_close_fx( + DIRAC_DEC_HANDLE *hDirAC_out ); + +void ivas_dirac_dec_set_md_map( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nCldfbTs /* i : number of CLDFB time slots */ +); + +void computeDirectionVectors_fixed( + Word32 *intensity_real_x, + Word32 *intensity_real_y, + Word32 *intensity_real_z, + const Word16 enc_param_start_band, + const Word16 num_frequency_bands, + Word32 *direction_vector_x, /*Q30*/ + Word32 *direction_vector_y, /*Q30*/ + Word32 *direction_vector_z, /*Q30*/ + Word16 i_e /*Exponent of all the intensity buffers*/ ); + +void computeDirectionVectors_fx( + Word32 *intensity_real_x, + Word32 *intensity_real_y, + Word32 *intensity_real_z, + const Word16 enc_param_start_band, + const Word16 num_frequency_bands, + Word32 *direction_vector_x, + Word32 *direction_vector_y, + Word32 *direction_vector_z, + Word16 *q_factor ); + + +void computeDiffuseness_fx( + Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], + const Word32 *buffer_energy, + const Word16 num_freq_bands, + Word32 *diffuseness, + Word16 q_factor_intensity, + Word16 q_factor_energy, + Word16 *out_exp + +); + +void computeDiffuseness_fixed( + Word32 *buffer_intensity[DIRAC_NUM_DIMS][DIRAC_NO_COL_AVG_DIFF], + const Word32 *buffer_energy, + const Word16 num_freq_bands, + Word32 *diffuseness, + Word16 *q_factor_intensity, + Word16 *q_factor_energy, + Word16 *q_diffuseness ); + +void ivas_dirac_dec_get_response_fx( + const Word16 azimuth, + const Word16 elevation, + Word32 *response, + const Word16 ambisonics_order, + Word16 Q_out ); + +void calculate_hodirac_sector_parameters_fx( + DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ + Word32 RealBuffer_fx[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector (L+1)^2 x N_bins, real part */ + Word32 ImagBuffer_fx[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector, imaginary part */ + Word16 Qfac, /* i : Q-factor of signal vector */ + const Word32 beta_fx, /* i : forgetting factor for average filtering, Q30 */ + const Word16 *band_grouping, /* i : indices of band groups */ + const Word16 N_bands, /* i : number of bands (groups) */ + const Word16 enc_param_start_band, /* i : first band to process */ + Word32 *azi_fx, /* o : array of sector azimuth angles, flat Q23 */ + Word32 *ele_fx, /* o : array of sector elevation angles, flat Q23 */ + Word32 *diff_fx, /* o : array of sector diffuseness values, flat */ + Word16 *diff_exp, /* o : array of sector diffuseness exponents, flat */ + Word32 *ene_fx, /* o : array of sector energy values, flat */ + Word16 *ene_exp /* o : array of sector energy exponents, flat */ +); + +void ivas_mc_paramupmix_enc_fx( + Encoder_Struct *st_ivas, /* i/o: IVAS Encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: IVAS Metadata bitstream handle */ + Word32 *data_fx[], + const Word16 input_frame /* i : input frame length */ +); + +void ivas_mc_paramupmix_dec_render( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Word32 *input_fx[], /* i : core-coder transport channels */ + Word32 *output_fx[] /* i/o: synthesized core-coder transport channels */ +); + +Word16 ivas_param_mc_getNumTransportChannels( + const Word32 ivas_total_bitrate, /* i : IVAS total bitrate */ + const MC_LS_SETUP mc_ls_setup /* i : MC ls setup */ +); + +ivas_error ivas_param_mc_dec_open_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +ivas_error ivas_param_mc_dec_reconfig_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ +); + +void ivas_param_mc_dec_close_fx( + PARAM_MC_DEC_HANDLE *hParamMC_out /* i/o: Parametric MC decoder handle */ +); + +void ivas_param_mc_dec_digest_tc_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord8 nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + Word32 *transport_channels_f_fx[], + Word16 transport_f_e ); + +void ivas_param_mc_dec_render_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailable, /* o : number of CLDFB slots still to render */ + Word32 *output_f_fx[], /* o : rendered time signal */ + Word16 channel_active_fx[MAX_OUTPUT_CHANNELS] ); + +Word16 matrix_product_mant_exp_fx( + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 X_fx_e, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 Y_fx_e, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx, /* o : resulting matrix after the matrix multiplication */ + Word16 *Z_fx_e /* o : resulting matrix after the matrix multiplication */ +); + +Word16 matrix_product_fx( + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ +); + +Word16 matrix_product_q30_fx( + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx /* o : resulting matrix after the matrix multiplication */ +); + +Word16 matrix_product_mant_exp( + const Word32 *X_fx, /* i : left hand matrix */ + const Word16 *X_e, /* i : left hand matrix */ + const Word16 rowsX, /* i : number of rows of the left hand matrix */ + const Word16 colsX, /* i : number of columns of the left hand matrix */ + const Word16 transpX, /* i : flag indicating the transposition of the left hand matrix prior to the multiplication */ + const Word32 *Y_fx, /* i : right hand matrix */ + const Word16 *Y_e, /* i : right hand matrix */ + const Word16 rowsY, /* i : number of rows of the right hand matrix */ + const Word16 colsY, /* i : number of columns of the right hand matrix */ + const Word16 transpY, /* i : flag indicating the transposition of the right hand matrix prior to the multiplication */ + Word32 *Z_fx, /* o : resulting matrix after the matrix multiplication */ + Word16 *Z_e /* o : resulting matrix after the matrix multiplication */ +); + +void mat2svdMat_fx( + const Word32 *mat, /* i : matrix as column ordered vector Qx*/ + Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* o : matrix as two-dimensional arry Qx*/ + const Word16 nRows, /* i : number of rows of the matrix Q0*/ + const Word16 mCols, /* i : number of columns of the matrix Q0*/ + const Word16 transpose /* i : flag indication transposition Q0*/ +); + +void svdMat2mat_fx( + Word32 svdMat[MAX_OUTPUT_CHANNELS][MAX_OUTPUT_CHANNELS], /* i : matrix as two-dimensional arry Qx*/ + Word32 *mat, /* o : matrix as column ordered vector Qx*/ + const Word16 nRows, /* i : number of rows of the matrix Q0*/ + const Word16 mCols /* i : number of columns of the matrix Q0*/ +); + +Word16 computeMixingMatrices_fx( + const Word16 num_inputs, /* i : number of input channels */ + const Word16 num_outputs, /* i : number of output channels */ + const Word32 *Cx, /* i : input channel covariance matrix */ + Word16 Cx_e, + const Word32 *Cy, /* i : target covariance matrix */ + Word16 Cy_e, + const Word32 *Q, /* i : prototype matrix (usually a upmix matrix) */ + Word16 Q_fx_e, + const Word16 energy_compensation_flag, /* i : flag indicating that the energy compensation should be performed (i.e. no residual mixing matrix will follow) */ + const Word32 reg_Sx_fx, /* i : regularization factor for the input channel singular values */ + Word16 reg_Sx_e, + const Word32 reg_ghat_fx, /* i : regularization factor for the normalization matrix */ + Word16 reg_ghat_e, + Word32 *mixing_matrix_fx, /* o : resulting mixing matrix */ + Word16 *mixing_matrix_out_e, + Word32 *Cr_fx, /* o : residual covariance matrix */ + Word16 *Cr_e ); + +Word16 computeMixingMatricesResidual_fx( + const Word32 num_outputs, /* i : number of output channels */ + const Word32 *Cx_fx, /* i : vector containing the diagonal diffuse prototype covariance */ + const Word16 Cx_e, + const Word32 *Cy_fx, /* i : matrix containing the missing cov (Cr from computeMixingMatrices()) */ + const Word16 Cy_fx_e, + const Word32 reg_Sx_fx, /* i : regularization factor for the input channel singular values */ + const Word16 reg_Sx_e, + const Word32 reg_ghat_fx, /* i : regularization factor for the normalization matrix */ + const Word16 reg_ghat_e, + Word32 *mixing_matrix_fx, /* o : resulting residual mixing matrix */ + Word16 *mixing_matrix_ret_e ); + +Word16 svd_fx( + Word32 InputMatrix[][MAX_OUTPUT_CHANNELS], /* i : matrix to be decomposed (M) InputMatrix_e*/ + Word16 InputMatrix_e, + Word32 singularVectors_Left_fx[][MAX_OUTPUT_CHANNELS], /* o : left singular vectors (U) Q31*/ + Word32 singularValues_fx[MAX_OUTPUT_CHANNELS], /* o : singular values vector (S) singularValues_fx_e*/ + Word32 singularVectors_Right_fx[][MAX_OUTPUT_CHANNELS], /* o : right singular vectors (V) Q31*/ + Word16 singularValues_fx_e[MAX_OUTPUT_CHANNELS], + const Word16 nChannelsL, /* i : number of rows in the matrix to be decomposed Q0*/ + const Word16 nChannelsC /* i : number of columns in the matrix to be decomposed Q0*/ +); + +ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ + DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: hanlde for the covariance synthesis state */ + const Word16 max_band_decorr, /* i : uppermost frequency band where decorrelation is applied */ + const Word16 interp_length, /* i : length for interpolating the mixing matrices in time slots */ + const Word16 num_param_bands, /* i : number of parameter bands */ + const Word16 num_param_bands_residual, /* i : number of parameter bands with a residual mixing matrix (i.e. decorrelation */ + const Word16 nchan_in, /* i : number of input (transport) channels */ + const Word16 nchan_out, /* i : number of output channels */ + const Word32 *proto_matrix /* i : the prototype (upmix) matrix (only used if mode == 1) */ +); + +void ivas_dirac_dec_output_synthesis_get_interpolator_fx( + DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ + const UWord16 interp_length /* i : interpolator length */ +); + +void ivas_dirac_dec_output_synthesis_cov_init_fx( + DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: pointer to the state of the covariance synthesis */ + const Word16 nchan_in, /* i : number of input (tranport) channels */ + const Word16 nchan_out, /* i : number of output channels */ + const Word16 n_param_bands, /* i : number of total parameter bands */ + const Word16 n_param_bands_res /* i : number of parameter bands with a residual mixing matrix (i.e. decorrelation */ +); + +void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx( + Word32 *Cldfb_RealBuffer_in_fx, + Word32 *Cldfb_ImagBuffer_in_fx, + Word32 Cldfb_RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ + Word32 Cldfb_ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ + Word32 *mixing_matrix_fx[], /* i : parameter band wise mixing matrices (direct part) */ + Word16 *mixing_matrix_e, /* i : parameter band wise mixing matrices (direct part) */ + Word32 *mixing_matrix_res_fx[], /* i : parameter band wise mixing matrices (residual part) */ + Word16 *mixing_matrix_res_e, /* i : parameter band wise mixing matrices (residual part) */ + const UWord16 slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ + const UWord16 slot_idx_tot, /* i : time slot index for the current slot within the frame */ + const Word16 nX, /* i : number of input channels */ + const Word16 nY, /* i : number of output channels */ + PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ +); + +Word16 computeMixingMatricesISM_fx( + const Word16 num_inputs, + const Word16 num_responses, + const Word16 num_outputs, + const Word32 *responses_fx, + const Word16 responses_e, + const Word32 *ener_fx, + const Word16 ener_e, + const Word32 *Cx_diag_fx, + const Word16 Cx_diag_e, + const Word32 *Cy_diag_fx, + const Word16 Cy_diag_e, + const Word16 *Q_16fx, // Q15 + const Word16 energy_compensation_flag, + const Word32 reg_Sx_fx, + const Word32 reg_ghat_fx, + Word32 *mixing_matrix_fx, + Word16 *mixing_matrix_e ); + +ivas_error ivas_spar_enc_open_fx( + Encoder_Struct *st_ivas, /* i/o: IVAS encoder handle */ + const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ +); + +void ivas_spar_dec_close_fx( + SPAR_DEC_HANDLE *hSpar, /* i/o: SPAR decoder handle */ + const Word32 output_Fs, /* i : output sampling rate */ + const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ +); + +ivas_error ivas_sba_linear_renderer_fx( + Word32 *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 nchan_in, /* i : number of input ambisonics channels */ + const Word16 nchan_ism, /* i : number of objects */ + const AUDIO_CONFIG output_config, /* i : output audio configuration */ + const IVAS_OUTPUT_SETUP output_setup /* i : output format setup */ +); + +void ivas_sba_mix_matrix_determiner_fx( + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ + Word32 *output_fx[], /* i/o: transport/output audio channels */ + const Word16 bfi, /* i : BFI flag */ + const Word16 nchan_remapped, /* i : num channels after remapping of TCs */ + const Word16 output_frame, /* i : output frame length */ + const Word16 num_md_sub_frames, /* i : number of subframes in mixing matrix*/ + const Word16 Q_output /* i : Q of transport/output audio channels */ +); + +Word16 ivas_agc_enc_get_flag( + const Word16 nchan_transport /* i : number of transport channels */ +); + +ivas_error ivas_spar_agc_enc_open_fx( + ivas_agc_enc_state_t **hAgcEnc, /* i/o: SPAR AGC encoder handle */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 nchan_inp /* i : number of input channels */ +); + +void ivas_spar_agc_enc_close_fx( + ivas_agc_enc_state_t **hAgcEnc /* i/o: SPAR AGC encoder handle */ +); + +void ivas_agc_enc_process_fx( + ivas_agc_enc_state_t *hAgcEnc, /* i/o: AGC encoder handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ + Word32 **ppPcm_in, /* i : input audio channels */ + Word32 **ppPcm_out, /* o : output audio channels */ + const Word16 n_channels, /* i : number of channels */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + Word16 *q_ppPcm ); + +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 */ + const Word16 num_bands, /* i : number of bands */ + const Word16 dirac2spar_md_flag, + const Word16 enc_flag, + const Word16 pca_flag, + const Word16 agc_flag ); + +Word16 ivas_is_res_channel( + const Word16 ch, /* i : ch index in WYZX ordering */ + const Word16 nchan_transport /* i : number of transport channels (1-4) */ +); + +void ivas_spar_dec_agc_pca_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output[], /* i/o: input/output audio channels */ + const Word16 output_frame /* i : output frame length */ +); + +void ivas_spar_dec_set_render_map_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nCldfbTs /* i : number of CLDFB time slots */ +); + +void ivas_spar_dec_set_render_params_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const Word16 n_cldfb_slots /* i : number of cldfb slots in this frame */ +); + +void ivas_spar_dec_digest_tc_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 nCldfbSlots, /* i : number of CLDFB slots */ + const Word16 nSamplesForRendering /* i : number of samples provided */ +); + +void ivas_sba_dec_digest_tc_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const Word16 nCldfbSlots, /* i : number of CLDFB slots */ + const Word16 nSamplesForRendering /* i : number of samples provided */ +); +ivas_error ivas_sba_dec_render_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const UWord16 nSamplesAsked, /* i : number of CLDFB slots requested */ + UWord16 *nSamplesRendered, /* o : number of CLDFB slots rendered */ + UWord16 *nSamplesAvailableNext, /* o : number of CLDFB slots still to render */ + Word32 *output_fx[], /* o : rendered time signal Q11*/ + Word16 out_len /*Store the length of values in each channel*/ +); + +void ivas_spar_dec_upmixer_sf_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + Word32 *output_fx[], /* o : output audio channels */ + const Word16 nchan_internal, /* i : number of internal channels */ + Word16 out_len ); + +ivas_error ivas_spar_md_enc_open_fx( + ivas_spar_md_enc_state_t **hMdEnc_in, /* i/o: SPAR MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ +); + +void ivas_create_fullr_dmx_mat_fx( + Word32 pred_coeffs_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + Word16 q_pred_coeffs_re, + Word32 dm_fv_re[IVAS_SPAR_MAX_CH - 1][IVAS_MAX_NUM_BANDS], + Word16 q_dm_fv_re, + Word32 ***mixer_mat, + Word16 *q_mixer_mat, + const Word16 in_chans, + const Word16 start_band, + const Word16 end_band, + const Word16 active_w, + ivas_spar_md_com_cfg *hMdCfg ); + +void ivas_get_spar_md_from_dirac_fx( + Word32 azi_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], // Q22 + Word32 ele_dirac_fx[IVAS_MAX_NUM_BANDS][MAX_PARAM_SPATIAL_SUBFRAMES], // Q22 + Word32 diffuseness_fx[IVAS_MAX_NUM_BANDS], // Q30 + const Word16 n_ts, + Word32 ***mixer_mat_fx, + Word16 *q_mixer_mat_fx, + ivas_spar_md_t *hSpar_md, + ivas_spar_md_com_cfg *hSpar_md_cfg, + const Word16 start_band, + const Word16 end_band, + const Word16 order, + const Word16 dtx_vad, + Word32 Wscale_d[IVAS_MAX_NUM_BANDS], // Q29 + const UWord8 useLowerRes, + const Word16 active_w_vlbr, + const Word16 dyn_active_w_flag ); + +ivas_error ivas_spar_md_enc_process_fx( + ivas_spar_md_enc_state_t *hMdEnc, /* i/o: SPAR MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + Word32 *cov_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 *cov_real_q[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word32 *cov_dtx_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 *cov_dtx_real_q[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ + const Word16 dtx_vad, + const Word16 nchan_inp, + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH], /* i : prior mixer_matrix */ + const Word16 dyn_active_w_flag, /* i : flag to indicate dynamic active W */ + const Word16 dirac_mono_flag /* i : flag to indicate mono only mode in SBA */ +); + +Word16 ivas_get_spar_dec_md_num_subframes( + const Word16 sba_order, /* i : Ambisonic (SBA) order */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word32 ivas_last_active_brate /* i : IVAS last active bitrate */ +); + +void ivas_spar_get_parameters_fx( + SPAR_DEC_HANDLE hSpar, /* i/o: SPAR decoder handle */ + const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ + const Word16 ts, /* i : time slot index */ + const Word16 num_ch_out, /* i : number of channels out */ + const Word16 num_ch_in, /* i : number of channels in */ + const Word16 num_spar_bands, /* i : number of SPAR bands */ + Word32 par_mat_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS] /* o : mixing matrix */ +); + +void ivas_spar_to_dirac_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const Word16 dtx_vad, /* i : DTX frame flag */ + const Word16 num_bands_out, /* i : number of output bands */ + const Word16 bw, /* i : band joining factor */ + const Word16 dyn_active_w_flag /* i : dynamic active W flag */ +); + +void ivas_spar_dec_gen_umx_mat_fx( + ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD decoder handle */ + const Word16 nchan_transport, /* i : number of transport channels */ + const Word16 num_bands_out, /* i : number of output bands */ + const Word16 bfi, /* i : bad frame indicator */ + const Word16 num_md_sub_frames ); + +ivas_error ivas_spar_covar_enc_open_fx( + ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ + ivas_filterbank_t *pFb, /* i/o: FB handle */ + const Word32 input_Fs, /* i : input sampling rate */ + const Word16 nchan_inp, /* i : number of input channels */ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +); + +void ivas_spar_covar_enc_close_fx( + ivas_enc_cov_handler_state_t **hCovEnc, /* i/o: SPAR Covar. encoder handle */ + const Word16 nchan_inp /* i : number of input channels */ +); + +void ivas_enc_cov_handler_process_fx( + ivas_enc_cov_handler_state_t *hCovEnc, /* i/o: SPAR Covar. encoder handle */ + Word32 **ppIn_FR_real, + Word32 **ppIn_FR_imag, + Word16 q_ppIn_FR, + Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 *q_cov_real[IVAS_SPAR_MAX_CH], + Word32 *cov_dtx_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + Word16 *q_cov_dtx_real[IVAS_SPAR_MAX_CH], + ivas_filterbank_t *pFb, /* i/o: FB handle */ + const Word16 start_band, + const Word16 end_band, + const Word16 num_ch, + const Word16 dtx_vad, + const Word16 transient_det[2], + const Word16 HOA_md_ind[IVAS_SPAR_MAX_CH], + Word16 *res_ind, + const Word16 *remix_order, + Word16 *dyn_active_w_flag, + const Word16 nchan_transport, + const Word16 is_sba ); + +ivas_error ivas_spar_covar_smooth_enc_open_fx( + ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. smoothing handle */ + const ivas_cov_smooth_cfg_t *cov_smooth_cfg, /* i : SPAR config. handle */ + ivas_filterbank_t *pFb, /* i/o: FB handle */ + const Word16 nchan_inp, /* i : number of input channels */ + const COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ +); + +void ivas_spar_covar_smooth_enc_close_fx( + ivas_cov_smooth_state_t **hCovState, /* i/o: SPAR Covar. encoder handle */ + const Word16 nchan_inp /* i : number of input channels */ +); + +void ivas_cov_smooth_process_fx( + ivas_cov_smooth_state_t *hCovState, /* i/o: Covariance state handle */ + Word32 *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], + ivas_filterbank_t *pFb, /* i/o: FB handle */ + const Word16 start_band, + const Word16 end_band, + const Word16 num_ch, + const Word16 transient_det[2], + Word16 *q_cov[IVAS_SPAR_MAX_CH] ); + +void ivas_pca_enc_fx( + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + PCA_ENC_STATE *hPCA, /* i : PCA encoder structure */ + BSTR_ENC_HANDLE hMetaData, /* i/o: MetaData handle */ + Word32 *data_f[8], /* i : input/transformed audio channels Q11 */ + const Word16 input_frame, /* i : input frame length */ + const Word16 n_channels /* i : number of channels */ +); + +void cov_subfr_fx( + Word32 **ptr_sig_fx, // Q11 + Word64 *r_fx_64, // Q11 + const Word16 n_channels, + const Word16 len ); + +void ivas_pca_read_bits_fx( + Decoder_State *st0, /* i/o: decoder state structure - for bitstream handling*/ + PCA_DEC_STATE *hPCA /* i/o: PCA encoder structure */ +); + +void ivas_pca_dec_init_fx( + PCA_DEC_STATE *hPCA /* i/o: PCA decoder structure */ +); + +void ivas_pca_dec_fx( + PCA_DEC_STATE *hPCA, /* i/o: PCA decoder structure */ + const Word16 output_frame, /* i : output frame length */ + const Word16 n_channels, /* i : number of channels */ + const Word32 ivas_total_brate, /* i : IVAS total bitrate */ + const Word32 last_ivas_total_brate, /* i : last IVAS total bitrate */ + const Word16 bfi, /* i : bad frame indicator */ + Word32 *pcm_out[] /* o : output audio channels */ +); + +void eye_matrix_fx( + Word16 *mat, + const Word16 n, + const Word16 d ); + +void eye_matrix_fx32( + Word32 *mat, // Q + const Word16 n, + const Word32 d ); // Q + +void eig_qr_fx( + const Word32 *A_fx, // A_q + Word16 A_q, + const Word16 num_iter, + Word32 *EV_fx, // Q31 + Word32 *Vals_fx, // A_q + const Word16 n ); + +void exhst_4x4_fx( + Word16 *cost_mtx, // Q + Word16 *path, + const Word16 maximize ); + +Word16 mat_det4_fx( + const Word16 *m // Q15 +); + +void mat2dquat_fx( + const Word16 *a, // Q15 + Word16 *ql, // Q15 + Word16 *qr // Q15 +); + +void dquat2mat_fx( + const Word16 *ql, + const Word16 *qr, + Word16 *m ); + +void quat_shortestpath_fx( + const Word16 *q00, + Word16 *q01, + const Word16 *q10, + Word16 *q11 ); + +void pca_interp_preproc_fx( + const Word16 *prev_ql, + const Word16 *prev_qr, + const Word16 *ql, + const Word16 *qr, + const Word16 len, + Word16 *ql_interp, + Word16 *qr_interp ); + +void pca_dec_s3_fx( + const Word32 index, + Word16 *q ); + +void ivas_spar_huff_coeffs_com_init( + ivas_huff_coeffs_t *pHuff_coeffs, + ivas_spar_md_com_cfg *pSpar_cfg, + const Word16 table_idx, + const Word16 enc_dec ); + +void ivas_spar_arith_coeffs_com_init( + ivas_arith_coeffs_t *pArith_coeffs, + ivas_spar_md_com_cfg *pSpar_cfg, + const Word16 table_idx, + const Word16 enc_dec ); + +void ivas_ari_start_decoding_14bits_ext_1_lfe( + Decoder_State *st, + Tastat *s, + Word16 *extra_bits_read ); + +UWord16 ivas_ari_decode_14bits_bit_ext_1_lfe( + Decoder_State *st, + Tastat *s, + const UWord16 *cum_freq, + Word16 *extra_bits_read ); + +void ivas_ari_done_decoding_14bits_ext_1_lfe( + Decoder_State *st, + const Word16 extra_bits_read ); + +Word16 quantize_phi_fx( + Word32 phi, /* i : azimuth value */ + const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ + Word32 *phi_hat, /* o : quantized azimuth */ + const Word16 n /* i : azimuth codebook size */ +); + +Word16 quantize_phi_enc_fx( + Word32 phi, /* i : azimuth value */ + const Word16 flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ + Word32 *phi_hat, /* o : quantized azimuth */ + const Word16 n /* i : azimuth codebook size */ +); + +Word16 ivas_spar_chk_zero_coefs_fx( + Decoder_Struct *st_ivas /* i/o: IVAS decoder handle */ +); + +void pca_enc_s3_fx( + Word16 *q, // Q15 + Word32 *index ); + +void ivas_spar_get_uniform_quant_strat_fx( + ivas_spar_md_com_cfg *pSpar_md_com_cfg, + const Word16 table_idx ); + +void ivas_lfe_lpf_select_filt_coeff_fx( + const Word32 sampling_rate, /* i : sampling rate */ + const Word16 order, /* i : filter order */ + const Word32 **ppFilt_coeff_fx, /* o : filter coefficients */ + const Word16 **ppFilt_coeff_e /* o : exponents of filter coefficients */ +); + +void ivas_filters_init_fx( + ivas_filters_process_state_t *filter_state, /* i/o: filter state handle */ + const Word32 *filt_coeff, /* i : filter coefficients */ + const Word16 *filt_coeff_e, /* i : exponents of filter coefficients */ + const Word16 order /* i : filter order */ +); + +void ivas_decision_matrix_enc_fx( + Encoder_State *st, /* i : encoder state structure */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 fft_buff[], /* i : FFT buffer */ + const Word32 enerBuffer[], /* i : energy buffer */ + Word16 enerBuffer_exp, + const Word16 last_element_mode /* i : last element mode */ +); + +void stereo_dft_dec_sid_coh_fx( + Decoder_State *st, /* i/o: decoder state structure */ + const Word16 nbands, /* i : number of DFT stereo bands Q0*/ + Word16 *coh, /* i/o: coherence Q15*/ + Word16 *nb_bits /* i/o: number of bits read Q0*/ +); + +void stereo_tca_init_enc_fx( + STEREO_TCA_ENC_HANDLE hStereoTCA, /* i/o: Stereo ICA handle */ + const Word32 input_Fs /* i : input sampling frequency */ +); + +void stereo_tca_dec_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *synth[CPE_CHANNELS], /* i/o: output synth qsynth*/ + const Word16 output_frame /* i : length of a frame per channel Q0*/ +); + +void stereo_tca_scale_R_channel_fx( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + Word32 *output_fx, /* i/o: output synthesis, R channel q_out*/ + const Word16 output_frame /* i : frame length Q0*/ +); + +void adjustTargetSignal_fx( + Word32 *target_fx, + const Word16 prevShift, + const Word16 currShift, + const Word16 L_shift_adapt, + const Word16 method ); + +void stereo_icBWE_init_enc_fx( + STEREO_ICBWE_ENC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ +); + +void stereo_classifier_init_fx( + STEREO_CLASSIF_HANDLE hStereoClassif /* i/o: stereo classifier structure */ +); + +void stereo_td_init_dec_fx( + STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ + const Word16 last_element_mode /* i : last element mode Q0*/ +); + +void initMdctStereoEncData_fx( + STEREO_MDCT_ENC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const Word16 element_mode, /* i : element mode */ + const Word32 element_brate, /* i : element bitrate */ + const Word16 bwidth, /* i : bandwidth */ + const Word16 igf, /* i : flag indicating IGF activity */ + const H_IGF_GRID hIgfGrid, /* i : IGF grid setup */ + const Word16 mem_init /* i : initialize memory after malloc */ +); + +void deindex_sph_idx_fx( + const UWord16 sphIndex, /* i : Spherical index */ + const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ + Word32 *theta_fx, /* o : Elevation */ + Word32 *phi_fx /* o : Azimuth */ +); + +ivas_error ivas_dirac_enc_open_fx( + Encoder_Struct *st_ivas /* i/o: IVAS encoder handle */ +); + +void ivas_dirac_enc_close_fx( + DIRAC_ENC_HANDLE *hDirAC, /* i/o: encoder DirAC handle */ + const Word32 input_Fs /* i : input sampling_rate */ +); + +ivas_error ivas_dirac_enc_fx( + DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ + BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ + Word32 *data_f[], /* i/o: SBA channels */ + Word32 **ppIn_FR_real, /* o : real freq domain values */ + Word32 **ppIn_FR_imag, /* o : imag freq domain values */ + Word16 pp_fr_q, + const Word16 input_frame, /* i : input frame length */ + const Word16 dtx_vad, /* i : DTX vad flag */ + const IVAS_FORMAT ivas_format, /* i : ivas format */ + const Word16 hodirac_flag /* i : hodirac flag */ +); + +ivas_error ivas_spar_md_enc_init_fx( + ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + const Word16 sba_order /* i : Ambisonic (SBA) order */ +); + +void ivas_spar_get_cldfb_gains_fx( + SPAR_DEC_HANDLE hSpar, + HANDLE_CLDFB_FILTER_BANK cldfbAnaDec0, + HANDLE_CLDFB_FILTER_BANK cldfbSynDec0, + const DECODER_CONFIG_HANDLE hDecoderConfig ); + + #endif diff --git a/lib_com/ivas_qmetadata_com.c b/lib_com/ivas_qmetadata_com.c index 552adb118..88821d0b3 100644 --- a/lib_com/ivas_qmetadata_com.c +++ b/lib_com/ivas_qmetadata_com.c @@ -990,25 +990,26 @@ void invdct4_transform( } #else void invdct4_transform_fx( - Word32 *v_fx, /* i : input vector */ - UWord8 *invdct_v, /* o : inverse transformed vector */ + Word32 *v_fx, /* i : input vector q */ + UWord8 *invdct_v, /* o : inverse transformed vector */ Word16 q ) { Word32 a_fx, b_fx, c_fx, d_fx; Word16 i; Word32 f_invdct_v_fx[4]; - a_fx = L_add( v_fx[0], v_fx[2] ); - b_fx = L_sub( v_fx[0], v_fx[2] ); - c_fx = L_shl( L_add( Mpy_32_32( 1402911360, v_fx[1] ), Mpy_32_32( 581104896, v_fx[3] ) ), Q31 - Q30 ); - d_fx = L_shl( L_sub( Mpy_32_32( 581104896, v_fx[1] ), Mpy_32_32( 1402911360, v_fx[3] ) ), Q31 - Q30 ); - f_invdct_v_fx[0] = L_shl( L_add( a_fx, c_fx ), 7 ); + a_fx = L_add( v_fx[0], v_fx[2] ); // q + b_fx = L_sub( v_fx[0], v_fx[2] ); // q + // 1.306562964876376f * 2 ^ 30 -> 1402911360, 0.541196100146198f * 2 ^ 30 -> 581104896 + c_fx = L_shl( L_add( Mpy_32_32( 1402911360, v_fx[1] ), Mpy_32_32( 581104896, v_fx[3] ) ), Q31 - Q30 ); // q + d_fx = L_shl( L_sub( Mpy_32_32( 581104896, v_fx[1] ), Mpy_32_32( 1402911360, v_fx[3] ) ), Q31 - Q30 ); // q + f_invdct_v_fx[0] = L_shl( L_add( a_fx, c_fx ), 7 ); // q move32(); - f_invdct_v_fx[1] = L_shl( L_add( b_fx, d_fx ), 7 ); + f_invdct_v_fx[1] = L_shl( L_add( b_fx, d_fx ), 7 ); // q move32(); - f_invdct_v_fx[2] = L_shl( L_sub( b_fx, d_fx ), 7 ); + f_invdct_v_fx[2] = L_shl( L_sub( b_fx, d_fx ), 7 ); // q move32(); - f_invdct_v_fx[3] = L_shl( L_sub( a_fx, c_fx ), 7 ); + f_invdct_v_fx[3] = L_shl( L_sub( a_fx, c_fx ), 7 ); // q move32(); FOR( i = 0; i < 4; i++ ) @@ -1022,10 +1023,10 @@ void invdct4_transform_fx( { IF( GT_32( f_invdct_v_fx[i], L_shl( 255, q ) ) ) { - f_invdct_v_fx[i] = L_shl( 255, q ); + f_invdct_v_fx[i] = L_shl( 255, q ); // q move32(); } - invdct_v[i] = (UWord8) L_shr( f_invdct_v_fx[i], q ); + invdct_v[i] = (UWord8) L_shr( f_invdct_v_fx[i], q ); // Q0 move16(); } } @@ -1180,16 +1181,17 @@ void ivas_qmetadata_azimuth_elevation_to_direction_vector( } #else void ivas_qmetadata_azimuth_elevation_to_direction_vector_fx( - const Word32 az, /* i : azimuth Q22 */ - const Word32 el, /* i : elevation Q22 */ - Word32 *dv /* o : direction vector */ + const Word32 az, /* i : azimuth Q22 */ + const Word32 el, /* i : elevation Q22 */ + Word32 *dv /* o : direction vector Q30 */ ) { Word16 radius_length; Word16 elevation_fx, azimuth_fx; - elevation_fx = extract_l( L_shr( Mpy_32_32( el, 5965232 ), 7 ) ); - azimuth_fx = extract_l( L_shr( Mpy_32_32( az, 5965232 ), 7 ) ); + // (2 ^ 31 - 1) / 360 -> 5965232 + elevation_fx = extract_l( L_shr( Mpy_32_32( el, ONE_BY_360_Q31 ), 7 ) ); // ( ( Q22 + Q31 - Q31 ) - Q7 ) -> Q15 + azimuth_fx = extract_l( L_shr( Mpy_32_32( az, ONE_BY_360_Q31 ), 7 ) ); // ( ( Q22 + Q31 - Q31 ) - Q7 ) -> Q15 dv[2] = L_shl( getSineWord16R2( elevation_fx ), Q15 ); /* Q30 */ move32(); @@ -1226,10 +1228,10 @@ void ivas_qmetadata_direction_vector_to_azimuth_elevation( #ifdef IVAS_FLOAT_FIXED void ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( - const Word32 *dv, /* i : direction vector */ + const Word32 *dv, /* i : direction vector dv_q */ const Word16 dv_q, - Word32 *az, /* o : azimuth */ - Word32 *el /* o : elevation */ + Word32 *az, /* o : azimuth Q22 */ + Word32 *el /* o : elevation Q22 */ ) { /* note: dv does not need to have unit L_2 norm, because the conversion is scale invariant */ @@ -1237,9 +1239,11 @@ void ivas_qmetadata_direction_vector_to_azimuth_elevation_fx( Word16 e_tmp; L_tmp = L_add( Mpy_32_32( dv[0], dv[0] ), Mpy_32_32( dv[1], dv[1] ) ); /* 2 * dv_q - 31 */ e_tmp = shl( sub( 31, dv_q ), 1 ); - L_tmp = Sqrt32( L_tmp, &e_tmp ); + L_tmp = Sqrt32( L_tmp, &e_tmp ); // e_tmp + // 29335 -> 180 / PI in Q9 *el = L_mult0( BASOP_util_atan2( dv[2], L_tmp, sub( sub( 31, dv_q ), e_tmp ) ), 29335 ); /* Q22 */ move32(); + // 29335 -> 180 / PI in Q9 *az = L_mult0( BASOP_util_atan2( dv[1], dv[0], 0 ), 29335 ); /* Q22 */ move32(); return; diff --git a/lib_com/ivas_qspherical_com.c b/lib_com/ivas_qspherical_com.c index 4c15510fe..52cfb9323 100644 --- a/lib_com/ivas_qspherical_com.c +++ b/lib_com/ivas_qspherical_com.c @@ -441,9 +441,9 @@ Word16 quantize_phi_fx( Word32 inv_delta_phi_fx; Word32 temp_res; - delta_phi_fx = delta_phi_val[n]; + delta_phi_fx = delta_phi_val[n]; // Q22 move32(); - inv_delta_phi_fx = inv_delta_phi_val[n]; + inv_delta_phi_fx = inv_delta_phi_val[n]; // Q31 move32(); IF( EQ_16( n, 1 ) ) { @@ -465,8 +465,8 @@ Word16 quantize_phi_fx( move32(); } - temp_res = Mpy_32_32( L_sub( L_sub( phi, DEGREE_180_Q_22 ), dd_fx ), inv_delta_phi_fx ); - id_phi = round_fx( L_shr( temp_res, Q22 - Q16 ) ); + temp_res = Mpy_32_32( L_sub( L_sub( phi, DEGREE_180_Q_22 ), dd_fx ), inv_delta_phi_fx ); // Q22 + Q31 - Q31 -> Q22 + id_phi = round_fx( L_shr( temp_res, Q22 - Q16 ) ); // Q0 assert( L_sub( L_abs( temp_res ), abs( id_phi ) * ONE_IN_Q22 ) <= ONE_IN_Q21 ); @@ -497,7 +497,7 @@ ELSE } } -*phi_hat = L_add_sat( L_add_sat( ( id_phi * delta_phi_fx ), dd_fx ), DEGREE_180_Q_22 ); +*phi_hat = L_add_sat( L_add_sat( imult3216( delta_phi_fx, id_phi ), dd_fx ), DEGREE_180_Q_22 ); // Q22 move32(); id_phi = add( id_phi, shr( n, 1 ) ); @@ -676,8 +676,8 @@ Word32 companding_azimuth_fx( const Word16 direction /* i : direction of companding (direct or inverse)*/ ) { - const Word16 pointsA[] = { 0, 60, 110, 150, 180, 0, 50, 90, 150, 180, 0, 30, 80, 150, 180 }; - const Word16 pointsB[] = { 0, 90, 110, 170, 180, 0, 90, 110, 170, 180, 0, 10, 100, 170, 180 }; + const Word16 pointsA[] = { 0, 60, 110, 150, 180, 0, 50, 90, 150, 180, 0, 30, 80, 150, 180 }; // Q0 + const Word16 pointsB[] = { 0, 90, 110, 170, 180, 0, 90, 110, 170, 180, 0, 10, 100, 170, 180 }; // Q0 const Word16 *pA; const Word32 pointsA_fx[] = { 0, 251658240, 461373440, 629145600, 754974720, 0, 209715200, 377487360, 629145600, 754974720, 0, 125829120, 335544320, 629145600, 754974720 }; // q=22 const Word32 pointsB_fx[] = { 0, 377487360, 461373440, 713031680, 754974720, 0, 377487360, 461373440, 713031680, 754974720, 0, 41943040, 419430400, 713031680, 754974720 }; // q=22 @@ -806,38 +806,46 @@ Word32 companding_azimuth_fx( not_done = 0; move16(); /* calculate companding */ - comp_azi_fx = Mpy_32_32( L_sub( pB_fx[i + 1], pB_fx[i] ), L_sub( abs_azi_fx, pA_fx[i] ) ); + comp_azi_fx = Mpy_32_32( L_sub( pB_fx[i + 1], pB_fx[i] ), L_sub( abs_azi_fx, pA_fx[i] ) ); // ( Q22 + Q22 - Q31 ) -> Q13 SWITCH( sub( pA[i + 1], pA[i] ) ) { case 10: - comp_azi_fx = Mpy_32_32( comp_azi_fx, 214748364 ); + // Q13 + Q31 - Q31 -> Q13 + comp_azi_fx = Mpy_32_32( comp_azi_fx, 214748364 ); // 1 / 10 in 2 ^ 31 BREAK; case 20: - comp_azi_fx = Mpy_32_32( comp_azi_fx, 107374182 ); + // Q13 + Q31 - Q31 -> Q13 + comp_azi_fx = Mpy_32_32( comp_azi_fx, 107374182 ); // 1 / 20 in 2 ^ 31 BREAK; case 30: - comp_azi_fx = Mpy_32_32( comp_azi_fx, 71582788 ); + // Q13 + Q31 - Q31 -> Q13 + comp_azi_fx = Mpy_32_32( comp_azi_fx, 71582788 ); // 1 / 30 in 2 ^ 31 BREAK; case 40: - comp_azi_fx = Mpy_32_32( comp_azi_fx, 53687091 ); + // Q13 + Q31 - Q31 -> Q13 + comp_azi_fx = Mpy_32_32( comp_azi_fx, 53687091 ); // 1 / 40 in 2 ^ 31 BREAK; case 50: - comp_azi_fx = Mpy_32_32( comp_azi_fx, 42949672 ); + // Q13 + Q31 - Q31 -> Q13 + comp_azi_fx = Mpy_32_32( comp_azi_fx, 42949672 ); // 1 / 50 in 2 ^ 31 BREAK; case 60: - comp_azi_fx = Mpy_32_32( comp_azi_fx, 35791394 ); + // Q13 + Q31 - Q31 -> Q13 + comp_azi_fx = Mpy_32_32( comp_azi_fx, 35791394 ); // 1 / 60 in 2 ^ 31 BREAK; case 70: - comp_azi_fx = Mpy_32_32( comp_azi_fx, 30678337 ); + // Q13 + Q31 - Q31 -> Q13 + comp_azi_fx = Mpy_32_32( comp_azi_fx, 30678337 ); // 1 / 70 in 2 ^ 31 BREAK; case 90: - comp_azi_fx = Mpy_32_32( comp_azi_fx, 23860929 ); + // Q13 + Q31 - Q31 -> Q13 + comp_azi_fx = Mpy_32_32( comp_azi_fx, 23860929 ); // 1 / 90 in 2 ^ 31 BREAK; default: assert( 0 ); BREAK; } - comp_azi_fx = L_add( pB_fx[i], L_shl( comp_azi_fx, 31 - 22 ) ); + comp_azi_fx = L_add( pB_fx[i], L_shl( comp_azi_fx, Q22 - Q13 ) ); // Q22 // comp_azi = pB[i] + ( pB[i + 1] - pB[i] ) / ( pA[i + 1] - pA[i] ) * ( abs_azi - pA[i] ); } ELSE @@ -848,16 +856,16 @@ Word32 companding_azimuth_fx( IF( azi_fx < 0 ) { - comp_azi_fx = L_negate( comp_azi_fx ); + comp_azi_fx = L_negate( comp_azi_fx ); // Q22 } IF( EQ_16( not_done, 1 ) ) { - comp_azi_fx = azi_fx; + comp_azi_fx = azi_fx; // Q22 move32(); } - return comp_azi_fx; + return comp_azi_fx; // Q22 } #endif @@ -926,7 +934,7 @@ Word16 quantize_phi_chan_lbr_fx( IF( phi < 0 && id_phi > 0 ) { id_phi = sub( shl( id_phi, 1 ), 1 ); - *phi_hat = L_negate( *phi_hat ); + *phi_hat = L_negate( *phi_hat ); // Q22 move32(); } ELSE @@ -1038,8 +1046,8 @@ Word16 quantize_phi_chan_compand_fx( delta_phi = BASOP_Util_Divide3232_Scale_cadence( 360, n, &tmp_e ); delta_phi = L_shr( delta_phi, sub( 9, tmp_e ) ); // Q22 // id_phi = (int16_t) round_f( ( phi / (float) delta_phi ) ); - id_phi = BASOP_Util_Divide3232_Scale( phi, delta_phi, &tmp_e ); - id_phi = shr( id_phi, sub( 15, tmp_e ) ); + id_phi = BASOP_Util_Divide3232_Scale( phi, delta_phi, &tmp_e ); // Q15 + id_phi = shr( id_phi, sub( 15, tmp_e ) ); // Q0 IF( add( id_phi, shr( n, 1 ) ) < 0 ) { @@ -1066,14 +1074,14 @@ ELSE } } //*phi_hat = id_phi * delta_phi; -*phi_hat = imult3216( delta_phi, id_phi ); +*phi_hat = imult3216( delta_phi, id_phi ); // Q22 move32(); // id_phi += ( n >> 1 ); id_phi = add( id_phi, shr( n, 1 ) ); -*phi_hat = L_add( companding_azimuth_fx( *phi_hat, mc_format, theta_flag, -1 ), DEGREE_180_Q_22 ); +*phi_hat = L_add( companding_azimuth_fx( *phi_hat, mc_format, theta_flag, -1 ), DEGREE_180_Q_22 ); // Q22 move32(); return id_phi; diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 9f08e3dfe..805900f8f 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -58,13 +58,13 @@ const int32_t ivas_brate_tbl[SIZE_IVAS_BRATE_TBL] = *------------------------------------------------------------------------*/ /*4xERB scale: max of 14 bands*/ -const int16_t dft_band_limits_erb4[STEREO_DFT_ERB4_BANDS] = +const Word16 dft_band_limits_erb4[STEREO_DFT_ERB4_BANDS] = { 1, 3, 5, 10, 18, 26, 41, 56, 84, 132, 214, 342, 470, 601 }; /*8xERB scale: max of 8 bands*/ -const int16_t dft_band_limits_erb8[STEREO_DFT_ERB8_BANDS] = +const Word16 dft_band_limits_erb8[STEREO_DFT_ERB8_BANDS] = { 1, 5, 18, 41, 84, 214, 470, 601 }; @@ -76,20 +76,21 @@ const float dft_res_cod_alpha[STEREO_DFT_BAND_MAX] = }; #endif -const int16_t dft_band_ipd[3][4] = +const Word16 dft_band_ipd[3][4] = { {0,8,10,13}, {0,5,6,8}, {0,2,3,4} }; -const int16_t dft_band_res_cod[3][4] = +const Word16 dft_band_res_cod[3][4] = { {0,8,10,11}, {0,5,6,7}, {0,5,6,7} }; +// Q31 const Word32 dft_res_gains_q_Q31[][2] = { /* quantization points for joint quantization of prediction gain and residual energy */ @@ -501,17 +502,17 @@ const float dft_trigo_48k[STEREO_DFT_N_MAX_ENC / 4 + 1] = }; /* tables for adaptive Golomb-Rice coding of DFT stereo parameters */ -const int16_t dft_code_itd[] = +const Word16 dft_code_itd[] = { 0, 3, 4, 13, 8, 9, 12, 5, 10, 44, 23, 60, 45, 31, 235, 59, 28, 61, 234, 116 }; -const int16_t dft_len_itd[] = +const Word16 dft_len_itd[] = { 2, 3, 4, 4, 4, 4, 4, 4, 4, 6, 5, 6, 6, 5, 8, 6, 5, 6, 8, 7 }; -const int16_t dft_maps_rpg[] = +const Word16 dft_maps_rpg[] = { 0, 1, 2, 3, 4, 5, 6, 7, 2, 0, 1, 3, 4, 5, 6, 7, @@ -524,7 +525,7 @@ const int16_t dft_maps_rpg[] = 6, 5, 4, 3, 1, 0, 2, 7, }; -const int16_t dft_maps_sg[NO_SYMB_GR_SIDE_G * NO_SYMB_GR_SIDE_G] = +const Word16 dft_maps_sg[NO_SYMB_GR_SIDE_G * NO_SYMB_GR_SIDE_G] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, @@ -565,7 +566,7 @@ const int16_t dft_maps_sg[NO_SYMB_GR_SIDE_G * NO_SYMB_GR_SIDE_G] = *------------------------------------------------------------------------*/ /* Create separate tables for cumulative frequency and symbol frequency */ -const uint16_t cum_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][1 + RANGE_N_SYMBOLS] = +const UWord16 cum_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][1 + RANGE_N_SYMBOLS] = { { 0,16,47,153,241,269,325,468,591,674,798,912,1017,1082,1183,1277,1364,16384 }, { 0,7401,7844,7886,7899,12065,12718,12790,12805,14099,14476,14533,14549,15058,15264,15299,15310,16384 }, @@ -633,7 +634,7 @@ const uint16_t cum_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][1 + RANGE_N_SYMBOLS] { 0,6720,8878,9325,9467,11564,13248,13744,13929,14384,14880,15087,15167,15311,15488,15569,15607,16384 }, }; -const uint16_t sym_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][RANGE_N_SYMBOLS] = +const UWord16 sym_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][RANGE_N_SYMBOLS] = { { 16,31,106,88,28,56,143,123,83,124,114,105,65,101,94,87,15020 }, { 7401,443,42,13,4166,653,72,15,1294,377,57,16,509,206,35,11,1074 }, @@ -707,7 +708,7 @@ const uint16_t sym_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][RANGE_N_SYMBOLS] = *------------------------------------------------------------------------*/ /* table with round(ECSQ_PROB_TOTAL / index) for entropy coding, with i in {1, .., ECSQ_SEGMENT_SIZE} */ -const uint16_t ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE] = +const UWord16 ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE] = { 0, 16384, 8192, 5461, 4096, 3277, 2731, 2341, 2048 }; @@ -792,7 +793,7 @@ const float tdm_den_ratio_tabl[TDM_NQ+1] = /* 1.0f/(2*LR_ratio*LR_ratio-2*LR_ra 1.2088f, 1.1429f, 1.0902f, 1.0501f, 1.0221f, 1.0000f, 1.0000f, 1.0000f }; -const int16_t tdm_bit_allc_tbl[5][6] = +const Word16 tdm_bit_allc_tbl[5][6] = { /* IC -- UC -- GC -- TM --AC */ { 1650, 3500, 0, 4400, 0, 5000 }, /* IVAS_13k2 */ @@ -879,9 +880,9 @@ const float tdm_PRED_QNT_fixed_beta_prd_diag_3[15 + 16 + 15] = 0.1193f, 0.6574f, }; -const int16_t fast_FCB_bits_2sfr[] = {8, 14, 18, 20, 24, 128/*stop value*/}; +const Word16 fast_FCB_bits_2sfr[] = {8, 14, 18, 20, 24, 128/*stop value*/}; -const int16_t fast_FCB_rates_2sfr[] = {/*16*50,*/ (8+14)*50, 28*50, 32*50, 34*50, 36*50, 38*50, 40*50, 42*50, 44*50, 48*50}; +const Word16 fast_FCB_rates_2sfr[] = {/*16*50,*/ (8+14)*50, 28*50, 32*50, 34*50, 36*50, 38*50, 40*50, 42*50, 44*50, 48*50}; /*----------------------------------------------------------------------------------* @@ -970,11 +971,11 @@ const float dft_cng_coh_pred[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] { 1.393664f, -0.131401f, 0.989429f, 0.738330f, 0.683865f, 0.001677f, -0.225448f, -0.012158f, 1.084608f, -0.115464f, 0.022371f, -0.045560f, -0.336230f, 0.422742f, 0.499163f} }; -const int16_t dft_cng_coh_u2i[9] = { 4, 5, 3, 6, 2, 7, 1, 8, 0 }; /* Coherence unary codeword -> residual codeword conversion table */ +const Word16 dft_cng_coh_u2i[9] = { 4, 5, 3, 6, 2, 7, 1, 8, 0 }; /* Coherence unary codeword -> residual codeword conversion table */ -const int16_t dft_cng_coh_i2u[9] = { 8, 6, 4, 2, 0, 1, 3, 5, 7 }; /* Coherence residual codeword -> unary codeword conversion table */ +const Word16 dft_cng_coh_i2u[9] = { 8, 6, 4, 2, 0, 1, 3, 5, 7 }; /* Coherence residual codeword -> unary codeword conversion table */ -const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1] = { 15, 16, 17, 18 }; +const Word16 dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1] = { 15, 16, 17, 18 }; const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS] = { @@ -1015,28 +1016,28 @@ const float diffuseness_thresholds[DIRAC_DIFFUSE_LEVELS + 1] = 2.0f /* out-of-range large value to make searching easier */ }; -const int16_t DirAC_band_grouping_12[12 + 1] = +const Word16 DirAC_band_grouping_12[12 + 1] = { 0, 1, 2, 3, 4, 5, 6, 7, 11, 17, 25, 40, 60 }; -const int16_t DirAC_band_grouping_6[6 + 1] = +const Word16 DirAC_band_grouping_6[6 + 1] = { 0, 1, 4, 8, 20, 30, 60 }; -const int16_t DirAC_band_grouping_5[5 + 1] = +const Word16 DirAC_band_grouping_5[5 + 1] = { 0, 1, 3, 7, 15, 60 }; -const int16_t DirAC_block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES + 1] = +const Word16 DirAC_block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES + 1] = { 0, 4, 8, 12, 16 }; -const int16_t DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1] = +const Word16 DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1] = { 0, 1, 2, 3, 4 }; @@ -1686,18 +1687,18 @@ const ivas_huff_models_t ivas_huff_decd_r_consts[TOTAL_DECD_QUANT_STRATS] = /* DTX quantization and bitstream constants */ const float dtx_pd_real_min_max[2] = { 0, 1.6f }; -const int16_t dtx_pd_real_q_levels[3][3] = { { 7,7,7 },{ 7,7,0 },{ 3,0,0 } }; -const int16_t dtx_pr_real_q_levels[3][3] = { { 9,9,9 },{ 9,7,9 },{ 9,5,7 } }; -const int16_t pr_pr_idx_pairs[3][3][2] = { { { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 1, 3 },{ 0, 0 } } }; -const int16_t pr_pd_idx_pairs[3][3][2] = { { { 1, 1 },{ 2, 2 },{ 3, 3 } },{ { 1, 1 },{ 3, 2 },{ 2, 0 } },{ { 2, 1 },{ 0, 0 },{ 0, 0 } } }; +const Word16 dtx_pd_real_q_levels[3][3] = { { 7,7,7 },{ 7,7,0 },{ 3,0,0 } }; +const Word16 dtx_pr_real_q_levels[3][3] = { { 9,9,9 },{ 9,7,9 },{ 9,5,7 } }; +const Word16 pr_pr_idx_pairs[3][3][2] = { { { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 1, 3 },{ 0, 0 } } }; +const Word16 pr_pd_idx_pairs[3][3][2] = { { { 1, 1 },{ 2, 2 },{ 3, 3 } },{ { 1, 1 },{ 3, 2 },{ 2, 0 } },{ { 2, 1 },{ 0, 0 },{ 0, 0 } } }; -const int16_t remix_order_set[1][DIRAC_MAX_ANA_CHANS] = { /* WYZX --> WYXZ... */ +const Word16 remix_order_set[1][DIRAC_MAX_ANA_CHANS] = { /* WYZX --> WYXZ... */ { 0, 1, 3, 2, 4, 5, 6, 7, 8, 9, 10 } }; -const int16_t HOA_keep_ind[IVAS_SPAR_MAX_FB_IN_CHAN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15}; -const int16_t HOA_keep_ind_spar[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 8, 9, 10, 10, 10, 10}; -const int16_t HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; +const Word16 HOA_keep_ind[IVAS_SPAR_MAX_FB_IN_CHAN] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15}; +const Word16 HOA_keep_ind_spar[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 8, 9, 10, 10, 10, 10}; +const Word16 HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; /*----------------------------------------------------------------------* @@ -1719,7 +1720,7 @@ const int32_t ivas_pca_offset_index1[IVAS_PCA_N1 + 1] = 463455, 463456 }; -const int16_t ivas_pca_offset_index2[2692] = +const Word16 ivas_pca_offset_index2[2692] = { 0, 1, 0, 1, 7, 8, 0, 1, 7, 19, 33, 45, 51, 52, 0, 1, 9, 23, 41, 61, @@ -1993,7 +1994,7 @@ const int16_t ivas_pca_offset_index2[2692] = 10365, 10366 }; -const int16_t ivas_pca_offset_n2[IVAS_PCA_N1] = +const Word16 ivas_pca_offset_n2[IVAS_PCA_N1] = { 0, 2, 6, 14, 24, 38, 56, 76, 100, 126, 156, 188, 224, 262, 302, 346, 392, 442, 494, 548, 604, 664, 726, 790, @@ -2106,53 +2107,53 @@ const Word16 ph1_q_n2_tbl[IVAS_PCA_N1][2] = { /* ph1_q : Q13, n2 : Q0 */ * Parametric MC ROM tables *----------------------------------------------------------------------------------*/ -const int16_t param_mc_band_grouping_20[20 + 1] = +const Word16 param_mc_band_grouping_20[20 + 1] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 17, 20, 23, 27, 33, 40, 52, 60 }; -const int16_t param_mc_coding_band_mapping_20[20] = +const Word16 param_mc_coding_band_mapping_20[20] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -const int16_t param_mc_bands_coded_20[4] = +const Word16 param_mc_bands_coded_20[4] = { 10, 14, 18, 20 }; -const int16_t param_mc_band_grouping_14[14 + 1] = +const Word16 param_mc_band_grouping_14[14 + 1] = { 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 28, 40, 60 }; -const int16_t param_mc_coding_band_mapping_14[14] = +const Word16 param_mc_coding_band_mapping_14[14] = { 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; -const int16_t param_mc_bands_coded_14[4] = +const Word16 param_mc_bands_coded_14[4] = { 8, 11, 13, 14 }; -const int16_t param_mc_band_grouping_10[10 + 1] = +const Word16 param_mc_band_grouping_10[10 + 1] = { 0, 1, 2, 3, 5, 7, 10, 14, 20, 40, 60 }; -const int16_t param_mc_bands_coded_10[4] = +const Word16 param_mc_bands_coded_10[4] = { 6, 8, 9, 10 }; -const int16_t param_mc_coding_band_mapping_10[10] = +const Word16 param_mc_coding_band_mapping_10[10] = { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; -const int16_t Param_MC_index[MAX_CICP_CHANNELS] = +const Word16 Param_MC_index[MAX_CICP_CHANNELS] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; @@ -2914,161 +2915,161 @@ const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER] = }; /* Alphabet for delta coding for the ICCs in Parametric MC processing */ -const uint16_t ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = +const UWord16 ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = { 0, 24, 224, 20873, 42384, 51699, 57122, 60572, 65535 }; -const uint16_t ivas_param_mc_sym_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] = +const UWord16 ivas_param_mc_sym_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] = { 24, 200, 20649, 21511, 9315, 5423, 3450, 4963 }; -const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] = +const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] = { 0, 4, 9, 124, 447, 1311, 4453, 18116, 48636, 60573, 63692, 64746, 65327, 65531, 65534, 65535 }; -const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] = +const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] = { 4, 5, 115, 323, 864, 3142, 13663, 30520, 11937, 3119, 1054, 581, 204, 3, 1 }; -const uint16_t ivas_param_mc_cum_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = +const UWord16 ivas_param_mc_cum_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = { 0, 30, 848, 26611, 47846, 57358, 61679, 63237, 65535 }; -const uint16_t ivas_param_mc_sym_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] = +const UWord16 ivas_param_mc_sym_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] = { 30, 818, 25763, 21235, 9512, 4321, 1558, 2298 }; -const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] = +const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] = { 0, 2, 7, 53, 243, 979, 3994, 16732, 49642, 61343, 64331, 65158, 65438, 65532, 65534, 65535 }; -const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] = +const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] = { 2, 5, 46, 190, 736, 3015, 12738, 32910, 11701, 2988, 827, 280, 94, 2, 1 }; -const uint16_t ivas_param_mc_cum_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = +const UWord16 ivas_param_mc_cum_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = { 0, 46, 826, 27798, 49552, 58447, 62046, 63284, 65535 }; -const uint16_t ivas_param_mc_sym_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER ]={ +const UWord16 ivas_param_mc_sym_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER ]={ 46, 780, 26972, 21754, 8895, 3599, 1238, 2251 }; -const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] = +const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] = { 0, 3, 8, 36, 172, 763, 3436, 15845, 50168, 62005, 64676, 65298, 65481, 65533, 65534, 65535 }; -const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[2* PARAM_MC_SZ_ICC_QUANTIZER - 1] = +const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[2* PARAM_MC_SZ_ICC_QUANTIZER - 1] = { 3, 5, 28, 136, 591, 2673, 12409, 34323, 11837, 2671, 622, 183, 52, 1, 1 }; -const uint16_t ivas_param_mc_cum_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = +const UWord16 ivas_param_mc_cum_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = { 0, 34, 552, 24717, 45819, 54772, 59054, 61166, 65535 }; -const uint16_t ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] = +const UWord16 ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] = { 34, 518, 24165, 21102, 8953, 4282, 2112, 4369 }; -const uint16_t ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] = +const UWord16 ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] = { 0, 3, 7, 74, 304, 1009, 3870, 16502, 49834, 61384, 64217, 65020, 65369, 65531, 65534, 65535 }; -const uint16_t ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] = +const UWord16 ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] = { 3, 4, 67, 230, 705, 2861, 12632, 33332, 11550, 2833, 803, 349, 162, 3, 1 }; -const uint16_t ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] = +const UWord16 ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] = { 0, 1092, 5574, 8315, 10652, 13875, 19656, 27664, 36284, 47058, 56251, 62579, 65118, 65462, 65513, 65532, 65535 }; -const uint16_t ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = +const UWord16 ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { 1092, 4482, 2741, 2337, 3223, 5781, 8008, 8620, 10774, 9193, 6328, 2539, 344, 51, 19, 3 }; -const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = +const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { 0, 1, 2, 3, 5, 38, 146, 352, 638, 997, 1559, 2323, 3570, 5859, 10556, 21075, 44682, 55617, 60408, 62739, 63833, 64443, 64809, 65074, 65279, 65400, 65484, 65531, 65532, 65533, 65534, 65535 }; -const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] = +const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] = { 1, 1, 1, 2, 33, 108, 206, 286, 359, 562, 764, 1247, 2289, 4697, 10519, 23607, 10935, 4791, 2331, 1094, 610, 366, 265, 205, 121, 84, 47, 1, 1, 1, 1 }; -const uint16_t ivas_param_mc_cum_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] = +const UWord16 ivas_param_mc_cum_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] = { 0, 967, 6335, 9941, 12837, 16652, 22416, 29814, 38807, 48497, 57184, 62661, 64916, 65466, 65514, 65530, 65535 }; -const uint16_t ivas_param_mc_sym_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = +const UWord16 ivas_param_mc_sym_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { 967, 5368, 3606, 2896, 3815, 5764, 7398, 8993, 9690, 8687, 5477, 2255, 550, 48, 16, 5 }; -const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = +const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { 0, 1, 2, 3, 5, 18, 61, 149, 320, 592, 1083, 1793, 2974, 5257, 10133, 21274, 44342, 55891, 60895, 63174, 64244, 64793, 65100, 65287, 65406, 65477, 65517, 65531, 65532, 65533, 65534, 65535 }; -const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] = +const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] = { 1, 1, 1, 2, 13, 43, 88, 171, 272, 491, 710, 1181, 2283, 4876, 11141, 23068, 11549, 5004, 2279, 1070, 549, 307, 187, 119, 71, 40, 14, 1, 1, 1, 1 }; -const uint16_t ivas_param_mc_cum_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] = +const UWord16 ivas_param_mc_cum_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] = { 0, 229, 7068, 10910, 13856, 17467, 22629, 29174, 36906, 46558, 55579, 61802, 65222, 65505, 65527, 65534, 65535 }; -const uint16_t ivas_param_mc_sym_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = +const UWord16 ivas_param_mc_sym_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { 229, 6839, 3842, 2946, 3611, 5162, 6545, 7732, 9652, 9021, 6223, 3420, 283, 22, 7, 1 }; -const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = +const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { 0, 1, 2, 3, 4, 12, 56, 153, 278, 475, 856, 1430, 2489, 4723, 9580, 20685, 45423, 56274, 60948, 63097, 64128, 64679, 65002, 65208, 65348, 65445, 65517, 65531, 65532, 65533, 65534, 65535 }; -const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] = +const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] = { 1, 1, 1, 1, 8, 44, 97, 125, 197, 381, 574, 1059, 2234, 4857, 11105, 24738, 10851, 4674, 2149, 1031, 551, 323, 206, 140, 97, 72, 14, 1, 1, 1, 1 }; -const uint16_t ivas_param_mc_cum_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS+1] = +const UWord16 ivas_param_mc_cum_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS+1] = { 0, 1453, 8326, 12221, 15164, 18764, 24177, 31297, 39520, 49154, 57135, 62460, 64821, 65468, 65514, 65530, 65535 }; -const uint16_t ivas_param_mc_sym_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = +const UWord16 ivas_param_mc_sym_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { 1453, 6873, 3895, 2943, 3600, 5413, 7120, 8223, 9634, 7981, 5325, 2361, 647, 46, 16, 5 }; -const uint16_t ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = +const UWord16 ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { 0, 1, 2, 3, 5, 29, 98, 220, 414, 699, 1186, 1876, 3049, 5304, 10013, 20612, 45247, 56109, 60818, 63022, 64081, 64647, 64977, 65198, 65348, 65443, 65502, 65530, 65532, 65533, 65534, 65535 }; -const uint16_t ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] = +const UWord16 ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] = { 1, 1, 1, 2, 24, 69, 122, 194, 285, 487, 690, 1173, 2255, 4709, 10599, 24635, 10862, 4709, 2204, 1059, 566, 330, 221, 150, 95, 59, 28, 2, 1, 1, 1 }; @@ -3156,7 +3157,7 @@ const Word32 diffuseness_thresholds_hr_fx[HR_MASA_ER_LEVELS + 1] = { /* Q30 */ MAX_32 /* out-of-range large value to make searching easier */ }; -const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS] = +const Word16 bits_direction_masa[DIRAC_DIFFUSE_LEVELS] = { 11, 11, @@ -3218,7 +3219,7 @@ const float coherence_cb1_masa[MASA_NO_CV_COH1*MASA_MAXIMUM_CODING_SUBBANDS] = 0.0017f, 0.2521f, -0.2479f, 0.7217f, -0.7157f }; -const int16_t len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS] = { 7, 6, 5, 4, 4, 4, 3, 2 }; +const Word16 len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS] = { 7, 6, 5, 4, 4, 4, 3, 2 }; const uint8_t sur_coherence_cb_masa[MASA_MAX_NO_CV_SUR_COH*MASA_NO_CB_SUR_COH] = { @@ -3231,18 +3232,18 @@ const uint8_t sur_coherence_cb_masa[MASA_MAX_NO_CV_SUR_COH*MASA_NO_CB_SUR_COH] = 6, 20, 38, 60, 86, 119, 165, 249 }; -const int16_t idx_cb_sur_coh_masa[MASA_MAX_NO_CV_SUR_COH] = { 0, 1, 2, 3, 4, 5, 5, 6 }; +const Word16 idx_cb_sur_coh_masa[MASA_MAX_NO_CV_SUR_COH] = { 0, 1, 2, 3, 4, 5, 5, 6 }; -const int16_t len_huf_masa[MASA_NO_CV_COH1] = { 4, 2, 1, 3, 4 }; +const Word16 len_huf_masa[MASA_NO_CV_COH1] = { 4, 2, 1, 3, 4 }; -const int16_t huff_code_av_masa[MASA_NO_CV_COH1] = { 15, 2, 0, 6, 14 }; +const Word16 huff_code_av_masa[MASA_NO_CV_COH1] = { 15, 2, 0, 6, 14 }; -const int16_t no_theta_masa[NO_SPHERICAL_GRIDS-2] = /* from 1 to 11 bits */ +const Word16 no_theta_masa[NO_SPHERICAL_GRIDS-2] = /* from 1 to 11 bits */ { /*1, 1,*/ 2 ,2 , 4, 5, 6, 7, 10, 14, 19 /*0, 2, 8, 6, 7, 12, 14, 16*/ }; -const int16_t no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = /* from 1 to 11 bits*/ +const Word16 no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = /* from 1 to 11 bits*/ { { 2 }, { 4 }, @@ -3278,63 +3279,63 @@ const float azimuth_cb[8] = 0.0f, -180.0f, -90.0f, 90.0f, -45.0f, 45.0f, -135.0f, 135.0f }; -const int16_t MASA_band_grouping_24[24 + 1] = +const Word16 MASA_band_grouping_24[24 + 1] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30, 40, 60 }; -const int16_t MASA_band_mapping_24_to_18[18 + 1] = +const Word16 MASA_band_mapping_24_to_18[18 + 1] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 17, 20, 21, 22, 23, 24 }; -const int16_t MASA_band_mapping_24_to_12[12 + 1] = +const Word16 MASA_band_mapping_24_to_12[12 + 1] = { 0, 1, 2, 3, 4, 5, 7, 9, 12, 15, 20, 22, 24 }; -const int16_t MASA_band_mapping_24_to_8[8 + 1] = +const Word16 MASA_band_mapping_24_to_8[8 + 1] = { 0, 1, 2, 3, 5, 8, 12, 20, 24 }; -const int16_t MASA_band_mapping_24_to_5[5 + 1] = +const Word16 MASA_band_mapping_24_to_5[5 + 1] = { 0, 1, 3, 7, 15, 24 }; -const int16_t MASA_grouping_8_to_5[8] = +const Word16 MASA_grouping_8_to_5[8] = { 0, 1, 1, 2, 3, 3, 4, 4 }; -const int16_t MASA_grouping_12_to_5[12] = +const Word16 MASA_grouping_12_to_5[12] = { 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4 }; -const int16_t MASA_grouping_18_to_5[18] = +const Word16 MASA_grouping_18_to_5[18] = { 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4 }; -const int16_t MASA_grouping_24_to_5[24] = +const Word16 MASA_grouping_24_to_5[24] = { 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; /* IVAS_13k2, IVAS_16k4, IVAS_24k4, IVAS_32k, IVAS_48k, IVAS_64k, IVAS_80k, IVAS_96k, IVAS_128k, IVAS_160k, IVAS_192k, IVAS_256k, IVAS_384k, IVAS_512k */ -const int16_t masa_bits[IVAS_NUM_ACTIVE_BRATES] = +const Word16 masa_bits[IVAS_NUM_ACTIVE_BRATES] = { 50, 60, 70, 85, 140, 180, 220, 256, 350, 432, 528, 832, 1024, MASA_MAX_BITS }; -const int16_t masa_bits_LR_stereo[4] = +const Word16 masa_bits_LR_stereo[4] = { 50, 50, 60, 70 }; -const int16_t mcmasa_bits[IVAS_NUM_ACTIVE_BRATES] = +const Word16 mcmasa_bits[IVAS_NUM_ACTIVE_BRATES] = { 50, 70, 80, 120, 140, 160, 220, 256, 288, 432, 528, 832, 1024, MASA_MAX_BITS }; @@ -3497,7 +3498,7 @@ const float ism_elevation_borders[4] = * Param ISM ROM tables *----------------------------------------------------------------------------------*/ -const int16_t Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1] = +const Word16 Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1] = { 0, 1, 2, 3, 4, 6, 8, 11, 15, 21, 31, 60 }; @@ -3780,7 +3781,7 @@ const ivas_lfe_freq_models ivas_str_lfe_freq_models = { 16384, 4468, 1489, 745, 0 }, 0, }; -const int16_t ivas_lfe_num_ele_in_coder_models[2][4] = +const Word16 ivas_lfe_num_ele_in_coder_models[2][4] = { { 63, 31, 7, 1 },{ 31, 15, 3, 0 } }; @@ -3790,9 +3791,9 @@ const Word16 ivas_lfe_log2_num_ele_in_coder_models_fx[2][4] = { 6, 5, 3, 1 },{ 5, 4, 2, 0 } }; -const int16_t ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 8, 6 }; +const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 8, 6 }; -const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 }; +const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 }; const float ivas_lfe_lpf_delay[2] = { 0.00175f, 0.0035f }; const Word16 ivas_lfe_lpf_delay_Q15[2] = { 57, 114 }; @@ -4752,7 +4753,7 @@ const float ivas_cos_twiddle_80[IVAS_80_PT_LEN >> 1] = 0.151584296010041f, 0.112661287574648f, 0.0735645635996675f, 0.0343544083996823f }; -const int16_t dirac_gains_P_idx[16] = +const Word16 dirac_gains_P_idx[16] = { -1, 1, 0, 1, 4, 3, 2, 3, 4, 8, 7, 6, 5, 6, 7, 8 }; @@ -5120,21 +5121,21 @@ const Word32 ivas_fb_fcs_12band_1ms_fx[IVAS_FB_BANDS_12] = 465288128, 715827904, 1091637520, 1735882615 };/*Q31*/ -const int16_t ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] = +const Word16 ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] = { { 24, 30, 30, 30, 30, 30, 42, 76, 124, 182, 291, 367 }, { 24, 30, 30, 30, 30, 30, 42, 76, 124, 182, 260, 47 }, { 24, 30, 30, 30, 30, 30, 42, 75, 122, 73, 0, 0 } }; -const int16_t ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] = +const Word16 ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] = { {0, 9, 25, 41, 57, 73, 88, 110, 158, 246, 380, 593 }, {0, 9, 25, 41, 57, 73, 88, 110, 158, 246, 380, 593 }, {0, 9, 25, 41, 57, 73, 88, 110, 159, 247, 0, 0 } }; -const int16_t ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] = +const Word16 ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] = { { IVAS_FB_12_1MS_48K_END_BINS_BAND_0 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0, @@ -5180,7 +5181,7 @@ const int16_t ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BA }, }; -const int16_t ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] = +const Word16 ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] = { { IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_1, @@ -6275,7 +6276,7 @@ const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1] = 0.500000000000000f }; -const int16_t ivas_num_active_bands[FB - WB + 1] = +const Word16 ivas_num_active_bands[FB - WB + 1] = { IVAS_16K_12BANDS_ACTIVE_BANDS, IVAS_FB_BANDS_12, IVAS_FB_BANDS_12 }; @@ -6284,9 +6285,9 @@ const int16_t ivas_num_active_bands[FB - WB + 1] = * SNS MSVQ codebooks and means *------------------------------------------------------------------------------------------*/ -const int16_t ivas_sns_cdbks_tcx20_levels[SNS_MSVQ_NSTAGES_TCX20] = { 128, 64, 32, 32 }; +const Word16 ivas_sns_cdbks_tcx20_levels[SNS_MSVQ_NSTAGES_TCX20] = { 128, 64, 32, 32 }; -const int16_t ivas_sns_cdbks_tcx20_bits[SNS_MSVQ_NSTAGES_TCX20] = { 7, 6, 5, 5 }; +const Word16 ivas_sns_cdbks_tcx20_bits[SNS_MSVQ_NSTAGES_TCX20] = { 7, 6, 5, 5 }; /* pre-rounded codebook vectors for singed Q4.12 represantation */ const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = @@ -6563,9 +6564,9 @@ const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = const float *const ivas_sns_cdbks_tcx20[SNS_MSVQ_NSTAGES_TCX20] = { ivas_sns_cdbk_tcx20_stage1, ivas_sns_cdbk_tcx20_stage2, ivas_sns_cdbk_tcx20_stage3, ivas_sns_cdbk_tcx20_stage4 }; -const int16_t ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 }; +const Word16 ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 }; -const int16_t ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 }; +const Word16 ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 }; const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = { @@ -6749,10 +6750,10 @@ const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = const float *const ivas_sns_cdbks_tcx10[SNS_MSVQ_NSTAGES_TCX10] = { ivas_sns_cdbk_tcx10_stage1, ivas_sns_cdbk_tcx10_stage2, ivas_sns_cdbk_tcx10_stage3}; -const int16_t ivas_sns_cdbks_side_tcx20_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 32 }; -const int16_t ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 }; -const int16_t ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 }; -const int16_t ivas_sns_cdbks_side_tcx10_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 3 }; +const Word16 ivas_sns_cdbks_side_tcx20_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 32 }; +const Word16 ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 }; +const Word16 ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 }; +const Word16 ivas_sns_cdbks_side_tcx10_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 3 }; const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = { @@ -6879,7 +6880,7 @@ const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = const float *const ivas_sns_cdbks_side_tcx10[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx10_stage1, ivas_sns_cdbks_side_tcx10_stage2 }; -const int16_t sns_1st_cdbk[2][2][8 * 32] = +const Word16 sns_1st_cdbk[2][2][8 * 32] = { { /* split 1 */ { /* TCX 20 */ @@ -7023,7 +7024,7 @@ const int16_t sns_1st_cdbk[2][2][8 * 32] = } }; -const int16_t sns_1st_means_16k[2][16] = +const Word16 sns_1st_means_16k[2][16] = { { /* TCX 20 */ 14210, 19017, 14362, 9309, 5385, 2674, 1055, -211, -1407, -3059, -4393, -8597, -11180, -11756, -12131, -13281, @@ -7033,7 +7034,7 @@ const int16_t sns_1st_means_16k[2][16] = } }; -const int16_t sns_1st_means_25k6[2][16] = +const Word16 sns_1st_means_25k6[2][16] = { { /* TCX 20 */ 14973, 20323, 16461, 9554, 4017, 3103, 1602, 1694, -221, -1401, -6817, -10071, -11503, -11805, -13158, -16749, @@ -7043,7 +7044,7 @@ const int16_t sns_1st_means_25k6[2][16] = } }; -const int16_t sns_1st_means_32k[2][16] = +const Word16 sns_1st_means_32k[2][16] = { { /* TCX 20 */ 15041, 20603, 16969, 10289, 4973, 4283, 3003, 3316, 1684, -259, -6614, -9535, -10363, -11834, -16625, -24930, @@ -7058,7 +7059,7 @@ const int16_t sns_1st_means_32k[2][16] = * MC ParamUpmix ROM tables *-----------------------------------------------------------------------*/ -const int16_t ivas_param_upmx_mx_qmap[33] = +const Word16 ivas_param_upmx_mx_qmap[33] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index 6d1648c4e..f70ad7937 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -45,16 +45,16 @@ * General IVAS ROM tables *----------------------------------------------------------------------------------*/ -extern const int32_t ivas_brate_tbl[]; +extern const Word32 ivas_brate_tbl[]; /*------------------------------------------------------------------------- * DFT Stereo ROM tables *------------------------------------------------------------------------*/ -extern const int16_t dft_band_limits_erb4[]; -extern const int16_t dft_band_limits_erb8[]; -extern const int16_t dft_band_ipd[3][4]; -extern const int16_t dft_band_res_cod[3][4]; +extern const Word16 dft_band_limits_erb4[]; +extern const Word16 dft_band_limits_erb8[]; +extern const Word16 dft_band_ipd[3][4]; +extern const Word16 dft_band_res_cod[3][4]; extern const float dft_res_gains_q[][2]; #ifndef IVAS_FLOAT_FIXED @@ -66,23 +66,23 @@ extern const float dft_trigo_32k[STEREO_DFT_N_32k_ENC / 4 + 1]; extern const float dft_trigo_48k[STEREO_DFT_N_MAX_ENC / 4 + 1]; /* Golomb-Rice encoding tables */ -extern const int16_t dft_maps_rpg[]; -extern const int16_t dft_code_itd[]; -extern const int16_t dft_len_itd[]; -extern const int16_t dft_maps_sg[NO_SYMB_GR_SIDE_G * NO_SYMB_GR_SIDE_G]; +extern const Word16 dft_maps_rpg[]; +extern const Word16 dft_code_itd[]; +extern const Word16 dft_len_itd[]; +extern const Word16 dft_maps_sg[NO_SYMB_GR_SIDE_G * NO_SYMB_GR_SIDE_G]; /*----------------------------------------------------------------------------------* * Range Coder ROM tables *----------------------------------------------------------------------------------*/ -extern const uint16_t cum_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][1 + RANGE_N_SYMBOLS]; -extern const uint16_t sym_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][RANGE_N_SYMBOLS]; +extern const UWord16 cum_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][1 + RANGE_N_SYMBOLS]; +extern const UWord16 sym_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][RANGE_N_SYMBOLS]; /*----------------------------------------------------------------------------------* * ECLVQ Stereo ROM tables *----------------------------------------------------------------------------------*/ -extern const uint16_t ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE]; +extern const UWord16 ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE]; /*----------------------------------------------------------------------------------* * Stereo ICA ROM tables @@ -105,7 +105,7 @@ extern const float icbwe_gsMappingDFT_tbl[]; extern const float tdm_ratio_tabl[]; extern const float tdm_den_ratio_tabl[]; -extern const int16_t tdm_bit_allc_tbl[5][6]; +extern const Word16 tdm_bit_allc_tbl[5][6]; /* LSFs Intra-frame prediction tables */ #ifdef IVAS_FLOAT_FIXED @@ -141,8 +141,8 @@ extern const float tdm_LSF_MEAN_PRED_QNT_IN[M]; extern const float tdm_LSF_MEAN_PRED_QNT[M]; extern const float tdm_PRED_QNT_fixed_beta_prd_diag_3[15 + 16 + 15]; -extern const int16_t fast_FCB_bits_2sfr[]; -extern const int16_t fast_FCB_rates_2sfr[]; +extern const Word16 fast_FCB_bits_2sfr[]; +extern const Word16 fast_FCB_rates_2sfr[]; /*----------------------------------------------------------------------------------* * MDCT Stereo ROM tables @@ -161,11 +161,11 @@ extern const float nf_tw_smoothing_coeffs[N_LTP_GAIN_MEMS]; extern const Word16 dft_cng_coh_pred_fx[][STEREO_DFT_COH_PRED_COEFFS]; extern const float dft_cng_coh_pred[][STEREO_DFT_COH_PRED_COEFFS]; -extern const int16_t dft_cng_coh_u2i[9]; -extern const int16_t dft_cng_coh_i2u[9]; +extern const Word16 dft_cng_coh_u2i[9]; +extern const Word16 dft_cng_coh_i2u[9]; extern const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; extern const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; -extern const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1]; +extern const Word16 dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1]; /*----------------------------------------------------------------------------------* * DirAC ROM tables @@ -173,11 +173,11 @@ extern const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1]; extern const float diffuseness_reconstructions[DIRAC_DIFFUSE_LEVELS]; extern const float diffuseness_thresholds[DIRAC_DIFFUSE_LEVELS + 1]; -extern const int16_t DirAC_band_grouping_12[12 + 1]; -extern const int16_t DirAC_band_grouping_6[6 + 1]; -extern const int16_t DirAC_band_grouping_5[5 + 1]; -extern const int16_t DirAC_block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES + 1]; -extern const int16_t DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1]; +extern const Word16 DirAC_band_grouping_12[12 + 1]; +extern const Word16 DirAC_band_grouping_6[6 + 1]; +extern const Word16 DirAC_band_grouping_5[5 + 1]; +extern const Word16 DirAC_block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES + 1]; +extern const Word16 DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1]; #ifdef IVAS_FLOAT_FIXED extern const Word32 c_weights_fx[DIRAC_NO_FB_BANDS_MAX]; // Q30 @@ -201,24 +201,24 @@ extern const ivas_huff_models_t ivas_huff_drct_r_consts[TOTAL_DRCT_QUANT_STRATS] extern const ivas_huff_models_t ivas_huff_decd_r_consts[TOTAL_DECD_QUANT_STRATS]; extern const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN]; extern const ivas_spar_br_table_t ivas_spar_br_table_consts_fx[IVAS_SPAR_BR_TABLE_LEN]; -extern const int16_t remix_order_set[1][DIRAC_MAX_ANA_CHANS]; -extern const int16_t HOA_keep_ind[IVAS_SPAR_MAX_FB_IN_CHAN]; -extern const int16_t HOA_keep_ind_spar[IVAS_SPAR_MAX_CH]; -extern const int16_t HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH]; +extern const Word16 remix_order_set[1][DIRAC_MAX_ANA_CHANS]; +extern const Word16 HOA_keep_ind[IVAS_SPAR_MAX_FB_IN_CHAN]; +extern const Word16 HOA_keep_ind_spar[IVAS_SPAR_MAX_CH]; +extern const Word16 HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH]; extern const float dtx_pd_real_min_max[2]; -extern const int16_t dtx_pd_real_q_levels[3][3]; -extern const int16_t dtx_pr_real_q_levels[3][3]; -extern const int16_t pr_pr_idx_pairs[3][3][2]; -extern const int16_t pr_pd_idx_pairs[3][3][2]; +extern const Word16 dtx_pd_real_q_levels[3][3]; +extern const Word16 dtx_pr_real_q_levels[3][3]; +extern const Word16 pr_pr_idx_pairs[3][3][2]; +extern const Word16 pr_pd_idx_pairs[3][3][2]; /*----------------------------------------------------------------------* * PCA ROM tables *-----------------------------------------------------------------------*/ -extern const int32_t ivas_pca_offset_index1[IVAS_PCA_N1 + 1]; -extern const int16_t ivas_pca_offset_index2[2692]; -extern const int16_t ivas_pca_offset_n2[IVAS_PCA_N1]; +extern const Word32 ivas_pca_offset_index1[IVAS_PCA_N1 + 1]; +extern const Word16 ivas_pca_offset_index2[2692]; +extern const Word16 ivas_pca_offset_n2[IVAS_PCA_N1]; extern const Word16 ph1_q_n2_tbl[IVAS_PCA_N1][2]; @@ -226,98 +226,98 @@ extern const Word16 ph1_q_n2_tbl[IVAS_PCA_N1][2]; * Parametric MC ROM tables *----------------------------------------------------------------------------------*/ -extern const int16_t param_mc_band_grouping_20[20 + 1]; -extern const int16_t param_mc_coding_band_mapping_20[20]; -extern const int16_t param_mc_bands_coded_20[4]; -extern const int16_t param_mc_band_grouping_14[14 + 1]; -extern const int16_t param_mc_coding_band_mapping_14[14]; -extern const int16_t param_mc_bands_coded_14[4]; -extern const int16_t param_mc_band_grouping_10[10 + 1]; -extern const int16_t param_mc_coding_band_mapping_10[10]; -extern const int16_t param_mc_bands_coded_10[4]; -extern const int16_t param_mc_start_bin_per_band_20[20]; -extern const int16_t param_mc_active_bins_per_band_20[20]; -extern const int16_t param_mc_start_bin_per_band_14[14]; -extern const int16_t param_mc_active_bins_per_band_14[14]; -extern const int16_t param_mc_start_bin_per_band_10[10]; -extern const int16_t param_mc_active_bins_per_band_10[10]; -extern const int16_t Param_MC_index[MAX_CICP_CHANNELS]; +extern const Word16 param_mc_band_grouping_20[20 + 1]; +extern const Word16 param_mc_coding_band_mapping_20[20]; +extern const Word16 param_mc_bands_coded_20[4]; +extern const Word16 param_mc_band_grouping_14[14 + 1]; +extern const Word16 param_mc_coding_band_mapping_14[14]; +extern const Word16 param_mc_bands_coded_14[4]; +extern const Word16 param_mc_band_grouping_10[10 + 1]; +extern const Word16 param_mc_coding_band_mapping_10[10]; +extern const Word16 param_mc_bands_coded_10[4]; +extern const Word16 param_mc_start_bin_per_band_20[20]; +extern const Word16 param_mc_active_bins_per_band_20[20]; +extern const Word16 param_mc_start_bin_per_band_14[14]; +extern const Word16 param_mc_active_bins_per_band_14[14]; +extern const Word16 param_mc_start_bin_per_band_10[10]; +extern const Word16 param_mc_active_bins_per_band_10[10]; +extern const Word16 Param_MC_index[MAX_CICP_CHANNELS]; extern const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS]; extern const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; extern const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER]; -extern const uint16_t ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; -extern const uint16_t ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; -extern const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; -extern const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1]; -extern const uint16_t ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1]; -extern const uint16_t ivas_param_mc_sym_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER]; -extern const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER]; -extern const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1]; - -extern const uint16_t ivas_param_mc_cum_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; -extern const uint16_t ivas_param_mc_sym_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; -extern const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; -extern const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1]; -extern const uint16_t ivas_param_mc_cum_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1]; -extern const uint16_t ivas_param_mc_sym_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER]; -extern const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER]; -extern const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1]; - -extern const uint16_t ivas_param_mc_cum_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; -extern const uint16_t ivas_param_mc_sym_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; -extern const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; -extern const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1]; -extern const uint16_t ivas_param_mc_cum_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1]; -extern const uint16_t ivas_param_mc_sym_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER]; -extern const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER]; -extern const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1]; - -extern const uint16_t ivas_param_mc_cum_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; -extern const uint16_t ivas_param_mc_sym_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; -extern const uint16_t ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; -extern const uint16_t ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1]; -extern const uint16_t ivas_param_mc_cum_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1]; -extern const uint16_t ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER]; -extern const uint16_t ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER]; -extern const uint16_t ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1]; +extern const UWord16 ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; +extern const UWord16 ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1]; +extern const UWord16 ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1]; +extern const UWord16 ivas_param_mc_sym_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER]; +extern const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER]; +extern const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1]; + +extern const UWord16 ivas_param_mc_cum_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; +extern const UWord16 ivas_param_mc_sym_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1]; +extern const UWord16 ivas_param_mc_cum_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1]; +extern const UWord16 ivas_param_mc_sym_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER]; +extern const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER]; +extern const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1]; + +extern const UWord16 ivas_param_mc_cum_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; +extern const UWord16 ivas_param_mc_sym_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const UWord16 ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1]; +extern const UWord16 ivas_param_mc_cum_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1]; +extern const UWord16 ivas_param_mc_sym_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER]; +extern const UWord16 ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER]; +extern const UWord16 ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1]; + +extern const UWord16 ivas_param_mc_cum_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; +extern const UWord16 ivas_param_mc_sym_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const UWord16 ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; +extern const UWord16 ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1]; +extern const UWord16 ivas_param_mc_cum_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1]; +extern const UWord16 ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER]; +extern const UWord16 ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER]; +extern const UWord16 ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1]; /*----------------------------------------------------------------------------------* * MASA ROM tables *----------------------------------------------------------------------------------*/ -extern const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS]; -extern const int16_t no_theta_masa[NO_SPHERICAL_GRIDS - 2]; -extern const int16_t no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA]; +extern const Word16 bits_direction_masa[DIRAC_DIFFUSE_LEVELS]; +extern const Word16 no_theta_masa[NO_SPHERICAL_GRIDS - 2]; +extern const Word16 no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA]; extern const float delta_theta_masa[NO_SPHERICAL_GRIDS - 2]; extern const float azimuth_cb[8]; extern const float coherence_cb0_masa[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH]; extern const float coherence_cb1_masa[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS]; /* 25 */ -extern const int16_t len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS]; -extern const uint8_t sur_coherence_cb_masa[MASA_NO_CB_SUR_COH * MASA_MAX_NO_CV_SUR_COH]; -extern const int16_t idx_cb_sur_coh_masa[MASA_NO_CV_COH]; -extern const int16_t len_huf_masa[MASA_NO_CV_COH1]; -extern const int16_t huff_code_av_masa[MASA_NO_CV_COH1]; - -extern const int16_t MASA_band_grouping_24[24 + 1]; -extern const int16_t MASA_band_mapping_24_to_18[18 + 1]; -extern const int16_t MASA_band_mapping_24_to_12[12 + 1]; -extern const int16_t MASA_band_mapping_24_to_8[8 + 1]; -extern const int16_t MASA_band_mapping_24_to_5[5 + 1]; - -extern const int16_t MASA_grouping_8_to_5[8]; -extern const int16_t MASA_grouping_12_to_5[12]; -extern const int16_t MASA_grouping_18_to_5[18]; -extern const int16_t MASA_grouping_24_to_5[24]; -extern const int16_t masa_bits[14]; -extern const int16_t masa_bits_LR_stereo[4]; -extern const int16_t mcmasa_bits[]; -extern const uint8_t masa_nbands[]; -extern const uint8_t masa_joined_nbands[]; -extern const uint8_t masa_twodir_bands[]; -extern const uint8_t masa_twodir_bands_joined[]; +extern const Word16 len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS]; +extern const UWord8 sur_coherence_cb_masa[MASA_NO_CB_SUR_COH * MASA_MAX_NO_CV_SUR_COH]; +extern const Word16 idx_cb_sur_coh_masa[MASA_NO_CV_COH]; +extern const Word16 len_huf_masa[MASA_NO_CV_COH1]; +extern const Word16 huff_code_av_masa[MASA_NO_CV_COH1]; + +extern const Word16 MASA_band_grouping_24[24 + 1]; +extern const Word16 MASA_band_mapping_24_to_18[18 + 1]; +extern const Word16 MASA_band_mapping_24_to_12[12 + 1]; +extern const Word16 MASA_band_mapping_24_to_8[8 + 1]; +extern const Word16 MASA_band_mapping_24_to_5[5 + 1]; + +extern const Word16 MASA_grouping_8_to_5[8]; +extern const Word16 MASA_grouping_12_to_5[12]; +extern const Word16 MASA_grouping_18_to_5[18]; +extern const Word16 MASA_grouping_24_to_5[24]; +extern const Word16 masa_bits[14]; +extern const Word16 masa_bits_LR_stereo[4]; +extern const Word16 mcmasa_bits[]; +extern const UWord8 masa_nbands[]; +extern const UWord8 masa_joined_nbands[]; +extern const UWord8 masa_twodir_bands[]; +extern const UWord8 masa_twodir_bands_joined[]; extern const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS]; extern const float diffuseness_thresholds_hr[HR_MASA_ER_LEVELS + 1]; @@ -347,7 +347,7 @@ extern const float McMASA_LFEGain_vectors[64]; * MASA and ISM (OMASA) combined format ROM tables *----------------------------------------------------------------------------------*/ -extern const int32_t sep_object_brate[][MAX_NUM_OBJECTS]; +extern const Word32 sep_object_brate[][MAX_NUM_OBJECTS]; extern const float dct4[]; extern const float dct5[]; extern const float dct8[]; @@ -364,7 +364,7 @@ extern const float ism_elevation_borders[4]; * Param ISM ROM tables *----------------------------------------------------------------------------------*/ -extern const int16_t Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1]; +extern const Word16 Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1]; /*----------------------------------------------------------------------------------* * LFE coding ROM tables @@ -381,10 +381,10 @@ extern const float ivas_lfe_window_coeff_48k[IVAS_LFE_FADE_LEN_48K]; extern const float ivas_lfe_window_coeff_32k[IVAS_LFE_FADE_LEN_32K]; extern const float ivas_lfe_window_coeff_16k[IVAS_LFE_FADE_LEN_16K]; -extern const int16_t ivas_lfe_num_ele_in_coder_models[2][4]; +extern const Word16 ivas_lfe_num_ele_in_coder_models[2][4]; extern const Word16 ivas_lfe_log2_num_ele_in_coder_models_fx[2][4]; -extern const int16_t ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; -extern const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; +extern const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; +extern const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; extern const ivas_lfe_freq_models ivas_str_lfe_freq_models; extern const float ivas_lfe_lpf_delay[2]; extern const Word16 ivas_lfe_lpf_delay_Q15[2]; @@ -414,7 +414,7 @@ extern const float ivas_mdft_coeff_cos_twid_40[IVAS_40_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_960[IVAS_960_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_640[IVAS_640_PT_LEN + 1]; extern const float ivas_mdft_coeff_cos_twid_320[IVAS_320_PT_LEN + 1]; -extern const int16_t dirac_gains_P_idx[16]; +extern const Word16 dirac_gains_P_idx[16]; extern const float dirac_gains_norm_term[9]; extern const float dirac_gains_Pnm[91][9]; extern const float dirac_gains_trg_term[181][2]; @@ -429,10 +429,10 @@ extern const Word32 ivas_fb_fcs_12band_1ms_fx[IVAS_FB_BANDS_12]; extern const float ivas_fb_fr_12band_1ms_re[IVAS_FB_12_1MS_LEN]; extern const float ivas_fb_fr_12band_1ms_im[IVAS_FB_12_1MS_LEN]; -extern const int16_t ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; -extern const int16_t ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; -extern const int16_t ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; -extern const int16_t ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; +extern const Word16 ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; +extern const Word16 ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; +extern const Word16 ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; +extern const Word16 ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; extern const float ivas_fb_cf_4ms_48k[IVAS_FB_4MS_48K_SAMP]; extern const float ivas_fb_cf_1ms_48k[IVAS_FB_1MS_48K_SAMP]; @@ -444,41 +444,41 @@ extern const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP]; 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]; -extern const int16_t ivas_num_active_bands[FB - WB + 1]; +extern const Word16 ivas_num_active_bands[FB - WB + 1]; /*------------------------------------------------------------------------------------------* * SNS MSVQ codebooks and means *------------------------------------------------------------------------------------------*/ -extern const int16_t ivas_sns_cdbks_tcx20_levels[]; -extern const int16_t ivas_sns_cdbks_tcx20_bits[]; +extern const Word16 ivas_sns_cdbks_tcx20_levels[]; +extern const Word16 ivas_sns_cdbks_tcx20_bits[]; -extern const int16_t ivas_sns_cdbks_tcx10_levels[]; -extern const int16_t ivas_sns_cdbks_tcx10_bits[]; +extern const Word16 ivas_sns_cdbks_tcx10_levels[]; +extern const Word16 ivas_sns_cdbks_tcx10_bits[]; extern const float *const ivas_sns_cdbks_tcx20[]; extern const float *const ivas_sns_cdbks_tcx10[]; -extern const int16_t ivas_sns_cdbks_side_tcx20_levels[]; -extern const int16_t ivas_sns_cdbks_side_tcx20_bits[]; -extern const int16_t ivas_sns_cdbks_side_tcx10_levels[]; -extern const int16_t ivas_sns_cdbks_side_tcx10_bits[]; +extern const Word16 ivas_sns_cdbks_side_tcx20_levels[]; +extern const Word16 ivas_sns_cdbks_side_tcx20_bits[]; +extern const Word16 ivas_sns_cdbks_side_tcx10_levels[]; +extern const Word16 ivas_sns_cdbks_side_tcx10_bits[]; extern const float *const ivas_sns_cdbks_side_tcx20[]; extern const float *const ivas_sns_cdbks_side_tcx10[]; /* means and codebooks for the split VQ in the 2-stage SNS VQ */ -extern const int16_t sns_1st_cdbk[2][2][8 * 32]; -extern const int16_t sns_1st_means_16k[2][16]; -extern const int16_t sns_1st_means_25k6[2][16]; -extern const int16_t sns_1st_means_32k[2][16]; +extern const Word16 sns_1st_cdbk[2][2][8 * 32]; +extern const Word16 sns_1st_means_16k[2][16]; +extern const Word16 sns_1st_means_25k6[2][16]; +extern const Word16 sns_1st_means_32k[2][16]; /*----------------------------------------------------------------------* * MC ParamUpmix ROM tables *-----------------------------------------------------------------------*/ -extern const int16_t ivas_param_upmx_mx_qmap[33]; +extern const Word16 ivas_param_upmx_mx_qmap[33]; extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_alpha_quant_table; extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[9]; diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index 269c62d28..dc2e0ad4e 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -605,6 +605,7 @@ const Word32 pow_10_q23[14] = { #endif /* clang-format on */ +// Q15 const Word16 ivas_tan_panning_gain_dirac_tbl_fx[601] = { SHC( 0x8000 ), SHC( 0x8001 ), @@ -1298,6 +1299,7 @@ const Masa_Diffuseness_Ratios masa_diffuse_ratios[DIRAC_DIFFUSE_LEVELS][DIRAC_DI * Stereo ICA ROM tables *----------------------------------------------------------------------------------*/ +// Q31 const Word32 ica_sincInterp2_fx[2 * SINC_ORDER1 + 1] = { 0, -4988604, 0, 7486127, 0, -12594991, 0, 20905753, 0, -33172179, 0, @@ -1310,10 +1312,12 @@ const Word32 ica_sincInterp2_fx[2 * SINC_ORDER1 + 1] = { -4988604, 0 }; +// Q31 const Word32 ica_sincInterp4_fx[2 * SINC_ORDER1 + 1] = { 0, -7054484, -11890617, -10587094, 0, 17813376, 32618130, 29564408, 0, -46911780, -82209968, -71380208, 0, 105465072, 180201792, 153819952, 0, -226492960, -394310208, -349923872, 0, 621904832, 1345701248, 1925805312, 2147483647, 1925805312, 1345701248, 621904832, 0, -349923872, -394310208, -226492960, 0, 153819952, 180201792, 105465072, 0, -71380208, -82209968, -46911780, 0, 29564408, 32618130, 17813376, 0, -10587094, -11890617, -7054484, 0 }; +// Q31 const Word32 ica_sincInterp6_fx[2 * SINC_ORDER1 + 1] = { 0, -7481833, -15444702, -22462678, -25151328, -18893562, 0, 31359704, 68816112, 99516536, 106796512, 75709536, 0, -111862424, -234090752, -326303712, -341870816, -240232560, 0, 371151744, 833251584, 1319259392, 1748116096, 2042624128, 2147483647, 2042624128, 1748116096, 1319259392, 833251584, 371151744, 0, -240232560, -341870816, -326303712, -234090752, -111862424, 0, 75709536, 106796512, 99516536, 68816112, 31359704, 0, -18893562, -25151328, -22462678, -15444702, -7481833, 0 }; @@ -1476,6 +1480,7 @@ const Word32 diffuseness_reconstructions_fx[DIRAC_DIFFUSE_LEVELS] = { 0, 42467328, 96206848, 170655744, 331087872, 508821504, 678952960, 912785408 }; +// Q30 const Word32 diffuseness_thresholds_fx[DIRAC_DIFFUSE_LEVELS + 1] = { 0, 20447232, @@ -1492,10 +1497,12 @@ const Word32 diffuseness_thresholds_fx[DIRAC_DIFFUSE_LEVELS + 1] = { * SPAR ROM tables *------------------------------------------------------------------------------------------*/ +// Q28 const Word32 dtx_pd_real_min_max_fx[2] = { 0, 429496729 }; +// Q31 const Word32 one_by_q_level[64] = { 0, 2147483647, 1073741824, 715827904, 536870912, 429496736, 357913952, 306783392, 268435456, 238609296, 214748368, @@ -1634,6 +1641,7 @@ const Word32 shoebox_sin_cos_tbl_fx[11][2] = { { 0, 1073741824 }, // 0 { 759250112, -759250112 }, { -759250112, -759250112 } }; // 135, -135 //Q.30 +// Q22 const Word32 delta_phi_val[90] = { 0, 1509949440, 754974720, 503316480, 377487360, 301989888, 251658240, 215707056, 188743680, 167772160, 150994944, @@ -1655,6 +1663,7 @@ const Word32 delta_phi_val[90] = { 17557552, 17355740, 17158516, 16965724 }; +// Q31 const Word32 inv_delta_phi_val[90] = { 0, 5965232, 11930464, 17895697, 23860929, 29826161, 35791394, 41756626, 47721858, 53687091, 59652323, @@ -1676,6 +1685,7 @@ const Word32 inv_delta_phi_val[90] = { 513009982, 518975214, 524940447, 530905679 }; +// Q22 const Word32 dd_val[90] = { 0, 754974720, 377487360, 251658240, 188743680, 150994944, 125829120, 107853528, 94371840, 83886080, 75497472, @@ -1749,10 +1759,12 @@ const Word32 dct12_fx[12 * 12] = { // Q31 * ISM ROM tables *----------------------------------------------------------------------------------*/ +// Q22 const Word32 ism_azimuth_borders_fx[4] = { ISM_AZIMUTH_MIN_FX, ISM_AZIMUTH_LOW_BORDER_FX, ISM_AZIMUTH_HIGH_BORDER_FX, ISM_AZIMUTH_MAX_FX }; +// Q22 const Word32 ism_elevation_borders_fx[4] = { ISM_ELEVATION_MIN_FX, ISM_ELEVATION_LOW_BORDER_FX, ISM_ELEVATION_HIGH_BORDER_FX, ISM_ELEVATION_MAX_FX }; @@ -1804,15 +1816,15 @@ const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1] = { /* Q30 */ 0x12c07, 0x2580d, 0x12c07, 0x40000000, 0x818a4580, 0x3e7a6a80 }; -const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K] = { +const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K] = { // Q31 0x0003a373, 0x000608f6, 0x000888a7, 0x000b3e1b, 0x000e34f1, 0x001174a2, 0x00150328, 0x0018e5e1, 0x001d21eb, 0x0021bc4d, 0x0026ba09, 0x002c202f, 0x0031f3dc, 0x00383a43, 0x003ef8ad, 0x0046347b, 0x004df325, 0x00563a3f, 0x005f0f74, 0x00687888, 0x00727b59, 0x007d1ddb, 0x0088661c, 0x00945a41, 0x00a10087, 0x00ae5f3d, 0x00bc7ccd, 0x00cb5fb3, 0x00db0e7d, 0x00eb8fd0, 0x00fcea61, 0x010f24f8, 0x0122466a, 0x013655a0, 0x014b598e, 0x01615936, 0x01785ba8, 0x01906800, 0x01a9855e, 0x01c3baf0, 0x01df0fee, 0x01fb8b90, 0x02193514, 0x023813c4, 0x02582ee4, 0x02798db8, 0x029c378c, 0x02c033a4, 0x02e58944, 0x030c3fa8, 0x03345e0c, 0x035deba0, 0x0388ef8c, 0x03b570f0, 0x03e376dc, 0x04130858, 0x04442c58, 0x0476e9b8, 0x04ab4760, 0x04e14c00, 0x0518fe48, 0x055264c8, 0x058d8600, 0x05ca6850, 0x06091200, 0x06498930, 0x068bd3f0, 0x06cff830, 0x0715fba8, 0x075de408, 0x07a7b6c8, 0x07f37940, 0x084130a0, 0x0890e200, 0x08e29220, 0x093645c0, 0x098c0150, 0x09e3c940, 0x0a3da180, 0x0a998e30, 0x0af792e0, 0x0b57b320, 0x0bb9f240, 0x0c1e5360, 0x0c84d940, 0x0ced8690, 0x0d585dc0, 0x0dc560f0, 0x0e349200, 0x0ea5f2b0, 0x0f198450, 0x0f8f4820, 0x10073f00, 0x10816980, 0x10fdc840, 0x117c5b00, 0x11fd21e0, 0x12801c60, 0x130549a0, 0x138ca8c0, 0x14163880, 0x14a1f740, 0x152fe320, 0x15bffa00, 0x16523980, 0x16e69ee0, 0x177d2700, 0x1815cec0, 0x18b09260, 0x194d6e00, 0x19ec5d60, 0x1a8d5c20, 0x1b306580, 0x1bd57440, 0x1c7c8300, 0x1d258c40, 0x1dd08a00, 0x1e7d7600, 0x1f2c49a0, 0x1fdcfe20, 0x208f8c40, 0x2143ed00, 0x21fa1840, 0x22b20680, 0x236baf40, 0x24270a00, 0x24e40e00, 0x25a2b280, 0x2662ee00, 0x2724b700, 0x27e80400, 0x28acca80, 0x297300c0, 0x2a3a9c00, 0x2b039180, 0x2bcdd680, 0x2c995fc0, 0x2d6621c0, 0x2e341140, 0x2f032240, 0x2fd34900, 0x30a47900, 0x3176a640, 0x3249c440, 0x331dc600, 0x33f29f40, 0x34c842c0, 0x359ea340, 0x3675b3c0, 0x374d66c0, 0x3825af00, 0x38fe7ec0, 0x39d7c880, 0x3ab17e40, 0x3b8b9240, 0x3c65f6c0, 0x3d409d80, 0x3e1b7880, 0x3ef679c0, 0x3fd19340, 0x40acb680, 0x4187d580, 0x4262e280, 0x433dce80, 0x44188c00, 0x44f30c80, 0x45cd4180, 0x46a71e00, 0x47809300, 0x48599300, 0x49320f80, 0x4a09fb80, 0x4ae14880, 0x4bb7e900, 0x4c8dcf80, 0x4d62ee80, 0x4e373880, 0x4f0aa080, 0x4fdd1900, 0x50ae9600, 0x517f0980, 0x524e6780, 0x531ca380, 0x53e9b100, 0x54b58400, 0x55801080, 0x56494b00, 0x57112800, 0x57d79c00, 0x589c9c00, 0x59601d00, 0x5a221480, 0x5ae27880, 0x5ba13e00, 0x5c5e5c00, 0x5d19c880, 0x5dd37a80, 0x5e8b6800, 0x5f418980, 0x5ff5d580, 0x60a84480, 0x6158ce00, 0x62076a80, 0x62b41280, 0x635ebf80, 0x64076a80, 0x64ae0d00, 0x6552a100, 0x65f52080, 0x66958680, 0x6733cd00, 0x67cff000, 0x6869ea80, 0x6901b880, 0x69975600, 0x6a2abf80, 0x6abbf200, 0x6b4aea80, 0x6bd7a680, 0x6c622300, 0x6cea5f80, 0x6d705900, 0x6df40f00, 0x6e758080, 0x6ef4ac80, 0x6f719300, 0x6fec3380, 0x70648f00, 0x70daa580, 0x714e7880, 0x71c00880, 0x722f5780, 0x729c6700, 0x73073980, 0x736fd100, 0x73d62f80, 0x743a5900, 0x749c5080, 0x74fc1880, 0x7559b600, 0x75b52b80, 0x760e7e80, 0x7665b280, 0x76bacc80, 0x770dd180, 0x775ec600, 0x77adb000, 0x77fa9480, 0x78457900, 0x788e6400, 0x78d55b80, 0x791a6500, 0x795d8780, 0x799ec900, 0x79de3100, 0x7a1bc580, 0x7a578d80, 0x7a919100, 0x7ac9d600, 0x7b006500, 0x7b354400, 0x7b687b80, 0x7b9a1300, 0x7bca1180, 0x7bf87f80, 0x7c256400, 0x7c50c780, 0x7c7ab180, 0x7ca32a00, 0x7cca3900, 0x7cefe600, 0x7d143900, 0x7d373a80, 0x7d58f280, 0x7d796800, 0x7d98a380, 0x7db6ad00, 0x7dd38c80, 0x7def4900, 0x7e09eb00, 0x7e237a00, 0x7e3bfd80, 0x7e537d80, 0x7e6a0180, 0x7e7f9080, 0x7e943200, 0x7ea7ed80, 0x7ebaca00, 0x7ecccf00, 0x7ede0300, 0x7eee6d00, 0x7efe1400, 0x7f0cfe80, 0x7f1b3380, 0x7f28b900, 0x7f359500, 0x7f41ce80, 0x7f4d6b80, 0x7f587180, 0x7f62e680, 0x7f6cd000, 0x7f763400, 0x7f7f1780, 0x7f878080, 0x7f8f7380, 0x7f96f580, 0x7f9e0b80, 0x7fa4bb00, 0x7fab0780, 0x7fb0f600, 0x7fb68b00, 0x7fbbca00, 0x7fc0b800, 0x7fc55880, 0x7fc9af80, 0x7fcdc080, 0x7fd18f00, 0x7fd51e80, 0x7fd87280, 0x7fdb8d80, 0x7fde7380, 0x7fe12700, 0x7fe3aa80, 0x7fe60100, 0x7fe82d00, 0x7fea3180, 0x7fec1000, 0x7fedcb00, 0x7fef6500, 0x7ff0e000, 0x7ff23e00, 0x7ff38080, 0x7ff4a980, 0x7ff5ba80, 0x7ff6b580, 0x7ff79c00, 0x7ff86e80, 0x7ff92f80, 0x7ff9e000, 0x7ffa8100, 0x7ffb1380, 0x7ffb9880, 0x7ffc1180, 0x7ffc7f80, 0x7ffce300, 0x7ffd3c80, 0x7ffd8d80, 0x7ffdd680, 0x7ffe1880, 0x7ffe5300, 0x7ffe8800, 0x7ffeb700, 0x7ffee100, 0x7fff0600, 0x7fff2700, 0x7fff4480, 0x7fff5e80, 0x7fff7500, 0x7fff8900, 0x7fff9a80, 0x7fffaa00, 0x7fffb780, 0x7fffc300, 0x7fffcd00, 0x7fffd580, 0x7fffdc80, 0x7fffe300, 0x7fffe880, 0x7fffec80, 0x7ffff080, 0x7ffff380, 0x7ffff680, 0x7ffff880, 0x7ffffa00, 0x7ffffb80, 0x7ffffc80, 0x7ffffd80, 0x7ffffe80, 0x7fffff00, 0x7fffff00, 0x7fffff80, 0x7fffff80, 0x7fffffff, 0x7fffffff }; -const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K] = { +const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K] = { // Q31 0x000474c9, 0x0007fdfd, 0x000c0272, 0x0010a35b, 0x0015f4ae, 0x001c079e, 0x0022ecc2, 0x002ab4c6, 0x003370ac, 0x003d31e5, 0x00480a5f, 0x00540c87, 0x00614b4e, 0x006fda25, 0x007fccfb, 0x0091383a, 0x00a430c2, 0x00b8cbe7, 0x00cf1f67, 0x00e74167, 0x0101486c, 0x011d4b52, 0x013b614e, 0x015ba1d8, 0x017e24ae, 0x01a301c8, 0x01ca514e, 0x01f42b90, 0x0220a900, 0x024fe224, 0x0281ef88, 0x02b6e9c0, 0x02eee954, 0x032a06b4, 0x03685a34, 0x03a9fc00, 0x03ef0408, 0x043789f8, 0x0483a538, 0x04d36cd0, 0x0526f760, 0x057e5b20, 0x05d9adc0, 0x06390470, 0x069c73c0, 0x07040fa8, 0x076feb68, 0x07e01990, 0x0854abe0, 0x08cdb350, 0x094b4000, 0x09cd6120, 0x0a5424d0, 0x0adf9870, 0x0b6fc830, 0x0c04bf20, 0x0c9e8760, 0x0d3d29c0, 0x0de0ade0, 0x0e891a50, 0x0f367440, 0x0fe8bfa0, 0x109fff00, 0x115c33a0, 0x121d5d80, 0x12e37b00, 0x13ae8960, 0x147e8440, 0x155365c0, 0x162d26c0, 0x170bbe80, 0x17ef22e0, 0x18d74820, 0x19c42100, 0x1ab59f20, 0x1babb200, 0x1ca64840, 0x1da54e80, 0x1ea8b080, 0x1fb057e0, 0x20bc2d80, 0x21cc1800, 0x22dffd40, 0x23f7c1c0, 0x25134800, 0x26327200, 0x27552000, 0x287b30c0, 0x29a48280, 0x2ad0f180, 0x2c005940, 0x2d329440, 0x2e677c00, 0x2f9ee880, 0x30d8b100, 0x3214ac40, 0x3352afc0, 0x34929040, 0x35d421c0, 0x37173780, 0x385ba480, 0x39a13b00, 0x3ae7cc40, 0x3c2f2a00, 0x3d7724c0, 0x3ebf8d80, 0x40083400, 0x4150e980, 0x42997d80, 0x43e1c000, 0x45298180, 0x46709200, 0x47b6c280, 0x48fbe380, 0x4a3fc600, 0x4b823b80, 0x4cc31600, 0x4e022800, 0x4f3f4500, 0x507a4080, 0x51b2ee80, 0x52e92580, 0x541cba80, 0x554d8580, 0x567b5e00, 0x57a61d80, 0x58cd9e00, 0x59f1bb80, 0x5b125200, 0x5c2f3f00, 0x5d486280, 0x5e5d9d00, 0x5f6ecf80, 0x607bde00, 0x6184ad00, 0x62892280, 0x63892680, 0x6484a280, 0x657b8100, 0x666daf00, 0x675b1980, 0x6843b100, 0x69276680, 0x6a062d00, 0x6adff980, 0x6bb4c180, 0x6c847d80, 0x6d4f2680, 0x6e14b800, 0x6ed52e80, 0x6f908900, 0x7046c680, 0x70f7e880, 0x71a3f300, 0x724aea00, 0x72ecd300, 0x7389b680, 0x74219c80, 0x74b48f80, 0x75429b80, 0x75cbcc80, 0x76503100, 0x76cfd800, 0x774ad280, 0x77c13180, 0x78330780, 0x78a06880, 0x79096800, 0x796e1b80, 0x79ce9980, 0x7a2af880, 0x7a835000, 0x7ad7b800, 0x7b284980, 0x7b751c80, 0x7bbe4c00, 0x7c03f080, 0x7c462580, 0x7c850480, 0x7cc0a880, 0x7cf92c00, 0x7d2eaa80, 0x7d613e00, 0x7d910180, 0x7dbe0f80, 0x7de88300, 0x7e107600, 0x7e360300, 0x7e594280, 0x7e7a4f80, 0x7e994200, 0x7eb63280, 0x7ed13a00, 0x7eea6f00, 0x7f01e980, 0x7f17c000, 0x7f2c0800, 0x7f3ed780, 0x7f504280, 0x7f605d80, 0x7f6f3c00, 0x7f7cf100, 0x7f898e00, 0x7f952500, 0x7f9fc600, 0x7fa98200, 0x7fb26800, 0x7fba8680, 0x7fc1eb80, 0x7fc8a400, 0x7fcebd80, 0x7fd44380, 0x7fd94100, 0x7fddc180, 0x7fe1ce80, 0x7fe57180, 0x7fe8b400, 0x7feb9d80, 0x7fee3680, 0x7ff08600, 0x7ff29280, 0x7ff46300, 0x7ff5fc80, 0x7ff76500, 0x7ff8a180, 0x7ff9b600, 0x7ffaa780, 0x7ffb7900, 0x7ffc2e80, 0x7ffccb80, 0x7ffd5200, 0x7ffdc580, 0x7ffe2800, 0x7ffe7b80, 0x7ffec200, 0x7ffefd80, 0x7fff2f00, 0x7fff5880, 0x7fff7a80, 0x7fff9680, 0x7fffad80, 0x7fffc000, 0x7fffcf00, 0x7fffdb00, 0x7fffe480, 0x7fffeb80, 0x7ffff180, 0x7ffff580, 0x7ffff900, 0x7ffffb00, 0x7ffffd00, 0x7ffffe00, 0x7fffff00, 0x7fffff80, 0x7fffffff, 0x7fffffff }; -const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K] = { +const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K] = { // Q31 0x00064d50, 0x000e283c, 0x0018b753, 0x00267552, 0x0037e397, 0x004d8c2b, 0x006801d2, 0x0087dfb9, 0x00adc8fc, 0x00da680b, 0x010e6df8, 0x014a91a0, 0x018f8ecc, 0x01de252a, 0x02371734, 0x029b2908, 0x030b1f1c, 0x0387bd00, 0x0411c3e8, 0x04a9f148, 0x0550fd60, 0x060799b0, 0x06ce6f88, 0x07a61e78, 0x088f3ad0, 0x098a4c30, 0x0a97cc00, 0x0bb82430, 0x0cebadd0, 0x0e32afe0, 0x0f8d5df0, 0x10fbd760, 0x127e2680, 0x14143f40, 0x15bdff00, 0x177b2bc0, 0x194b7440, 0x1b2e6f00, 0x1d239ae0, 0x1f2a5ee0, 0x21420ac0, 0x2369d700, 0x25a0e640, 0x27e64500, 0x2a38ebc0, 0x2c97bfc0, 0x2f019400, 0x31752b00, 0x33f13800, 0x36746180, 0x38fd42c0, 0x3b8a6cc0, 0x3e1a6a80, 0x40abc080, 0x433cf080, 0x45cc7c80, 0x4858e600, 0x4ae0b400, 0x4d627280, 0x4fdcb500, 0x524e1b00, 0x54b54e80, 0x57110880, 0x59601300, 0x5ba14800, 0x5dd39780, 0x5ff60500, 0x6207aa80, 0x6407ba80, 0x65f57e80, 0x67d05b00, 0x6997cc80, 0x6b4b6b00, 0x6ceae880, 0x6e761080, 0x6fecc980, 0x714f1280, 0x729d0480, 0x73d6ce80, 0x74fcb800, 0x760f1d80, 0x770e6e80, 0x77fb2f00, 0x78d5f280, 0x799f5b80, 0x7a581b80, 0x7b00ec80, 0x7b9a9480, 0x7c25df80, 0x7ca39e80, 0x7d14a680, 0x7d79ce00, 0x7dd3eb00, 0x7e23d180, 0x7e6a5180, 0x7ea83680, 0x7ede4580, 0x7f0d3a80, 0x7f35cb00, 0x7f58a180, 0x7f765e80, 0x7f8f9880, 0x7fa4db80, 0x7fb6a700, 0x7fc57100, 0x7fd1a400, 0x7fdb9f80, 0x7fe3b980, 0x7fea3e00, 0x7fef6f80, 0x7ff38900, 0x7ff6bc80, 0x7ff93500, 0x7ffb1780, 0x7ffc8300, 0x7ffd9080, 0x7ffe5500, 0x7ffee280, 0x7fff4580, 0x7fff8a00, 0x7fffb800, 0x7fffd580, 0x7fffe880, 0x7ffff400, 0x7ffffa00, 0x7ffffd80, 0x7fffff00, 0x7fffffff }; @@ -1826,6 +1838,7 @@ const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2] = { 171798688, 172140032, 17 * MDFT/iMDFT ROM tables *------------------------------------------------------------------------------------------*/ +// Q31 const Word32 ivas_mdft_coeff_cos_twid_960_fx[IVAS_960_PT_LEN + 1] = { 2147483647, 2147480832, 2147472128, 2147457792, 2147437696, @@ -2070,6 +2083,7 @@ const Word32 ivas_mdft_coeff_cos_twid_960_fx[IVAS_960_PT_LEN + 1] = { 10541393, 7027612, 3513810, 0 }; +// Q31 const Word32 ivas_mdft_coeff_cos_twid_640_fx[IVAS_640_PT_LEN + 1] = { 2147483647, 2147477120, 2147457792, 2147425408, 2147380096, @@ -2234,6 +2248,7 @@ const Word32 ivas_mdft_coeff_cos_twid_640_fx[IVAS_640_PT_LEN + 1] = { 15812011, 10541393, 5270713, 0 }; +// Q31 const Word32 ivas_mdft_coeff_cos_twid_320_fx[IVAS_320_PT_LEN + 1] = { 2147483647, 2147457792, 2147380096, 2147250816, 2147069696, @@ -2318,6 +2333,7 @@ const Word32 ivas_mdft_coeff_cos_twid_320_fx[IVAS_320_PT_LEN + 1] = { 31623164, 21082532, 10541393, 0 }; +// Q31 const Word32 ivas_mdft_coeff_cos_twid_240_fx[IVAS_240_PT_LEN + 1] = { 2147483647, 2147437696, 2147299712, 2147069696, 2146747776, @@ -2382,6 +2398,7 @@ const Word32 ivas_mdft_coeff_cos_twid_240_fx[IVAS_240_PT_LEN + 1] = { 42163032, 28109692, 14055147, 0 }; +// Q31 const Word32 ivas_mdft_coeff_cos_twid_160_fx[IVAS_160_PT_LEN + 1] = { 2147483647, 2147380096, 2147069696, 2146552320, 2145827968, @@ -2426,6 +2443,7 @@ const Word32 ivas_mdft_coeff_cos_twid_160_fx[IVAS_160_PT_LEN + 1] = { 63239472, 42163032, 21082532, 0 }; +// Q31 const Word32 ivas_mdft_coeff_cos_twid_120_fx[IVAS_120_PT_LEN + 1] = { 2147483647, 2147299712, 2146747776, 2145827968, 2144540544, @@ -2460,6 +2478,7 @@ const Word32 ivas_mdft_coeff_cos_twid_120_fx[IVAS_120_PT_LEN + 1] = { 84309816, 56214568, 28109692, 0 }; +// Q31 const Word32 ivas_mdft_coeff_cos_twid_80_fx[IVAS_80_PT_LEN + 1] = { 2147483647, 2147069696, 2145827968, 2143759104, 2140863616, @@ -2484,6 +2503,7 @@ const Word32 ivas_mdft_coeff_cos_twid_80_fx[IVAS_80_PT_LEN + 1] = { 126424088, 84309816, 42163032, 0 }; +// Q31 const Word32 ivas_mdft_coeff_cos_twid_40_fx[IVAS_40_PT_LEN + 1] = { 2147483647, 2145827968, 2140863616, 2132598272, 2121044608, @@ -2978,26 +2998,32 @@ const Word32 dirac_gains_trg_term_fx[181][2] = { * FB ROM tables *------------------------------------------------------------------------------------------*/ +// Q15 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 }; +// Q15 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 }; +// Q15 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 }; +// Q15 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 }; +// Q15 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 }; +// Q15 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 }; @@ -4020,6 +4046,7 @@ const Word32 ivas_sine_frame_len_640_del_32_fx[577] = { }; +/* Q Factor is 30 */ const Word32 ivas_sine_frame_len_640_del_16_fx[289] = { 1073725952, 1073678400, 1073599104, 1073488064, 1073345344, 1073170880, 1072964736, 1072726912, 1072457408, 1072156160, 1071823296, diff --git a/lib_com/ivas_rom_com_fx.h b/lib_com/ivas_rom_com_fx.h index 4cf61f9ae..2460cd383 100644 --- a/lib_com/ivas_rom_com_fx.h +++ b/lib_com/ivas_rom_com_fx.h @@ -224,9 +224,9 @@ extern const Word32 ivas_lpf_2_butter_16k_fx[IVAS_BIQUAD_FILT_LEN << 1]; extern const Word32 ivas_lpf_2_butter_32k_fx[IVAS_BIQUAD_FILT_LEN << 1]; extern const Word32 ivas_lpf_2_butter_48k_fx[IVAS_BIQUAD_FILT_LEN << 1]; -extern const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K]; -extern const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K]; -extern const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K]; +extern const Word32 ivas_lfe_window_coeff_48k_fx[IVAS_LFE_FADE_LEN_48K]; // Q31 +extern const Word32 ivas_lfe_window_coeff_32k_fx[IVAS_LFE_FADE_LEN_32K]; // Q31 +extern const Word32 ivas_lfe_window_coeff_16k_fx[IVAS_LFE_FADE_LEN_16K]; // Q31 extern const UWord32 d_hamm_lfe_plc_fx[LFE_PLC_LENANA / 2]; diff --git a/lib_com/ivas_spar_com_quant_util.c b/lib_com/ivas_spar_com_quant_util.c index 3c7b4e620..0207e3e19 100644 --- a/lib_com/ivas_spar_com_quant_util.c +++ b/lib_com/ivas_spar_com_quant_util.c @@ -41,6 +41,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" +#include "ivas_prot_fx.h" #endif diff --git a/lib_com/ivas_stereo_ica_com_fx.c b/lib_com/ivas_stereo_ica_com_fx.c index f5f4c423d..829f4e5e8 100644 --- a/lib_com/ivas_stereo_ica_com_fx.c +++ b/lib_com/ivas_stereo_ica_com_fx.c @@ -42,6 +42,7 @@ #include "wmc_auto.h" #include "rom_com.h" #include "ivas_rom_com.h" +#include "ivas_prot_fx.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" #endif diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 942135fbd..d615e511b 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9593,12 +9593,12 @@ void addBassPostFilter_ivas_fx( Word32 **iAnalysis_fx, HANDLE_CLDFB_FILTER_BANK cldfb ); -Word32 ism_dequant_meta_fx( - const Word16 idx, /* i : quantizer index */ - const Word32 borders_fx[], /* i : level borders */ - const Word32 q_step_fx, /* i : quantization step */ - const Word32 q_step_border_fx, /* i : quantization step at the border */ - const Word16 cbsize /* i : codebook size */ +Word32 ism_dequant_meta_fx( /* o : Q22*/ + const Word16 idx, /* i : quantizer index */ + const Word32 borders_fx[], /* i : level borders Q22*/ + const Word32 q_step_fx, /* i : quantization step Q22 */ + const Word32 q_step_border_fx, /* i : quantization step at the border Q22*/ + const Word16 cbsize /* i : codebook size */ ); void save_synthesis_hq_fec_fx( diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index df1ae4cc8..677e37baf 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -10,6 +10,7 @@ #include "basop_util.h" #include "cnst.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" #include "ivas_prot.h" #include "ivas_rom_com.h" diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 834691ce0..3fcf4610b 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -45,6 +45,7 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" +#include "ivas_prot_fx.h" #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index f38fe4612..fa0a6c053 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -45,6 +45,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" +#include "ivas_prot_fx.h" #include "ivas_rom_com_fx.h" #include "debug.h" #define NUM_TAPS_F0_6 ( Word16 )( 58 ) // (Word16) ceil( 0.6f * hBinRenConvModule->numTaps ) diff --git a/lib_dec/ivas_pca_dec_fx.c b/lib_dec/ivas_pca_dec_fx.c index 9765facd6..bec9d70d9 100644 --- a/lib_dec/ivas_pca_dec_fx.c +++ b/lib_dec/ivas_pca_dec_fx.c @@ -40,6 +40,7 @@ #include "wmc_auto.h" #include "prot_fx.h" #include "math.h" +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------------* * Local function definitions diff --git a/lib_dec/ivas_qspherical_dec.c b/lib_dec/ivas_qspherical_dec.c index 3f50f3816..ef42ebe55 100644 --- a/lib_dec/ivas_qspherical_dec.c +++ b/lib_dec/ivas_qspherical_dec.c @@ -40,6 +40,7 @@ #include "prot.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" +#include "ivas_prot_fx.h" #endif diff --git a/lib_dec/ivas_range_uni_dec.c b/lib_dec/ivas_range_uni_dec.c index 8a82dabd2..b2e00ffc2 100644 --- a/lib_dec/ivas_range_uni_dec.c +++ b/lib_dec/ivas_range_uni_dec.c @@ -41,6 +41,7 @@ #include "prot.h" #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED +#include "ivas_prot_fx.h" #include "prot_fx.h" #endif diff --git a/lib_dec/ivas_sns_dec_fx.c b/lib_dec/ivas_sns_dec_fx.c index 1863e11ae..a2ca9f3c2 100644 --- a/lib_dec/ivas_sns_dec_fx.c +++ b/lib_dec/ivas_sns_dec_fx.c @@ -42,6 +42,7 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" #include "ivas_rom_com_fx.h" +#include "ivas_prot_fx.h" /*------------------------------------------------------------------- * sns_1st_dec_fx() diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 886db7651..5b3d2000b 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -4459,7 +4459,7 @@ static void ivas_parse_parameter_bitstream_dtx( move16(); } pd = extract_l( L_sub( value, i_mult( pr, pd_q_lvls ) ) ); - val_fx = dtx_pd_real_min_max_fx[0]; /*Q0*/ + val_fx = dtx_pd_real_min_max_fx[0]; /*Q28*/ move32(); ivas_quantise_real_values_fx( &val_fx, pd_q_lvls, dtx_pd_real_min_max_fx[0], dtx_pd_real_min_max_fx[1], &idx, &val_fx, 1 ); pd = add( pd, idx ); diff --git a/lib_dec/ivas_svd_dec.c b/lib_dec/ivas_svd_dec.c index e0c210a2f..1cb20cc22 100644 --- a/lib_dec/ivas_svd_dec.c +++ b/lib_dec/ivas_svd_dec.c @@ -39,7 +39,7 @@ #include #include "wmc_auto.h" #include "prot_fx.h" - +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------------* * Local constants diff --git a/lib_dec/ivas_td_low_rate_dec.c b/lib_dec/ivas_td_low_rate_dec.c index 03f85a5d6..73214cb3c 100644 --- a/lib_dec/ivas_td_low_rate_dec.c +++ b/lib_dec/ivas_td_low_rate_dec.c @@ -41,6 +41,7 @@ #include "prot_fx.h" #include "ivas_prot.h" #include "wmc_auto.h" +#include "ivas_prot_fx.h" #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tdm_low_rate_dec() diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index a81e22f25..a50c98d09 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -9,6 +9,7 @@ #include "prot_fx.h" /* Function prototypes */ #if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE #include "ivas_prot.h" +#include "ivas_prot_fx.h" #endif #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_enc/cod_tcx.c b/lib_enc/cod_tcx.c index 502b22aed..a5152dcb6 100644 --- a/lib_enc/cod_tcx.c +++ b/lib_enc/cod_tcx.c @@ -47,6 +47,7 @@ #include "ivas_rom_com_fx.h" #include "prot_fx_enc.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" #endif /*-------------------------------------------------------------------* * HBAutocorrelation() diff --git a/lib_enc/find_uv.c b/lib_enc/find_uv.c index f51a259bc..7acb99f49 100644 --- a/lib_enc/find_uv.c +++ b/lib_enc/find_uv.c @@ -562,6 +562,7 @@ Word16 find_uv_ivas_fx( /* o : coding typ test(); #ifdef BASOP_NOGLOB if ( ( ( LT_16( add_o( mean_voi3, corr_shift, &Overflow ), add( 22774, mean_voi3_offset ) ) ) && /* normalized correlation low */ + ( LT_16( add_o( st_fx->voicing_fx[2], corr_shift, &Overflow ), 25887 ) ) && /* normalized correlation low on look-ahead - onset detection */ ( LT_32( ee[0], 397 ) ) && ( GT_32( hp_E[0], E_min_th ) ) && /* energy concentrated in high frequencies provided that some energy is present in HF... */ ( LT_32( ee[1], 397 ) ) && ( GT_32( hp_E[1], E_min_th ) ) && /* ... biased towards look-ahead to detect onsets */ ( tmp_offset_flag == 0 ) && /* Take care of voiced offsets */ diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 7c5223b42..3804b1a9e 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -38,6 +38,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" +#include "ivas_prot_fx.h" #endif /*------------------------------------------------------------------------------------------* diff --git a/lib_enc/ivas_front_vad.c b/lib_enc/ivas_front_vad.c index a4f7731e1..ca21f7b64 100644 --- a/lib_enc/ivas_front_vad.c +++ b/lib_enc/ivas_front_vad.c @@ -45,6 +45,7 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx_enc.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" #endif /*-----------------------------------------------------------------------------------------* diff --git a/lib_enc/ivas_stereo_adapt_GR_enc.c b/lib_enc/ivas_stereo_adapt_GR_enc.c index f98b453a0..b1c490c78 100644 --- a/lib_enc/ivas_stereo_adapt_GR_enc.c +++ b/lib_enc/ivas_stereo_adapt_GR_enc.c @@ -38,7 +38,7 @@ #include "stat_enc.h" #include "wmc_auto.h" #include "ivas_rom_com.h" - +#include "ivas_prot_fx.h" /*---------------------------------------------------------------------* * Local function prototypes diff --git a/lib_enc/ivas_stereo_switching_enc.c b/lib_enc/ivas_stereo_switching_enc.c index 683907e8a..ef62186fe 100644 --- a/lib_enc/ivas_stereo_switching_enc.c +++ b/lib_enc/ivas_stereo_switching_enc.c @@ -45,6 +45,7 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx_enc.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" #endif #ifdef IVAS_FLOAT_FIXED diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 18ef67dbf..4618eaaa6 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -14,6 +14,7 @@ #include "prot_fx_enc.h" /* Function prototypes */ #include "ivas_prot.h" /* Function prototypes */ #include "stl.h" +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------* diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 78ebf384d..95ab75f93 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -49,6 +49,7 @@ #ifdef IVAS_FLOAT_FIXED #include "control.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" #define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) #define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) #endif diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 01bd6edab..dd71510d7 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -42,6 +42,7 @@ #include "ivas_rom_rend.h" #include "wmc_auto.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" /*------------------------------------------------------------------------- * Local constants diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index ef7f34e82..f30bb1237 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -45,6 +45,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" /* Function prototypes */ +#include "ivas_prot_fx.h" #endif #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index 28ba346ca..f12d122b7 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -37,6 +37,7 @@ #include "ivas_error.h" #include "wmc_auto.h" #include "ivas_prot.h" +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------------* * ivas_HRTF_binary_open() diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 4a23da243..ccf81a09d 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -40,6 +40,7 @@ #include "ivas_cnst.h" #include #include "wmc_auto.h" +#include "ivas_prot_fx.h" /*-------------------------------------------------------------------* * ivas_sba_prototype_renderer() diff --git a/lib_rend/ivas_vbap.c b/lib_rend/ivas_vbap.c index 4c14067ec..ad0de1534 100644 --- a/lib_rend/ivas_vbap.c +++ b/lib_rend/ivas_vbap.c @@ -40,6 +40,7 @@ #include "ivas_stat_dec.h" #include "wmc_auto.h" #include "prot_fx.h" +#include "ivas_prot_fx.h" /*-----------------------------------------------------------------------* * Local constants diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 0fe9ed71d..625302e11 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -36,6 +36,7 @@ #include "ivas_prot_rend.h" #include "prot_fx.h" #include "ivas_prot.h" +#include "ivas_prot_fx.h" /*---------------------------------------------------------------------* * Local structures -- GitLab