diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 17d4ba062813a1586791e833f16142a798425d83..15af6dffe3dad514de53b752a2d843f59d12164c 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1681,6 +1681,7 @@ void ivas_mdct_tcx10_bit_distribution_fx( const Word16 nTnsBitsTCX10[NB_DIV] /* i : TNS bits */ ); +#ifndef FIX_2480_HARM_TONALMDCT void TonalMDCTConceal_Detect_ivas_fx( const TonalMDCTConcealPtr hTonalMDCTConc, const Word32 pitchLag, @@ -1688,7 +1689,15 @@ void TonalMDCTConceal_Detect_ivas_fx( const PsychoacousticParameters *psychParamsCurrent, Word16 element_mode ); - +#else +void TonalMDCTConceal_Detect_fx( + const TonalMDCTConcealPtr hTonalMDCTConc, + const Word32 pitchLag, + Word16* numIndices, + const PsychoacousticParameters* psychParamsCurrent, + Word16 element_mode +); +#endif // !FIX_2480_HARM_TONALMDCT ivas_error stereo_dft_dec_create_fx( STEREO_DFT_DEC_DATA_HANDLE *hStereoDft, /* i/o: decoder DFT stereo handle */ const Word32 element_brate, /* i : element bitrate */ diff --git a/lib_com/options.h b/lib_com/options.h index daede4c0d2584ef73b77d4b5f9700e8bceb2fe1c..9f02a761a3142ccabeea1ac0c7325bfccda26c24 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -90,6 +90,7 @@ #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() */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 02cc7f06d9e2f601e777acb42cb5c3bdd8a63e79..79928921011dfeab90f5b4576238e42498da4017 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -5708,12 +5708,14 @@ void TonalMDCTConceal_UpdateState_fx( const Word16 badBlock, const Word8 tonalConcealmentActive ); +#ifndef FIX_2480_HARM_TONALMDCT void TonalMDCTConceal_Detect_fx( const TonalMDCTConcealPtr self, /*IN */ const Word32 pitchLag, /*IN */ Word16 *umIndices, /*OUT*/ const Word16 element_mode /* IN */ ); +#endif // !FIX_2480_HARM_TONALMDCT void TonalMDCTConceal_Apply_fx( const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */ diff --git a/lib_dec/er_util_fx.c b/lib_dec/er_util_fx.c index 5632e52affb7735a4058431b672612b1cda9a0a4..7adb78c127adc1734a34ea5d7283b2a522f1e114 100644 --- a/lib_dec/er_util_fx.c +++ b/lib_dec/er_util_fx.c @@ -449,6 +449,7 @@ Word16 GetPLCModeDecision_fx( { pitch = L_add( st->old_fpitch, 0 ); /*Q16*/ } +#ifndef FIX_2480_HARM_TONALMDCT IF( NE_16( st->element_mode, EVS_MONO ) ) { TonalMDCTConceal_Detect_ivas_fx( st->hTonalMDCTConc, pitch, &numIndices, ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ), st->element_mode ); @@ -457,6 +458,10 @@ Word16 GetPLCModeDecision_fx( { TonalMDCTConceal_Detect_fx( st->hTonalMDCTConc, pitch, &numIndices, st->element_mode ); } +#else + TonalMDCTConceal_Detect_fx( st->hTonalMDCTConc, pitch, &numIndices, ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ? &( st->hTcxCfg->psychParamsTCX20 ) : st->hTcxCfg->psychParamsCurrent ), st->element_mode ); +#endif // !FIX_2480_HARM_TONALMDCT + test(); test(); diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index ee491c23b98d630861b228c01efa4b3cb12bd496..210d2a2c08e09e6b9e04e53d2bc85888fbccb586 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -927,6 +927,7 @@ static void CalcMDXT( return; } +#ifndef FIX_2480_HARM_TONALMDCT void TonalMDCTConceal_Detect_fx( const TonalMDCTConcealPtr hTonalMDCTConc, const Word32 pitchLag, /*15Q16*/ @@ -1052,31 +1053,58 @@ void TonalMDCTConceal_Detect_fx( return; } - +#endif // !FIX_2480_HARM_TONALMDCT +#ifndef FIX_2480_HARM_TONALMDCT void TonalMDCTConceal_Detect_ivas_fx( const TonalMDCTConcealPtr hTonalMDCTConc, const Word32 pitchLag, /*15Q16*/ Word16 *numIndices, const PsychoacousticParameters *psychParamsCurrent, Word16 element_mode ) +#else +void TonalMDCTConceal_Detect_fx( + const TonalMDCTConcealPtr hTonalMDCTConc, + const Word32 pitchLag, /*15Q16*/ + Word16 *numIndices, + const PsychoacousticParameters *psychParamsCurrent, + Word16 element_mode ) +#endif // !FIX_2480_HARM_TONALMDCT { Word32 secondLastMDST[L_FRAME_MAX]; set32_fx( secondLastMDST, 0, L_FRAME_MAX ); + + Word32 secondLastMDCT[L_FRAME_MAX]; Word16 secondLastMDCT_exp; Word32 *powerSpectrum = secondLastMDST; Word16 i, powerSpectrum_exp, secondLastMDST_exp, s; Word16 nSamples; - // Word16 nBands; Word32 sns_int_scf_fx[FDNS_NPTS]; set32_fx( sns_int_scf_fx, 0, FDNS_NPTS ); + nSamples = hTonalMDCTConc->nSamples; move16(); + +#ifndef FIX_2480_HARM_TONALMDCT secondLastMDST_exp = sub( 16, hTonalMDCTConc->q_lastPcmOut ); /*time signal Q-1 - hTonalMDCTConc->q_lastPcmOut*/ move16(); secondLastMDCT_exp = sub( 16, hTonalMDCTConc->q_lastPcmOut ); /*time signal Q-1 - hTonalMDCTConc->q_lastPcmOut*/ move16(); +#else + IF( EQ_16( element_mode, EVS_MONO ) ) + { + secondLastMDST_exp = 16; /*time signal Q-1*/ + secondLastMDCT_exp = 16; /*time signal Q-1*/ + } + ELSE + { + secondLastMDST_exp = sub( 16, hTonalMDCTConc->q_lastPcmOut ); /*time signal Q-1 - hTonalMDCTConc->q_lastPcmOut*/ + secondLastMDCT_exp = sub( 16, hTonalMDCTConc->q_lastPcmOut ); /*time signal Q-1 - hTonalMDCTConc->q_lastPcmOut*/ + } +#endif // !FIX_2480_HARM_TONALMDCT + move16(); + move16(); test(); test(); test(); @@ -1108,8 +1136,15 @@ void TonalMDCTConceal_Detect_ivas_fx( move16(); nSamples = hTonalMDCTConc->nNonZeroSamples; move16(); - +#ifndef FIX_2480_HARM_TONALMDCT s = sub( getScaleFactor32( secondLastMDST, nSamples ), 1 ); +#else + s = getScaleFactor32( secondLastMDST, nSamples ); + IF( NE_16( element_mode, EVS_MONO ) ) + { + s = sub( s, 1 ); + } +#endif // !FIX_2480_HARM_TONALMDCT FOR( i = 0; i < nSamples; i++ ) { @@ -1118,7 +1153,15 @@ void TonalMDCTConceal_Detect_ivas_fx( } secondLastMDST_exp = sub( secondLastMDST_exp, s ); move16(); +#ifndef FIX_2480_HARM_TONALMDCT s = sub( getScaleFactor32( secondLastMDCT, nSamples ), 1 ); +#else + s = getScaleFactor32( secondLastMDCT, nSamples ); + IF( NE_16( element_mode, EVS_MONO ) ) + { + s = sub( s, 1 ); + } +#endif // !FIX_2480_HARM_TONALMDCT FOR( i = 0; i < nSamples; i++ ) { @@ -1136,8 +1179,16 @@ void TonalMDCTConceal_Detect_ivas_fx( Word16 temp_power_spectrum_q = 0; nSamples = hTonalMDCTConc->nNonZeroSamples; move16(); +#ifndef FIX_2480_HARM_TONALMDCT Copy_Scale_sig_16_32_DEPREC( hTonalMDCTConc->secondLastPowerSpectrum, powerSpectrum, nSamples, Q15 ); temp_power_spectrum_q = add( Q15, sub( 15, hTonalMDCTConc->secondLastPowerSpectrum_exp ) ); +#else + IF( NE_16( element_mode, EVS_MONO ) ) + { + Copy_Scale_sig_16_32_DEPREC( hTonalMDCTConc->secondLastPowerSpectrum, powerSpectrum, nSamples, Q15 ); + temp_power_spectrum_q = add( Q15, sub( 15, hTonalMDCTConc->secondLastPowerSpectrum_exp ) ); + } +#endif // !FIX_2480_HARM_TONALMDCT IF( psychParamsCurrent == NULL ) { mdct_shaping_16( hTonalMDCTConc->secondLastPowerSpectrum, hTonalMDCTConc->nSamplesCore, nSamples,