From 3b55b2d8511ffd924e0ed55b3f5d335860ef1a4d Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 12 Mar 2025 12:00:22 +0100 Subject: [PATCH 01/35] Use round_fx instead of extract_h for angle computation. --- lib_com/options.h | 1 + lib_dec/ivas_dirac_dec_fx.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index d03261715..4272caefe 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -172,4 +172,5 @@ #define DOT_PROD_CHOLESKY_64BIT /* FhG: Issue 1323, optimized 64 bit implementation of dot_product_cholesky() */ #define OPT_BASOP_ADD_v1 /* optimizations to avoid usage of BASOP_Util_Add_MantExp */ #define FIX_ISSUE_1327 /* Ittiam: Fix for issue 1327: Glitch when stereo is switching from TD to FD*/ +#define FIX_1379_MASA_ANGLE_ROUND #endif diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index d8288e561..7ad651af1 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -1446,10 +1446,17 @@ void ivas_qmetadata_to_dirac_fx( { FOR( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { +#ifdef FIX_1379_MASA_ANGLE_ROUND + hSpatParamRendCom->azimuth[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); + move16(); + hSpatParamRendCom->elevation[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); + move16(); +#else hSpatParamRendCom->azimuth[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); move16(); hSpatParamRendCom->elevation[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); move16(); +#endif hSpatParamRendCom->energy_ratio1_fx[meta_write_index][b] = q_direction->band_data[band].energy_ratio_fx[block]; move32(); hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b] = L_sub( ONE_IN_Q30, q_direction->band_data[band].energy_ratio_fx[block] ); @@ -1494,10 +1501,17 @@ void ivas_qmetadata_to_dirac_fx( { FOR( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { +#ifdef FIX_1379_MASA_ANGLE_ROUND + hSpatParamRendCom->azimuth2[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); + move16(); + hSpatParamRendCom->elevation2[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); + move16(); +#else hSpatParamRendCom->azimuth2[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); move16(); hSpatParamRendCom->elevation2[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); move16(); +#endif hSpatParamRendCom->energy_ratio2_fx[meta_write_index][b] = q_direction->band_data[band].energy_ratio_fx[block]; move32(); hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b] = L_sub( hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b], q_direction->band_data[band].energy_ratio_fx[block] ); @@ -1704,8 +1718,13 @@ void ivas_qmetadata_to_dirac_fx( IF( hodirac_flag ) { +#ifdef FIX_1379_MASA_ANGLE_ROUND + azi = round_fx( L_shr( ( L_add( azimuth_fx, ONE_IN_Q21 ) ), 6 ) ); + ele = round_fx( L_shr( ( L_add( elevation_fx, ONE_IN_Q21 ) ), 6 ) ); +#else azi = extract_h( L_shr( ( L_add( azimuth_fx, ONE_IN_Q21 ) ), 6 ) ); ele = extract_h( L_shr( ( L_add( elevation_fx, ONE_IN_Q21 ) ), 6 ) ); +#endif /*addition of one to compensate precision loss*/ if ( azi < 0 ) { @@ -1741,8 +1760,13 @@ void ivas_qmetadata_to_dirac_fx( final_1_32 = BASOP_Util_Add_Mant32Exp( final_1_32, final_1_exp, ONE_IN_Q30, 0, &final_1_exp ); /*0.5 in q31*/ final_2_32 = BASOP_Util_Add_Mant32Exp( final_2_32, final_2_exp, ONE_IN_Q30, 0, &final_2_exp ); +#ifdef FIX_1379_MASA_ANGLE_ROUND + azi = round_fx( L_shr( final_1_32, sub( sub( 31, final_1_exp ), 16 ) ) ); + ele = round_fx( L_shr( final_2_32, sub( sub( 31, final_2_exp ), 16 ) ) ); +#else azi = extract_h( L_shr( final_1_32, sub( sub( 31, final_1_exp ), 16 ) ) ); ele = extract_h( L_shr( final_2_32, sub( sub( 31, final_2_exp ), 16 ) ) ); +#endif /*addition of one to compensate precision loss*/ if ( azi < 0 ) @@ -3597,7 +3621,9 @@ void ivas_dirac_dec_render_sf_fx( { Word16 j, k, j2, l; Word16 num_objects, nchan_out_woLFE, lfe_index; +#ifndef FIX_1379_MASA_ANGLE_ROUND Word16 az1, el1; +#endif Word16 n_slots_to_render; Word16 n_samples_to_render; Word16 interp_offset; @@ -3631,13 +3657,20 @@ void ivas_dirac_dec_render_sf_fx( Word16 el_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, Q22 ) ); Word32 az1_32, el1_32; rotateAziEle_fixed( az_q0, el_q0, &az1_32, &el1_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup ); +#ifndef FIX_1379_MASA_ANGLE_ROUND az1 = extract_h( az1_32 ); el1 = extract_h( el1_32 ); +#endif IF( st_ivas->hEFAPdata != NULL ) { +#ifdef FIX_1379_MASA_ANGLE_ROUND + const Word32 azi_fx = L_shl( az1_32, Q22-Q16 ); // Q16 -> Q22 + const Word32 ele_fx = L_shl( el1_32, Q22-Q16 ); // Q16 -> Q22 +#else const Word32 azi_fx = L_shl( az1, Q22 ); // Q0 -> Q22 const Word32 ele_fx = L_shl( el1, Q22 ); // Q0 -> Q22 +#endif efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azi_fx, ele_fx, EFAP_MODE_EFAP ); } } -- GitLab From 820ea273d5140a00c5696978276e99729b1b11ab Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 12 Mar 2025 12:02:11 +0100 Subject: [PATCH 02/35] Use round_fx instead of extract_h for angle computation. format fix. --- lib_dec/ivas_dirac_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index 7ad651af1..26c7e3441 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -3665,8 +3665,8 @@ void ivas_dirac_dec_render_sf_fx( IF( st_ivas->hEFAPdata != NULL ) { #ifdef FIX_1379_MASA_ANGLE_ROUND - const Word32 azi_fx = L_shl( az1_32, Q22-Q16 ); // Q16 -> Q22 - const Word32 ele_fx = L_shl( el1_32, Q22-Q16 ); // Q16 -> Q22 + const Word32 azi_fx = L_shl( az1_32, Q22 - Q16 ); // Q16 -> Q22 + const Word32 ele_fx = L_shl( el1_32, Q22 - Q16 ); // Q16 -> Q22 #else const Word32 azi_fx = L_shl( az1, Q22 ); // Q0 -> Q22 const Word32 ele_fx = L_shl( el1, Q22 ); // Q0 -> Q22 -- GitLab From 4714a44d70693d2ffbbb4eb5ba2f717b14df91f2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 11 Mar 2025 12:32:57 +0530 Subject: [PATCH 03/35] Fix for 3GPP issue 1341: Usage of open/deleteCldfb() functions - multiple variants Link #1341 --- lib_com/cldfb.c | 107 +++-------------------- lib_com/cnst.h | 6 +- lib_com/prot_fx.h | 15 +--- lib_dec/init_dec_fx.c | 6 +- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 4 +- lib_dec/ivas_init_dec.c | 4 +- lib_dec/ivas_sce_dec_fx.c | 2 +- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 4 +- lib_dec/ivas_stereo_switching_dec_fx.c | 10 +-- lib_enc/init_enc_fx.c | 4 +- lib_enc/ivas_masa_enc_fx.c | 4 +- lib_enc/ivas_omasa_enc_fx.c | 4 +- lib_enc/ivas_stereo_switching_enc_fx.c | 10 +-- lib_enc/ivas_stereo_td_enc_fx.c | 8 +- lib_rend/ivas_dirac_ana_fx.c | 2 +- lib_rend/ivas_masa_merge_fx.c | 2 +- lib_rend/ivas_mcmasa_ana_fx.c | 2 +- lib_rend/ivas_omasa_ana_fx.c | 2 +- lib_rend/lib_rend.c | 4 +- 19 files changed, 53 insertions(+), 147 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 38195b65d..7fc8026b5 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1364,8 +1364,8 @@ ivas_error openCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -) + CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ + CODE_TYPE code_type ) { HANDLE_CLDFB_FILTER_BANK hs; Word16 buf_len; @@ -1379,7 +1379,14 @@ ivas_error openCldfb_ivas_fx( move32(); hs->prototype = prototype; move32(); - configureCldfb_ivas_fx( hs, sampling_rate ); + IF( code_type == IVAS_ENC ) + { + configureCldfb_ivas_enc_fx( hs, sampling_rate ); + } + ELSE + { + configureCldfb_ivas_fx( hs, sampling_rate ); + } hs->memory32 = NULL; hs->FilterStates = NULL; hs->memory_length = 0; @@ -1413,65 +1420,6 @@ ivas_error openCldfb_ivas_fx( return IVAS_ERR_OK; } -ivas_error openCldfb_ivas_enc( - HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ - CLDFB_TYPE type, /* i : analysis or synthesis */ - const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -) -{ - HANDLE_CLDFB_FILTER_BANK hs; - Word16 buf_len; - - IF( ( hs = (HANDLE_CLDFB_FILTER_BANK) malloc( sizeof( CLDFB_FILTER_BANK ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" ); - } - - hs->type = type; - move32(); - hs->prototype = prototype; - move32(); - - configureCldfb_ivas_enc_fx( hs, sampling_rate ); - hs->memory_length = 0; - move32(); - - IF( type == CLDFB_ANALYSIS ) - { - buf_len = sub( hs->p_filter_length, hs->no_channels ); - hs->FilterStates = (Word16 *) malloc( ( 9 + 16 ) * CLDFB_getNumChannels( sampling_rate ) * sizeof( Word16 ) ); - hs->FilterStates_eg = 0; - move16(); - } - ELSE - { - buf_len = hs->p_filter_length; - move16(); - hs->FilterStates = (Word16 *) malloc( 2 * ( 9 + 16 ) * CLDFB_getNumChannels( sampling_rate ) * sizeof( Word16 ) ); - hs->FilterStates_eg = 0; - move16(); - } - - if ( ( hs->cldfb_state_fx = (Word32 *) malloc( buf_len * sizeof( Word32 ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" ); - } - hs->cldfb_state_length = buf_len; // Temporarily added to store the length of buffer - move16(); - hs->cldfb_size = buf_len; /*for having original size at intermediatery conversion, will be removed on removing conversion*/ - move16(); - set32_fx( hs->cldfb_state_fx, 0, buf_len ); - hs->Q_cldfb_state = 0; - move16(); - set16_fx( hs->FilterStates, 0, i_mult( 9 + 16, hs->no_channels ) ); - set16_fx( hs->FilterStates_e, 0, sizeof( hs->FilterStates_e ) / sizeof( hs->FilterStates_e[0] ) ); - - *h_cldfb = hs; - - return IVAS_ERR_OK; -} - /*-------------------------------------------------------------------* * resampleCldfb_ivas() * @@ -1563,41 +1511,6 @@ void analysisCldfbEncoder_ivas_fx( return; } - -/*-------------------------------------------------------------------* - * GetEnergyCldfb_ivas() - * - * Remove handle - *--------------------------------------------------------------------*/ - -void deleteCldfb_ivas( - HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ -) -{ - HANDLE_CLDFB_FILTER_BANK hs = *h_cldfb; - - test(); - IF( h_cldfb == NULL || *h_cldfb == NULL ) - { - return; - } - - IF( hs->cldfb_state_fx ) - { - free( hs->cldfb_state_fx ); - } - - IF( hs->FilterStates ) - { - free( hs->FilterStates ); - } - - free( hs ); - *h_cldfb = NULL; - - return; -} - void deleteCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ ) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 7c93498af..3c014325e 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -803,7 +803,11 @@ typedef enum CLDFB_ANALYSIS, CLDFB_SYNTHESIS } CLDFB_TYPE; - +typedef enum +{ + IVAS_ENC, + IVAS_DEC_REND +} CODE_TYPE; typedef enum { CLDFB_PROTOTYPE_1_25MS, diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index db0953cd9..c1aefbe36 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9803,8 +9803,8 @@ ivas_error openCldfb_ivas_fx( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -); + CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ + CODE_TYPE code_type ); Word32 rand_gauss_fx( Word32 *x, @@ -11944,13 +11944,6 @@ ivas_error openCldfb_ivas( CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ ); -ivas_error openCldfb_ivas_enc( - HANDLE_CLDFB_FILTER_BANK *h_cldfb, /* i/o: filter bank handle */ - CLDFB_TYPE type, /* i : analysis or synthesis */ - const Word32 sampling_rate, /* i : sampling rate */ - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -); - void resampleCldfb_ivas( HANDLE_CLDFB_FILTER_BANK hs, /* i/o: filter bank handle */ const Word32 newSamplerate /* i : new samplerate to operate */ @@ -11960,10 +11953,6 @@ ivas_error cldfb_save_memory_ivas( HANDLE_CLDFB_FILTER_BANK hs /* i/o: filter bank handle */ ); -void deleteCldfb_ivas( - HANDLE_CLDFB_FILTER_BANK *h_cldfb /* i/o: filter bank handle */ -); - /*! r: flag indicating a valid bitrate */ Word16 is_EVS_bitrate( const Word32 ivas_total_brate, /* i : EVS total bitrate */ diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 3865cd61c..4e0cfda18 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1447,13 +1447,13 @@ ivas_error init_decoder_ivas_fx( IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) { /* open analysis for max. SR 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } /* open analysis BPF for max. SR 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -1465,7 +1465,7 @@ ivas_error init_decoder_ivas_fx( } /* open synthesis for output SR */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 25c0bea42..111c0be0e 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -602,7 +602,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbAnalyses_old; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -622,7 +622,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbSyntheses_old; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b11669460..236eaad54 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2264,7 +2264,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -2276,7 +2276,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index a6be10c08..cc3980b12 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -438,7 +438,7 @@ ivas_error create_sce_dec( IF( EQ_16( (Word16) st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index 3f39bd9ac..c8dde0837 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -601,7 +601,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -610,7 +610,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 09b683a16..34eef94ed 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -205,7 +205,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -214,7 +214,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -752,7 +752,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbAna == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -761,7 +761,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -1100,7 +1100,7 @@ ivas_error stereo_memory_dec_fx( { IF( hCPE->hCoreCoder[i]->cldfbSyn == NULL ) /* could be NULL when we had the MCT LFE channel */ { - IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 615ca1b33..f0338b461 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1695,7 +1695,7 @@ ivas_error init_encoder_ivas_fx( test(); IF( ( NE_16( st->element_mode, IVAS_CPE_MDCT ) && idchan == 0 ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->Opt_DTX_ON ) ) { - IF( ( error = openCldfb_ivas_enc( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) { return error; } @@ -1809,7 +1809,7 @@ ivas_error init_encoder_ivas_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( ( error = openCldfb_ivas_enc( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 6960629c8..9fdebed7a 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -152,7 +152,7 @@ ivas_error ivas_masa_enc_open_fx( FOR( i = 0; i < hMasa->data.num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_enc( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -260,7 +260,7 @@ void ivas_masa_enc_close_fx( FOR( i = 0; i < ( *hMasa )->data.num_Cldfb_instances; i++ ) { - deleteCldfb_ivas( &( ( *hMasa )->data.cldfbAnaEnc[i] ) ); + deleteCldfb_ivas_fx( &( ( *hMasa )->data.cldfbAnaEnc[i] ) ); } IF( ( *hMasa )->data.hOmasaData != NULL ) diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 5d79265f4..50fb49355 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -124,7 +124,7 @@ ivas_error ivas_omasa_enc_open_fx( move16(); FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_enc( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ) != IVAS_ERR_OK ) { return error; } @@ -227,7 +227,7 @@ void ivas_omasa_enc_close_fx( FOR( i = 0; i < ( *hOMasa )->num_Cldfb_instances; i++ ) { - deleteCldfb_ivas( &( ( *hOMasa )->cldfbAnaEnc[i] ) ); + deleteCldfb_ivas_fx( &( ( *hOMasa )->cldfbAnaEnc[i] ) ); } FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 2fe8b6c84..6c7a1e68d 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -366,8 +366,8 @@ ivas_error stereo_memory_enc_fx( IF( EQ_16( hCPE->last_element_mode, IVAS_CPE_MDCT ) && ( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) || EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) ) { /* Deallocate MDCT CNG structures */ - deleteCldfb_ivas( &hCPE->hCoreCoder[0]->cldfbAnaEnc ); - deleteCldfb_ivas( &hCPE->hCoreCoder[1]->cldfbAnaEnc ); + deleteCldfb_ivas_fx( &hCPE->hCoreCoder[0]->cldfbAnaEnc ); + deleteCldfb_ivas_fx( &hCPE->hCoreCoder[1]->cldfbAnaEnc ); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) { @@ -417,7 +417,7 @@ ivas_error stereo_memory_enc_fx( /* allocate CLDFB for primary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -433,7 +433,7 @@ ivas_error stereo_memory_enc_fx( IF( st->cldfbSynTd == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -587,7 +587,7 @@ ivas_error stereo_memory_enc_fx( FOR( i = 0; i < CPE_CHANNELS; i++ ) { st = hCPE->hCoreCoder[i]; - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index d2ff2c0c2..de9bc09b5 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -263,7 +263,7 @@ ivas_error stereo_set_tdm_fx( /* deallocate CLDFB ana for secondary channel */ IF( st->cldfbAnaEnc != NULL ) { - deleteCldfb_ivas( &st->cldfbAnaEnc ); + deleteCldfb_ivas_fx( &st->cldfbAnaEnc ); } /* deallocate BWEs for secondary channel */ @@ -275,7 +275,7 @@ ivas_error stereo_set_tdm_fx( st->hBWE_TD = NULL; } - deleteCldfb_ivas( &st->cldfbSynTd ); + deleteCldfb_ivas_fx( &st->cldfbSynTd ); IF( st->hBWE_FD != NULL ) { @@ -309,7 +309,7 @@ ivas_error stereo_set_tdm_fx( /* allocate CLDFB ana for secondary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -322,7 +322,7 @@ ivas_error stereo_set_tdm_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( NE_32( ( error = openCldfb_ivas_enc( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 93a100e17..5dd3f8384 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -107,7 +107,7 @@ ivas_error ivas_dirac_ana_open_fx( move16(); FOR( i = 0; i < hDirAC->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_masa_merge_fx.c b/lib_rend/ivas_masa_merge_fx.c index 430fab2c7..3aa9f62a9 100644 --- a/lib_rend/ivas_masa_merge_fx.c +++ b/lib_rend/ivas_masa_merge_fx.c @@ -499,7 +499,7 @@ ivas_error masaPrerendOpen_fx( move16(); FOR( i = 0; i < hMasaPrerend->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index 8b56b6855..d56ba2685 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -224,7 +224,7 @@ ivas_error ivas_mcmasa_ana_open( move16(); FOR( i = 0; i < hMcMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_omasa_ana_fx.c b/lib_rend/ivas_omasa_ana_fx.c index 2c28b32bd..1d849a90f 100644 --- a/lib_rend/ivas_omasa_ana_fx.c +++ b/lib_rend/ivas_omasa_ana_fx.c @@ -133,7 +133,7 @@ ivas_error ivas_omasa_ana_open( hOMasa->num_Cldfb_instances = numAnalysisChannels; FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 2c81911a1..041f278f1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8187,7 +8187,7 @@ static ivas_error initMasaExtRenderer( { FOR( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } @@ -8195,7 +8195,7 @@ static ivas_error initMasaExtRenderer( FOR( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) { return error; } -- GitLab From b3f172527adda62f08af43cb0d81f7b553e0f8f2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 12 Mar 2025 11:42:57 +0530 Subject: [PATCH 04/35] Address review comments --- lib_com/cldfb.c | 10 ++++++---- lib_com/cnst.h | 6 +----- lib_com/prot_fx.h | 2 +- lib_dec/init_dec_fx.c | 6 +++--- lib_dec/ivas_corecoder_dec_reconfig_fx.c | 4 ++-- lib_dec/ivas_init_dec.c | 4 ++-- lib_dec/ivas_sce_dec_fx.c | 2 +- lib_dec/ivas_stereo_mdct_stereo_dec_fx.c | 4 ++-- lib_dec/ivas_stereo_switching_dec_fx.c | 10 +++++----- lib_enc/init_enc_fx.c | 4 ++-- lib_enc/ivas_masa_enc_fx.c | 2 +- lib_enc/ivas_omasa_enc_fx.c | 2 +- lib_enc/ivas_stereo_switching_enc_fx.c | 6 +++--- lib_enc/ivas_stereo_td_enc_fx.c | 4 ++-- lib_rend/ivas_dirac_ana_fx.c | 2 +- lib_rend/ivas_masa_merge_fx.c | 2 +- lib_rend/ivas_mcmasa_ana_fx.c | 2 +- lib_rend/ivas_omasa_ana_fx.c | 2 +- lib_rend/lib_rend.c | 4 ++-- 19 files changed, 38 insertions(+), 40 deletions(-) diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 7fc8026b5..246a8a8e8 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1365,7 +1365,7 @@ ivas_error openCldfb_ivas_fx( CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ - CODE_TYPE code_type ) + const Word16 enc_dec ) /* i : encoder/decoder flag */ { HANDLE_CLDFB_FILTER_BANK hs; Word16 buf_len; @@ -1379,14 +1379,17 @@ ivas_error openCldfb_ivas_fx( move32(); hs->prototype = prototype; move32(); - IF( code_type == IVAS_ENC ) + IF( enc_dec == ENC ) { configureCldfb_ivas_enc_fx( hs, sampling_rate ); + hs->Q_cldfb_state = 0; } ELSE { configureCldfb_ivas_fx( hs, sampling_rate ); + hs->Q_cldfb_state = Q11; } + move16(); hs->memory32 = NULL; hs->FilterStates = NULL; hs->memory_length = 0; @@ -1412,8 +1415,7 @@ ivas_error openCldfb_ivas_fx( hs->cldfb_size = buf_len; /*for having original size at intermediatery conversion, will be removed on removing conversion*/ move16(); set32_fx( hs->cldfb_state_fx, 0, buf_len ); - hs->Q_cldfb_state = Q11; - move16(); + *h_cldfb = hs; move16(); diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 3c014325e..7c93498af 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -803,11 +803,7 @@ typedef enum CLDFB_ANALYSIS, CLDFB_SYNTHESIS } CLDFB_TYPE; -typedef enum -{ - IVAS_ENC, - IVAS_DEC_REND -} CODE_TYPE; + typedef enum { CLDFB_PROTOTYPE_1_25MS, diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index c1aefbe36..9fe14b5bd 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9804,7 +9804,7 @@ ivas_error openCldfb_ivas_fx( CLDFB_TYPE type, /* i : analysis or synthesis */ const Word32 sampling_rate, /* i : sampling rate */ CLDFB_PROTOTYPE prototype, /* i : CLDFB version (1.25ms/5ms delay) */ - CODE_TYPE code_type ); + const Word16 enc_dec ); /* i : encoder/decoder flag */ Word32 rand_gauss_fx( Word32 *x, diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 4e0cfda18..bd8a2cbd3 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1447,13 +1447,13 @@ ivas_error init_decoder_ivas_fx( IF( ( idchan == 0 && NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) { /* open analysis for max. SR 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } /* open analysis BPF for max. SR 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -1465,7 +1465,7 @@ ivas_error init_decoder_ivas_fx( } /* open synthesis for output SR */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st_fx->cldfbSyn, CLDFB_SYNTHESIS, st_fx->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_corecoder_dec_reconfig_fx.c b/lib_dec/ivas_corecoder_dec_reconfig_fx.c index 111c0be0e..8333f146f 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig_fx.c +++ b/lib_dec/ivas_corecoder_dec_reconfig_fx.c @@ -602,7 +602,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbAnalyses_old; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -622,7 +622,7 @@ ivas_error ivas_cldfb_dec_reconfig_fx( /* create additional CLDFB synthesis instances */ FOR( i = numCldfbSyntheses_old; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, hDecoderConfig->output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 236eaad54..1ab797ded 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2264,7 +2264,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbAnalyses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -2276,7 +2276,7 @@ ivas_error ivas_init_decoder_fx( FOR( i = 0; i < numCldfbSyntheses; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index cc3980b12..12549f49d 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -438,7 +438,7 @@ ivas_error create_sce_dec( IF( EQ_16( (Word16) st_ivas->ivas_format, SBA_FORMAT ) && ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( (Word16) st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynHB, CLDFB_SYNTHESIS, st->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c index c8dde0837..5b1378a89 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec_fx.c @@ -601,7 +601,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -610,7 +610,7 @@ ivas_error initMdctStereoDtxData_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_stereo_switching_dec_fx.c b/lib_dec/ivas_stereo_switching_dec_fx.c index 34eef94ed..c70e606ac 100644 --- a/lib_dec/ivas_stereo_switching_dec_fx.c +++ b/lib_dec/ivas_stereo_switching_dec_fx.c @@ -205,7 +205,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbAna == NULL ) { /* open analysis for max. sampling rate 48kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -214,7 +214,7 @@ static ivas_error allocate_CoreCoder_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -752,7 +752,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbAna == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAna, CLDFB_ANALYSIS, 48000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -761,7 +761,7 @@ ivas_error stereo_memory_dec_fx( IF( st->cldfbBPF == NULL ) { /* open analysis BPF for max. internal sampling rate 16kHz */ - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbBPF, CLDFB_ANALYSIS, 16000, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -1100,7 +1100,7 @@ ivas_error stereo_memory_dec_fx( { IF( hCPE->hCoreCoder[i]->cldfbSyn == NULL ) /* could be NULL when we had the MCT LFE channel */ { - IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &hCPE->hCoreCoder[i]->cldfbSyn, CLDFB_SYNTHESIS, hCPE->hCoreCoder[i]->output_Fs, CLDFB_PROTOTYPE_1_25MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index f0338b461..cd5db5377 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1695,7 +1695,7 @@ ivas_error init_encoder_ivas_fx( test(); IF( ( NE_16( st->element_mode, IVAS_CPE_MDCT ) && idchan == 0 ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->Opt_DTX_ON ) ) { - IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) { return error; } @@ -1809,7 +1809,7 @@ ivas_error init_encoder_ivas_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_masa_enc_fx.c b/lib_enc/ivas_masa_enc_fx.c index 9fdebed7a..da1f836df 100644 --- a/lib_enc/ivas_masa_enc_fx.c +++ b/lib_enc/ivas_masa_enc_fx.c @@ -152,7 +152,7 @@ ivas_error ivas_masa_enc_open_fx( FOR( i = 0; i < hMasa->data.num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index 50fb49355..b5258712b 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -124,7 +124,7 @@ ivas_error ivas_omasa_enc_open_fx( move16(); FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_ENC ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, st_ivas->hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS, ENC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 6c7a1e68d..0a526561a 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -417,7 +417,7 @@ ivas_error stereo_memory_enc_fx( /* allocate CLDFB for primary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -433,7 +433,7 @@ ivas_error stereo_memory_enc_fx( IF( st->cldfbSynTd == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -587,7 +587,7 @@ ivas_error stereo_memory_enc_fx( FOR( i = 0; i < CPE_CHANNELS; i++ ) { st = hCPE->hCoreCoder[i]; - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index de9bc09b5..1544aab76 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -309,7 +309,7 @@ ivas_error stereo_set_tdm_fx( /* allocate CLDFB ana for secondary channel */ IF( st->cldfbAnaEnc == NULL ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } @@ -322,7 +322,7 @@ ivas_error stereo_set_tdm_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, IVAS_ENC ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_dirac_ana_fx.c b/lib_rend/ivas_dirac_ana_fx.c index 5dd3f8384..1a5013059 100644 --- a/lib_rend/ivas_dirac_ana_fx.c +++ b/lib_rend/ivas_dirac_ana_fx.c @@ -107,7 +107,7 @@ ivas_error ivas_dirac_ana_open_fx( move16(); FOR( i = 0; i < hDirAC->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_masa_merge_fx.c b/lib_rend/ivas_masa_merge_fx.c index 3aa9f62a9..c74477365 100644 --- a/lib_rend/ivas_masa_merge_fx.c +++ b/lib_rend/ivas_masa_merge_fx.c @@ -499,7 +499,7 @@ ivas_error masaPrerendOpen_fx( move16(); FOR( i = 0; i < hMasaPrerend->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ) != IVAS_ERR_OK ) + IF( ( error = openCldfb_ivas_fx( &( hMasaPrerend->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_rend/ivas_mcmasa_ana_fx.c b/lib_rend/ivas_mcmasa_ana_fx.c index d56ba2685..e17b2f9f6 100644 --- a/lib_rend/ivas_mcmasa_ana_fx.c +++ b/lib_rend/ivas_mcmasa_ana_fx.c @@ -224,7 +224,7 @@ ivas_error ivas_mcmasa_ana_open( move16(); FOR( i = 0; i < hMcMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMcMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_omasa_ana_fx.c b/lib_rend/ivas_omasa_ana_fx.c index 1d849a90f..5e175fae5 100644 --- a/lib_rend/ivas_omasa_ana_fx.c +++ b/lib_rend/ivas_omasa_ana_fx.c @@ -133,7 +133,7 @@ ivas_error ivas_omasa_ana_open( hOMasa->num_Cldfb_instances = numAnalysisChannels; FOR( i = 0; i < hOMasa->num_Cldfb_instances; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hOMasa->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 041f278f1..129f72388 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -8187,7 +8187,7 @@ static ivas_error initMasaExtRenderer( { FOR( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } @@ -8195,7 +8195,7 @@ static ivas_error initMasaExtRenderer( FOR( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, IVAS_DEC_REND ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS, DEC ) ), IVAS_ERR_OK ) ) { return error; } -- GitLab From 128cb148a9380ccff30b26f257b06eada4b205fd Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Thu, 27 Mar 2025 13:00:16 +0100 Subject: [PATCH 05/35] Improve accuracy of no_phi_masa_inv_fx table and remove all other azimuth/elevation roundings. --- lib_com/ivas_rom_com_fx.c | 15 +++++++++++++++ lib_dec/ivas_dirac_dec_fx.c | 14 +++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index a7a8bdcbf..ffb18d6d2 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -1545,6 +1545,7 @@ const Word16 ivas_param_mc_quant_icc_fx[PARAM_MC_SZ_ICC_QUANTIZER] = { /* from 1 to 11 bits*/ /*q factor = 8*/ const Word32 no_phi_masa_inv_fx[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = { +#ifndef FIX_1379_MASA_ANGLE_ROUND { 1073741824 }, { 536870912 }, { 536870912, 1073741824 }, @@ -1556,8 +1557,22 @@ const Word32 no_phi_masa_inv_fx[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = { { 44739242, 45691141, 47721858, 52377649, 61356675, 76695844, 107374182, 178956970, 1073741824, 2147483647 }, { 35791394, 35791394, 37025580, 38347922, 39768215, 42949672, 46684427, 52377649, 59652323, 71582788, 93368854, 126322567, 214748364, 2147483647 }, { 24129029, 24129029, 24403223, 24970740, 25565281, 26512143, 27889398, 29417584, 31580641, 34087042, 37675151, 42107522, 48806446, 56512727, 71582788, 93368854, 143165576, 268435456, 2147483647 } +#else + { 1073741824 }, + { 536870912 }, + { 536870912, 1073741824 }, + { 268435456, 536870912 }, + { 178956971, 306783378, 1073741824, 2147483647 }, + { 153391689, 165191050, 238609294, 1073741824, 2147483647 }, + { 97612893, 102261126, 126322568, 195225786, 715827883, 2147483647 }, + { 65075262, 67108864, 74051160, 93368854, 126322568, 238609294, 2147483647 }, + { 44739243, 45691141, 47721859, 52377650, 61356676, 76695845, 107374182, 178956971, 1073741824, 2147483647 }, + { 35791394, 35791394, 37025580, 38347922, 39768216, 42949673, 46684427, 52377650, 59652324, 71582788, 93368854, 126322568, 214748365, 2147483647 }, + { 24129030, 24129030, 24403223, 24970740, 25565282, 26512144, 27889398, 29417584, 31580642, 34087042, 37675152, 42107523, 48806447, 56512728, 71582788, 93368854, 143165577, 268435456, 2147483647 }, +#endif }; + const Word32 azimuth_cb_fx[8] = { 0, -754974720, -377487360, 377487360, -188743680, 188743680, -566231040, 566231040 }; diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index c72c0d6c8..bd49d13d6 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -1446,7 +1446,7 @@ void ivas_qmetadata_to_dirac_fx( { FOR( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { -#ifdef FIX_1379_MASA_ANGLE_ROUND +#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT hSpatParamRendCom->azimuth[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); move16(); hSpatParamRendCom->elevation[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); @@ -1501,7 +1501,7 @@ void ivas_qmetadata_to_dirac_fx( { FOR( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { -#ifdef FIX_1379_MASA_ANGLE_ROUND +#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT hSpatParamRendCom->azimuth2[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); move16(); hSpatParamRendCom->elevation2[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); @@ -1718,7 +1718,7 @@ void ivas_qmetadata_to_dirac_fx( IF( hodirac_flag ) { -#ifdef FIX_1379_MASA_ANGLE_ROUND +#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT azi = round_fx( L_shr( ( L_add( azimuth_fx, ONE_IN_Q21 ) ), 6 ) ); ele = round_fx( L_shr( ( L_add( elevation_fx, ONE_IN_Q21 ) ), 6 ) ); #else @@ -1760,7 +1760,7 @@ void ivas_qmetadata_to_dirac_fx( final_1_32 = BASOP_Util_Add_Mant32Exp( final_1_32, final_1_exp, ONE_IN_Q30, 0, &final_1_exp ); /*0.5 in q31*/ final_2_32 = BASOP_Util_Add_Mant32Exp( final_2_32, final_2_exp, ONE_IN_Q30, 0, &final_2_exp ); -#ifdef FIX_1379_MASA_ANGLE_ROUND +#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT azi = round_fx( L_shr( final_1_32, sub( sub( 31, final_1_exp ), 16 ) ) ); ele = round_fx( L_shr( final_2_32, sub( sub( 31, final_2_exp ), 16 ) ) ); #else @@ -3626,7 +3626,7 @@ void ivas_dirac_dec_render_sf_fx( { Word16 j, k, j2, l; Word16 num_objects, nchan_out_woLFE, lfe_index; -#ifndef FIX_1379_MASA_ANGLE_ROUND +#ifndef FIX_1379_MASA_ANGLE_ROUND_NOT Word16 az1, el1; #endif Word16 n_slots_to_render; @@ -3662,14 +3662,14 @@ void ivas_dirac_dec_render_sf_fx( Word16 el_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, Q22 ) ); Word32 az1_32, el1_32; rotateAziEle_fixed( az_q0, el_q0, &az1_32, &el1_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup ); -#ifndef FIX_1379_MASA_ANGLE_ROUND +#ifndef FIX_1379_MASA_ANGLE_ROUND_NOT az1 = extract_h( az1_32 ); el1 = extract_h( el1_32 ); #endif IF( st_ivas->hEFAPdata != NULL ) { -#ifdef FIX_1379_MASA_ANGLE_ROUND +#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT const Word32 azi_fx = L_shl( az1_32, Q22 - Q16 ); // Q16 -> Q22 const Word32 ele_fx = L_shl( el1_32, Q22 - Q16 ); // Q16 -> Q22 #else -- GitLab From 97754fe6471c6857bc76feb9de337b6513f58c63 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Thu, 27 Mar 2025 18:14:37 +0100 Subject: [PATCH 06/35] Remove wrong round_fx(). Reactivate simplification which also fixes instrumentation (implicit Word16 to Word32 conversion). --- lib_dec/ivas_dirac_dec_fx.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/lib_dec/ivas_dirac_dec_fx.c b/lib_dec/ivas_dirac_dec_fx.c index bd49d13d6..c06047113 100644 --- a/lib_dec/ivas_dirac_dec_fx.c +++ b/lib_dec/ivas_dirac_dec_fx.c @@ -1446,17 +1446,10 @@ void ivas_qmetadata_to_dirac_fx( { FOR( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { -#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT - hSpatParamRendCom->azimuth[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); - move16(); - hSpatParamRendCom->elevation[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); - move16(); -#else hSpatParamRendCom->azimuth[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); move16(); hSpatParamRendCom->elevation[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); move16(); -#endif hSpatParamRendCom->energy_ratio1_fx[meta_write_index][b] = q_direction->band_data[band].energy_ratio_fx[block]; move32(); hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b] = L_sub( ONE_IN_Q30, q_direction->band_data[band].energy_ratio_fx[block] ); @@ -1501,17 +1494,10 @@ void ivas_qmetadata_to_dirac_fx( { FOR( b = MASA_band_grouping_24[band_mapping[band]]; b < MASA_band_grouping_24[band_mapping[band + 1]]; ++b ) { -#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT - hSpatParamRendCom->azimuth2[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); - move16(); - hSpatParamRendCom->elevation2[meta_write_index][b] = round_fx( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); - move16(); -#else hSpatParamRendCom->azimuth2[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].azimuth_fx[block], 6 ) ); move16(); hSpatParamRendCom->elevation2[meta_write_index][b] = extract_h( L_shr( q_direction->band_data[band].elevation_fx[block], 6 ) ); move16(); -#endif hSpatParamRendCom->energy_ratio2_fx[meta_write_index][b] = q_direction->band_data[band].energy_ratio_fx[block]; move32(); hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b] = L_sub( hSpatParamRendCom->diffuseness_vector_fx[meta_write_index][b], q_direction->band_data[band].energy_ratio_fx[block] ); @@ -1718,13 +1704,8 @@ void ivas_qmetadata_to_dirac_fx( IF( hodirac_flag ) { -#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT - azi = round_fx( L_shr( ( L_add( azimuth_fx, ONE_IN_Q21 ) ), 6 ) ); - ele = round_fx( L_shr( ( L_add( elevation_fx, ONE_IN_Q21 ) ), 6 ) ); -#else azi = extract_h( L_shr( ( L_add( azimuth_fx, ONE_IN_Q21 ) ), 6 ) ); ele = extract_h( L_shr( ( L_add( elevation_fx, ONE_IN_Q21 ) ), 6 ) ); -#endif /*addition of one to compensate precision loss*/ if ( azi < 0 ) { @@ -1760,13 +1741,8 @@ void ivas_qmetadata_to_dirac_fx( final_1_32 = BASOP_Util_Add_Mant32Exp( final_1_32, final_1_exp, ONE_IN_Q30, 0, &final_1_exp ); /*0.5 in q31*/ final_2_32 = BASOP_Util_Add_Mant32Exp( final_2_32, final_2_exp, ONE_IN_Q30, 0, &final_2_exp ); -#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT - azi = round_fx( L_shr( final_1_32, sub( sub( 31, final_1_exp ), 16 ) ) ); - ele = round_fx( L_shr( final_2_32, sub( sub( 31, final_2_exp ), 16 ) ) ); -#else azi = extract_h( L_shr( final_1_32, sub( sub( 31, final_1_exp ), 16 ) ) ); ele = extract_h( L_shr( final_2_32, sub( sub( 31, final_2_exp ), 16 ) ) ); -#endif /*addition of one to compensate precision loss*/ if ( azi < 0 ) @@ -3626,7 +3602,7 @@ void ivas_dirac_dec_render_sf_fx( { Word16 j, k, j2, l; Word16 num_objects, nchan_out_woLFE, lfe_index; -#ifndef FIX_1379_MASA_ANGLE_ROUND_NOT +#ifndef FIX_1379_MASA_ANGLE_ROUND Word16 az1, el1; #endif Word16 n_slots_to_render; @@ -3662,14 +3638,14 @@ void ivas_dirac_dec_render_sf_fx( Word16 el_q0 = extract_l( L_shr( st_ivas->hIsmMetaData[i]->elevation_fx, Q22 ) ); Word32 az1_32, el1_32; rotateAziEle_fixed( az_q0, el_q0, &az1_32, &el1_32, st_ivas->hCombinedOrientationData->Rmat_fx[0], st_ivas->hIntSetup.is_planar_setup ); -#ifndef FIX_1379_MASA_ANGLE_ROUND_NOT +#ifndef FIX_1379_MASA_ANGLE_ROUND az1 = extract_h( az1_32 ); el1 = extract_h( el1_32 ); #endif IF( st_ivas->hEFAPdata != NULL ) { -#ifdef FIX_1379_MASA_ANGLE_ROUND_NOT +#ifdef FIX_1379_MASA_ANGLE_ROUND const Word32 azi_fx = L_shl( az1_32, Q22 - Q16 ); // Q16 -> Q22 const Word32 ele_fx = L_shl( el1_32, Q22 - Q16 ); // Q16 -> Q22 #else -- GitLab From ff1ecd8743402a7cb90cffda09c2dc9c9bab382f Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 15:05:26 +0530 Subject: [PATCH 07/35] Q mismatch fix in stereo_icBWE_enc_ivas_fx stack --- lib_com/deemph.c | 11 ++--- lib_com/prot_fx.h | 1 - lib_dec/ivas_stereo_icbwe_dec_fx.c | 2 +- lib_enc/ivas_stereo_ica_enc_fx.c | 8 ++-- lib_enc/ivas_stereo_icbwe_enc_fx.c | 64 +++++++++++++++++++----------- 5 files changed, 49 insertions(+), 37 deletions(-) diff --git a/lib_com/deemph.c b/lib_com/deemph.c index c03a050bc..9bc20cb6f 100644 --- a/lib_com/deemph.c +++ b/lib_com/deemph.c @@ -41,26 +41,23 @@ void deemph_fx_32( - Word16 shift, /*scaled output*/ Word32 *signal, /* i/o: signal Qx*/ const Word16 mu, /* i : deemphasis factor Q15*/ const Word16 L, /* i : vector size */ - Word32 *mem /* i/o: memory (y[-1]) Qx+shift*/ + Word32 *mem /* i/o: memory (y[-1]) Qx*/ ) { Word16 i; - signal[0] = L_add( signal[0], Mpy_32_16_1( ( *mem ), mu ) ); /*Qx*/ + signal[0] = Madd_32_16( signal[0], *mem, mu ); // Qx move32(); FOR( i = 1; i < L; i++ ) { - signal[i] = L_add( signal[i], Mpy_32_16_1( signal[i - 1], mu ) ); /*Qx*/ - signal[i] = L_shl( signal[i], shift ); /*Qx+shift*/ - move32(); + signal[i] = Madd_32_16( signal[i], signal[i - 1], mu ); // Qx move32(); } - *mem = signal[L - 1]; /*Qx+shift*/ + *mem = signal[L - 1]; // Qx move32(); return; diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 851b461bf..ffd1d6032 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -1651,7 +1651,6 @@ void deemph_fx( void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, Word16 *mem ); void deemph_fx_32( - Word16 shift, /* i : scaled output */ Word32 *signal, /* i/o: signal */ const Word16 mu, /* i : deemphasis factor */ const Word16 L, /* i : vector size */ diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index c9f7cac92..c7bc98566 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -611,7 +611,7 @@ void stereo_icBWE_dec_fx( Q_syn_shb = tmp; move16(); - deemph_fx_32( 0, shb_synth_nonref_fx + L_SHB_LAHEAD, specMapping_fx, L_FRAME16k, &( hStereoICBWE->memShbSpecMapping_fx ) ); + deemph_fx_32( shb_synth_nonref_fx + L_SHB_LAHEAD, specMapping_fx, L_FRAME16k, &( hStereoICBWE->memShbSpecMapping_fx ) ); hStereoICBWE->prev_Q_memshbspec = Q_syn_shb; move16(); Copy32( shb_synth_nonref_fx + L_FRAME16k, hStereoICBWE->mem_syn_shb_nonref_fx, L_SHB_LAHEAD ); /* Q_syn_shb */ diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 78ea50d7e..a8a088f20 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -408,8 +408,8 @@ static void deEmphResample_fx( /* De-emphasis, 1/(1-mu z^-1), and resample, stage 1 */ - deemph_fx_32( 0, buf1_fx, PREEMPH_FAC_16k, input_frame, &hStereoTCA->memdecim_fx[0] ); - deemph_fx_32( 0, buf2_fx, PREEMPH_FAC_16k, input_frame, &hStereoTCA->memdecim_fx[1] ); + deemph_fx_32( buf1_fx, PREEMPH_FAC_16k, input_frame, &hStereoTCA->memdecim_fx[0] ); + deemph_fx_32( buf2_fx, PREEMPH_FAC_16k, input_frame, &hStereoTCA->memdecim_fx[1] ); FOR( i = 0; i < ( input_frame / dsFac1 ); i++ ) { @@ -420,8 +420,8 @@ static void deEmphResample_fx( } /* De-emphasis, 1/(1-mu z^-1), and resample, stage 2 */ - deemph_fx_32( 0, tempBuf1_fx, PREEMPH_FAC_16k, idiv1616( input_frame, dsFac1 ), &hStereoTCA->memdecim_fx[2] ); - deemph_fx_32( 0, tempBuf2_fx, PREEMPH_FAC_16k, idiv1616( input_frame, dsFac1 ), &hStereoTCA->memdecim_fx[3] ); + deemph_fx_32( tempBuf1_fx, PREEMPH_FAC_16k, idiv1616( input_frame, dsFac1 ), &hStereoTCA->memdecim_fx[2] ); + deemph_fx_32( tempBuf2_fx, PREEMPH_FAC_16k, idiv1616( input_frame, dsFac1 ), &hStereoTCA->memdecim_fx[3] ); FOR( i = 0; i < ( input_frame / dsFactor ); i++ ) { diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 02d20543b..eba30f762 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -102,14 +102,15 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( const Word32 *shb_frame_target_fx, /* i : target shb Q31-shb_frame_target_e*/ Word16 shb_frame_target_e, Word32 *shb_synth_nonref_fx, /* o : non-ref shb synth Q31-shb_synth_nonref_e*/ - Word16 shb_synth_nonref_e, + Word16 *shb_synth_nonref_e, Word32 *specMapping_fx, /* i/o: current frame's mapping Qx*/ - Word32 *memShbSpecMapping_fx, /* i/o: current frame's mapping Qx*/ - Word32 *memShbSpecXcorr_fx, /* i/o: ic bwe spec mapping scorr memory Q31-memShbSpecXcorr_e*/ + Word32 *memShbSpecMapping_fx, /* i/o: current frame's mapping Q31-memShbSpecMapping_e*/ + Word16 *memShbSpecMapping_e, + Word32 *memShbSpecXcorr_fx, /* i/o: ic bwe spec mapping scorr memory Q31-memShbSpecXcorr_e*/ Word16 *memShbSpecXcorr_e ) { Word16 idx; - + Word16 max_exp; Word16 Txx1_fx = 0, Txx2_fx = 0, Txx3_fx = 0, T_desired_fx = 0; Word16 Txx1_e = 0, Txx2_e = 0, Txx3_e = 0, T_desired_e = 0; Word16 T_nonref_target_fx, temp_fx; @@ -136,10 +137,10 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( temp11_fx = dotp_fixed_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx + 1, shb_frame_target_e, L_FRAME16k - 1, &temp11_exp ); /* Q31-temp1_exp */ /* Calculate rxx(1)/rxx(0) of the non ref synth */ - temp0_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, shb_synth_nonref_e, shb_synth_nonref_fx, shb_synth_nonref_e, L_FRAME16k - 3, &temp0_exp ); /* Q31-temp0_exp */ - temp1_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, shb_synth_nonref_e, shb_synth_nonref_fx + 1, shb_synth_nonref_e, L_FRAME16k - 3, &temp1_exp ); /* Q31-temp1_exp */ - temp2_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, shb_synth_nonref_e, shb_synth_nonref_fx + 2, shb_synth_nonref_e, L_FRAME16k - 3, &temp2_exp ); /* Q31-temp2_exp */ - temp3_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, shb_synth_nonref_e, shb_synth_nonref_fx + 3, shb_synth_nonref_e, L_FRAME16k - 3, &temp3_exp ); /* Q31-temp3_exp */ + temp0_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx, *shb_synth_nonref_e, L_FRAME16k - 3, &temp0_exp ); /* Q31-temp0_exp */ + temp1_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 1, *shb_synth_nonref_e, L_FRAME16k - 3, &temp1_exp ); /* Q31-temp1_exp */ + temp2_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 2, *shb_synth_nonref_e, L_FRAME16k - 3, &temp2_exp ); /* Q31-temp2_exp */ + temp3_fx = dotp_fixed_ivas_fx( shb_synth_nonref_fx, *shb_synth_nonref_e, shb_synth_nonref_fx + 3, *shb_synth_nonref_e, L_FRAME16k - 3, &temp3_exp ); /* Q31-temp3_exp */ exp = s_max( *memShbSpecXcorr_e, s_max( s_max( s_max( temp00_exp, temp11_exp ), s_max( temp0_exp, temp1_exp ) ), s_max( temp2_exp, temp3_exp ) ) ); @@ -291,8 +292,19 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( *specMapping_fx = L_deposit_h( specMapping16 ); move32(); + max_exp = s_max( sub( *memShbSpecMapping_e, norm_l( *memShbSpecMapping_fx ) ), *shb_synth_nonref_e ); + + *memShbSpecMapping_fx = L_shl( *memShbSpecMapping_fx, sub( *memShbSpecMapping_e, max_exp ) ); // max_exp + move32(); + *memShbSpecMapping_e = max_exp; + move16(); + + scale_sig32( shb_synth_nonref_fx, L_FRAME16k, sub( *shb_synth_nonref_e, max_exp ) ); // max_exp + *shb_synth_nonref_e = max_exp; + move16(); + /* IC-BWE spec mapping */ - deemph_fx_32( 0, shb_synth_nonref_fx, extract_h( *specMapping_fx ), L_FRAME16k, memShbSpecMapping_fx ); + deemph_fx_32( shb_synth_nonref_fx, specMapping16, L_FRAME16k, memShbSpecMapping_fx ); // shb_synth_nonref_e return idx; } @@ -429,7 +441,7 @@ static void icbwe_dft_stereo_param_ivas_fx( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i : */ Encoder_State *st, /* i/o: */ Word32 *shb_synth_nonref_fx, /* i/o: Q31-shb_synth_nonref_e*/ - Word16 shb_synth_nonref_e /* i/o: */ + Word16 *shb_synth_nonref_e /* i/o: */ ) { Word16 slopeILD_fx; @@ -439,7 +451,7 @@ static void icbwe_dft_stereo_param_ivas_fx( Word32 *nrg_L_fx, *nrg_R_fx, *nrg_DMX_fx; Word32 sum_nrg_L_fx, sum_nrg_R_fx, sum_nrg_DMX_fx; const Word32 spec_table_fx[4] = { -1288490189, -858993459, -429496730, 0 }; // Q31 - const Word16 slope_table_fx16[4] = { -17788, -10577, -4822, 0 }; // Q13 + const Word16 slope_table_fx16[4] = { -278, -165, -75, 0 }; // Q7 BSTR_ENC_HANDLE hBstr = st->hBstr; normFac_fx = 1342177280; /* 1000 * (10/((14400+10400)/2 - (6400+10400)/2)) */ // Q29 @@ -505,6 +517,7 @@ static void icbwe_dft_stereo_param_ivas_fx( IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) ) { /* Spec Mapping Estimate */ + Word16 max_exp; Word16 tmp1, exp1; Word32 L_tmp, L_tmp1; L_tmp = Mpy_32_32( hStereoICBWE->mem_nrg_L_fx[1], hStereoICBWE->mem_nrg_R_fx[0] ); // hStereoICBWE->mem_nrg_L_fx_e[1] + hStereoICBWE->mem_nrg_R_fx_e[1] @@ -527,10 +540,20 @@ static void icbwe_dft_stereo_param_ivas_fx( } hStereoICBWE->prevSpecMapping_fx = spec_table_fx[spIndx]; // q31 - /* ic bwe spec mapping application */ - deemph_fx_32( 0, shb_synth_nonref_fx, extract_l( L_shr( hStereoICBWE->prevSpecMapping_fx, 16 ) ), L_FRAME16k, &hStereoICBWE->memShbSpecMapping_fx ); // shb_synth_nonref_e - hStereoICBWE->memShbSpecMapping_e = shb_synth_nonref_e; + + max_exp = s_max( *shb_synth_nonref_e, sub( hStereoICBWE->memShbSpecMapping_e, norm_l( hStereoICBWE->memShbSpecMapping_fx ) ) ); + + hStereoICBWE->memShbSpecMapping_fx = L_shl( hStereoICBWE->memShbSpecMapping_fx, sub( hStereoICBWE->memShbSpecMapping_e, max_exp ) ); // max_exp + move32(); + hStereoICBWE->memShbSpecMapping_e = max_exp; + move16(); + + scale_sig32( shb_synth_nonref_fx, L_FRAME16k, sub( *shb_synth_nonref_e, max_exp ) ); + *shb_synth_nonref_e = max_exp; move16(); + + /* ic bwe spec mapping application */ + deemph_fx_32( shb_synth_nonref_fx, extract_h( hStereoICBWE->prevSpecMapping_fx ), L_FRAME16k, &hStereoICBWE->memShbSpecMapping_fx ); // shb_synth_nonref_e } ELSE { @@ -572,7 +595,7 @@ static void icbwe_dft_stereo_param_ivas_fx( move32(); move16(); - gsIndx = ic_bwe_enc_gsMapping_ivas_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */ + gsIndx = ic_bwe_enc_gsMapping_ivas_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */ hStereoICBWE->gDes_pastFrame_fx = L_deposit_h( gDes_fx ); /* Q31-exp */ hStereoICBWE->gDes_pastFrame_e = exp; @@ -800,7 +823,7 @@ void stereo_icBWE_enc_ivas_fx( move16(); } - icbwe_dft_stereo_param_ivas_fx( hStereoICBWE, hStereoDft, st, shb_synth_nonref_fx, shb_synth_nonref_e ); + icbwe_dft_stereo_param_ivas_fx( hStereoICBWE, hStereoDft, st, shb_synth_nonref_fx, &shb_synth_nonref_e ); } ELSE { @@ -1020,14 +1043,7 @@ void stereo_icBWE_enc_ivas_fx( IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) ) { /* IC BWE spectral mapping */ - Word32 max_abs_val; - maximum_abs_32_fx( shb_synth_nonref_fx, L_FRAME16k, &max_abs_val ); - IF( max_abs_val > 0 ) - { - scale_sig32( shb_synth_nonref_fx, L_FRAME16k, -1 ); - shb_synth_nonref_e = sub( shb_synth_nonref_e, -1 ); - } - spIndx = ic_bwe_enc_specMapping_ivas_fx( shb_frame_nonref_fx, shb_frame_nonref_e, shb_synth_nonref_fx, shb_synth_nonref_e, &( hStereoICBWE->prevSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_fx ), hStereoICBWE->memShbSpecXcorr_fx, &( hStereoICBWE->memShbSpecXcorr_e ) ); /* Q0 */ + spIndx = ic_bwe_enc_specMapping_ivas_fx( shb_frame_nonref_fx, shb_frame_nonref_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_e ), hStereoICBWE->memShbSpecXcorr_fx, &( hStereoICBWE->memShbSpecXcorr_e ) ); /* Q0 */ } ELSE { -- GitLab From eb76c9cb525514513b14b663f4a9f7bce45ab6b8 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 28 Mar 2025 16:33:13 +0530 Subject: [PATCH 08/35] Crash fix when Debugging mode was enabled --- lib_enc/ivas_core_pre_proc_front_fx.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 0eb6d1887..ec752e71a 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -242,8 +242,16 @@ ivas_error pre_proc_front_ivas_fx( move16(); #ifdef DEBUG_MODE_INFO - in_buff_temp = hSCE->hCoreCoder[n]->input32_fx; - in_q_temp = hSCE->hCoreCoder[n]->q_inp32; + IF( hSCE != NULL ) + { + in_buff_temp = hSCE->hCoreCoder[n]->input32_fx; + in_q_temp = hSCE->hCoreCoder[n]->q_inp32; + } + ELSE + { + in_buff_temp = hCPE->hCoreCoder[n]->input32_fx; + in_q_temp = hCPE->hCoreCoder[n]->q_inp32; + } #endif -- GitLab From 7e5738514934f1352dbda55ef54544ff955754b8 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 26 Mar 2025 14:54:23 +0100 Subject: [PATCH 09/35] minimal code cleanup in ivas_smc_gmm_fx(). There were two unncessary IF clauses which could be replaced with L_max. --- lib_enc/speech_music_classif_fx.c | 49 ++++++++++++------------------- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 63c0d5d54..189e6a8e2 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -856,16 +856,8 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { /*mx = PS_norm[i] > st->past_PS[i] ? PS_norm[i] : st->past_PS[i];*/ - IF( GT_32( PS_norm[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ) ) - { - mx = PS_norm[i]; - move16(); /*Q25 */ - } - ELSE - { - mx = hSpMusClas->past_PS_fx[i - LOWEST_FBIN]; - move16(); /*Q25 */ - } + mx = L_max( PS_norm[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); + move16(); /*Q25 */ /*ps_sta += mx / (dPS[i] + 1e-5f);*/ IF( !dPS[i] ) @@ -1611,7 +1603,7 @@ Word16 ivas_smc_gmm_fx( Word32 ps_fx[N_SMC_MIXTURES], pm_fx[N_SMC_MIXTURES], pn_fx[N_SMC_MIXTURES]; Word64 wprob_fx; Word32 fvm_fx[N_PCA_COEF]; - Word32 sum_PS_fx, ps_diff_fx, ps_sta_fx; + Word32 sum_PS_fx, ps_diff_fx; Word32 dlp_fx, wrelE_fx, wdrop_fx, wght_fx; Word32 wrise_fx; Word16 dlp_mean2var_fx; @@ -1989,32 +1981,29 @@ Word16 ivas_smc_gmm_fx( move32(); /* [14] ps_sta (spectral stationarity) */ - ps_sta_fx = 0; - move32(); - Word16 ps_sta_exp = 0; - move16(); - FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { - IF( GT_32( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ) ) + Word32 ps_sta_fx = 0; + move32(); + Word16 ps_sta_exp = 0; + move16(); + Word32 avoid_divide_by_zero; + avoid_divide_by_zero = L_shr( 21475, sub( 31, Qfact_PS_past ) ); // 21475 = 1e-5 in Q31 + FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { - temp32 = BASOP_Util_Divide3232_Scale_cadence( PS_norm_fx[i], ( L_add( dPS_fx[i], L_shr( 21475, sub( 31, Qfact_PS_past ) ) ) ), &temp_exp ); // 31-temp_exp + Word32 tmp_max; + tmp_max = L_max(PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); + + temp32 = BASOP_Util_Divide3232_Scale_cadence( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp move32(); ps_sta_fx = BASOP_Util_Add_Mant32Exp( temp32, temp_exp, ps_sta_fx, ps_sta_exp, &ps_sta_exp ); move32(); } - ELSE - { - // ps_sta += hSpMusClas->past_PS[i - LOWEST_FBIN] / ( dPS[i] + 1e-5f ); - temp32 = BASOP_Util_Divide3232_Scale_cadence( hSpMusClas->past_PS_fx[i - LOWEST_FBIN], ( L_add( dPS_fx[i], L_shr( 21475, sub( 31, Qfact_PS_past ) ) ) ), &temp_exp ); // 31-temp_exp - ps_sta_fx = BASOP_Util_Add_Mant32Exp( temp32, temp_exp, ps_sta_fx, ps_sta_exp, &ps_sta_exp ); - } + temp32_log = L_add( BASOP_Util_Log2( L_add_sat( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); + temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/ + *pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f ); + move32(); + MVR2R_WORD32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); } - // temp32_log = L_add( BASOP_Util_Log2( L_add( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); - temp32_log = L_add( BASOP_Util_Log2( L_add_sat( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); - temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/ - *pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f ); - move32(); - MVR2R_WORD32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); /* save ps_diff and ps_sta features for XTALK and UNCLR classifier */ IF( hStereoClassif != NULL ) -- GitLab From a4a0941a200ae798dd1e99b5e7ccf75e8645a244 Mon Sep 17 00:00:00 2001 From: Thomas Dettbarn Date: Wed, 26 Mar 2025 15:24:44 +0100 Subject: [PATCH 10/35] applied the clang patch. --- lib_enc/speech_music_classif_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index 189e6a8e2..c293ceb3d 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -1991,7 +1991,7 @@ Word16 ivas_smc_gmm_fx( FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { Word32 tmp_max; - tmp_max = L_max(PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); + tmp_max = L_max( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); temp32 = BASOP_Util_Divide3232_Scale_cadence( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp move32(); -- GitLab From dbb240ebb931eafa0778e3479c5e21f0edf0b833 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 28 Mar 2025 13:45:15 +0100 Subject: [PATCH 11/35] remove unnecessary moves16(), move32(), keep closer to original code --- lib_enc/speech_music_classif_fx.c | 40 ++++++++++++++----------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/lib_enc/speech_music_classif_fx.c b/lib_enc/speech_music_classif_fx.c index c293ceb3d..3f6449a0c 100644 --- a/lib_enc/speech_music_classif_fx.c +++ b/lib_enc/speech_music_classif_fx.c @@ -856,8 +856,7 @@ static Word16 sp_mus_classif_gmm_fx( /* o : decis FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { /*mx = PS_norm[i] > st->past_PS[i] ? PS_norm[i] : st->past_PS[i];*/ - mx = L_max( PS_norm[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); - move16(); /*Q25 */ + mx = L_max( PS_norm[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); /*Q25 */ /*ps_sta += mx / (dPS[i] + 1e-5f);*/ IF( !dPS[i] ) @@ -1981,29 +1980,26 @@ Word16 ivas_smc_gmm_fx( move32(); /* [14] ps_sta (spectral stationarity) */ + Word32 ps_sta_fx = 0; + move32(); + Word16 ps_sta_exp = 0; + move16(); + Word32 avoid_divide_by_zero; + avoid_divide_by_zero = L_shr( 21475, sub( 31, Qfact_PS_past ) ); // 21475 = 1e-5 in Q31 + + FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) { - Word32 ps_sta_fx = 0; - move32(); - Word16 ps_sta_exp = 0; - move16(); - Word32 avoid_divide_by_zero; - avoid_divide_by_zero = L_shr( 21475, sub( 31, Qfact_PS_past ) ); // 21475 = 1e-5 in Q31 - FOR( i = LOWEST_FBIN; i < HIGHEST_FBIN; i++ ) - { - Word32 tmp_max; - tmp_max = L_max( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); + Word32 tmp_max; + tmp_max = L_max( PS_norm_fx[i], hSpMusClas->past_PS_fx[i - LOWEST_FBIN] ); - temp32 = BASOP_Util_Divide3232_Scale_cadence( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp - move32(); - ps_sta_fx = BASOP_Util_Add_Mant32Exp( temp32, temp_exp, ps_sta_fx, ps_sta_exp, &ps_sta_exp ); - move32(); - } - temp32_log = L_add( BASOP_Util_Log2( L_add_sat( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); - temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/ - *pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f ); - move32(); - MVR2R_WORD32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); + temp32 = BASOP_Util_Divide3232_Scale_cadence( tmp_max, L_add( dPS_fx[i], avoid_divide_by_zero ), &temp_exp ); // 31-temp_exp + ps_sta_fx = BASOP_Util_Add_Mant32Exp( temp32, temp_exp, ps_sta_fx, ps_sta_exp, &ps_sta_exp ); } + temp32_log = L_add( BASOP_Util_Log2( L_add_sat( ps_sta_fx, L_shr( 21475, ps_sta_exp ) ) ), L_shl( ps_sta_exp, Q25 ) ); + temp32_log = Mpy_32_32( temp32_log, 1488522239 ); /*logf(x) = log2(x)*logf(2)*/ + *pFV_fx++ = L_shr( temp32_log, Q5 ); // logf( ps_sta + 1e-5f ); + move32(); + MVR2R_WORD32( &PS_norm_fx[LOWEST_FBIN], hSpMusClas->past_PS_fx, HIGHEST_FBIN - LOWEST_FBIN ); /* save ps_diff and ps_sta features for XTALK and UNCLR classifier */ IF( hStereoClassif != NULL ) -- GitLab From 7acfb9dbb809362d8822d6de601b99f4f60820ef Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 11 Feb 2025 14:53:41 +0100 Subject: [PATCH 12/35] improve high complexity of param_mc_prm_est: MC/7-1-4/128kBit reduced by 166 WMOPS --- lib_com/options.h | 17 +++++-- lib_enc/ivas_mc_param_enc_fx.c | 83 ++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index a25ba565e..e35eca130 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -68,9 +68,18 @@ #endif /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ -//#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ -#define OPT_AVOID_STATE_BUF_RESCALE /* Optimization made to avoid rescale of synth state buffer */ -#define FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, nonbe*/ -#define FIX_1310_SPEEDUP_ivas_dirac_dec_output_synthesis_process_slot /*FhG: WMOPS tuning, nonbe*/ #define FIX_1379_MASA_ANGLE_ROUND +#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS /* FhG: Defines 1.0f-weight variables, uses Madd operation instead of L_add_sat */ +#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS /* FhG: Splits single loop with IF-statements into two low-complex loops */ +#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_HQ_CONSTANTS /* FhG: IMPROVE PRECISION: Uses 1/6 and 1/20 in full-precise Q31 constants instead of Q15 */ +#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL /* FhG: Uses unique shift amount in each loop iteration */ +#define FIX_11_1_IVAS_SPAR_DEC_UPMIXER_SF_RND_COEFFS /* FhG ivas_spar_com.c: Zeroes very small negative coeffs via L_shr_r (was L_shr) */ +#define FIX_ISSUE_1237 /* VA: replacement of Copy_Scale_sig_16_32_DEPREC() that are doing 16 bits left shift by Copy_Scale_sig_16_32_no_sat() */ +#define FIX_ISSUE_1237_KEEP_EVS_BE /* VA: Fix to keep EVS bitexactness to 26.444 */ +#define FIX_ISSUE_1214 /* Ittiam: Fix for issue 1214: Energy leakage in IGF tiles for MDCT-stereo @64kbps SWB*/ +#define FIX_881_HILBERT_FILTER /* VA: improve the precision of the Hilbert filter to remove 2kHz unwanted tone */ +#define FIX_ISSUE_1245 /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/ +#define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ +#define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ +#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ #endif diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 039bbdf98..37ae4ef91 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -720,9 +720,16 @@ static void ivas_param_mc_param_est_enc_fx( } } +#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST + Word16 gb = find_guarded_bits_fx( l_ts ); + Word16 add20gb = add( 20, gb ); +#endif + FOR( ts = start_ts; ts < num_time_slots; ts++ ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST Word16 gb = find_guarded_bits_fx( l_ts ); +#endif ivas_fb_mixer_get_windowed_fr_fx( hParamMC->hFbMixer, pcm_in_fx, p_slot_frame_f_real_fx, p_slot_frame_f_imag_fx, l_ts, l_ts, hParamMC->hFbMixer->fb_cfg->num_in_chans, gb ); ivas_fb_mixer_update_prior_input_fx( hParamMC->hFbMixer, pcm_in_fx, l_ts, hParamMC->hFbMixer->fb_cfg->num_in_chans ); @@ -807,10 +814,25 @@ static void ivas_param_mc_param_est_enc_fx( { FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST a_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &a_e ); b_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &b_e ); c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); +#else + a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band]); + a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e); + a_e = sub(add20gb, a_e); + b_e = norm_l( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band] ); + b_fx = L_shl( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], b_e ); + b_e = sub( add20gb, b_e ); + c_e = norm_l( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band] ); + c_fx = L_shl( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], c_e ); + c_e = sub( add20gb, c_e ); + d_e = norm_l( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band] ); + d_fx = L_shl( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], d_e ); + d_e = sub( add20gb, d_e ); +#endif /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, c_fx ), add( a_e, c_e ), Mpy_32_32( b_fx, d_fx ), add( b_e, d_e ), &tmp_e ); @@ -841,6 +863,7 @@ static void ivas_param_mc_param_est_enc_fx( FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST dmx_real_fx[ch_idx1] = 0; move32(); dmx_real_e[ch_idx1] = 0; @@ -860,13 +883,49 @@ static void ivas_param_mc_param_est_enc_fx( move32(); p_dmx_fac_fx++; } +#else + Word32 real_fx = L_add(0, 0); + Word16 real_e = 0; + move16(); + Word32 imag_fx = L_add( 0, 0 ); + Word16 imag_e = 0; + move16(); + + FOR( inp_ch = 0; inp_ch < nchan_input; inp_ch++ ) + { + L_tmp = Mpy_32_32( slot_frame_f_real_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); + real_fx = BASOP_Util_Add_Mant32Exp( real_fx, real_e, L_tmp, add20gb, &real_e ); + L_tmp = Mpy_32_32( slot_frame_f_imag_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); + imag_fx = BASOP_Util_Add_Mant32Exp( imag_fx, imag_e, L_tmp, add( 20, gb ), &imag_e ); + p_dmx_fac_fx++; + } + dmx_real_fx[ch_idx1] = real_fx; + move32(); + dmx_real_e[ch_idx1] = real_e; + move16(); + dmx_imag_fx[ch_idx1] = imag_fx; + move32(); + dmx_imag_e[ch_idx1] = imag_e; + move16(); +#endif } /* Cx for transport channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { +#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST + a_fx = dmx_real_fx[ch_idx1]; + move32(); + a_e = dmx_real_e[ch_idx1]; + move16(); + b_fx = dmx_imag_fx[ch_idx1]; + move32(); + b_e = dmx_imag_e[ch_idx1]; + move16(); +#endif FOR( ch_idx2 = 0; ch_idx2 < nchan_transport; ++ch_idx2 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST a_fx = dmx_real_fx[ch_idx1]; move32(); a_e = dmx_real_e[ch_idx1]; @@ -888,6 +947,12 @@ static void ivas_param_mc_param_est_enc_fx( L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, c_fx ), add( a_e, c_e ), Mpy_32_32( b_fx, d_fx ), add( b_e, d_e ), &tmp_e ); Cx_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cx_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cx_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, &Cx_sum_e[cur_param_band][ch_idx1][ch_idx2] ); +#else + /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ + L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, dmx_real_fx[ch_idx2] ), add( a_e, dmx_real_e[ch_idx2] ), Mpy_32_32( b_fx, dmx_imag_fx[ch_idx2] ), add( b_e, dmx_imag_e[ch_idx2] ), &tmp_e ); + Cx_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cx_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cx_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, + &Cx_sum_e[cur_param_band][ch_idx1][ch_idx2] ); +#endif move32(); } } @@ -895,12 +960,30 @@ static void ivas_param_mc_param_est_enc_fx( /* Cy for input channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) { +#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST + a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band] ); + a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e ); + a_e = sub( add20gb, a_e ); + b_e = norm_l( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band] ); + b_fx = L_shl( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], b_e ); + b_e = sub( add20gb, b_e ); +#endif FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST a_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &a_e ); b_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &b_e ); c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); +#else + + c_e = norm_l( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band] ); + c_fx = L_shl( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], c_e ); + c_e = sub( add20gb, c_e ); + d_e = norm_l( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band] ); + d_fx = L_shl( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], d_e ); + d_e = sub( add20gb, d_e ); +#endif /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, c_fx ), add( a_e, c_e ), Mpy_32_32( b_fx, d_fx ), add( b_e, d_e ), &tmp_e ); -- GitLab From 26732f809b1397fe77800cf545d195caf95f3b92 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 11 Feb 2025 15:26:46 +0100 Subject: [PATCH 13/35] fix clang-fomat-issues --- lib_enc/ivas_mc_param_enc_fx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index 37ae4ef91..788273b94 100644 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -820,9 +820,9 @@ static void ivas_param_mc_param_est_enc_fx( c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); #else - a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band]); - a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e); - a_e = sub(add20gb, a_e); + a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band] ); + a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e ); + a_e = sub( add20gb, a_e ); b_e = norm_l( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band] ); b_fx = L_shl( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], b_e ); b_e = sub( add20gb, b_e ); @@ -884,7 +884,7 @@ static void ivas_param_mc_param_est_enc_fx( p_dmx_fac_fx++; } #else - Word32 real_fx = L_add(0, 0); + Word32 real_fx = L_add( 0, 0 ); Word16 real_e = 0; move16(); Word32 imag_fx = L_add( 0, 0 ); -- GitLab From 0a4281e6c2204efcd9d764477c2fb69f99a85b4e Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 13 Feb 2025 22:07:15 +0100 Subject: [PATCH 14/35] completed tuning of MC param: no more BE now --- lib_com/options.h | 3 +- lib_enc/ivas_mc_param_enc_fx.c | 59 ++++++++++++++++++++++++++++------ 2 files changed, 51 insertions(+), 11 deletions(-) mode change 100644 => 100755 lib_enc/ivas_mc_param_enc_fx.c diff --git a/lib_com/options.h b/lib_com/options.h index e35eca130..bfff1b66a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -81,5 +81,6 @@ #define FIX_ISSUE_1245 /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/ #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ #define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ -#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ +#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ +#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ #endif diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c old mode 100644 new mode 100755 index 788273b94..d150b1473 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -812,6 +812,24 @@ static void ivas_param_mc_param_est_enc_fx( /* Cy for input channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) { +#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST + a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band] ); + a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e ); + a_e = sub( add20gb, a_e ); + if ( a_fx == 0 ) + { + a_e = 0; + move16(); + } + b_e = norm_l( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band] ); + b_fx = L_shl( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], b_e ); + b_e = sub( add20gb, b_e ); + if ( b_fx == 0 ) + { + b_e = 0; + move16(); + } +#endif FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { #ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST @@ -820,20 +838,23 @@ static void ivas_param_mc_param_est_enc_fx( c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); #else - a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band] ); - a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e ); - a_e = sub( add20gb, a_e ); - b_e = norm_l( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band] ); - b_fx = L_shl( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], b_e ); - b_e = sub( add20gb, b_e ); c_e = norm_l( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band] ); c_fx = L_shl( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], c_e ); c_e = sub( add20gb, c_e ); + if ( c_fx == 0 ) + { + c_e = 0; + move16(); + } d_e = norm_l( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band] ); d_fx = L_shl( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], d_e ); d_e = sub( add20gb, d_e ); + if ( d_fx == 0 ) + { + d_e = 0; + move16(); + } #endif - /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, c_fx ), add( a_e, c_e ), Mpy_32_32( b_fx, d_fx ), add( b_e, d_e ), &tmp_e ); Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], @@ -896,7 +917,7 @@ static void ivas_param_mc_param_est_enc_fx( L_tmp = Mpy_32_32( slot_frame_f_real_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); real_fx = BASOP_Util_Add_Mant32Exp( real_fx, real_e, L_tmp, add20gb, &real_e ); L_tmp = Mpy_32_32( slot_frame_f_imag_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); - imag_fx = BASOP_Util_Add_Mant32Exp( imag_fx, imag_e, L_tmp, add( 20, gb ), &imag_e ); + imag_fx = BASOP_Util_Add_Mant32Exp( imag_fx, imag_e, L_tmp, add20gb, &imag_e ); p_dmx_fac_fx++; } dmx_real_fx[ch_idx1] = real_fx; @@ -964,9 +985,19 @@ static void ivas_param_mc_param_est_enc_fx( a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band] ); a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e ); a_e = sub( add20gb, a_e ); + if ( a_fx == 0 ) + { + a_e = 0; + move16(); + } b_e = norm_l( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band] ); b_fx = L_shl( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], b_e ); b_e = sub( add20gb, b_e ); + if ( b_fx == 0 ) + { + b_e = 0; + move16(); + } #endif FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { @@ -976,15 +1007,23 @@ static void ivas_param_mc_param_est_enc_fx( c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); d_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &d_e ); #else - c_e = norm_l( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band] ); c_fx = L_shl( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], c_e ); c_e = sub( add20gb, c_e ); + if ( c_fx == 0 ) + { + c_e = 0; + move16(); + } d_e = norm_l( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band] ); d_fx = L_shl( slot_frame_f_imag_fx[ch_idx2][cur_cldfb_band], d_e ); d_e = sub( add20gb, d_e ); + if ( d_fx == 0 ) + { + d_e = 0; + move16(); + } #endif - /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, c_fx ), add( a_e, c_e ), Mpy_32_32( b_fx, d_fx ), add( b_e, d_e ), &tmp_e ); Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, -- GitLab From a54e71469275581829e4f24cc5229f075e308393 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 10:23:33 +0100 Subject: [PATCH 15/35] version now with 2 macros for NONBE and BE code parts --- lib_enc/ivas_mc_param_enc_fx.c | 44 ++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index d150b1473..c1a8e5877 100755 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -720,14 +720,14 @@ static void ivas_param_mc_param_est_enc_fx( } } -#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#if defined( IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE ) || defined( IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE ) Word16 gb = find_guarded_bits_fx( l_ts ); Word16 add20gb = add( 20, gb ); #endif FOR( ts = start_ts; ts < num_time_slots; ts++ ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#if !defined( IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE ) && !defined( IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE ) Word16 gb = find_guarded_bits_fx( l_ts ); #endif ivas_fb_mixer_get_windowed_fr_fx( hParamMC->hFbMixer, pcm_in_fx, p_slot_frame_f_real_fx, p_slot_frame_f_imag_fx, l_ts, l_ts, hParamMC->hFbMixer->fb_cfg->num_in_chans, gb ); @@ -738,6 +738,7 @@ static void ivas_param_mc_param_est_enc_fx( FOR( i = 0; i < nchan_input; i++ ) { pcm_in_fx[i] += l_ts; + move32(); } /* Computing the downmix */ FOR( cur_param_band = 0; cur_param_band < hParamMC->max_param_band_abs_cov; cur_param_band++ ) @@ -755,6 +756,7 @@ static void ivas_param_mc_param_est_enc_fx( FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE dmx_real_fx[ch_idx1] = 0; move32(); dmx_real_e[ch_idx1] = 0; @@ -773,6 +775,28 @@ static void ivas_param_mc_param_est_enc_fx( move32(); p_dmx_fac_fx++; } +#else + Word32 real_fx = L_add(0,0); + Word16 real_e = add(0, 0); + Word32 imag_fx = L_add( 0, 0 ); + Word16 imag_e = add( 0, 0 ); + FOR( inp_ch = 0; inp_ch < nchan_input; inp_ch++ ) + { + L_tmp = Mpy_32_32( slot_frame_f_real_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); + real_fx = BASOP_Util_Add_Mant32Exp( real_fx, real_e, L_tmp, add20gb, &real_e ); + L_tmp = Mpy_32_32( slot_frame_f_imag_fx[inp_ch][cur_cldfb_band], ( *p_dmx_fac_fx ) ); + imag_fx = BASOP_Util_Add_Mant32Exp( imag_fx, imag_e, L_tmp, add20gb, &imag_e ); + p_dmx_fac_fx++; + } + dmx_real_fx[ch_idx1] = real_fx; + dmx_real_e[ch_idx1] = real_e; + dmx_imag_fx[ch_idx1] = imag_fx; + dmx_imag_e[ch_idx1] = imag_e; + move32(); + move16(); + move32(); + move16(); +#endif } /* Cx for transport channels */ @@ -812,7 +836,7 @@ static void ivas_param_mc_param_est_enc_fx( /* Cy for input channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) { -#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band] ); a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e ); a_e = sub( add20gb, a_e ); @@ -832,7 +856,7 @@ static void ivas_param_mc_param_est_enc_fx( #endif FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE a_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &a_e ); b_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &b_e ); c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); @@ -884,7 +908,7 @@ static void ivas_param_mc_param_est_enc_fx( FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE dmx_real_fx[ch_idx1] = 0; move32(); dmx_real_e[ch_idx1] = 0; @@ -934,7 +958,7 @@ static void ivas_param_mc_param_est_enc_fx( /* Cx for transport channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) { -#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE a_fx = dmx_real_fx[ch_idx1]; move32(); a_e = dmx_real_e[ch_idx1]; @@ -946,7 +970,7 @@ static void ivas_param_mc_param_est_enc_fx( #endif FOR( ch_idx2 = 0; ch_idx2 < nchan_transport; ++ch_idx2 ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE a_fx = dmx_real_fx[ch_idx1]; move32(); a_e = dmx_real_e[ch_idx1]; @@ -981,7 +1005,7 @@ static void ivas_param_mc_param_est_enc_fx( /* Cy for input channels */ FOR( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) { -#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifdef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE a_e = norm_l( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band] ); a_fx = L_shl( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], a_e ); a_e = sub( add20gb, a_e ); @@ -1001,7 +1025,7 @@ static void ivas_param_mc_param_est_enc_fx( #endif FOR( ch_idx2 = ch_idx1; ch_idx2 < nchan_input; ++ch_idx2 ) { -#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST +#ifndef IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE a_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &a_e ); b_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_imag_fx[ch_idx1][cur_cldfb_band], add( 20, gb ), 0, 0, &b_e ); c_fx = BASOP_Util_Add_Mant32Exp( slot_frame_f_real_fx[ch_idx2][cur_cldfb_band], add( 20, gb ), 0, 0, &c_e ); @@ -1028,7 +1052,7 @@ static void ivas_param_mc_param_est_enc_fx( L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, c_fx ), add( a_e, c_e ), Mpy_32_32( b_fx, d_fx ), add( b_e, d_e ), &tmp_e ); Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, &Cy_sum_e[cur_param_band][ch_idx1][ch_idx2] ); - move32(); +pri move32(); } } } -- GitLab From 10a3bd68e413c0a5632f78c975bbee1bd1ca2553 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 10:25:46 +0100 Subject: [PATCH 16/35] fix stupid typo --- lib_enc/ivas_mc_param_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c index c1a8e5877..1e681d030 100755 --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -1052,7 +1052,7 @@ static void ivas_param_mc_param_est_enc_fx( L_tmp = BASOP_Util_Add_Mant32Exp( Mpy_32_32( a_fx, c_fx ), add( a_e, c_e ), Mpy_32_32( b_fx, d_fx ), add( b_e, d_e ), &tmp_e ); Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2] = BASOP_Util_Add_Mant32Exp( Cy_sum_fx[cur_param_band][ch_idx1][ch_idx2], Cy_sum_e[cur_param_band][ch_idx1][ch_idx2], L_tmp, tmp_e, &Cy_sum_e[cur_param_band][ch_idx1][ch_idx2] ); -pri move32(); + move32(); } } } -- GitLab From 6116f7b9779c57d13914f1454bd8c7d8c7f19d83 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 10:28:27 +0100 Subject: [PATCH 17/35] fix clang-format-issues --- lib_enc/ivas_mc_param_enc_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100755 => 100644 lib_enc/ivas_mc_param_enc_fx.c diff --git a/lib_enc/ivas_mc_param_enc_fx.c b/lib_enc/ivas_mc_param_enc_fx.c old mode 100755 new mode 100644 index 1e681d030..92cd33e2f --- a/lib_enc/ivas_mc_param_enc_fx.c +++ b/lib_enc/ivas_mc_param_enc_fx.c @@ -776,8 +776,8 @@ static void ivas_param_mc_param_est_enc_fx( p_dmx_fac_fx++; } #else - Word32 real_fx = L_add(0,0); - Word16 real_e = add(0, 0); + Word32 real_fx = L_add( 0, 0 ); + Word16 real_e = add( 0, 0 ); Word32 imag_fx = L_add( 0, 0 ); Word16 imag_e = add( 0, 0 ); FOR( inp_ch = 0; inp_ch < nchan_input; inp_ch++ ) -- GitLab From 05442c393d4e0db6bc2c220fcfbf1ecf2c40cacb Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 11:32:40 +0100 Subject: [PATCH 18/35] deactivated temporarily the NONBE part of this MR to check the pipeline results --- lib_com/options.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index bfff1b66a..c83adeb3a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -81,6 +81,11 @@ #define FIX_ISSUE_1245 /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/ #define FIX_MINOR_SVD_WMOPS_MR1010X /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */ #define SVD_WMOPS_OPT /* Ittiam : SVD related optimizations */ -#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ -#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ +// #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ +/* Both following 2 macros (IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST*) are independent from each other, they refer to different code blocks */ +#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ +//#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ +#define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ +#define FIX_ISSUE_1279 /* VA: correction of wrong scaling update */ +#define FIX_ISSUE_1247 #endif -- GitLab From fc387514c9302e926028e13f5bdd8c150f8fc743 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Feb 2025 14:57:16 +0100 Subject: [PATCH 19/35] reactivated NONBE modifications to see pipeline effects --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index c83adeb3a..6b0cbedc8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -84,7 +84,7 @@ // #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ /* Both following 2 macros (IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST*) are independent from each other, they refer to different code blocks */ #define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_BE /* FhG: reduces WMOPS of param_mc_prm_est, bit-exact to previous version */ -//#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ +#define IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE /* FhG: reduces WMOPS of param_mc_prm_est, not bit-exact to previous version */ #define NONBE_FIX_1087_OOB_SBA_DTX_RS /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */ #define FIX_ISSUE_1279 /* VA: correction of wrong scaling update */ #define FIX_ISSUE_1247 -- GitLab From a580e8872979581d899534faa09f43d79d8b76dc Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 13:55:52 -0400 Subject: [PATCH 20/35] replace EVS push_indice_fx with push_indice (from IVAS) --- lib_com/bitstream_fx.c | 6 +-- lib_com/gs_gains_fx.c | 28 ++++++------- lib_com/hq_tools_fx.c | 4 +- lib_com/pvq_com_fx.c | 2 +- lib_enc/FEC_enc_fx.c | 6 +-- lib_enc/acelp_core_enc_fx.c | 4 +- lib_enc/acelp_core_switch_enc_fx.c | 8 ++-- lib_enc/amr_wb_enc_fx.c | 2 +- lib_enc/avq_cod_fx.c | 20 +++++----- lib_enc/cng_enc_fx.c | 24 +++++------ lib_enc/cod2t32_fx.c | 6 +-- lib_enc/cod4t64_fx.c | 30 +++++++------- lib_enc/decision_matrix_enc_fx.c | 64 +++++++++++++++--------------- lib_enc/enc_amr_wb_fx.c | 4 +- lib_enc/enc_gen_voic_fx.c | 6 +-- lib_enc/enc_higher_acelp_fx.c | 4 +- lib_enc/enc_pit_exc_fx.c | 6 +-- lib_enc/enc_tran_fx.c | 62 ++++++++++++++--------------- lib_enc/enc_uv_fx.c | 2 +- lib_enc/eval_pit_contr_fx.c | 6 +-- lib_enc/fd_cng_enc_fx.c | 12 +++--- lib_enc/gain_enc_fx.c | 20 +++++----- lib_enc/gaus_enc_fx.c | 6 +-- lib_enc/gs_enc_fx.c | 20 +++++----- lib_enc/hq_classifier_enc_fx.c | 8 ++-- lib_enc/hq_core_enc_fx.c | 8 ++-- lib_enc/hq_env_enc_fx.c | 24 +++++------ lib_enc/hq_hr_enc_fx.c | 4 +- lib_enc/hq_lr_enc_fx.c | 62 ++++++++++++++--------------- lib_enc/hvq_enc_fx.c | 2 +- lib_enc/isf_enc_amr_wb_fx.c | 34 ++++++++-------- lib_enc/lsf_enc_fx.c | 18 ++++----- lib_enc/nelp_enc_fx.c | 8 ++-- lib_enc/peak_vq_enc_fx.c | 36 ++++++++--------- lib_enc/pit_enc_fx.c | 8 ++-- lib_enc/ppp_enc_fx.c | 8 ++-- lib_enc/range_enc_fx.c | 8 ++-- lib_enc/stat_noise_uv_enc_fx.c | 2 +- lib_enc/swb_bwe_enc_fx.c | 46 ++++++++++----------- lib_enc/swb_bwe_enc_hr_fx.c | 22 +++++----- lib_enc/swb_bwe_enc_lr_fx.c | 6 +-- lib_enc/swb_tbe_enc_fx.c | 28 ++++++------- lib_enc/tcq_core_enc_fx.c | 4 +- lib_enc/transition_enc_fx.c | 36 ++++++++--------- lib_enc/voiced_enc_fx.c | 2 +- 45 files changed, 363 insertions(+), 363 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index e144c2cc9..667958264 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -240,11 +240,11 @@ Word16 rate2EVSmode( } /*-------------------------------------------------------------------* - * push_indice_fx( ) + * push_indice( ) * * Push a new indice into the buffer *-------------------------------------------------------------------*/ - +#if 0 void push_indice_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ Word16 id, /* i : ID of the indice */ @@ -288,7 +288,7 @@ void push_indice_fx( return; } - +#endif /*-------------------------------------------------------------------* * push_next_indice_fx() * * Push a new indice into the buffer at the next position diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index 35236b603..ecfe9aae0 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -1028,7 +1028,7 @@ Word16 gsc_gainQ_fx( /*Q12*/ mean_4g[0] = round_fx( L_tmp ); move16(); idx_g = vquant_fx( mean_4g, Gain_meanNB_fx, mean_4g, Gain_mean_dicNB_fx, 1, 64 ); - push_indice_fx( hBstr, IND_MEAN_GAIN2, idx_g, 6 ); + push_indice( hBstr, IND_MEAN_GAIN2, idx_g, 6 ); FOR( i = 0; i < Mbands_gn; i++ ) { @@ -1040,21 +1040,21 @@ Word16 gsc_gainQ_fx( /*Q12*/ move16(); set16_fx( y_gain_tmp + 10, 0, MBANDS_GN - 10 ); idx_g = vquant_fx( y_gain_tmp, Mean_dic_NB_fx, y_gain_tmp, Gain_dic1_NB_fx, 3, 64 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); IF( LT_32( core_brate, ACELP_9k60 ) ) { idx_g = vquant_fx( y_gain_tmp + 3, Mean_dic_NB_fx + 3, y_gain_tmp + 3, Gain_dic2_NB_fx, 3, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp + 6, Mean_dic_NB_fx + 6, y_gain_tmp + 6, Gain_dic3_NB_fx, 4, 16 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); } ELSE { idx_g = vquant_fx( y_gain_tmp + 3, Mean_dic_NB_fx + 3, y_gain_tmp + 3, Gain_dic2_NBHR_fx, 3, 64 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 6, Mean_dic_NB_fx + 6, y_gain_tmp + 6, Gain_dic3_NBHR_fx, 4, 128 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 7 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 7 ); } /*add end */ test(); @@ -1122,7 +1122,7 @@ Word16 gsc_gainQ_fx( /*Q12*/ move16(); idx_g = vquant_fx( mean_4g, mean_m_fx, mean_4g, mean_gain_dic_fx, 1, 64 ); - push_indice_fx( hBstr, IND_MEAN_GAIN2, idx_g, 6 ); + push_indice( hBstr, IND_MEAN_GAIN2, idx_g, 6 ); FOR( i = 0; i < Mbands_gn; i++ ) { @@ -1148,11 +1148,11 @@ Word16 gsc_gainQ_fx( /*Q12*/ move16(); idx_g = vquant_fx( y_gain_tmp2, YGain_mean_LR_fx, y_gain_tmp2, YGain_dic1_LR_fx, 3, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp2 + 3, YGain_mean_LR_fx + 3, y_gain_tmp2 + 3, YGain_dic2_LR_fx, 4, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp2 + 7, YGain_mean_LR_fx + 7, y_gain_tmp2 + 7, YGain_dic3_LR_fx, 5, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); set16_fx( y_gain_tmp2 + 12, 0, MBANDS_GN - 12 ); /* Update to quantized vector */ @@ -1185,13 +1185,13 @@ Word16 gsc_gainQ_fx( /*Q12*/ ELSE { idx_g = vquant_fx( y_gain_tmp, YG_mean16_fx, y_gain_tmp, YG_dicMR_1_fx, 4, 64 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 6 ); idx_g = vquant_fx( y_gain_tmp + 4, YG_mean16_fx + 4, y_gain_tmp + 4, YG_dicMR_2_fx, 4, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp + 8, YG_mean16_fx + 8, y_gain_tmp + 8, YG_dicMR_3_fx, 4, 32 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); idx_g = vquant_fx( y_gain_tmp + 12, YG_mean16_fx + 12, y_gain_tmp + 12, YG_dicMR_4_fx, 4, 16 ); - push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); + push_indice( hBstr, IND_Y_GAIN_TMP, idx_g, 4 ); } } diff --git a/lib_com/hq_tools_fx.c b/lib_com/hq_tools_fx.c index cf3ce202e..0e00b9428 100644 --- a/lib_com/hq_tools_fx.c +++ b/lib_com/hq_tools_fx.c @@ -2036,7 +2036,7 @@ Word16 calc_nor_delta_hf_fx( /* updating norm & storing delta norm */ add_bits_denv = 2; move16(); - push_indice_fx( hBstr, IND_DELTA_ENV_HQ, sub( bitsforDelta, 2 ), 2 ); + push_indice( hBstr, IND_DELTA_ENV_HQ, sub( bitsforDelta, 2 ), 2 ); FOR( i = num_env_bands; i < nb_sfm; ++i ) { IF( Rsubband[i] != 0 ) @@ -2052,7 +2052,7 @@ Word16 calc_nor_delta_hf_fx( delta = min_delta; /*Q0*/ move16(); } - push_indice_fx( hBstr, IND_DELTA_ENV_HQ, delta - min_delta, bitsforDelta ); + push_indice( hBstr, IND_DELTA_ENV_HQ, delta - min_delta, bitsforDelta ); ynrm[i] = add( ynrm[i], delta ); /*Q0*/ move16(); add_bits_denv = add( add_bits_denv, bitsforDelta ); diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 479bc04d9..9cf1226d8 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -622,7 +622,7 @@ void fine_gain_quant_fx( gain_db = round_fx_sat( L_shl_o( L_tmp, 17, &Overflow ) ); idx = squant_fx( gain_db, &gain_dbq, finegain_fx[gbits - 1], gain_cb_size[gbits - 1] ); - push_indice_fx( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); + push_indice( hBstr, IND_PVQ_FINE_GAIN, idx, gbits ); L_tmp = L_mult0( gain_dbq, 21771 ); /* 21771=0.05*log2(10) */ /* 14+17=31 */ L_tmp = L_shr( L_tmp, 15 ); /* Q16 */ diff --git a/lib_enc/FEC_enc_fx.c b/lib_enc/FEC_enc_fx.c index 87243e8d2..69b14eb9b 100644 --- a/lib_enc/FEC_enc_fx.c +++ b/lib_enc/FEC_enc_fx.c @@ -94,7 +94,7 @@ void FEC_encode_fx( index = 3; move16(); } - push_indice_fx( hBstr, IND_FEC_CLAS, index, FEC_BITS_CLS ); + push_indice( hBstr, IND_FEC_CLAS, index, FEC_BITS_CLS ); } /*-----------------------------------------------------------------* @@ -117,7 +117,7 @@ void FEC_encode_fx( tmpS = s_min( tmpS, 31 ); tmpS = s_max( tmpS, 0 ); - push_indice_fx( hBstr, IND_FEC_ENR, tmpS, FEC_BITS_ENR ); + push_indice( hBstr, IND_FEC_ENR, tmpS, FEC_BITS_ENR ); } /*-----------------------------------------------------------------* * Encode last glottal pulse position (8 bits) @@ -157,7 +157,7 @@ void FEC_encode_fx( maxi = add( maxi, 128 ); /* use 8 bits (MSB represent the sign of the pulse) Q0*/ } - push_indice_fx( hBstr, IND_FEC_POS, maxi, FEC_BITS_POS ); + push_indice( hBstr, IND_FEC_POS, maxi, FEC_BITS_POS ); } maxi = 0; move16(); diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index f9f941dbd..795f03403 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -472,7 +472,7 @@ ivas_error acelp_core_enc_fx( IF( nb_bits > 0 ) { Es_pred_enc_fx( &Es_pred_fx, &indice, st_fx->L_frame, res_fx, st_fx->voicing_fx, nb_bits, 0, Q_new ); - push_indice_fx( st_fx->hBstr, IND_ES_PRED, indice, nb_bits ); + push_indice( st_fx->hBstr, IND_ES_PRED, indice, nb_bits ); } @@ -619,7 +619,7 @@ ivas_error acelp_core_enc_fx( WHILE( nBits > 0 ) { i = s_min( nBits, 16 ); // Q0 - push_indice_fx( st_fx->hBstr, IND_UNUSED, 0, i ); + push_indice( st_fx->hBstr, IND_UNUSED, 0, i ); nBits = sub( nBits, i ); // Q0 } } diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index f9058b9b9..9b0ed8b58 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -441,7 +441,7 @@ static void encod_gen_voic_core_switch_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } /*-----------------------------------------------------------------* @@ -489,7 +489,7 @@ static void encod_gen_voic_core_switch_fx( /* write reserved bits */ IF( unbits ) { - push_indice_fx( hBstr, IND_UNUSED, 0, unbits ); + push_indice( hBstr, IND_UNUSED, 0, unbits ); } /*-----------------------------------------------------------------* @@ -838,7 +838,7 @@ static void bwe_switch_enc_fx( } } - push_indice_fx( hBstr, IND_CORE_SWITCHING_AUDIO_DELAY, d1m_fx, AUDIODELAYBITS ); + push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_DELAY, d1m_fx, AUDIODELAYBITS ); tmp = add( i_mult2( d1m_fx, delta_fx ), fdelay_fx ); /* Q0 */ ptmp = &hb_synth_tmp_fx[tmp]; /* Q0 */ @@ -867,7 +867,7 @@ static void bwe_switch_enc_fx( L_tmp1 = L_shl( L_tmp1, sub( q_tmp2, 24 ) ); gain_fx = round_fx_o( Isqrt( L_tmp1 ), &Overflow ); /*Q12 */ ind1_fx = usquant_fx( gain_fx, &gain_fx, shr( MINVALUEOFFIRSTGAIN_FX, 1 ), shr( DELTAOFFIRSTGAIN_FX, 4 ), ( 1 << NOOFGAINBITS1 ) ); /* Q0 */ - push_indice_fx( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); + push_indice( hBstr, IND_CORE_SWITCHING_AUDIO_GAIN, ind1_fx, NOOFGAINBITS1 ); return; } diff --git a/lib_enc/amr_wb_enc_fx.c b/lib_enc/amr_wb_enc_fx.c index b1b2257e2..6f46e5c12 100644 --- a/lib_enc/amr_wb_enc_fx.c +++ b/lib_enc/amr_wb_enc_fx.c @@ -548,7 +548,7 @@ void amr_wb_enc_fx( * Write VAD information into the bitstream in AMR-WB IO mode *--------------------------------------------------------------------------------------*/ - push_indice_fx( st->hBstr, IND_VAD_FLAG, st->vad_flag, 1 ); + push_indice( st->hBstr, IND_VAD_FLAG, st->vad_flag, 1 ); } /*-----------------------------------------------------------------* diff --git a/lib_enc/avq_cod_fx.c b/lib_enc/avq_cod_fx.c index 962b715cd..b3a49c59e 100644 --- a/lib_enc/avq_cod_fx.c +++ b/lib_enc/avq_cod_fx.c @@ -384,20 +384,20 @@ void AVQ_encmux_fx( /* write the unary code */ FOR( ; j > 16; j -= 16 ) { - push_indice_fx( hBstr, nq_ind, 65535, 16 ); + push_indice( hBstr, nq_ind, 65535, 16 ); bits = sub( bits, 16 ); } IF( j > 0 ) { - push_indice_fx( hBstr, nq_ind, extract_l( L_sub( L_shl( 1L, j ), 1L ) ), j ); + push_indice( hBstr, nq_ind, extract_l( L_sub( L_shl( 1L, j ), 1L ) ), j ); bits = sub( bits, j ); } } IF( !overflow ) { /* write the stop bit */ - push_indice_fx( hBstr, nq_ind, 0, 1 ); + push_indice( hBstr, nq_ind, 0, 1 ); bits = sub( bits, 1 ); } @@ -506,13 +506,13 @@ void AVQ_encmux_fx( IF( j > 0 ) { /* write the unary code */ - push_indice_fx( hBstr, nq_ind, sub( shl( 1, j ), 1 ), j ); + push_indice( hBstr, nq_ind, sub( shl( 1, j ), 1 ), j ); } IF( nq[i] != 0 ) { /* write the stop bit */ - push_indice_fx( hBstr, nq_ind, 0, 1 ); + push_indice( hBstr, nq_ind, 0, 1 ); } /*Compute AVQ code book number from unused Bits */ @@ -1099,32 +1099,32 @@ static void wrte_cv( ELSE IF( LT_16( nq, 5 ) ) /* Q2, Q3, Q4 */ { nq4 = shl( nq, 2 ); - push_indice_fx( hBstr, i_ind, I, nq4 ); + push_indice( hBstr, i_ind, I, nq4 ); bits = sub( bits, nq4 ); } ELSE IF( EQ_16( s_and( nq, 1 ), 0 ) ) /* Q4 + Voronoi extensions r=1,2,3,... */ { - push_indice_fx( hBstr, i_ind, I, 4 * 4 ); + push_indice( hBstr, i_ind, I, 4 * 4 ); bits = sub( bits, 4 * 4 ); /*pos = (int16_t)(nq / 2 - 2);*/ /* Voronoi order determination */ pos = sub( shr( nq, 1 ), 2 ); FOR( j = 0; j < 8; j++ ) { - push_indice_fx( hBstr, kv_ind, kv[j], pos ); + push_indice( hBstr, kv_ind, kv[j], pos ); } bits = sub( bits, shl( pos, 3 ) ); } ELSE /* Q3 + Voronoi extensions r=1,2,3,... */ { - push_indice_fx( hBstr, i_ind, I, 4 * 3 ); + push_indice( hBstr, i_ind, I, 4 * 3 ); bits = sub( bits, 4 * 3 ); /*pos = (int16_t)(nq / 2 - 1);*/ /* Voronoi order determination */ pos = sub( shr( nq, 1 ), 1 ); FOR( j = 0; j < 8; j++ ) { - push_indice_fx( hBstr, kv_ind, kv[j], pos ); + push_indice( hBstr, kv_ind, kv[j], pos ); } bits = sub( bits, shl( pos, 3 ) ); diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index e2b29ba59..221454970 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -975,7 +975,7 @@ void CNG_enc_fx( hTdCngEnc->old_enr_index = enr_index; move16(); - push_indice_fx( hBstr, IND_ENERGY, enr_index, num_bits ); + push_indice( hBstr, IND_ENERGY, enr_index, num_bits ); if ( enr_index == 0 ) { enr_index = -5; @@ -1063,7 +1063,7 @@ void CNG_enc_fx( move16(); } } - push_indice_fx( hBstr, IND_CNG_ENV1, min1_idx, 6 ); + push_indice( hBstr, IND_CNG_ENV1, min1_idx, 6 ); /* get quantized res_env_details */ FOR( i = 0; i < NUM_ENV_CNG; i++ ) { @@ -1122,28 +1122,28 @@ void CNG_enc_fx( /* dithering bit for AMR-WB IO mode is always set to 0 */ IF( EQ_32( st_fx->core_brate, SID_1k75 ) ) { - push_indice_fx( hBstr, IND_DITHERING, 0, 1 ); + push_indice( hBstr, IND_DITHERING, 0, 1 ); } IF( EQ_32( st_fx->core_brate, SID_2k40 ) ) { IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { - push_indice_fx( hBstr, IND_ACELP_16KHZ, 1, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, 1, 1 ); } ELSE { - push_indice_fx( hBstr, IND_ACELP_16KHZ, 0, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, 0, 1 ); } - push_indice_fx( hBstr, IND_CNG_HO, s_min( hTdCngEnc->burst_ho_cnt, 7 ), 3 ); + push_indice( hBstr, IND_CNG_HO, s_min( hTdCngEnc->burst_ho_cnt, 7 ), 3 ); hTdCngEnc->num_ho = m; move16(); - push_indice_fx( hBstr, IND_SID_TYPE, 0, 1 ); + push_indice( hBstr, IND_SID_TYPE, 0, 1 ); test(); IF( LT_32( st_fx->input_Fs, 32000 ) && NE_16( st_fx->element_mode, IVAS_CPE_DFT ) ) { - push_indice_fx( hBstr, IND_SID_BW, 0, 1 ); + push_indice( hBstr, IND_SID_BW, 0, 1 ); *sid_bw = 0; move16(); } @@ -2458,8 +2458,8 @@ static void shb_CNG_encod_fx( idx_ener_fx = s_max( idx_ener_fx, 0 ); } - push_indice_fx( hBstr, IND_SHB_CNG_GAIN, idx_ener_fx, 4 ); - push_indice_fx( hBstr, IND_SID_BW, 1, 1 ); + push_indice( hBstr, IND_SHB_CNG_GAIN, idx_ener_fx, 4 ); + push_indice( hBstr, IND_SID_BW, 1, 1 ); hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, hBstr->ind_list[IND_CNG_ENV1].nb_bits ); hBstr->ind_list[IND_CNG_ENV1].nb_bits = -1; move16(); @@ -2470,7 +2470,7 @@ static void shb_CNG_encod_fx( } else { - push_indice_fx( hBstr, IND_UNUSED, 0, 2 ); + push_indice( hBstr, IND_UNUSED, 0, 2 ); } hTdCngEnc->ho_sid_bw = L_shl( L_and( hTdCngEnc->ho_sid_bw, (Word32) 0x3fffffffL ), 1 ); hTdCngEnc->ho_sid_bw = L_or( hTdCngEnc->ho_sid_bw, 0x1L ); @@ -2482,7 +2482,7 @@ static void shb_CNG_encod_fx( IF( EQ_32( st_fx->core_brate, SID_2k40 ) ) { hTdCngEnc->ho_sid_bw = L_shl( L_and( hTdCngEnc->ho_sid_bw, (Word32) 0x3fffffffL ), 1 ); - push_indice_fx( hBstr, IND_SID_BW, 0, 1 ); + push_indice( hBstr, IND_SID_BW, 0, 1 ); } } diff --git a/lib_enc/cod2t32_fx.c b/lib_enc/cod2t32_fx.c index a948a4656..dc967e656 100644 --- a/lib_enc/cod2t32_fx.c +++ b/lib_enc/cod2t32_fx.c @@ -292,7 +292,7 @@ void acelp_2t32_fx( } { /* write index to array of indices */ - push_indice_fx( hBstr, IND_ALG_CDBK_2T32, index, 12 ); + push_indice( hBstr, IND_ALG_CDBK_2T32, index, 12 ); } return; } @@ -636,11 +636,11 @@ void acelp_1t64_fx( } IF( EQ_16( L_subfr, L_SUBFR ) ) { - push_indice_fx( hBstr, IND_ALG_CDBK_1T64, index, 7 ); + push_indice( hBstr, IND_ALG_CDBK_1T64, index, 7 ); } ELSE /* L_subfr == 2*L_SUBFR */ { - push_indice_fx( hBstr, IND_ALG_CDBK_1T64, index, 8 ); + push_indice( hBstr, IND_ALG_CDBK_1T64, index, 8 ); } return; diff --git a/lib_enc/cod4t64_fx.c b/lib_enc/cod4t64_fx.c index 99b794b42..457a129b8 100644 --- a/lib_enc/cod4t64_fx.c +++ b/lib_enc/cod4t64_fx.c @@ -330,11 +330,11 @@ Word16 acelp_4t64_fx( bitcnt = s_and( nbbits, 15 ); FOR( i = 0; i < wordcnt; i++ ) { - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], 16 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], 16 ); } IF( bitcnt ) { - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], bitcnt ); + push_indice( hBstr, IND_ALG_CDBK_4T64, indexing_indices[i], bitcnt ); } } ELSE @@ -347,7 +347,7 @@ Word16 acelp_4t64_fx( { k = i_mult2( track, NPMAXPT ); index = quant_1p_N1_fx( ind[k], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 5 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 5 ); } } ELSE IF( EQ_16( nbbits, 36 ) ) @@ -357,7 +357,7 @@ Word16 acelp_4t64_fx( k = i_mult2( track, NPMAXPT ); /* k = track * NPMAXPT;*/ index = quant_2p_2N1_fx( ind[k], ind[k + 1], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 9 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 ); } } ELSE IF( EQ_16( nbbits, 44 ) ) /* AMR-WB pulse indexing */ @@ -366,14 +366,14 @@ Word16 acelp_4t64_fx( { k = i_mult2( track, NPMAXPT ); index = quant_3p_3N1_fx( ind[k], ind[k + 1], ind[k + 2], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 13 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 ); } FOR( track = 2; track < NB_TRACK_FCB_4T; track++ ) { k = i_mult2( track, NPMAXPT ); index = quant_2p_2N1_fx( ind[k], ind[k + 1], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 9 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 9 ); } } ELSE IF( EQ_16( nbbits, 52 ) ) /* AMR-WB pulse indexing */ @@ -382,7 +382,7 @@ Word16 acelp_4t64_fx( { k = i_mult2( track, NPMAXPT ); index = quant_3p_3N1_fx( ind[k], ind[k + 1], ind[k + 2], 4 ); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64, index, 13 ); + push_indice( hBstr, IND_ALG_CDBK_4T64, index, 13 ); } } ELSE IF( EQ_16( nbbits, 64 ) ) /* AMR-WB pulse indexing */ @@ -393,7 +393,7 @@ Word16 acelp_4t64_fx( L_index = quant_4p_4N_fx( &ind[k], 4 ); index = extract_l( L_shr( L_index, 14 ) & 3 ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); } FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) @@ -402,7 +402,7 @@ Word16 acelp_4t64_fx( L_index = quant_4p_4N_fx( &ind[k], 4 ); index = extract_l( L_index & 0x3FFF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); } } ELSE IF( EQ_16( nbbits, 72 ) ) @@ -413,7 +413,7 @@ Word16 acelp_4t64_fx( L_index = quant_5p_5N_fx( &ind[k], 4 ); index = extract_l( L_shr( L_index, 10 ) & 0x03FF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_1, index, 10 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 10 ); } FOR( track = 2; track < NB_TRACK_FCB_4T; track++ ) @@ -422,7 +422,7 @@ Word16 acelp_4t64_fx( L_index = quant_4p_4N_fx( &ind[k], 4 ); index = extract_l( L_shr( L_index, 14 ) & 3 ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 2 ); } FOR( track = 0; track < ( NB_TRACK_FCB_4T - 2 ); track++ ) @@ -431,7 +431,7 @@ Word16 acelp_4t64_fx( L_index = quant_5p_5N_fx( &ind[k], 4 ); index = extract_l( L_index & 0x03FF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_2, index, 10 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 10 ); } FOR( track = 2; track < NB_TRACK_FCB_4T; track++ ) @@ -440,7 +440,7 @@ Word16 acelp_4t64_fx( L_index = quant_4p_4N_fx( &ind[k], 4 ); index = extract_l( L_index & 0x3FFF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 14 ); } } ELSE IF( EQ_16( nbbits, 88 ) ) @@ -451,7 +451,7 @@ Word16 acelp_4t64_fx( L_index = quant_6p_6N_2_fx( &ind[k], 4 ); index = extract_l( L_shr( L_index, 11 ) & 0x07FF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_1, index, 11 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_1, index, 11 ); } FOR( track = 0; track < NB_TRACK_FCB_4T; track++ ) @@ -460,7 +460,7 @@ Word16 acelp_4t64_fx( L_index = quant_6p_6N_2_fx( &ind[k], 4 ); index = extract_l( L_index & 0x07FF ); logic16(); - push_indice_fx( hBstr, IND_ALG_CDBK_4T64_2, index, 11 ); + push_indice( hBstr, IND_ALG_CDBK_4T64_2, index, 11 ); } } } diff --git a/lib_enc/decision_matrix_enc_fx.c b/lib_enc/decision_matrix_enc_fx.c index c95bc9d5b..63a13aa1a 100644 --- a/lib_enc/decision_matrix_enc_fx.c +++ b/lib_enc/decision_matrix_enc_fx.c @@ -449,14 +449,14 @@ Word16 signalling_mode1_tcx20_enc_fx( num_bits = add( num_bits, nBits ); IF( push != 0 ) { - push_indice_fx( hBstr, IND_ACELP_SIGNALLING, sub( idx, start_idx ), nBits ); + push_indice( hBstr, IND_ACELP_SIGNALLING, sub( idx, start_idx ), nBits ); } /* HQ/TCX core switching flag */ num_bits = add( num_bits, 1 ); IF( push != 0 ) { - push_indice_fx( hBstr, IND_MDCT_CORE, 1, 1 ); + push_indice( hBstr, IND_MDCT_CORE, 1, 1 ); } } ELSE @@ -467,7 +467,7 @@ Word16 signalling_mode1_tcx20_enc_fx( num_bits = add( num_bits, 1 ); IF( push != 0 ) { - push_indice_fx( hBstr, IND_CORE, 1, 1 ); + push_indice( hBstr, IND_CORE, 1, 1 ); } } @@ -475,7 +475,7 @@ Word16 signalling_mode1_tcx20_enc_fx( num_bits = add( num_bits, 1 ); IF( push != 0 ) { - push_indice_fx( hBstr, IND_MDCT_CORE, 1, 1 ); + push_indice( hBstr, IND_MDCT_CORE, 1, 1 ); } num_bits = add( num_bits, 2 ); @@ -484,19 +484,19 @@ Word16 signalling_mode1_tcx20_enc_fx( /* write band-width (needed for different I/O sampling rate support) */ IF( EQ_16( st->bwidth, NB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 0, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 0, 2 ); } ELSE IF( EQ_16( st->bwidth, WB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 1, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 1, 2 ); } ELSE IF( EQ_16( st->bwidth, SWB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 2, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 2, 2 ); } ELSE /* st->bwidth == FB */ { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 3, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 3, 2 ); } } } @@ -534,21 +534,21 @@ void signalling_enc_fx( test(); IF( ( st_fx->last_core == ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) { - push_indice_fx( hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); + push_indice( hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); /* write ACELP L_frame info */ IF( EQ_16( st_fx->last_L_frame, L_FRAME ) ) { - push_indice_fx( hBstr, IND_LAST_L_FRAME, 0, 1 ); + push_indice( hBstr, IND_LAST_L_FRAME, 0, 1 ); } ELSE { - push_indice_fx( hBstr, IND_LAST_L_FRAME, 1, 1 ); + push_indice( hBstr, IND_LAST_L_FRAME, 1, 1 ); } } ELSE { - push_indice_fx( hBstr, IND_HQ_SWITCHING_FLG, 0, 1 ); + push_indice( hBstr, IND_HQ_SWITCHING_FLG, 0, 1 ); } return; @@ -574,7 +574,7 @@ void signalling_enc_fx( IF( EQ_16( ppp_mode, 1 ) || EQ_16( nelp_mode, 1 ) ) { /* 1 bit to distinguish between 2.8kbps PPP/NELP frame and SID frame */ - push_indice_fx( hBstr, IND_CORE, 0, 1 ); + push_indice( hBstr, IND_CORE, 0, 1 ); /* SC-VBR: 0 - PPP_NB, 1 - PPP_WB, 2 - NELP_NB, 3 - NELP_WB */ test(); test(); @@ -586,19 +586,19 @@ void signalling_enc_fx( test(); IF( EQ_16( st_fx->coder_type, VOICED ) && EQ_16( st_fx->bwidth, NB ) && EQ_16( ppp_mode, 1 ) ) { - push_indice_fx( hBstr, IND_PPP_NELP_MODE, 0, 2 ); + push_indice( hBstr, IND_PPP_NELP_MODE, 0, 2 ); } ELSE IF( EQ_16( st_fx->coder_type, VOICED ) && NE_16( st_fx->bwidth, NB ) && EQ_16( ppp_mode, 1 ) ) { - push_indice_fx( hBstr, IND_PPP_NELP_MODE, 1, 2 ); + push_indice( hBstr, IND_PPP_NELP_MODE, 1, 2 ); } ELSE IF( EQ_16( st_fx->coder_type, UNVOICED ) && EQ_16( st_fx->bwidth, NB ) && EQ_16( nelp_mode, 1 ) ) { - push_indice_fx( hBstr, IND_PPP_NELP_MODE, 2, 2 ); + push_indice( hBstr, IND_PPP_NELP_MODE, 2, 2 ); } ELSE IF( EQ_16( st_fx->coder_type, UNVOICED ) && NE_16( st_fx->bwidth, NB ) && EQ_16( nelp_mode, 1 ) ) { - push_indice_fx( hBstr, IND_PPP_NELP_MODE, 3, 2 ); + push_indice( hBstr, IND_PPP_NELP_MODE, 3, 2 ); } } ELSE IF( NE_32( st_fx->core_brate, SID_2k40 ) && ( st_fx->core_brate != FRAME_NO_DATA ) ) @@ -606,7 +606,7 @@ void signalling_enc_fx( /* write the ACELP/HQ core selection bit */ IF( GE_32( st_fx->total_brate, ACELP_24k40 ) ) { - push_indice_fx( hBstr, IND_CORE, 0, 1 ); + push_indice( hBstr, IND_CORE, 0, 1 ); } /* find the section in the ACELP signalling table corresponding to bitrate */ @@ -652,7 +652,7 @@ void signalling_enc_fx( idx++; } - push_indice_fx( hBstr, IND_ACELP_SIGNALLING, idx - start_idx, nBits ); + push_indice( hBstr, IND_ACELP_SIGNALLING, idx - start_idx, nBits ); } /* write extension layer flag to distinguish between TBE (0) and BWE (1) */ @@ -664,11 +664,11 @@ void signalling_enc_fx( test(); IF( EQ_16( st_fx->extl, WB_TBE ) || EQ_16( st_fx->extl, SWB_TBE ) || EQ_16( st_fx->extl, FB_TBE ) ) { - push_indice_fx( hBstr, IND_BWE_FLAG, 0, 1 ); + push_indice( hBstr, IND_BWE_FLAG, 0, 1 ); } ELSE IF( EQ_16( st_fx->extl, WB_BWE ) || EQ_16( st_fx->extl, SWB_BWE ) || EQ_16( st_fx->extl, FB_BWE ) ) { - push_indice_fx( hBstr, IND_BWE_FLAG, 1, 1 ); + push_indice( hBstr, IND_BWE_FLAG, 1, 1 ); } } } @@ -678,24 +678,24 @@ void signalling_enc_fx( test(); IF( ( st_fx->last_core == ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) { - push_indice_fx( hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); + push_indice( hBstr, IND_HQ_SWITCHING_FLG, 1, 1 ); /* write ACELP L_frame info */ IF( EQ_16( st_fx->last_L_frame, L_FRAME ) ) { - push_indice_fx( hBstr, IND_LAST_L_FRAME, 0, 1 ); + push_indice( hBstr, IND_LAST_L_FRAME, 0, 1 ); } ELSE { - push_indice_fx( hBstr, IND_LAST_L_FRAME, 1, 1 ); + push_indice( hBstr, IND_LAST_L_FRAME, 1, 1 ); } } ELSE { - push_indice_fx( hBstr, IND_HQ_SWITCHING_FLG, 0, 1 ); + push_indice( hBstr, IND_HQ_SWITCHING_FLG, 0, 1 ); } /* HQ/TCX core switching flag */ - push_indice_fx( hBstr, IND_MDCT_CORE, 0, 1 ); + push_indice( hBstr, IND_MDCT_CORE, 0, 1 ); /* Use ACELP signaling for LR MDCT */ IF( LE_32( st_fx->total_brate, ACELP_16k40 ) ) @@ -719,7 +719,7 @@ void signalling_enc_fx( idx++; } - push_indice_fx( hBstr, IND_ACELP_SIGNALLING, idx - start_idx, nBits ); + push_indice( hBstr, IND_ACELP_SIGNALLING, idx - start_idx, nBits ); } ELSE { @@ -727,25 +727,25 @@ void signalling_enc_fx( IF( LE_32( st_fx->core_brate, ACELP_64k ) ) { /* write ACELP/HQ core indication flag */ - push_indice_fx( hBstr, IND_CORE, 1, 1 ); + push_indice( hBstr, IND_CORE, 1, 1 ); } /* write band-width (needed for different I/O sampling rate support) */ IF( EQ_16( st_fx->bwidth, NB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 0, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 0, 2 ); } ELSE IF( EQ_16( st_fx->bwidth, WB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 1, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 1, 2 ); } ELSE IF( EQ_16( st_fx->bwidth, SWB ) ) { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 2, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 2, 2 ); } ELSE /* st_fx->bwidth == FB */ { - push_indice_fx( hBstr, IND_HQ_BWIDTH, 3, 2 ); + push_indice( hBstr, IND_HQ_BWIDTH, 3, 2 ); } } } diff --git a/lib_enc/enc_amr_wb_fx.c b/lib_enc/enc_amr_wb_fx.c index 08a20bbb9..4c5268017 100644 --- a/lib_enc/enc_amr_wb_fx.c +++ b/lib_enc/enc_amr_wb_fx.c @@ -170,7 +170,7 @@ void encod_amr_wb_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } /*-----------------------------------------------------------------* @@ -243,7 +243,7 @@ void encod_amr_wb_fx( hVAD->hangover_cnt, &hAmrwb_IO->gain_alpha_fx, &hf_gain_fx[i_subfr / L_SUBFR], add( Q_new, 1 ), st->Q_syn ); } - push_indice_fx( hBstr, IND_HF_GAIN_MODIFICATION, hf_gain_fx[i_subfr / L_SUBFR], 4 ); + push_indice( hBstr, IND_HF_GAIN_MODIFICATION, hf_gain_fx[i_subfr / L_SUBFR], 4 ); } p_Aw += ( M + 1 ); diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 62f740fb2..00c7d28d7 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -179,7 +179,7 @@ void encod_gen_voic_fx( move16(); } - push_indice_fx( hBstr, IND_HARM_FLAG_ACELP, harm_flag_acelp, 1 ); + push_indice( hBstr, IND_HARM_FLAG_ACELP, harm_flag_acelp, 1 ); } /*------------------------------------------------------------------* @@ -239,7 +239,7 @@ void encod_gen_voic_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit_fx;*/ @@ -387,7 +387,7 @@ void encod_gen_voic_fx( WHILE( unbits_PI_fx > 0 ) { i = s_min( unbits_PI_fx, 16 ); - push_indice_fx( hBstr, IND_UNUSED, 0, i ); + push_indice( hBstr, IND_UNUSED, 0, i ); unbits_PI_fx -= i; } IF( st_fx->Opt_SC_VBR ) diff --git a/lib_enc/enc_higher_acelp_fx.c b/lib_enc/enc_higher_acelp_fx.c index 64a11be5b..bf248bb5a 100644 --- a/lib_enc/enc_higher_acelp_fx.c +++ b/lib_enc/enc_higher_acelp_fx.c @@ -242,7 +242,7 @@ void transf_cdbk_enc_fx( Ltmp = L_shl( Ltmp, add( e_den, 9 ) ); /* Q18*/ *gain_preQ = round_fx( Ltmp ); /* Q2*/ } - push_indice_fx( st_fx->hBstr, IND_AVQ_GAIN, index, G_AVQ_BITS ); + push_indice( st_fx->hBstr, IND_AVQ_GAIN, index, G_AVQ_BITS ); /*--------------------------------------------------------------* * Encode and multiplex subvectors into bit-stream @@ -276,7 +276,7 @@ void transf_cdbk_enc_fx( WHILE( *unbits > 0 ) { i = s_min( *unbits, 16 ); - push_indice_fx( st_fx->hBstr, IND_UNUSED, 0, i ); + push_indice( st_fx->hBstr, IND_UNUSED, 0, i ); *unbits -= i; } } diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 957e41516..3cb2cc066 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -291,7 +291,7 @@ void enc_pit_exc_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit;*/ @@ -312,12 +312,12 @@ void enc_pit_exc_fx( IF( GE_32( st_fx->core_brate, MIN_RATE_FCB ) ) { pit_idx = vquant_fx( &gain_pit, mean_gp_fx, &gain_pit, dic_gp_fx, 1, 32 ); /* Q0 */ - push_indice_fx( hBstr, IND_PIT_IDX, pit_idx, 5 ); + push_indice( hBstr, IND_PIT_IDX, pit_idx, 5 ); } ELSE { pit_idx = vquant_fx( &gain_pit, mean_gp_fx, &gain_pit, dic_gp_fx, 1, 16 ); /* Q0 */ - push_indice_fx( hBstr, IND_PIT_IDX, pit_idx, 4 ); + push_indice( hBstr, IND_PIT_IDX, pit_idx, 4 ); } } else if ( use_fcb == 2 ) diff --git a/lib_enc/enc_tran_fx.c b/lib_enc/enc_tran_fx.c index 4cda393d5..d6935dd0c 100644 --- a/lib_enc/enc_tran_fx.c +++ b/lib_enc/enc_tran_fx.c @@ -327,7 +327,7 @@ Word16 encod_tran_fx( WHILE( unbits_PI > 0 ) { i = s_min( unbits_PI, 16 ); - push_indice_fx( hBstr, IND_UNUSED, 0, i ); + push_indice( hBstr, IND_UNUSED, 0, i ); unbits_PI -= i; } @@ -336,72 +336,72 @@ Word16 encod_tran_fx( { IF( EQ_16( tc_subfr, TC_0_0 ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, TC_0_64 ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, TC_0_128 ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); } ELSE IF( EQ_16( tc_subfr, TC_0_192 ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, 2 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } ELSE IF( EQ_16( tc_subfr, 3 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); } } ELSE /* L_frame == L_FRAME16k */ { IF( tc_subfr == 0 ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 2 ); } ELSE IF( EQ_16( tc_subfr, L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 2 ); } ELSE IF( EQ_16( tc_subfr, 2 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 2, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 2, 2 ); } ELSE IF( EQ_16( tc_subfr, 3 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 3, 2 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 0, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 3, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 0, 1 ); } ELSE IF( EQ_16( tc_subfr, 4 * L_SUBFR ) ) { - push_indice_fx( hBstr, IND_TC_SUBFR, 3, 2 ); - push_indice_fx( hBstr, IND_TC_SUBFR, 1, 1 ); + push_indice( hBstr, IND_TC_SUBFR, 3, 2 ); + push_indice( hBstr, IND_TC_SUBFR, 1, 1 ); } } diff --git a/lib_enc/enc_uv_fx.c b/lib_enc/enc_uv_fx.c index 8a77b9e2b..a8612725b 100644 --- a/lib_enc/enc_uv_fx.c +++ b/lib_enc/enc_uv_fx.c @@ -153,7 +153,7 @@ void encod_unvoiced_fx( #ifdef DEBUGGING assert( st_fx->acelp_cfg.gains_mode[i_subfr_idx] == 7 && "Error: UC two-stage, only 5+2 gain Q is supported" ); #endif - push_indice_fx( st_fx->hBstr, IND_GAIN, index, st_fx->acelp_cfg.gains_mode[i_subfr_idx] ); + push_indice( st_fx->hBstr, IND_GAIN, index, st_fx->acelp_cfg.gains_mode[i_subfr_idx] ); gp_clip_test_gain_pit_fx( st_fx->element_mode, st_fx->core_brate, gain_pit_fx, st_fx->clip_var_fx ); diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c index aef5fd637..df629f295 100644 --- a/lib_enc/eval_pit_contr_fx.c +++ b/lib_enc/eval_pit_contr_fx.c @@ -409,17 +409,17 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pit IF( EQ_16( st_fx->coder_type, INACTIVE ) ) { - push_indice_fx( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 1 ); + push_indice( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 1 ); } } ELSE { - push_indice_fx( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 3 ); + push_indice( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 3 ); } } ELSE { - push_indice_fx( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 4 ); + push_indice( hBstr, IND_PIT_CONTR_IDX, pit_contr_idx, 4 ); } return last_pit_bin; diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index e51e2b682..2eb13646c 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -1217,21 +1217,21 @@ void FdCng_encodeSID_fx( HANDLE_FD_CNG_ENC stenc, /* i/o: pointer to FD_CNG stru } ELSE { - push_indice_fx( hBstr, IND_SID_TYPE, 1, 1 ); - push_indice_fx( hBstr, IND_ACELP_16KHZ, corest->bwidth, 2 ); + push_indice( hBstr, IND_SID_TYPE, 1, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, corest->bwidth, 2 ); IF( EQ_16( corest->L_frame, L_FRAME16k ) ) { - push_indice_fx( hBstr, IND_ACELP_16KHZ, 1, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, 1, 1 ); } ELSE { - push_indice_fx( hBstr, IND_ACELP_16KHZ, 0, 1 ); + push_indice( hBstr, IND_ACELP_16KHZ, 0, 1 ); } FOR( i = 0; i < stages_37bits; i++ ) { - push_indice_fx( hBstr, IND_LSF, indices[i], bits_37bits[i] ); + push_indice( hBstr, IND_LSF, indices[i], bits_37bits[i] ); } - push_indice_fx( hBstr, IND_ENERGY, index, 7 ); + push_indice( hBstr, IND_ENERGY, index, 7 ); } /* Interpolate the bin/band-wise levels from the partition levels */ diff --git a/lib_enc/gain_enc_fx.c b/lib_enc/gain_enc_fx.c index 0321cd763..0ccb31ccf 100644 --- a/lib_enc/gain_enc_fx.c +++ b/lib_enc/gain_enc_fx.c @@ -428,7 +428,7 @@ void gain_enc_mless_fx( tmp1 = mult_r( G_PITCH_MAX_MINUS_MIN_TC192_Q13, div_s( 1, sub( shl( 1, nBits ), 1 ) ) ); /*Q13*/ /* set quantization step */ index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_TC192_Q14, tmp1, shl( 1, nBits ) ); move16(); - push_indice_fx( hBstr, IND_GAIN_PIT, index, nBits ); + push_indice( hBstr, IND_GAIN_PIT, index, nBits ); /* gain_code Q */ /**gain_code /= gcode0;*/ @@ -441,7 +441,7 @@ void gain_enc_mless_fx( } index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_TC192_Q14, LG10_G_CODE_MAX_TC192_Q13, nBits2, &expg ); - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits2 ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits2 ); L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ *gain_code = L_shl_o( L_tmp, add( add( expg, exp_gcode0 ), 15 ), &Overflow ); /*Q16*/ } @@ -508,7 +508,7 @@ void gain_enc_mless_fx( * search for the best quantizer *-----------------------------------------------------------------*/ index = Find_Opt_gainQ_fx( coeff, exp_coeff, gain_pit, gain_code, gcode0, exp_gcode0, qua_table, size ); // Q0 - push_indice_fx( hBstr, IND_GAIN, index, nBits ); + push_indice( hBstr, IND_GAIN, index, nBits ); } /* *norm_gain_code = *gain_code / *gain_inov; */ @@ -1108,7 +1108,7 @@ void gain_enc_SQ_fx( tmp1 = mult_r( G_PITCH_MAX_Q13, div_s( 1, sub( shl( 1, nBits_pitch ), 1 ) ) ); /*Q13*/ /* set quantization step */ index = usquant_fx( *gain_pit, gain_pit, G_PITCH_MIN_Q14, tmp1, shl( 1, nBits_pitch ) ); // Q0 - push_indice_fx( hBstr, IND_GAIN_PIT, index, nBits_pitch ); + push_indice( hBstr, IND_GAIN_PIT, index, nBits_pitch ); /* gain_code Q */ /* *gain_code /= gcode0; */ @@ -1121,7 +1121,7 @@ void gain_enc_SQ_fx( } index = gain_quant_fx( gain_code, &gain_code16, LG10_G_CODE_MIN_Q14, LG10_G_CODE_MAX_Q13, nBits_code, &expg ); - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits_code ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits_code ); L_tmp = L_mult( gain_code16, gcode0 ); /*Q0*Q0 -> Q1*/ *gain_code = L_shl_sat( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); move32(); /*Q16*/ @@ -1601,7 +1601,7 @@ void gain_enc_tc_fx( *gain_code_fx = L_shl( L_tmp, add( add( expg, exp_gcode0 ), 15 ) ); /*Q16*/ move32(); - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits ); } ELSE { @@ -1632,7 +1632,7 @@ void gain_enc_tc_fx( L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ *gain_code_fx = L_shl( L_tmp, add( exp_gcode0, 2 ) ); move32(); /* Q14 -> Q16 */ - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits ); } ELSE /* nBits == 3 */ { @@ -1642,7 +1642,7 @@ void gain_enc_tc_fx( L_tmp = L_mult( wgain_code, gcode0_fx ); /* Q13*Q0 -> Q14 */ *gain_code_fx = L_shl_sat( L_tmp, add( exp_gcode0, 2 ) ); move32(); /* Q14 -> Q16 */ - push_indice_fx( hBstr, IND_GAIN_CODE, index, nBits ); + push_indice( hBstr, IND_GAIN_CODE, index, nBits ); } } @@ -2438,7 +2438,7 @@ void gain_enc_lbr_fx( *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16 move32(); { - push_indice_fx( hBstr, IND_GAIN, index, nBits ); + push_indice( hBstr, IND_GAIN, index, nBits ); } return; } @@ -3223,7 +3223,7 @@ void gain_enc_amr_wb_fx( *norm_gain_code = L_shr( Mult_32_16( *gain_code, tmp ), sub( 1, exp ) ); // Q16 move32(); - push_indice_fx( hBstr, IND_GAIN, index, nBits ); + push_indice( hBstr, IND_GAIN, index, nBits ); return; } diff --git a/lib_enc/gaus_enc_fx.c b/lib_enc/gaus_enc_fx.c index edddc6a88..081cf7ef0 100644 --- a/lib_enc/gaus_enc_fx.c +++ b/lib_enc/gaus_enc_fx.c @@ -96,7 +96,7 @@ Word16 gaus_encode_fx( move16(); /* low bound = -30; stepSize = 1.71875; inv_stepSize = 0.5818181 */ idx = gain_enc_gaus_fx( gain_code, nb_bits, -7680, 28160, 19065 ); /* Q0 */ - push_indice_fx( st_fx->hBstr, IND_GAIN, idx, nb_bits ); + push_indice( st_fx->hBstr, IND_GAIN, idx, nb_bits ); /*----------------------------------------------------------------* * Total excitation for Unvoiced coders @@ -638,8 +638,8 @@ void gauss2v_fx( idx = cod_2pos_fx( i, j, sign1, sign2, nvec ); /* Q0 */ move16(); - push_indice_fx( hBstr, IND_GAUS_CDBK_INDEX, idx, 2 * nb_bits + 1 ); - push_indice_fx( hBstr, IND_TILT_FACTOR, index_delta, 3 ); + push_indice( hBstr, IND_GAUS_CDBK_INDEX, idx, 2 * nb_bits + 1 ); + push_indice( hBstr, IND_TILT_FACTOR, index_delta, 3 ); /*----------------------------------------------------------------* * Find quantized gain diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index 1642d1253..1a3d2cb56 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -82,16 +82,16 @@ void encod_audio_fx( test(); IF( ( st_fx->element_mode > EVS_MONO ) && st_fx->idchan == 0 ) { - push_indice_fx( hBstr, IND_GSC_IVAS_SP, st_fx->GSC_IVAS_mode, 2 ); + push_indice( hBstr, IND_GSC_IVAS_SP, st_fx->GSC_IVAS_mode, 2 ); } #endif IF( attack_flag > 0 ) { - push_indice_fx( hBstr, IND_GSC_ATTACK, 1, 1 ); + push_indice( hBstr, IND_GSC_ATTACK, 1, 1 ); } ELSE { - push_indice_fx( hBstr, IND_GSC_ATTACK, 0, 1 ); + push_indice( hBstr, IND_GSC_ATTACK, 0, 1 ); } @@ -105,7 +105,7 @@ void encod_audio_fx( IF( GE_16( st_fx->GSC_IVAS_mode, 1 ) || ( NE_16( st_fx->coder_type, INACTIVE ) && ( ( EQ_16( st_fx->element_mode, EVS_MONO ) && GE_32( st_fx->total_brate, ACELP_13k20 ) ) || ( GT_16( st_fx->element_mode, EVS_MONO ) && GT_32( st_fx->total_brate, MIN_BRATE_GSC_NOISY_FLAG ) && GE_16( st_fx->bwidth, SWB ) && !st_fx->flag_ACELP16k ) ) ) ) { - push_indice_fx( hBstr, IND_GSC_SWB_SPEECH, st_fx->GSC_noisy_speech, 1 ); + push_indice( hBstr, IND_GSC_SWB_SPEECH, st_fx->GSC_noisy_speech, 1 ); } /*---------------------------------------------------------------* * Find and encode the number of subframes @@ -185,12 +185,12 @@ void encod_audio_fx( IF( EQ_16( st_fx->L_frame, L_FRAME16k ) && GE_32( st_fx->core_brate, MIN_RATE_4SBFR ) ) { - push_indice_fx( hBstr, IND_HF_NOISE, nb_subfr_flag, 2 ); + push_indice( hBstr, IND_HF_NOISE, nb_subfr_flag, 2 ); } ELSE IF( GE_32( st_fx->core_brate, ACELP_9k60 ) ) { /* nb_subfr_flag can only have the value 0 or 1 */ - push_indice_fx( hBstr, IND_HF_NOISE, nb_subfr_flag, 1 ); + push_indice( hBstr, IND_HF_NOISE, nb_subfr_flag, 1 ); } } test(); @@ -227,7 +227,7 @@ void encod_audio_fx( move16(); } Es_pred_enc_fx( &Es_pred, &indice, st_fx->L_frame, res, st_fx->voicing_fx, nb_bits, 0, Q_new ); - push_indice_fx( hBstr, IND_ES_PRED, indice, nb_bits ); + push_indice( hBstr, IND_ES_PRED, indice, nb_bits ); } enc_pit_exc_fx( st_fx, speech, Aw, Aq, Es_pred, res, synth, exc, &T0_tmp, @@ -290,7 +290,7 @@ void encod_audio_fx( { hGSCEnc->noise_lev = s_max( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 ); move16(); - push_indice_fx( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 ), 2 ); + push_indice( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP2 ), 2 ); } ELSE IF( st_fx->GSC_noisy_speech ) { @@ -300,7 +300,7 @@ void encod_audio_fx( } ELSE { - push_indice_fx( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP0 ), 3 ); + push_indice( hBstr, IND_NOISE_LEVEL, sub( hGSCEnc->noise_lev, NOISE_LEVEL_SP0 ), 3 ); } /*---------------------------------------------------------------* @@ -931,7 +931,7 @@ void gsc_enc_fx( WHILE( bit > 0 ) { i = s_min( bit, 16 ); - push_indice_fx( hBstr, IND_UNUSED, 0, i ); + push_indice( hBstr, IND_UNUSED, 0, i ); bit = sub( bit, i ); } /* Reorder Q bands */ diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index 2b53082f7..300e31e8e 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -258,16 +258,16 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits { IF( GE_16( *hqswb_clas, HQ_GEN_SWB ) ) { - push_indice_fx( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas - 5, bits ); + push_indice( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas - 5, bits ); } ELSE { - push_indice_fx( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); + push_indice( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); } } ELSE { - push_indice_fx( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); + push_indice( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); } test(); @@ -343,7 +343,7 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits move16(); } /* write signalling info to the bitstream */ - push_indice_fx( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); + push_indice( st_fx->hBstr, IND_HQ_SWB_CLAS, *hqswb_clas, bits ); IF( LE_32( st_fx->core_brate, HQ_32k ) && EQ_16( *hqswb_clas, HQ_NORMAL ) ) { diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index ff19cfebc..66430cb8e 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -229,12 +229,12 @@ void hq_core_enc_fx( { IF( Voicing_flag > 0 ) { - push_indice_fx( hBstr, IND_HQ_VOICING_FLAG, 1, 1 ); + push_indice( hBstr, IND_HQ_VOICING_FLAG, 1, 1 ); num_bits = sub( num_bits, 1 ); } ELSE { - push_indice_fx( hBstr, IND_HQ_VOICING_FLAG, 0, 1 ); + push_indice( hBstr, IND_HQ_VOICING_FLAG, 0, 1 ); num_bits = sub( num_bits, 1 ); } } @@ -278,13 +278,13 @@ void hq_core_enc_fx( WHILE( num_bits >= 16 ) { - push_indice_fx( hBstr, IND_UNUSED, 0, 16 ); + push_indice( hBstr, IND_UNUSED, 0, 16 ); num_bits = sub( num_bits, 16 ); } IF( num_bits != 0 ) { - push_indice_fx( hBstr, IND_UNUSED, 0, num_bits ); + push_indice( hBstr, IND_UNUSED, 0, num_bits ); } #ifdef ADD_IVAS_HQ_CODE if ( st->element_mode > EVS_MONO && ( st->last_core == ACELP_CORE || st->last_core == AMR_WB_CORE ) ) diff --git a/lib_enc/hq_env_enc_fx.c b/lib_enc/hq_env_enc_fx.c index 5d47710ed..f033bd685 100644 --- a/lib_enc/hq_env_enc_fx.c +++ b/lib_enc/hq_env_enc_fx.c @@ -295,13 +295,13 @@ Word16 encode_envelope_indices_fx( /* o : Number of b test(); IF( EQ_16( flag_HQ2, LOW_RATE_HQ_CORE_TRAN ) || EQ_16( flag_HQ2, LOW_RATE_HQ_CORE ) ) { - push_indice_fx( hBstr, IND_HQ2_DENG_HMODE, *LCmode, BITS_DE_HMODE ); - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, difidx[0], BITS_DE_FCOMP ); + push_indice( hBstr, IND_HQ2_DENG_HMODE, *LCmode, BITS_DE_HMODE ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, difidx[0], BITS_DE_FCOMP ); } ELSE { - push_indice_fx( hBstr, IND_LC_MODE, *LCmode, 2 ); - push_indice_fx( hBstr, IND_YNRM, difidx[0], NORM0_BITS ); + push_indice( hBstr, IND_LC_MODE, *LCmode, 2 ); + push_indice( hBstr, IND_YNRM, difidx[0], NORM0_BITS ); } test(); @@ -331,7 +331,7 @@ Word16 encode_envelope_indices_fx( /* o : Number of b m = lshr( m, 1 ); /* Q0 */ } - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, v, r ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, v, r ); } } ELSE @@ -370,7 +370,7 @@ Word16 encode_envelope_indices_fx( /* o : Number of b move16(); } } - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, m, r ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, m, r ); prevj = j; move16(); } @@ -419,11 +419,11 @@ Word16 encode_envelope_indices_fx( /* o : Number of b IF( EQ_16( flag_HQ2, LOW_RATE_HQ_CORE ) ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, m, r ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, m, r ); } ELSE { - push_indice_fx( hBstr, IND_YNRM, m, r ); + push_indice( hBstr, IND_YNRM, m, r ); } prevj = j; @@ -515,11 +515,11 @@ Word16 encode_envelope_indices_fx( /* o : Number of b IF( flag_HQ2 == 0 ) { - push_indice_fx( hBstr, IND_YNRM, v, r ); + push_indice( hBstr, IND_YNRM, v, r ); } ELSE { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, v, r ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, v, r ); } } } @@ -536,14 +536,14 @@ Word16 encode_envelope_indices_fx( /* o : Number of b r = huffsizn[j]; /* Q0 */ move16(); - push_indice_fx( hBstr, IND_YNRM, m, r ); + push_indice( hBstr, IND_YNRM, m, r ); } } ELSE { FOR( i = 1; i < num_sfm; i++ ) { - push_indice_fx( hBstr, IND_YNRM, difidx[i], NORMI_BITS ); + push_indice( hBstr, IND_YNRM, difidx[i], NORMI_BITS ); } } } diff --git a/lib_enc/hq_hr_enc_fx.c b/lib_enc/hq_hr_enc_fx.c index 1cd516b43..705db9ecd 100644 --- a/lib_enc/hq_hr_enc_fx.c +++ b/lib_enc/hq_hr_enc_fx.c @@ -236,12 +236,12 @@ void hq_hr_enc_fx( IF( EQ_16( hqswb_clas, HQ_GEN_SWB ) || EQ_16( hqswb_clas, HQ_GEN_FB ) ) { nf_idx = noise_adjust_fx( t_audio_norm, 12, R, sfm_start, sfm_end, s_max( core_sfm, sub( num_env_bands, 1 ) ) ); /* Q0 */ - push_indice_fx( st_fx->hBstr, IND_NF_IDX, nf_idx, 2 ); + push_indice( st_fx->hBstr, IND_NF_IDX, nf_idx, 2 ); } ELSE { nf_idx = noise_adjust_fx( t_audio_norm, 12, R, sfm_start, sfm_end, core_sfm ); /* Q0 */ - push_indice_fx( st_fx->hBstr, IND_NF_IDX, nf_idx, 2 ); + push_indice( st_fx->hBstr, IND_NF_IDX, nf_idx, 2 ); } } /* updates */ diff --git a/lib_enc/hq_lr_enc_fx.c b/lib_enc/hq_lr_enc_fx.c index 9aca0f646..af2780682 100644 --- a/lib_enc/hq_lr_enc_fx.c +++ b/lib_enc/hq_lr_enc_fx.c @@ -115,7 +115,7 @@ static void spt_shorten_domain_set_fx( move16(); } } - push_indice_fx( st_fx->hBstr, IND_HQ2_SPT_SHORTEN, spt_shorten_flag[j], 1 ); + push_indice( st_fx->hBstr, IND_HQ2_SPT_SHORTEN, spt_shorten_flag[j], 1 ); *bit_budget = sub( *bit_budget, 1 ); /* Q0 */ move16(); } @@ -313,7 +313,7 @@ void hq_lr_enc_fx( } /* write the classification information into the bitstream */ - push_indice_fx( hBstr, IND_HQ2_SWB_CLAS, hqswb_clas_fx, 2 ); + push_indice( hBstr, IND_HQ2_SWB_CLAS, hqswb_clas_fx, 2 ); ( *num_bits_fx ) = sub( *num_bits_fx, 2 ); move16(); IF( EQ_16( hqswb_clas_fx, HQ_NORMAL ) ) @@ -325,7 +325,7 @@ void hq_lr_enc_fx( ELSE { /* write the transient bit into the bitstream */ - push_indice_fx( st_fx->hBstr, IND_HQ2_SWB_CLAS, is_transient_fx, 1 ); + push_indice( st_fx->hBstr, IND_HQ2_SWB_CLAS, is_transient_fx, 1 ); /* subtract one bit for the transient flag */ ( *num_bits_fx ) = sub( ( *num_bits_fx ), 1 ); @@ -741,7 +741,7 @@ void hq_lr_enc_fx( /* encode the last p2a_bands-1 subbands bit-allocation index of the previous frame */ FOR( i = 0; i < 2; i++ ) { - push_indice_fx( st_fx->hBstr, IND_HQ2_LAST_BA_MAX_BAND, hHQ_core->last_bitalloc_max_band[i], 1 ); + push_indice( st_fx->hBstr, IND_HQ2_LAST_BA_MAX_BAND, hHQ_core->last_bitalloc_max_band[i], 1 ); } } ELSE IF( is_transient_fx == 0 && EQ_16( inner_frame_fx, L_FRAME16k ) ) @@ -970,7 +970,7 @@ void hq_lr_enc_fx( /* encode the last p2a_bands-1 subbands bit-allocation index of the previous frame */ FOR( i = 0; i < 2; i++ ) { - push_indice_fx( st_fx->hBstr, IND_HQ2_LAST_BA_MAX_BAND, hHQ_core->last_bitalloc_max_band[i], 1 ); + push_indice( st_fx->hBstr, IND_HQ2_LAST_BA_MAX_BAND, hHQ_core->last_bitalloc_max_band[i], 1 ); } } ELSE IF( EQ_16( st_fx->bwidth, SWB ) && EQ_16( hqswb_clas_fx, HQ_HARMONIC ) && ( EQ_32( L_bwe_br, HQ_16k40 ) || EQ_32( L_bwe_br, HQ_13k20 ) ) ) @@ -2213,7 +2213,7 @@ static Word16 small_symbol_enc_fx( /* o : bits /* Encoding LSB bit packing */ FOR( i = 0; i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, LSB[i], BITS_DE_LSB ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, LSB[i], BITS_DE_LSB ); } } @@ -2526,74 +2526,74 @@ static Word16 large_symbol_enc_fx( /* o : bits /* Encoding MSB bits */ IF( *hLCmode0 == 0 ) { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE, 0, BITS_DE_8SMODE ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE, 0, BITS_DE_8SMODE ); bits = BITS_DE_8SMODE; move16(); IF( cnt_outlyer0 == 0 ) { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N0, 0, BITS_DE_8SMODE_N0 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N0, 0, BITS_DE_8SMODE_N0 ); bits = add( bits, BITS_DE_8SMODE_N0 ); IF( EQ_16( cnt_outlyer, 1 ) ) { /* 01 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N1, 1, BITS_DE_8SMODE_N1 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N1, 1, BITS_DE_8SMODE_N1 ); bits = add( bits, BITS_DE_8SMODE_N1 ); /* Q0 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SPOS, pos_outlyer, BITS_DE_8SPOS ); + push_indice( hBstr, IND_HQ2_DENG_8SPOS, pos_outlyer, BITS_DE_8SPOS ); bits = add( bits, BITS_DE_8SPOS ); - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[pos_outlyer] + ABS_ENG_OFFSET, BITS_ABS_ENG ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[pos_outlyer] + ABS_ENG_OFFSET, BITS_ABS_ENG ); bits = add( bits, BITS_ABS_ENG ); } ELSE { /* 00 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N1, 0, BITS_DE_8SMODE_N1 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N1, 0, BITS_DE_8SMODE_N1 ); bits = add( bits, BITS_DE_8SMODE_N1 ); /* Q0 */ } FOR( i = 0; i < pos_outlyer; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); bitsmode0 = add( bitsmode0, hessize[tdifidx0[i] + 4] ); /* Q0 */ } FOR( i = ( pos_outlyer + 1 ); i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); bitsmode0 = add( bitsmode0, hessize[tdifidx0[i] + 4] ); /* Q0 */ } } ELSE IF( EQ_16( cnt_outlyer0, 1 ) ) { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N0, 1, BITS_DE_8SMODE_N0 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N0, 1, BITS_DE_8SMODE_N0 ); bits = add( bits, BITS_DE_8SMODE_N0 ); IF( EQ_16( cnt_outlyer, 1 ) ) { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N1, 1, BITS_DE_8SMODE_N1 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N1, 1, BITS_DE_8SMODE_N1 ); bits = add( bits, BITS_DE_8SMODE_N1 ); /* Q0 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SPOS, pos_outlyer, BITS_DE_8SPOS ); + push_indice( hBstr, IND_HQ2_DENG_8SPOS, pos_outlyer, BITS_DE_8SPOS ); bits = add( bits, BITS_DE_8SPOS ); - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[0] + ABS_ENG_OFFSET, BITS_ABS_ENG ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[0] + ABS_ENG_OFFSET, BITS_ABS_ENG ); bits = add( bits, BITS_ABS_ENG ); - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[pos_outlyer] + ABS_ENG_OFFSET, BITS_ABS_ENG ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[pos_outlyer] + ABS_ENG_OFFSET, BITS_ABS_ENG ); bits = add( bits, BITS_ABS_ENG ); } ELSE { - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE_N1, 0, BITS_DE_8SMODE_N1 ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE_N1, 0, BITS_DE_8SMODE_N1 ); bits = add( bits, BITS_DE_8SMODE_N1 ); /* Q0 */ - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[0] + ABS_ENG_OFFSET, BITS_ABS_ENG ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, qbidx[0] + ABS_ENG_OFFSET, BITS_ABS_ENG ); bits = add( bits, BITS_ABS_ENG ); /* Q0 */ } FOR( i = 1; i < pos_outlyer; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); bits = add( bits, hessize[tdifidx0[i] + 4] ); /* Q0 */ } FOR( i = pos_outlyer + 1; i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx0[i] + 4], hessize[tdifidx0[i] + 4] ); bits = add( bits, hessize[tdifidx0[i] + 4] ); /* Q0 */ } } @@ -2601,12 +2601,12 @@ static Word16 large_symbol_enc_fx( /* o : bits ELSE { bits = add( BITS_DE_8SMODE, BITS_MAX_DEPTH ); /* Q0 */ - push_indice_fx( hBstr, IND_HQ2_DENG_8SMODE, 1, BITS_DE_8SMODE ); - push_indice_fx( hBstr, IND_HQ2_DENG_8SDEPTH, lsbdepth1, BITS_MAX_DEPTH ); + push_indice( hBstr, IND_HQ2_DENG_8SMODE, 1, BITS_DE_8SMODE ); + push_indice( hBstr, IND_HQ2_DENG_8SDEPTH, lsbdepth1, BITS_MAX_DEPTH ); FOR( i = 0; i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx1[i] + 4], hessize[tdifidx1[i] + 4] ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, hescode[tdifidx1[i] + 4], hessize[tdifidx1[i] + 4] ); bits = add( bits, hessize[tdifidx1[i] + 4] ); /* Q0 */ } @@ -2614,7 +2614,7 @@ static Word16 large_symbol_enc_fx( /* o : bits { FOR( i = 0; i < BANDS; ++i ) { - push_indice_fx( hBstr, IND_HQ2_DIFF_ENERGY, LSB1[i], lsbdepth1 ); + push_indice( hBstr, IND_HQ2_DIFF_ENERGY, LSB1[i], lsbdepth1 ); } /*bits += BANDS * lsbdepth1; */ bits = add( bits, extract_h( L_shl( L_mult( BANDS, lsbdepth1 ), 15 ) ) ); /* Q0 */ @@ -3115,7 +3115,7 @@ static Word16 band_energy_quant_fx( { deng_cmode = 0; move16(); - push_indice_fx( hBstr, IND_HQ2_DENG_MODE, deng_cmode, BITS_DE_CMODE ); + push_indice( hBstr, IND_HQ2_DENG_MODE, deng_cmode, BITS_DE_CMODE ); large_symbol_enc_fx( hBstr, bq2_fx, bands_fx, &hLCmode0, 1 ); deng_bits = add( ebits, BITS_DE_CMODE ); /* Q0 */ } @@ -3124,7 +3124,7 @@ static Word16 band_energy_quant_fx( /* setting energy difference coding mode and storing it */ deng_cmode = 1; move16(); - push_indice_fx( hBstr, IND_HQ2_DENG_MODE, deng_cmode, BITS_DE_CMODE ); + push_indice( hBstr, IND_HQ2_DENG_MODE, deng_cmode, BITS_DE_CMODE ); deng_bits = add( hbits, BITS_DE_CMODE ); /* Q0 */ @@ -3479,7 +3479,7 @@ static Word16 p2a_threshold_quant_fx( move16(); } - push_indice_fx( hBstr, IND_HQ2_P2A_FLAGS, p2a_flags_fx[k], 1 ); + push_indice( hBstr, IND_HQ2_P2A_FLAGS, p2a_flags_fx[k], 1 ); j = add( j, 1 ); } @@ -3768,7 +3768,7 @@ static void mdct_spectrum_fine_gain_enc_fx( move16(); } - push_indice_fx( st_fx->hBstr, IND_HQ2_SUBBAND_GAIN, imin_fx, gqbits ); + push_indice( st_fx->hBstr, IND_HQ2_SUBBAND_GAIN, imin_fx, gqbits ); } return; diff --git a/lib_enc/hvq_enc_fx.c b/lib_enc/hvq_enc_fx.c index b06a1734d..a0acd0bfd 100644 --- a/lib_enc/hvq_enc_fx.c +++ b/lib_enc/hvq_enc_fx.c @@ -335,7 +335,7 @@ Word16 hvq_enc_fx( /*o : Consumed bits q_noise_level[i] = 0; move16(); } - push_indice_fx( st_fx->hBstr, IND_HVQ_BWE_NL, q_noise_level_idx[i], 2 ); + push_indice( st_fx->hBstr, IND_HVQ_BWE_NL, q_noise_level_idx[i], 2 ); bits_used = add( bits_used, 2 ); noise_level[i] = q_noise_level[i]; /* in Q15 */ diff --git a/lib_enc/isf_enc_amr_wb_fx.c b/lib_enc/isf_enc_amr_wb_fx.c index 4851ed155..d58998565 100644 --- a/lib_enc/isf_enc_amr_wb_fx.c +++ b/lib_enc/isf_enc_amr_wb_fx.c @@ -173,11 +173,11 @@ static void qisf_ns_28b_fx( indice[4] = add( sub_VQ_fx( &isf[12], dico5_ns_28b_fx + 4, 4, DICO5_NS_28b - 1, &tmp ), 1 ); /* First vector has a problem -> do not allow */ move16(); /* write indices to array */ - push_indice_fx( hBstr, IND_ISF_0_0, indice[0], 6 ); - push_indice_fx( hBstr, IND_ISF_0_1, indice[1], 6 ); - push_indice_fx( hBstr, IND_ISF_0_2, indice[2], 6 ); - push_indice_fx( hBstr, IND_ISF_0_3, indice[3], 5 ); - push_indice_fx( hBstr, IND_ISF_0_4, indice[4], 5 ); + push_indice( hBstr, IND_ISF_0_0, indice[0], 6 ); + push_indice( hBstr, IND_ISF_0_1, indice[1], 6 ); + push_indice( hBstr, IND_ISF_0_2, indice[2], 6 ); + push_indice( hBstr, IND_ISF_0_3, indice[3], 5 ); + push_indice( hBstr, IND_ISF_0_4, indice[4], 5 ); /* decoding the ISFs */ disf_ns_28b_fx( indice, isf ); @@ -305,11 +305,11 @@ static void qisf_2s_36b_fx( indice[0] = Indirect_dico1[indice[0]]; move16(); /* Make interoperable with G722.2 */ - push_indice_fx( hBstr, IND_ISF_0_0, indice[0], 8 ); - push_indice_fx( hBstr, IND_ISF_0_1, indice[1], 8 ); - push_indice_fx( hBstr, IND_ISF_1_0, indice[2], 7 ); - push_indice_fx( hBstr, IND_ISF_1_1, indice[3], 7 ); - push_indice_fx( hBstr, IND_ISF_1_2, indice[4], 6 ); + push_indice( hBstr, IND_ISF_0_0, indice[0], 8 ); + push_indice( hBstr, IND_ISF_0_1, indice[1], 8 ); + push_indice( hBstr, IND_ISF_1_0, indice[2], 7 ); + push_indice( hBstr, IND_ISF_1_1, indice[3], 7 ); + push_indice( hBstr, IND_ISF_1_2, indice[4], 6 ); return; } @@ -442,13 +442,13 @@ static void qisf_2s_46b_fx( indice[0] = Indirect_dico1[indice[0]]; move16(); /* Make interoperable with G722.2 */ - push_indice_fx( hBstr, IND_ISF_0_0, indice[0], 8 ); - push_indice_fx( hBstr, IND_ISF_0_1, indice[1], 8 ); - push_indice_fx( hBstr, IND_ISF_1_0, indice[2], 6 ); - push_indice_fx( hBstr, IND_ISF_1_1, indice[3], 7 ); - push_indice_fx( hBstr, IND_ISF_1_2, indice[4], 7 ); - push_indice_fx( hBstr, IND_ISF_1_3, indice[5], 5 ); - push_indice_fx( hBstr, IND_ISF_1_4, indice[6], 5 ); + push_indice( hBstr, IND_ISF_0_0, indice[0], 8 ); + push_indice( hBstr, IND_ISF_0_1, indice[1], 8 ); + push_indice( hBstr, IND_ISF_1_0, indice[2], 6 ); + push_indice( hBstr, IND_ISF_1_1, indice[3], 7 ); + push_indice( hBstr, IND_ISF_1_2, indice[4], 7 ); + push_indice( hBstr, IND_ISF_1_3, indice[5], 5 ); + push_indice( hBstr, IND_ISF_1_4, indice[6], 5 ); return; } diff --git a/lib_enc/lsf_enc_fx.c b/lib_enc/lsf_enc_fx.c index e6d08c49d..8fe425d74 100644 --- a/lib_enc/lsf_enc_fx.c +++ b/lib_enc/lsf_enc_fx.c @@ -647,11 +647,11 @@ static void lsfq_CNG_fx( Vr_add( qlsf, &CNG_SN1_fx[idx_cv * M], qlsf, M ); /* write the VQ index to the bitstream */ - push_indice_fx( hBstr, IND_ISF_0_0, idx_cv, 4 ); + push_indice( hBstr, IND_ISF_0_0, idx_cv, 4 ); /* write the LVQ index to the bitstream */ - push_indice_fx( hBstr, IND_ISF_0_1, idx_lvq[0], LEN_INDICE ); - push_indice_fx( hBstr, IND_ISF_0_1, idx_lvq[1], LSF_BITS_CNG - 4 - LEN_INDICE ); + push_indice( hBstr, IND_ISF_0_1, idx_lvq[0], LEN_INDICE ); + push_indice( hBstr, IND_ISF_0_1, idx_lvq[1], LSF_BITS_CNG - 4 - LEN_INDICE ); return; } @@ -1117,13 +1117,13 @@ void lsf_end_enc_fx( IF( EQ_16( coder_type_org, GENERIC ) && EQ_32( st->sr_core, INT_FS_16k ) ) { /* VOICED =2 and GENERIC=3, so "coder_type-2" means VOICED =0 and GENERIC=1*/ - push_indice_fx( hBstr, IND_LSF_PREDICTOR_SELECT_BIT, sub( coder_type, 2 ), 1 ); + push_indice( hBstr, IND_LSF_PREDICTOR_SELECT_BIT, sub( coder_type, 2 ), 1 ); } /* write predictor selection bit */ IF( EQ_16( predmode, 2 ) ) { - push_indice_fx( st->hBstr, IND_LSF_PREDICTOR_SELECT_BIT, safety_net, 1 ); + push_indice( st->hBstr, IND_LSF_PREDICTOR_SELECT_BIT, safety_net, 1 ); } test(); @@ -1134,7 +1134,7 @@ void lsf_end_enc_fx( Bit_alloc1 = &BC_TCVQ_BIT_ALLOC_40B[1]; FOR( i = 0; i < ( M / 2 ) + 3; i++ ) { - push_indice_fx( hBstr, IND_LSF, TCQIdx[i], Bit_alloc1[i] ); + push_indice( hBstr, IND_LSF, TCQIdx[i], Bit_alloc1[i] ); } } ELSE @@ -1175,7 +1175,7 @@ void lsf_end_enc_fx( move16(); cumleft -= num_bits; move16(); - push_indice_fx( hBstr, IND_LSF, indice[i], num_bits ); + push_indice( hBstr, IND_LSF, indice[i], num_bits ); } WHILE( cumleft > 0 ) @@ -1195,7 +1195,7 @@ void lsf_end_enc_fx( } cumleft = sub( cumleft, num_bits ); - push_indice_fx( hBstr, IND_LSF, indice[i], num_bits ); + push_indice( hBstr, IND_LSF, indice[i], num_bits ); i = add( i, 1 ); } } @@ -3636,7 +3636,7 @@ static void lsf_mid_enc_fx( /* convert LSFs back to LSPs */ lsf2lsp_fx( qlsf, lsp, M, int_fs ); - push_indice_fx( hBstr, IND_MID_FRAME_LSF_INDEX, idx, nb_bits ); + push_indice( hBstr, IND_MID_FRAME_LSF_INDEX, idx, nb_bits ); return; } diff --git a/lib_enc/nelp_enc_fx.c b/lib_enc/nelp_enc_fx.c index a7588283a..391191175 100644 --- a/lib_enc/nelp_enc_fx.c +++ b/lib_enc/nelp_enc_fx.c @@ -698,9 +698,9 @@ void nelp_encoder_fx( } ELSE { - push_indice_fx( hBstr, IND_IG1, iG1_fx, 5 ); - push_indice_fx( hBstr, IND_IG2A, iG2_fx[0], 6 ); - push_indice_fx( hBstr, IND_IG2B, iG2_fx[1], 6 ); + push_indice( hBstr, IND_IG1, iG1_fx, 5 ); + push_indice( hBstr, IND_IG2A, iG2_fx[0], 6 ); + push_indice( hBstr, IND_IG2B, iG2_fx[1], 6 ); } test(); @@ -1019,7 +1019,7 @@ void nelp_encoder_fx( } ELSE { - push_indice_fx( hBstr, IND_NELP_FID, fid, 2 ); + push_indice( hBstr, IND_NELP_FID, fid, 2 ); } } diff --git a/lib_enc/peak_vq_enc_fx.c b/lib_enc/peak_vq_enc_fx.c index aa4763aa6..dffab4900 100644 --- a/lib_enc/peak_vq_enc_fx.c +++ b/lib_enc/peak_vq_enc_fx.c @@ -559,13 +559,13 @@ Word16 peak_vq_enc_fx( move32(); nf_gains[i] = L_shr( acc, 1 + 2 ); /* nf_gains in Q12. dicn_fx is in Q14. Need extra shift +2. */ move32(); - push_indice_fx( hBstr, IND_HVQ_NF_GAIN, indx, 5 ); + push_indice( hBstr, IND_HVQ_NF_GAIN, indx, 5 ); bits = add( bits, 5 ); } /* Signal number of peaks */ i = sub( max_peaks, vq_peaks ); - push_indice_fx( hBstr, IND_NUM_PEAKS, i, 5 ); + push_indice( hBstr, IND_NUM_PEAKS, i, 5 ); bits = add( bits, 5 ); /* Identify position of first peak and arrange peak gains by position */ @@ -677,8 +677,8 @@ Word16 peak_vq_enc_fx( move16(); } - push_indice_fx( hBstr, IND_FLAGN, FlagN, 1 ); - push_indice_fx( hBstr, IND_PG_IDX, pgain_difidx[0], GAIN0_BITS ); + push_indice( hBstr, IND_FLAGN, FlagN, 1 ); + push_indice( hBstr, IND_PG_IDX, pgain_difidx[0], GAIN0_BITS ); IF( FlagN ) { @@ -692,7 +692,7 @@ Word16 peak_vq_enc_fx( r = pgain_huffsizn[j]; move16(); - push_indice_fx( hBstr, IND_PG_IDX, m, r ); + push_indice( hBstr, IND_PG_IDX, m, r ); } } ELSE @@ -700,7 +700,7 @@ Word16 peak_vq_enc_fx( pPgainDifIdx = &pgain_difidx[1]; FOR( i = 0; i < vqPeaksMinus1; i++ ) { - push_indice_fx( hBstr, IND_PG_IDX, ( *pPgainDifIdx++ ), GAINI_BITS ); + push_indice( hBstr, IND_PG_IDX, ( *pPgainDifIdx++ ), GAINI_BITS ); } } @@ -727,13 +727,13 @@ Word16 peak_vq_enc_fx( num_overlap_bins = sub( 5, sub( vq_peak_idx[i + 1], vq_peak_idx[i] ) ); indx = sub( vq_peak_idx[i], 2 ); quant_peaks_fx( hBstr, &coefs[indx], &coefs_out[indx], &peak_gains[i], &vq_cb_idx, num_overlap_bins, core_brate, vq_peaks ); - push_indice_fx( hBstr, IND_HVQ_PEAKS, vq_cb_idx, 8 ); + push_indice( hBstr, IND_HVQ_PEAKS, vq_cb_idx, 8 ); bits = add( bits, 9 ); } indx = sub( vq_peak_idx[i], 2 ); quant_peaks_fx( hBstr, &coefs[indx], &coefs_out[indx], &peak_gains[i], &vq_cb_idx, 0, core_brate, vq_peaks ); - push_indice_fx( hBstr, IND_HVQ_PEAKS, vq_cb_idx, 8 ); + push_indice( hBstr, IND_HVQ_PEAKS, vq_cb_idx, 8 ); bits = add( bits, 9 ); /* Quantize peak positions and sign with HVQ */ @@ -826,7 +826,7 @@ Word16 peak_vq_enc_fx( move16(); } - push_indice_fx( hBstr, IND_HVQ_PVQ_GAIN, pvq_norm[k], HVQ_PVQ_GAIN_BITS ); + push_indice( hBstr, IND_HVQ_PVQ_GAIN, pvq_norm[k], HVQ_PVQ_GAIN_BITS ); pvq_bits = add( pvq_bits, HVQ_PVQ_GAIN_BITS ); pvq_norm[k] = add( pvq_norm[k], 8 ); @@ -1148,7 +1148,7 @@ static void quant_peaks_fx( { *vq_idx = w_vquant_fx( x, Qx, weights, xq, hvq_peak_cb_fx, cbSize, 0 ); move16(); - push_indice_fx( hBstr, IND_HVQ_PEAKS, 0, 1 ); + push_indice( hBstr, IND_HVQ_PEAKS, 0, 1 ); } ELSE IF( EQ_16( cb_class, 1 ) ) { @@ -1157,7 +1157,7 @@ static void quant_peaks_fx( move16(); *vq_idx = add( *vq_idx, sub( HVQ_CB_SIZE / 2, search_overlap ) ); move16(); - push_indice_fx( hBstr, IND_HVQ_PEAKS, 0, 1 ); + push_indice( hBstr, IND_HVQ_PEAKS, 0, 1 ); } ELSE IF( EQ_16( cb_class, 2 ) ) { @@ -1166,13 +1166,13 @@ static void quant_peaks_fx( move16(); *vq_idx = add( *vq_idx, sub( HVQ_CB_SIZE / 2, search_overlap ) ); move16(); - push_indice_fx( hBstr, IND_HVQ_PEAKS, 1, 1 ); + push_indice( hBstr, IND_HVQ_PEAKS, 1, 1 ); } ELSE { *vq_idx = w_vquant_fx( x, Qx, weights, xq, hvq_peak_cb_fx, cbSize, 1 ); move16(); - push_indice_fx( hBstr, IND_HVQ_PEAKS, 1, 1 ); + push_indice( hBstr, IND_HVQ_PEAKS, 1, 1 ); } FOR( i = 0; i < 4; i++ ) @@ -1458,23 +1458,23 @@ static Word16 hvq_code_pos_fx( test(); IF( GT_16( delta_bits, sparse_bits ) || delta_bits < 0 ) { - push_indice_fx( hBstr, IND_POS_IDX, HVQ_CP_SPARSE, 1 ); + push_indice( hBstr, IND_POS_IDX, HVQ_CP_SPARSE, 1 ); FOR( i = 0; i < sparse_bits; i++ ) { - push_indice_fx( hBstr, IND_POS_IDX, sparse_result[i], 1 ); + push_indice( hBstr, IND_POS_IDX, sparse_result[i], 1 ); } bits = add( add( bits, sparse_bits ), 1 ); } ELSE { - push_indice_fx( hBstr, IND_POS_IDX, HVQ_CP_DELTA, 1 ); + push_indice( hBstr, IND_POS_IDX, HVQ_CP_DELTA, 1 ); FOR( i = 0; i < num_peaks; i++ ) { j = delta[i]; move16(); - push_indice_fx( hBstr, IND_POS_IDX, hvq_cp_huff_val[j], hvq_cp_huff_len[j] ); + push_indice( hBstr, IND_POS_IDX, hvq_cp_huff_val[j], hvq_cp_huff_len[j] ); } bits = add( add( bits, delta_bits ), 1 ); } @@ -1489,7 +1489,7 @@ static Word16 hvq_code_pos_fx( tmp = 0; move16(); } - push_indice_fx( hBstr, IND_POS_IDX, tmp, 1 ); + push_indice( hBstr, IND_POS_IDX, tmp, 1 ); } bits = add( bits, num_peaks ); diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c index b19fb7e56..8eea1b3d5 100644 --- a/lib_enc/pit_enc_fx.c +++ b/lib_enc/pit_enc_fx.c @@ -1787,7 +1787,7 @@ void pit_Q_enc_fx( } { - push_indice_fx( hBstr, IND_PITCH, pitch_index, nBits ); + push_indice( hBstr, IND_PITCH, pitch_index, nBits ); } return; @@ -1919,7 +1919,7 @@ void pit16k_Q_enc_fx( } } - push_indice_fx( hBstr, IND_PITCH, pitch_index, nBits ); + push_indice( hBstr, IND_PITCH, pitch_index, nBits ); } ELSE IF( EQ_16( nBits, 9 ) ) /* absolute encoding with 9 bits */ { @@ -1949,14 +1949,14 @@ void pit16k_Q_enc_fx( } } - push_indice_fx( hBstr, IND_PITCH, pitch_index, 9 ); + push_indice( hBstr, IND_PITCH, pitch_index, 9 ); } ELSE /* nBits == 6 */ /* relative encoding with 6 bits */ { /*pitch_index = (T0 - *T0_min) * 4 + T0_frac;*/ pitch_index = add( shl( sub( T0, *T0_min ), 2 ), T0_frac ); - push_indice_fx( hBstr, IND_PITCH, pitch_index, nBits ); + push_indice( hBstr, IND_PITCH, pitch_index, nBits ); } limit_T0_fx( L_FRAME16k, 8, L_SUBFR, limit_flag, T0, T0_frac, T0_min, T0_max ); diff --git a/lib_enc/ppp_enc_fx.c b/lib_enc/ppp_enc_fx.c index 9afb27065..ac3d5836a 100644 --- a/lib_enc/ppp_enc_fx.c +++ b/lib_enc/ppp_enc_fx.c @@ -171,9 +171,9 @@ ivas_error ppp_quarter_encoder_fx( CURRCW_Q_FX->upper_cut_off_freq_of_interest_fx = (Word16) find_remd( Ltempn, 20971, &Ltempd ); move16(); - push_indice_fx( hBstr, IND_AMP0, AMP_IDX_fx[0], 6 ); - push_indice_fx( hBstr, IND_AMP1, AMP_IDX_fx[1], 6 ); - push_indice_fx( hBstr, IND_POWER, POWER_IDX_FX, 6 ); + push_indice( hBstr, IND_AMP0, AMP_IDX_fx[0], 6 ); + push_indice( hBstr, IND_AMP1, AMP_IDX_fx[1], 6 ); + push_indice( hBstr, IND_POWER, POWER_IDX_FX, 6 ); /*Phase copying is done through copy_phase instead of car2pol and pol2car */ copy_phase_fx( TARGETCW_FX, *CURRCW_Q_FX, TARGETCW_FX ); @@ -199,7 +199,7 @@ ivas_error ppp_quarter_encoder_fx( /*DTFS_phaseShift( CURRCW_Q,(float)(PI2*tmp/CURRCW_Q->lag) ); */ Q2phaseShift_fx( CURRCW_Q_FX, tmp_fx, CURRCW_Q_FX->lag_fx, S_fx, C_fx ); - push_indice_fx( hBstr, IND_GLOBAL_ALIGNMENT, shr( add( tmp_fx, 12 ), 2 ), 3 ); + push_indice( hBstr, IND_GLOBAL_ALIGNMENT, shr( add( tmp_fx, 12 ), 2 ), 3 ); free( PREVDTFS_FX ); return error; diff --git a/lib_enc/range_enc_fx.c b/lib_enc/range_enc_fx.c index 689b313d8..767b2ecb5 100644 --- a/lib_enc/range_enc_fx.c +++ b/lib_enc/range_enc_fx.c @@ -423,14 +423,14 @@ void rc_enc_bits_fx( IF( GT_16( bits, 16 ) ) { - push_indice_fx( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_lshr( value, 16 ) ), sub( bits, 16 ) ); + push_indice( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_lshr( value, 16 ) ), sub( bits, 16 ) ); hPVQ->rc_offset = add( hPVQ->rc_offset, 1 ); // Q0 - push_indice_fx( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_and( value, 0x0000ffff ) ), 16 ); + push_indice( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( UL_and( value, 0x0000ffff ) ), 16 ); hPVQ->rc_offset = add( hPVQ->rc_offset, 1 ); // Q0 } ELSE { - push_indice_fx( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( value ), bits ); + push_indice( hBstr, sub( IND_RC_END, hPVQ->rc_offset ), u_extract_l( value ), bits ); hPVQ->rc_offset = add( hPVQ->rc_offset, 1 ); // Q0 } } @@ -516,7 +516,7 @@ static void rc_enc_write_fx( Word16 bits /* i : Number of bits Q0*/ ) { - push_indice_fx( hBstr, IND_RC_START, byte, bits ); + push_indice( hBstr, IND_RC_START, byte, bits ); return; } diff --git a/lib_enc/stat_noise_uv_enc_fx.c b/lib_enc/stat_noise_uv_enc_fx.c index 0a20db8ed..1445559a1 100644 --- a/lib_enc/stat_noise_uv_enc_fx.c +++ b/lib_enc/stat_noise_uv_enc_fx.c @@ -94,7 +94,7 @@ void stat_noise_uv_enc_fx( noisiness = s_max( noisiness, 0 ); noisiness = s_min( noisiness, 31 ); - push_indice_fx( st_fx->hBstr, IND_NOISINESS, noisiness, 5 ); + push_indice( st_fx->hBstr, IND_NOISINESS, noisiness, 5 ); } /*-----------------------------------------------------------------* diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 26c8382ca..1ebef7404 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -186,7 +186,7 @@ void wb_bwe_enc_fx( Q_synth = sub( add( sub( new_input_fx_exp, 16 ), scl ), 1 ); mode = WB_BWE_encoding_fx( coder_type, yorig_fx, WB_fenv_fx, st_fx, Q_synth, Q_synth ); - push_indice_fx( st_fx->hBstr, IND_WB_CLASS, sub( mode, 2 ), 1 ); + push_indice( st_fx->hBstr, IND_WB_CLASS, sub( mode, 2 ), 1 ); } hBWE_FD->prev_mode = mode; @@ -820,7 +820,7 @@ void swb_bwe_enc_fx( /* write FB BWE frame gain to the bitstream */ IF( EQ_16( st_fx->extl, FB_BWE ) ) { - push_indice_fx( st_fx->hBstr, IND_FB_SLOPE, idxGain, NUM_BITS_FB_FRAMEGAIN ); + push_indice( st_fx->hBstr, IND_FB_SLOPE, idxGain, NUM_BITS_FB_FRAMEGAIN ); } return; @@ -2476,7 +2476,7 @@ Word16 WB_BWE_encoding_fx( /* o : classification of wb index = WB_BWE_fenv_q_fx( WB_fenv_fx, F_2_5_fx, 32, 2 ); - push_indice_fx( st_fx->hBstr, IND_WB_FENV, index, 5 ); + push_indice( st_fx->hBstr, IND_WB_FENV, index, 5 ); return ( mode ); } @@ -2665,7 +2665,7 @@ static Word16 SWB_BWE_encoding_fx( { mode = IsTransient; move16(); - push_indice_fx( hBstr, IND_SWB_CLASS, mode, 2 ); + push_indice( hBstr, IND_SWB_CLASS, mode, 2 ); /* Energy for the different bands and global energies */ global_gain_fx = L_deposit_l( 0 ); @@ -2924,13 +2924,13 @@ static Word16 SWB_BWE_encoding_fx( index = shr( add( SWB_tenv_tmp_fx[n_band], 1024 ), 11 ); } - push_indice_fx( hBstr, IND_SWB_TENV, index, 4 ); + push_indice( hBstr, IND_SWB_TENV, index, 4 ); } MSVQ_Interpol_Tran_fx( SWB_fenv_fx, indice ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[0], 7 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[1], 6 ); + push_indice( hBstr, IND_SWB_FENV, indice[0], 7 ); + push_indice( hBstr, IND_SWB_FENV, indice[1], 6 ); } ELSE { @@ -2955,7 +2955,7 @@ static Word16 SWB_BWE_encoding_fx( global_gain_fx = L_shr( global_gain_fx, 1 ); /*2*Q_shb */ mode = FD_BWE_class_fx( yos_fx, global_gain_fx, tilt_nb_fx, Q_synth, Q_shb, st_fx ); - push_indice_fx( hBstr, IND_SWB_CLASS, mode, 2 ); + push_indice( hBstr, IND_SWB_CLASS, mode, 2 ); energy_control_fx( st_fx, ACELP_CORE, mode, -1, yos_fx, st_offset, energy_factor_fx, Q_synth_lf ); @@ -2990,11 +2990,11 @@ static Word16 SWB_BWE_encoding_fx( /* Energy VQ */ msvq_interpol_fx( SWB_fenv_fx, w_env_fx, indice ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[0], 5 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[1], 7 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[2], 6 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[3], 5 ); - push_indice_fx( hBstr, IND_SWB_FENV, indice[4], 6 ); + push_indice( hBstr, IND_SWB_FENV, indice[0], 5 ); + push_indice( hBstr, IND_SWB_FENV, indice[1], 7 ); + push_indice( hBstr, IND_SWB_FENV, indice[2], 6 ); + push_indice( hBstr, IND_SWB_FENV, indice[3], 5 ); + push_indice( hBstr, IND_SWB_FENV, indice[4], 6 ); } hBWE_FD->prev_mode = mode; move16(); @@ -3939,7 +3939,7 @@ void hq_generic_encoding_fx( IF( EQ_16( hHQ_core->hq_generic_speech_class, 1 ) ) { - push_indice_fx( hBstr, IND_HQ_SWB_EXC_SP_CLAS, 1, 1 ); + push_indice( hBstr, IND_HQ_SWB_EXC_SP_CLAS, 1, 1 ); *hq_generic_exc_clas = HQ_GENERIC_SP_EXC; move16(); } @@ -3947,8 +3947,8 @@ void hq_generic_encoding_fx( { *hq_generic_exc_clas = decision_hq_generic_class_fx_32( coefs_fx, hq_generic_offset ); move16(); - push_indice_fx( hBstr, IND_HQ_SWB_EXC_SP_CLAS, 0, 1 ); - push_indice_fx( hBstr, IND_HQ_SWB_EXC_CLAS, *hq_generic_exc_clas, 1 ); + push_indice( hBstr, IND_HQ_SWB_EXC_SP_CLAS, 0, 1 ); + push_indice( hBstr, IND_HQ_SWB_EXC_CLAS, *hq_generic_exc_clas, 1 ); } FOR( n_band = 0; n_band < nenv; n_band++ ) @@ -4069,23 +4069,23 @@ void hq_generic_encoding_fx( move16(); } - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[0], 5 ); - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[1], 7 ); - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[2], 6 ); - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[3], 5 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[0], 5 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[1], 7 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[2], 6 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[3], 5 ); IF( LE_16( hq_generic_offset, HQ_GENERIC_FOFFSET_24K4 ) ) { - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[4], 6 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[4], 6 ); } ELSE { - push_indice_fx( hBstr, IND_SWB_FENV_HQ, indice[4], 5 ); + push_indice( hBstr, IND_SWB_FENV_HQ, indice[4], 5 ); } IF( EQ_16( st_fx->bwidth, FB ) ) { - push_indice_fx( hBstr, IND_FB_FENV_HQ, indice[5], 5 ); + push_indice( hBstr, IND_FB_FENV_HQ, indice[5], 5 ); } FOR( n_band = 0; n_band < nenv; n_band++ ) diff --git a/lib_enc/swb_bwe_enc_hr_fx.c b/lib_enc/swb_bwe_enc_hr_fx.c index fd4a9f125..8b5a17353 100644 --- a/lib_enc/swb_bwe_enc_hr_fx.c +++ b/lib_enc/swb_bwe_enc_hr_fx.c @@ -189,7 +189,7 @@ void swb_bwe_enc_hr_fx( st_fx->EnergyLT_fx_exp = exp1; move16(); - push_indice_fx( hBstr, IND_HR_IS_TRANSIENT, is_transient, 1 ); + push_indice( hBstr, IND_HR_IS_TRANSIENT, is_transient, 1 ); /*---------------------------------------------------------------------* * OLA and MDCT @@ -309,7 +309,7 @@ void swb_bwe_enc_hr_fx( ind1 = gain_quant_fx( &L_gain_fx, &gain1_fx, LG10_MIN_GLOB_GAIN_BWE_HR_Q14, LG10_MAX_GLOB_GAIN_BWE_HR_Q13, NBITS_GLOB_GAIN_BWE_HR, &exp1 ); - push_indice_fx( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_GLOB_GAIN_BWE_HR ); /* normalization with global gain */ @@ -353,7 +353,7 @@ void swb_bwe_enc_hr_fx( { ind1 = en_band_quant_fx( en_band_fx, swb_hr_env_code3_fx, NUM_ENVLOPE_CODE_HR_TR ); - push_indice_fx( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR_TR ); + push_indice( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR_TR ); nBits = sub( nBits, NBITS_ENVELOPE_BWE_HR_TR ); ind2 = ind1; move16(); @@ -369,7 +369,7 @@ void swb_bwe_enc_hr_fx( ind1 = en_band_quant_fx( en_band_fx, swb_hr_env_code3_fx + ( NUM_ENVLOPE_CODE_HR_TR2 * 2 ), NUM_ENVLOPE_CODE_HR_TR2 ); } - push_indice_fx( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR_TR - 1 ); + push_indice( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR_TR - 1 ); nBits = sub( nBits, NBITS_ENVELOPE_BWE_HR_TR - 1 ); } @@ -439,7 +439,7 @@ void swb_bwe_enc_hr_fx( L_en_noncoded_fx = L_deposit_h( en_band_fx[N_BANDS_TRANS_BWE_HR - 1] ); /* to Put in Q16+9 */ } - push_indice_fx( hBstr, IND_HR_HF_GAIN, ind1, NBITS_HF_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_HF_GAIN, ind1, NBITS_HF_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_HF_GAIN_BWE_HR ); } ELSE @@ -507,7 +507,7 @@ void swb_bwe_enc_hr_fx( L_gain_fx = L_shr( L_tmp, sub( 31 - 16, exp2 ) ); /* 31: 'L_tmp' is already in Q31 */ ind1 = gain_quant_fx( &L_gain_fx, &gain1_fx, LG10_MIN_GLOB_GAIN_BWE_HR_Q14, LG10_MAX_GLOB_GAIN_BWE_HR_Q13, NBITS_GLOB_GAIN_BWE_HR, &exp1 ); - push_indice_fx( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_GLOB_GAIN_BWE_HR ); /* normalization with global gain */ @@ -547,8 +547,8 @@ void swb_bwe_enc_hr_fx( ind1 = en_band_quant_fx( en_band_fx, swb_hr_env_code1_fx, NUM_ENVLOPE_CODE_HR1 ); ind2 = en_band_quant_fx( en_band_fx + 2, swb_hr_env_code2_fx, NUM_ENVLOPE_CODE_HR2 ); - push_indice_fx( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR1 ); - push_indice_fx( hBstr, IND_HR_ENVELOPE, ind2, NBITS_ENVELOPE_BWE_HR2 ); + push_indice( hBstr, IND_HR_ENVELOPE, ind1, NBITS_ENVELOPE_BWE_HR1 ); + push_indice( hBstr, IND_HR_ENVELOPE, ind2, NBITS_ENVELOPE_BWE_HR2 ); nBits = sub( nBits, NBITS_ENVELOPE_BWE_HR1 + NBITS_ENVELOPE_BWE_HR2 ); @@ -673,7 +673,7 @@ void swb_bwe_enc_hr_fx( L_en_noncoded_fx = L_mult0( min_env_fx, 16384 ); } - push_indice_fx( hBstr, IND_HR_HF_GAIN, ind1, NBITS_HF_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_HF_GAIN, ind1, NBITS_HF_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_HF_GAIN_BWE_HR ); } ELSE @@ -758,7 +758,7 @@ void swb_bwe_enc_hr_fx( /* Put in Q16 */ L_gain_fx = L_shr( L_temp, sub( 31 - 16, temp2 ) ); /* 31: 'L_temp' is already in Q31 */ ind1 = gain_quant_fx( &L_gain_fx, &gain2_fx, LG10_MIN_GLOB_GAIN_BWE_HR_Q14, LG10_MAX_GLOB_GAIN_BWE_HR_Q13, NBITS_GLOB_GAIN_BWE_HR, &exp2 ); - push_indice_fx( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); + push_indice( hBstr, IND_HR_GAIN, ind1, NBITS_GLOB_GAIN_BWE_HR ); nBits = sub( nBits, NBITS_GLOB_GAIN_BWE_HR ); /* normalize with global gain */ @@ -784,7 +784,7 @@ void swb_bwe_enc_hr_fx( WHILE( nBits > 0 ) { i = s_min( nBits, 16 ); - push_indice_fx( hBstr, IND_UNUSED, 0, i ); + push_indice( hBstr, IND_UNUSED, 0, i ); nBits = sub( nBits, i ); } return; diff --git a/lib_enc/swb_bwe_enc_lr_fx.c b/lib_enc/swb_bwe_enc_lr_fx.c index 1a397c514..938cdd971 100644 --- a/lib_enc/swb_bwe_enc_lr_fx.c +++ b/lib_enc/swb_bwe_enc_lr_fx.c @@ -806,7 +806,7 @@ static void gethar_noisegn_fx( } } - push_indice_fx( hBstr, IND_NOISEG, imin_fx, 2 ); + push_indice( hBstr, IND_NOISEG, imin_fx, 2 ); /*g=(float) pow (10.0f,gain_table[imin]);*/ L_temp = L_mult( gain_table_SWB_BWE_fx[imin_fx], 27213 ); /* Q14+Q13+1=Q28 log(10)/log(2)=3.3219 27213.23(Q13) */ @@ -909,7 +909,7 @@ static void EncodeSWBSubbands_fx( /* Write the indices into the bitstream */ FOR( k = 0; k < nBands_search_fx; k++ ) { - push_indice_fx( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_mode0_Har[k] ); + push_indice( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_mode0_Har[k] ); } IF( flag_dis == 0 ) @@ -974,7 +974,7 @@ static void EncodeSWBSubbands_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_modeNormal[k] ); + push_indice( st_fx->hBstr, IND_LAGINDICES, lagIndices_fx[k], bits_lagIndices_modeNormal[k] ); } } diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index c5d5e651e..1a14e7acb 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -866,7 +866,7 @@ void wb_tbe_enc_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_SHB_LSF, i, NUM_BITS_LBR_WB_LSF ); + push_indice( st_fx->hBstr, IND_SHB_LSF, i, NUM_BITS_LBR_WB_LSF ); } Copy( lbr_wb_bwe_lsfvq_cbook_2bit_fx + i * LPC_SHB_ORDER_LBR_WB, lsp_wb, LPC_SHB_ORDER_LBR_WB ); @@ -928,7 +928,7 @@ void wb_tbe_enc_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_SHB_LSF, i, NUM_BITS_WB_LSF ); + push_indice( st_fx->hBstr, IND_SHB_LSF, i, NUM_BITS_WB_LSF ); } Copy( wb_bwe_lsfvq_cbook_8bit_fx + i * LPC_SHB_ORDER_WB, lsp_wb, LPC_SHB_ORDER_WB ); @@ -1162,7 +1162,7 @@ void wb_tbe_enc_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_UV_FLAG, uv_flag, 1 ); + push_indice( st_fx->hBstr, IND_UV_FLAG, uv_flag, 1 ); /* Quantization of the subframe gain parameter */ QuantizeSHBsubgains_fx( st_fx, GainShape, st_fx->extl ); @@ -2482,7 +2482,7 @@ void swb_tbe_enc_fx( } ELSE { - push_indice_fx( st_fx->hBstr, IND_SHB_VF, vf_ind_fx, NUM_BITS_SHB_VF ); + push_indice( st_fx->hBstr, IND_SHB_VF, vf_ind_fx, NUM_BITS_SHB_VF ); } } @@ -5330,7 +5330,7 @@ static void QuantizeSHBsubgains_fx( idxSubGain = closest_centroid_lc_fx( subgains + NUM_SHB_SUBFR / 4, HBCB_SubGain5bit_fx, 1 << NUM_BITS_SHB_SUBGAINS ); Copy( HBCB_SubGain5bit_fx + idxSubGain * NUM_SHB_SUBFR / 4, subgains, NUM_SHB_SUBFR / 4 ); - push_indice_fx( hBstr, IND_SHB_SUBGAIN, idxSubGain, NUM_BITS_SHB_SUBGAINS ); + push_indice( hBstr, IND_SHB_SUBGAIN, idxSubGain, NUM_BITS_SHB_SUBGAINS ); FOR( i = 0; i < NUM_SHB_SUBFR / 4; i++ ) { @@ -5401,7 +5401,7 @@ static void QuantizeSHBsubgains_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( hBstr, IND_SHB_SUBGAIN, idxSubGain, NUM_BITS_SHB_SUBGAINS ); + push_indice( hBstr, IND_SHB_SUBGAIN, idxSubGain, NUM_BITS_SHB_SUBGAINS ); } } @@ -5596,7 +5596,7 @@ static void Quant_shb_ener_sf_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( st_fx->hBstr, IND_SHB_ENER_SF, idxSubEner_fx, NUM_BITS_SHB_ENER_SF ); + push_indice( st_fx->hBstr, IND_SHB_ENER_SF, idxSubEner_fx, NUM_BITS_SHB_ENER_SF ); } return; } @@ -5683,7 +5683,7 @@ static void Quant_shb_res_gshape_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( st_fx->hBstr, IND_SHB_RES_GS1 + i, idxSubGain_fx[i], NUM_BITS_SHB_RES_GS ); + push_indice( st_fx->hBstr, IND_SHB_RES_GS1 + i, idxSubGain_fx[i], NUM_BITS_SHB_RES_GS ); } } } @@ -5787,7 +5787,7 @@ static void QuantizeSHBframegain_fx( 1 << NUM_BITS_SHB_FrameGain, &idxFrameGain, &Q_GainFrame, SHBCB_FrameGain64_fx ); - push_indice_fx( st_fx->hBstr, IND_SHB_FRAMEGAIN, idxFrameGain, NUM_BITS_SHB_FrameGain ); + push_indice( st_fx->hBstr, IND_SHB_FRAMEGAIN, idxFrameGain, NUM_BITS_SHB_FrameGain ); *rf_gainFrame_ind = idxFrameGain; move16(); /* Q18 */ } @@ -5852,7 +5852,7 @@ static void QuantizeSHBframegain_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( st_fx->hBstr, IND_SHB_FRAMEGAIN, idxFrameGain, NUM_BITS_SHB_FRAMEGAIN ); + push_indice( st_fx->hBstr, IND_SHB_FRAMEGAIN, idxFrameGain, NUM_BITS_SHB_FRAMEGAIN ); } *rf_gainFrame_ind = idxFrameGain; move16(); @@ -7176,7 +7176,7 @@ static void Quant_BWE_LSF_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( hBstr, IND_SHB_LSF, lsf_idx[i], lsf_q_num_bits[i] ); + push_indice( hBstr, IND_SHB_LSF, lsf_idx[i], lsf_q_num_bits[i] ); } } @@ -7186,7 +7186,7 @@ static void Quant_BWE_LSF_fx( move16(); IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( hBstr, IND_SHB_MIRROR, m_idx, MIRROR_POINT_BITS ); + push_indice( hBstr, IND_SHB_MIRROR, m_idx, MIRROR_POINT_BITS ); } grid_idx = Find_LSF_grid_fx( lsf, lsf_q, m ); @@ -7194,7 +7194,7 @@ static void Quant_BWE_LSF_fx( hBWE_TD->grid_idx = grid_idx; IF( NE_16( st_fx->codec_mode, MODE2 ) ) { - push_indice_fx( hBstr, IND_SHB_GRID, grid_idx, NUM_LSF_GRID_BITS ); + push_indice( hBstr, IND_SHB_GRID, grid_idx, NUM_LSF_GRID_BITS ); } FOR( i = 0; i < LPC_SHB_ORDER; i++ ) @@ -7407,7 +7407,7 @@ void fb_tbe_enc_fx( } ELSE { - push_indice_fx( st->hBstr, IND_FB_SLOPE, idxGain, 4 ); + push_indice( st->hBstr, IND_FB_SLOPE, idxGain, 4 ); } return; diff --git a/lib_enc/tcq_core_enc_fx.c b/lib_enc/tcq_core_enc_fx.c index 82088be50..d5841094f 100644 --- a/lib_enc/tcq_core_enc_fx.c +++ b/lib_enc/tcq_core_enc_fx.c @@ -449,11 +449,11 @@ ivas_error tcq_core_LR_enc_fx( j = sub( bit_budget, shl( nb_bytes, 3 ) ); FOR( i = 0; i < nb_bytes; i++ ) { - push_indice_fx( hBstr, IND_HQ2_SUBBAND_TCQ, pbs_fx->buf[i], 8 ); + push_indice( hBstr, IND_HQ2_SUBBAND_TCQ, pbs_fx->buf[i], 8 ); } IF( j > 0 ) { - push_indice_fx( hBstr, IND_HQ2_SUBBAND_TCQ, shr( pbs_fx->buf[nb_bytes], ( 8 - j ) ), j ); + push_indice( hBstr, IND_HQ2_SUBBAND_TCQ, shr( pbs_fx->buf[nb_bytes], ( 8 - j ) ), j ); } /* Clear decoding buffer */ set32_fx( coefs_quant_fx, 0, sfm_end[BANDS - 1] + 1 ); diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 7fe813d12..253cc9717 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -389,7 +389,7 @@ void transition_enc_fx( /* 7bit ENCODER */ /* index = (*T0-pit_start)*2 + *T0_frac/2;*/ index = add( shl( sub( *T0, pit_start ), 1 ), shr( *T0_frac, 1 ) ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); @@ -438,7 +438,7 @@ void transition_enc_fx( limit_T0_fx( L_FRAME, 8, pit_flag, limit_flag, *T0, 0, T0_min, T0_max ); /* find T0_min and T0_max for delta search */ index = add( shl( sub( *T0, pit_start ), 1 ), shr( *T0_frac, 1 ) ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); @@ -502,7 +502,7 @@ void transition_enc_fx( *T0_frac = 0; move16(); } - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); @@ -526,7 +526,7 @@ void transition_enc_fx( *T0 = pitch_fr4_fx( &exc_fx[i_subfr], xn_fx, h1_fx, *T0_min, *T0_max, T0_frac, pit_flag, limit_flag, PIT_MIN, PIT_FR1_8b, L_FRAME, L_SUBFR ); move16(); index = delta_pit_enc_fx( 2, *T0, *T0_frac, *T0_min ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); /* Find the adaptive codebook vector - ACELP long-term prediction */ pred_lt4( &exc_fx[i_subfr], &exc_fx[i_subfr], *T0, *T0_frac, L_SUBFR + 1, pitch_inter4_2, L_INTERPOL2, PIT_UP_SAMP ); @@ -607,7 +607,7 @@ void transition_enc_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } } @@ -768,7 +768,7 @@ void transition_enc_fx( /*index = (*T0)*2 + ((*T0_frac)>>1) - (PIT16k_FR2_TC0_2SUBFR*2) + ((PIT16k_FR2_TC0_2SUBFR-PIT16k_MIN)*4);*/ index = add( sub( add( shl( *T0, 1 ), shr( *T0_frac, 1 ) ), ( PIT16k_FR2_TC0_2SUBFR * 2 ) ), ( PIT16k_FR2_TC0_2SUBFR - PIT16k_MIN ) * 4 ); } - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } ELSE IF( EQ_16( nBits, 6 ) ) { @@ -777,7 +777,7 @@ void transition_enc_fx( move16(); index = delta_pit_enc_fx( 4, *T0, *T0_frac, *T0_min ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } IF( EQ_16( nBits, 6 ) ) { @@ -804,7 +804,7 @@ void transition_enc_fx( move16(); set16_fx( &exc_fx[i_subfr], 0, L_SUBFR + 1 ); /* set excitation for current subrame to 0 */ - push_indice_fx( hBstr, IND_LP_FILT_SELECT, 0, 1 ); /* this bit is actually not needed */ + push_indice( hBstr, IND_LP_FILT_SELECT, 0, 1 ); /* this bit is actually not needed */ Copy( xn_fx, xn2_fx, L_SUBFR ); /* target vector for codebook search */ set16_fx( y1_fx, 0, L_SUBFR ); /* set filtered adaptive excitation to 0 */ @@ -839,7 +839,7 @@ void transition_enc_fx( IF( EQ_16( lp_flag, NORMAL_OPERATION ) ) { - push_indice_fx( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); + push_indice( hBstr, IND_LP_FILT_SELECT, lp_select, 1 ); } *Jopt_flag = 1; @@ -1886,7 +1886,7 @@ static void tc_enc_fx( /* write pitch index */ IF( ( GE_16( *T0, L_SUBFR ) ) && ( NE_16( *tc_subfr, 3 * L_SUBFR ) ) ) { - push_indice_fx( hBstr, IND_PITCH, 0, nBits ); + push_indice( hBstr, IND_PITCH, 0, nBits ); } ELSE IF( EQ_16( *tc_subfr, 3 * L_SUBFR ) ) { @@ -1898,7 +1898,7 @@ static void tc_enc_fx( { index = abs_pit_enc_fx( 2, 0, *T0, *T0_frac ); } - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); limit_T0_fx( L_FRAME, 8, 0, 0, *T0, 0, T0_min, T0_max ); } @@ -1907,12 +1907,12 @@ static void tc_enc_fx( IF( EQ_16( nBits, 6 ) ) { index = delta_pit_enc_fx( 2, *T0, *T0_frac, PIT_MIN - 1 ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } ELSE { index = delta_pit_enc_fx( 0, *T0, *T0_frac, PIT_MIN - 1 ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } } } @@ -1926,13 +1926,13 @@ static void tc_enc_fx( ELSE IF( EQ_16( nBits, 6 ) ) { index = add( shl( sub( *T0, PIT16k_MIN ), 1 ), shr( *T0_frac, 1 ) ); - push_indice_fx( hBstr, IND_PITCH, index, nBits ); + push_indice( hBstr, IND_PITCH, index, nBits ); } } - push_indice_fx( hBstr, IND_TC_IMP_SHAPE, imp_shape, 3 ); - push_indice_fx( hBstr, IND_TC_IMP_POS, imp_pos, 6 ); - push_indice_fx( hBstr, IND_TC_IMP_SIGN, pitch_sign_fx, 1 ); - push_indice_fx( hBstr, IND_TC_IMP_GAIN, pitch_index, 3 ); + push_indice( hBstr, IND_TC_IMP_SHAPE, imp_shape, 3 ); + push_indice( hBstr, IND_TC_IMP_POS, imp_pos, 6 ); + push_indice( hBstr, IND_TC_IMP_SIGN, pitch_sign_fx, 1 ); + push_indice( hBstr, IND_TC_IMP_GAIN, pitch_index, 3 ); *position = add( imp_pos, i_subfr ); move16(); diff --git a/lib_enc/voiced_enc_fx.c b/lib_enc/voiced_enc_fx.c index b0dba61de..8081b2909 100644 --- a/lib_enc/voiced_enc_fx.c +++ b/lib_enc/voiced_enc_fx.c @@ -1156,7 +1156,7 @@ ivas_error ppp_voiced_encoder_fx( { Q_delta_lag = add( delta_lag_E, 11 ); /* to make it positive always */ - push_indice_fx( hBstr, IND_DELTALAG, Q_delta_lag, 5 ); + push_indice( hBstr, IND_DELTALAG, Q_delta_lag, 5 ); } WIsyn_fx( *dtfs_temp_fx, CURRP_Q_E_FX, lpc2_fx, &( hSC_VBR->ph_offset_E_fx ), out_fx, L_FRAME, 0, S_fx, C_fx, -- GitLab From dd98b3e4fa57b4bc8b07e175610df09427ba1916 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 14:01:42 -0400 Subject: [PATCH 21/35] fix clang --- lib_enc/transition_enc_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/transition_enc_fx.c b/lib_enc/transition_enc_fx.c index 253cc9717..6718552c5 100644 --- a/lib_enc/transition_enc_fx.c +++ b/lib_enc/transition_enc_fx.c @@ -803,7 +803,7 @@ void transition_enc_fx( *Jopt_flag = 0; move16(); - set16_fx( &exc_fx[i_subfr], 0, L_SUBFR + 1 ); /* set excitation for current subrame to 0 */ + set16_fx( &exc_fx[i_subfr], 0, L_SUBFR + 1 ); /* set excitation for current subrame to 0 */ push_indice( hBstr, IND_LP_FILT_SELECT, 0, 1 ); /* this bit is actually not needed */ Copy( xn_fx, xn2_fx, L_SUBFR ); /* target vector for codebook search */ -- GitLab From 7fa6d1bb0c0fe89cb8226b89a80803ed9f59d4b5 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 14:05:40 -0400 Subject: [PATCH 22/35] replace EVS push_next_indice_fx byt IVAS one --- lib_com/bitstream_fx.c | 4 +- lib_com/igf_base_fx.c | 2 +- lib_com/parameter_bitmaping_fx.c | 2 +- lib_enc/ACcontextMapping_enc_fx.c | 2 +- lib_enc/ari_hm_enc_fx.c | 4 +- lib_enc/decision_matrix_enc_fx.c | 4 +- lib_enc/enc_prm_fx.c | 130 +++++++++++++++--------------- lib_enc/evs_enc_fx.c | 14 ++-- lib_enc/fd_cng_enc_fx.c | 4 +- lib_enc/guided_plc_enc_fx.c | 6 +- lib_enc/igf_enc_fx.c | 4 +- lib_enc/igf_scf_enc_fx.c | 2 +- lib_enc/lsf_msvq_ma_enc_fx.c | 10 +-- lib_enc/qlpc_avq_fx.c | 20 ++--- lib_enc/swb_tbe_enc_fx.c | 28 +++---- 15 files changed, 118 insertions(+), 118 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 667958264..8cb968bf1 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -288,9 +288,8 @@ void push_indice_fx( return; } -#endif /*-------------------------------------------------------------------* - * push_next_indice_fx() * + * push_next_indice() * * Push a new indice into the buffer at the next position *-------------------------------------------------------------------*/ @@ -315,6 +314,7 @@ void push_next_indice_fx( return; } +#endif /*-------------------------------------------------------------------* diff --git a/lib_com/igf_base_fx.c b/lib_com/igf_base_fx.c index fbccdb519..44cf27c5f 100644 --- a/lib_com/igf_base_fx.c +++ b/lib_com/igf_base_fx.c @@ -1242,7 +1242,7 @@ void IGFCommonFuncsWriteSerialBit( IF( hBstr ) { - push_next_indice_fx( hBstr, bit, 1 ); + push_next_indice( hBstr, bit, 1 ); } *pBitOffset = add( *pBitOffset, 1 ); move16(); diff --git a/lib_com/parameter_bitmaping_fx.c b/lib_com/parameter_bitmaping_fx.c index 0846c618b..923872090 100644 --- a/lib_com/parameter_bitmaping_fx.c +++ b/lib_com/parameter_bitmaping_fx.c @@ -21,7 +21,7 @@ static Word16 PutIntoBitstream_fx( value = *( *pStream )++; codedValue = EncodeValue( value, index ); - push_next_indice_fx( hBstr, codedValue, nBits ); + push_next_indice( hBstr, codedValue, nBits ); return value; } diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index c52fddf97..4e02b1f11 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -343,7 +343,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( /* Push number of encoded tuples */ value = sub( shr( lastnz, 1 ), 1 ); /* Q0 */ - push_next_indice_fx( hBstr, value, nbbits_ntuples ); + push_next_indice( hBstr, value, nbbits_ntuples ); /* Push arithmetic coded bits */ push_next_bits_fx( hBstr, &ptr[nbbits_ntuples], sub( bp, nbbits_ntuples ) ); diff --git a/lib_enc/ari_hm_enc_fx.c b/lib_enc/ari_hm_enc_fx.c index 76d48ccf4..343f1890f 100644 --- a/lib_enc/ari_hm_enc_fx.c +++ b/lib_enc/ari_hm_enc_fx.c @@ -42,12 +42,12 @@ Word16 EncodeIndex_fx( NumRatioBitsBwLtpIndx = NumRatioBits[Bandwidth][LtpPitchIndex]; move16(); - push_next_indice_fx( hBst, s_and( PeriodicityIndex, 0xff ), NumRatioBitsBwLtpIndx ); + push_next_indice( hBst, s_and( PeriodicityIndex, 0xff ), NumRatioBitsBwLtpIndx ); return NumRatioBitsBwLtpIndx; } ELSE { - push_next_indice_fx( hBst, PeriodicityIndex, 8 ); + push_next_indice( hBst, PeriodicityIndex, 8 ); return 8; } } diff --git a/lib_enc/decision_matrix_enc_fx.c b/lib_enc/decision_matrix_enc_fx.c index 63a13aa1a..bc5feeb6b 100644 --- a/lib_enc/decision_matrix_enc_fx.c +++ b/lib_enc/decision_matrix_enc_fx.c @@ -527,8 +527,8 @@ void signalling_enc_fx( assert( !st_fx->tcxonly ); assert( st_fx->core == HQ_CORE ); - push_next_indice_fx( hBstr, 1, 1 ); /* TCX */ - push_next_indice_fx( hBstr, 1, 1 ); /* HQ_CORE */ + push_next_indice( hBstr, 1, 1 ); /* TCX */ + push_next_indice( hBstr, 1, 1 ); /* HQ_CORE */ /* write ACELP->HQ core switching flag */ test(); diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index ecd4e2f01..6c052e596 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -33,7 +33,7 @@ static void enc_prm_hm( } /* Flag */ - push_next_indice_fx( hBstr, prm_hm[0], 1 ); + push_next_indice( hBstr, prm_hm[0], 1 ); IF( prm_hm[0] ) { @@ -50,7 +50,7 @@ static void enc_prm_hm( IF( EQ_16( st->hTcxCfg->coder_type, VOICED ) ) { /* Gain index */ - push_next_indice_fx( hBstr, prm_hm[2], kTcxHmNumGainBits ); + push_next_indice( hBstr, prm_hm[2], kTcxHmNumGainBits ); } } } @@ -152,7 +152,7 @@ void enc_prm_rf_ivas_fx( index = 3; move16(); } - push_next_indice_fx( hBstr, index, 2 ); + push_next_indice( hBstr, index, 2 ); IF( EQ_16( rf_frame_type, RF_TCXFD ) ) { @@ -296,9 +296,9 @@ void enc_prm_rf_fx( /* LSF indices */ IF( EQ_16( rf_frame_type, RF_TCXFD ) ) { - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][0], lsf_numbits[0] ); /* VQ 1 */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][1], lsf_numbits[1] ); /* VQ 2 */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][2], lsf_numbits[2] ); /* VQ 3 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][0], lsf_numbits[0] ); /* VQ 1 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][1], lsf_numbits[1] ); /* VQ 2 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][2], lsf_numbits[2] ); /* VQ 3 */ } /* classification */ @@ -324,12 +324,12 @@ void enc_prm_rf_fx( index = 3; move16(); } - push_next_indice_fx( hBstr, index, 2 ); + push_next_indice( hBstr, index, 2 ); IF( EQ_16( rf_frame_type, RF_TCXFD ) ) { /* TCX global gain = 7 bits */ - push_next_indice_fx( hBstr, hRF->rf_gain_tcx[fec_offset], 7 ); + push_next_indice( hBstr, hRF->rf_gain_tcx[fec_offset], 7 ); /*window info 1 bit for long overlap 2 if minimum or half overlap*/ @@ -345,35 +345,35 @@ void enc_prm_rf_fx( test(); IF( ( EQ_16( rf_frame_type, RF_TCXTD1 ) || EQ_16( rf_frame_type, RF_TCXTD2 ) ) && hTcxEnc->tcxltp != 0 ) { - push_next_indice_fx( hBstr, hRF->rf_tcxltp_param[fec_offset], 9 ); + push_next_indice( hBstr, hRF->rf_tcxltp_param[fec_offset], 9 ); } } } ELSE IF( EQ_16( rf_frame_type, 7 ) ) /* NELP bitstream writing */ { /* LSF indices */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */ /* NELP gain indices */ - push_next_indice_fx( hBstr, hRF->rf_indx_nelp_iG1[fec_offset], 5 ); - push_next_indice_fx( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][0], 6 ); - push_next_indice_fx( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][1], 6 ); + push_next_indice( hBstr, hRF->rf_indx_nelp_iG1[fec_offset], 5 ); + push_next_indice( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][0], 6 ); + push_next_indice( hBstr, hRF->rf_indx_nelp_iG2[fec_offset][1], 6 ); /* NELP filter selection index */ - push_next_indice_fx( hBstr, hRF->rf_indx_nelp_fid[fec_offset], 2 ); + push_next_indice( hBstr, hRF->rf_indx_nelp_fid[fec_offset], 2 ); /* tbe gainFr */ - push_next_indice_fx( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 5 ); + push_next_indice( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 5 ); } ELSE IF( GE_16( rf_frame_type, 4 ) ) /* rf_frame_type ALL_PRED: 4, NO_PRED: 5, GEN_PRED: 6 */ { /* LSF indices */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */ - push_next_indice_fx( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][0], 8 ); /* VQ 1 */ + push_next_indice( hBstr, hRF->rf_indx_lsf[fec_offset][1], 8 ); /* VQ 2 */ /* ES pred */ - push_next_indice_fx( hBstr, hRF->rf_indx_EsPred[fec_offset], 3 ); + push_next_indice( hBstr, hRF->rf_indx_EsPred[fec_offset], 3 ); ltp_mode = ACELP_LTP_MODE[1][1][rf_frame_type]; /* Q0 */ ltf_mode = ACELP_LTF_MODE[1][1][rf_frame_type]; /* Q0 */ @@ -386,13 +386,13 @@ void enc_prm_rf_fx( n = ACELP_LTP_BITS_SFR[ltp_mode][sfr]; IF( n != 0 ) { - push_next_indice_fx( hBstr, hRF->rf_indx_pitch[fec_offset][sfr], n ); + push_next_indice( hBstr, hRF->rf_indx_pitch[fec_offset][sfr], n ); } /* Adaptive codebook filtering (1 bit) */ IF( EQ_16( ltf_mode, 2 ) ) { - push_next_indice_fx( hBstr, hRF->rf_indx_ltfMode[fec_offset][sfr], 1 ); + push_next_indice( hBstr, hRF->rf_indx_ltfMode[fec_offset][sfr], 1 ); } /*Innovative codebook*/ @@ -403,7 +403,7 @@ void enc_prm_rf_fx( ( EQ_16( rf_frame_type, RF_GENPRED ) && ( sfr == 0 || EQ_16( sfr, 2 ) ) ) ) { - push_next_indice_fx( hBstr, hRF->rf_indx_fcb[fec_offset][sfr], 7 ); + push_next_indice( hBstr, hRF->rf_indx_fcb[fec_offset][sfr], 7 ); } /* Gains (5b, 6b or 7b / subfr) */ @@ -411,11 +411,11 @@ void enc_prm_rf_fx( IF( sfr == 0 || EQ_16( sfr, 2 ) ) { n = ACELP_GAINS_BITS[gains_mode]; - push_next_indice_fx( hBstr, hRF->rf_indx_gain[fec_offset][sfr], n ); + push_next_indice( hBstr, hRF->rf_indx_gain[fec_offset][sfr], n ); } } /* tbe gainFr */ - push_next_indice_fx( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 2 ); + push_next_indice( hBstr, hRF->rf_indx_tbeGainFr[fec_offset], 2 ); } /***************/ @@ -429,15 +429,15 @@ void enc_prm_rf_fx( test(); IF( EQ_16( fec_offset, 2 ) ) { - push_next_indice_fx( hBstr, 0, 2 ); + push_next_indice( hBstr, 0, 2 ); } ELSE IF( EQ_16( fec_offset, 3 ) || EQ_16( fec_offset, 5 ) || EQ_16( fec_offset, 7 ) ) { - push_next_indice_fx( hBstr, ( fec_offset - 1 ) / 2, 2 ); + push_next_indice( hBstr, ( fec_offset - 1 ) / 2, 2 ); } /* write RF frame type last in the bitstream */ - push_next_indice_fx( hBstr, rf_frame_type, 3 ); + push_next_indice( hBstr, rf_frame_type, 3 ); } @@ -533,7 +533,7 @@ void enc_prm_fx( IF( st->tcxonly ) { - push_next_indice_fx( hBstr, core == TCX_10_CORE, 1 ); + push_next_indice( hBstr, core == TCX_10_CORE, 1 ); { index = 3; move16(); @@ -553,7 +553,7 @@ void enc_prm_fx( index = 2; move16(); } - push_next_indice_fx( hBstr, index, 2 ); + push_next_indice( hBstr, index, 2 ); } } ELSE @@ -581,13 +581,13 @@ void enc_prm_fx( { idx = add( idx, 1 ); /* Q0 */ } - push_next_indice_fx( hBstr, idx - start_idx, nBits ); - push_next_indice_fx( hBstr, 0, 1 ); /* Indicate to the decoder that the core is ACELP*/ + push_next_indice( hBstr, idx - start_idx, nBits ); + push_next_indice( hBstr, 0, 1 ); /* Indicate to the decoder that the core is ACELP*/ nbits_start = 3; /* Q0 */ } ELSE { - push_next_indice_fx( hBstr, coder_type, 3 ); + push_next_indice( hBstr, coder_type, 3 ); } } ELSE @@ -595,15 +595,15 @@ void enc_prm_fx( IF( EQ_16( st->mdct_sw, MODE1 ) ) { /* 2 bits instead of 3 as TCX is already signaled */ - push_next_indice_fx( hBstr, st->hTcxCfg->coder_type, 2 ); + push_next_indice( hBstr, st->hTcxCfg->coder_type, 2 ); } ELSE { IF( EQ_16( st->mdct_sw_enable, MODE2 ) ) { - push_next_indice_fx( hBstr, 1, 1 ); /* TCX */ - push_next_indice_fx( hBstr, 0, 1 ); /* not HQ_CORE */ - push_next_indice_fx( hBstr, st->hTcxCfg->coder_type, 2 ); + push_next_indice( hBstr, 1, 1 ); /* TCX */ + push_next_indice( hBstr, 0, 1 ); /* not HQ_CORE */ + push_next_indice( hBstr, st->hTcxCfg->coder_type, 2 ); } ELSE { @@ -641,13 +641,13 @@ void enc_prm_fx( { idx = add( idx, 1 ); } - push_next_indice_fx( hBstr, idx - start_idx, nBits ); - push_next_indice_fx( hBstr, 1, 1 ); /* Indicate to the decoder that the core is TCX*/ + push_next_indice( hBstr, idx - start_idx, nBits ); + push_next_indice( hBstr, 1, 1 ); /* Indicate to the decoder that the core is TCX*/ nbits_start = 3; } ELSE { - push_next_indice_fx( hBstr, 4 + st->hTcxCfg->coder_type, 3 ); + push_next_indice( hBstr, 4 + st->hTcxCfg->coder_type, 3 ); } } } @@ -667,7 +667,7 @@ void enc_prm_fx( tmp = TCX_20_CORE; move16(); } - push_next_indice_fx( hBstr, tmp, 1 ); + push_next_indice( hBstr, tmp, 1 ); } /* write TCX overlap mode (1 bit: full, 2 bits: half or no overlap) */ @@ -696,7 +696,7 @@ void enc_prm_fx( overlap_code = 0; move16(); } - push_next_indice_fx( hBstr, overlap_code, nbits_tcx ); + push_next_indice( hBstr, overlap_code, nbits_tcx ); } IF( st->hPlcExt->enableGplc ) @@ -719,7 +719,7 @@ void enc_prm_fx( IF( EQ_16( core, ACELP_CORE ) ) { - push_next_indice_fx( hBstr, st->glr_idx[0], G_LPC_RECOVERY_BITS ); + push_next_indice( hBstr, st->glr_idx[0], G_LPC_RECOVERY_BITS ); } } @@ -789,7 +789,7 @@ void enc_prm_fx( IF( n != 0 ) { - push_next_indice_fx( hBstr, st->bpf_gain_param, n ); + push_next_indice( hBstr, st->bpf_gain_param, n ); } /* Mean energy (2 or 3 bits) */ @@ -797,7 +797,7 @@ void enc_prm_fx( IF( n != 0 ) { - push_next_indice_fx( hBstr, prm[j++], n ); + push_next_indice( hBstr, prm[j++], n ); } /* Subframe parameters */ @@ -810,14 +810,14 @@ void enc_prm_fx( IF( n != 0 ) { - push_next_indice_fx( hBstr, prm[j++], n ); + push_next_indice( hBstr, prm[j++], n ); } /* Adaptive codebook filtering (1 bit) */ IF( EQ_16( st->acelp_cfg.ltf_mode, 2 ) ) { - push_next_indice_fx( hBstr, prm[j++], 1 ); + push_next_indice( hBstr, prm[j++], 1 ); } /*Innovative codebook*/ @@ -839,12 +839,12 @@ void enc_prm_fx( FOR( ix = 0; ix < wordcnt; ix++ ) { - push_next_indice_fx( hBstr, prm[j++], 16 ); + push_next_indice( hBstr, prm[j++], 16 ); } IF( bitcnt ) { - push_next_indice_fx( hBstr, prm[j++], bitcnt ); + push_next_indice( hBstr, prm[j++], bitcnt ); } j = add( j_old, 8 ); /* Q0 */ @@ -852,7 +852,7 @@ void enc_prm_fx( /* Gains (5b, 6b or 7b / subfr) */ n = ACELP_GAINS_BITS[st->acelp_cfg.gains_mode[sfr]]; - push_next_indice_fx( hBstr, prm[j++], n ); + push_next_indice( hBstr, prm[j++], n ); } /*end of for(sfr)*/ } /*end of mode[0]==0*/ @@ -866,14 +866,14 @@ void enc_prm_fx( move16(); IF( st->enablePlcWaveadjust ) { - push_next_indice_fx( hBstr, st->Tonal_SideInfo, 1 ); + push_next_indice( hBstr, st->Tonal_SideInfo, 1 ); } /* TCX Gain = 7 bits */ - push_next_indice_fx( hBstr, prm[j++], 7 ); + push_next_indice( hBstr, prm[j++], 7 ); /* TCX Noise Filling = NBITS_NOISE_FILL_LEVEL bits */ - push_next_indice_fx( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); + push_next_indice( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); /* LTP data */ test(); @@ -881,13 +881,13 @@ void enc_prm_fx( { IF( prm[j] ) { - push_next_indice_fx( hBstr, 1, 1 ); - push_next_indice_fx( hBstr, prm[j + 1], 9 ); - push_next_indice_fx( hBstr, prm[j + 2], 2 ); + push_next_indice( hBstr, 1, 1 ); + push_next_indice( hBstr, prm[j + 1], 9 ); + push_next_indice( hBstr, prm[j + 2], 2 ); } ELSE { - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); } } j = add( j, 3 ); @@ -932,7 +932,7 @@ void enc_prm_fx( test(); IF( st->hTcxCfg->ctx_hm && NE_16( last_core, ACELP_CORE ) ) { - push_next_indice_fx( hBstr, prm[j], 1 ); + push_next_indice( hBstr, prm[j], 1 ); IF( prm[j] ) { @@ -1015,14 +1015,14 @@ void enc_prm_fx( test(); IF( st->enablePlcWaveadjust && k ) { - push_next_indice_fx( hBstr, st->Tonal_SideInfo, 1 ); + push_next_indice( hBstr, st->Tonal_SideInfo, 1 ); } /* TCX Gain = 7 bits */ - push_next_indice_fx( hBstr, prm[j++], 7 ); + push_next_indice( hBstr, prm[j++], 7 ); /* TCX Noise Filling = NBITS_NOISE_FILL_LEVEL bits */ - push_next_indice_fx( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); + push_next_indice( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); /* LTP data */ test(); @@ -1031,13 +1031,13 @@ void enc_prm_fx( { IF( prm[j] ) { - push_next_indice_fx( hBstr, 1, 1 ); - push_next_indice_fx( hBstr, prm[j + 1], 9 ); - push_next_indice_fx( hBstr, prm[j + 2], 2 ); + push_next_indice( hBstr, 1, 1 ); + push_next_indice( hBstr, prm[j + 1], 9 ); + push_next_indice( hBstr, prm[j + 2], 2 ); } ELSE { - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); } } j = add( j, 3 ); @@ -1079,7 +1079,7 @@ void enc_prm_fx( test(); IF( st->hTcxCfg->ctx_hm && !( last_core == ACELP_CORE && k == 0 ) ) { - push_next_indice_fx( hBstr, prm[j], 1 ); + push_next_indice( hBstr, prm[j], 1 ); IF( prm[j] ) { diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c index c86b7e061..396e97c6f 100644 --- a/lib_enc/evs_enc_fx.c +++ b/lib_enc/evs_enc_fx.c @@ -419,7 +419,7 @@ ivas_error evs_enc_fx( FOR( i = 0; i < padBits; i++ ) { - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); } } @@ -678,19 +678,19 @@ static void writeFrameHeader_loc( Encoder_State *st ) IF( EQ_16( st->cng_type, FD_CNG ) ) { /* write SID/CNG type flag */ - push_next_indice_fx( hBstr, 1, 1 ); + push_next_indice( hBstr, 1, 1 ); /* write bandwidth mode */ - push_next_indice_fx( hBstr, st->bwidth, 2 ); + push_next_indice( hBstr, st->bwidth, 2 ); /* write L_frame */ IF( EQ_16( st->L_frame, L_FRAME ) ) { - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); } ELSE { - push_next_indice_fx( hBstr, 1, 1 ); + push_next_indice( hBstr, 1, 1 ); } } } @@ -698,7 +698,7 @@ static void writeFrameHeader_loc( Encoder_State *st ) { IF( st->rf_mode == 0 ) { - push_next_indice_fx( hBstr, sub( st->bwidth, FrameSizeConfig[st->frame_size_index].bandwidth_min ), FrameSizeConfig[st->frame_size_index].bandwidth_bits ); + push_next_indice( hBstr, sub( st->bwidth, FrameSizeConfig[st->frame_size_index].bandwidth_min ), FrameSizeConfig[st->frame_size_index].bandwidth_bits ); } } @@ -706,7 +706,7 @@ static void writeFrameHeader_loc( Encoder_State *st ) test(); IF( FrameSizeConfig[st->frame_size_index].reserved_bits && st->rf_mode == 0 ) { - push_next_indice_fx( hBstr, 0, FrameSizeConfig[st->frame_size_index].reserved_bits ); + push_next_indice( hBstr, 0, FrameSizeConfig[st->frame_size_index].reserved_bits ); } } diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 2eb13646c..d182e4a44 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -1211,9 +1211,9 @@ void FdCng_encodeSID_fx( HANDLE_FD_CNG_ENC stenc, /* i/o: pointer to FD_CNG stru { FOR( i = 0; i < stages_37bits; i++ ) { - push_next_indice_fx( hBstr, indices[i], bits_37bits[i] ); + push_next_indice( hBstr, indices[i], bits_37bits[i] ); } - push_next_indice_fx( hBstr, index, 7 ); + push_next_indice( hBstr, index, 7 ); } ELSE { diff --git a/lib_enc/guided_plc_enc_fx.c b/lib_enc/guided_plc_enc_fx.c index 60a3f8f50..81e50d099 100644 --- a/lib_enc/guided_plc_enc_fx.c +++ b/lib_enc/guided_plc_enc_fx.c @@ -215,7 +215,7 @@ void enc_prm_side_Info_fx( IF( GT_16( hPlc_Ext->nBits, 1 ) ) { - push_next_indice_fx( st->hBstr, 1, 1 ); + push_next_indice( st->hBstr, 1, 1 ); diff_pitch = sub( hPlc_Ext->T0, hPlc_Ext->T0_4th ); test(); @@ -225,11 +225,11 @@ void enc_prm_side_Info_fx( move16(); } - push_next_indice_fx( st->hBstr, add( diff_pitch, search_range ), bits_per_subfr ); + push_next_indice( st->hBstr, add( diff_pitch, search_range ), bits_per_subfr ); } ELSE { - push_next_indice_fx( st->hBstr, 0, 1 ); + push_next_indice( st->hBstr, 0, 1 ); } return; diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index cc4840876..f5c13df57 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -1513,13 +1513,13 @@ Word16 IGFEncWriteConcatenatedBitstream_fx( tmp = shr( hPrivateData->igfBitstreamBits, 3 ); FOR( i = 0; i < tmp; i++ ) { - push_next_indice_fx( hBstr, pBitstream[i], 8 ); + push_next_indice( hBstr, pBitstream[i], 8 ); } bitsLeft = s_and( hPrivateData->igfBitstreamBits, 0x7 ); IF( bitsLeft > 0 ) { - push_next_indice_fx( hBstr, shr( pBitstream[i], sub( 8, bitsLeft ) ), bitsLeft ); + push_next_indice( hBstr, shr( pBitstream[i], sub( 8, bitsLeft ) ), bitsLeft ); } return hInstance->infoTotalBitsWritten; diff --git a/lib_enc/igf_scf_enc_fx.c b/lib_enc/igf_scf_enc_fx.c index 8659d53a1..ed52349dc 100644 --- a/lib_enc/igf_scf_enc_fx.c +++ b/lib_enc/igf_scf_enc_fx.c @@ -358,7 +358,7 @@ Word16 IGFSCFEncoderEncode_fx( { FOR( i = 0; i < hPublicData->ptrBitIndex; ++i ) { - push_next_indice_fx( hBstr, ptr[i], 1 ); + push_next_indice( hBstr, ptr[i], 1 ); } } diff --git a/lib_enc/lsf_msvq_ma_enc_fx.c b/lib_enc/lsf_msvq_ma_enc_fx.c index aa2255c68..8f6a21d03 100644 --- a/lib_enc/lsf_msvq_ma_enc_fx.c +++ b/lib_enc/lsf_msvq_ma_enc_fx.c @@ -834,7 +834,7 @@ Word16 enc_lsf_tcxlpc_fx( move16(); FOR( i = 0; i < TCXLPC_NUMSTAGES; ++i ) { - push_next_indice_fx( hBstr, **indices, lsf_numbits[i] ); + push_next_indice( hBstr, **indices, lsf_numbits[i] ); ++*indices; } @@ -843,7 +843,7 @@ Word16 enc_lsf_tcxlpc_fx( NumBits = add( NumBits, TCXLPC_IND_NUMBITS ); FOR( i = 0; i < TCXLPC_IND_NUMSTAGES; ++i ) { - push_next_indice_fx( hBstr, **indices, lsf_ind_numbits[i] ); + push_next_indice( hBstr, **indices, lsf_ind_numbits[i] ); ++*indices; } } @@ -909,7 +909,7 @@ Word16 lsf_msvq_ma_encprm_fx( FOR( i = 0; i < no_indices; i++ ) { - push_next_indice_fx( hBstr, *param_lpc, bits_param_lpc[i] ); + push_next_indice( hBstr, *param_lpc, bits_param_lpc[i] ); param_lpc++; nbits_lpc = add( nbits_lpc, bits_param_lpc[i] ); } @@ -919,7 +919,7 @@ Word16 lsf_msvq_ma_encprm_fx( IF( ( core == ACELP_CORE ) && acelp_midLpc ) { - push_next_indice_fx( hBstr, *param_lpc, bits_midlpc ); + push_next_indice( hBstr, *param_lpc, bits_midlpc ); nbits_lpc = add( nbits_lpc, bits_midlpc ); } } @@ -981,7 +981,7 @@ Word16 lsf_bctcvq_encprm_fx( FOR( i = 0; i < no_indices; i++ ) { - push_next_indice_fx( hBstr, *param_lpc, bits_param_lpc[i] ); + push_next_indice( hBstr, *param_lpc, bits_param_lpc[i] ); param_lpc++; nbits_lpc = add( nbits_lpc, bits_param_lpc[i] ); } diff --git a/lib_enc/qlpc_avq_fx.c b/lib_enc/qlpc_avq_fx.c index 13e0a3cf7..288612e43 100644 --- a/lib_enc/qlpc_avq_fx.c +++ b/lib_enc/qlpc_avq_fx.c @@ -143,12 +143,12 @@ static Word16 unary_code( FOR( ; ind > 0; ind-- ) { - push_next_indice_fx( hBstr, 1, 1 ); + push_next_indice( hBstr, 1, 1 ); nb_bits = add( nb_bits, 1 ); // Q0 } /* Stop bit */ - push_next_indice_fx( hBstr, 0, 1 ); + push_next_indice( hBstr, 0, 1 ); return ( nb_bits ); } @@ -195,7 +195,7 @@ static Word16 unpack4bits( IF( nbits == 0 ) { - push_next_indice_fx( hBstr, 0, 0 ); + push_next_indice( hBstr, 0, 0 ); i = 1; move16(); } @@ -206,10 +206,10 @@ static Word16 unpack4bits( FOR( ; nbits > 4; nbits -= 4 ) { - push_next_indice_fx( hBstr, prm[i], 4 ); + push_next_indice( hBstr, prm[i], 4 ); i = add( i, 1 ); } - push_next_indice_fx( hBstr, prm[i], nbits ); + push_next_indice( hBstr, prm[i], nbits ); i = add( i, 1 ); } @@ -330,7 +330,7 @@ Word16 encode_lpc_avq_fx( { nb = 1; move16(); - push_next_indice_fx( hBstr, q_type, nb ); + push_next_indice( hBstr, q_type, nb ); } nb_bits = add( nb_bits, nb ); // Q0 @@ -342,7 +342,7 @@ Word16 encode_lpc_avq_fx( IF( ( ( q_type == 0 ) && NE_16( element_mode, IVAS_CPE_MDCT ) ) || ( ( q_type == 0 ) && ( GE_16( st1, 0 ) ) && EQ_16( element_mode, IVAS_CPE_MDCT ) ) ) { /* Absolute quantizer with 1st stage stochastic codebook */ - push_next_indice_fx( hBstr, st1, bits_for_abs_quant ); + push_next_indice( hBstr, st1, bits_for_abs_quant ); nb_bits = add( nb_bits, bits_for_abs_quant ); // Q0 } @@ -350,7 +350,7 @@ Word16 encode_lpc_avq_fx( test(); IF( EQ_16( element_mode, IVAS_CPE_MDCT ) && EQ_16( stereo_mode, 3 ) && st1 < 0 ) { - push_next_indice_fx( hBstr, add( st1, 2 ), 1 ); + push_next_indice( hBstr, add( st1, 2 ), 1 ); nb_bits = add( nb_bits, 1 ); // Q0 } @@ -368,7 +368,7 @@ Word16 encode_lpc_avq_fx( move16(); i = 3; } - push_next_indice_fx( hBstr, i, 2 ); + push_next_indice( hBstr, i, 2 ); i = sub( qn2, 2 ); @@ -377,7 +377,7 @@ Word16 encode_lpc_avq_fx( move16(); i = 3; } - push_next_indice_fx( hBstr, i, 2 ); + push_next_indice( hBstr, i, 2 ); /* Unary code for abs and rel LPC0/LPC2 */ /* Q5 = 0, Q6=10, Q0=110, Q7=1110, ... */ diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 1a14e7acb..316a5b549 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -7579,10 +7579,10 @@ void tbe_write_bitstream_fx( IF( ( st_fx->rf_mode || EQ_32( st_fx->total_brate, ACELP_9k60 ) ) && ( EQ_16( st_fx->bwidth, WB ) ) ) { /* WB LSF */ - push_next_indice_fx( hBstr, hBWE_TD->lsf_WB, NUM_BITS_LBR_WB_LSF ); + push_next_indice( hBstr, hBWE_TD->lsf_WB, NUM_BITS_LBR_WB_LSF ); /* WB frame */ - push_next_indice_fx( hBstr, hBWE_TD->gFrame_WB, NUM_BITS_SHB_FrameGain_LBR_WB ); + push_next_indice( hBstr, hBWE_TD->gFrame_WB, NUM_BITS_SHB_FrameGain_LBR_WB ); } ELSE IF( ( GE_32( st_fx->total_brate, ACELP_9k60 ) ) && ( LE_32( st_fx->total_brate, ACELP_32k ) ) && ( ( EQ_16( st_fx->bwidth, SWB ) ) || ( EQ_16( st_fx->bwidth, FB ) ) ) ) @@ -7592,53 +7592,53 @@ void tbe_write_bitstream_fx( test(); IF( ( EQ_16( st_fx->rf_mode, 1 ) ) || EQ_32( st_fx->total_brate, ACELP_9k60 ) ) { - push_next_indice_fx( hBstr, hBWE_TD->lsf_idx[0], 8 ); + push_next_indice( hBstr, hBWE_TD->lsf_idx[0], 8 ); } ELSE { FOR( i = 0; i < NUM_Q_LSF; i++ ) { - push_next_indice_fx( hBstr, hBWE_TD->lsf_idx[i], lsf_q_num_bits[i] ); + push_next_indice( hBstr, hBWE_TD->lsf_idx[i], lsf_q_num_bits[i] ); } /* LSF mirror points */ - push_next_indice_fx( hBstr, hBWE_TD->m_idx, MIRROR_POINT_BITS ); + push_next_indice( hBstr, hBWE_TD->m_idx, MIRROR_POINT_BITS ); /* LSF grid points */ - push_next_indice_fx( hBstr, hBWE_TD->grid_idx, NUM_LSF_GRID_BITS ); + push_next_indice( hBstr, hBWE_TD->grid_idx, NUM_LSF_GRID_BITS ); } /* Gain shape */ - push_next_indice_fx( hBstr, hBWE_TD->idxSubGains, NUM_BITS_SHB_SUBGAINS ); + push_next_indice( hBstr, hBWE_TD->idxSubGains, NUM_BITS_SHB_SUBGAINS ); /* frame gain */ - push_next_indice_fx( hBstr, hBWE_TD->idxFrameGain, NUM_BITS_SHB_FRAMEGAIN ); + push_next_indice( hBstr, hBWE_TD->idxFrameGain, NUM_BITS_SHB_FRAMEGAIN ); IF( GE_32( st_fx->total_brate, ACELP_24k40 ) ) { /* sub frame energy*/ - push_next_indice_fx( hBstr, hBWE_TD->idx_shb_fr_gain, NUM_BITS_SHB_ENER_SF ); + push_next_indice( hBstr, hBWE_TD->idx_shb_fr_gain, NUM_BITS_SHB_ENER_SF ); /* gain shapes residual */ FOR( i = 0; i < NB_SUBFR16k; i++ ) { - push_next_indice_fx( hBstr, hBWE_TD->idx_res_gs[i], NUM_BITS_SHB_RES_GS ); + push_next_indice( hBstr, hBWE_TD->idx_res_gs[i], NUM_BITS_SHB_RES_GS ); } /* voicing factor */ - push_next_indice_fx( hBstr, hBWE_TD->idx_mixFac, NUM_BITS_SHB_VF ); + push_next_indice( hBstr, hBWE_TD->idx_mixFac, NUM_BITS_SHB_VF ); } IF( EQ_16( st_fx->tec_tfa, 1 ) ) { - push_next_indice_fx( hBstr, st_fx->tec_flag, BITS_TEC ); - push_next_indice_fx( hBstr, st_fx->tfa_flag, BITS_TFA ); + push_next_indice( hBstr, st_fx->tec_flag, BITS_TEC ); + push_next_indice( hBstr, st_fx->tfa_flag, BITS_TFA ); } } IF( EQ_16( st_fx->bwidth, FB ) ) { - push_next_indice_fx( hBstr, hBWE_TD->idxGain, 4 ); + push_next_indice( hBstr, hBWE_TD->idxGain, 4 ); } } -- GitLab From 469705796bbf1af9839f5b0042e670c2dbd6eaff Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 15:03:51 -0400 Subject: [PATCH 23/35] replace other EVS bitstream related stuff --- lib_com/bitstream_fx.c | 9 ++++++--- lib_enc/ACcontextMapping_enc_fx.c | 6 +++--- lib_enc/enc_prm_fx.c | 2 +- lib_enc/igf_enc.c | 4 ++-- lib_enc/igf_enc_fx.c | 4 ++-- lib_enc/lib_enc.c | 2 ++ lib_enc/tcx_utils_enc_fx.c | 26 +++++++++++++++++++++----- 7 files changed, 37 insertions(+), 16 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 8cb968bf1..d3aab2616 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -314,11 +314,10 @@ void push_next_indice_fx( return; } -#endif /*-------------------------------------------------------------------* - * push_next_bits_fx() + * push_next_bits() * Push a bit buffer into the buffer at the next position *-------------------------------------------------------------------*/ @@ -368,6 +367,7 @@ void push_next_bits_fx( hBstr->nb_bits_tot = add( hBstr->nb_bits_tot, nb_bits ); move16(); } +#endif /*-------------------------------------------------------------------* * get_next_indice_fx( ) @@ -565,6 +565,7 @@ void reset_indices_dec_fx( * * Write the buffer of indices to a file *-------------------------------------------------------------------*/ +#if 0 void write_indices_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ @@ -663,12 +664,13 @@ void write_indices_fx( return; } +#endif /*-------------------------------------------------------------------* * write_indices_buf_fx() * * Write the buffer of indices to a file *-------------------------------------------------------------------*/ - +#if 0 void write_indices_buf_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ @@ -772,6 +774,7 @@ void write_indices_buf_fx( return; } +#endif /*-------------------------------------------------------------------* * indices_to_serial() * diff --git a/lib_enc/ACcontextMapping_enc_fx.c b/lib_enc/ACcontextMapping_enc_fx.c index 4e02b1f11..43bd30fd4 100644 --- a/lib_enc/ACcontextMapping_enc_fx.c +++ b/lib_enc/ACcontextMapping_enc_fx.c @@ -346,10 +346,10 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( push_next_indice( hBstr, value, nbbits_ntuples ); /* Push arithmetic coded bits */ - push_next_bits_fx( hBstr, &ptr[nbbits_ntuples], sub( bp, nbbits_ntuples ) ); + push_next_bits( hBstr, (UWord16 *) &ptr[nbbits_ntuples], sub( bp, nbbits_ntuples ) ); /* Push sign bits */ - push_next_bits_fx( hBstr, signs, nbbits_signs ); + push_next_bits( hBstr, (UWord16 *) signs, nbbits_signs ); bp = add( bp, nbbits_signs ); /* Q0 */ /*write residual Quantization bits*/ @@ -372,7 +372,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC_fx( assert( bp + k <= nbbits ); /* Push the rest of the buffer */ - push_next_bits_fx( hBstr, &ptr[bp], sub( nbbits, bp ) ); + push_next_bits( hBstr, (UWord16 *) &ptr[bp], sub( nbbits, bp ) ); return /*(bp+nbbits_lsbs)*/; /*return only for debug plot*/ } diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index 6c052e596..1d619e6c5 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -965,7 +965,7 @@ void enc_prm_fx( IF( hTcxEnc->tcx_lpc_shaped_ari != 0 ) { - push_next_bits_fx( hBstr, &prm[++j], nbits_tcx ); + push_next_bits( hBstr, ( UWord16 * ) &prm[++j], nbits_tcx ); j = add( j, nbits_tcx ); /* Q0 */ } ELSE diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index 2680bd9f6..d0c9fa329 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -2429,7 +2429,7 @@ void IGFEncSetMode_ivas_fx( * * IGF bitstream concatenation for TCX10 modes *-------------------------------------------------------------------*/ - +#if 0 /* Float code */ void IGFEncConcatenateBitstream( const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ const Word16 bsBits, /* i : number of IGF bits written to list of indices */ @@ -2487,7 +2487,7 @@ move16(); return; } - +#endif /*-------------------------------------------------------------------* * IGFEncResetTCX10BitCounter_ivas_fx() diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index f5c13df57..a8a64422f 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -1449,7 +1449,7 @@ hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, nb_bits_written ); return; } - +#if 0 /* old bitstream */ /**********************************************************************/ /* IGF bitsream concatenation for TCX10 modes **************************************************************************/ @@ -1475,7 +1475,7 @@ void IGFEncConcatenateBitstream_fx( const IGF_ENC_INSTANCE_HANDLE hInstance, /** move16(); return; } - +#endif /**********************************************************************/ /* IGF reset bitsream bit counter for TCX10 modes **************************************************************************/ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 877fc2045..b17ba61df 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1892,6 +1892,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( } /* write indices into bitstream buffer */ +#if 0 IF( hEncoderConfig->element_mode_init == EVS_MONO ) { test(); @@ -1905,6 +1906,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( } } ELSE +#endif { write_indices_ivas_fx( st_ivas, outputBitStream, numOutBits ); } diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 7d268b92a..fd6293124 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3650,7 +3650,7 @@ Word16 tcx_res_Q_spec_ivas_fx( return bits; } - +#if 1 //TV void ProcessIGF_fx( IGF_ENC_INSTANCE_HANDLE const hInstance, /**< in: instance handle of IGF Encoder */ Encoder_State *st, /**< in: Encoder state */ @@ -3667,8 +3667,9 @@ void ProcessIGF_fx( Word16 igfGridIdx; Word16 isIndepFlag; Word16 bsBits; - Word16 bsStart; + Word16 bsStart, pBsStart; BSTR_ENC_HANDLE hBstr = st->hBstr; + IGF_ENC_INSTANCE_HANDLE hIGFEnc = st->hIGFEnc; isIndepFlag = 1; @@ -3721,6 +3722,8 @@ void ProcessIGF_fx( Word16 Q_A; Word16 predictionGain = 0; Word16 *flatteningTrigger = &( st->hIGFEnc->flatteningTrigger ); + + move32(); move16(); move16(); @@ -3750,6 +3753,7 @@ void ProcessIGF_fx( { IGFEncWriteBitstream_fx( hInstance, NULL, &hInstance->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); } +#if 0 ELSE { IGFEncWriteBitstream_fx( hInstance, st->hBstr, &hInstance->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); @@ -3760,8 +3764,20 @@ void ProcessIGF_fx( { IGFEncConcatenateBitstream_fx( hInstance, bsBits, &hBstr->next_ind_fx, &hBstr->nb_bits_tot, hBstr->ind_list ); } -} +#else + ELSE + { + pBsStart = hBstr->nb_ind_tot; + move16(); + + IGFEncWriteBitstream_ivas_fx( hIGFEnc, hBstr, &hIGFEnc->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); + bsBits = sub( hBstr->nb_ind_tot, pBsStart ); + IGFEncConcatenateBitstream_ivas_fx( hIGFEnc, bsBits, hBstr ); + } +#endif +} + #endif void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) { Word16 i, length, att; @@ -3877,7 +3893,7 @@ void ProcessIGF_ivas_fx( IGFEncWriteBitstream_ivas_fx( hIGFEnc, hBstr, &hIGFEnc->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); bsBits = sub( hBstr->nb_ind_tot, pBsStart ); - IGFEncConcatenateBitstream( hIGFEnc, bsBits, hBstr ); + IGFEncConcatenateBitstream_ivas_fx( hIGFEnc, bsBits, hBstr ); } return; @@ -3981,7 +3997,7 @@ void ProcessStereoIGF_fx( IGFEncWriteBitstream_ivas_fx( hIGFEnc[ch], hBstr, &hIGFEnc[ch]->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); bsBits = sub( hBstr->nb_ind_tot, pBsStart ); - IGFEncConcatenateBitstream( hIGFEnc[ch], bsBits, hBstr ); + IGFEncConcatenateBitstream_ivas_fx( hIGFEnc[ch], bsBits, hBstr ); } } return; -- GitLab From 9a216fbc8ecfdb3dc23206dbaf79e82cfa70819c Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 15:06:06 -0400 Subject: [PATCH 24/35] fix clang --- lib_com/bitstream_fx.c | 2 +- lib_enc/enc_prm_fx.c | 4 ++-- lib_enc/tcx_utils_enc_fx.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index d3aab2616..f0e564a8a 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -664,7 +664,7 @@ void write_indices_fx( return; } -#endif +#endif /*-------------------------------------------------------------------* * write_indices_buf_fx() * diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index 1d619e6c5..6d6a2d575 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -583,7 +583,7 @@ void enc_prm_fx( } push_next_indice( hBstr, idx - start_idx, nBits ); push_next_indice( hBstr, 0, 1 ); /* Indicate to the decoder that the core is ACELP*/ - nbits_start = 3; /* Q0 */ + nbits_start = 3; /* Q0 */ } ELSE { @@ -965,7 +965,7 @@ void enc_prm_fx( IF( hTcxEnc->tcx_lpc_shaped_ari != 0 ) { - push_next_bits( hBstr, ( UWord16 * ) &prm[++j], nbits_tcx ); + push_next_bits( hBstr, (UWord16 *) &prm[++j], nbits_tcx ); j = add( j, nbits_tcx ); /* Q0 */ } ELSE diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index fd6293124..06de6a2fa 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3650,7 +3650,7 @@ Word16 tcx_res_Q_spec_ivas_fx( return bits; } -#if 1 //TV +#if 1 // TV void ProcessIGF_fx( IGF_ENC_INSTANCE_HANDLE const hInstance, /**< in: instance handle of IGF Encoder */ Encoder_State *st, /**< in: Encoder state */ @@ -3777,7 +3777,7 @@ void ProcessIGF_fx( } #endif } - #endif +#endif void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) { Word16 i, length, att; -- GitLab From 112e0cd6b0455ab87b74ddc78ada386a7d5b8f2d Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 25 Mar 2025 15:13:41 -0400 Subject: [PATCH 25/35] fix clang --- lib_enc/tcx_utils_enc_fx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 06de6a2fa..ec1db2cf3 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3667,7 +3667,11 @@ void ProcessIGF_fx( Word16 igfGridIdx; Word16 isIndepFlag; Word16 bsBits; +#if 0 Word16 bsStart, pBsStart; +#else + Word16 pBsStart; +#endif BSTR_ENC_HANDLE hBstr = st->hBstr; IGF_ENC_INSTANCE_HANDLE hIGFEnc = st->hIGFEnc; @@ -3744,8 +3748,9 @@ void ProcessIGF_fx( } } +#if 0 bsStart = hBstr->next_ind_fx; - +#endif move16(); hInstance->infoTotalBitsPerFrameWritten = 0; move16(); -- GitLab From 95ea2c5fb0bd8883ade9207dc5d36262b91f8f2f Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 26 Mar 2025 09:06:17 -0400 Subject: [PATCH 26/35] work on encoder config duplication --- lib_enc/ivas_init_enc_fx.c | 46 ++++++++++++++++++-------------------- lib_enc/lib_enc.c | 10 ++++++--- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 57858b03e..19996e2e4 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -463,7 +463,7 @@ void ivas_initialize_handles_enc_fx( * * Initialize IVAS encoder state structure *-------------------------------------------------------------------*/ - +#if 0 ivas_error ivas_init_encoder( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) @@ -1073,6 +1073,7 @@ ivas_error ivas_init_encoder( } return error; } +#endif ivas_error ivas_init_encoder_fx( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) @@ -1100,10 +1101,10 @@ ivas_error ivas_init_encoder_fx( hEncoderConfig->last_ivas_total_brate = ivas_total_brate; /* Q0 */ move32(); - IF( NE_16( ivas_format, MONO_FORMAT ) ) + if ( NE_16( ivas_format, MONO_FORMAT ) ) { /* In IVAS, ensure that minimum coded bandwidth is WB */ - hEncoderConfig->max_bwidth = extract_l( L_max( hEncoderConfig->max_bwidth, WB ) ); /* Q0 */ + hEncoderConfig->max_bwidth = s_max( hEncoderConfig->max_bwidth, WB ); /* Q0 */ move16(); } st_ivas->ism_mode = ISM_MODE_NONE; @@ -1142,7 +1143,10 @@ ivas_error ivas_init_encoder_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for floating-point input audio buffer!\n" ) ); } + set32_fx( st_ivas->p_data_fx[n], 0, extract_l( Mpy_32_16_1( input_Fs, INV_FRAME_PER_SEC_Q15 ) ) ); } + st_ivas->q_data_fx = Q11; + move16(); FOR( ; n < MAX_INPUT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { st_ivas->p_data_fx[n] = NULL; @@ -1196,7 +1200,7 @@ ivas_error ivas_init_encoder_fx( /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles *-----------------------------------------------------------------*/ - test(); + IF( EQ_32( ivas_format, MONO_FORMAT ) ) { st_ivas->nSCE = 1; /* in mono, there is always only one SCE */ @@ -1209,19 +1213,9 @@ ivas_error ivas_init_encoder_fx( move16(); test(); - IF( st_ivas->hEncoderConfig->element_mode_init == EVS_MONO ) + IF( NE_32( ( error = create_evs_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) { - IF( NE_32( ( error = create_evs_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) - { - return error; - } - } - ELSE - { - IF( ( error = create_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ) != IVAS_ERR_OK ) - { - return error; - } + return error; } /* prepare stereo downmix for EVS */ @@ -1342,7 +1336,7 @@ ivas_error ivas_init_encoder_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( hEncoderConfig->Opt_DTX_ON ) + if ( hEncoderConfig->Opt_DTX_ON ) { st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 1; move16(); @@ -1350,7 +1344,7 @@ ivas_error ivas_init_encoder_fx( } } - IF( st_ivas->nCPE > 1 ) + IF( GT_16( st_ivas->nCPE, 1 ) ) { IF( ( error = create_mct_enc_fx( st_ivas ) ) != IVAS_ERR_OK ) { @@ -1358,7 +1352,7 @@ ivas_error ivas_init_encoder_fx( } } } - ELSE IF( EQ_32( ivas_format, MASA_ISM_FORMAT ) ) + ELSE IF( EQ_16( ivas_format, MASA_ISM_FORMAT ) ) { Word32 ism_total_brate; Word16 k; @@ -1428,12 +1422,12 @@ ivas_error ivas_init_encoder_fx( ELSE IF( EQ_32( ivas_format, SBA_ISM_FORMAT ) ) { st_ivas->ism_mode = ISM_MODE_NONE; - move32(); + move16(); IF( GE_32( ivas_total_brate, IVAS_256k ) ) { st_ivas->ism_mode = ISM_SBA_MODE_DISC; - move32(); + move16(); } IF( ( error = ivas_ism_metadata_enc_create_fx( st_ivas, hEncoderConfig->nchan_ism, element_brate_tmp ) ) != IVAS_ERR_OK ) @@ -1523,7 +1517,7 @@ ivas_error ivas_init_encoder_fx( return error; } - IF( NE_32( st_ivas->mc_mode, MC_MODE_MCT ) ) + IF( EQ_32( st_ivas->mc_mode, MC_MODE_MCT ) ) { st_ivas->nSCE = 0; move16(); @@ -1596,7 +1590,9 @@ ivas_error ivas_init_encoder_fx( FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nCPE + st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) + Word32 res_dec, res_frac; + iDiv_and_mod_32( ivas_total_brate, add( st_ivas->nCPE, st_ivas->nSCE ), &res_dec, &res_frac, 0 ); + IF( ( error = create_cpe_enc_fx( st_ivas, cpe_id, res_dec ) ) != IVAS_ERR_OK ) { return error; } @@ -1658,7 +1654,9 @@ ivas_error ivas_init_encoder_fx( *-----------------------------------------------------------------*/ /* set number of input channels used for analysis/coding */ - n = getNumChanAnalysis_fx( st_ivas ); + n = getNumChanAnalysis_fx( st_ivas ); /* Q0 */ + move16(); + IF( n > 0 ) { IF( ( st_ivas->mem_hp20_in_fx = (Word32 **) malloc( n * sizeof( Word32 * ) ) ) == NULL ) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index b17ba61df..52734b4bd 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -70,7 +70,7 @@ struct IVAS_ENC * Local functions *---------------------------------------------------------------------*/ -static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); +//static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); static ivas_error setBandwidth_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_BANDWIDTH maxBandwidth ); static ivas_error setChannelAwareConfig_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); static ivas_error sanitizeBandwidth_fx( const IVAS_ENC_HANDLE hIvasEnc ); @@ -609,6 +609,7 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( return error; } +#if 0 ivas_error IVAS_ENC_ConfigureForAmbisonics_fx( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ const Word32 inputFs, /* i : input sampling frequency */ @@ -649,11 +650,12 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics_fx( hIvasEnc->maxBandwidthUser = max_bwidth_user; - error = configureEncoder_fx( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); + error = configureEncoder( hIvasEnc, inputFs, bitrate, maxBandwidth, dtxConfig, IVAS_ENC_GetDefaultChannelAwareConfig() ); return error; } +#endif /*---------------------------------------------------------------------* * IVAS_ENC_ConfigureForSBAObjects() * @@ -1188,7 +1190,7 @@ static ivas_error configureEncoder( * Finalize initialization *-----------------------------------------------------------------*/ - IF( ( error = ivas_init_encoder( st_ivas ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_init_encoder_fx( st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -1211,6 +1213,7 @@ static ivas_error configureEncoder( return error; } +#if 0 static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, @@ -1543,6 +1546,7 @@ static ivas_error configureEncoder_fx( return error; } +#endif /*---------------------------------------------------------------------* * IVAS_ENC_GetDelay() * -- GitLab From e8635700ca462990bef565bfc8529611f790732c Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 26 Mar 2025 13:46:47 -0400 Subject: [PATCH 27/35] Addition of compiler switch, code compiles and run, but not BE --- lib_com/bitstream_fx.c | 7 +++--- lib_enc/igf_enc.c | 2 +- lib_enc/igf_enc_fx.c | 2 +- lib_enc/init_enc_fx.c | 48 ++++++++++++++++++++++++++++---------- lib_enc/ivas_init_enc_fx.c | 7 +++--- lib_enc/ivas_sce_enc_fx.c | 27 +++++++++++++++++---- lib_enc/lib_enc.c | 6 ++--- lib_enc/tcx_utils_enc_fx.c | 6 ++--- 8 files changed, 74 insertions(+), 31 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index f0e564a8a..f29dc6aee 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -244,7 +244,7 @@ Word16 rate2EVSmode( * * Push a new indice into the buffer *-------------------------------------------------------------------*/ -#if 0 +#ifndef HARM_PUSH_BIT void push_indice_fx( BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ Word16 id, /* i : ID of the indice */ @@ -565,8 +565,7 @@ void reset_indices_dec_fx( * * Write the buffer of indices to a file *-------------------------------------------------------------------*/ -#if 0 - +#ifndef HARM_PUSH_BIT void write_indices_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ @@ -670,7 +669,7 @@ void write_indices_fx( * * Write the buffer of indices to a file *-------------------------------------------------------------------*/ -#if 0 +#ifndef HARM_PUSH_BIT void write_indices_buf_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index d0c9fa329..c8e8974c2 100644 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -2429,7 +2429,7 @@ void IGFEncSetMode_ivas_fx( * * IGF bitstream concatenation for TCX10 modes *-------------------------------------------------------------------*/ -#if 0 /* Float code */ +#ifndef HARM_PUSH_BIT /* Float code */ void IGFEncConcatenateBitstream( const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i : instance handle of IGF Encoder */ const Word16 bsBits, /* i : number of IGF bits written to list of indices */ diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index a8a64422f..96f8d0202 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -1449,7 +1449,7 @@ hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, nb_bits_written ); return; } -#if 0 /* old bitstream */ +#ifndef HARM_PUSH_BIT /* old bitstream */ /**********************************************************************/ /* IGF bitsream concatenation for TCX10 modes **************************************************************************/ diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index ea944dd75..4913e410d 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -20,6 +20,7 @@ * * Initialization of state variables *-----------------------------------------------------------------------*/ +#if 1 ivas_error init_encoder_fx( Encoder_State *st_fx /* i/o: Encoder static variables structure */ ) @@ -946,6 +947,7 @@ ivas_error init_encoder_fx( move32(); return error; } +#endif /*-----------------------------------------------------------------------* * LPDmem_enc_init_fx() * @@ -1498,14 +1500,7 @@ ivas_error init_encoder_ivas_fx( IF( st->element_mode == EVS_MONO ) { /* This is done to as in EVS T_CldfbVadState structure is present in Encoder State */ - /* - if ( ( st->hVAD_CLDFB = (VAD_CLDFB_HANDLE) malloc( sizeof( T_CldfbVadState ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB VAD\n" ) ); - } - */ st->hVAD_CLDFB = &st->vad_st; - vad_init_fx( st->hVAD_CLDFB ); } ELSE @@ -1670,9 +1665,23 @@ ivas_error init_encoder_ivas_fx( test(); IF( ( NE_16( st->element_mode, IVAS_CPE_MDCT ) && idchan == 0 ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && st->Opt_DTX_ON ) ) { - IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + IF( EQ_16( st->element_mode, EVS_MONO ) ) { - return error; + /* open analysis for input SR */ + st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); + + if ( ( error = openCldfb( &st->cldfbAnaEnc, CLDFB_ANALYSIS, CLDFB_getNumChannels( st->input_Fs ), st->input_frame_fx ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + + IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + { + return error; + } } } ELSE @@ -1784,11 +1793,20 @@ ivas_error init_encoder_ivas_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD BWE\n" ) ); } - IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + IF( st->element_mode == EVS_MONO ) { - return error; + if ( ( error = openCldfb( &st->cldfbSynTd, CLDFB_SYNTHESIS, CLDFB_getNumChannels( 16000 ), L_FRAME16k ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + IF( ( error = openCldfb_ivas_fx( &st->cldfbSynTd, CLDFB_SYNTHESIS, 16000, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) + { + return error; + } } - InitSWBencBuffer_ivas_fx( st ); ResetSHBbuffer_Enc_fx( st ); } @@ -2144,7 +2162,13 @@ ivas_error init_encoder_ivas_fx( } ELSE { +#ifndef HARM_ENC_INIT InitTransientDetection_ivas_fx( frame_length, NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), st->hTranDet, 0 ); +#else + InitTransientDetection_fx( extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ), + NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ), + &st->transientDetection ); +#endif } /*-----------------------------------------------------------------* diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 19996e2e4..7c72d4780 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -269,7 +269,7 @@ Word16 getNumChanAnalysis_fx( return n; } - +#ifndef HARM_ENC_INIT /*-------------------------------------------------------------------* * copy_encoder_config_ivas_fx() * @@ -321,6 +321,7 @@ void copy_encoder_config_ivas_fx( return; } +#endif /*-------------------------------------------------------------------* * copy_encoder_config_fx() * @@ -463,7 +464,7 @@ void ivas_initialize_handles_enc_fx( * * Initialize IVAS encoder state structure *-------------------------------------------------------------------*/ -#if 0 +#ifndef HARM_ENC_INIT ivas_error ivas_init_encoder( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ) @@ -1213,7 +1214,7 @@ ivas_error ivas_init_encoder_fx( move16(); test(); - IF( NE_32( ( error = create_evs_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index f1631ba4f..3f80cce2b 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -466,12 +466,31 @@ ivas_error create_sce_enc_fx( st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; move32(); move32(); - + st->max_bwidth = st_ivas->hEncoderConfig->max_bwidth; + st->input_Fs = st_ivas->hEncoderConfig->input_Fs; + st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); +#if 0 + IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) + //IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) + { + return error; + } +#else IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) + //IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) { return error; } - hSCE->hCoreCoder[0] = st; + //IF( NE_32( ( error = init_encoder_fx( st) ), IVAS_ERR_OK ) ) + //{ + // return error; + //} + + //st->hBstr->ind_list = ind_list; + // st_fx->hBstr->ind_list_fx = st->hBstr->ind_list; + //reset_indices_enc_fx( st->hBstr, MAX_NUM_INDICES ); +#endif + hSCE->hCoreCoder[0] = st; st_ivas->hSCE[sce_id] = hSCE; @@ -483,7 +502,7 @@ ivas_error create_sce_enc_fx( * * Create, allocate and initialize EVS encoder SCE handle *-------------------------------------------------------------------------*/ - +#if 0 ivas_error create_evs_sce_enc_fx( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const Word16 sce_id, /* i : SCE # identifier */ @@ -614,7 +633,7 @@ ivas_error create_evs_sce_enc_fx( return error; } - +#endif /*------------------------------------------------------------------------- * destroy_sce_enc_fx() * diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 52734b4bd..fdf410df5 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -609,7 +609,7 @@ ivas_error IVAS_ENC_ConfigureForAmbisonics( return error; } -#if 0 +#ifndef HARM_ENC_INIT ivas_error IVAS_ENC_ConfigureForAmbisonics_fx( IVAS_ENC_HANDLE hIvasEnc, /* i/o: IVAS encoder handle */ const Word32 inputFs, /* i : input sampling frequency */ @@ -1213,7 +1213,7 @@ static ivas_error configureEncoder( return error; } -#if 0 +#ifndef HARM_ENC_INIT static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, @@ -1896,7 +1896,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( } /* write indices into bitstream buffer */ -#if 0 +#ifndef HARM_PUSH_BIT IF( hEncoderConfig->element_mode_init == EVS_MONO ) { test(); diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index ec1db2cf3..5bea901bb 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3667,7 +3667,7 @@ void ProcessIGF_fx( Word16 igfGridIdx; Word16 isIndepFlag; Word16 bsBits; -#if 0 +#ifndef HARM_PUSH_BIT Word16 bsStart, pBsStart; #else Word16 pBsStart; @@ -3748,7 +3748,7 @@ void ProcessIGF_fx( } } -#if 0 +#ifndef HARM_PUSH_BIT bsStart = hBstr->next_ind_fx; #endif move16(); @@ -3758,7 +3758,7 @@ void ProcessIGF_fx( { IGFEncWriteBitstream_fx( hInstance, NULL, &hInstance->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); } -#if 0 +#ifndef HARM_PUSH_BIT ELSE { IGFEncWriteBitstream_fx( hInstance, st->hBstr, &hInstance->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); -- GitLab From a5992c0d0657a48d492bd8258ccd44a56fb15add Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 26 Mar 2025 14:08:20 -0400 Subject: [PATCH 28/35] fix BE issue, still crashed mid-file --- lib_enc/ivas_init_enc_fx.c | 10 ++++++++-- lib_enc/ivas_sce_enc_fx.c | 41 +++++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index 7c72d4780..04b99f039 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -1212,13 +1212,19 @@ ivas_error ivas_init_encoder_fx( move16(); sce_id = 0; move16(); - +#ifndef HARM_SCE_INIT + test(); + IF( NE_32( ( error = create_evs_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) + { + return error; + } +#else test(); IF( NE_32( ( error = create_sce_enc_fx( st_ivas, sce_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) { return error; } - +#endif /* prepare stereo downmix for EVS */ IF( EQ_16( hEncoderConfig->stereo_dmx_evs, 1 ) ) { diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 3f80cce2b..2e1aed092 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -469,27 +469,11 @@ ivas_error create_sce_enc_fx( st->max_bwidth = st_ivas->hEncoderConfig->max_bwidth; st->input_Fs = st_ivas->hEncoderConfig->input_Fs; st->input_frame_fx = extract_l( Mult_32_16( st->input_Fs, 0x0290 ) ); -#if 0 - IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) - //IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) - { - return error; - } -#else + IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) - //IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, 0, st_ivas->hEncoderConfig->var_SID_rate_flag, st_ivas->hEncoderConfig->interval_SID, 0, st_ivas->ism_mode, hSCE->element_brate ) ), IVAS_ERR_OK ) ) { return error; } - //IF( NE_32( ( error = init_encoder_fx( st) ), IVAS_ERR_OK ) ) - //{ - // return error; - //} - - //st->hBstr->ind_list = ind_list; - // st_fx->hBstr->ind_list_fx = st->hBstr->ind_list; - //reset_indices_enc_fx( st->hBstr, MAX_NUM_INDICES ); -#endif hSCE->hCoreCoder[0] = st; st_ivas->hSCE[sce_id] = hSCE; @@ -502,7 +486,7 @@ ivas_error create_sce_enc_fx( * * Create, allocate and initialize EVS encoder SCE handle *-------------------------------------------------------------------------*/ -#if 0 +#ifndef HARM_SCE_INIT ivas_error create_evs_sce_enc_fx( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const Word16 sce_id, /* i : SCE # identifier */ @@ -624,9 +608,30 @@ ivas_error create_evs_sce_enc_fx( { return error; } +#ifdef HARM_PUSH_BIT + /*-----------------------------------------------------------------* + * Bitstream + *-----------------------------------------------------------------*/ + IF( ( st_fx->hBstr = (BSTR_ENC_HANDLE) malloc( sizeof( BSTR_ENC_DATA ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) ); + } + + /* set pointer to the buffer of indices */ + st_fx->hBstr->ind_list = st_ivas->ind_list; + st_fx->hBstr->ivas_ind_list_zero = &st_ivas->ind_list; + st_fx->hBstr->ivas_max_num_indices = &st_ivas->ivas_max_num_indices; + st_fx->hBstr->nb_ind_tot = 0; + move16(); + st_fx->hBstr->nb_bits_tot = 0; + move16(); + st_fx->hBstr->st_ivas = st_ivas; +#else st_fx->hBstr->ind_list = ind_list; // st_fx->hBstr->ind_list_fx = st->hBstr->ind_list; reset_indices_enc_fx( st_fx->hBstr, MAX_NUM_INDICES ); +#endif + hSCE->hCoreCoder[0] = st_fx; st_ivas->hSCE[sce_id] = hSCE; -- GitLab From 3891a5187d17cdd2e3b49eddf983989ea42a73b9 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 09:43:27 -0400 Subject: [PATCH 29/35] fix during switching --- lib_com/bitstream_fx.c | 3 ++- lib_enc/acelp_core_switch_enc_fx.c | 18 +++++++++++++++++- lib_enc/stat_enc.h | 3 ++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index f29dc6aee..07a6a632f 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -530,11 +530,12 @@ void reset_indices_enc_fx( move16(); hBstr->nb_bits_tot = 0; move16(); +#ifndef HARM_PUSH_BIT hBstr->next_ind_fx = 0; move16(); hBstr->last_ind_fx = -1; move16(); - +#endif FOR( i = 0; i < max_num_indices; i++ ) { hBstr->ind_list[i].nb_bits = -1; diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 9b0ed8b58..8226748f7 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -62,7 +62,10 @@ void acelp_core_switch_enc_fx( Word16 Aq[2 * ( M + 1 )]; LPD_state_HANDLE hLPDmem; /* ACELP LPDmem memories */ BSTR_ENC_HANDLE hBstr = st_fx->hBstr; - +#ifdef HARM_PUSH_BIT + UWord16 value; + Word16 nb_bits; +#endif hLPDmem = st_fx->hLPDmem; /* initializations */ @@ -153,6 +156,18 @@ void acelp_core_switch_enc_fx( encod_gen_voic_core_switch_fx( st_fx, st_fx->last_L_frame, inp, Aq, A, T_op, exc, cbrate, shift, Q_new ); +#ifdef HARM_PUSH_BIT + i = find_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START, &value, &nb_bits ); +#ifdef DEBUGGING + assert( i >= 0 && "Internal error in ACELP core switching - unable to find ACELP subframe indices!" ); +#endif + while ( hBstr->ind_list[i].id == TAG_ACELP_SUBFR_LOOP_START ) + { + push_indice( hBstr, IND_CORE_SWITCHING_CELP_SUBFRAME, hBstr->ind_list[i].value, hBstr->ind_list[i].nb_bits ); + i++; + } + delete_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START ); +#else /*----------------------------------------------------------------* * bit-stream: modify the layer of sub frame CELP *----------------------------------------------------------------*/ @@ -165,6 +180,7 @@ void acelp_core_switch_enc_fx( hBstr->ind_list[TAG_ACELP_SUBFR_LOOP_START + i].nb_bits = -1; /* Q0 */ move16(); } +#endif /*----------------------------------------------------------------* * BWE encoding *----------------------------------------------------------------*/ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 64ab13ea2..5305a8bdc 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -92,9 +92,10 @@ typedef struct bitstream_enc_data_structure void *st_ivas; /* IVAS encoder structure */ // Word16 nb_bits_tot_fx; /* total number of bits already written */ // Indice *ind_list_fx; /* list of indices */ +#ifndef HARM_PUSH_BIT Word16 next_ind_fx; /* pointer to the next empty slot in the list of indices */ Word16 last_ind_fx; /* last written indice */ - +#endif } BSTR_ENC_DATA, *BSTR_ENC_HANDLE; /*----------------------------------------------------------------------------------* -- GitLab From 6b9dde261138ff69f80e1932e3156250ccdd672d Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 09:50:15 -0400 Subject: [PATCH 30/35] fix when erasing indices --- lib_enc/cng_enc_fx.c | 4 ++++ lib_enc/eval_pit_contr_fx.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index 221454970..d6cb59b17 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -2460,8 +2460,12 @@ static void shb_CNG_encod_fx( push_indice( hBstr, IND_SHB_CNG_GAIN, idx_ener_fx, 4 ); push_indice( hBstr, IND_SID_BW, 1, 1 ); +#ifdef HARM_PUSH_BIT + delete_indice( hBstr, IND_CNG_ENV1 ); +#else hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, hBstr->ind_list[IND_CNG_ENV1].nb_bits ); hBstr->ind_list[IND_CNG_ENV1].nb_bits = -1; +#endif move16(); move16(); diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c index df629f295..5e1c8dfe3 100644 --- a/lib_enc/eval_pit_contr_fx.c +++ b/lib_enc/eval_pit_contr_fx.c @@ -378,6 +378,16 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pit move16(); set16_fx( pitch_buf, shl( L_SUBFR, 6 ), NB_SUBFR16k ); + +#ifdef HARM_PUSH_BIT + /* pitch contribution useless - delete all previously written indices belonging to pitch contribution */ + for ( i = TAG_ACELP_SUBFR_LOOP_START; i < TAG_ACELP_SUBFR_LOOP_END; i++ ) + { + delete_indice( hBstr, i ); + } + + delete_indice( hBstr, IND_ES_PRED ); +#else /* pitch contribution useless - delete all previously written indices belonging to pitch contribution */ FOR( i = TAG_ACELP_SUBFR_LOOP_START; i < TAG_ACELP_SUBFR_LOOP_END; i++ ) { @@ -396,6 +406,7 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pit hBstr->ind_list[IND_ES_PRED].nb_bits = -1; move16(); } +#endif } IF( LT_32( st_fx->core_brate, CFREQ_BITRATE ) ) { -- GitLab From c0db989af3499a2dc4741b2059c6e6b6449524af Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 09:54:11 -0400 Subject: [PATCH 31/35] fix clang --- lib_enc/cng_enc_fx.c | 2 +- lib_enc/igf_enc_fx.c | 2 +- lib_enc/init_enc_fx.c | 2 +- lib_enc/ivas_sce_enc_fx.c | 2 +- lib_enc/lib_enc.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index d6cb59b17..b031ca528 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -2460,7 +2460,7 @@ static void shb_CNG_encod_fx( push_indice( hBstr, IND_SHB_CNG_GAIN, idx_ener_fx, 4 ); push_indice( hBstr, IND_SID_BW, 1, 1 ); -#ifdef HARM_PUSH_BIT +#ifdef HARM_PUSH_BIT delete_indice( hBstr, IND_CNG_ENV1 ); #else hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, hBstr->ind_list[IND_CNG_ENV1].nb_bits ); diff --git a/lib_enc/igf_enc_fx.c b/lib_enc/igf_enc_fx.c index 96f8d0202..f508b313f 100644 --- a/lib_enc/igf_enc_fx.c +++ b/lib_enc/igf_enc_fx.c @@ -1449,7 +1449,7 @@ hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, nb_bits_written ); return; } -#ifndef HARM_PUSH_BIT /* old bitstream */ +#ifndef HARM_PUSH_BIT /* old bitstream */ /**********************************************************************/ /* IGF bitsream concatenation for TCX10 modes **************************************************************************/ diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 4913e410d..60e6019aa 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1675,7 +1675,7 @@ ivas_error init_encoder_ivas_fx( return error; } } - ELSE + ELSE { IF( ( error = openCldfb_ivas_fx( &st->cldfbAnaEnc, CLDFB_ANALYSIS, st->input_Fs, CLDFB_PROTOTYPE_1_25MS, ENC ) ) != IVAS_ERR_OK ) diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 2e1aed092..41127a98e 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -474,7 +474,7 @@ ivas_error create_sce_enc_fx( { return error; } - hSCE->hCoreCoder[0] = st; + hSCE->hCoreCoder[0] = st; st_ivas->hSCE[sce_id] = hSCE; diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index fdf410df5..dd01386d8 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -70,7 +70,7 @@ struct IVAS_ENC * Local functions *---------------------------------------------------------------------*/ -//static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); +// static ivas_error configureEncoder_fx( IVAS_ENC_HANDLE hIvasEnc, const Word32 inputFs, const Word32 initBitrate, const IVAS_ENC_BANDWIDTH initBandwidth, const IVAS_ENC_DTX_CONFIG dtxConfig, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); static ivas_error setBandwidth_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_BANDWIDTH maxBandwidth ); static ivas_error setChannelAwareConfig_fx( IVAS_ENC_HANDLE hIvasEnc, const IVAS_ENC_CHANNEL_AWARE_CONFIG caConfig ); static ivas_error sanitizeBandwidth_fx( const IVAS_ENC_HANDLE hIvasEnc ); -- GitLab From b0162e358ff26d71df3c137718ba8b22ac3b023a Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 11:34:05 -0400 Subject: [PATCH 32/35] fix reset indice for dtx case --- lib_enc/dtx_fx.c | 4 ++++ lib_enc/enc_ppp_fx.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index 9a66572ab..6d8a29795 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -838,7 +838,11 @@ void dtx_fx( /* reset the bitstream (IVAS format signalling was already written) */ IF( NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) && st_fx->hBstr != NULL ) { +#ifdef HARM_PUSH_BIT + reset_indices_enc_fx( st_fx->hBstr, st_fx->hBstr->nb_ind_tot ); +#else reset_indices_enc_fx( st_fx->hBstr, MAX_NUM_INDICES ); +#endif } } diff --git a/lib_enc/enc_ppp_fx.c b/lib_enc/enc_ppp_fx.c index c2aeaa7ca..9d1ffad60 100644 --- a/lib_enc/enc_ppp_fx.c +++ b/lib_enc/enc_ppp_fx.c @@ -189,8 +189,11 @@ ivas_error encod_ppp_fx( /* We write signalling indices again only in case of bump_up */ /* delete previous indices */ +#ifdef HARM_PUSH_BIT + reset_indices_enc_fx( hBstr, hBstr->nb_ind_tot ); +#else reset_indices_enc_fx( hBstr, MAX_NUM_INDICES ); - +#endif /* signalling matrix (writing of signalling bits) */ signalling_enc_fx( st_fx ); } @@ -373,8 +376,11 @@ ivas_error encod_ppp_ivas_fx( /* We write signalling indices again only in case of bump_up */ /* delete previous indices */ +#ifdef HARM_PUSH_BIT + reset_indices_enc_fx( hBstr, hBstr->nb_ind_tot ); +#else reset_indices_enc_fx( hBstr, MAX_NUM_INDICES ); - +#endif /* signalling matrix (writing of signalling bits) */ signalling_enc_fx( st_fx ); } -- GitLab From faf1f546c95d0ea2d6dc16419b8e87dac5d92e57 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Thu, 27 Mar 2025 12:52:49 -0400 Subject: [PATCH 33/35] Fix bitrate switching --- lib_enc/lib_enc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index dd01386d8..063f39dea 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -1817,6 +1817,16 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( /* set pointers to the new buffers of indices in each element */ FOR( n = 0; n < st_ivas->nSCE; n++ ) { +#ifdef HARM_PUSH_BIT + st_ivas->hSCE[n]->hCoreCoder[0]->hBstr->ind_list = st_ivas->ind_list; + st_ivas->hSCE[n]->hCoreCoder[0]->hBstr->ivas_ind_list_zero = &st_ivas->ind_list; + + if ( st_ivas->hSCE[n]->hMetaData != NULL ) + { + st_ivas->hSCE[n]->hMetaData->ind_list = st_ivas->ind_list_metadata; + st_ivas->hSCE[n]->hMetaData->ivas_ind_list_zero = &st_ivas->ind_list_metadata; + } +#else test(); IF( !( hIvasEnc->hCoreCoder == NULL && EQ_32( hEncoderConfig->ivas_format, MONO_FORMAT ) ) ) { @@ -1832,6 +1842,7 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( st_ivas->hSCE[n]->hMetaData->ind_list = st_ivas->ind_list_metadata; st_ivas->hSCE[n]->hMetaData->ivas_ind_list_zero = &st_ivas->ind_list_metadata; } +#endif } FOR( n = 0; n < st_ivas->nCPE; n++ ) -- GitLab From 7f70a132985455dcf07605cb195ace3a99637457 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 31 Mar 2025 11:41:23 +0200 Subject: [PATCH 34/35] Activate FIX_1379_MASA_ANGLE_ROUND (merge conflict resolution) --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index 4653bb460..59a6b3508 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -68,6 +68,7 @@ #endif /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ +#define FIX_1379_MASA_ANGLE_ROUND //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ #define OPT_AVOID_STATE_BUF_RESCALE /* Optimization made to avoid rescale of synth state buffer */ #define FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx /*FhG: WMOPS tuning, nonbe*/ -- GitLab From b40fc402017aecf7982e099cba73fad32ad20e1b Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Wed, 16 Apr 2025 07:58:24 +0200 Subject: [PATCH 35/35] Reactivate FIX_1379_MASA_ANGLE_ROUND after merge with conflict resolution. --- lib_com/options.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 43c3c3038..ad220450b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -71,6 +71,8 @@ #define FIX_1378_ACELP_OUT_OF_BOUNDS +#define FIX_1379_MASA_ANGLE_ROUND + /* Note: each compile switch (FIX_1101_...) is independent from the other ones */ //#define OPT_STEREO_32KBPS_V1 /* Optimization made in stereo decoding path for 32kbps decoding */ #define OPT_AVOID_STATE_BUF_RESCALE /* Optimization made to avoid rescale of synth state buffer */ -- GitLab