diff --git a/lib_com/core_com_config_fx.c b/lib_com/core_com_config_fx.c index 1afa2f1a9456062e24ab7db3224ea8d935bf19a1..cb9723487826c1f5d416afa83084bec6400607b9 100644 --- a/lib_com/core_com_config_fx.c +++ b/lib_com/core_com_config_fx.c @@ -997,8 +997,11 @@ void init_tcx_cfg_ivas_fx( IF( hTcxCfg->fIsTNSAllowed ) { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfigs_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag ); +#else InitTnsConfigs_ivas_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag ); - +#endif SetAllowTnsOnWhite( hTcxCfg->tnsConfig, (Word8) EQ_16( element_mode, IVAS_CPE_MDCT ) ); } @@ -1253,7 +1256,11 @@ void init_tcx_cfg_fx( IF( hTcxCfg->fIsTNSAllowed ) { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfigs_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag ); +#else InitTnsConfigs( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag ); +#endif SetAllowTnsOnWhite( hTcxCfg->tnsConfig, (Word8) EQ_16( element_mode, IVAS_CPE_MDCT ) ); } diff --git a/lib_com/options.h b/lib_com/options.h index f0eb097b589750a46be62c7c201f8cc2450919aa..61a3c10ccfc2662a6854e6d6fc182f24dde9d839 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -84,6 +84,7 @@ #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 FIX_1904_HARM_GSC_ENC /* VA: #1904 Harmonization of EVS and IVAS GSC code */ +#define FIX_2388_INITTNSCONFIGURATION /* FhG: issue 2388 : harmonizing InitTnsConfiguration() function */ #define FIX_2397_COPY_AQ_MDCT_CORE_BFI /* FhG: prevent copying of uninit memory in MDCT stereo core if bfi is set */ #define HARMONIZE_TBE /* VA: harmonize core-coder TBE function duplications */ #define FIX_2405_HARM_SMC_INIT /* VA, basop 2405, harmonisation of SMC init */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index e7166845dadd450a457fdd39f8c53bd7f6e0debf..4dc1a1b1eadbdf44bb0ef2242219f853c1011b74 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -3577,6 +3577,7 @@ Word32 DTFS_getEngy_band_wb_fx( Word16 lband, Word16 hband ); +#ifndef FIX_2388_INITTNSCONFIGURATION void InitTnsConfiguration( const Word16 bwidth, const Word16 frameLength, @@ -3585,8 +3586,13 @@ void InitTnsConfiguration( const Word32 total_brate, const Word16 element_mode, const Word16 is_mct ); +#endif +#ifdef FIX_2388_INITTNSCONFIGURATION +void InitTnsConfiguration_fx( +#else void InitTnsConfiguration_ivas_fx( +#endif const Word16 bwidth, const Word16 frameLength, STnsConfig *pTnsConfig, @@ -4231,6 +4237,7 @@ void tcx_noise_filling_with_shift( const Word16 element_mode /* i : IVAS element mode */ ); +#ifndef FIX_2388_INITTNSCONFIGURATION void InitTnsConfigs( const Word16 bwidth, const Word16 L_frame, @@ -4239,15 +4246,21 @@ void InitTnsConfigs( const Word32 total_brate, const Word16 element_mode, const Word16 is_mct ); +#endif -void InitTnsConfigs_ivas_fx( - const Word16 bwidth, - const Word16 L_frame, - STnsConfig tnsConfig[2][2], - const Word16 igfStopFreq, - const Word32 total_brate, - const Word16 element_mode, - const Word16 is_mct ); +#ifdef FIX_2388_INITTNSCONFIGURATION +void InitTnsConfigs_fx +#else +void InitTnsConfigs_ivas_fx +#endif + ( + const Word16 bwidth, + const Word16 L_frame, + STnsConfig tnsConfig[2][2], + const Word16 igfStopFreq, + const Word32 total_brate, + const Word16 element_mode, + const Word16 is_mct ); void SetAllowTnsOnWhite( STnsConfig tnsConfig[2][2], diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index f73fb5971b38de11530493d3bdd92d6df7fdd6ea..44c034a20ac0c3ea1e8572bbdf63954cb4c9dbf4 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -1973,6 +1973,7 @@ void tcx_noise_filling_with_shift( *--------------------------------------------------------------*/ +#ifndef FIX_2388_INITTNSCONFIGURATION void InitTnsConfigs( const Word16 bwidth, /*Q0*/ const Word16 L_frame, /*Q0*/ @@ -1989,22 +1990,37 @@ void InitTnsConfigs( InitTnsConfiguration( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, MCT_flag ); InitTnsConfiguration( bwidth, add( L_frame, shr( L_frame, 2 ) ), &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag ); } - -void InitTnsConfigs_ivas_fx( - const Word16 bwidth, /*Q0*/ - const Word16 L_frame, /*Q0*/ - STnsConfig tnsConfig[2][2], - const Word16 igfStopFreq, /*Q0*/ - const Word32 total_brate, /*Q0*/ - const Word16 element_mode, /*Q0*/ - const Word16 MCT_flag /*Q0*/ ) +#endif + +#ifdef FIX_2388_INITTNSCONFIGURATION +void InitTnsConfigs_fx +#else +void InitTnsConfigs_ivas_fx +#endif + ( + const Word16 bwidth, /*Q0*/ + const Word16 L_frame, /*Q0*/ + STnsConfig tnsConfig[2][2], + const Word16 igfStopFreq, /*Q0*/ + const Word32 total_brate, /*Q0*/ + const Word16 element_mode, /*Q0*/ + const Word16 MCT_flag /*Q0*/ ) { IF( GT_32( total_brate, ACELP_32k ) ) { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfiguration_fx( bwidth, shr( L_frame, 1 ), &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, MCT_flag ); +#else InitTnsConfiguration_ivas_fx( bwidth, shr( L_frame, 1 ), &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, MCT_flag ); +#endif } +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfiguration_fx( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, MCT_flag ); + InitTnsConfiguration_fx( bwidth, add( L_frame, shr( L_frame, 2 ) ), &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag ); +#else InitTnsConfiguration_ivas_fx( bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, MCT_flag ); InitTnsConfiguration_ivas_fx( bwidth, add( L_frame, shr( L_frame, 2 ) ), &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag ); +#endif } void SetTnsConfig( diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c old mode 100755 new mode 100644 index 600b2e6fe9b03a725b1673a09f2db93a39e903a7..8c79d885f2a9c45228e992c246f30e746444df00 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -72,6 +72,7 @@ static void ITF_GetFilterParameters_fx( Word32 rxx[], const Word16 maxOrder, Wor /* Interface functions */ /********************************/ +#ifndef FIX_2388_INITTNSCONFIGURATION /** Init TNS configuration. * Fills STnsConfig structure with sensible content. * @param nSampleRate Sampling rate of the input. @@ -196,15 +197,21 @@ void InitTnsConfiguration( } return; /*TNS_NO_ERROR;*/ } - -void InitTnsConfiguration_ivas_fx( - const Word16 bwidth, /*Q0*/ - const Word16 frameLength, /*Q0*/ - STnsConfig *pTnsConfig, - const Word16 igfStopFreq, /*Q0*/ - const Word32 total_brate, /*Q0*/ - const Word16 element_mode, /*Q0*/ - const Word16 is_mct /*Q0*/ ) +#endif /* FIX_2388_INITTNSCONFIGURATION */ + +#ifdef FIX_2388_INITTNSCONFIGURATION +void InitTnsConfiguration_fx +#else +void InitTnsConfiguration_ivas_fx +#endif /* FIX_2388_INITTNSCONFIGURATION */ + ( + const Word16 bwidth, /*Q0*/ + const Word16 frameLength, /*Q0*/ + STnsConfig *pTnsConfig, + const Word16 igfStopFreq, /*Q0*/ + const Word32 total_brate, /*Q0*/ + const Word16 element_mode, /*Q0*/ + const Word16 is_mct /*Q0*/ ) { Word16 iFilter = 0; move16(); @@ -235,7 +242,11 @@ void InitTnsConfiguration_ivas_fx( IF( LE_32( total_brate, ACELP_32k ) ) { move16(); - pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParametersIGF32kHz_LowBR ), sizeof( tnsParametersIGF32kHz_LowBR[0] ) ); /*Q0*/ +#ifdef FIX_2388_INITTNSCONFIGURATION + pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParametersIGF32kHz_LowBR ) / sizeof( tnsParametersIGF32kHz_LowBR[0] ) ); /*Q0*/ +#else + pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParametersIGF32kHz_LowBR ), sizeof( tnsParametersIGF32kHz_LowBR[0] ) ); /*Q0*/ +#endif pTnsConfig->pTnsParameters = tnsParametersIGF32kHz_LowBR; } ELSE @@ -243,7 +254,11 @@ void InitTnsConfiguration_ivas_fx( test(); IF( GT_32( nSampleRate, 32000 ) && EQ_32( nSampleRate, L_mult0( 100, frameLength ) ) ) { - pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters48kHz_grouped ), sizeof( tnsParameters48kHz_grouped[0] ) ); /*Q0*/ +#ifdef FIX_2388_INITTNSCONFIGURATION + pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters48kHz_grouped ) / sizeof( tnsParameters48kHz_grouped[0] ) ); /*Q0*/ +#else + pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters48kHz_grouped ), sizeof( tnsParameters48kHz_grouped[0] ) ); /*Q0*/ +#endif move16(); pTnsConfig->pTnsParameters = tnsParameters48kHz_grouped; } @@ -259,7 +274,11 @@ void InitTnsConfiguration_ivas_fx( test(); IF( GT_16( element_mode, IVAS_SCE ) && GE_32( total_brate, L_tmp ) ) { - pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters32kHz_Stereo ), sizeof( tnsParameters32kHz_Stereo[0] ) ); /*Q0*/ +#ifdef FIX_2388_INITTNSCONFIGURATION + pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters32kHz_Stereo ) / sizeof( tnsParameters32kHz_Stereo[0] ) ); /*Q0*/ +#else + pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters32kHz_Stereo ), sizeof( tnsParameters32kHz_Stereo[0] ) ); /*Q0*/ +#endif move16(); IF( EQ_32( nSampleRate, L_mult0( 100, frameLength ) ) ) /* sub-frame length is <= 10 ms */ { @@ -274,7 +293,11 @@ void InitTnsConfiguration_ivas_fx( { move16(); - pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters32kHz ), sizeof( tnsParameters32kHz[0] ) ); /*Q0*/ +#ifdef FIX_2388_INITTNSCONFIGURATION + pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters32kHz ) / sizeof( tnsParameters32kHz[0] ) ); /*Q0*/ +#else + pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters32kHz ), sizeof( tnsParameters32kHz[0] ) ); /*Q0*/ +#endif pTnsConfig->pTnsParameters = tnsParameters32kHz; @@ -289,13 +312,21 @@ void InitTnsConfiguration_ivas_fx( IF( EQ_32( nSampleRate, L_mult0( 100, frameLength ) ) ) /* sub-frame length is <= 10 ms */ { move16(); +#ifdef FIX_2388_INITTNSCONFIGURATION + pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters16kHz_grouped ) / sizeof( tnsParameters16kHz_grouped[0] ) ); /*Q0*/ +#else pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters16kHz_grouped ), sizeof( tnsParameters16kHz_grouped[0] ) ); /*Q0*/ +#endif pTnsConfig->pTnsParameters = tnsParameters16kHz_grouped; } ELSE { move16(); - pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters16kHz ), sizeof( tnsParameters16kHz[0] ) ); /*Q0*/ +#ifdef FIX_2388_INITTNSCONFIGURATION + pTnsConfig->nMaxFilters = (UWord8) ( sizeof( tnsParameters16kHz ) / sizeof( tnsParameters16kHz[0] ) ); /*Q0*/ +#else + pTnsConfig->nMaxFilters = (UWord8) idiv1616( sizeof( tnsParameters16kHz ), sizeof( tnsParameters16kHz[0] ) ); /*Q0*/ +#endif pTnsConfig->pTnsParameters = tnsParameters16kHz; } } diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 79b75b02f20db6120e5428c92ecf95e417a4a391..678d0b3d7ccc621dd3ecc0bbea2006fe0b507cea 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -240,7 +240,11 @@ void open_decoder_LPD_fx( IF( st->hTcxCfg->fIsTNSAllowed != 0 ) { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfigs_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, st->total_brate, st->element_mode, 0 /*is_mct*/ ); +#else InitTnsConfigs( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, st->total_brate, st->element_mode, 0 /*is_mct*/ ); +#endif } /*Constraint for adaptive BPF, otherwise parameter estimation and post-processing not time aligned*/ if ( st->tcxonly == 0 ) diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index b22a48b43cf685fa4255336d593e0698cfaa7ba9..3a9148b7661f45f9584b5d5729caac9f4eba3f27 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -133,7 +133,11 @@ void mode_switch_decoder_LPD_fx( IF( ( st->hTcxCfg->fIsTNSAllowed != 0 ) && st->hIGFDec != NULL ) { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfigs_fx( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, 0 /* 0 should be replaced with MCT_flag*/ ); +#else InitTnsConfigs( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, 0 /* 0 should be replaced with MCT_flag*/ ); +#endif } } } @@ -377,7 +381,11 @@ void mode_switch_decoder_LPD_ivas_fx( IF( st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL ) { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfigs_fx( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, MCT_flag ); +#else InitTnsConfigs( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, MCT_flag ); +#endif SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, (Word8) EQ_16( st->element_mode, IVAS_CPE_MDCT ) ); } diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index a8c674170365bd4a43a6d0cee9216e58ffa83ab3..c944bc5f473ce969750d2893041c5673b6c45fa6 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -361,7 +361,11 @@ static void init_tcx_fx( IF( st->hTcxCfg->fIsTNSAllowed != 0 ) { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfigs_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, 0 /*is_mct*/ ); +#else InitTnsConfigs( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, 0 /*is_mct*/ ); +#endif } /* TCX-LTP */ diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index b61609e50c06e942b791564429ee2dad0f04fae0..27c429ded7f03b07c847cd9022c6d5caeb55170e 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -109,7 +109,11 @@ void core_coder_mode_switch_fx( move16(); IF( st->hTcxCfg->fIsTNSAllowed != 0 ) { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfigs_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, MCT_flag ); +#else InitTnsConfigs( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, MCT_flag ); +#endif } st->narrowBand = 0; @@ -333,7 +337,11 @@ void core_coder_mode_switch_ivas_fx( IF( st->hTcxCfg->fIsTNSAllowed ) { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfigs_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, MCT_flag ); +#else InitTnsConfigs_ivas_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, MCT_flag ); +#endif SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT ); } diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index 709e17ef716a3ea4c82c7824624b342d35933d24..db24fbd35ce16f4260f22824b4a50b7b8b180d4b 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -134,7 +134,11 @@ void stereo_tcx_init_enc_fx( test(); IF( !prev_IsTNSAllowed && st->hTcxCfg->fIsTNSAllowed && EQ_16( st->element_mode, IVAS_CPE_DFT ) ) /* may happen in unified stereo when switching stereo technologies */ { +#ifdef FIX_2388_INITTNSCONFIGURATION + InitTnsConfigs_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, total_brate, st->element_mode, 0 ); +#else InitTnsConfigs_ivas_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, total_brate, st->element_mode, 0 ); +#endif SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, 0 ); }