diff --git a/lib_com/options.h b/lib_com/options.h index af2752dcde23f0c28141100d603bd77c100c141f..598299d16be2487400788cbb8f308feabd723e21 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -84,11 +84,6 @@ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define HARM_HQ_CORE_KEEP_BE /* hack to keep all BE after HQ core functions harmonization; pending resolving issues #2450, #2451, #2452 */ -#define FIX_BASOP_2457_HARM_GEN /* FhG: harmonization of function generate_comfort_noise_dec_hf_ivas_fx()*/ -#define FIX_BASOP_2478_HARM_ENC_PRM_HM /* FhG: basop issue 2478: harmonize enc_prm_hm() and enc_prm_hm_ivas_fx() */ -#define FIX_2455_HARMONIZE_generate_comfort_noise_enc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ -#define FIX_2455_HARMONIZE_configureFdCngEnc /* FhG: harmonize generate_comfort_noise_enc and generate_comfort_noise_enc_ivas */ -#define FIX_2463_EVS_BWE_LSF /* VA: basop issue 2463: harmonize calling of Quant_BWE_LSF_fx() */ #define FIX_2452_HQ_CORE_PEAQ_AVR_RATIO_HARM /* Eri: Basop issue 2453: Fix alignment of peak_avrg_ratio_fx */ #define FIX_2480_HARM_TONALMDCT /* FhG: basop issue 2480: Harmonize TonalMDCTConceal_Detect_fx() and TonalMDCTConceal_Detect_ivas_fx() */ #define FIX_2479_HARM_PITCH_GAIN /* FhG: basop issue 2479: Harmonize tcx_ltp_pitch_search_*(), tcx_ltp_find_gain_*fx() */ @@ -99,8 +94,6 @@ /* #################### Start NON-BE switches ############################ */ /* any switch which is non-be wrt. TS 26.251 V3.0 */ -#define FIX_BASOP_2451_HQ_FEC_SELECTOR /* Eri: Resolve basop issue 2451, wrong condition on env_stab_plc_fx */ -#define FIX_2398_PRECISSION_ORIENTATION_TRACKING /* FhG: use refinement of Sqrt32 within certain functions*/ #define FIX_BASOP_2486_HQ_FINE_GAIN_ALIGNMENT /* Eri: Basop issue 2486: IVAS BASOP used calculations with truncation, EVS BASOP used rounding. This aligns the use of a table lookup. */ #define FIX_1543_MID_LSF_BITS /* VA: float issue 1543: Resolve "MSAN: use-of-uninitialized-value in lib_enc/lsf_enc.c:262:5 for EVS encoder" */ #define FIX_2488_PREVENT_NEG_PITCH /* VA: Fix for 2488, use saturation to prevent possible wrap-around, thus negative pitch values */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 79928921011dfeab90f5b4576238e42498da4017..346bedd078d4914517869feae2414323d4258a0e 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -6620,15 +6620,6 @@ void generate_comfort_noise_dec_ivas_fx( const Word16 nchan_out /* i : number of output channels */ ); -#ifndef FIX_BASOP_2457_HARM_GEN -void generate_comfort_noise_dec_hf_ivas_fx( - Word32 **bufferReal, /* o : matrix to real part of input bands bufferScale*/ - Word32 **bufferImag, /* o : matrix to imaginary part of input bands bufferScale*/ - Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of input bands */ - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const Word16 cng_coh_flag /* i : CNG Flag for coherence handling Q0*/ -); -#endif void generate_comfort_noise_dec_hf_fx( Word32 **bufferReal, /* o : matrix to real part of input bands bufferScale*/ @@ -9791,13 +9782,6 @@ void core_coder_mode_switch_ivas_fx( const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ ); -#ifndef FIX_2455_HARMONIZE_configureFdCngEnc -void configureFdCngEnc_ivas_fx( - HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: Contains the variables related to the FD-based CNG process */ - const Word16 bwidth, /* Q0 */ - const Word32 total_brate /* Q0 */ -); -#endif void SetModeIndex_ivas_fx( Encoder_State *st, /* i : Encoder state */ diff --git a/lib_com/window_ola_fx.c b/lib_com/window_ola_fx.c index e53c9f49ab634c0a5acb48361d75075b986a1fa4..6b41dcd04618af4d6e87b26266715956479ed544 100644 --- a/lib_com/window_ola_fx.c +++ b/lib_com/window_ola_fx.c @@ -304,11 +304,7 @@ void window_ola_fx( p4 = oldgapsynth + n; FOR( i = 0; i < temp; i++ ) { -#ifdef FIX_BASOP_2451_HQ_FEC_SELECTOR *p1 = add_sat( mult( *p1, *p2 ), mult( *p4, *p3 ) ); /* auOut[i]*SS2[i]+ oldgapsynth[i+n]*(SS2[L-n-i-1]);*/ -#else - *p1 = add( mult( *p1, *p2 ), mult( *p4, *p3 ) ); /* auOut[i]*SS2[i]+ oldgapsynth[i+n]*(SS2[L-n-i-1]);*/ -#endif move16(); p1++; p2++; diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index f1c3ab88bdb16db69c9981a6b50efd0ce491dac2..e805372330900e5a88341fb374ac2c8cdcb3f716 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -3301,42 +3301,10 @@ void hq_ecu_fx( test(); test(); test(); -#ifdef FIX_BASOP_2451_HQ_FEC_SELECTOR evs_mode_selection = ( GE_32( st_fx->total_brate, 48000 ) && ( GE_16( output_frame, L_FRAME16k ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) && ( ph_ecu_HqVoicing || ( ( ( NE_16( hHQ_core->env_stab_plc_fx, 0 ) ) && ( LT_16( corr, 19661 ) /* 0.6 in Q15 */ ) ) || ( !( NE_16( hHQ_core->env_stab_plc_fx, 0 ) ) && ( GT_16( corr, 27853 ) /* 0.85 in Q15 */ ) ) ) ) ) ) || ( LT_32( st_fx->total_brate, 48000 ) && ( ( ph_ecu_HqVoicing || GT_16( corr, 27853 ) /* 0.85 in Q15 */ ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) ); -#else - evs_mode_selection = ( GE_32( st_fx->total_brate, 48000 ) && ( GE_16( output_frame, L_FRAME16k ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) && - ( ph_ecu_HqVoicing || ( ( ( GT_16( hHQ_core->env_stab_plc_fx, 16384 ) /* 0.5 in Q15 */ ) && ( LT_16( corr, 19661 ) /* 0.6 in Q15 */ ) ) || ( LT_16( hHQ_core->env_stab_plc_fx, 16384 ) /* 0.5 in Q15 */ && ( GT_16( corr, 27853 ) /* 0.85 in Q15 */ ) ) ) ) ) ) || - ( LT_32( st_fx->total_brate, 48000 ) && ( ( ph_ecu_HqVoicing || GT_16( corr, 27853 ) /* 0.85 in Q15 */ ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) ); -#endif - -#ifndef FIX_BASOP_2451_HQ_FEC_SELECTOR -#ifdef HARM_HQ_CORE_KEEP_BE - IF( st_fx->element_mode == EVS_MONO ) - { - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - evs_mode_selection = ( GE_32( st_fx->total_brate, 48000 ) && ( GE_16( output_frame, L_FRAME16k ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) && - ( NE_16( ph_ecu_HqVoicing, 0 ) || ( ( ( NE_16( hHQ_core->env_stab_plc_fx, 0 ) ) && ( LT_16( corr, 19661 ) ) ) || ( !( NE_16( hHQ_core->env_stab_plc_fx, 0 ) ) && ( GT_16( corr, 27853 ) ) ) ) ) ) ) || - ( LT_32( st_fx->total_brate, 48000 ) && ( ( ph_ecu_HqVoicing || GT_16( corr, 27853 ) ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) ); - } -#endif -#endif test(); ivas_mode_selection = ( LT_16( N, PH_ECU_N_LIMIT ) ) || ( LT_16( corr, PH_ECU_CORR_LIMIT_Q15 ) ); diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index c4241b3a542f89298c0ed27a2b8f7acdf2941aa5..2518d8a3a2d70052badd8a790beb73ebe793e6b7 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1985,11 +1985,7 @@ ivas_error acelp_core_dec_fx( { Word16 tmpBufferScale = 0; move16(); -#ifndef FIX_BASOP_2457_HARM_GEN - generate_comfort_noise_dec_hf_ivas_fx( realBuffer_fx, imagBuffer_fx, /*realBuffer, imagBuffer,*/ &tmpBufferScale, st->hFdCngDec->hFdCngCom, st->cng_ism_flag ); -#else generate_comfort_noise_dec_hf_fx( realBuffer_fx, imagBuffer_fx, /*realBuffer, imagBuffer,*/ &tmpBufferScale, st ); -#endif // !FIX_BASOP_2457_HARM_GEN FOR( i = 0; i < st->hFdCngDec->hFdCngCom->numSlots; i++ ) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 97f53dfb6dd89f5f0b898ec9c7a637b198adbbd5..901d2c5cbea9d4a33e9b09a3c69060e338488738 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -3431,93 +3431,12 @@ void generate_comfort_noise_dec_ivas_fx( return; } -#ifndef FIX_BASOP_2457_HARM_GEN -void generate_comfort_noise_dec_hf_fx( - Word32 **bufferReal, /* o : matrix to real part of input bands bufferScale*/ - Word32 **bufferImag, /* o : matrix to imaginary part of input bands bufferScale*/ - Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of input bands */ - Decoder_State *st ) -{ - Word16 i, j, s, sc, sn; - Word16 scaleCLDFB; - Word32 sqrtNoiseLevel; - Word16 randGaussExp; - Word16 cngNoiseLevelExp; - Word16 *seed; - Word32 *cngNoiseLevel; - Word32 *ptr_level; - HANDLE_FD_CNG_COM hFdCngCom = st->hFdCngDec->hFdCngCom; - - cngNoiseLevel = hFdCngCom->cngNoiseLevel + sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); /*Q31 - hFdCngCom->cngNoiseLevelExp*/ - cngNoiseLevelExp = hFdCngCom->cngNoiseLevelExp; - move16(); - ptr_level = cngNoiseLevel; /*Q31 - hFdCngCom->cngNoiseLevelExp*/ - seed = &( hFdCngCom->seed ); - - /* scaleCLDFB: CLDFBinvScalingFactor_EXP + 1 */ - scaleCLDFB = mult( hFdCngCom->invScalingFactor, CLDFB_SCALING ); /*CLDFBinvScalingFactor_EXP + 1*/ - - sn = 0; - move16(); - IF( s_and( cngNoiseLevelExp, 1 ) != 0 ) - { - sn = add( sn, 1 ); - cngNoiseLevelExp = add( cngNoiseLevelExp, sn ); - } - - randGaussExp = CNG_RAND_GAUSS_SHIFT; - move16(); - - IF( LT_16( hFdCngCom->numCoreBands, hFdCngCom->regularStopBand ) ) - { - sc = add( shr( add( cngNoiseLevelExp, CLDFBinvScalingFactor_EXP + 1 - 1 ), 1 ), randGaussExp ); - move16(); - assert( ( ( cngNoiseLevelExp + CLDFBinvScalingFactor_EXP + 1 - 1 ) & 1 ) == 0 ); - - FOR( j = hFdCngCom->numCoreBands; j < hFdCngCom->regularStopBand; j++ ) - { - /* scaleCLDFB: CLDFBinvScalingFactor_EXP + 1 */ - s = 0; - move16(); - sqrtNoiseLevel = Sqrt32( L_shr( Mpy_32_16_1( *ptr_level, scaleCLDFB ), sn ), &s ); /*Q31 - s*/ - - FOR( i = 0; i < hFdCngCom->numSlots; i++ ) - { - /* Real part in CLDFB band */ - bufferReal[i][j] = L_shl( Mpy_32_32( rand_gauss( seed ), sqrtNoiseLevel ), s ); /*bufferScale*/ - move32(); - /*fprintf(pFile,"%13.10f\n",WORD322FL_SCALE(bufferReal[i][j],sc));*/ - - /* Imaginary part in CLDFB band */ - bufferImag[i][j] = L_shl( Mpy_32_32( rand_gauss( seed ), sqrtNoiseLevel ), s ); /*bufferScale*/ - move32(); - /*fprintf(pFile,"%13.10f\n",WORD322FL_SCALE(bufferImag[i][j],sc));*/ - } - ptr_level = ptr_level + 1; /*Q31 - hFdCngCom->cngNoiseLevelExp*/ - } - *bufferScale = sub( sc, 15 ); - move16(); - } -} - -#endif // !FIX_BASOP_2457_HARM_GEN - -#ifndef FIX_BASOP_2457_HARM_GEN -void generate_comfort_noise_dec_hf_ivas_fx( - Word32 **bufferReal, /* o : matrix to real part of input bands bufferScale*/ - Word32 **bufferImag, /* o : matrix to imaginary part of input bands bufferScale*/ - Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of input bands */ - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const Word16 cng_coh_flag /* i : CNG Flag for coherence handling Q0*/ -) -#else void generate_comfort_noise_dec_hf_fx( Word32 **bufferReal, /* o : matrix to real part of input bands bufferScale*/ Word32 **bufferImag, /* o : matrix to imaginary part of input bands bufferScale*/ Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of input bands */ Decoder_State *st ) -#endif { Word16 i, j, s, sc, sn; Word16 scaleCLDFB; @@ -3530,10 +3449,8 @@ void generate_comfort_noise_dec_hf_fx( Word32 *ptr_level; Word32 *cngNoiseLevel; Word32 tmp1, tmp2; -#ifdef FIX_BASOP_2457_HARM_GEN HANDLE_FD_CNG_COM hFdCngCom = st->hFdCngDec->hFdCngCom; Word16 cng_coh_flag = st->cng_ism_flag; -#endif // FIX_BASOP_2457_HARM_GEN cngNoiseLevel = hFdCngCom->cngNoiseLevel + sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); /*Q31 - hFdCngCom->cngNoiseLevelExp*/ cngNoiseLevelExp = hFdCngCom->cngNoiseLevelExp; @@ -3578,9 +3495,6 @@ void generate_comfort_noise_dec_hf_fx( cngNoiseLevelExp = add( cngNoiseLevelExp, sn ); move16(); } -#ifndef FIX_BASOP_2457_HARM_GEN - randGaussExp = CNG_RAND_GAUSS_SHIFT + 1; -#else IF( EQ_16( st->element_mode, EVS_MONO ) ) { randGaussExp = CNG_RAND_GAUSS_SHIFT; @@ -3589,7 +3503,6 @@ void generate_comfort_noise_dec_hf_fx( { randGaussExp = CNG_RAND_GAUSS_SHIFT + 1; } -#endif // !FIX_BASOP_2457_HARM_GEN move16(); @@ -3605,20 +3518,12 @@ void generate_comfort_noise_dec_hf_fx( FOR( j = hFdCngCom->numCoreBands; j < hFdCngCom->regularStopBand; j++ ) { -#ifdef FIX_BASOP_2457_HARM_GEN /* scaleCLDFB: CLDFBinvScalingFactor_EXP + 1 */ s = 0; move16(); sqrtNoiseLevel = Sqrt32( L_shr( Mpy_32_16_1( *ptr_level, scaleCLDFB ), sn ), &s ); /*Q31 - s*/ -#endif // FIX_BASOP_2457_HARM_GEN FOR( i = 0; i < hFdCngCom->numSlots; i++ ) { -#ifndef FIX_BASOP_2457_HARM_GEN - /* scaleCLDFB: CLDFBinvScalingFactor_EXP + 1 */ - s = 0; - move16(); - sqrtNoiseLevel = Sqrt32( L_shr( Mpy_32_16_1( *ptr_level, scaleCLDFB ), sn ), &s ); /*Q31 - s*/ -#endif // FIX_BASOP_2457_HARM_GEN IF( cng_coh_flag ) @@ -3641,15 +3546,6 @@ void generate_comfort_noise_dec_hf_fx( } ELSE { -#ifndef FIX_BASOP_2457_HARM_GEN - /* Real part in CLDFB band */ - bufferReal[i][j] = L_shl( Mpy_32_32( L_shr( rand_gauss( seed ), 1 ), sqrtNoiseLevel ), s ); /*bufferScale*/ - move32(); - - /* Imaginary part in CLDFB band */ - bufferImag[i][j] = L_shl( Mpy_32_32( L_shr( rand_gauss( seed ), 1 ), sqrtNoiseLevel ), s ); /*bufferScale*/ - move32(); -#else IF( EQ_16( st->element_mode, EVS_MONO ) ) { /* Real part in CLDFB band */ @@ -3672,7 +3568,6 @@ void generate_comfort_noise_dec_hf_fx( bufferImag[i][j] = L_shl( Mpy_32_32( L_shr( rand_gauss( seed ), 1 ), sqrtNoiseLevel ), s ); /*bufferScale*/ move32(); } -#endif // !FIX_BASOP_2457_HARM_GEN } } ptr_level = ptr_level + 1; /*Q31 - hFdCngCom->cngNoiseLevelExp*/ diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index b74c92599ae39d8e3e451e135e7d1028e21bfae3..27e6e2528428947499a9a59af1198db60f058d65 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -362,11 +362,7 @@ ivas_error acelp_core_enc_fx( st->hDtxEnc->last_CNG_L_frame = st->L_frame; move16(); } -#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc generate_comfort_noise_enc_fx( st, Q_new, 1, st->element_mode ); -#else - generate_comfort_noise_enc_fx( st, Q_new, 1 ); -#endif FdCng_exc( st->hFdCngEnc->hFdCngCom, &st->hDtxEnc->CNG_mode, st->L_frame, st->lsp_old_fx, st->hDtxEnc->first_CNG, st->hDtxEnc->lspCNG_fx, Aq, lsp_new, lsf_new_fx, exc_fx, exc2_fx, bwe_exc_fx ); @@ -422,11 +418,7 @@ ivas_error acelp_core_enc_fx( st->hFdCngEnc->hFdCngCom->cngNoiseLevelExp = sub( st->hFdCngEnc->hFdCngCom->cngNoiseLevelExp, Q_cngNoise ); move16(); -#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc generate_comfort_noise_enc_fx( st, Q_new, 1, st->element_mode ); -#else - generate_comfort_noise_enc_ivas_fx( st, Q_new, 1 ); -#endif st->hTcxEnc->q_Txnq = Q_new; move16(); diff --git a/lib_enc/enc_acelp_tcx_main_fx.c b/lib_enc/enc_acelp_tcx_main_fx.c index 7814aadba1aa76947e59faafbdbd1500ddb61748..855ef896ec5c4854ba6a1a4a5319679084610d76 100644 --- a/lib_enc/enc_acelp_tcx_main_fx.c +++ b/lib_enc/enc_acelp_tcx_main_fx.c @@ -92,11 +92,7 @@ void enc_acelp_tcx_main_fx( } /* Generate Comfort Noise */ -#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc generate_comfort_noise_enc_fx( st, *Q_new, 1, EVS_MONO ); -#else - generate_comfort_noise_enc_fx( st, *Q_new, 1 ); -#endif /* Update Core Encoder */ core_encode_update_cng_fx( st, st->hFdCngEnc->hFdCngCom->timeDomainBuffer, st->hFdCngEnc->hFdCngCom->A_cng, Aw, *Q_new, *shift ); diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index 2c1b6b5d7c82490590b5e1896336b471c45bfb0b..4db8f2f2c488e03c1b1844406f6d949ab348ecba 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -14,49 +14,7 @@ #include "prot_fx_enc.h" /* Function prototypes */ -#ifndef FIX_BASOP_2478_HARM_ENC_PRM_HM -static void enc_prm_hm( - Word16 *prm_hm, /* Q0 */ - Encoder_State *st, - Word16 L_frame /* Q0 */ -) -{ - Word8 flag; - BSTR_ENC_HANDLE hBstr = st->hBstr; - - /* Disable HM for non-GC,VC modes */ - test(); - IF( NE_16( st->hTcxCfg->coder_type, VOICED ) && NE_16( st->hTcxCfg->coder_type, GENERIC ) ) - { - return; - } - - /* Flag */ - push_next_indice( hBstr, prm_hm[0], 1 ); - - IF( prm_hm[0] ) - { - /* Periodicy index */ - flag = 0; - move16(); - if ( GE_16( L_frame, 256 ) ) - { - flag = 1; - move16(); - } - EncodeIndex_fx( flag, prm_hm[1], hBstr ); - - IF( EQ_16( st->hTcxCfg->coder_type, VOICED ) ) - { - /* Gain index */ - push_next_indice( hBstr, prm_hm[2], kTcxHmNumGainBits ); - } - } -} -static void enc_prm_hm_ivas_fx( -#else static void enc_prm_hm_fx( -#endif Word16 *prm_hm, /* Q0 */ Encoder_State *st, Word16 L_frame /* Q0 */ @@ -758,11 +716,7 @@ void enc_prm_fx( test(); IF( hTcxEnc->tcx_lpc_shaped_ari && NE_16( last_core, ACELP_CORE ) ) { -#ifdef FIX_BASOP_2478_HARM_ENC_PRM_HM enc_prm_hm_fx( &prm[j], st, hm_size ); -#else - enc_prm_hm( &prm[j], st, hm_size ); -#endif } /*Context HM flag*/ @@ -1231,11 +1185,7 @@ void writeTCXparam_fx( test(); IF( st->hTcxEnc->tcx_lpc_shaped_ari && last_core != ACELP_CORE && EQ_16( core, TCX_20_CORE ) ) { -#ifdef FIX_BASOP_2478_HARM_ENC_PRM_HM enc_prm_hm_fx( &prm[j], st, hm_size ); -#else - enc_prm_hm_ivas_fx( &prm[j], st, hm_size ); -#endif } /*Context HM flag*/ diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 2dbb0ac905b5333b806c01d8afb6018dc9e480f5..378e0f9c643563e5d7d1466023ecaa3ef0530954 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -159,20 +159,12 @@ void initFdCngEnc_fx( * Configure FD_CNG * ************************************/ -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc void configureFdCngEnc_fx( HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bandwidth, /* i : bandwidth Q0 */ const Word32 bitrate, /* i : bitrate Q0 */ const Word16 element_mode /* i : element mode Q0 */ ) -#else -void configureFdCngEnc_fx( - HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ - const Word16 bandwidth, /* i : bandwidth Q0*/ - const Word32 bitrate /* Q0 */ -) -#endif { HANDLE_FD_CNG_COM hsCom = hsEnc->hFdCngCom; Word16 psizeDec[NPART]; @@ -274,28 +266,24 @@ void configureFdCngEnc_fx( SWITCH( hsCom->fftlen ) { case 512: -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc if ( GT_16( element_mode, EVS_MONO ) ) { hsCom->fftSineTab_fx = NULL; hsCom->olapWinAna_fx = olapWinAna512_fx; /* Q30 */ hsCom->olapWinSyn_fx = olapWinSyn256_fx; /* Q15 */ } -#endif hsCom->fftlenShift = 8; move16(); hsCom->fftlenFac = 32767 /*1.0 Q15*/; move16(); BREAK; case 640: -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc if ( GT_16( element_mode, EVS_MONO ) ) { hsCom->fftSineTab_fx = fftSineTab640_fx; /* Q15 */ hsCom->olapWinAna_fx = olapWinAna640_fx; /* Q30 */ hsCom->olapWinSyn_fx = olapWinSyn320_fx; /* Q15 */ } -#endif hsCom->fftlenShift = 9; move16(); hsCom->fftlenFac = 20480 /*0.625 Q15*/; @@ -313,142 +301,6 @@ void configureFdCngEnc_fx( return; } -#ifndef FIX_2455_HARMONIZE_configureFdCngEnc -void configureFdCngEnc_ivas_fx( - HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: Contains the variables related to the FD-based CNG process */ - const Word16 bwidth, /* Q0 */ - const Word32 total_brate /* Q0 */ -) -{ - HANDLE_FD_CNG_COM hsCom = hFdCngEnc->hFdCngCom; - Word16 psizeDec[NPART]; - Word16 psizeDec_norm[NPART]; - Word16 psizeDec_norm_exp; - Word16 psize_invDec[NPART]; - - set16_fx( psizeDec, 0, NPART ); - - hsCom->CngBandwidth = bwidth; /* Q0 */ - move16(); - IF( EQ_16( hsCom->CngBandwidth, FB ) ) - { - hsCom->CngBandwidth = SWB; - move16(); - } - hsCom->CngBitrate = total_brate; /* Q0 */ - move32(); - - /* NB configuration */ - IF( EQ_16( bwidth, NB ) ) - { - hsCom->FdCngSetup = FdCngSetup_nb; /* PTR assignation -> no move needed*/ - } - - /* WB configuration */ - ELSE IF( EQ_16( bwidth, WB ) ) - { - /* FFT 6.4kHz, no CLDFB */ - IF( LE_32( total_brate, ACELP_8k00 ) ) - { - hsCom->FdCngSetup = FdCngSetup_wb1; - } - /* FFT 6.4kHz, CLDFB 8.0kHz */ - ELSE IF( LE_32( total_brate, ACELP_13k20 ) ) - { - hsCom->FdCngSetup = FdCngSetup_wb2; - } - /* FFT 8.0kHz, no CLDFB */ - ELSE - { - hsCom->FdCngSetup = FdCngSetup_wb3; - } - } - - /* SWB/FB configuration */ - ELSE - { - /* FFT 6.4kHz, CLDFB 14kHz */ - IF( LE_32( total_brate, ACELP_13k20 ) ) - { - hsCom->FdCngSetup = FdCngSetup_swb1; - } - /* FFT 8.0kHz, CLDFB 16kHz */ - ELSE - { - hsCom->FdCngSetup = FdCngSetup_swb2; - } - } - hsCom->fftlen = hsCom->FdCngSetup.fftlen; /* Q0 */ - move16(); - hFdCngEnc->stopFFTbinDec = hsCom->FdCngSetup.stopFFTbin; /* Q0 */ - move16(); - - /* Configure the SID quantizer and the Confort Noise Generator */ - - hFdCngEnc->startBandDec = hsCom->startBand; /* Q0 */ - move16(); - hFdCngEnc->stopBandDec = add( hsCom->FdCngSetup.sidPartitions[hsCom->FdCngSetup.numPartitions - 1], 1 ); /* Q0 */ - move16(); - initPartitions( hsCom->FdCngSetup.sidPartitions, - hsCom->FdCngSetup.numPartitions, - hFdCngEnc->startBandDec, - hFdCngEnc->stopBandDec, - hFdCngEnc->partDec, - &hFdCngEnc->npartDec, - hFdCngEnc->midbandDec, - psizeDec, - psizeDec_norm, - &psizeDec_norm_exp, - psize_invDec, - 0 ); - IF( EQ_16( hFdCngEnc->stopFFTbinDec, 160 ) ) - { - hFdCngEnc->nFFTpartDec = 17; - move16(); - } - ELSE IF( EQ_16( hFdCngEnc->stopFFTbinDec, 256 ) ) - { - hFdCngEnc->nFFTpartDec = 20; - move16(); - } - ELSE - { - hFdCngEnc->nFFTpartDec = 21; - move16(); - } - - SWITCH( hsCom->fftlen ) - { - case 512: - hsCom->fftSineTab_fx = NULL; - hsCom->olapWinAna_fx = olapWinAna512_fx; /* Q30 */ - hsCom->olapWinSyn_fx = olapWinSyn256_fx; /* Q15 */ - hsCom->fftlenShift = 8; - move16(); - hsCom->fftlenFac = 32767 /*1.0 Q15*/; - move16(); - BREAK; - case 640: - hsCom->fftSineTab_fx = fftSineTab640_fx; /* Q15 */ - hsCom->olapWinAna_fx = olapWinAna640_fx; /* Q30 */ - hsCom->olapWinSyn_fx = olapWinSyn320_fx; /* Q15 */ - hsCom->fftlenShift = 9; - move16(); - hsCom->fftlenFac = 20480 /*0.625 Q15*/; - move16(); - BREAK; - default: - assert( !"Unsupported FFT length for FD-based CNG" ); - BREAK; - } - BASOP_getTables( &hsCom->olapWinAna, NULL, NULL, shr( hsCom->fftlen, 1 ) ); - BASOP_getTables( &hsCom->olapWinSyn, NULL, NULL, shr( hsCom->fftlen, 2 ) ); - hsCom->frameSize = shr( hsCom->fftlen, 1 ); - move16(); - - return; -} -#endif /*FIX_2455_HARMONIZE_configureFdCngEnc*/ /************************************** * Delete the instance of type FD_CNG * @@ -1294,403 +1146,12 @@ void FdCng_encodeSID_fx( return; } -#ifndef FIX_2455_HARMONIZE_generate_comfort_noise_enc -void generate_comfort_noise_enc_fx( - Encoder_State *stcod, - Word16 Q_new, - Word16 gen_exc ) -{ - Word16 i, s, sn, cnt; - Word16 startBand2; - Word16 stopFFTbin2; - Word16 preemph_fac; - Word32 sqrtNoiseLevel; - Word16 randGaussExp; - Word16 fftBufferExp; - Word16 cngNoiseLevelExp; - Word16 *seed; - Word16 *timeDomainOutput; - Word32 *ptr_r, *ptr_i; - Word32 *cngNoiseLevel; - Word32 *ptr_level; - Word32 *fftBuffer; - Word16 old_syn_pe_tmp[16]; - Word16 tcx_transition = 0; - HANDLE_FD_CNG_ENC stenc = stcod->hFdCngEnc; - HANDLE_FD_CNG_COM st = stenc->hFdCngCom; - DTX_ENC_HANDLE hDtxEnc = stcod->hDtxEnc; - TD_CNG_ENC_HANDLE hTdCngEnc = stcod->hTdCngEnc; - - LPD_state_HANDLE hLPDmem = stcod->hLPDmem; - TCX_ENC_HANDLE hTcxEnc = stcod->hTcxEnc; - - /* Warning fix */ - s = 0; - - /* pointer initialization */ - - cngNoiseLevel = st->cngNoiseLevel; - cngNoiseLevelExp = st->cngNoiseLevelExp; - ptr_level = cngNoiseLevel; - seed = &( st->seed ); - fftBuffer = st->fftBuffer; - timeDomainOutput = st->timeDomainBuffer; - - /* - Generate Gaussian random noise in real and imaginary parts of the FFT bins - Amplitudes are adjusted to the estimated noise level cngNoiseLevel in each bin - scaling Gaussian random noise: format Q3.29 - */ - sn = 0; - move16(); - IF( s_and( cngNoiseLevelExp, 1 ) != 0 ) - { - sn = add( sn, 1 ); - cngNoiseLevelExp = add( cngNoiseLevelExp, sn ); - move16(); - } - - randGaussExp = CNG_RAND_GAUSS_SHIFT; - move16(); - cnt = sub( stenc->stopFFTbinDec, stenc->startBandDec ); - IF( stenc->startBandDec == 0 ) - { - /* DC component in FFT */ - s = 0; - move16(); - sqrtNoiseLevel = Sqrt32( L_shr( *ptr_level, sn ), &s ); - - fftBuffer[0] = L_shl( Mpy_32_32( rand_gauss( seed ), sqrtNoiseLevel ), s ); - move32(); - - /* Nyquist frequency is discarded */ - fftBuffer[1] = L_deposit_l( 0 ); - - ptr_level = ptr_level + 1; - ptr_r = fftBuffer + 2; - cnt = sub( cnt, 1 ); - } - ELSE - { - startBand2 = shl( stenc->startBandDec, 1 ); - set32_fx( fftBuffer, 0, startBand2 ); - ptr_r = fftBuffer + startBand2; - } - - sn = add( sn, 1 ); - ptr_i = ptr_r + 1; - FOR( i = 0; i < cnt; i++ ) - { - s = 0; - move16(); - sqrtNoiseLevel = Sqrt32( L_shr( *ptr_level, sn ), &s ); - - /* Real part in FFT bins */ - *ptr_r = L_shl( Mpy_32_32( rand_gauss( seed ), sqrtNoiseLevel ), s ); - move32(); - - /* Imaginary part in FFT bins */ - *ptr_i = L_shl( Mpy_32_32( rand_gauss( seed ), sqrtNoiseLevel ), s ); - move32(); - - ptr_r = ptr_r + 2; - ptr_i = ptr_i + 2; - ptr_level = ptr_level + 1; - } - - /* Remaining FFT bins are set to zero */ - stopFFTbin2 = shl( stenc->stopFFTbinDec, 1 ); - set32_fx( fftBuffer + stopFFTbin2, 0, sub( st->fftlen, stopFFTbin2 ) ); - - fftBufferExp = add( shr( cngNoiseLevelExp, 1 ), randGaussExp ); - - /* If previous frame is active, reset the overlap-add buffer */ - IF( GT_32( stcod->last_core_brate, SID_2k40 ) ) - { - set16_fx( st->olapBufferSynth, 0, st->fftlen ); - test(); - test(); - IF( ( GT_32( stcod->last_core, ACELP_CORE ) && EQ_16( stcod->codec_mode, MODE2 ) ) || EQ_16( stcod->codec_mode, MODE1 ) ) - { - tcx_transition = 1; - move16(); - } - } - - /* Perform STFT synthesis */ - SynthesisSTFT( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, - tcx_transition, st, gen_exc, &Q_new, -1, -1 ); - { - Word32 Lener, att; - Word16 exp; - /* update CNG excitation energy for LP_CNG */ - - /* calculate the residual signal energy */ - /*enr = dotp( st->exc_cng, st->exc_cng, st->frameSize ) / st->frameSize;*/ - Lener = Dot_productSq16HQ( 1, st->exc_cng, stcod->L_frame, &exp ); - exp = add( sub( shl( sub( 15, Q_new ), 1 ), 8 ), exp ); /*8 = log2(256)*/ - - /* convert log2 of residual signal energy */ - /*(float)log10( enr + 0.1f ) / (float)log10( 2.0f );*/ - Lener = BASOP_Util_Log2( Lener ); - Lener = L_add( Lener, L_shl( L_deposit_l( exp ), WORD32_BITS - 1 - LD_DATA_SCALE ) ); /*Q25*/ - if ( EQ_16( stcod->L_frame, L_FRAME16k ) ) - { - Lener = L_sub( Lener, 10802114l /*0.3219280949f Q25*/ ); /*log2(320) = 8.3219280949f*/ - } - /* decrease the energy in case of WB input */ - IF( NE_16( stcod->bwidth, NB ) ) - { - IF( EQ_16( stcod->bwidth, WB ) ) - { - IF( hDtxEnc->CNG_mode >= 0 ) - { - /* Bitrate adapted attenuation */ - att = L_shl( L_deposit_l( ENR_ATT_fx[hDtxEnc->CNG_mode] ), 17 ); - } - ELSE - { - /* Use least attenuation for higher bitrates */ - att = L_shl( L_deposit_l( ENR_ATT_fx[4] ), 17 ); - } - } - ELSE - { - att = 384 << 17; - move32(); /*1.5 Q8<<17=Q25*/ - } - Lener = L_sub( Lener, att ); - } - /*stdec->lp_ener = 0.8f * stcod->lp_ener + 0.2f * pow( 2.0f, enr );*/ - Lener = BASOP_util_Pow2( Lener, 6, &exp ); - Lener = Mult_32_16( Lener, 6554 /*0.2f Q15*/ ); - exp = sub( 25, exp ); - Lener = L_shr( Lener, exp ); /*Q6*/ - hTdCngEnc->lp_ener_fx = L_add( Mult_32_16( hTdCngEnc->lp_ener_fx, 26214 /*0.8f Q15*/ ), Lener ); /*Q6*/ - } - - /* Overlap-add when previous frame is active */ - test(); - IF( ( GT_32( stcod->last_core_brate, SID_2k40 ) ) && ( EQ_16( stcod->codec_mode, MODE2 ) ) ) - { - Word32 old_exc_ener, gain, noise32; - Word16 seed_loc, lpcorder, old_syn, tmp, gain16, N, N2, N4, N8; - Word16 old_exc_ener_exp, gain_exp; - Word16 normFacE, normShiftE, normShiftEM1; - Word16 normFacG, normShiftG, normShiftGM1; - Word16 noiseExp, *old_exc, old_Aq[M + 1], *old_syn_pe; - Word16 noise[640], normShiftP2; - Word16 Q_exc, Q_syn; - - assert( st->frameSize <= 640 ); - - seed_loc = st->seed; - move16(); - N = st->frameSize; - move16(); - N2 = shr( st->frameSize, 1 ); - - IF( GT_16( stcod->last_core, ACELP_CORE ) ) - { - Word16 left_overlap_mode; - left_overlap_mode = stcod->hTcxCfg->tcx_last_overlap_mode; - move16(); - if ( EQ_16( left_overlap_mode, ALDO_WINDOW ) ) - { - left_overlap_mode = FULL_OVERLAP; - move16(); - } - - tcx_windowing_synthesis_current_frame( timeDomainOutput, - stcod->hTcxCfg->tcx_mdct_window, /*Keep sine windows for limiting Time modulation*/ - stcod->hTcxCfg->tcx_mdct_window_half, - stcod->hTcxCfg->tcx_mdct_window_minimum, - stcod->hTcxCfg->tcx_mdct_window_length, - stcod->hTcxCfg->tcx_mdct_window_half_length, - stcod->hTcxCfg->tcx_mdct_window_min_length, - 0, - left_overlap_mode, - NULL, - NULL, - NULL, - NULL, - NULL, - N / 2, - shr( sub( abs_s( stcod->hTcxCfg->tcx_offset ), stcod->hTcxCfg->tcx_offset ), 1 ), /* equivalent to: stdec->hTcxCfg->tcx_offset<0?-stdec->hTcxCfg->tcx_offset:0 */ - 1, - 0, - 0 ); - - IF( stcod->hTcxCfg->last_aldo != 0 ) - { - FOR( i = 0; i < st->frameSize; i++ ) - { - timeDomainOutput[i] = add( timeDomainOutput[i], shr_r( hTcxEnc->old_out_fx[i + NS2SA_FX2( stcod->sr_core, N_ZERO_MDCT_NS )], hTcxEnc->Q_old_out ) ); - move16(); - } - } - ELSE - { - tcx_windowing_synthesis_past_frame( hTcxEnc->Txnq, - stcod->hTcxCfg->tcx_aldo_window_1_trunc, - stcod->hTcxCfg->tcx_mdct_window_half, - stcod->hTcxCfg->tcx_mdct_window_minimum, - stcod->hTcxCfg->tcx_mdct_window_length, - stcod->hTcxCfg->tcx_mdct_window_half_length, - stcod->hTcxCfg->tcx_mdct_window_min_length, - stcod->hTcxCfg->tcx_last_overlap_mode ); - - FOR( i = 0; i < N2; i++ ) - { - timeDomainOutput[i] = add( timeDomainOutput[i], shl( hTcxEnc->Txnq[i], TCX_IMDCT_HEADROOM ) ); - move16(); - } - } - } - ELSE - { - - /* - - the scaling of the LPCs (e.g. old_Aq) is always Q12 (encoder or decoder) - - - the scaling of the deemphasized signals (e.g. old_syn) is always Q0 (encoder or decoder) - - - the scaling of the excitation signals in the encoder (e.g. old_exc) is Q_new - - the scaling of the preemphasized signals in the encoder (e.g. old_syn_pe) is Q_new-1 - - - the scaling of the excitation signals in the decoder (e.g. old_exc) is Q_exc (or stdec->Q_exc) - - the scaling of the preemphasized signals in the decoder (e.g. old_syn_pe) is Q_syn (or stdec->Q_syn) - */ - - lpcorder = M; - move16(); - E_LPC_f_lsp_a_conversion( stcod->lsp_old_fx, old_Aq, M ); - old_exc = hLPDmem->old_exc + sub( L_EXC_MEM, N2 ); - old_syn_pe = hLPDmem->mem_syn2; - old_syn = hLPDmem->syn[lpcorder]; - move16(); - preemph_fac = stcod->preemph_fac; - move16(); - Q_exc = Q_new; - Q_syn = sub( Q_new, 1 ); - - /* shift to be in the range of values supported by getNormReciprocalWord16() */ - N8 = shr( N2, CNG_NORM_RECIPROCAL_RANGE_SHIFT ); - - assert( N2 == ( N8 << CNG_NORM_RECIPROCAL_RANGE_SHIFT ) ); - - normFacE = getNormReciprocalWord16( N8 ); - normShiftE = BASOP_util_norm_s_bands2shift( N8 ); - normShiftEM1 = sub( normShiftE, 1 ); - normShiftP2 = add( normShiftE, CNG_NORM_RECIPROCAL_RANGE_SHIFT ); - - old_exc_ener = L_shr( L_mult( old_exc[0], old_exc[0] ), normShiftP2 ); - FOR( i = 1; i < N2; i++ ) - { - old_exc_ener = L_add( old_exc_ener, L_shr( L_mult( old_exc[i], old_exc[i] ), normShiftP2 ) ); - } - old_exc_ener = L_shl( Mpy_32_16_1( old_exc_ener, shl( normFacE, normShiftEM1 ) ), 1 ); - - old_exc_ener_exp = 0; - move16(); - old_exc_ener = Sqrt32( old_exc_ener, &old_exc_ener_exp ); - old_exc_ener_exp = add( old_exc_ener_exp, ( sub( 15, Q_exc ) ) ); - - /* shift to be in the range of values supported by getNormReciprocalWord16() */ - N4 = shr( N, CNG_NORM_RECIPROCAL_RANGE_SHIFT ); - - assert( N == ( N4 << CNG_NORM_RECIPROCAL_RANGE_SHIFT ) ); - - normFacG = getNormReciprocalWord16( N4 ); - normShiftG = BASOP_util_norm_s_bands2shift( N4 ); - normShiftGM1 = sub( normShiftG, 1 ); - normShiftP2 = add( normShiftG, CNG_NORM_RECIPROCAL_RANGE_SHIFT ); - - gain = L_deposit_l( 0 ); - FOR( i = 0; i < N; i++ ) - { - noise32 = rand_gauss( &seed_loc ); - noise[i] = extract_h( noise32 ); - gain = L_add( gain, L_shr( L_mult( noise[i], noise[i] ), normShiftP2 ) ); - } - gain = L_shl( Mpy_32_16_1( gain, shl( normFacG, normShiftGM1 ) ), 1 ); - - gain_exp = 2 * CNG_RAND_GAUSS_SHIFT; - move16(); - gain = ISqrt32( gain, &gain_exp ); - - gain = Mpy_32_32( old_exc_ener, gain ); - gain16 = extract_h( gain ); - - gain_exp = add( old_exc_ener_exp, gain_exp ); - noiseExp = add( CNG_RAND_GAUSS_SHIFT, gain_exp ); - - s = sub( 15 - NOISE_HEADROOM, noiseExp ); - FOR( i = 0; i < N; i++ ) - { - noise[i] = shr_sat( mult( noise[i], gain16 ), s ); - move16(); - } - - assert( lpcorder <= 16 ); - - s = sub( 15 - NOISE_HEADROOM, ( sub( 15, Q_syn ) ) ); - FOR( i = 0; i < lpcorder; i++ ) - { - old_syn_pe_tmp[i] = shr_sat( old_syn_pe[i], s ); - move16(); - } - - E_UTIL_synthesis( - 0, /* i : scaling to apply for a[0] Q0 */ - old_Aq, /* i : LP filter coefficients Q12 */ - noise, /* i : input signal Qx */ - noise, /* o : output signal Qx-s */ - N, /* i : size of filtering Q0 */ - old_syn_pe_tmp, /* i/o: memory associated with this filtering. Q0 */ - 0, /* i : 0=no update, 1=update of memory. Q0 */ - lpcorder /* i : order of LP filter Q0 */ - ); - - tmp = old_syn; - move16(); - - E_UTIL_deemph2( - NOISE_HEADROOM, - noise, /* I/O: signal Qx */ - preemph_fac, /* I: deemphasis factor Qx */ - N, /* I: vector size */ - &tmp /* I/O: memory (signal[-1]) Qx */ - ); - - FOR( i = 0; i < N4; i++ ) - { - tmp = mult( noise[i], st->olapWinSyn[i].v.re ); - timeDomainOutput[i] = add( timeDomainOutput[i], tmp ); - move16(); - tmp = mult( noise[i + N4], st->olapWinSyn[N4 - 1 - i].v.im ); - timeDomainOutput[i + N4] = add( timeDomainOutput[i + N4], tmp ); - move16(); - } - } - } - return; -} -#endif - -#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc void generate_comfort_noise_enc_fx( Encoder_State *stcod, Word16 Q_new, Word16 gen_exc, Word16 element_mode ) -#else -void generate_comfort_noise_enc_ivas_fx( - Encoder_State *stcod, - Word16 Q_new, - Word16 gen_exc ) -#endif { Word16 i, s, sn, cnt; Word16 startBand2; @@ -1813,7 +1274,6 @@ void generate_comfort_noise_enc_ivas_fx( } /* Perform STFT synthesis */ -#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc IF( EQ_16( element_mode, EVS_MONO ) ) { SynthesisSTFT( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, @@ -1825,11 +1285,6 @@ void generate_comfort_noise_enc_ivas_fx( tcx_transition, st, gen_exc, &Q_new, -1, -1 ); } IF( ( ( hTdCngEnc != NULL ) && ( NE_16( element_mode, EVS_MONO ) ) ) || EQ_16( element_mode, EVS_MONO ) ) -#else - SynthesisSTFT_enc_ivas_fx( fftBuffer, fftBufferExp, timeDomainOutput, st->olapBufferSynth, st->olapWinSyn, - tcx_transition, st, gen_exc, &Q_new, -1, -1 ); - IF( hTdCngEnc != NULL ) -#endif { Word32 Lener, att; Word16 exp; diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 2e96187c8d79582b2303ba5f8b4636f03875ca5d..bd5e86e5bcbf262940c905c00c93c7e36d62e086 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1177,11 +1177,7 @@ ivas_error init_encoder_fx( total_brate = st->total_brate; move32(); } -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, total_brate, st->element_mode ); -#else - configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, total_brate ); -#endif } } ELSE diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 2308d8d65a42ab221759ae6eaed9ce8b45b9b236..c8389c17109936bc382bd06a7d2a35b9eb4b642d 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -567,7 +567,6 @@ ivas_error ivas_core_enc_fx( test(); IF( ( NE_16( st->hFdCngEnc->hFdCngCom->frameSize, st->L_frame ) ) || ( NE_16( st->hFdCngEnc->hFdCngCom->CngBandwidth, st->bwidth ) ) ) { -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc IF( EQ_16( st->L_frame, L_FRAME16k ) ) { configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_16k40, st->element_mode ); @@ -576,16 +575,6 @@ ivas_error ivas_core_enc_fx( { configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_9k60, st->element_mode ); } -#else - IF( EQ_16( st->L_frame, L_FRAME16k ) ) - { - configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_16k40 ); - } - ELSE - { - configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_9k60 ); - } -#endif } } diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 0afc640bf681832230e6ff606ff0457f5b1778fd..9b2631128e995c86deeb58bc50589ab77d8968a2 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -930,11 +930,7 @@ void pre_proc_front_ivas_fx( { total_brate = imult3216( FRAMES_PER_SEC, st->bits_frame_nominal ); /* Q0 */ } -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate, element_mode ); -#else - configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate ); -#endif IF( hCPE != NULL ) { diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index de8970d09506e6f3971b75e7bd8a2a0c61278029..d4c8c6481e342b9caa2bf133b1924f1a5d875ee8 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -178,11 +178,7 @@ void pre_proc_ivas_fx( test(); IF( st->hFdCngEnc != NULL && NE_16( st->element_mode, IVAS_CPE_MDCT ) && ( ( NE_16( st->hFdCngEnc->hFdCngCom->frameSize, st->L_frame ) ) || ( NE_16( st->hFdCngEnc->hFdCngCom->CngBandwidth, st->input_bwidth ) ) ) ) { -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc configureFdCngEnc_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate_tmp, st->element_mode ); -#else - configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate_tmp ); -#endif } if ( st->ini_frame == 0 ) diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 7ab3c8fbbad0b3fddc751d5561496a36d29ffb49..2110337566ae932d8e30f4e87b4e20c749a9f20b 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -608,11 +608,7 @@ ivas_error stereo_memory_enc_fx( } initFdCngEnc_fx( st->hFdCngEnc, st->input_Fs, st->cldfbAnaEnc->scale ); -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, st->rf_mode && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, hCPE->element_mode ); -#else - configureFdCngEnc_ivas_fx( st->hFdCngEnc, st->bwidth, st->rf_mode && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate ); -#endif } } } diff --git a/lib_enc/pre_proc_fx.c b/lib_enc/pre_proc_fx.c index e25c15dde949578eab5a997bf4ecc7e38f28fb24..7ee3143b61037f43ca0e17b27ecb2ea8051bbc32 100644 --- a/lib_enc/pre_proc_fx.c +++ b/lib_enc/pre_proc_fx.c @@ -346,11 +346,7 @@ void pre_proc_fx( L_tmp = ACELP_9k60; move32(); } -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc - configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, L_tmp, 0 /*EVS_MONO*/ ); -#else - configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, L_tmp ); -#endif + configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, L_tmp, EVS_MONO ); } test(); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 0281d8f6d1c2d2d87a44723a7db1e3350528a6be..ffcfbff2081ebcb5af61dcc7aa0c5ce0f66524df 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1479,20 +1479,12 @@ void FdCng_encodeSID_fx( Word16 preemph_fac /* i : preemphase factor */ ); -#ifdef FIX_2455_HARMONIZE_generate_comfort_noise_enc /* Generate the comfort noise based on the target noise level */ void generate_comfort_noise_enc_fx( Encoder_State *stcod, Word16 Q_new, Word16 gen_exc, Word16 element_mode ); -#else -/* Generate the comfort noise based on the target noise level */ -void generate_comfort_noise_enc_fx( - Encoder_State *stcod, - Word16 Q_new, - Word16 gen_exc ); -#endif Word16 cng_energy_fx( const Word16 element_mode, /* i : element mode Q0*/ @@ -1598,20 +1590,12 @@ void initFdCngEnc_fx( const Word32 input_Fs, /* Q0 */ const Word16 scale ); -#ifdef FIX_2455_HARMONIZE_configureFdCngEnc void configureFdCngEnc_fx( HANDLE_FD_CNG_ENC hsEnc, /* i/o: Contains the variables related to the FD-based CNG process */ const Word16 bandwidth, /* i : bandwidth Q0 */ const Word32 bitrate, /* i : bitrate Q0 */ const Word16 element_mode /* i : element mode Q0 */ ); -#else -void configureFdCngEnc_fx( - HANDLE_FD_CNG_ENC hs, /* i/o: Contains the variables related to the CLDFB-based CNG process */ - const Word16 bandwidth, /* i : bandwidth Q0*/ - const Word32 bitrate /* Q0 */ -); -#endif /* Perform noise estimation */ void perform_noise_estimation_enc_fx( @@ -3871,12 +3855,6 @@ Word16 cng_energy_ivas_fx( const Word16 Q_new /* i : Input scaling */ ); -#ifndef FIX_2455_HARMONIZE_generate_comfort_noise_enc -void generate_comfort_noise_enc_ivas_fx( - Encoder_State *stcod, - Word16 Q_new, - Word16 gen_exc ); -#endif void SynthesisSTFT_enc_ivas_fx( Word32 *fftBuffer, /* i : pointer to FFT bins */ diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 425e3c99fe8edfa86c4c55aa7f681ec6227b8d29..5de1e776cf0dc99c69e8176bc6901a0014f3b89e 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -1681,18 +1681,7 @@ void swb_tbe_enc_fx( ELSE { /* LSF quantization (21 bits) */ -#ifdef FIX_2463_EVS_BWE_LSF Quant_BWE_LSF_fx( hBstr, hBWE_TD, st_fx->codec_mode, lsf_shb_fx, lsf_shb_fx, st_fx->extl_brate ); -#else - IF( st_fx->element_mode == EVS_MONO ) - { - Quant_BWE_LSF_fx( hBstr, hBWE_TD, st_fx->codec_mode, lsf_shb_fx, lsf_shb_fx, st_fx->extl ); // this is likely a bug in EVS - } - ELSE - { - Quant_BWE_LSF_fx( hBstr, hBWE_TD, st_fx->codec_mode, lsf_shb_fx, lsf_shb_fx, st_fx->extl_brate ); - } -#endif } /* space the lsfs to assert a minimum distance */ diff --git a/lib_rend/ivas_orient_trk_fx.c b/lib_rend/ivas_orient_trk_fx.c index 8208488e18edf5ec7d7f03cefa63b6117d045ce2..3c911bd0a051db1b4de24fa73a21577f0f04244c 100644 --- a/lib_rend/ivas_orient_trk_fx.c +++ b/lib_rend/ivas_orient_trk_fx.c @@ -52,7 +52,6 @@ * Local functions *------------------------------------------------------------------------------------------*/ -#ifdef FIX_2398_PRECISSION_ORIENTATION_TRACKING /*------------------------------------------------------------------------------------------* * Sqrt32 with Newton-Raphson Correction * @@ -88,7 +87,6 @@ static Word32 Sqrt32_NewtonRaphson( Word32 mantissa, Word16 *e, Word16 n ) move32(); return result_fx_0; } -#endif /*------------------------------------------------------------------------------------------* * IdentityQuaternion() @@ -229,11 +227,7 @@ static void QuaternionNormalize_fx( Word32 sqrt_fx; Word32 dot_prod_fx = QuaternionDotProduct_fx( q_fx, q_fx, &q_dot ); sqrt_e = sub( Q31, q_dot ); -#ifdef FIX_2398_PRECISSION_ORIENTATION_TRACKING sqrt_fx = Sqrt32_NewtonRaphson( dot_prod_fx, &sqrt_e, 1 ); -#else - sqrt_fx = Sqrt32( dot_prod_fx, &sqrt_e ); -#endif QuaternionDivision_fx( q_fx, sqrt_fx, r_fx, sqrt_e ); return; } @@ -528,11 +522,7 @@ static Word32 VectorLength_fx( Word32 result_fx; result_fx = Madd_32_32( Madd_32_32( Mpy_32_32( p.x_fx, p.x_fx ), p.y_fx, p.y_fx ), p.z_fx, p.z_fx ); sqrt_e = shl( sub( 31, p.q_fact ), 1 ); /* convert Q to E */ -#ifndef FIX_2398_PRECISSION_ORIENTATION_TRACKING - result_fx = Sqrt32( result_fx, &sqrt_e ); -#else result_fx = Sqrt32_NewtonRaphson( result_fx, &sqrt_e, 1 ); -#endif *q_fact = sub( 31, sqrt_e ); /* back to Q again */ move16(); return result_fx;