diff --git a/lib_com/core_com_config_fx.c b/lib_com/core_com_config_fx.c index fef5b6f392e0d0f46aec523339ba65465c306818..94cc4345a6a323bd102fe9d198866254fffbf129 100644 --- a/lib_com/core_com_config_fx.c +++ b/lib_com/core_com_config_fx.c @@ -169,7 +169,20 @@ Word16 get_codec_mode( return codec_mode; /*Q0*/ } +#ifdef FIX_2385_GETTCXONLY +/*-------------------------------------------------------------------* + * getTcxonly() + * + * + *-------------------------------------------------------------------*/ +Word16 getTcxonly_fx( + const Word16 element_mode, /* i : IVAS element mode Q0*/ + const Word32 total_brate, /* i : total bitrate Q0*/ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ + const Word16 is_ism_format /* i : flag indicating ISM format Q0*/ +) +#else /*-------------------------------------------------------------------* * getTcxonly_ivas() * @@ -182,20 +195,11 @@ Word16 getTcxonly_ivas_fx( const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ const Word16 is_ism_format /* i : flag indicating ISM format Q0*/ ) +#endif /* FIX_2385_GETTCXONLY */ { Word16 tcxonly = 0; move16(); Word32 temp_flag; - if ( MCT_flag ) - { - temp_flag = IVAS_32k; - move32(); - } - else - { - temp_flag = IVAS_48k; - move32(); - } SWITCH( element_mode ) { @@ -207,24 +211,19 @@ Word16 getTcxonly_ivas_fx( } BREAK; case IVAS_SCE: + temp_flag = MAX_ACELP_BRATE; + move32(); if ( is_ism_format ) { - if ( GT_32( total_brate, MAX_ACELP_BRATE_ISM ) ) - { - tcxonly = 1; - move16(); - } + temp_flag = MAX_ACELP_BRATE_ISM; + move32(); } - else + if ( GT_32( total_brate, temp_flag ) ) { - if ( GT_32( total_brate, MAX_ACELP_BRATE ) ) - { - tcxonly = 1; - move16(); - } + tcxonly = 1; + move16(); } BREAK; - case IVAS_CPE_DFT: case IVAS_CPE_TD: if ( GT_32( total_brate, MAX_ACELP_BRATE ) ) @@ -234,6 +233,13 @@ Word16 getTcxonly_ivas_fx( } BREAK; case IVAS_CPE_MDCT: + temp_flag = IVAS_48k; + move32(); + if ( MCT_flag ) + { + temp_flag = IVAS_32k; + move32(); + } if ( GE_32( total_brate, temp_flag ) ) { tcxonly = 1; @@ -244,6 +250,7 @@ Word16 getTcxonly_ivas_fx( return tcxonly; /*Q0*/ } +#ifndef FIX_2385_GETTCXONLY Word16 getTcxonly( const Word32 total_brate /* i : total bitrate */ @@ -331,6 +338,7 @@ Word16 getTcxonly_fx( return tcxonly; /*Q0*/ } +#endif /* FIX_2385_GETTCXONLY */ /*-------------------------------------------------------------------* * getCtxHm() diff --git a/lib_com/options.h b/lib_com/options.h index 6f0d8e55eecabd7851829ca66e771ef0e0d4ba91..3054af029d7262f967f4a3b6ba8673c7644b47a0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -92,6 +92,7 @@ #define HARM_FD_BWE /* VA: harmonize core-coder FD BWE function duplications */ #define FIX_2411_Harmonize_TNSANALYSIS_DETECTTNSFILT /* FhG: basop issue 2411: harmonize TNSAnalysis*_fx(), DetectTnsFilt*_fx()*/ #define HARMONIZE_READ_DECODE_TNS /* FhG basop 2389: Harm between two pairs of functions. */ +#define FIX_2385_GETTCXONLY /* FhG: issue 2385 : harmonizing getTcxonly_ivas_fx() and getTcxonly_ivas_fx() functions */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 49e042e2db19e255f9c8204595d6a34082816bba..fbc6533da0bcee8e53e0537acfd36e02d70a9d4c 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -3802,10 +3802,12 @@ Word16 get_cng_mode( Word16 get_codec_mode( const Word32 total_brate /* i : total bitrate */ ); +#ifndef FIX_2385_GETTCXONLY Word16 getTcxonly( const Word32 total_brate /* i : total bitrate */ ); +#endif Word16 getTcxonly_fx( const Word16 element_mode, /* i : IVAS element mode */ @@ -10266,6 +10268,7 @@ void configureFdCngEnc_ivas_fx( const Word16 bwidth, /* Q0 */ const Word32 total_brate /* Q0 */ ); +#ifndef FIX_2385_GETTCXONLY Word16 getTcxonly_ivas_fx( const Word16 element_mode, /* i : IVAS element mode */ @@ -10273,6 +10276,7 @@ Word16 getTcxonly_ivas_fx( const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ const Word16 is_ism_format /* i : flag indicating ISM format */ ); +#endif void SetModeIndex_ivas_fx( Encoder_State *st, /* i : Encoder state */ diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index a75acb7e198934463e7992d686ba1727a82e4c44..c8ff02d0af1f2b773edb1120e0a3bd4704abf64c 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -32,6 +32,12 @@ void open_decoder_LPD_fx( TCX_LTP_DEC_HANDLE hTcxLtpDec; HQ_DEC_HANDLE hHQ_core; TCX_DEC_HANDLE hTcxDec; +#ifdef FIX_2385_GETTCXONLY + Word16 MCT_flag; + + MCT_flag = 0; /* TODO: workaround for future harmonization of functions */ + move16(); +#endif hBPF = st->hBPF; hBWE_TD = st->hBWE_TD; @@ -67,10 +73,15 @@ void open_decoder_LPD_fx( st->L_frameTCX_past = hTcxDec->L_frameTCX; move16(); } + +#ifdef FIX_2385_GETTCXONLY + st->tcxonly = getTcxonly_fx( st->element_mode, total_brate, MCT_flag, st->is_ism_format ); +#else st->tcxonly = getTcxonly( st->total_brate /*, st->is_ism_format Needed in the last version of float IVAS */ ); +#endif move16(); /* the TD TCX PLC in MODE1 still runs with 80ms subframes */ diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index 0fa4c43f34a472eba36ba7ac35e99ef6c7c13034..97be28a27de5989804772fadb3d9a1771f017f44 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -245,7 +245,11 @@ ivas_error evs_dec_fx( test(); test(); test(); +#ifdef FIX_2385_GETTCXONLY + IF( st_fx->use_partial_copy && ( ( sub( st_fx->last_core, HQ_CORE ) == 0 ) || ( sub( st_fx->last_core, TCX_10_CORE ) == 0 ) || ( ( sub( st_fx->last_core, TCX_20_CORE ) == 0 ) && getTcxonly_fx( EVS_MONO, st_fx->last_total_brate, 0, 0 ) ) ) ) +#else IF( st_fx->use_partial_copy && ( ( sub( st_fx->last_core, HQ_CORE ) == 0 ) || ( sub( st_fx->last_core, TCX_10_CORE ) == 0 ) || ( ( sub( st_fx->last_core, TCX_20_CORE ) == 0 ) && getTcxonly( /*EVS_MONO, */ st_fx->last_total_brate /*, 0, 0*/ ) ) ) ) +#endif { st_fx->bfi = 1; move16(); diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 23dcd45b1e045f3c67b71541339f573956bfbf6e..85c945f9c7ba01aceb1801c1f7c83d590363d792 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -49,8 +49,12 @@ void init_coder_ace_plus_fx( TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; /* Bitrate */ +#ifdef FIX_2385_GETTCXONLY + st->tcxonly = (Word8) getTcxonly_fx( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format ); +#else st->tcxonly = (Word8) getTcxonly( st->total_brate ); +#endif move16(); /* Core Sampling Rate */ @@ -937,7 +941,11 @@ void init_coder_ace_plus_ivas_fx( Word16 L_subfr; /* Bitrate */ +#ifdef FIX_2385_GETTCXONLY + st->tcxonly = getTcxonly_fx( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format ); +#else st->tcxonly = getTcxonly_ivas_fx( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format ); +#endif /* FIX_2385_GETTCXONLY */ move16(); /* Core Sampling Rate */ diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index b94c1a0e31bd5e4a836d45ed36170603598cd895..f1ae291ef09f13ebda723db7681117e1cef48688 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -49,7 +49,11 @@ void core_coder_mode_switch_fx( switchWB = 1; /*force init when coming from MODE1*/ } +#ifdef FIX_2385_GETTCXONLY + tcxonly_tmp = getTcxonly_fx( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format ); +#else tcxonly_tmp = getTcxonly( st->total_brate ); +#endif if ( NE_16( tcxonly_tmp, st->tcxonly ) ) { @@ -67,7 +71,11 @@ void core_coder_mode_switch_fx( move32(); st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); assert( st->L_frame == st->sr_core / 50 ); +#ifdef FIX_2385_GETTCXONLY + st->tcxonly = (Word8) getTcxonly_fx( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format ); +#else st->tcxonly = (Word8) getTcxonly( st->total_brate ); +#endif /* st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale ) * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ; */ /* st->bits_frame_nominal = extract_l(L_shr(Mpy_32_16_1( L_shl(st->bitrate,8), mult_r(div_s(st->fscale, shl(st->L_frame,4)), FL2WORD16(FSCALE_DENOM/12800.f))), 6)); */ tmp32 = L_shl( st->total_brate, 1 ); /* (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate */ diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index be1caae8320de6582080ec6b5cebfd1181d5ba63..493b21a50df0724e6bf216f9379f8c310ff7de45 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -816,7 +816,11 @@ ivas_error ivas_cpe_enc_fx( { Word32 internal_Fs; +#ifdef FIX_2385_GETTCXONLY + IF( getTcxonly_fx( IVAS_CPE_MDCT, imult1616( sts[0]->bits_frame_nominal, FRAMES_PER_SEC ), 0, sts[0]->is_ism_format ) == 0 ) +#else IF( getTcxonly_ivas_fx( IVAS_CPE_MDCT, imult1616( sts[0]->bits_frame_nominal, FRAMES_PER_SEC ), 0, sts[0]->is_ism_format ) == 0 ) +#endif /* FIX_2385_GETTCXONLY */ { internal_Fs = INT_FS_16k; move32();