From 51e39130bb2fbda03cc3e8d145e17f7f028698b6 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 30 Apr 2025 11:56:09 +0530 Subject: [PATCH 1/2] Fix for 3GPP issue 1415: Cleanup of pre-processor macros Link #1415 --- lib_com/basop_util.c | 10 - lib_com/bitstream_fx.c | 2 - lib_com/cldfb_evs.c | 7 - lib_com/core_com_config.c | 55 +- lib_com/hq_conf_fx.c | 4 - lib_com/interleave_spectrum.c | 12 - lib_com/prot_fx.h | 81 +-- lib_com/swb_tbe_com_fx.c | 422 +----------- lib_com/tcx_mdct_window.c | 39 -- lib_com/tns_base.c | 20 - lib_dec/FEC_HQ_phase_ecu_fx.c | 525 --------------- lib_dec/TonalComponentDetection_fx.c | 9 - lib_dec/acelp_core_dec_fx.c | 5 - lib_dec/amr_wb_dec_fx.c | 5 - lib_dec/core_dec_init_fx.c | 116 ---- lib_dec/core_dec_switch_fx.c | 22 - lib_dec/dec_LPD_fx.c | 8 - lib_dec/dec_ace_fx.c | 7 - lib_dec/dec_acelp_tcx_main_fx.c | 4 - lib_dec/dec_tcx_fx.c | 3 - lib_dec/er_dec_tcx_fx.c | 114 ---- lib_dec/evs_dec_fx.c | 4 - lib_dec/fd_cng_dec_fx.c | 155 +---- lib_dec/gs_dec_amr_wb_fx.c | 43 -- lib_dec/hq_classifier_dec_fx.c | 10 - lib_dec/hq_core_dec_fx.c | 111 ---- lib_dec/hq_hr_dec_fx.c | 1 - lib_dec/ivas_output_config_fx.c | 10 - lib_dec/tns_base_dec_fx.c | 53 +- lib_dec/tonalMDCTconcealment_fx.c | 456 ------------- lib_dec/updt_dec_fx.c | 35 - lib_enc/cng_enc_fx.c | 5 - lib_enc/cod_tcx_fx.c | 628 ------------------ lib_enc/core_enc_init_fx.c | 7 - lib_enc/core_enc_switch_fx.c | 11 - lib_enc/core_enc_updt_fx.c | 14 - lib_enc/enc_pit_exc_fx.c | 5 - lib_enc/evs_enc_fx.c | 22 - lib_enc/ext_sig_ana_fx.c | 152 ----- lib_enc/hq_classifier_enc_fx.c | 195 +----- lib_enc/hq_core_enc_fx.c | 117 ---- lib_enc/hq_hr_enc_fx.c | 14 - lib_enc/init_enc_fx.c | 15 +- lib_enc/ivas_omasa_enc_fx.c | 5 - lib_enc/lib_enc.c | 36 +- lib_enc/mdct_classifier_fx.c | 78 +-- lib_enc/tcx_utils_enc_fx.c | 4 +- lib_enc/transient_detection_fx.c | 75 --- lib_enc/updt_enc_fx.c | 31 - .../ivas_dirac_dec_binaural_functions_fx.c | 14 - 50 files changed, 20 insertions(+), 3756 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index ec15e9769..dc9013a42 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -1409,15 +1409,6 @@ Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, Word32 y, Word16 *s ) *s = 0; return ( (Word32) 0 ); } - -#if 0 - sign = L_xor( x, y ); /* check (sign < 0) for result negation */ - - if ( x < 0 ) - { - x = L_negate( x ); - } -#else IF( EQ_32( y, 0x80000000 ) ) { /* Division by -1.0: same as negation of numerator */ @@ -1429,7 +1420,6 @@ Word32 BASOP_Util_Divide3232_Scale_newton( Word32 x, Word32 y, Word16 *s ) } sign = y; move32(); -#endif if ( y < 0 ) { y = L_negate( y ); diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 07a6a632f..4fcac20b6 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -52,7 +52,6 @@ int16_t FEC_seed = 12558; /* Seed for random FEC generator */ FILE *FEC_pattern = NULL; /* FEC pattern file (for simulation of FEC) */ -#ifndef IVAS_CODE float FEC_random = 0; /* FEC rate in percent (for simulation of FEC) */ /*-------------------------------------------------------------------* * file_read_FECpattern() @@ -109,7 +108,6 @@ static int16_t file_read_FECpattern( void ) return bfi; } #endif -#endif /*-------------------------------------------------------------------* * pack_bit() * diff --git a/lib_com/cldfb_evs.c b/lib_com/cldfb_evs.c index c28a534d6..51c9ee6f9 100644 --- a/lib_com/cldfb_evs.c +++ b/lib_com/cldfb_evs.c @@ -981,10 +981,6 @@ ivas_error openCldfb( const Word16 type, /*!< analysis or synthesis */ const Word16 maxCldfbBands, /*!< number of cldfb bands */ const Word16 frameSize /*!< FrameSize */ -#ifdef ADD_IVAS_CLDFB - , - CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */ -#endif ) { HANDLE_CLDFB_FILTER_BANK hs; @@ -996,9 +992,6 @@ ivas_error openCldfb( } hs->type = type; -#ifdef ADD_IVAS_CLDFB - hs->prototype = prototype; -#endif move16(); IF( type == CLDFB_ANALYSIS ) diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index f0ee8efd8..f75f28a18 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -246,67 +246,18 @@ Word16 getTcxonly_ivas_fx( } Word16 getTcxonly( -#ifdef IVAS_CODE_SWITCHING - const Word16 element_mode, /* i : IVAS element mode */ -#endif const Word32 total_brate /* i : total bitrate */ -#ifdef IVAS_CODE_SWITCHING - , - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ - const int16_t is_ism_format /* i : flag indicating ISM format */ -#endif ) { Word16 tcxonly; tcxonly = 0; move16(); -#ifdef IVAS_CODE_SWITCHING - SWITCH( element_mode ) + if ( GT_32( total_brate, 32000 ) ) { - case EVS_MONO: -#endif - if ( GT_32( total_brate, 32000 ) ) - { - tcxonly = 1; - move16(); - } -#ifdef IVAS_CODE_SWITCHING - break; - case IVAS_SCE: - if ( is_ism_format ) - { - if ( total_brate > MAX_ACELP_BRATE_ISM ) - { - tcxonly = 1; - } - } - else - { - if ( total_brate > MAX_ACELP_BRATE ) - { - tcxonly = 1; - } - } - break; - - case IVAS_CPE_DFT: - case IVAS_CPE_TD: - if ( total_brate > MAX_ACELP_BRATE ) - { - tcxonly = 1; - } - break; - case IVAS_CPE_MDCT: - if ( total_brate >= ( MCT_flag ? IVAS_32k : IVAS_48k ) ) - { - tcxonly = 1; - } - break; -#endif -#ifdef IVAS_CODE_SWITCHING + tcxonly = 1; + move16(); } -#endif return tcxonly; /*Q0*/ } diff --git a/lib_com/hq_conf_fx.c b/lib_com/hq_conf_fx.c index 503975363..f6a01adfc 100644 --- a/lib_com/hq_conf_fx.c +++ b/lib_com/hq_conf_fx.c @@ -303,11 +303,7 @@ void hq_configure_evs_fx( *start_norm = 0; move16(); -#ifndef SOLVED_COMP_ENC_DEC IF( EQ_16( length, L_FRAME48k ) ) /*tbv SOLVED_COMP_ENC_DEC*/ -#else - IF( EQ_16( length, L_SPEC48k ) ) -#endif { IF( EQ_16( hqswb_clas, HQ_GEN_FB ) ) { diff --git a/lib_com/interleave_spectrum.c b/lib_com/interleave_spectrum.c index 5c4c98e29..e8bb728ff 100644 --- a/lib_com/interleave_spectrum.c +++ b/lib_com/interleave_spectrum.c @@ -63,11 +63,7 @@ void interleave_spectrum_fx( /* Common inits */ p1 = coefs; /*Q12*/ p_out = coefs_out; -#ifdef SOLVED_COMP_ENC_DEC - IF( EQ_16( length, L_SPEC48k ) ) -#else IF( EQ_16( length, L_FRAME48k ) ) -#endif { bw = intl_bw_48; /*Q0*/ cnt = intl_cnt_48; /*Q0*/ @@ -337,20 +333,12 @@ void de_interleave_spectrum_fx( p1 = coefs_out; l_frame = length; move16(); -#ifdef SOLVED_COMP_ENC_DEC - IF( EQ_16( length, L_SPEC48k ) ) -#else IF( EQ_16( length, L_FRAME48k ) ) -#endif { bw = intl_bw_48; /*Q0*/ cnt = intl_cnt_48; /*Q0*/ grps = N_INTL_GRP_48; move16(); -#ifdef SOLVED_COMP_ENC_DEC - l_frame = L_FRAME48k; - move16(); -#endif p2 = coefs_out + sublen[2]; /* 240, length/4 */ p3 = coefs_out + sublen[4]; /* 480, 2*length/4 */ p4 = coefs_out + sublen[5]; /* 720, 3*length/4 */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 86b5ec0b7..fde3949fd 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -3062,20 +3062,6 @@ void GenShapedSHBExcitation_fx( Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */ const Word32 bitrate, const Word16 prev_bfi -#ifdef ADD_IVAS_TBE_CODE - , /* i : previous frame was concealed */ - const Word16 element_mode, /* i : element mode */ - const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ - Word16 *nlExc16k, /* i/o: NL exc for IC-BWE */ - Word16 *mixExc16k, /* i/o: exc spreading for IC-BWE */ - const Word32 extl_brate, /* i : extension layer bitarte */ - const Word16 MSFlag, /* i : Multi Source flag */ - Word16 EnvSHBres_4k[], /* i/o: TD envelope of the SHB residual signal */ - Word16 *prev_pow_exc16kWhtnd, /* i/o: power of the LB excitation signal in the previous frame */ - Word16 *prev_mix_factor, /* i/o: mixing factor in the previous frame */ - Word16 *Env_error, /* o : error in SHB residual envelope modelling*/ - Word16 Env_error_part[] /* o : per-segment error in SHB residual envelope modelling */ -#endif ); void GenShapedSHBExcitation_ivas_enc_fx( @@ -3152,7 +3138,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */ const Word32 bitrate, const Word16 prev_bfi -#if 1 // def ADD_IVAS_TBE_CODE , /* i : previous frame was concealed */ const Word16 element_mode, /* i : element mode */ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ @@ -3165,7 +3150,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( Word16 *prev_mix_factor, /* i/o: mixing factor in the previous frame */ Word16 *Env_error, /* o : error in SHB residual envelope modelling*/ Word16 Env_error_part[] /* o : per-segment error in SHB residual envelope modelling */ -#endif ); void GenSHBSynth_fx( @@ -3309,9 +3293,6 @@ void synthesise_fb_high_band_fx( #ifndef REMOVE_EVS_DUPLICATES void prep_tbe_exc_fx( const Word16 L_frame_fx, /* i : length of the frame */ -#ifdef ADD_IVAS_TBE_CODE - const Word16 L_subfr, -#endif const Word16 i_subfr_fx, /* i : subframe index */ const Word16 gain_pit_fx, /* i : Pitch gain Q14*/ const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/ @@ -3326,21 +3307,12 @@ void prep_tbe_exc_fx( Word16 T0_frac, /* i : Fractional pitch variables Q0*/ const Word16 coder_type, /* i : coding type */ Word32 core_brate /* i :core bitrate */ -#ifdef ADD_IVAS_TBE_CODE - , - const Word16 element_mode, /* i : element mode */ - const Word16 idchan, /* i : channel ID */ - const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ - const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ -#endif ); #endif void prep_tbe_exc_ivas_fx( const Word16 L_frame_fx, /* i : length of the frame */ -#if 1 // def ADD_IVAS_TBE_CODE const Word16 L_subfr, -#endif const Word16 i_subfr_fx, /* i : subframe index */ const Word16 gain_pit_fx, /* i : Pitch gain Q14*/ const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/ @@ -3355,13 +3327,11 @@ void prep_tbe_exc_ivas_fx( Word16 T0_frac, /* i : Fractional pitch variables Q0*/ const Word16 coder_type, /* i : coding type */ Word32 core_brate -#if 1 // def ADD_IVAS_TBE_CODE , /* i : core bitrate */ const Word16 element_mode, /* i : element mode */ const Word16 idchan, /* i : channel ID */ const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ -#endif ); Word16 swb_formant_fac_fx( /* o : Formant filter strength [0,1] */ @@ -4180,15 +4150,7 @@ Word16 get_codec_mode( ); Word16 getTcxonly( -#ifdef IVAS_CODE_SWITCHING - const Word16 element_mode, /* i : IVAS element mode */ -#endif const Word32 total_brate /* i : total bitrate */ -#ifdef IVAS_CODE_SWITCHING - , - const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/ - const int16_t is_ism_format /* i : flag indicating ISM format */ -#endif ); Word16 getTcxonly_fx( @@ -6578,10 +6540,6 @@ void TonalMDCTConceal_SaveFreqSignal( const Word16 *scaleFactors, const Word16 *scaleFactors_exp, const Word16 gain_tcx_exp -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - , - const Word16 infoIGFStartLine -#endif ); void TonalMDCTConceal_SaveFreqSignal_ivas_fx( @@ -6650,9 +6608,6 @@ void TonalMDCTConceal_InsertNoise( Word16 *pSeed, /*IN/OUT*/ const Word16 tiltCompFactor, Word16 crossfadeGain, -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - const Word16concealment_noise[L_FRAME48k], -#endif const Word16 crossOverFreq ); void TonalMDCTConceal_SaveTimeSignal( @@ -7646,9 +7601,6 @@ void configureFdCngDec_fx( Word16 ApplyFdCng_fx( Word16 *timeDomainInput, /* i : pointer to time domain i */ Word16 Q, -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - Word16 *powerSpectrum, -#endif Word32 **cldfbBufferReal, /* i/o: real part of the CLDFB buffer */ Word32 **cldfbBufferImag, /* i/o: imaginary part of the CLDFB buffer */ Word16 *cldfbBufferScale, /* o : pointer to the scalefactor for real and imaginary part of the CLDFB buffer */ @@ -7672,9 +7624,6 @@ Word16 ApplyFdCng_ivas_fx( void perform_noise_estimation_dec_fx( const Word16 *timeDomainInput, /* i: pointer to time domain i */ const Word16 Q, -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - float *power_spectrum, -#endif HANDLE_FD_CNG_DEC hFdCngDec /* i/o: FD_CNG structure containing all buffers and variables */ ); @@ -8389,10 +8338,6 @@ void improv_amr_wb_gs_fx( const Word16 Last_ener_fx, /* i : Last energy (Q8) Q0*/ const Word16 rate_switching_reset, /* i : rate switching reset flag Q0*/ const Word16 last_coder_type /* i : Last coder_type Q0*/ -#ifdef ADD_IVAS_GS_DEC_IMPR - , - const Word16 VeryLowRateSTflag /* i : Enable the noise enhancement for very low rate stereo generic mode */ -#endif ); // dec_amr_wb_fx.c @@ -8444,18 +8389,7 @@ ivas_error ppp_quarter_decoder_fx( void open_decoder_LPD_fx( Decoder_State *st, const Word32 total_brate, /* Q0 */ -#ifdef NEW_IVAS_OPEN_DEC - const Word32 last_total_brate, -#endif const Word16 bwidth /* Q0 */ -#ifdef NEW_IVAS_OPEN_DEC - , - const Word16 is_mct, /* i : MCT mode flag */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - const Word16 last_element_mode, -#endif - const Word16 is_init /* i : indicate call from init_decoder() to avoid double TC initialization */ -#endif ); void open_decoder_LPD_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ @@ -9010,28 +8944,19 @@ void tcx_hm_modify_envelope( ); // tns_base_dec_fx.c -#ifdef IVAS_CODE -void -#else Word16 -#endif ReadTnsData( STnsConfig const *pTnsConfig, Decoder_State *st, Word16 *pnBits, Word16 *stream, Word16 *pnSize ); -#define IVAS_CODE -#ifdef IVAS_CODE + void -#else -Word16 -#endif ReadTnsData_ivas_fx( STnsConfig const *pTnsConfig, Decoder_State *st, Word16 *pnBits, Word16 *stream, Word16 *pnSize ); -#undef IVAS_CODE Word16 DecodeTnsData( STnsConfig const *pTnsConfig, Word16 const *stream, @@ -9454,10 +9379,6 @@ void con_tcx_fx( const Word16 coh, /* i : coherence of stereo signal */ Word16 *noise_seed, /* i/o: noise seed for stereo */ const Word16 only_left /* i : TD-PLC only in left channel */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - , - const float *A_cng /* i : CNG LP filter coefficients */ -#endif #endif ); diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 5631dfa94..d1883efde 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -2103,20 +2103,6 @@ void GenShapedSHBExcitation_fx( Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */ const Word32 bitrate, const Word16 prev_bfi -#ifdef ADD_IVAS_TBE_CODE - , /* i : previous frame was concealed */ - const Word16 element_mode, /* i : element mode */ - const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ - Word16 *nlExc16k, /* i/o: NL exc for IC-BWE */ - Word16 *mixExc16k, /* i/o: exc spreading for IC-BWE */ - const Word32 extl_brate, /* i : extension layer bitarte */ - const Word16 MSFlag, /* i : Multi Source flag */ - Word16 EnvSHBres_4k[], /* i/o: TD envelope of the SHB residual signal */ - Word16 *prev_pow_exc16kWhtnd, /* i/o: power of the LB excitation signal in the previous frame */ - Word16 *prev_mix_factor, /* i/o: mixing factor in the previous frame */ - Word16 *Env_error, /* o : error in SHB residual envelope modelling*/ - Word16 Env_error_part[] /* o : per-segment error in SHB residual envelope modelling */ -#endif ) { Word16 i, j, k; @@ -2160,20 +2146,6 @@ void GenShapedSHBExcitation_fx( Word16 Q_temp; Word16 prev_Q_bwe_exc_fb; -#ifdef ADD_IVAS_TBE_CODE - Word32 tempD; - Word16 alpha, step, mem_csfilt_left, mem_csfilt_right, excNoisyEnvLeft[L_FRAME16k], excNoisyEnvRight[L_FRAME16k]; - Word16 cbsize; - Word16 mix_factor, old_fact, new_fact, fact, old_scale, new_scale, step_scale; - Word16 c0, c1, c2, c3, c4, c5, g1, g2, g, den; - Word16 EnvWhiteExc16k[L_FRAME16k], EnvExc16kWhtnd[L_FRAME16k]; - Word16 EnvWhiteExc16k_4k[L_FRAME4k] = { 0 }, EnvExc16kWhtnd_4k[L_FRAME4k] = { 0 }; - Word16 flag_plosive; - Word16 delta; - Word16 c0_part[NUM_SHB_SUBGAINS], c1_part[NUM_SHB_SUBGAINS], c2_part[NUM_SHB_SUBGAINS], c3_part[NUM_SHB_SUBGAINS], c4_part[NUM_SHB_SUBGAINS], c5_part[NUM_SHB_SUBGAINS]; - - mix_factor = 0.0f; -#endif set16_fx( zero_mem, 0, LPC_SHB_ORDER ); set16_fx( wht_fil_mem, 0, LPC_WHTN_ORDER ); @@ -2205,12 +2177,7 @@ void GenShapedSHBExcitation_fx( /* i: exc16k in Q_bwe_exc */ /* o: exc16kWhtnd in Q_bwe_exc */ - -#ifdef ADD_IVAS_TBE_CODE - IF( GE_32( extl_brate, SWB_TBE_2k8 ) ) -#else IF( GE_32( bitrate, ACELP_24k40 ) ) -#endif { temp2 = 0; move16(); @@ -2244,11 +2211,7 @@ void GenShapedSHBExcitation_fx( Q_pow1 = shl( *Q_bwe_exc, 1 ); test(); -#ifdef ADD_IVAS_TBE_CODE - IF( EQ_16( flag_ACELP16k, 0 ) ) -#else IF( ( LE_32( bitrate, ACELP_13k20 ) ) && ( GE_32( bitrate, ACELP_7k20 ) ) ) -#endif { /* varEnvShape = mean_fx(voice_factors, 4); */ /* unroll the loop */ @@ -2294,11 +2257,7 @@ void GenShapedSHBExcitation_fx( test(); test(); test(); -#ifdef ADD_IVAS_TBE_CODE - IF( EQ_16( element_mode, EVS_MONO ) && *mem_csfilt == 0 && ( ( EQ_32( bitrate, ACELP_9k60 ) ) || ( EQ_32( bitrate, ACELP_16k40 ) ) || ( EQ_32( bitrate, ACELP_24k40 ) ) ) ) -#else IF( *mem_csfilt == 0 && ( ( EQ_32( bitrate, ACELP_9k60 ) ) || ( EQ_32( bitrate, ACELP_16k40 ) ) || ( EQ_32( bitrate, ACELP_24k40 ) ) ) ) -#endif { /* pre-init smoothing filter to avoid energy drop outs */ L_tmp = L_mult( excTmp2[0], 1638 ); @@ -2325,42 +2284,6 @@ void GenShapedSHBExcitation_fx( *mem_csfilt = Mult_32_16( L_tmp, varEnvShape ); move32(); } -#ifdef ADD_IVAS_TBE_CODE - if ( MSFlag > 0 ) - { - varEnvShape = 0.995f; - csfilt_num2[0] = 1.0f - varEnvShape; - csfilt_den2[1] = -varEnvShape; - } - - White_exc16k = exc16k; - - /* Track the low band envelope */ - if ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT ) - { - if ( extl_brate != SWB_TBE_1k10 && extl_brate != SWB_TBE_1k75 ) - { - mem_csfilt_left = 0.0f; - mem_csfilt_right = 0.0f; - for ( k = 0; k < L_FRAME16k; k++ ) - { - excNoisyEnvLeft[k] = mem_csfilt_left + csfilt_num2[0] * excTmp2[k]; - mem_csfilt_left = -csfilt_den2[1] * excNoisyEnvLeft[k]; - excNoisyEnvRight[L_FRAME16k - k - 1] = mem_csfilt_right + csfilt_num2[0] * excTmp2[L_FRAME16k - k - 1]; - mem_csfilt_right = -csfilt_den2[1] * excNoisyEnvRight[L_FRAME16k - k - 1]; - } - - alpha = 0.0f; - step = 1.0f / L_FRAME16k; - for ( k = 0; k < L_FRAME16k; k++ ) - { - excNoisyEnv[k] = alpha * excNoisyEnvLeft[k] + ( 1 - alpha ) * excNoisyEnvRight[k]; - alpha += step; - } - } - } - else -#endif { /* Track the low band envelope */ L_tmp = *mem_csfilt; @@ -2376,21 +2299,6 @@ void GenShapedSHBExcitation_fx( *mem_csfilt = L_tmp; move32(); } -#ifdef ADD_IVAS_TBE_CODE - if ( extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75 ) - { - /* generate gaussian (white) excitation */ - for ( k = 0; k < L_FRAME16k; k++ ) - { - White_exc16k[k] = (float) own_random( &bwe_seed[0] ); - } - - /* normalize the amplitude of the gaussian excitation to that of the LB exc. */ - pow22 = POW_EXC16k_WHTND; - v_multc( White_exc16k, (float) sqrt( pow1 / pow22 ), White_exc16k, L_FRAME16k ); - } - else -#endif { /* create a random excitation - Reuse exc16k memory */ White_exc16k = exc16k; @@ -2439,98 +2347,10 @@ void GenShapedSHBExcitation_fx( Q_pow22 = shl( sub( *Q_bwe_exc, NOISE_QADJ ), 1 ); } -#ifdef ADD_IVAS_TBE_CODE - flag_plosive = 0; - move16(); - test(); - test(); - test(); - IF(GE_32(extl_brate, SWB_TBE_2k8) || EQ_32(extl_brate, SWB_TBE_1k10) || EQ_32(extl_brate, SWB_TBE_1k75))) -#else IF( GE_32( bitrate, ACELP_24k40 ) ) -#endif { IF( EQ_16( *vf_ind, 20 ) ) /* encoder side */ { -#ifdef ADD_IVAS_TBE_CODE - if ( extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75 ) - { - /* calculate TD envelopes of exc16kWhtnd and White_exc16k */ - find_td_envelope( White_exc16k, L_FRAME16k, 20, NULL, EnvWhiteExc16k ); - find_td_envelope( exc16kWhtnd, L_FRAME16k, 20, NULL, EnvExc16kWhtnd ); - - for ( k = 0; k < L_FRAME4k; k++ ) - { - EnvWhiteExc16k_4k[k] = EnvWhiteExc16k[4 * k]; - EnvExc16kWhtnd_4k[k] = EnvExc16kWhtnd[4 * k]; - } - - /* calculate the optimal mix factor */ - c0 = c1 = c2 = c3 = c4 = c5 = 0.0f; - for ( i = 0; i < NUM_SHB_SUBGAINS; i++ ) - { - c0_part[i] = sum2_f( &EnvExc16kWhtnd_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS ); - c1_part[i] = -2.0f * dotp( &EnvSHBres_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], &EnvExc16kWhtnd_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS ); - c2_part[i] = sum2_f( &EnvWhiteExc16k_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS ); - c3_part[i] = -2.0f * dotp( &EnvSHBres_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], &EnvWhiteExc16k_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS ); - c4_part[i] = 2.0f * dotp( &EnvExc16kWhtnd_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], &EnvWhiteExc16k_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS ); - c5_part[i] = sum2_f( &EnvSHBres_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS ); - - c0 += c0_part[i]; - c1 += c1_part[i]; - c2 += c2_part[i]; - c3 += c3_part[i]; - c4 += c4_part[i]; - c5 += c5_part[i]; - } - - den = 4.0f * c0 * c2 - c4 * c4; - g1 = ( c3 * c4 - 2 * c1 * c2 ) / den; - g2 = ( c1 * c4 - 2 * c0 * c3 ) / den; - - *Env_error = 0.0f; - flag_plosive = 0; - for ( i = 0; i < NUM_SHB_SUBGAINS; i++ ) - { - Env_error_part[i] = c5_part[i] + g1 * g1 * c0_part[i] + g1 * c1_part[i] + g2 * g2 * c2_part[i] + g2 * c3_part[i] + g1 * g2 * c4_part[i]; - *Env_error += Env_error_part[i]; - - if ( Env_error_part[i] > THR_ENV_ERROR_PLOSIVE ) - { - /* envelope error is too high -> likely a plosive */ - flag_plosive = 1; - } - } - - if ( flag_plosive ) - { - /* plosive detected -> set the mixing factor to 0 */ - *vf_ind = 0; - mix_factor = 0.0f; - } - else - { - /* normalize gain */ - g = g2 / ( g1 + g2 ); - - /* quantization of the mixing factor */ - cbsize = 1 << NUM_BITS_SHB_VF; - delta = 1.0f / ( cbsize - 1 ); - if ( g > 1.0f ) - { - g = 1.0f; - } - else if ( g < delta ) - { - /* prevent low gains to be quantized to 0 as this is reserved for plosives */ - g = delta; - } - - *vf_ind = usquant( g, &mix_factor, 0.0f, 1.0f / ( cbsize - 1 ), cbsize ); - } - } - else -#endif { Estimate_mix_factors_fx( shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc, White_exc16k, ( *Q_bwe_exc - NOISE_QADJ ), pow1, Q_pow1, pow22, Q_pow22, voiceFacEst, vf_ind ); @@ -2547,21 +2367,6 @@ void GenShapedSHBExcitation_fx( } ELSE /* decoder side */ { -#ifdef ADD_IVAS_TBE_CODE - if ( extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75 ) - { - if ( *vf_ind == 0 ) - { - mix_factor = 0.0f; - flag_plosive = 1; - } - else - { - mix_factor = usdequant( *vf_ind, 0.0f, 1.0f / ( ( 1 << NUM_BITS_SHB_VF ) - 1 ) ); - } - } - else -#endif { /* *vf_ind is an integer scale by 0.125f*/ tmp = shl( *vf_ind, ( 15 - 3 ) ); @@ -2574,9 +2379,6 @@ void GenShapedSHBExcitation_fx( } } } -#ifdef ADD_IVAS_TBE_CODE - IF( NE_32( extl_brate, SWB_TBE_1k10 ) && NE_32( extl_brate, SWB_TBE_1k75 ) ) -#endif { voice_factors[0] = mult_r( voice_factors[0], tmp2 ); move16(); @@ -2590,14 +2392,6 @@ void GenShapedSHBExcitation_fx( move16(); } } -#ifdef ADD_IVAS_TBE_CODE - if ( element_mode >= IVAS_CPE_DFT && nlExc16k != NULL ) - { - /* save buffers for IC-BWE */ - mvr2r( exc16kWhtnd, nlExc16k, L_FRAME16k ); - v_multc( White_exc16k, (float) sqrt( pow1 / pow22 ), mixExc16k, L_FRAME16k ); - } -#endif tmp = sub( Q_temp, 3 ); FOR( k = 0; k < L_FRAME16k; k++ ) @@ -2611,47 +2405,8 @@ void GenShapedSHBExcitation_fx( deemph_fx( White_exc16k, PREEMPH_FAC, L_FRAME16k, tbe_demph ); /* i/o: White_exc16k (Q_bwe_exc-NOISE_QADJ) */ /* i: tbe_demph (Q_bwe_exc-NOISE_QADJ) */ -#ifdef ADD_IVAS_TBE_CODE - if ( extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75 ) - { - if ( !flag_plosive ) /* use only LB excitation in case of plosives */ - { - /* re-scale gaussian excitation at the beginning to gradually move from old energy to new energy */ - old_scale = (float) sqrt( *prev_pow_exc16kWhtnd / pow1 ); - new_scale = 1.0f; - step_scale = ( new_scale - old_scale ) / ( L_FRAME16k / 2 ); - scale = old_scale; - - /* interpolate between the old and the new value of the mixing factor */ - old_fact = *prev_mix_factor; - new_fact = mix_factor; - step = ( new_fact - old_fact ) / ( L_FRAME16k / 2 ); - fact = old_fact; - - /* mixing of LB and gaussian excitation in the first half of the frame */ - for ( k = 0; k < L_FRAME16k / 2; k++ ) - { - exc16kWhtnd[k] = (float) fact * ( White_exc16k[k] * scale ) + (float) ( 1 - fact ) * exc16kWhtnd[k]; - fact += step; - scale += step_scale; - } - - /* mixing of LB and gaussian excitation in the second half of the frame */ - for ( ; k < L_FRAME16k; k++ ) - { - exc16kWhtnd[k] = (float) new_fact * White_exc16k[k] + (float) ( 1 - new_fact ) * exc16kWhtnd[k]; - } - } - preemph( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph ); - } - else -#endif { -#ifdef ADD_IVAS_TBE_CODE - if ( coder_type == UNVOICED || MSFlag == 1 ) -#else IF( EQ_16( coder_type, UNVOICED ) ) -#endif { L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp ); scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ @@ -2753,11 +2508,7 @@ void GenShapedSHBExcitation_fx( } } -#ifdef ADD_IVAS_TBE_CODE - IF( LT_32( extl_brate, SWB_TBE_2k8 ) ) -#else IF( LT_32( bitrate, ACELP_24k40 ) ) -#endif { Syn_filt_s( 0, lpc_shb, LPC_SHB_ORDER, exc16kWhtnd, excSHB, L_FRAME16k, state_lpc_syn, 1 ); /* i: exc16kWhtnd in Q_bwe_exc */ @@ -2866,10 +2617,6 @@ void GenShapedSHBExcitation_fx( set16_fx( White_exc16k_FB, 0, L_FRAME16k ); } -#ifdef ADD_IVAS_TBE_CODE - *prev_pow_exc16kWhtnd = pow1; - *prev_mix_factor = mix_factor; -#endif return; } @@ -3288,7 +3035,6 @@ void GenShapedSHBExcitation_ivas_enc_fx( { IF( EQ_16( *vf_ind, 20 ) ) /* encoder side */ { -#ifndef ADD_IVAS_TBE_CODE // BELOW PART WILL NEED TO BE CONVERTED FOR ENCODER!! test(); IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) ) { @@ -3474,33 +3220,6 @@ void GenShapedSHBExcitation_ivas_enc_fx( } } ELSE -#else - UNUSED_PARAM( Env_error_part ); - UNUSED_PARAM( Env_error ); - UNUSED_PARAM( EnvSHBres_4k ); - UNUSED_PARAM( c5_part ); - UNUSED_PARAM( c1 ); - UNUSED_PARAM( den ); - UNUSED_PARAM( c3_part ); - UNUSED_PARAM( c0 ); - UNUSED_PARAM( delta ); - UNUSED_PARAM( c3 ); - UNUSED_PARAM( c2_part ); - UNUSED_PARAM( c1_part ); - UNUSED_PARAM( EnvWhiteExc16k ); - UNUSED_PARAM( g2 ); - UNUSED_PARAM( c5 ); - UNUSED_PARAM( c4_part ); - UNUSED_PARAM( EnvWhiteExc16k_4k ); - UNUSED_PARAM( c2 ); - UNUSED_PARAM( g ); - UNUSED_PARAM( cbsize ); - UNUSED_PARAM( g1 ); - UNUSED_PARAM( EnvExc16kWhtnd ); - UNUSED_PARAM( c0_part ); - UNUSED_PARAM( EnvExc16kWhtnd_4k ); - UNUSED_PARAM( c4 ); -#endif { Estimate_mix_factors_fx( shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc, White_exc16k, Q_White_exc16k, pow1, Q_pow1, pow22, Q_pow22, voiceFacEst, vf_ind ); @@ -4003,7 +3722,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( move16(); move32(); -#if 1 // def ADD_IVAS_TBE_CODE Word16 alpha, step, mem_csfilt_left, mem_csfilt_right, excNoisyEnvLeft[L_FRAME16k], excNoisyEnvRight[L_FRAME16k]; Word16 cbsize; Word16 mix_factor, old_fact, new_fact, fact, old_scale, new_scale, step_scale; @@ -4018,7 +3736,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( mix_factor = 0; /* Q15 */ move16(); -#endif + set16_fx( zero_mem, 0, LPC_SHB_ORDER ); set16_fx( wht_fil_mem, 0, LPC_WHTN_ORDER ); FOR( i = 0; i < L_FRAME32k; i = i + 2 ) @@ -4050,11 +3768,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( /* i: exc16k in Q_bwe_exc */ /* o: exc16kWhtnd in Q_bwe_exc */ -#if 1 // def ADD_IVAS_TBE_CODE IF( GE_32( extl_brate, SWB_TBE_2k8 ) ) -#else - IF( GE_32( bitrate, ACELP_24k40 ) ) -#endif { temp2 = 0; move16(); @@ -4089,11 +3803,8 @@ void GenShapedSHBExcitation_ivas_dec_fx( Q_pow1 = shl( *Q_bwe_exc, 1 ); test(); -#if 1 // ADD_IVAS_TBE_CODE + IF( flag_ACELP16k == 0 ) -#else - IF( ( LE_32( bitrate, ACELP_13k20 ) ) && ( GE_32( bitrate, ACELP_7k20 ) ) ) -#endif { /* varEnvShape = mean_fx(voice_factors, 4); */ /* unroll the loop */ @@ -4139,12 +3850,8 @@ void GenShapedSHBExcitation_ivas_dec_fx( test(); test(); test(); -#if 1 // def ADD_IVAS_TBE_CODE - test(); + IF( EQ_16( element_mode, EVS_MONO ) && *mem_csfilt == 0 && ( ( EQ_32( bitrate, ACELP_9k60 ) ) || ( EQ_32( bitrate, ACELP_16k40 ) ) || ( EQ_32( bitrate, ACELP_24k40 ) ) ) ) -#else - IF( *mem_csfilt == 0 && ( ( EQ_32( bitrate, ACELP_9k60 ) ) || ( EQ_32( bitrate, ACELP_16k40 ) ) || ( EQ_32( bitrate, ACELP_24k40 ) ) ) ) -#endif { /* pre-init smoothing filter to avoid energy drop outs */ L_tmp = L_mult( excTmp2[0], 1638 ); @@ -4171,7 +3878,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( *mem_csfilt = Mult_32_16( L_tmp, varEnvShape ); move32(); } -#if 1 // def ADD_IVAS_TBE_CODE + IF( MSFlag > 0 ) { // varEnvShape = 0.995f; @@ -4231,7 +3938,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( } } ELSE -#endif + { /* Track the low band envelope */ L_tmp = L_shl( *mem_csfilt, sub( Q_excTmp2, *Q_bwe_exc ) ); @@ -4257,7 +3964,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( *mem_csfilt = L_shr( L_tmp, sub( Q_excTmp2, *Q_bwe_exc ) ); move32(); } -#if 1 // def ADD_IVAS_TBE_CODE test(); IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) ) { @@ -4303,7 +4009,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( } } ELSE -#endif { /* create a random excitation - Reuse exc16k memory */ White_exc16k = exc16k; @@ -4352,20 +4057,15 @@ void GenShapedSHBExcitation_ivas_dec_fx( Q_White_exc16k = add( Q_White_exc16k, sub( Q_excTmp2, 10 ) ); } -#if 1 // def ADD_IVAS_TBE_CODE flag_plosive = 0; move16(); test(); test(); test(); IF( GE_32( extl_brate, SWB_TBE_2k8 ) || EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) ) -#else - IF( GE_32( bitrate, ACELP_24k40 ) ) -#endif { IF( EQ_16( *vf_ind, 20 ) ) /* encoder side */ { -#ifndef ADD_IVAS_TBE_CODE // BELOW PART WILL NEED TO BE CONVERTED FOR ENCODER!! test(); IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) ) { @@ -4544,33 +4244,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( } } ELSE -#else - UNUSED_PARAM( Env_error_part ); - UNUSED_PARAM( Env_error ); - UNUSED_PARAM( EnvSHBres_4k ); - UNUSED_PARAM( c5_part ); - UNUSED_PARAM( c1 ); - UNUSED_PARAM( den ); - UNUSED_PARAM( c3_part ); - UNUSED_PARAM( c0 ); - UNUSED_PARAM( delta ); - UNUSED_PARAM( c3 ); - UNUSED_PARAM( c2_part ); - UNUSED_PARAM( c1_part ); - UNUSED_PARAM( EnvWhiteExc16k ); - UNUSED_PARAM( g2 ); - UNUSED_PARAM( c5 ); - UNUSED_PARAM( c4_part ); - UNUSED_PARAM( EnvWhiteExc16k_4k ); - UNUSED_PARAM( c2 ); - UNUSED_PARAM( g ); - UNUSED_PARAM( cbsize ); - UNUSED_PARAM( g1 ); - UNUSED_PARAM( EnvExc16kWhtnd ); - UNUSED_PARAM( c0_part ); - UNUSED_PARAM( EnvExc16kWhtnd_4k ); - UNUSED_PARAM( c4 ); -#endif { Estimate_mix_factors_fx( shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc, White_exc16k, ( *Q_bwe_exc - NOISE_QADJ ), pow1, Q_pow1, pow22, Q_pow22, voiceFacEst, vf_ind ); @@ -4588,7 +4261,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( ELSE /* decoder side */ { test(); -#if 1 // def ADD_IVAS_TBE_CODE IF( EQ_32( extl_brate, SWB_TBE_1k10 ) || EQ_32( extl_brate, SWB_TBE_1k75 ) ) { IF( *vf_ind == 0 ) @@ -4606,7 +4278,6 @@ void GenShapedSHBExcitation_ivas_dec_fx( } } ELSE -#endif { /* *vf_ind is an integer scale by 0.125f*/ tmp = shl( *vf_ind, ( 15 - 3 ) ); @@ -4619,10 +4290,8 @@ void GenShapedSHBExcitation_ivas_dec_fx( } } } -#if 1 // def ADD_IVAS_TBE_CODE test(); IF( NE_32( extl_brate, SWB_TBE_1k10 ) && NE_32( extl_brate, SWB_TBE_1k75 ) ) -#endif { voice_factors[0] = mult_r( voice_factors[0], tmp2 ); move16(); @@ -4979,10 +4648,8 @@ void GenShapedSHBExcitation_ivas_dec_fx( set16_fx( White_exc16k_FB, 0, L_FRAME16k ); } -#if 1 // def ADD_IVAS_TBE_CODE *prev_pow_exc16kWhtnd = L_shr_sat( pow1, Q_pow1 ); // power goes above MAX_32 *prev_mix_factor = mix_factor; -#endif return; } @@ -7566,56 +7233,7 @@ void Estimate_mix_factors_fx( return; } -#ifdef ADD_IVAS_TBE_CODE -/*-------------------------------------------------------------------* - * tbe_celp_exc() * - * * - * Prepare adaptive part of TBE excitation * - *-------------------------------------------------------------------*/ - -void tbe_celp_exc( - const int16_t element_mode, /* i : element mode */ - const int16_t idchan, /* i : channel ID */ - float *bwe_exc, /* i/o: BWE excitation */ - const int16_t L_frame, /* i : frame length */ - const int16_t L_subfr, /* i : subframe length */ - const int16_t i_subfr, /* i : subframe index */ - const int16_t T0, /* i : integer pitch lag */ - const int16_t T0_frac, /* i : fraction of lag */ - float *error, /* i/o: error */ - const int16_t tdm_LRTD_flag /* i : LRTD stereo mode flag */ -) -{ - int16_t i, offset; - - if ( element_mode == IVAS_CPE_TD && idchan == 1 && !tdm_LRTD_flag ) - { - return; - } - - if ( L_frame == L_FRAME ) - { - offset = tbe_celp_exc_offset( T0, T0_frac ); - - for ( i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++ ) - { - bwe_exc[i + i_subfr * HIBND_ACB_L_FAC] = bwe_exc[i + i_subfr * HIBND_ACB_L_FAC - offset + (int16_t) *error]; - } - *error += (float) offset - (float) T0 * HIBND_ACB_L_FAC - 0.25f * HIBND_ACB_L_FAC * (float) T0_frac; - } - else - { - offset = T0 * 2 + (int16_t) ( (float) T0_frac * 0.5f + 4 + 0.5f ) - 4; - for ( i = 0; i < L_subfr * 2; i++ ) - { - bwe_exc[i + i_subfr * 2] = bwe_exc[i + i_subfr * 2 - offset + (int16_t) *error]; - } - *error += (float) offset - (float) T0 * 2 - 0.5f * (float) T0_frac; - } - return; -} -#endif /*======================================================================================*/ /* FUNCTION : prep_tbe_exc_fx() */ /*--------------------------------------------------------------------------------------*/ @@ -7647,9 +7265,6 @@ void tbe_celp_exc( #ifndef REMOVE_EVS_DUPLICATES void prep_tbe_exc_fx( const Word16 L_frame_fx, /* i : length of the frame */ -#ifdef ADD_IVAS_TBE_CODE - const Word16 L_subfr, -#endif const Word16 i_subfr_fx, /* i : subframe index */ const Word16 gain_pit_fx, /* i : Pitch gain Q14*/ const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/ @@ -7664,13 +7279,6 @@ void prep_tbe_exc_fx( Word16 T0_frac, /* i : Fractional pitch variables Q0*/ const Word16 coder_type, /* i : coding type */ Word32 core_brate -#ifdef ADD_IVAS_TBE_CODE - , /* i : core bitrate */ - const int16_t element_mode, /* i : element mode */ - const int16_t idchan, /* i : channel ID */ - const int16_t flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ - const int16_t tdm_LRTD_flag /* i : LRTD stereo mode flag */ -#endif ) { Word16 i; @@ -7685,10 +7293,8 @@ void prep_tbe_exc_fx( Word32 L_tmp, Ltemp1, Ltemp2; Word32 tempQ31; Word16 tempQ15; -#ifndef ADD_IVAS_TBE_CODE Word16 L_subfr = L_SUBFR; move16(); -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; move32(); @@ -7719,17 +7325,6 @@ void prep_tbe_exc_fx( *voice_factors_fx = s_min( s_max( *voice_factors_fx, 0 ), MAX_16 ); move16(); -#ifdef ADD_IVAS_TBE_CODE - IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( idchan, 1 ) && !tdm_LRTD_flag ) - { - IF( flag_TD_BWE && i_subfr == 0 ) - { - set16_fx( bwe_exc, 0, L_FRAME32k ); - } - return; - } - -#endif IF( EQ_16( L_frame_fx, L_FRAME ) ) { interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ @@ -7816,9 +7411,7 @@ void prep_tbe_exc_fx( #endif void prep_tbe_exc_ivas_fx( const Word16 L_frame_fx, /* i : length of the frame */ -#if 1 // def ADD_IVAS_TBE_CODE const Word16 L_subfr, -#endif const Word16 i_subfr_fx, /* i : subframe index */ const Word16 gain_pit_fx, /* i : Pitch gain Q14*/ const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/ @@ -7833,13 +7426,11 @@ void prep_tbe_exc_ivas_fx( Word16 T0_frac, /* i : Fractional pitch variables Q0*/ const Word16 coder_type, /* i : coding type */ Word32 core_brate -#if 1 // def ADD_IVAS_TBE_CODE , /* i : core bitrate */ const Word16 element_mode, /* i : element mode */ const Word16 idchan, /* i : channel ID */ const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ -#endif ) { Word16 i; @@ -7885,7 +7476,7 @@ void prep_tbe_exc_ivas_fx( *voice_factors_fx = s_min( s_max( *voice_factors_fx, 0 ), MAX_16 ); move16(); -#if 1 // def ADD_IVAS_TBE_CODE + test(); test(); IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( idchan, 1 ) && !tdm_LRTD_flag ) @@ -7898,7 +7489,6 @@ void prep_tbe_exc_ivas_fx( return; } -#endif IF( EQ_16( L_frame_fx, L_FRAME ) ) { interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr ); /* code: Q9, tmp_code: Q9 */ diff --git a/lib_com/tcx_mdct_window.c b/lib_com/tcx_mdct_window.c index 44ce806f7..0316ec582 100644 --- a/lib_com/tcx_mdct_window.c +++ b/lib_com/tcx_mdct_window.c @@ -123,9 +123,6 @@ void mdct_window_sine( Word16 n /* Q0 */ ) { -#ifdef IVAS_CODE - if ( element_mode == EVS_MONO ) -#endif { const PWord16 *table; table = getSineWindowTable( n ); @@ -138,42 +135,6 @@ void mdct_window_sine( } // PMT("getSineWindowTable needs to be updated for IVAS") } -#ifdef IVAS_CODE - else - { - const float *window_table = 0; - Word16 buf_in_size = 0; - switch ( window_type ) - { - case FULL_OVERLAP: - window_table = tcx_mdct_window_48; - buf_in_size = 420; - break; - case HALF_OVERLAP: - window_table = tcx_mdct_window_half_48; - buf_in_size = 180; - break; - case TRANSITION_OVERLAP: - case MIN_OVERLAP: - window_table = tcx_mdct_window_trans_48; - buf_in_size = 60; - break; - - default: - assert( 0 && "Unsupported window type" ); - break; - } - - if ( Fs == 48000 ) - { - mvr2r( window_table, window, n ); - } - else - { - lerp( window_table, window, n, buf_in_size ); - } - } -#endif } diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c index 101bc1df8..82de45023 100644 --- a/lib_com/tns_base.c +++ b/lib_com/tns_base.c @@ -96,10 +96,8 @@ void InitTnsConfiguration( Word32 nSampleRate; Word16 s1; Word16 s2; -#ifndef ADD_IVAS_TNS (void) ( element_mode ); (void) ( is_mct ); -#endif nSampleRate = bwMode2fs[bwidth]; move32(); startLineFilter = &pTnsConfig->iFilterBorders[1]; @@ -138,21 +136,6 @@ void InitTnsConfiguration( ELSE IF( GT_32( nSampleRate, INT_FS_16k ) ) { -#ifdef ADD_IVAS_TNS - if ( ( element_mode > IVAS_SCE ) && ( total_brate >= ( is_mct ? IVAS_32k : IVAS_48k ) ) ) - { - pTnsConfig->nMaxFilters = sizeof( tnsParameters32kHz_Stereo ) / sizeof( tnsParameters32kHz_Stereo[0] ); - if ( nSampleRate == 100 * frameLength ) /* sub-frame length is <= 10 ms */ - { - pTnsConfig->pTnsParameters = tnsParameters32kHz_grouped; - } - else - { - pTnsConfig->pTnsParameters = tnsParameters32kHz_Stereo; - } - } - else -#endif { move16(); @@ -212,9 +195,6 @@ void InitTnsConfiguration( move16(); pTnsConfig->iFilterBorders[0] = frameLength; } -#ifdef ADD_IVAS_TNS - pTnsConfig->allowTnsOnWhite = 0; -#endif return; /*TNS_NO_ERROR;*/ } diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index ef09c3de3..dedf9f859 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -65,25 +65,12 @@ static void windowing_ROM_optimized( const Word16 *, Word16 *, const Word16, con static void fft_spec2_fx( const Word16[], Word32[], const Word16 ); static void trans_ana_fx( const Word16 *, Word16 *, Word16 *, Word16 *, const Word16, const Word16, const Word16, const Word16, Word16 *, Word16 *, Word16 *, Word16 * ); static void peakfinder_fx( const Word16 *, const Word16, Word16 *, Word16 *, const Word16 -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const Word16 endpoints /* i : Flag to include endpoints in peak search */ -#endif ); static Word16 imax_fx( const Word16 *, const Word16 ); static void spec_ana_fx( const Word16 *prevsynth, Word16 *plocs, Word32 *plocsi, Word16 *num_plocs, Word16 *X_sav, const Word16 output_frame, const Word16 bwidth_fx, Word16 *Q -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const Word16 element_mode, - Word16 *noise_fac, - const Word16 pcorr -#endif ); static void subst_spec_fx( const Word16 *, const Word32 *, Word16 *, const Word16, Word16 *, const Word16 *, const Word16, const Word16 *, const Word16, Word16 *, const Word16 *, const Word16 *, Word16, const Word16 * ); static Word16 rand_phase_fx( const Word16 seed, Word16 *sin_F, Word16 *cos_F ); -#ifdef IVAS_FEC_ECU_TO_COMPLETE -static float imax2_jacobsen_mag( const float *y_re, const float *y_im ); -#endif /*------------------------------------------------------------------* * rand_phase() @@ -666,9 +653,6 @@ static void ivas_peakfinder_fx( move16(); } len0Minus2 = sub( len0, 2 ); -#ifdef IVAS_FEC_ECU_TO_COMPLETE - PMT( "\nlen0Minus2 = sub(len0, 2) is it still correct if IVAS_FEC_ECU_TO_COMPLETE is activated\n" ) -#endif FOR( i = 0; i < len0Minus2; i++ ) { @@ -912,10 +896,6 @@ static void peakfinder_fx( Word16 *plocs, /* o : the indices of the identified peaks in x0 Q0 */ Word16 *cInd, /* o : number of identified peaks Q0 */ const Word16 sel /* i : The amount above surrounding data for a peak to be identified */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const Word16 endpoints /* i : Flag to include endpoints in peak search */ -#endif ) { const Word16 *pX0; @@ -951,11 +931,6 @@ static void peakfinder_fx( pInd = indarr; pDx01 = dx0; pDx0 = pDx01 + 1; -#ifdef IVAS_FEC_ECU_TO_COMPLETE - len = 0; - move16(); - IF( endpoints ) -#endif { *pX++ = *pX0++; move16(); @@ -965,9 +940,6 @@ static void peakfinder_fx( move16(); } len0Minus2 = sub( len0, 2 ); -#ifdef IVAS_FEC_ECU_TO_COMPLETE - PMT( "\nlen0Minus2 = sub(len0, 2) is it still correct if IVAS_FEC_ECU_TO_COMPLETE is activated\n" ) -#endif FOR( i = 0; i < len0Minus2; i++ ) { @@ -981,9 +953,6 @@ static void peakfinder_fx( } pX0++; } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - IF( endpoints ) -#endif { *pInd = len0Minus1; move16(); @@ -994,13 +963,7 @@ static void peakfinder_fx( minimum_fx( x, len, &minMag ); pInd = indarr; -#ifdef IVAS_FEC_ECU_TO_COMPLETE - test(); - test(); - IF( GT_16( len, 2 ) || ( !endpoints && ( len > 0 ) ) ) -#else IF( GT_16( len, 2 ) ) -#endif { /* Set initial parameters for loop */ tempMag = minMag; @@ -1011,9 +974,6 @@ static void peakfinder_fx( move16(); threshold = add( leftMin, sel ); -#ifdef IVAS_FEC_ECU_TO_COMPLETE - IF( len > 0 ) -#endif { /* Deal with first point a little differently since tacked it on Calculate the sign of the derivative since we took the first point @@ -1060,20 +1020,6 @@ static void peakfinder_fx( } pX--; /* After decrement, pX points to either x[-1] or x[0]. */ } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - ELSE - { - PMTE() - ii = -1; /* First point is a peak */ - if ( len >= 2 ) - { - if ( x[1] >= x[0] ) - { - ii = 0; /* First point is a valley, skip it */ - } - } - } -#endif *cInd = 0; move16(); /*Loop through extrema which should be peaks and then valleys*/ @@ -1179,9 +1125,6 @@ static void peakfinder_fx( } ELSE /* This is a monotone function where an endpoint is the only peak */ { -#ifdef IVAS_FEC_ECU_TO_COMPLETE - IF( endpoints ) -#endif { xInd = 1; move16(); @@ -1206,13 +1149,6 @@ static void peakfinder_fx( move16(); } } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - ELSE - { /* Input constant or all zeros -- no peaks found */ - *cInd = 0; - move16(); - } -#endif } } @@ -1709,12 +1645,6 @@ static void spec_ana_fx( const Word16 output_frame, /* i : Frame length Q0 */ const Word16 bwidth_fx, /* i : Encoded bandwidth index Q0 */ Word16 *Q /* o : Q value of the fft spectrum */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const Word16 element_mode, /* i : IVAS element mode */ - Word16 *noise_fac, /* o : for few peaks zeroing valleys decision making */ - const Word16 pcorr -#endif ) { Word16 Lprot, LprotLog2Minus1, hamm_len2, Lprot2, Lprot2_1, m, n; @@ -1782,52 +1712,18 @@ static void spec_ana_fx( IF( EQ_16( output_frame, L_FRAME48k ) ) { /* Apply hamming-rect window */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - IF( EQ_16( element_mode, EVS_MONO ) ) -#endif { windowing( xfp, xfp, w_hamm_sana48k_2_fx, rectLength, hamm_len2 ); } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - ELSE - { - PMTE() - // window_corr = w_hamm[0]; - // window_corr_step = w_hamm[0] / hamm_len2; - // for (i = 0; i < hamm_len2; i++) - //{ - // xfp[i] = prevsynth[i] * (w_hamm[i] - window_corr); - // xfp[Lprot - i - 1] = prevsynth[Lprot - i - 1] * (w_hamm[i] - window_corr); - // window_corr -= window_corr_step; - // } - } -#endif /* Spectrum */ fft3_fx( xfp, xfp, Lprot ); } ELSE { -#ifdef IVAS_FEC_ECU_TO_COMPLETE - IF( EQ_16( element_mode, EVS_MONO ) ) -#endif { /* Apply hamming-rect window */ windowing_ROM_optimized( xfp, xfp, sinTblOffset, rectLength, hamm_len2 ); } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - ELSE - { - PMTE() - // window_corr = w_hamm[0]; - // window_corr_step = w_hamm[0] / hamm_len2; - // for (i = 0; i < hamm_len2; i++) - //{ - // xfp[i] = prevsynth[i] * (w_hamm[i] - window_corr); - // xfp[Lprot - i - 1] = prevsynth[Lprot - i - 1] * (w_hamm[i] - window_corr); - // window_corr -= window_corr_step; - // } - } -#endif /* Spectrum */ r_fft_fx_lc( pFftTbl, Lprot, Lprot2, LprotLog2Minus1, xfp, xfp, 1 ); } @@ -1880,35 +1776,13 @@ static void spec_ana_fx( /* Find maximum and minimum. */ maximum_fx( xfp, Lprot2_1, &Xmax ); minimum_fx( xfp, Lprot2_1, &Xmin ); -#ifdef IVAS_FEC_ECU_TO_COMPLETE - IF( EQ_16( element_mode, EVS_MONO ) ) -#endif { sel = mult_r( sub( Xmax, Xmin ), CMPLMNT_PFIND_SENS_FX ); } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - ELSE - { - sel = ( Xmax - Xmin ) * ( 1.0f - ST_PFIND_SENS ); - } -#endif peakfinder_fx( xfp, Lprot2_1, plocs, num_plocs, sel -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - endpoints -#endif ); -#ifdef IVAS_FEC_ECU_TO_COMPLETE - /* Currently not the pitch correlation but some LF correlation */ - if ( element_mode != EVS_MONO && *num_plocs > 50 && pcorr < 0.6f ) - { - *num_plocs = 0; - } - - IF( EQ_16( element_mode, EVS_MONO ) ) -#endif { /* Refine peaks */ @@ -1955,105 +1829,6 @@ static void spec_ana_fx( move32(); /* in Q16. Append the fractional part to the integral part. */ } } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - ELSE - { - Lprot2p1 = Lprot / 2 + 1; - - /* Refine peaks */ - pPlocsi = plocsi; - pPlocs = plocs; - n = *num_plocs; /* number of peaks to process */ - - /* Special case-- The very 1st peak if it is at 0 index position (DC) */ - /* With DELTA_CORR_F0_INT == 2 one needs to handle both *pPlocs==0 and *pPlocs==1 */ - if ( n > 0 && *pPlocs == 0 ) /* Very 1st peak position possible to have a peak at 0/DC index position. */ - { - *pPlocsi++ = *pPlocs + imax_pos( &xfp[*pPlocs] ); - pPlocs++; - n = n - 1; - } - - if ( n > 0 && *pPlocs == 1 ) /* Also 2nd peak position uses DC which makes jacobsen unsuitable. */ - { - *pPlocsi++ = *pPlocs - 1 + imax_pos( &xfp[*pPlocs - 1] ); - currPlocs = *pPlocs++; - n = n - 1; - } - - /* All remaining peaks except the very last two possible integer positions */ - currPlocs = *pPlocs++; - endPlocs = Lprot2p1 - DELTA_CORR_F0_INT; /* last *pPlocs position for Jacobsen */ - - /* precompute number of turns based on endpoint integer location and make into a proper for loop */ - if ( n > 0 ) - { - nJacob = n; - if ( sub( endPlocs, plocs[sub( *num_plocs, 1 )] ) <= 0 ) - { - nJacob = sub( nJacob, 1 ); - } - - for ( k = 0; k < nJacob; k++ ) - { - *pPlocsi++ = currPlocs + imax2_jacobsen_mag( &( X_sav[currPlocs - 1] ), &( X_sav[Lprot - 1 - currPlocs] ) ); - currPlocs = *pPlocs++; - } - n = n - nJacob; - } - - /* At this point there should at most two plocs left to process */ - /* the position before fs/2 and fs/2 both use the same magnitude points */ - if ( n > 0 ) - { - /* [ . . . . . . . ] Lprot/2+1 positions */ - /* | | | */ - /* 0 (Lprot/2-2) (Lprot/2) */ - - if ( currPlocs == ( Lprot2p1 - DELTA_CORR_F0_INT ) ) /* Also 2nd last peak position uses fs/2 which makes jacobsen less suitable. */ - { - *pPlocsi++ = currPlocs - 1 + imax_pos( &xfp[currPlocs - 1] ); - currPlocs = *pPlocs++; - n = n - 1; - } - - /* Here the only remaining point would be a fs/2 plocs */ - /* pXfp = xfp + sub(Lprot2,1); already set just a reminder where it - * whould point */ - if ( n > 0 ) /* fs/2 which makes special case . */ - { - *pPlocsi++ = currPlocs - 2 + imax_pos( &xfp[currPlocs - 2] ); - currPlocs = *pPlocs++; - n = n - 1; - } - } - - /* For few peaks decide noise floor attenuation */ - if ( *num_plocs < 3 && *num_plocs > 0 ) - { - sig = sum_f( xfp, Lprot2_1 ) + EPSILON; - - /*excluding peaks and neighboring bins*/ - for ( i = 0; i < *num_plocs; i++ ) - { - st_point = max( 0, plocs[i] - DELTA_CORR ); - end_point = min( Lprot2_1 - 1, plocs[i] + DELTA_CORR ); - set_f( &xfp[st_point], 0.0f, end_point - st_point + 1 ); - } - noise = sum_f( xfp, Lprot2_1 ) + EPSILON; - nsr = noise / sig; - - if ( nsr < 0.03f ) - { - *noise_fac = 0.5f; - } - else - { - *noise_fac = 1.0f; - } - } - } -#endif } /*-------------------------------------------------------------------* @@ -2474,12 +2249,6 @@ static void subst_spec_fx( const Word16 *beta, /* i : Magnitude modification factors for fade to average Q15 */ Word16 beta_mute, /* i : Factor for long-term mute Q15 */ const Word16 *Xavg /* i : Frequency group averages to fade to Q0 */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const Word16 element_mode, /* i : IVAS element mode */ - const Word16 ph_ecu_lookahead, /* i : Phase ECU lookahead */ - const Word16 noise_fac /* i : noise factor */ -#endif ) { Word16 Xph_short; @@ -2500,11 +2269,6 @@ static void subst_spec_fx( Word16 alpha_local; Word16 beta_local; Word16 expo; -#ifdef IVAS_FEC_ECU_TO_COMPLETE - Word16 one_peak_flag_mask; - Word16 alpha_local; - Word16 beta_local; -#endif Word16 mag_chg_local; /*for peak attenuation in burst */ Lprot = 512; @@ -2560,21 +2324,6 @@ static void subst_spec_fx( move32(); } } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - one_peak_flag_mask = 1; /* all ones mask -> keep */ - IF( NE_16( element_mode, EVS_MONO ) ) - { - if ( ( *num_plocs > 0 ) && sub( *num_plocs, 3 ) < 0 ) - { - one_peak_flag_mask = noise_fac; /* all zeroes mask -> zero */ - } - if ( *num_plocs == 0 ) - { - X[0] = 0; /* reset DC if there are no peaks */ - X[shr( Lprot, 1 )] = 0; /* also reset fs/2 if there are no peaks */ - } - } -#endif lprotBy2Minus1 = sub( shr( Lprot, 1 ), 1 ); i = 1; move16(); @@ -2635,21 +2384,10 @@ static void subst_spec_fx( move16(); im = *pImX; move16(); -#ifdef IVAS_FEC_ECU_TO_COMPLETE - IF( EQ_16( element_mode, EVS_MONO ) ) -#endif { tmp = sub( mult_r( re, cos_F ), mult_r( im, sin_F ) ); im = add( mult_r( re, sin_F ), mult_r( im, cos_F ) ); } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - ELSE - { - PMTE() - // tmp = one_peak_flag_mask * (X[i] * cos_F - X[im_ind] * sin_F); - // X[im_ind] = one_peak_flag_mask * (X[i] * sin_F + X[im_ind] * cos_F); - } -#endif IF( LT_16( alpha[k], 32766 ) ) { *seed = rand_phase_fx( *seed, &sin_F, &cos_F ); @@ -2766,21 +2504,10 @@ static void subst_spec_fx( move16(); im = *pImX; move16(); -#ifdef IVAS_FEC_ECU_TO_COMPLETE - IF( EQ_16( element_mode, EVS_MONO ) ) -#endif { tmp = sub_sat( mult_r( re, cos_F ), mult_r( im, sin_F ) ); im = add_sat( mult_r( re, sin_F ), mult_r( im, cos_F ) ); } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - ELSE - { - PMTE() - // tmp = one_peak_flag_mask * (X[i] * cos_F - X[im_ind] * sin_F); - // X[im_ind] = one_peak_flag_mask * (X[i] * sin_F + X[im_ind] * cos_F); - } -#endif IF( LT_16( alpha[k], 32766 ) ) { alpha_local = mag_chg_local; @@ -3032,97 +2759,7 @@ static void rec_wtda_fx( Word16 *p_ecu; Word16 g; Word16 tbl_delta; -#ifdef IVAS_FEC_ECU_TO_COMPLETE - float xsubst_[2 * L_FRAME48k]; - const float *w_hamm; - float *pX_start, *pX_end; - float tmp; - int16_t hamm_len2; - float *pNew; - const float *pOldW, *pNewW; - float xfwin[NS2SA( L_FRAME48k * FRAMES_PER_SEC, N_ZERO_MDCT_NS - ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 )]; - const float *pOld; - int16_t copy_len; - int16_t ola_len; - - copy_len = NS2SA( output_frame * FRAMES_PER_SEC, ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 ); /* prototype fill on each side of xsubst to fill MDCT Frame */ - ola_len = NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS - ( 2 * FRAME_SIZE_NS - L_PROT_NS ) / 2 ); /* remaining lengt of LA_ZEROS to overlap add decoded with xsubst */ - - if ( output_frame == L_FRAME48k ) - { - w_hamm = w_hamm_sana48k_2; - hamm_len2 = L_PROT_HAMM_LEN2_48k; - } - else if ( output_frame == L_FRAME32k ) - { - w_hamm = w_hamm_sana32k_2; - hamm_len2 = L_PROT_HAMM_LEN2_32k; - } - else - { - w_hamm = w_hamm_sana16k_2; - hamm_len2 = L_PROT_HAMM_LEN2_16k; - } - - if ( element_mode != EVS_MONO && *num_p > 0 && plocs[0] > 3 ) - { - /* Perform inverse windowing of hammrect */ - pX_start = X; - pX_end = X + Lprot - 1; - for ( i = 0; i < hamm_len2; i++ ) - { - tmp = 1.0f / *w_hamm; - *pX_start *= tmp; - *pX_end *= tmp; - pX_start++; - pX_end--; - w_hamm++; - } - } - - /* extract reconstructed frame with aldo window */ - timesh = NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ) - ( 2 * output_frame - Lprot ) / 2; - - set_f( xsubst_, 0.0f, 2 * output_frame - Lprot + timesh ); - mvr2r( X, xsubst_ + 2 * output_frame - Lprot + timesh, Lprot - timesh ); - - /* Copy and OLA look ahead zero part of MDCT window from decoded signal */ - if ( element_mode != EVS_MONO ) - { - mvr2r( old_dec, xsubst_ + NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ), copy_len ); /* also need to scale to Q0 ?? */ - pOld = old_dec + copy_len; - pNew = xsubst_ + copy_len + NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ); - sinq( EVS_PI / ( ola_len * 2 ), 0.0f, ola_len, xfwin ); - v_mult( xfwin, xfwin, xfwin, ola_len ); /* xfwin = sin^2 of 0..pi/4 */ - pOldW = xfwin + ola_len - 1; - pNewW = xfwin; - for ( i = 0; i < ola_len; i++ ) - { - *pNew = *pOld * *pOldW + *pNew * *pNewW; - pOld += 1; - pNew += 1; - pOldW -= 1; - pNewW += 1; - } - } - else - { - /* Smoothen onset of ECU frame */ - xf_len = (int16_t) ( (float) output_frame * N_ZERO_MDCT_NS / FRAME_SIZE_NS ) - ( output_frame - Lprot / 2 ); - p_ecu = xsubst_ + 2 * output_frame - Lprot + timesh; - tbl_delta = 64.f / xf_len; /* 64 samples = 1/4 cycle in sincos_t */ - for ( i = 0; i < xf_len; i++, p_ecu++ ) - { - g = sincos_t[( (int16_t) ( i * tbl_delta ) )]; - g *= g; - *p_ecu = g * ( *p_ecu ); - } - } - - /* Apply TDA and windowing to ECU frame */ - wtda( xsubst_ + output_frame, ecu_rec, NULL, ALDO_WINDOW, ALDO_WINDOW, output_frame ); -#else // PMTE() xsubst_ = rec_buf + output_frame; Lprot2 = shr( Lprot, 1 ); @@ -3175,7 +2812,6 @@ static void rec_wtda_fx( out_ptr = rec_buf + sub( shl( output_frame, 1 ), timesh ); wtda_fx( out_ptr, &Qin, ecu_rec, NULL, 0, ALDO_WINDOW, ALDO_WINDOW, /* window overlap of current frame (0: full, 2: none, or 3: half) */ output_frame ); -#endif return; } @@ -3240,13 +2876,6 @@ static void rec_frame_fx( Word32 *ecu_rec, /* o : Reconstructed frame in tda domain */ const Word16 output_frame, /* i : Frame length */ const Word16 Q -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const float *old_dec, /* i : end of last decoded for OLA before tda and itda */ - const int16_t element_mode, /* i : IVAS element mode */ - const int16_t *num_p, /* i : Number of peaks */ - const int16_t *plocs /* i : Peak locations */ -#endif ) { const Word16 *pFftTbl; @@ -4034,28 +3663,11 @@ static void fec_ecu_dft_fx( Word16 *Tf_abs, /*Qout */ Word16 *Nfft, Word16 *exp /*Qout = Qin+exp */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const int16_t element_mode /* i : IVAS element mode */ -#endif ) { Word32 L_tmp, Tmp, Tfr32[512], Tfi32[512], fac, *Pt1, *Pt2; Word16 i, tmp, tmp_short, N_LP, target[2 * L_FRAME48k], Tfr16[FEC_FFT_MAX_SIZE], *pt1, *pt2, *pt3; Word16 tmp_loop; -#ifdef IVAS_FEC_ECU_TO_COMPLETE - int16_t alignment_point; - - Lon20 = (int16_t) 160 / 20; - if ( element_mode == EVS_MONO ) - { - alignment_point = 2 * 160 - 3 * Lon20; - } - else - { - alignment_point = 2 * 160; - } -#endif tmp = sub( 296, N ); Copy( &prevsynth_LP[tmp], target, N ); @@ -4588,11 +4200,6 @@ static void fec_noise_filling_fx( const Word16 N, const Word16 HqVoicing, Word16 *gapsynth_fx /*Qsynth */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const int16_t element_mode, /* i : IVAS element mode */ - const float *old_out -#endif ) { @@ -4607,22 +4214,6 @@ static void fec_noise_filling_fx( Word32 L_tmp; const Word16 *sinq_tab; -#ifdef IVAS_FEC_ECU_TO_COMPLETE - - const float *p_mdct_ola; - int16_t alignment_point; - PMTE() - if ( element_mode == EVS_MONO ) - { - alignment_point = 2 * L - 3 * L / 20; - } - else - { - alignment_point = 2 * L; - } - mvr2r( prevsynth + alignment_point - N, noisevect, N ); -#endif - IF( EQ_16( L, L_FRAME32k ) ) { sinq_tab = sinq_32k; @@ -4693,18 +4284,6 @@ static void fec_noise_filling_fx( tmp_fx = div_s( 1, Rnd_N_noise ); /*Q15 */ tmp_fx = round_fx_sat( L_shl_sat( L_mult( tmp_fx, 25736 ), 2 ) ); /*Q15 */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - if ( element_mode == EVS_MONO ) - { - kk = 7 * L / 20; - p_mdct_ola = prevsynth + 37 * L / 20; - } - else - { - kk = NS2SA( L * FRAMES_PER_SEC, N_ZERO_MDCT_NS ); - p_mdct_ola = old_out + kk; - } -#endif sinq_fx( shr( tmp_fx, 1 ), shr( tmp_fx, 2 ), Rnd_N_noise, SS_fx ); @@ -4812,11 +4391,6 @@ static void fec_alg_fx( const Word16 decimatefactor, const Word16 HqVoicing, Word16 *gapsynth /*Qin */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const Word16 element_mode, /* i : IVAS element mode */ - const Word16 *old_out -#endif ) { Word16 Nfft; @@ -4829,19 +4403,11 @@ static void fec_alg_fx( Word16 n, Q; fec_ecu_dft_fx( prevsynth_LP, N, Tfr, Tfi, &sum_Tf_abs, Tf_abs, &Nfft, &exp -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - element_mode -#endif ); sinusoidal_synthesis_fx( Tfr, Tfi, Tf_abs, N, output_frame, decimatefactor, Nfft, sum_Tf_abs, synthesis, HqVoicing, exp ); fec_noise_filling_fx( prevsynth, synthesis, ni_seed_forfec, output_frame, i_mult2( N, decimatefactor ), HqVoicing, gapsynth -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - element_mode, old_out -#endif ); n = R1_48 - R2_48; @@ -5018,11 +4584,6 @@ static void hq_phase_ecu_fx( Word16 *beta_mute, /* o : Factor for long-term mute Q15 */ const Word16 bwidth_fx, /* i : Encoded bandwidth */ const Word16 output_frame /* i : frame length */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - const Word16 pcorr, - const Word16 element_mode /* i : IVAS element mode */ -#endif ) { Word16 lprot, offset; @@ -5030,22 +4591,6 @@ static void hq_phase_ecu_fx( Word16 seed; Word16 alpha[LGW_MAX], beta[LGW_MAX]; -#ifdef IVAS_FEC_ECU_TO_COMPLETE - const float *old_dec; - float noise_fac; - int16_t ph_ecu_lookahead; - - noise_fac = 1.0f; - - if ( element_mode == EVS_MONO ) - { - ph_ecu_lookahead = NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS ); - } - else - { - ph_ecu_lookahead = 0; - } -#endif IF( EQ_16( output_frame, L_FRAME48k ) ) { lprot = L_PROT48k; /* 1536 = (2*output_frame)*1024/1280 */ @@ -5074,29 +4619,17 @@ static void hq_phase_ecu_fx( { test(); // PMT("verify condition compared to float") -#ifdef IVAS_FEC_ECU_TO_COMPLETE - IF( !( prev_bfi != 0 && *last_fec != 0 ) && EQ_16( element_mode == EVS_MONO ) ) -#else if ( !( prev_bfi != 0 && *last_fec != 0 ) ) -#endif { *time_offs = 0; move16(); } -#ifdef IVAS_FEC_ECU_TO_COMPLETE - offset = add( sub( sub( shl( output_frame, 1 ), lprot ), *time_offs ), ph_ecu_lookahead ); -#else offset = sub( sub( shl( output_frame, 1 ), lprot ), *time_offs ); -#endif trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, *last_fec, alpha, beta, beta_mute, Xavg ); spec_ana_fx( prevsynth + offset, plocs, plocsi, num_p, X_sav, output_frame, bwidth_fx, Q_spec -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - element_mode, noise_fac, pcorr -#endif ); test(); @@ -5128,21 +4661,10 @@ static void hq_phase_ecu_fx( subst_spec_fx( plocs, plocsi, num_p, *time_offs, X, mag_chg, ph_dith, old_is_transient, output_frame, &seed, alpha, beta, *beta_mute, Xavg -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - element_mode, ph_ecu_lookahead, noise_fac -#endif ); /* reconstructed frame in tda domain */ -#ifdef IVAS_FEC_ECU_TO_COMPLETE - old_dec = prevsynth + 2 * output_frame - NS2SA( output_frame * FRAMES_PER_SEC, N_ZERO_MDCT_NS ); -#endif rec_frame_fx( X, ecu_rec, output_frame, *Q_spec -#ifdef IVAS_FEC_ECU_TO_COMPLETE - , - old_dec, element_mode, num_p, plocs -#endif ); *last_fec = 0; @@ -5297,22 +4819,6 @@ void hq_ecu_fx( Word16 decimatefactor; Word16 corr; /*Q15 */ Word16 prevsynth_LP[2 * L_FRAME8k]; -#ifdef IVAS_FEC_ECU_TO_COMPLETE - HQ_DEC_HANDLE hHQ_core; - const float *fec_alg_input; - int16_t evs_mode_selection; - int16_t ivas_mode_selection; - - hHQ_core = st->hHQ_core; - if ( st->element_mode == EVS_MONO ) - { - fec_alg_input = prevsynth + NS2SA( output_frame * FRAMES_PER_SEC, ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS ); - } - else - { - fec_alg_input = prevsynth - NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS ); - } -#endif /* init (values ar changed after) */ decimatefactor = 4; move16(); @@ -5323,11 +4829,7 @@ void hq_ecu_fx( IF( !( LT_16( output_frame, L_FRAME16k ) ) ) { -#ifdef IVAS_FEC_ECU_TO_COMPLETE - fec_ecu_pitch_fx( fec_alg_input, prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing ); -#else fec_ecu_pitch_fx( prevsynth + NS2SA_FX2( L_mult0( output_frame, 50 ), ACELP_LOOK_NS / 2 - PH_ECU_LOOKAHEAD_NS ), prevsynth_LP, output_frame, &N, &corr, &decimatefactor, ph_ecu_HqVoicing ); -#endif } ELSE { @@ -5350,32 +4852,6 @@ void hq_ecu_fx( test(); test(); test(); -#if defined IVAS_FEC_ECU_TO_COMPLETE - evs_mode_selection = ( st->total_brate >= 48000 && ( output_frame >= L_FRAME16k && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) && - ( ph_ecu_HqVoicing || ( ( ( hHQ_core->env_stab_plc > 0.5 ) && ( corr < 0.6 ) ) || ( hHQ_core->env_stab_plc < 0.5 && ( corr > 0.85 ) ) ) ) ) ) || - ( st->total_brate < 48000 && ( ( ph_ecu_HqVoicing || corr > 0.85 ) && !prev_bfi && ( !old_is_transient[0] || old_is_transient[1] ) ) ); - - ivas_mode_selection = ( N < PH_ECU_N_LIMIT ) || ( corr < PH_ECU_CORR_LIMIT ); - if ( ( ( st->element_mode == EVS_MONO ) && evs_mode_selection ) || - ( ( st->element_mode != EVS_MONO ) && evs_mode_selection && ivas_mode_selection ) ) - - { - fec_alg_fx( fec_alg_input, prevsynth_LP, ecu_rec, output_frame, N, decimatefactor, ph_ecu_HqVoicing, gapsynth, &hHQ_core->ni_seed_forfec, st->element_mode, st->hHQ_core->old_out ); - *last_fec = 1; - *ph_ecu_active = 0; - move16(); - *time_offs = output_frame; - move16(); - ; - } - else - { - hq_phase_ecu( prevsynth - NS2SA( output_frame * FRAMES_PER_SEC, PH_ECU_LOOKAHEAD_NS ), ecu_rec, time_offs, X_sav, num_p, plocs, plocsi, env_stab, last_fec, prev_bfi, old_is_transient, mag_chg_1st, Xavg, beta_mute, st->bwidth, output_frame, corr, st->element_mode ); - - *last_fec = 0; - *ph_ecu_active = 1; - } -#else IF( ( 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( st_fx->hHQ_core->env_stab_plc_fx, 0 ) ) && ( LT_16( corr, 19661 ) ) ) || ( !( NE_16( st_fx->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] ) ) ) ) @@ -5395,7 +4871,6 @@ void hq_ecu_fx( env_stab, last_fec, ph_ecu_active, prev_bfi, old_is_transient, mag_chg_1st, Xavg, beta_mute, st_fx->bwidth, output_frame ); } -#endif return; } diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index e820f1399..4b2cf0213 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -740,15 +740,6 @@ static void CorrectF0( Word16 tmp; -#ifdef IVAS_CODE - FOR( i = 0; i < MAX_PEAKS_FROM_PITCH - 1; i++ ) - { - diff[i] = 0; - sortedDiff[i] = 0; - move16)); - move16)); - } -#endif F0 = *pF0; /*Q10*/ test(); diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 0fbedff60..3570ce86d 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -1287,12 +1287,7 @@ ivas_error acelp_core_dec_fx( /*Noise estimate*/ IF( NE_16( st_fx->element_mode, IVAS_CPE_TD ) /* && !st->cng_ism_flag IVAS_CODE */ ) { -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - PMT( "Code for IVAS_CODE_CNG_FIX185_PLC_FADEOUT not done" ) - ApplyFdCng_fx( syn, st_fx->Q_syn, NULL, realBuffer, imagBuffer, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); -#else ApplyFdCng_fx( syn_fx, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st_fx, 0, ( EQ_16( st_fx->coder_type, AUDIO ) && st_fx->GSC_noisy_speech == 0 ) ); -#endif } /* CNA: Generate additional comfort noise to mask potential coding artefacts */ } diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index c1c1e6143..971af2b56 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -813,15 +813,10 @@ ivas_error amr_wb_dec_fx( st_fx->VAD = 0; move16(); } -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - PMT( "Fixed point not done here " ) - ApplyFdCng_fx( syn, NULL, NULL, NULL, st, 0, 0 ); -#else #ifdef REMOVE_EVS_DUPLICATES ApplyFdCng_ivas_fx( syn_fx, st_fx->Q_syn, NULL, 0, NULL, NULL, NULL, st_fx, 0, 0 ); #else ApplyFdCng_fx( syn_fx, st_fx->Q_syn, NULL, NULL, NULL, st_fx, 0, 0 ); -#endif #endif st_fx->hFdCngDec->hFdCngCom->frame_type_previous = st_fx->m_frame_type; move16(); diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 967a93bfb..86d8e805a 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -20,18 +20,7 @@ void open_decoder_LPD_fx( Decoder_State *st, const Word32 total_brate, /* Q0 */ -#ifdef NEW_IVAS_OPEN_DEC - const Word32 last_total_brate, -#endif const Word16 bwidth /* Q0 */ -#ifdef NEW_IVAS_OPEN_DEC - , - const Word16 is_mct, /* i : MCT mode flag */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - const Word16 last_element_mode, -#endif - const Word16 is_init /* i : indicate call from init_decoder() to avoid double TC initialization */ -#endif ) { Word16 i; @@ -50,10 +39,8 @@ void open_decoder_LPD_fx( hTcxLtpDec = st->hTcxLtpDec; hTcxDec = st->hTcxDec; -#ifndef NEW_IVAS_OPEN_DEC st->total_brate = total_brate; move32(); -#endif if ( NE_16( st->codec_mode, MODE1 ) ) /*already updated in MODE1*/ { @@ -70,40 +57,18 @@ void open_decoder_LPD_fx( /* initializing variables for frame lengths etc. right in the beginning */ st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); move16(); -#ifndef NEW_IVAS_OPEN_DEC hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); move16(); -#endif IF( st->ini_frame == 0 ) { st->last_L_frame = st->L_frame_past = st->L_frame; move16(); move16(); -#ifndef NEW_IVAS_OPEN_DEC st->L_frameTCX_past = hTcxDec->L_frameTCX; -#endif move16(); } -#ifdef NEW_IVAS_OPEN_DEC - IF( st->hTcxDec != NULL ) - { - hTcxDec->L_frameTCX = extract_l( Mult_32_16( st->output_Fs, 0x0290 ) ); - IF( st->ini_frame == 0 ) - { - st->L_frameTCX_past = st->hTcxDec->L_frameTCX; - move16(); - } - } -#endif st->tcxonly = getTcxonly( -#ifdef IVAS_CODE_SWITCHING - st->element_mode, -#endif st->total_brate -#ifdef IVAS_CODE_SWITCHING - , - is_mct -#endif /*, st->is_ism_format Needed in the last version of float IVAS */ ); move16(); @@ -155,9 +120,6 @@ void open_decoder_LPD_fx( // st->pit_res_max = initPitchLagParameters(12800, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max); // hTcxDec->pit_max_TCX = (int16_t)(st->pit_max * st->output_Fs / 12800); // hTcxDec->pit_min_TCX = (int16_t)(st->pit_min * st->output_Fs / 12800); -#if 0 - PMT("Fixed point to be verified here") -#endif i = mult_r( hTcxDec->L_frameTCX, getInvFrameLen( L_FRAME ) ); /* Q6 */ hTcxDec->pit_max_TCX = extract_l( L_shr( L_mult( st->pit_max, i ), 7 ) ); /* Q0 */ move16(); @@ -243,7 +205,6 @@ void open_decoder_LPD_fx( } /*TCX config*/ -#ifndef NEW_IVAS_OPEN_DEC st->hTcxCfg->preemph_fac = st->preemph_fac; move16(); st->hTcxCfg->tcx_mdct_window_length_old = st->hTcxCfg->tcx_mdct_window_length; @@ -304,34 +265,6 @@ void open_decoder_LPD_fx( } resetTecDec_Fx( st->hTECDec ); - -#else - if ( st->hIGFDec != NULL ) - { - PMT( "To be done" ) - // IF (!is_init || st->element_mode != IVAS_CPE_MDCT) - //{ - // init_tcx_cfg(st->hTcxCfg, total_brate, st->sr_core, st->output_Fs, st->L_frame, st->bwidth, st->hTcxDec->L_frameTCX, st->fscale, encoderLookahead, encoderLookaheadFB, st->preemph_fac, st->tcxonly, st->rf_flag, st->igf, st->hIGFDec->infoIGFStopFreq, st->element_mode, st->ini_frame, MCT_flag); - // } - // else - //{ - // st->hTcxCfg->tcx_curr_overlap_mode = st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; - // st->hTcxCfg->last_aldo = 1; - // } - } - /*Constraint for adaptive BPF, otherwise parameter estimation and post-processing not time aligned*/ - IF( st->tcxonly == 0 ) - { - assert( 0 == ( st->hTcxCfg->lfacNext > 0 ? st->hTcxCfg->lfacNext : 0 ) ); - } - // IF (st->tecDec_fx != NULL) - { - resetTecDec_Fx( &( st->tecDec_fx ) ); - } - -#endif - - /* Initialize decoder delay */ @@ -447,7 +380,6 @@ void open_decoder_LPD_fx( move16(); /*PLC*/ -#ifndef NEW_IVAS_OPEN_DEC IF( st->prev_bfi != 0 ) { PWord16 const *w; @@ -498,10 +430,6 @@ void open_decoder_LPD_fx( hTcxDec->Q_syn_Overl_TDAC = hHQ_core->Q_old_wtda_LB; move16(); } -#else - PMT( "acelp_plc_mdct_transition is missing" ) - // acelp_plc_mdct_transition(st); -#endif } test(); @@ -545,9 +473,6 @@ void open_decoder_LPD_fx( set16_fx( hTcxDec->syn_Overl_TDAC, 0, L_FRAME32k / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ /* Q_syn_Overl_TDAC */ set16_fx( hTcxDec->syn_Overl_TDACFB, 0, L_FRAME_MAX / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ /* Q_syn_Overl_TDACFB */ set16_fx( hTcxDec->syn_Overl, 0, L_FRAME32k / 2 ); /*HQ-CORE(bfi)->TCX don't need it*/ /* Q_syn_Overl */ -#if 0 - PMT("to be moved to reset_tcx_overl_buf") -#endif } IF( st->hTcxCfg != NULL ) { @@ -575,15 +500,6 @@ void open_decoder_LPD_fx( cldfb_reset_memory( st->cldfbAna ); cldfb_reset_memory( st->cldfbBPF ); cldfb_reset_memory( st->cldfbSyn ); -#ifndef NEW_IVAS_OPEN_DEC -#if 0 - PMT("cldfbSynHB is missing ") -#endif - // IF (st->cldfbSynHB != NULL) - //{ - // cldfb_reset_memory(st->cldfbSynHB); - // } -#endif } ELSE IF( ( NE_16( st->L_frame, st->last_L_frame ) ) && ( LE_16( st->L_frame, L_FRAME16k ) ) && ( LE_16( st->last_L_frame, L_FRAME16k ) ) ) /* Rate switching between 12.8 and 16 kHz*/ { @@ -817,10 +733,6 @@ void open_decoder_LPD_fx( test(); IF( EQ_16( st->core, ACELP_CORE ) && EQ_16( st->last_core, HQ_CORE ) ) { - /*_DIFF_FLOAT_FIX_*/ -#if 0 - PMT("floating point is using L_frameTCX instead of output_frame, is it ok?") -#endif frame_ener_fx( st->output_frame_fx, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); } } @@ -840,20 +752,6 @@ void open_decoder_LPD_fx( move16(); if ( st->hTcxDec != NULL ) { -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - /* Todo: should be considered for other stereo modes as well */ - IF( is_init || MCT_flag || !( st->element_mode == IVAS_CPE_MDCT && st->element_mode == last_element_mode ) ) - { - PMT( "Fixed point to be done" ) - st->hTcxDec->CngLevelBackgroundTrace_bfi = PLC_MIN_CNG_LEV; - st->hTcxDec->NoiseLevelIndex_bfi = PLC_MIN_STAT_BUFF_SIZE - 1; - st->hTcxDec->CurrLevelIndex_bfi = 0; - st->hTcxDec->LastFrameLevel_bfi = PLC_MIN_CNG_LEV; - set_f( st->hTcxDec->NoiseLevelMemory_bfi, PLC_MIN_CNG_LEV, PLC_MIN_STAT_BUFF_SIZE ); - - st->hTcxDec->cummulative_damping_tcx = 1.0f; - } -#else hTcxDec->conCngLevelBackgroundTrace = PLC_MIN_CNG_LEV_Q21; /*Q21*/ move16(); hTcxDec->conNoiseLevelIndex = PLC_MIN_STAT_BUFF_SIZE - 1; /* Q0 */ @@ -871,7 +769,6 @@ void open_decoder_LPD_fx( hTcxDec->cummulative_damping_tcx = 32767 /*1.0f Q15*/; move16(); -#endif } st->cummulative_damping = 32767 /*1.0f Q15*/; move16(); @@ -891,10 +788,8 @@ void open_decoder_LPD_fx( st->old_fpitch = L_deposit_h( st->pit_min ); move32(); -#ifndef NEW_IVAS_OPEN_DEC st->old_fpitchFB = L_deposit_h( hTcxDec->pit_min_TCX ); move32(); -#endif st->rate_switching_init = 1; move16(); @@ -924,9 +819,6 @@ void open_decoder_LPD_fx( test(); IF( hTcxLtpDec != NULL && ( EQ_16( st->ini_frame, 0 ) || ( EQ_16( st->last_codec_mode, MODE1 ) && st->element_mode == EVS_MONO ) ) ) { -#if 0 - PMT("TO be verify, update seems to differ from float") -#endif hTcxLtpDec->tcxltp_pitch_int = st->pit_max; /* Q0 */ move16(); hTcxLtpDec->tcxltp_pitch_fr = 0; /* Q0 */ @@ -1059,12 +951,6 @@ void open_decoder_LPD_fx( move16(); st->second_last_core = -1; move16(); -#ifdef NEW_IVAS_OPEN_DEC - IF( st->hTcxCfg != NULL && st->element_mode != EVS_MONO ) - { - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf ); - } -#endif IF( hTcxDec != NULL ) { hTcxDec->tcxltp_second_last_pitch = st->old_fpitch; /*15Q16*/ @@ -1105,10 +991,8 @@ void open_decoder_LPD_fx( hTcxDec->tcx_hm_LtpPitchLag = -1; move16(); } -#ifndef NEW_IVAS_OPEN_DEC st->hTcxCfg->na_scale = 32767 /*1.0f Q15*/; move16(); -#endif if ( hTcxLtpDec != NULL ) { hTcxLtpDec->tcxltp_gain = 0; /* Q15 */ diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index 63c35f876..8c68f39ce 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -13,18 +13,7 @@ void mode_switch_decoder_LPD_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 bwidth, /* i : audio bandwidth Q0*/ Word32 total_brate, /* i : total bitrate Q0*/ -#ifdef IVAS_CODE_SWITCHING - const Word32 last_total_brate, /* i : last frame total bitrate */ -#endif Word16 frame_size_index /* i : index determining the frame size Q0*/ -#ifdef IVAS_CODE_SWITCHING - , - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - , - const Word16 last_element_mode -#endif -#endif ) { Word16 fscale, switchWB; @@ -100,15 +89,7 @@ void mode_switch_decoder_LPD_fx( test(); IF( NE_16( fscale, st->fscale ) || ( switchWB != 0 ) || ( bSwitchFromAmrwbIO != 0 ) || EQ_16( st->last_codec_mode, MODE1 ) || st->force_lpd_reset ) { -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - open_decoder_LPD_fx( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0 ); -#else -#ifdef IVAS_CODE - open_decoder_LPD_fx( st, total_brate, last_total_brate, bwidth, is_mct, 0 ); -#else open_decoder_LPD_fx( st, total_brate, bwidth ); -#endif -#endif } ELSE { @@ -153,9 +134,6 @@ void mode_switch_decoder_LPD_fx( IF( ( st->hTcxCfg->fIsTNSAllowed != 0 ) && st->hIGFDec != NULL ) { 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*/ ); -#ifdef IVAS_CODE - SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT ); -#endif } } } diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index f53234ded..c04ee9dc5 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -574,11 +574,7 @@ void decoder_LPD_fx( IF( bfi != 0 && ( st->last_core != ACELP_CORE ) ) { /* PLC: [TCX: TD PLC] */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - con_tcx_fx( st, &synthFB[0], -1.f, NULL, 0, NULL ); -#else con_tcx_fx( st, &synthFB[0] ); -#endif lerp( synthFB, synth, st->L_frame, hTcxDec->L_frameTCX ); st->con_tcx = 1; move16(); @@ -778,11 +774,7 @@ void decoder_LPD_fx( { TonalMDCTConceal_SaveTimeSignal( st->hTonalMDCTConc, synthFB, L_frameTCX ); } -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - decoder_tcx_post_fx( st, synth, synthFB, Aq, bfi, 0 ); -#else decoder_tcx_post_fx( st, synth, synthFB, Aq, bfi ); -#endif IF( EQ_16( st->core, TCX_20_CORE ) ) { /* LPC Interpolation for BWE/post-processing */ diff --git a/lib_dec/dec_ace_fx.c b/lib_dec/dec_ace_fx.c index 16f749156..55d3ebbae 100644 --- a/lib_dec/dec_ace_fx.c +++ b/lib_dec/dec_ace_fx.c @@ -537,15 +537,8 @@ void decoder_acelp_fx( gain_preQ, code_preQ, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, 0 ); #else prep_tbe_exc_fx( st->L_frame, -#ifdef ADD_IVAS_TBE_CODE - L_SUBFR, -#endif i_subfr, gain_pit, gain_code, code, st->voice_fac, &voice_factors[idx], bwe_exc, gain_preQ, code_preQ, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate -#ifdef ADD_IVAS_TBE_CODE - , - st->element_mode, st->idchan, st->hBWE_TD != NULL, 0 -#endif ); #endif } diff --git a/lib_dec/dec_acelp_tcx_main_fx.c b/lib_dec/dec_acelp_tcx_main_fx.c index 04a41ed46..21bf7cf12 100644 --- a/lib_dec/dec_acelp_tcx_main_fx.c +++ b/lib_dec/dec_acelp_tcx_main_fx.c @@ -208,11 +208,7 @@ static void decode_frame_type_fx( Decoder_State *st ) move16(); /* Reconf Core */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - mode_switch_decoder_LPD_fx( st, st->bwidth, st->total_brate, st->last_total_brate, frame_size_index, 0, st->element_mode ); -#else mode_switch_decoder_LPD_fx( st, st->bwidth, st->total_brate, frame_size_index ); -#endif /* Reconf CLDFB */ IF( NE_16( i_mult( st->cldfbAna->no_channels, st->cldfbAna->no_col ), st->L_frame ) ) { diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index af80ee1f5..883024002 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -893,9 +893,6 @@ void decoder_tcx_fx( TonalMDCTConceal_InsertNoise( st->hTonalMDCTConc, x, &x_e, st->tonal_mdct_plc_active, &st->seed_tcx_plc, noiseTiltFactor, f, -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - concealment_noise, -#endif infoIGFStartLine ); } } diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index e804d2009..1a8a8b30d 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -126,10 +126,6 @@ void con_tcx_fx( const Word16 coh, /* i : coherence of stereo signal Q14*/ Word16 *noise_seed, /* i/o: noise seed for stereo Q0*/ const Word16 only_left /* i : TD-PLC only in left channel Q0*/ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - , - const float *A_cng /* i : CNG LP filter coefficients Q14*/ -#endif #endif ) @@ -489,19 +485,7 @@ void con_tcx_fx( move16(); /* PLC: calculate damping factor */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - alpha = 1.0f; - if ( st->element_mode == IVAS_CPE_MDCT && st->nbLostCmpt >= MDCT_ST_PLC_FADEOUT_START_FRAME ) - { - alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 ); - } - else if ( st->element_mode != IVAS_CPE_MDCT ) - { - alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 ); - } -#else alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &( st->Mode2_lp_gainp ), 0 ); /*Q14*/ -#endif IF( EQ_16( st->nbLostCmpt, 1 ) ) { st->cummulative_damping = 32767 /*1.f Q15*/; @@ -568,19 +552,7 @@ void con_tcx_fx( } set32_fx( pitch_buf, L_deposit_h( L_SUBFR ), st->nb_subfr ); /*Q16*/ /* PLC: calculate damping factor */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - alpha = 1.0f; - if ( st->element_mode == IVAS_CPE_MDCT && st->nbLostCmpt >= MDCT_ST_PLC_FADEOUT_START_FRAME ) - { - alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 ); - } - else if ( st->element_mode != IVAS_CPE_MDCT ) - { - alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 ); - } -#else alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &( st->Mode2_lp_gainp ), 0 ); /*Q14*/ -#endif } /*-----------------------------------------------------------------* @@ -707,20 +679,9 @@ void con_tcx_fx( } /* PLC: [TCX: Fade-out] retrieve background level */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - if ( A_cng != NULL ) - { - gainSynthDeemph = getLevelSynDeemph_fx( &( tmp ), A_cng, L_frame / 4, st->preemph_fac, 1 ) / 4.f; - } - else - { - gainSynthDeemph = getLevelSynDeemph_fx( &( tmp ), A_local, L_frame / 4, st->preemph_fac, 1 ); - } -#else tmp16 = 32767; move16(); gainSynthDeemph = getLevelSynDeemph_fx( &( tmp16 ), A_local, M, shr( L_frame, 2 ), st->preemph_fac, 1, &gainSynthDeemph_e ); /*Q5*/ -#endif IF( st->tcxonly != 0 ) { /* gainCNG = st->conCngLevelBackgroundTrace/gainSynthDeemph; */ @@ -728,19 +689,6 @@ void con_tcx_fx( hTcxDec->conCngLevelBackgroundTrace_e, gainSynthDeemph, gainSynthDeemph_e, &gainCNG, &gainCNG_e ); -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - if ( st->element_mode == IVAS_CPE_MDCT && A_cng != NULL ) - { - if ( st->nbLostCmpt > MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME + MDCT_ST_PLC_FADEOUT_TO_ZERO_LEN ) - { - gainCNG = 0.f; - } - else if ( st->nbLostCmpt > MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME ) - { - gainCNG *= 1.f - (float) ( st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME ) / MDCT_ST_PLC_FADEOUT_TO_ZERO_LEN; - } - } -#endif } ELSE { @@ -907,34 +855,6 @@ void con_tcx_fx( /*buf[OLD_EXC_SIZE_DEC;3/2 L_frame] Q1: exc*/ /*buf[0;M] Q0: mem_syn*/ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - if ( A_cng != NULL ) - { - float alpha_delayed; - - alpha_delayed = 1.0f; - if ( st->nbLostCmpt > MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE ) - { - alpha_delayed = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE, st->last_good, st->stab_fac, &( st->lp_gainp ), ACELP_CORE ); - } - - if ( st->plcBackgroundNoiseUpdated && alpha_delayed != 1.0f ) - { - float lsp_local[M], lsp_fade[M], alpha_inv; - - alpha_inv = 1.0f - alpha_delayed; - - a2lsp_stab( A_local, lsp_local, lsp_local ); - - for ( i = 0; i < M; i++ ) - { - lsp_fade[i] = alpha_delayed * lsp_local[i] + alpha_inv * st->lspold_cng[i]; - } - - lsp2a_stab( lsp_fade, A_local, M ); - } - } -#endif E_UTIL_synthesis( sub( Q_exc, Q_syn ), A_local, @@ -1434,19 +1354,7 @@ void con_tcx_ivas_fx( move16(); /* PLC: calculate damping factor */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - alpha = 1.0f; - if ( st->element_mode == IVAS_CPE_MDCT && st->nbLostCmpt >= MDCT_ST_PLC_FADEOUT_START_FRAME ) - { - alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 ); - } - else if ( st->element_mode != IVAS_CPE_MDCT ) - { - alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 ); - } -#else alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &( st->Mode2_lp_gainp ), 0 ); /*Q14*/ -#endif IF( EQ_16( st->nbLostCmpt, 1 ) ) { st->cummulative_damping = 32767 /*1.f Q15*/; @@ -1513,19 +1421,7 @@ void con_tcx_ivas_fx( } set32_fx( pitch_buf, L_deposit_h( L_SUBFR ), st->nb_subfr ); /*Q16*/ /* PLC: calculate damping factor */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - alpha = 1.0f; - if ( st->element_mode == IVAS_CPE_MDCT && st->nbLostCmpt >= MDCT_ST_PLC_FADEOUT_START_FRAME ) - { - alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt - MDCT_ST_PLC_FADEOUT_START_FRAME, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 ); - } - else if ( st->element_mode != IVAS_CPE_MDCT ) - { - alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac, &( st->lp_gainp ), 0 ); - } -#else alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &( st->Mode2_lp_gainp ), 0 ); /*Q14*/ -#endif } /*-----------------------------------------------------------------* @@ -1666,7 +1562,6 @@ void con_tcx_ivas_fx( } /* PLC: [TCX: Fade-out] retrieve background level */ -#ifndef IVAS_CODE_CNG_FIX185_PLC_FADEOUT tmp16 = 32767; move16(); IF( A_cng != NULL ) @@ -1677,11 +1572,6 @@ void con_tcx_ivas_fx( { gainSynthDeemph = getLevelSynDeemph_fx( &( tmp16 ), A_local, M, shr( L_frame, 2 ), st->preemph_fac, 1, &gainSynthDeemph_e ); /*Q13*/ } -#else - tmp16 = 32767; - move16(); - gainSynthDeemph = getLevelSynDeemph_fx( &( tmp16 ), A_local, M, shr( L_frame, 2 ), st->preemph_fac, 1, &gainSynthDeemph_e ); -#endif IF( st->tcxonly != 0 ) { /* gainCNG = st->conCngLevelBackgroundTrace/gainSynthDeemph; */ @@ -1689,7 +1579,6 @@ void con_tcx_ivas_fx( hTcxDec->conCngLevelBackgroundTrace_e, gainSynthDeemph, gainSynthDeemph_e, &gainCNG, &gainCNG_e ); -#ifndef IVAS_CODE_CNG_FIX185_PLC_FADEOUT test(); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && A_cng != NULL ) { @@ -1705,7 +1594,6 @@ void con_tcx_ivas_fx( gainCNG = extract_l( Mpy_32_32( gainCNG, L_tmp ) ); /*Q15-gainCNG_e*/ } } -#endif } ELSE { @@ -1882,7 +1770,6 @@ void con_tcx_ivas_fx( /*buf[OLD_EXC_SIZE_DEC;3/2 L_frame] Q1: exc*/ /*buf[0;M] Q0: mem_syn*/ -#ifndef IVAS_CODE_CNG_FIX185_PLC_FADEOUT IF( A_cng != NULL ) { Word16 alpha_delayed; @@ -1914,7 +1801,6 @@ void con_tcx_ivas_fx( E_LPC_f_lsp_a_conversion( lsp_fade, A_local, M ); } } -#endif E_UTIL_synthesis( sub( Q_exc, Q_syn ), diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index 090409b4c..c0281c7e3 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -957,14 +957,10 @@ ivas_error evs_dec_fx( } st_fx->lp_noise = hFdCngDec->lp_noise; /*Q9.23*/ move32(); -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - ApplyFdCng_fx( output, NULL, realBuffer, imagBuffer, st, concealWholeFrame, 0 ); -#else #ifdef REMOVE_EVS_DUPLICATES ApplyFdCng_ivas_fx( output_sp, 0, NULL, 0, realBuffer, imagBuffer, &st_fx->scaleFactor.hb_scale, st_fx, concealWholeFrame, 0 ); #else ApplyFdCng_fx( output_sp, 0, realBuffer, imagBuffer, &st_fx->scaleFactor.hb_scale, st_fx, concealWholeFrame, 0 ); -#endif #endif /* Generate additional comfort noise to mask potential coding artefacts */ test(); diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 47a61a26e..893b49241 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -559,9 +559,6 @@ void deleteFdCngDec_fx( HANDLE_FD_CNG_DEC *hFdCngDec ) Word16 ApplyFdCng_fx( Word16 *timeDomainInput, /* i : pointer to time domain input Q*/ Word16 Q, -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - Word16 *powerSpectrum, -#endif Word32 **cldfbBufferReal, /* i/o: real part of the CLDFB buffer cldfbBufferScale*/ Word32 **cldfbBufferImag, /* i/o: imaginary part of the CLDFB buffer cldfbBufferScale*/ Word16 *cldfbBufferScale, /* o : pointer to the scalefactor for real and imaginary part of the CLDFB buffer */ @@ -588,16 +585,6 @@ Word16 ApplyFdCng_fx( move16(); move16(); #endif -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - int16_t L_frame, last_L_frame; - int32_t sr_core; - - PMT( "Fix point code missing for IVAS_CODE_CNG_FIX185_PLC_FADEOUT" ) - /* limit L_frame and core fs values for MDCT-Stereo modes which can have higher core sampling than 16kHz, but use a downsampled buffer */ - L_frame = min( st->L_frame, L_FRAME16k ); - last_L_frame = min( st->last_L_frame, L_FRAME16k ); - sr_core = min( st->sr_core, INT_FS_16k ); -#endif hFdCngDec = st->hFdCngDec; hFdCngCom = hFdCngDec->hFdCngCom; @@ -636,27 +623,6 @@ Word16 ApplyFdCng_fx( /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive during concealment, no update with noise generated by concealment should be performed. */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - if ( concealWholeFrame == 0 && - ( timeDomainInput == NULL || - ( *timeDomainInput( -FLT_MAX ) && - *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && - *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && - ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD ) && - !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || - ( st->element_mode == IVAS_CPE_TD ) ) && - ( !st->BER_detect ) ) -#else test(); test(); test(); @@ -671,14 +637,9 @@ Word16 ApplyFdCng_fx( IF( ( concealWholeFrame == 0 ) && ( LT_16( *timeDomainInput, MAXVAL_WORD16 ) ) && GT_16( *timeDomainInput, MINVAL_WORD16 ) && ( LT_16( *( timeDomainInput + sub( hFdCngCom->frameSize, 1 ) ), MAXVAL_WORD16 ) ) && GT_16( *( timeDomainInput + sub( hFdCngCom->frameSize, 1 ) ), MINVAL_WORD16 ) && ( ( ( hFdCngDec->flag_dtx_mode == 0 ) && ( st->VAD != 0 ) ) == 0 ) && ( ( ( st->cng_type == LP_CNG ) && ( hFdCngDec->flag_dtx_mode != 0 ) ) == 0 ) && ( is_music == 0 ) && ( st->BER_detect == 0 ) ) -#endif { /* Perform noise estimation at the decoder */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - perform_noise_estimation_dec_fx( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); -#else perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); -#endif /* Update the shaping parameters */ test(); @@ -790,16 +751,6 @@ Word16 ApplyFdCng_fx( move16(); } } -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - if ( st->element_mode == IVAS_CPE_MDCT && timeDomainInput == NULL ) - { - st->hTcxDec->CngLevelBackgroundTrace_bfi = sqrtf( sum_f( cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand ) / NORM_MDCT_FACTOR ); - } - else - { - st->hTcxDec->CngLevelBackgroundTrace_bfi = (float) sqrt( ( sum_f( cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand ) / 2 * hFdCngCom->fftlen ) / L_frame ); - } -#endif /*st->cngTDLevel = (float)sqrt( (sumFLOAT(cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand) / 2 * hFdCngCom->fftlen) / st->Mode2_L_frame);*/ tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); L_tmp = L_deposit_h( 0 ); @@ -840,11 +791,8 @@ Word16 ApplyFdCng_fx( IF( hFdCngCom->active_frame_counter > 0 ) { /* Perform noise estimation in active frames in the decoder for downward updates */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - perform_noise_estimation_dec_fx( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); -#else perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); -#endif + } } test(); @@ -860,58 +808,11 @@ Word16 ApplyFdCng_fx( IF( EQ_16( concealWholeFrame, 1 ) && EQ_16( st->nbLostCmpt, 1 ) && ( GT_32( L_shl_o( L_tmp, L_tmp_exp, &Overflow ), 21474836 ) /*0.01f Q31*/ ) ) { /* update isf cng estimate for concealment. Do that during concealment, in order to avoid addition clean channel complexity*/ -#ifndef IVAS_CODE_CNG_FIX185_PLC_FADEOUT lpc_from_spectrum( hFdCngCom, hFdCngCom->startBand, hFdCngCom->stopFFTbin, 0 ); E_LPC_a_lsp_conversion( hFdCngCom->A_cng, lsp_cng, st->lspold_cng, M ); Copy( lsp_cng, st->lspold_cng, M ); /*Q15*/ lsp2lsf_fx( lsp_cng, st->lsf_cng, M, st->sr_core ); -#else - if ( st->element_mode == IVAS_CPE_MDCT && st->core != ACELP_CORE ) - { - float scf[SNS_NPTS]; - float scf_int[FDNS_NPTS]; - float whitenend_noise_shape[L_FRAME16k]; - int16_t inc, start_idx, stop_idx; - float *noiseLevelPtr; - - - inc = ( st->core > TCX_20 ) ? 2 : 1; - start_idx = hFdCngCom->startBand / inc; - stop_idx = L_frame / inc; - noiseLevelPtr = cngNoiseLevel; - - set_zero( whitenend_noise_shape, start_idx ); - for ( j = start_idx; j < stop_idx; j++, noiseLevelPtr += inc ) - { - whitenend_noise_shape[j] = *noiseLevelPtr; - } - if ( st->core == TCX_20_CORE ) - { - st->hTonalMDCTConc->psychParams = &st->hTonalMDCTConc->psychParamsTCX20; - } - else - { - st->hTonalMDCTConc->psychParams = &st->hTonalMDCTConc->psychParamsTCX10; - } - - sns_compute_scf( whitenend_noise_shape, st->hTonalMDCTConc->psychParams, L_frame, scf ); - sns_interpolate_scalefactors( scf_int, scf, ENC ); - sns_interpolate_scalefactors( st->hTonalMDCTConc->scaleFactorsBackground_flt, scf, DEC ); - sns_shape_spectrum( whitenend_noise_shape, st->hTonalMDCTConc->psychParams, scf_int, L_frame ); - - mvr2r( whitenend_noise_shape + start_idx, cngNoiseLevel, stop_idx - start_idx ); - wmops_sub_end(); - } - else if ( st->element_mode != IVAS_CPE_MDCT ) - { - lpc_from_spectrum( hFdCngCom, hFdCngCom->startBand, hFdCngCom->stopFFTbin, 0.f ); - a2lsp_stab( hFdCngCom->A_cng, lsp_cng, st->lspold_cng ); - mvr2r( lsp_cng, st->lspold_cng, M ); - lsp2lsf( lsp_cng, st->lsf_cng, M, sr_core ); - } - -#endif st->plcBackgroundNoiseUpdated = 1; move16(); } @@ -929,11 +830,7 @@ Word16 ApplyFdCng_fx( IF( st != NULL && st->cng_type == LP_CNG ) { /* Perform noise estimation on inactive phase at the decoder */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - perform_noise_estimation_dec_fx( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); -#else perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); -#endif /* Update the shaping parameters */ test(); @@ -947,9 +844,6 @@ Word16 ApplyFdCng_fx( Copy32( hFdCngDec->bandNoiseShape, cngNoiseLevel, sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ) ); /* This sets the new CNG levels until a SID update overwrites it Q31 - hFdCngDec->bandNoiseShape_exp*/ *cngNoiseLevel_exp = hFdCngDec->bandNoiseShape_exp; move16(); -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - st->cngTDLevel = (float) sqrt( ( sum_f( cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand ) / 2 * hFdCngCom->fftlen ) / L_frame ); -#else /*st->cngTDLevel = (float)sqrt( (sumFLOAT(cngNoiseLevel, hFdCngCom->stopFFTbin - hFdCngCom->startBand) / 2 * hFdCngCom->fftlen) / st->Mode2_L_frame);*/ tmp_loop = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); L_tmp = L_deposit_h( 0 ); @@ -985,7 +879,6 @@ Word16 ApplyFdCng_fx( move16(); st->cngTDLevel_e = L_tmp_exp; move16(); -#endif BREAK; } hFdCngCom->inactive_frame_counter = add( hFdCngCom->inactive_frame_counter, 1 ); @@ -1903,9 +1796,6 @@ Word16 ApplyFdCng_ivas_fx( void perform_noise_estimation_dec_fx( const Word16 *timeDomainInput, /* i: pointer to time domain input Q*/ const Word16 Q, -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - float *power_spectrum, -#endif HANDLE_FD_CNG_DEC hFdCngDec /* i/o: FD_CNG structure containing all buffers and variables */ ) { @@ -1936,53 +1826,11 @@ void perform_noise_estimation_dec_fx( move16(); /* Perform STFT analysis */ -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - IF( !( EQ_16( element_mode, IVAS_CPE_MDCT ) && power_spectrum != NULL ) ) - { - /* Perform STFT analysis */ - AnalysisSTFT( timeDomainInput, Q, fftBuffer, &fftBuffer_exp, hFdCngDec->hFdCngCom ); - } -#else /* Perform STFT analysis */ AnalysisSTFT( timeDomainInput, Q, fftBuffer, &fftBuffer_exp, hFdCngDec->hFdCngCom ); -#endif fftBuffer_exp = add( fftBuffer_exp, WORD16_BITS - 1 ); { -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - if ( element_mode == IVAS_CPE_MDCT && power_spectrum != NULL ) - { - /* use power spectrum calculated in the MDCT-domain instead of calculating new power spectrum */ - periodog = power_spectrum; - } - else - { - /* Compute the squared magnitude in each FFT bin */ - if ( startBand == 0 ) - { - ( *ptr_per ) = fftBuffer[0] * fftBuffer[0]; /* DC component */ - ptr_per++; - ptr_r = fftBuffer + 2; - } - else - { - ptr_r = fftBuffer + 2 * startBand; - } - - ptr_i = ptr_r + 1; - - for ( ; ptr_per < periodog + stopFFTbin - startBand; ptr_per++ ) - { - ( *ptr_per ) = ( *ptr_r ) * ( *ptr_r ) + ( *ptr_i ) * ( *ptr_i ); - ptr_r += 2; - ptr_i += 2; - } - /* Nyquist frequency is discarded */ - - /* Rescale to get energy/sample: it should be 2*(1/N)*(2/N), parseval relation with 1/N,*2 for nrg computed till Nyquist only, 2/N as windowed samples correspond to half a frame*/ - v_multc( periodog, 4.f / (float) ( hFdCngDec->hFdCngCom->fftlen * hFdCngDec->hFdCngCom->fftlen ), periodog, stopFFTbin - startBand ); - } -#else assert( startBand != 0 ); len = sub( stopFFTbin, startBand ); @@ -2062,7 +1910,6 @@ void perform_noise_estimation_dec_fx( } hFdCngDec->hFdCngCom->periodog_exp = add( hFdCngDec->hFdCngCom->periodog_exp, sub( 2, s ) ); move16(); -#endif /* Adjust to the desired frequency resolution by averaging over spectral partitions for SID transmission */ bandcombinepow( periodog, hFdCngDec->hFdCngCom->periodog_exp, sub( stopFFTbin, startBand ), part, npart, psize_inv, hFdCngDec->msPeriodog, &hFdCngDec->msPeriodog_exp ); diff --git a/lib_dec/gs_dec_amr_wb_fx.c b/lib_dec/gs_dec_amr_wb_fx.c index 65e9eaa87..331142a44 100644 --- a/lib_dec/gs_dec_amr_wb_fx.c +++ b/lib_dec/gs_dec_amr_wb_fx.c @@ -24,9 +24,6 @@ #define NORMALIZE_SPECS_Q_OUT 6 #define ENER_FX_Q_GUARD 1 -#ifdef ADD_IVAS_GS_DEC_IMPR -#define CONTR_LIMIT 3012 to be verified for fixed point /* Threshold to allow an increase in the contribution length */ -#endif /*-------------------------------------------------------------------* * Local functions *-------------------------------------------------------------------*/ @@ -35,10 +32,6 @@ static void Ener_per_band_fx( const Word16 exc_diff_fx[], const Word16 exc_diff_ static void Apply_gain_fx( Word16 exc_diffQ_fx[], Word32 L_Ener_per_bd_iQ[], Word32 L_Ener_per_bd_yQ[], const Word16 Q_out ); static void normalize_spec_fx( Word16 fac_up_fx, Word16 fy_norm_fx[], const Word16 L_frame, const Word16 Q_out ); static void gs_dec_amr_wb_fx( const long core_brate, Word16 *seed_tcx, const Word16 dct_in_fx[], const Word16 Q_dct_in, Word16 dct_out_fx[], Word16 Q_dct_out, const Word16 pitch_fx[], const Word16 voice_fac, const Word16 clas, const Word16 coder_type -#ifdef ADD_IVAS_GS_DEC_IMPR - , - const Word16 VeryLowRateSTflag -#endif ); /*-------------------------------------------------------------------* @@ -223,10 +216,6 @@ static void gs_dec_amr_wb_fx( const Word16 voice_fac, /* i : gain pitch Q15*/ const Word16 clas, /* i : signal frame class Q0*/ const Word16 coder_type /* i : coder type Q0*/ -#ifdef ADD_IVAS_GS_DEC_IMPR - , - const Word16 VeryLowRateSTflag /* i : Enable the noise enhancement for very low rate stereo generic mode */ -#endif ) { Word16 i, mDiff_len; @@ -280,13 +269,7 @@ static void gs_dec_amr_wb_fx( temp = Invert16( temp, &exp ); /* Q15 */ L_temp = L_mult( temp, 12800 ); /* Q15 */ L_temp = L_shl( L_temp, sub( 3, exp ) ); /* *8.0f */ /* Q15 */ -#ifdef ADD_IVAS_GS_DEC_IMPR - test(); - test(); - IF( L_temp <= CONTR_LIMIT && ( VeryLowRateSTflag || GE_32( core_brate, ACELP_12k65 ) ) ) -#else if ( GE_32( core_brate, ACELP_12k65 ) ) -#endif { L_temp = L_shl( L_temp, 1 ); /* Q16 */ } @@ -311,16 +294,6 @@ static void gs_dec_amr_wb_fx( mDiff_len = s_max( round_fx( L_temp ), BIN_1k2 ); /* Q0 */ -#ifdef ADD_IVAS_GS_DEC_IMPR - IF( ( VeryLowRateSTflag && ( EQ_16( clas, VOICED_CLAS ) || EQ_16( clas, AUDIO_CLAS ) ) ) ) /* Do not apply normalization on VOICED signal in case of stereo */ - { - Copy( dct_in_fx, exc_diffQ, L_FRAME ); - - /* normalization of the spectrum and noise fill */ - normalize_spec_fx( 1 * 256, exc_diffQ + mDiff_len, sub( L_FRAME, mDiff_len ), NORMALIZE_SPECS_Q_OUT ); - } - ELSE -#endif { Copy( dct_in_fx, exc_diffQ_fx, mDiff_len ); /* Q_dct_in */ set16_fx( exc_diffQ_fx + mDiff_len, 0, sub( L_FRAME, mDiff_len ) ); @@ -387,10 +360,6 @@ void improv_amr_wb_gs_fx( const Word16 Last_ener_fx, /* i : Last energy (Q8) Q0*/ const Word16 rate_switching_reset, /* i : rate switching reset flag Q0*/ const Word16 last_coder_type /* i : Last coder_type Q0*/ -#ifdef ADD_IVAS_GS_DEC_IMPR - , - const Word16 VeryLowRateSTflag /* i : Enable the noise enhancement for very low rate stereo generic mode */ -#endif ) { Word16 i, exp_a, exp_b, exp_diff, j; @@ -413,18 +382,10 @@ void improv_amr_wb_gs_fx( test(); test(); test(); -#ifdef ADD_IVAS_GS_DEC_IMPR - IF( VeryLowRateSTflag || - ( ( locattack == 0 && LE_32( core_brate, ACELP_12k65 ) ) && - ( ( LT_32( core_brate, ACELP_8k85 ) && NE_16( clas, AUDIO_CLAS ) && - ( EQ_16( clas, UNVOICED_CLAS ) || EQ_16( clas, VOICED_TRANSITION ) ) ) || - EQ_16( coder_type, INACTIVE ) ) ) ) -#else IF( ( locattack == 0 && LE_32( core_brate, ACELP_12k65 ) ) && ( ( LT_32( core_brate, ACELP_8k85 ) && NE_16( clas, AUDIO_CLAS ) && ( ( clas == UNVOICED_CLAS ) || EQ_16( clas, VOICED_TRANSITION ) ) ) || ( EQ_16( coder_type, INACTIVE ) ) ) ) -#endif { /*------------------------------------------------------------* * two differents paths: @@ -495,10 +456,6 @@ void improv_amr_wb_gs_fx( *------------------------------------------------------------*/ edct_16fx( exc2_fx, dct_exc_in_fx, L_FRAME, 6, EVS_MONO ); gs_dec_amr_wb_fx( core_brate, seed_tcx, dct_exc_in_fx, Q_exc2, dct_exc_out_fx, Q_exc2, pitch_buf_fx, lt_voice_fac_fx, clas, coder_type -#ifdef ADD_IVAS_GS_DEC_IMPR - , - VeryLowRateSTflag -#endif ); edct_16fx( dct_exc_out_fx, exc2_fx, L_FRAME, 6, EVS_MONO ); diff --git a/lib_dec/hq_classifier_dec_fx.c b/lib_dec/hq_classifier_dec_fx.c index 5ff5dec58..c8dac0a0b 100644 --- a/lib_dec/hq_classifier_dec_fx.c +++ b/lib_dec/hq_classifier_dec_fx.c @@ -99,17 +99,11 @@ Word16 hq_classifier_dec_fx( /* o : Consumed bits max_brate = HQ_48k; /* Q0 */ move32(); } -#ifndef SOLVED_COMP_ENC_DEC test(); test(); test(); test(); IF( ( EQ_16( length, L_SPEC32k ) || EQ_16( length, L_FRAME48k ) ) && LE_32( core_brate, max_brate ) ) -#else - /*_DIFF_FLOAT_FIX_ -> could this modification break the interoperability with EVS ?? */ - test(); - IF( ( EQ_16( length, L_SPEC32k ) || EQ_16( length, L_SPEC48k ) ) && LE_32( core_brate, max_brate ) ) -#endif { *hqswb_clas = get_next_indice( st_fx, 2 ); /* Q0 */ move16(); @@ -147,11 +141,7 @@ Word16 hq_classifier_dec_fx( /* o : Consumed bits *hqswb_clas = HQ_GEN_SWB; /* Q0 */ move16(); } -#ifndef SOLVED_COMP_ENC_DEC ELSE IF( EQ_16( length, L_FRAME48k ) ) -#else - ELSE IF( EQ_16( length, L_SPEC48k ) ) -#endif { *hqswb_clas = HQ_GEN_FB; /* Q0 */ move16(); diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index 4d1ef6774..3c2cd5a80 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -78,22 +78,10 @@ void hq_core_dec_fx( /*num_bits = (short)(st->total_brate / 50); */ Mpy_32_16_ss( st_fx->total_brate, 5243, &L_tmp, &lsb ); /* 5243 is 1/50 in Q18. (0+18-15=3) */ num_bits = extract_l( L_shr( L_tmp, 3 ) ); /*Q0 */ - -#ifdef ADD_IVAS_HQ_CODE_L_SPEC - /* Set default spectrum length */ - L_spec = l_spec_tbl[st_fx->bwidth]; -#endif IF( !st_fx->bfi ) { IF( EQ_16( core_switching_flag, 1 ) ) { -#ifdef ADD_IVAS_HQ_CODE_L_SPEC - IF( NE_16( st_fx->element_mode, EVS_MONO ) ) - { - L_spec = l_spec_ext_tbl[st_fx->bwidth]; - } - ELSE -#endif { core_switching_hq_prepare_dec_fx( st_fx, &num_bits, output_frame ); @@ -105,12 +93,6 @@ void hq_core_dec_fx( } } } -#ifdef ADD_IVAS_HQ_CODE - IF( hq_recovery_flag ) - { - acelp_plc_mdct_transition( st ); - } -#endif /* subtract signalling bits */ num_bits = sub( num_bits, st_fx->next_bit_pos ); /* Q0 */ @@ -145,9 +127,7 @@ void hq_core_dec_fx( /* set inner frame (== coded bandwidth) length */ inner_frame = inner_frame_tbl[st_fx->bwidth]; /* Q0 */ move16(); -#ifndef ADD_IVAS_HQ_CODE_L_SPEC L_spec = inner_frame; /* Q0 */ -#endif move16(); IF( st_fx->bfi == 0 ) @@ -233,12 +213,6 @@ void hq_core_dec_fx( move16(); } -#ifdef ADD_IVAS_HQ_CODE - test(); - test(); - test(); - IF( EQ_16( st_fx->element_mode, EVS_MONO ) || ( !core_switching_flag && !hq_recovery_flag ) ) -#endif { /* scaling (coefficients are in nominal level) */ IF( NE_16( output_frame, NORM_MDCT_FACTOR ) ) @@ -322,59 +296,6 @@ void hq_core_dec_fx( * Overlap-add * Pre-echo reduction *--------------------------------------------------------------------------*/ -#ifdef ADD_IVAS_HQ_CODE - if ( st->element_mode > EVS_MONO && ( core_switching_flag || hq_recovery_flag ) ) - { - /* Initializations for TCX MDCT framework, to be used for switching frame */ - tcx_cfg = st->hTcxCfg; - L_frameTCX_glob = hTcxDec->L_frameTCX; - L_frame_glob = st->L_frame; - L_spec = hTcxDec->L_frameTCX; - st->fscale = sr2fscale( st->sr_core ); - fscaleFB = sr2fscale( st->output_Fs ); - encoderLookahead = ( L_LOOK_12k8 * st->fscale ) / FSCALE_DENOM; - encoderLookaheadFB = ( L_LOOK_12k8 * fscaleFB ) / FSCALE_DENOM; - mdctWindowLength = getMdctWindowLength( st->fscale ); - mdctWindowLengthFB = (int16_t) ( mdctWindowLength * st->output_Fs / st->sr_core ); - if ( core_switching_flag ) - { - tcx_cfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; - tcx_cfg->tcx_curr_overlap_mode = FULL_OVERLAP; - } - else - { - tcx_cfg->tcx_last_overlap_mode = ALDO_WINDOW; - tcx_cfg->tcx_curr_overlap_mode = ALDO_WINDOW; - st->last_core = HQ_CORE; /* Needed to decode non-transition frame */ - } - - init_tcx_window_cfg( tcx_cfg, st->sr_core, st->output_Fs, st->L_frame, hTcxDec->L_frameTCX, encoderLookahead, encoderLookaheadFB, mdctWindowLength, mdctWindowLengthFB, st->element_mode ); - - init_tcx_info( st, L_frame_glob, L_frameTCX_glob, 0, st->bfi, &tcx_offset, &tcx_offsetFB, &L_frame, &L_frameTCX, &left_rect, &L_spec ); - - overlap = tcx_cfg->tcx_mdct_window_length; - overlapFB = tcx_cfg->tcx_mdct_window_lengthFB; - index = tcx_cfg->tcx_last_overlap_mode; - - /* LB synthesis */ - IMDCT_fx( t_audio_q, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, - MDCT_IV, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, 0, st->bfi, hHQ_core->old_outLB, 0, st, 0, acelp_zir ); - - mvr2r( wtda_audio + ( overlap >> 1 ) - tcx_offset, output, L_frame_glob ); - - /* FB synthesis */ - IMDCT_fx( t_audio_q, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, - MDCT_IV, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, 0, st->bfi, hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); - - mvr2r( wtda_audio + ( overlapFB >> 1 ) - tcx_offsetFB, synth, L_frameTCX_glob ); - - if ( !core_switching_flag ) - { - st->last_core = ACELP_CORE; /* Restore last core */ - } - } - else -#endif { test(); IF( EQ_16( output_frame, L_FRAME8k ) || st_fx->bfi == 0 ) @@ -392,24 +313,6 @@ void hq_core_dec_fx( move16(); } } -#ifdef ADD_IVAS_HQ_CODE - if ( st->element_mode > EVS_MONO ) - { - if ( st->bfi ) - { - /* Rough resampling, but reduces energy loss in case of switch to ACELP in first good frame */ - lerp( t_audio_q, wtda_audio_LB, st->L_frame, inner_frame ); - v_multc( t_audio_q, 0.5f, wtda_audio_LB, st->L_frame ); - } - else - { - /* LB synthesis for potential switch to ACELP */ - ener_match = (float) sqrt( (float) st->L_frame / (float) output_frame ); - v_multc( t_audio_q, ener_match, t_audio_q, inner_frame ); - inverse_transform( t_audio_q, wtda_audio_LB, is_transient, st->L_frame, inner_frame, st->element_mode ); - } - } -#endif IF( EQ_16( output_frame, L_FRAME8k ) ) { test(); @@ -465,13 +368,6 @@ void hq_core_dec_fx( window_ola_fx( wtda_audio, synth, Q_synth, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, output_frame, st_fx->hTcxCfg->tcx_last_overlap_mode, st_fx->hTcxCfg->tcx_curr_overlap_mode, st_fx->prev_bfi && !hHQ_core->ph_ecu_active, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx ); } -#ifdef ADD_IVAS_HQ_CODE - if ( st->element_mode > EVS_MONO ) - { - /* LB synthesis for potential switch to ACELP */ - window_ola( wtda_audio_LB, output, hHQ_core->old_outLB, L_FRAME16k, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, st->prev_bfi && !hHQ_core->ph_ecu_active, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth ); - } -#endif test(); test(); IF( ( st_fx->bfi == 0 && st_fx->prev_bfi == 0 ) || !( GE_16( output_frame, L_FRAME16k ) ) ) @@ -561,13 +457,6 @@ void hq_core_dec_fx( Copy( &st_fx->mem_pitch_gain[2], &st_fx->mem_pitch_gain[nbsubfr + 2], nbsubfr ); /* Q14 */ set16_fx( &st_fx->mem_pitch_gain[2], 0, nbsubfr ); } -#ifdef ADD_IVAS_HQ_CODE - /* Move LB excitation to old_exc memory in case of switch HQ->ACELP */ - if ( st->element_mode > EVS_MONO ) - { - mvr2r( output, st->old_exc + L_EXC_MEM_DEC - st->L_frame, st->L_frame ); - } -#endif return; } diff --git a/lib_dec/hq_hr_dec_fx.c b/lib_dec/hq_hr_dec_fx.c index 89864bc3b..6423015bc 100644 --- a/lib_dec/hq_hr_dec_fx.c +++ b/lib_dec/hq_hr_dec_fx.c @@ -46,7 +46,6 @@ void ivas_hq_pred_hb_bws_fx( } ELSE { - // EVS_FUNC_MODIFIED st_fx->prev_ener_shb_fx = 0; move16(); L_tmp = L_deposit_l( 0 ); diff --git a/lib_dec/ivas_output_config_fx.c b/lib_dec/ivas_output_config_fx.c index 3a0960960..17999496e 100644 --- a/lib_dec/ivas_output_config_fx.c +++ b/lib_dec/ivas_output_config_fx.c @@ -239,16 +239,6 @@ void ivas_renderer_select( move16(); } -#if 0 // def DEBUGGING /*temp disabling this as paramMC crashes with CREND*/ - IF ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_CREND ) - { - *renderer_type = RENDERER_BINAURAL_MIXER_CONV; - } - ELSE IF ( st_ivas->hRenderConfig->renderer_type_override == IVAS_RENDER_TYPE_OVERRIDE_FASTCONV ) - { - *renderer_type = RENDERER_BINAURAL_FASTCONV; - } -#endif test(); IF( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) { diff --git a/lib_dec/tns_base_dec_fx.c b/lib_dec/tns_base_dec_fx.c index 13f6ca461..def1ffefb 100644 --- a/lib_dec/tns_base_dec_fx.c +++ b/lib_dec/tns_base_dec_fx.c @@ -26,11 +26,8 @@ typedef Word32 ( *TLinearPredictionFilter )( Word16 order, Word16 const parCoeff * * *---------------------------------------------------------------------*/ -#ifdef IVAS_CODE -void -#else + Word16 -#endif ReadTnsData( STnsConfig const *pTnsConfig, Decoder_State *st, @@ -47,20 +44,6 @@ ReadTnsData( IF( GT_16( pTnsConfig->nMaxFilters, 1 ) ) { -#ifdef IVAS_CODE - IF( pTnsConfig->allowTnsOnWhite ) - { - IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) - { - ReadFromBitstream( &tnsEnabledOnWhiteSWBTCX10BitMap, 1, st, &stream, pnSize ); - } - ELSE - { - ReadFromBitstream( &tnsEnabledOnWhiteSWBTCX20BitMap, 1, st, &stream, pnSize ); - } - } - ELSE -#endif { IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) @@ -81,19 +64,10 @@ ReadTnsData( move16(); *pnBits = sub( st->next_bit_pos, start_bit_pos ); - -#ifdef IVAS_CODE - return; -#else return TNS_NO_ERROR; -#endif } -#define IVAS_CODE -#ifdef IVAS_CODE + void -#else -Word16 -#endif ReadTnsData_ivas_fx( STnsConfig const *pTnsConfig, Decoder_State *st, @@ -109,7 +83,6 @@ ReadTnsData_ivas_fx( IF( GT_16( pTnsConfig->nMaxFilters, 1 ) ) { -#ifdef IVAS_CODE IF( pTnsConfig->allowTnsOnWhite ) { IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) @@ -122,7 +95,6 @@ ReadTnsData_ivas_fx( } } ELSE -#endif { IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) @@ -143,13 +115,9 @@ ReadTnsData_ivas_fx( move16(); *pnBits = sub( st->next_bit_pos, start_bit_pos ); -#ifdef IVAS_CODE return; -#else - return TNS_NO_ERROR; -#endif } -#undef IVAS_CODE + /*---------------------------------------------------------------------* * DecodeTnsData() * @@ -169,21 +137,6 @@ Word16 DecodeTnsData( IF( GT_16( pTnsConfig->nMaxFilters, 1 ) ) { - -#ifdef IVAS_CODE - IF( pTnsConfig->allowTnsOnWhite ) - { - IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) - { - SetParameters( &tnsEnabledOnWhiteSWBTCX10BitMap, 1, pTnsData, &stream, pnSize ); - } - ELSE - { - SetParameters( &tnsEnabledOnWhiteSWBTCX20BitMap, 1, pTnsData, &stream, pnSize ); - } - } - ELSE -#endif { IF( LT_16( pTnsConfig->iFilterBorders[0], 512 ) ) { diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index bc7e1d536..7465a7f65 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -103,18 +103,6 @@ ivas_error TonalMDCTConceal_Init( hTonalMDCTConc->nScaleFactors = nScaleFactors; move16(); -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - PMTE() - set_zero( hTonalMDCTConc->scaleFactorsBackground, FDNS_NPTS ); - PsychoacousticParameters_Init( INT_FS_16k, L_FRAME16k, 64, 1, 1, &hTonalMDCTConc->psychParamsTCX20 ); - PsychoacousticParameters_Init( INT_FS_16k, L_FRAME16k / 2, 64, 0, 1, &hTonalMDCTConc->psychParamsTCX10 ); - hTonalMDCTConc->psychParams = NULL; - hTonalMDCTConc->scf_fadeout = 1.0f; - hTonalMDCTConc->last_block_nrg = 0.0f; - hTonalMDCTConc->curr_noise_nrg = 0.0f; - hTonalMDCTConc->faded_signal_nrg = 0.0f; - -#endif /* Offset the pointer to the end of buffer, so that pTCI is not destroyed when new time samples are stored in lastPcmOut */ move16(); @@ -198,9 +186,6 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( hTonalMDCTConc->nScaleFactors = nScaleFactors; move16(); - //#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - // PMTE() - // To be uncommented when field of fixed type is added for scaleFactorsBackground set32_fx( hTonalMDCTConc->scaleFactorsBackground_fx, 0, FDNS_NPTS ); hTonalMDCTConc->scf_fadeout = 16384 /*1.000000 Q14*/; PsychoacousticParameters_Init_fx( INT_FS_16k, L_FRAME16k, 64, 1, 1, &hTonalMDCTConc->psychParamsTCX20 ); @@ -243,10 +228,6 @@ void TonalMDCTConceal_SaveFreqSignal( const Word16 *scaleFactors, // Q31-scaleFactors_exp const Word16 *scaleFactors_exp, const Word16 gain_tcx_exp -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - , - const int16_t infoIGFStartLine -#endif ) { Word16 *temp; @@ -340,20 +321,6 @@ void TonalMDCTConceal_SaveFreqSignal( test(); IF( ( nNewSamples > 0 ) && ( LE_16( nNewSamples, 2 * L_FRAME_MAX ) ) ) { -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - int16_t i; - PMTE() - hTonalMDCTConc->last_block_nrg_flt = 0.0f; - for ( i = 0; i < infoIGFStartLine; i++ ) - { - hTonalMDCTConc->lastBlockData.spectralData[i] = mdctSpectrum[i]; - hTonalMDCTConc->last_block_nrg_flt += mdctSpectrum[i] * mdctSpectrum[i]; - } - for ( ; i < nNewSamples; i++ ) - { - hTonalMDCTConc->lastBlockData.spectralData[i] = mdctSpectrum[i]; - } -#else /* Store new data */ s = getScaleFactor32( mdctSpectrum, nNewSamples ); @@ -375,7 +342,6 @@ void TonalMDCTConceal_SaveFreqSignal( move16(); } hTonalMDCTConc->lastBlockData.spectralData_exp = sub( mdctSpectrum_exp, s ); -#endif move16(); hTonalMDCTConc->lastBlockData.gain_tcx_exp = gain_tcx_exp; @@ -2207,19 +2173,12 @@ void TonalMDCTConceal_InsertNoise( Word16 *pSeed, /*IN/OUT*/ const Word16 tiltCompFactor, // Q15 Word16 crossfadeGain, // Q15 -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - const Word16concealment_noise[L_FRAME48k], - const float cngLevelBackgroundTrace_bfi, -#endif const Word16 crossOverFreq ) { Word16 i, ld, fac; Word16 rnd, exp, exp_last, exp_noise, inv_samples, inv_exp; Word16 g, tiltFactor, tilt, tmp; Word32 nrgNoiseInLastFrame, nrgWhiteNoise, L_tmp, L_tmp2; -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - float last_block_nrg_correct; -#endif g = sub( 32767 /*1.0f Q15*/, crossfadeGain ); @@ -2230,16 +2189,6 @@ void TonalMDCTConceal_InsertNoise( rnd = *pSeed; move16(); } -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - /* based on what is done in tcx_noise_filling() */ - /* always initialize these to avoid compiler warnings */ - tiltFactor = (float) pow( max( 0.375f, tiltCompFactor ), 1.0f / hTonalMDCTConc->lastBlockData.nSamples ); - tilt = 1.0f; - nrgNoiseInLastFrame = 0.0f; - nrgWhiteNoise = 0.0f; - hTonalMDCTConc->faded_signal_nrg_flt = 0.0f; - last_block_nrg_correct = 0.0f; -#endif IF( hTonalMDCTConc->lastBlockData.blockIsValid == 0 ) { /* may just become active if the very first frame is lost */ @@ -2247,199 +2196,8 @@ void TonalMDCTConceal_InsertNoise( *mdctSpectrum_exp = SPEC_EXP_DEC; move16(); } -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT - else if ( concealment_noise != NULL ) - { - if ( !tonalConcealmentActive ) - { - /* if fadeout has not started yet, only apply sign scrambling */ - if ( crossfadeGain == 1.0f ) - { - for ( i = 0; i < crossOverFreq; i++ ) - { - if ( concealment_noise[i] > 0 ) - { - mdctSpectrum[i] = hTonalMDCTConc->lastBlockData.spectralData[i]; - } - else - { - mdctSpectrum[i] = -hTonalMDCTConc->lastBlockData.spectralData[i]; - } - } - - for ( l = crossOverFreq; l < hTonalMDCTConc->lastBlockData.nSamples; l++ ) - { - mdctSpectrum[l] = hTonalMDCTConc->lastBlockData.spectralData[l]; - } - } - /* actual fadeout is done in this case */ - else - { - g *= (float) sqrt( cngLevelBackgroundTrace_bfi / hTonalMDCTConc->curr_noise_nrg_flt ); - - for ( i = 0; i < crossOverFreq; i++ ) - { - x = hTonalMDCTConc->lastBlockData.spectralData[i]; - y = concealment_noise[i]; - - if ( y > 0 ) - { - mdctSpectrum[i] = g * y + crossfadeGain * x; - } - else - { - mdctSpectrum[i] = g * y - crossfadeGain * x; - } - - hTonalMDCTConc->faded_signal_nrg_flt += mdctSpectrum[i] * mdctSpectrum[i]; - } - for ( l = crossOverFreq; l < hTonalMDCTConc->lastBlockData.nSamples; l++ ) - { - mdctSpectrum[l] = 0.0f; - } - } - } - else - { - assert( hTonalMDCTConc->pTCI->numIndexes > 0 ); - - /* initialize bins of tonal components with zero: basically not - necessary, but currently the whole spectrum is rescaled in - mdct_noiseShaping() and then there would be a processing of - uninitialized values */ - for ( i = 0; i < hTonalMDCTConc->pTCI->numIndexes; i++ ) - { - for ( l = hTonalMDCTConc->pTCI->lowerIndex[i]; l <= hTonalMDCTConc->pTCI->upperIndex[i]; l++ ) - { - mdctSpectrum[l] = 0; - if ( l < crossOverFreq ) - { - last_block_nrg_correct += hTonalMDCTConc->lastBlockData.spectralData[l] * hTonalMDCTConc->lastBlockData.spectralData[l]; - hTonalMDCTConc->curr_noise_nrg_flt -= concealment_noise[l] * concealment_noise[l]; - } - } - } - - /* if fadeout has not started yet, only apply sign scrambling */ - if ( crossfadeGain == 1.0f ) - { - for ( l = 0; l < hTonalMDCTConc->pTCI->lowerIndex[0]; l++ ) - { - if ( concealment_noise[l] > 0 ) - { - mdctSpectrum[l] = hTonalMDCTConc->lastBlockData.spectralData[l]; - } - else - { - mdctSpectrum[l] = -hTonalMDCTConc->lastBlockData.spectralData[l]; - } - } - for ( i = 1; i < hTonalMDCTConc->pTCI->numIndexes; i++ ) - { - for ( l = hTonalMDCTConc->pTCI->upperIndex[i - 1] + 1; l < hTonalMDCTConc->pTCI->lowerIndex[i]; l++ ) - { - if ( concealment_noise[l] > 0 ) - { - mdctSpectrum[l] = hTonalMDCTConc->lastBlockData.spectralData[l]; - } - else - { - mdctSpectrum[l] = -hTonalMDCTConc->lastBlockData.spectralData[l]; - } - } - } - - for ( l = hTonalMDCTConc->pTCI->upperIndex[hTonalMDCTConc->pTCI->numIndexes - 1] + 1; l < crossOverFreq; l++ ) - { - if ( concealment_noise[l] > 0 ) - { - mdctSpectrum[l] = hTonalMDCTConc->lastBlockData.spectralData[l]; - } - else - { - mdctSpectrum[l] = -hTonalMDCTConc->lastBlockData.spectralData[l]; - } - } - - for ( l = crossOverFreq; l < hTonalMDCTConc->lastBlockData.nSamples; l++ ) - { - mdctSpectrum[l] = hTonalMDCTConc->lastBlockData.spectralData[l]; - } - } - /* actual fadeout is done in this case */ - else - { - g *= (float) sqrt( cngLevelBackgroundTrace_bfi / hTonalMDCTConc->curr_noise_nrg_flt ); - - for ( l = 0; l < hTonalMDCTConc->pTCI->lowerIndex[0]; l++ ) - { - x = hTonalMDCTConc->lastBlockData.spectralData[l]; - y = concealment_noise[l]; - - if ( y > 0 ) - { - mdctSpectrum[l] = g * y + crossfadeGain * x; - } - else - { - mdctSpectrum[l] = g * y - crossfadeGain * x; - } - hTonalMDCTConc->faded_signal_nrg_flt += mdctSpectrum[l] * mdctSpectrum[l]; - } - for ( i = 1; i < hTonalMDCTConc->pTCI->numIndexes; i++ ) - { - for ( l = hTonalMDCTConc->pTCI->upperIndex[i - 1] + 1; l < hTonalMDCTConc->pTCI->lowerIndex[i]; l++ ) - { - x = hTonalMDCTConc->lastBlockData.spectralData[l]; - y = concealment_noise[l]; - - if ( y > 0 ) - { - mdctSpectrum[l] = g * y + crossfadeGain * x; - } - else - { - mdctSpectrum[l] = g * y - crossfadeGain * x; - } - hTonalMDCTConc->faded_signal_nrg_flt += mdctSpectrum[l] * mdctSpectrum[l]; - } - } - - for ( l = hTonalMDCTConc->pTCI->upperIndex[hTonalMDCTConc->pTCI->numIndexes - 1] + 1; l < crossOverFreq; l++ ) - { - x = hTonalMDCTConc->lastBlockData.spectralData[l]; - y = concealment_noise[l]; - - if ( y > 0 ) - { - mdctSpectrum[l] = g * y + crossfadeGain * x; - } - else - { - mdctSpectrum[l] = g * y - crossfadeGain * x; - } - hTonalMDCTConc->faded_signal_nrg_flt += mdctSpectrum[l] * mdctSpectrum[l]; - } - - for ( l = crossOverFreq; l < hTonalMDCTConc->lastBlockData.nSamples; l++ ) - { - mdctSpectrum[l] = 0.0f; - } - } - } - - if ( hTonalMDCTConc->faded_signal_nrg_flt > 0.0f && hTonalMDCTConc->curr_noise_nrg_flt > MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG ) - { - float nrg_corr_factor; - - nrg_corr_factor = sqrtf( ( hTonalMDCTConc->last_block_nrg_flt - last_block_nrg_correct ) / hTonalMDCTConc->faded_signal_nrg_flt ); - v_multc( mdctSpectrum, nrg_corr_factor, mdctSpectrum, crossOverFreq ); - } - } -#endif ELSE { -#ifndef IVAS_CODE_CNG_FIX185_PLC_FADEOUT L_tmp = 805306368l /*0.375f Q31*/; move32(); inv_exp = 15; @@ -2456,7 +2214,6 @@ void TonalMDCTConceal_InsertNoise( nrgNoiseInLastFrame = L_deposit_h( 0 ); nrgWhiteNoise = L_deposit_h( 0 ); exp_last = exp_noise = 0; -#endif move16(); move16(); IF( !tonalConcealmentActive ) @@ -3576,216 +3333,3 @@ void TonalMdctConceal_whiten_noise_shape_ivas_fx( pop_wmops(); } - - -#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT -void TonalMdctConceal_create_concealment_noise( - float concealment_noise[L_FRAME48k], - CPE_DEC_HANDLE hCPE, - const int16_t L_frameTCX, - const int16_t L_frame, - const int16_t idchan, - const int16_t subframe_idx, - const int16_t core, - const int16_t crossfade_gain, - const TONALMDCTCONC_NOISE_GEN_MODE noise_gen_mode ) -{ - STEREO_MDCT_DEC_DATA_HANDLE hStereoMdct; - TonalMDCTConcealPtr hTonalMDCTConc; - Decoder_State *st; - HANDLE_FD_CNG_COM hFdCngCom; - int16_t *rnd_c, *rnd; - int16_t crossOverFreq, i, save_rnd_c, max_noise_line; - float c, c_inv; - float noise_shape_buffer[L_FRAME48k]; - int16_t inc, start_idx, stop_idx; - float *cngNoiseLevelPtr; - float last_scf; - - wmops_sub_start( "create_conc_noise" ); - - hStereoMdct = hCPE->hStereoMdct; - st = hCPE->hCoreCoder[idchan]; - hTonalMDCTConc = st->hTonalMDCTConc; - hFdCngCom = st->hFdCngDec->hFdCngCom; - rnd = &hStereoMdct->noise_seeds_channels[idchan]; - rnd_c = &hStereoMdct->noise_seed_common; - - /* determine start bin for IGF */ - if ( st->igf == 0 ) - { - if ( st->narrowBand == 0 ) - { - /* minimum needed for output with sampling rates lower then the - nominal sampling rate */ - crossOverFreq = min( L_frameTCX, L_frame ); - } - else - { - crossOverFreq = L_frameTCX; - } - } - else - { - crossOverFreq = min( st->hIGFDec->infoIGFStartLine, L_frameTCX ); - } - - /* for tonal mdct concealment with tonal components above the crossover frequency, conditionally raise the frequency index until which noise is generated */ - max_noise_line = crossOverFreq; - if ( st->tonal_mdct_plc_active ) - { - max_noise_line = max( max_noise_line, hTonalMDCTConc->pTCI->upperIndex[hTonalMDCTConc->pTCI->numIndexes - 1] + 1 ); - } - - /* first lost frame is handled separately */ - if ( !hTonalMDCTConc->lastBlockData.blockIsConcealed ) - { - *rnd = 1977 + idchan; - /* will be set twice when looping over two channels, but does not matter */ - *rnd_c = 1979; - } - - if ( crossfade_gain == 1.0f ) - { - /* In first frame, noise is weighted with zero anyway, we only need the random numbers for the sign scrambling */ - for ( i = 0; i < max_noise_line; i++ ) - { - *rnd = own_random( rnd ); - concealment_noise[i] = *rnd; - } - - wmops_sub_end(); - - return; - } - - save_rnd_c = *rnd_c; - - c = sqrtf( hStereoMdct->lastCoh ); - c_inv = sqrtf( 1 - hStereoMdct->lastCoh ); - - /* pre-compute the noise shape for later weighting of the noise spectra */ - cngNoiseLevelPtr = &hFdCngCom->cngNoiseLevel_flt[0]; - inc = ( st->core > TCX_20_CORE ) ? 2 : 1; - start_idx = hFdCngCom->startBand / inc; - stop_idx = hFdCngCom->stopFFTbin / inc; - - for ( i = 0; i < start_idx; i++ ) - { - noise_shape_buffer[i] = 0.0f; - } - for ( ; i < stop_idx; i++, cngNoiseLevelPtr += inc ) - { - noise_shape_buffer[i] = sqrtf( *( cngNoiseLevelPtr ) ); - } - - last_scf = sqrtf( *( cngNoiseLevelPtr - inc ) ); - - for ( ; i < max_noise_line; i++ ) - { - noise_shape_buffer[i] = last_scf; - } - - /* fill the noise vector */ - hTonalMDCTConc->curr_noise_nrg_flt = MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG; - if ( noise_gen_mode == EQUAL_CORES || ( ( noise_gen_mode == TCX20_IN_0_TCX10_IN_1 && idchan == 0 ) || ( noise_gen_mode == TCX10_IN_0_TCX20_IN_1 && idchan == 1 ) ) ) - { - /* current channel is TCX20 -> generate noise for "full-length" spectrum */ - for ( i = 0; i < max_noise_line; i++ ) - { - *rnd = own_random( rnd ); - *rnd_c = own_random( rnd_c ); - - concealment_noise[i] = ( c_inv * *rnd + c * *rnd_c ) * noise_shape_buffer[i]; - hTonalMDCTConc->curr_noise_nrg_flt += concealment_noise[i] * concealment_noise[i]; - } - } - else /* ( ( noise_gen_mode == TCX10_IN_0_TCX20_IN_1 && idchan == 0 ) || ( noise_gen_mode == TCX20_IN_0_TCX10_IN_1 && idchan == 1 ) ) */ - { - /* current channel is TCX10 and the other is TCX20 -> generate noise for "half-length" spectrum, but "increment" mid seed twice, to have the same seed in mid as the other (TCX20) channel for next frame */ - for ( i = 0; i < max_noise_line; i++ ) - { - *rnd = own_random( rnd ); - *rnd_c = own_random( rnd_c ); - - concealment_noise[i] = ( c_inv * *rnd + c * *rnd_c ) * noise_shape_buffer[i]; - hTonalMDCTConc->curr_noise_nrg_flt += concealment_noise[i] * concealment_noise[i]; - - *rnd_c = own_random( rnd_c ); - } - } - if ( st->tonal_mdct_plc_active ) - { - for ( i = crossOverFreq; i < max( crossOverFreq, hTonalMDCTConc->pTCI->lowerIndex[hTonalMDCTConc->pTCI->numIndexes - 1] ); ++i ) - { - concealment_noise[i] *= 0.0f; - } - } - /* restore common seed - - after finishing the first channel - - after a first subframe if the current channel is TCX10 */ - if ( ( idchan == 0 && ( core == TCX_20 || ( core == TCX_10 && subframe_idx == 1 ) ) ) || ( core == TCX_10 && subframe_idx == 0 ) ) - { - *rnd_c = save_rnd_c; - } - st->seed_tcx_plc = *rnd; - wmops_sub_end(); - - return; -} -void TonalMdctConceal_whiten_noise_shape( - Decoder_State *st, - const int16_t L_frame, - const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE whitening_mode ) -{ - int16_t inc, start_idx, stop_idx; - float *noiseLevelPtr, *scfs_bg, *scfs_for_shaping; - HANDLE_FD_CNG_COM hFdCngCom; - float whitenend_noise_shape[L_FRAME16k]; - float scfs_int[FDNS_NPTS]; - const PsychoacousticParameters *psychParams; - - push_wmops( "apply_sns_on_noise_shape" ); - - scfs_bg = &st->hTonalMDCTConc->scaleFactorsBackground_flt[0]; - psychParams = st->hTonalMDCTConc->psychParams; - hFdCngCom = st->hFdCngDec->hFdCngCom; - - inc = ( ( whitening_mode == ON_FIRST_LOST_FRAME ? st->core : st->last_core ) > TCX_20_CORE ) ? 2 : 1; - start_idx = hFdCngCom->startBand / inc; - stop_idx = L_frame / inc; - noiseLevelPtr = hFdCngCom->cngNoiseLevel_flt; - - set_zero( whitenend_noise_shape, start_idx ); - for ( int16_t j = start_idx; j < stop_idx; j++, noiseLevelPtr += inc ) - { - whitenend_noise_shape[j] = *noiseLevelPtr; - } - - if ( whitening_mode == ON_FIRST_LOST_FRAME ) - { - float scf[SNS_NPTS]; - - sns_compute_scf( whitenend_noise_shape, psychParams, L_frame, scf ); - sns_interpolate_scalefactors( scfs_int, scf, ENC ); - sns_interpolate_scalefactors( scfs_bg, scf, DEC ); - scfs_for_shaping = &scfs_int[0]; - } - else /* whitening_mode == ON_FIRST_GOOD_FRAME */ - { - scfs_for_shaping = &scfs_bg[0]; - } - - if ( sum_f( scfs_for_shaping, FDNS_NPTS ) > 0.0f ) - { - sns_shape_spectrum( whitenend_noise_shape, psychParams, scfs_for_shaping, L_frame ); - mvr2r( whitenend_noise_shape + start_idx, hFdCngCom->cngNoiseLevel_flt, stop_idx - start_idx ); - } - else - { - set_zero( hFdCngCom->cngNoiseLevel_flt, stop_idx - start_idx ); - } - - pop_wmops(); -} -#endif diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c index 0e1b951bb..81046fb19 100644 --- a/lib_dec/updt_dec_fx.c +++ b/lib_dec/updt_dec_fx.c @@ -576,23 +576,6 @@ void updt_dec_common_fx( test(); test(); test(); -#ifdef IVAS_CODE - /* Store long-term estimates of stab_fac and log energy diff to estimate env_stab in case of core switch ACELP/TCX->HQ */ - if ( st->element_mode != EVS_MONO ) - { - output_frame = NS2SA( st->output_Fs, FRAME_SIZE_NS ); - log_energy = log2f( ( sum2_f( synth, output_frame ) / output_frame ) + 1.0f ); - log_energy_diff = fabsf( st->log_energy_old - log_energy ); - st->log_energy_old = log_energy; - st->log_energy_diff_lt = ENV_SMOOTH_FAC * log_energy_diff + ( 1.0f - ENV_SMOOTH_FAC ) * st->log_energy_diff_lt; - if ( st->core == HQ_CORE ) - { - st->stab_fac = min( 1, ( STAB_FAC_EST1 + ( STAB_FAC_EST2 * st->hHQ_core->mem_env_delta ) + ( STAB_FAC_EST3 * st->log_energy_diff_lt ) ) ); - st->stab_fac = max( 0, st->stab_fac ); - } - st->stab_fac_smooth_lt = ENV_SMOOTH_FAC * st->stab_fac + ( 1.0f - ENV_SMOOTH_FAC ) * st->stab_fac_smooth_lt; - } -#endif IF( ( ( LE_32( st_fx->core_brate, SID_2k40 ) ) && EQ_16( st_fx->cng_type, FD_CNG ) ) || ( st_fx->tcxonly && EQ_16( st_fx->codec_mode, MODE2 ) ) ) { @@ -964,23 +947,6 @@ void ivas_updt_dec_common_fx( test(); test(); test(); -#ifdef IVAS_CODE - /* Store long-term estimates of stab_fac and log energy diff to estimate env_stab in case of core switch ACELP/TCX->HQ */ - if ( st->element_mode != EVS_MONO ) - { - output_frame = NS2SA( st->output_Fs, FRAME_SIZE_NS ); - log_energy = log2f( ( sum2_f( synth, output_frame ) / output_frame ) + 1.0f ); - log_energy_diff = fabsf( st->log_energy_old - log_energy ); - st->log_energy_old = log_energy; - st->log_energy_diff_lt = ENV_SMOOTH_FAC * log_energy_diff + ( 1.0f - ENV_SMOOTH_FAC ) * st->log_energy_diff_lt; - if ( st->core == HQ_CORE ) - { - st->stab_fac = min( 1, ( STAB_FAC_EST1 + ( STAB_FAC_EST2 * st->hHQ_core->mem_env_delta ) + ( STAB_FAC_EST3 * st->log_energy_diff_lt ) ) ); - st->stab_fac = max( 0, st->stab_fac ); - } - st->stab_fac_smooth_lt = ENV_SMOOTH_FAC * st->stab_fac + ( 1.0f - ENV_SMOOTH_FAC ) * st->stab_fac_smooth_lt; - } -#else IF( st_fx->element_mode != EVS_MONO ) { Word16 q_div = sub( Q31, shl( Qpostd, 1 ) ); @@ -1003,7 +969,6 @@ void ivas_updt_dec_common_fx( st_fx->stab_fac_smooth_lt_fx = extract_h( L_add( L_mult( ENV_SMOOTH_FAC_FX, st_fx->stab_fac_fx ), L_mult( sub( MAX_16, ENV_SMOOTH_FAC_FX ), st_fx->stab_fac_smooth_lt_fx ) ) ); // Q15 } -#endif test(); test(); diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index b031ca528..9dea812a6 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -462,7 +462,6 @@ void CNG_enc_fx( IF( hTdCngEnc->burst_ho_cnt > 0 ) { /**allow_cn_step |= ( hTdCngEnc->ho_ener_hist_fx[hTdCngEnc->ho_hist_ptr] > 4 * hTdCngEnc->lp_ener_fx ); */ -#if 1 /*allow_cn_step |= (hDtxEnc->first_CNG || st->element_mode == EVS_MONO) && (hTdCngEnc->ho_ener_hist[hTdCngEnc->ho_hist_ptr] > lp_ener_thr_scale * hTdCngEnc->lp_ener);*/ /* (hTdCngEnc->ho_ener_hist[hTdCngEnc->ho_hist_ptr] > lp_ener_thr_scale * hTdCngEnc->lp_ener); */ L_tmp1 = L_shr( hTdCngEnc->ho_ener_hist_fx[hTdCngEnc->ho_hist_ptr], 2 ); @@ -471,10 +470,6 @@ void CNG_enc_fx( L_tmp1 = L_add( L_tmp1, L_shr( hTdCngEnc->lp_ener_fx, 8 ) ); } L_tmp1 = L_sub( L_tmp1, hTdCngEnc->lp_ener_fx ); -#else - L_tmp1 = L_shr( hTdCngEnc->ho_ener_hist_fx[hTdCngEnc->ho_hist_ptr], 2 ); - L_tmp1 = L_sub( L_tmp1, hTdCngEnc->lp_ener_fx ); -#endif test(); test(); IF( ( hDtxEnc->first_CNG > 0 || st_fx->element_mode == EVS_MONO ) && L_tmp1 > 0 ) diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 4bb44eae2..c40db6678 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -138,487 +138,7 @@ void HBAutocorrelation_fx( move32(); } } -#ifdef ADD_IVAS_TNS -/*-------------------------------------------------------------------* - * TNSAnalysisStereo() - * - * - *-------------------------------------------------------------------*/ - -#define SIMILAR_TNS_THRESHOLD ( 0.04f ) -#define TNS_GAIN_THRESHOLD_FOR_WHITE ( 3.0f ) - -void TNSAnalysisStereo( - Encoder_State **sts, /* i : encoder state handle */ - float *mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* o : MDST spectrum */ - const int16_t bWhitenedDomain, /* i : whitened domain flag */ - int16_t tnsSize[MCT_MAX_CHANNELS][NB_DIV], /* i : number of tns parameters put into prm */ - int16_t tnsBits[MCT_MAX_CHANNELS][NB_DIV], /* i : number of tns bits in the frame */ - int16_t param_core[][NB_DIV * NPRM_DIV], /* o : TNS parameters */ - const int16_t mct_on /* i : flag mct block (1) or stereo (0) */ -) -{ - int16_t ch, k, L_spec, L_frame, nSubframes, iFilter; - float *spectrum; - Encoder_State *st = NULL; - TCX_ENC_HANDLE hTcxEnc = NULL; - int16_t individual_decision[NB_DIV]; - float maxPredictionGain = 0.f, meanPredictionGain; - - individual_decision[0] = 0; - individual_decision[1] = 0; - L_spec = -1; - L_frame = -1; - - /* TNS filter analysis, loop over channels */ - for ( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) - { - continue; - } - - hTcxEnc = st->hTcxEnc; - - nSubframes = ( hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; - - for ( k = 0; k < nSubframes; k++ ) - { - /* reset tns on whitened domain flag */ - if ( !bWhitenedDomain ) - { - hTcxEnc->bTnsOnWhithenedSpectra[k] = 0; - hTcxEnc->fUseTns[k] = 0; - } - - if ( st->hTcxCfg->fIsTNSAllowed && ( !bWhitenedDomain || hTcxEnc->bTnsOnWhithenedSpectra[k] ) ) - { - - spectrum = hTcxEnc->spectrum[k]; - L_frame = hTcxEnc->L_frameTCX; - st->hTcxCfg->pCurrentTnsConfig = &st->hTcxCfg->tnsConfig[hTcxEnc->transform_type[k] == TCX_20][( k == 0 ) && ( st->last_core == ACELP_CORE )]; - L_spec = st->hTcxCfg->pCurrentTnsConfig->iFilterBorders[0]; - - /*-----------------------------------------------------------* - * Temporal Noise Shaping analysis * - *-----------------------------------------------------------*/ - - if ( hTcxEnc->transform_type[k] == TCX_5 ) - { - /* rearrange LF sub-window lines prior to TNS analysis & filtering */ - tcx5TnsGrouping( L_frame >> 2, L_spec >> 1, spectrum ); - } - - /* WMOPS: All initializations are either for safety or static (tables) and thus not to be counted */ - ResetTnsData( &hTcxEnc->tnsData[k] ); - if ( st->hTcxCfg->pCurrentTnsConfig->maxOrder <= 0 ) - { - break; - } - - CalculateTnsFilt( st->hTcxCfg->pCurrentTnsConfig, spectrum, &hTcxEnc->tnsData[k], NULL ); - } - } - } - - if ( !mct_on ) - { - /* TNS decision */ - /* if framing differs between channels, keep the filter decision per channel */ - if ( ( sts[0]->hTcxEnc->transform_type[0] != sts[1]->hTcxEnc->transform_type[0] && - sts[0]->hTcxEnc->transform_type[1] != sts[1]->hTcxEnc->transform_type[1] ) || - sts[0]->hTcxCfg->fIsTNSAllowed != sts[1]->hTcxCfg->fIsTNSAllowed ) - { - individual_decision[0] = individual_decision[1] = 1; - } - else if ( bWhitenedDomain ) - { - nSubframes = ( sts[0]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; - for ( k = 0; k < nSubframes; k++ ) - { - if ( sts[0]->hTcxEnc->bTnsOnWhithenedSpectra[k] != sts[1]->hTcxEnc->bTnsOnWhithenedSpectra[k] ) - { - individual_decision[k] = 1; - } - } - } - - /* framing equal, check for similar filters, if very similar (also indicator for and M signal), - * use at least the same decision, maybe use the same filter - */ - { - int16_t isTCX10; - isTCX10 = ( sts[0]->hTcxEnc->tcxMode == TCX_20 ) ? 0 : 1; - - nSubframes = ( sts[0]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; - - for ( k = 0; k < nSubframes; k++ ) - { - if ( sts[0]->hTcxCfg->fIsTNSAllowed && individual_decision[k] != 1 && ( !bWhitenedDomain || sts[0]->hTcxEnc->bTnsOnWhithenedSpectra[k] ) ) - { - float maxPredGain = -1.0f; - sts[0]->hTcxCfg->pCurrentTnsConfig = &sts[0]->hTcxCfg->tnsConfig[sts[0]->hTcxEnc->transform_type[k] == TCX_20][( k == 0 ) && ( sts[0]->last_core == ACELP_CORE )]; - sts[1]->hTcxCfg->pCurrentTnsConfig = &sts[1]->hTcxCfg->tnsConfig[sts[1]->hTcxEnc->transform_type[k] == TCX_20][( k == 0 ) && ( sts[1]->last_core == ACELP_CORE )]; - -#ifdef DEBUGGING - assert( sts[0]->hTcxCfg->pCurrentTnsConfig->nMaxFilters == sts[1]->hTcxCfg->pCurrentTnsConfig->nMaxFilters ); -#endif - for ( iFilter = sts[0]->hTcxCfg->pCurrentTnsConfig->nMaxFilters - 1; iFilter >= 0; iFilter-- ) - { - STnsFilter *pFilter[2]; - struct TnsParameters const *pTnsParameters[2]; - pFilter[0] = sts[0]->hTcxEnc->tnsData[k].filter + iFilter; - pTnsParameters[0] = sts[0]->hTcxCfg->pCurrentTnsConfig->pTnsParameters + iFilter; - pFilter[1] = sts[1]->hTcxEnc->tnsData[k].filter + iFilter; - pTnsParameters[1] = sts[1]->hTcxCfg->pCurrentTnsConfig->pTnsParameters + iFilter; - -#ifdef DEBUGGING - assert( pTnsParameters[0]->startLineFrequency == pTnsParameters[1]->startLineFrequency ); - assert( pTnsParameters[0]->nSubdivisions == pTnsParameters[1]->nSubdivisions ); -#endif - /* if prediction gain and avgSqrCoef are both close we are pretty sure the filters are quite similar, use the avg of - * both filters for the decision - */ - meanPredictionGain = ( pFilter[0]->predictionGain + pFilter[1]->predictionGain ) * 0.5f; - maxPredictionGain = max( maxPredictionGain, meanPredictionGain ); - - if ( ( pFilter[0]->predictionGain > pTnsParameters[0]->minPredictionGain ) && ( sts[0]->element_brate < IVAS_80k ) && - ( pFilter[1]->predictionGain > pTnsParameters[1]->minPredictionGain ) && ( sts[0]->hTcxEnc->tnsData[k].nFilters == sts[1]->hTcxEnc->tnsData[k].nFilters ) ) - { - pFilter[0]->predictionGain = pFilter[1]->predictionGain = meanPredictionGain; /* more TNS filter sync at 48kbps */ - } - if ( ( fabs( pFilter[0]->predictionGain - pFilter[1]->predictionGain ) < SIMILAR_TNS_THRESHOLD * meanPredictionGain ) && - ( sts[0]->hTcxEnc->tnsData[k].nFilters == sts[1]->hTcxEnc->tnsData[k].nFilters ) ) - { - float maxAvgSqrCoef = max( pFilter[0]->avgSqrCoef, pFilter[1]->avgSqrCoef ); - float meanLtpGain = ( sts[0]->hTcxEnc->tcxltp_gain + sts[1]->hTcxEnc->tcxltp_gain ) * 0.5f; - maxPredGain = max( maxPredGain, meanPredictionGain ); - if ( ( meanPredictionGain > pTnsParameters[0]->minPredictionGain ) || ( maxAvgSqrCoef > pTnsParameters[0]->minAvgSqrCoef ) ) - { - if ( sts[0]->hTcxEnc->tnsData[k].nFilters > 0 || sts[1]->hTcxEnc->tnsData[k].nFilters > 0 || isTCX10 || meanLtpGain < 0.6f ) - { - ++sts[0]->hTcxEnc->tnsData[k].nFilters; - pFilter[0]->filterType = TNS_FILTER_ON; - ++sts[1]->hTcxEnc->tnsData[k].nFilters; - pFilter[1]->filterType = TNS_FILTER_ON; - } - else - { - const float maxEnergyChange = ( GetTCXMaxenergyChange( sts[0]->hTranDet, isTCX10, NSUBBLOCKS, 3 ) + GetTCXMaxenergyChange( sts[1]->hTranDet, isTCX10, NSUBBLOCKS, 3 ) ) * 0.5f; - - if ( maxEnergyChange >= pTnsParameters[0]->minEnergyChange ) - { - ++sts[0]->hTcxEnc->tnsData[k].nFilters; - pFilter[0]->filterType = TNS_FILTER_ON; - ++sts[1]->hTcxEnc->tnsData[k].nFilters; - pFilter[1]->filterType = TNS_FILTER_ON; - } - else - { - pFilter[0]->filterType = TNS_FILTER_OFF; - pFilter[1]->filterType = TNS_FILTER_OFF; - } - } - } - else if ( sts[0]->hTcxEnc->tnsData[k].nFilters > 0 && sts[1]->hTcxEnc->tnsData[k].nFilters > 0 ) /* If a previous filter is turned on */ - { - pFilter[0]->filterType = TNS_FILTER_ON_ZERO; - pFilter[1]->filterType = TNS_FILTER_ON_ZERO; - ++sts[0]->hTcxEnc->tnsData[k].nFilters; - ++sts[1]->hTcxEnc->tnsData[k].nFilters; - } - else if ( sts[0]->hTcxEnc->tnsData[k].nFilters != sts[1]->hTcxEnc->tnsData[k].nFilters ) /* sanity check */ - { - assert( 0 ); - } - else - { - pFilter[0]->filterType = TNS_FILTER_OFF; - pFilter[1]->filterType = TNS_FILTER_OFF; - } - if ( ( pFilter[0]->filterType == TNS_FILTER_ON ) && ( pFilter[1]->filterType == TNS_FILTER_ON ) && ( sts[0]->element_brate < IVAS_80k ) ) - { - int16_t tmpIntValue = 0; - int16_t tmpCoeff[TNS_MAX_FILTER_ORDER]; - int16_t i, maxOrder = max( pFilter[0]->order, pFilter[1]->order ); - - set_s( tmpCoeff, 0, TNS_MAX_FILTER_ORDER ); - for ( i = 0; i < maxOrder; i++ ) - { - tmpIntValue = (int16_t) max( tmpIntValue, abs( pFilter[0]->coefIndex[i] - pFilter[1]->coefIndex[i] ) ); - } - if ( tmpIntValue == 1 ) /* the TNS coefficients are sufficiently similar to equalize the two filters */ - { - for ( i = maxOrder - 1; i >= 0; i-- ) - { - tmpCoeff[i] = ( abs( pFilter[0]->coefIndex[i] ) < abs( pFilter[1]->coefIndex[i] ) ? pFilter[0]->coefIndex[i] : pFilter[1]->coefIndex[i] ); - if ( ( tmpIntValue > 0 ) && ( tmpCoeff[i] == 0 ) ) - { - maxOrder--; - } - else - { - tmpIntValue = 0; - } - } - /* make sure that maxOrder is non zero and not all coefficients are zero (could happen in rare cases) */ - if ( maxOrder > 0 ) - { - for ( i = TNS_MAX_FILTER_ORDER - 1; i >= 0; i-- ) - { - pFilter[0]->coefIndex[i] = pFilter[1]->coefIndex[i] = tmpCoeff[i]; - } - - pFilter[0]->order = pFilter[1]->order = maxOrder; - } - } - } - } - else - { - individual_decision[k] = 1; - } - } - - if ( individual_decision[k] == 0 ) - { - sts[0]->hTcxEnc->fUseTns[k] = ( sts[0]->hTcxEnc->tnsData[k].nFilters > 0 ) ? 1 : 0; - sts[1]->hTcxEnc->fUseTns[k] = ( sts[1]->hTcxEnc->tnsData[k].nFilters > 0 ) ? 1 : 0; - } - else - { - sts[0]->hTcxEnc->tnsData[k].nFilters = 0; - sts[1]->hTcxEnc->tnsData[k].nFilters = 0; - sts[0]->hTcxEnc->fUseTns[k] = 0; - sts[1]->hTcxEnc->fUseTns[k] = 0; - for ( iFilter = sts[0]->hTcxCfg->pCurrentTnsConfig->nMaxFilters - 1; iFilter >= 0; iFilter-- ) - { - sts[0]->hTcxEnc->tnsData[k].filter[iFilter].filterType = TNS_FILTER_OFF; - sts[1]->hTcxEnc->tnsData[k].filter[iFilter].filterType = TNS_FILTER_OFF; - } - } - - if ( !bWhitenedDomain && individual_decision[k] == 0 && maxPredGain < TNS_GAIN_THRESHOLD_FOR_WHITE && sts[0]->hTcxEnc->transform_type[k] != TCX_5 ) - { - sts[0]->hTcxEnc->bTnsOnWhithenedSpectra[k] = 1; - sts[1]->hTcxEnc->bTnsOnWhithenedSpectra[k] = 1; - sts[0]->hTcxEnc->tnsData[k].nFilters = 0; - sts[1]->hTcxEnc->tnsData[k].nFilters = 0; - sts[0]->hTcxEnc->fUseTns[k] = 0; - sts[1]->hTcxEnc->fUseTns[k] = 0; - for ( iFilter = sts[0]->hTcxCfg->pCurrentTnsConfig->nMaxFilters - 1; iFilter >= 0; iFilter-- ) - { - ClearTnsFilterCoefficients( sts[0]->hTcxEnc->tnsData[k].filter + iFilter ); - ClearTnsFilterCoefficients( sts[1]->hTcxEnc->tnsData[k].filter + iFilter ); - } - } - maxPredictionGain = max( maxPredictionGain, maxPredGain ); - } - } - } - } - - /* individual decision for each channel */ - for ( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) - { - continue; - } - - int16_t isTCX10; - isTCX10 = ( sts[ch]->hTcxEnc->tcxMode == TCX_20 ) ? 0 : 1; - - nSubframes = ( sts[ch]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; - - for ( k = 0; k < nSubframes; k++ ) - { - if ( sts[ch]->hTcxCfg->fIsTNSAllowed && ( individual_decision[k] || mct_on ) && - ( !bWhitenedDomain || sts[ch]->hTcxEnc->bTnsOnWhithenedSpectra[k] ) ) - { - float maxPredGain = -1.0f; - - sts[ch]->hTcxCfg->pCurrentTnsConfig = &sts[ch]->hTcxCfg->tnsConfig[sts[ch]->hTcxEnc->transform_type[k] == TCX_20][( k == 0 ) && ( sts[ch]->last_core == ACELP_CORE )]; - - for ( iFilter = sts[ch]->hTcxCfg->pCurrentTnsConfig->nMaxFilters - 1; iFilter >= 0; iFilter-- ) - { - STnsFilter *pFilter; - const struct TnsParameters *pTnsParameters; - pFilter = sts[ch]->hTcxEnc->tnsData[k].filter + iFilter; - pTnsParameters = sts[ch]->hTcxCfg->pCurrentTnsConfig->pTnsParameters + iFilter; - maxPredGain = max( maxPredGain, pFilter->predictionGain ); - - if ( ( pFilter->predictionGain > pTnsParameters->minPredictionGain ) || ( pFilter->avgSqrCoef > pTnsParameters->minAvgSqrCoef ) ) - { - if ( sts[ch]->hTcxEnc->tnsData[k].nFilters > 0 || isTCX10 || sts[ch]->hTcxEnc->tcxltp_gain < 0.6f ) - { - ++sts[ch]->hTcxEnc->tnsData[k].nFilters; - pFilter->filterType = TNS_FILTER_ON; - } - else - { - const float maxEnergyChange = GetTCXMaxenergyChange( sts[ch]->hTranDet, isTCX10, NSUBBLOCKS, 3 ); - - if ( maxEnergyChange >= pTnsParameters->minEnergyChange ) - { - ++sts[ch]->hTcxEnc->tnsData[k].nFilters; - pFilter->filterType = TNS_FILTER_ON; - } - else - { - pFilter->filterType = TNS_FILTER_OFF; - } - } - } - else if ( sts[ch]->hTcxEnc->tnsData[k].nFilters > 0 ) /* If a previous filter is turned on */ - { - pFilter->filterType = TNS_FILTER_ON_ZERO; - ++sts[ch]->hTcxEnc->tnsData[k].nFilters; - } - else - { - pFilter->filterType = TNS_FILTER_OFF; - } - } - - sts[ch]->hTcxEnc->fUseTns[k] = ( sts[ch]->hTcxEnc->tnsData[k].nFilters > 0 ) ? 1 : 0; - - if ( !bWhitenedDomain && maxPredGain < TNS_GAIN_THRESHOLD_FOR_WHITE && sts[ch]->hTcxEnc->transform_type[k] != TCX_5 ) - { - sts[ch]->hTcxEnc->fUseTns[k] = 0; - sts[ch]->hTcxEnc->bTnsOnWhithenedSpectra[k] = 1; - sts[ch]->hTcxEnc->tnsData[k].nFilters = 0; - for ( iFilter = sts[ch]->hTcxCfg->pCurrentTnsConfig->nMaxFilters - 1; iFilter >= 0; iFilter-- ) - { - ClearTnsFilterCoefficients( sts[ch]->hTcxEnc->tnsData[k].filter + iFilter ); - sts[ch]->hTcxEnc->tnsData[k].filter[iFilter].filterType = TNS_FILTER_OFF; - } - } - maxPredictionGain = max( maxPredictionGain, maxPredGain ); - } - } - } - - - /* we have the decision, set filter data accordingly */ - for ( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) - { - continue; - } - - nSubframes = ( sts[ch]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; - - for ( k = 0; k < nSubframes; k++ ) - { - if ( sts[ch]->hTcxCfg->fIsTNSAllowed && ( !bWhitenedDomain || sts[ch]->hTcxEnc->bTnsOnWhithenedSpectra[k] ) ) - { - sts[ch]->hTcxCfg->pCurrentTnsConfig = &sts[ch]->hTcxCfg->tnsConfig[sts[ch]->hTcxEnc->transform_type[k] == TCX_20][( k == 0 ) && ( sts[ch]->last_core == ACELP_CORE )]; - - for ( iFilter = sts[ch]->hTcxCfg->pCurrentTnsConfig->nMaxFilters - 1; iFilter >= 0; iFilter-- ) - { - STnsFilter *pFilter; - pFilter = sts[ch]->hTcxEnc->tnsData[k].filter + iFilter; - switch ( pFilter->filterType ) - { - case TNS_FILTER_OFF: - ClearTnsFilterCoefficients( sts[ch]->hTcxEnc->tnsData[k].filter + iFilter ); - break; - case TNS_FILTER_ON_ZERO: - /* Since TNS filter of order 0 is not allowed we have to signal in the stream filter of order 1 with the 0th coefficient equal to 0 */ - ClearTnsFilterCoefficients( pFilter ); - pFilter->order = 1; - break; - } - } - } - } - } - - /* Apply filters, loop over channels */ - for ( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - st = sts[ch]; - if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) - { - continue; - } - - nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; - - for ( k = 0; k < nSubframes; k++ ) - { - if ( bWhitenedDomain && ( ch > 0 ) && /* test for identical TNS filter data in both channels */ - sts[0]->hTcxCfg->fIsTNSAllowed && sts[0]->hTcxEnc->fUseTns[k] && - sts[1]->hTcxCfg->fIsTNSAllowed && sts[1]->hTcxEnc->fUseTns[k] ) - { - int16_t equalFilterData = ( sts[0]->hTcxCfg->pCurrentTnsConfig->nMaxFilters == sts[1]->hTcxCfg->pCurrentTnsConfig->nMaxFilters && - sts[0]->hTcxEnc->bTnsOnWhithenedSpectra[k] == sts[1]->hTcxEnc->bTnsOnWhithenedSpectra[k] && - sts[0]->hTcxEnc->tnsData[k].nFilters == sts[1]->hTcxEnc->tnsData[k].nFilters ) - ? 1 - : 0; - if ( equalFilterData ) - { - for ( iFilter = st->hTcxCfg->pCurrentTnsConfig->nMaxFilters - 1; iFilter >= 0; iFilter-- ) - { - const int16_t *pDataCh0 = (const int16_t *) &sts[0]->hTcxEnc->tnsData[k].filter[iFilter]; - const int16_t *pDataCh1 = (const int16_t *) &sts[1]->hTcxEnc->tnsData[k].filter[iFilter]; - int16_t i = 2 + TNS_MAX_FILTER_ORDER; /* excl. informative float data. Portable? */ - - while ( ( i >= 0 ) && ( pDataCh0[i] == pDataCh1[i] ) ) - { - i--; - } - if ( i >= 0 ) - { - equalFilterData = 0; - break; - } - } - if ( equalFilterData ) - { - st->hTcxEnc->tnsData[k].nFilters *= -1; /* signals common TNS */ - } - } - } - if ( st->hTcxCfg->fIsTNSAllowed && ( !bWhitenedDomain || st->hTcxEnc->bTnsOnWhithenedSpectra[k] ) ) - { - L_spec = st->hTcxCfg->pCurrentTnsConfig->iFilterBorders[0]; - spectrum = st->hTcxEnc->spectrum[k]; - /* If TNS should be used then get the residual after applying it inplace in the spectrum */ - if ( st->hTcxEnc->fUseTns[k] ) - { - st->hTcxCfg->pCurrentTnsConfig = &st->hTcxCfg->tnsConfig[st->hTcxEnc->transform_type[k] == TCX_20][( k == 0 ) && ( st->last_core == ACELP_CORE )]; - - ApplyTnsFilter( st->hTcxCfg->pCurrentTnsConfig, &st->hTcxEnc->tnsData[k], spectrum, 1 ); - } - - if ( st->hTcxEnc->transform_type[k] == TCX_5 ) - { - tcx5TnsUngrouping( L_frame >> 2, L_spec >> 1, st->hTcxEnc->spectrum[k], ENC ); - } - - st->hTcxEnc->tnsData[k].tnsOnWhitenedSpectra = st->hTcxEnc->bTnsOnWhithenedSpectra[k]; - - EncodeTnsData( st->hTcxCfg->pCurrentTnsConfig, &st->hTcxEnc->tnsData[k], param_core[ch] + k * NPRM_DIV + 1 + NOISE_FILL_RANGES + LTPSIZE, tnsSize[ch] + k, tnsBits[ch] + k ); - } - - if ( st->hTcxEnc->transform_type[k] == TCX_5 ) - { - tcx5SpectrumInterleaving( st->hTcxCfg->tcx5SizeFB, st->hTcxEnc->spectrum[k] ); - tcx5SpectrumInterleaving( st->hTcxCfg->tcx5SizeFB, mdst_spectrum[ch][k] ); - } - } - } - - return; -} - - -#endif void TNSAnalysis_fx( TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ Word16 L_frame, /* input: frame length */ @@ -1317,154 +837,6 @@ void ShapeSpectrum_ivas_fx( } } -#ifdef ADD_IVAS_TNS -/*-----------------------------------------------------------* - * EstimateStereoTCXNoiseLevel() - * - * Estimate and quantize stereo noise factors - *-----------------------------------------------------------*/ - -void EstimateStereoTCXNoiseLevel( - Encoder_State **sts, /* i : state handle */ - float *q_spectrum[CPE_CHANNELS][NB_DIV], /* i : quantized MDCT spectrum */ - float gain_tcx[][NB_DIV], /* i : global gain */ - int16_t L_frame[][NB_DIV], /* i : frame length */ - int16_t noiseFillingBorder[][NB_DIV], /* i : noise filling border */ - int16_t hm_active[][NB_DIV], /* i : flag indicating if the harmonic model is active */ - const int16_t ignore_chan[], /* i : flag indicating whether the channel should be ignored */ - float fac_ns[][NB_DIV], /* o : noise filling level */ - int16_t param_core[][NB_DIV * NPRM_DIV], /* o : quantized noise filling level */ - const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -) -{ - int16_t ch, n; - int16_t nSubframes, maxNfCalcBw, iStart, noiseTransWidth; - float smooth_gain; - float combined_q_spectrum[N_MAX]; - int16_t *fac_ns_q; - int32_t total_brate; - - for ( ch = 0; ch < CPE_CHANNELS; ch++ ) - { - Encoder_State *st = sts[ch]; - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - - nSubframes = ( st->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; - - if ( ignore_chan[ch] ) - { - continue; - } - total_brate = ( st->element_mode == IVAS_CPE_MDCT && !MCT_flag ) ? st->element_brate : st->total_brate; - - for ( n = 0; n < nSubframes; n++ ) - { - fac_ns_q = param_core[ch] + n * NPRM_DIV + 1; - maxNfCalcBw = min( noiseFillingBorder[ch][n], (int16_t) ( hTcxEnc->measuredBwRatio * (float) L_frame[ch][n] + 0.5f ) ); - if ( ( total_brate >= HQ_96k && ( st->element_mode <= IVAS_SCE || st->bwidth < SWB ) ) || total_brate > IVAS_192k ) - { - fac_ns[ch][n] = 0.0f; - *fac_ns_q = 0; - } - else - { - iStart = L_frame[ch][n] / ( ( total_brate >= ACELP_13k20 && !st->rf_mode ) ? 6 : 8 ); /* noise filling start bin*/ - - if ( n == 0 ) - { - mvr2r( hTcxEnc->ltpGainMemory, &hTcxEnc->ltpGainMemory[1], N_LTP_GAIN_MEMS - 1 ); - hTcxEnc->ltpGainMemory[0] = st->hTcxEnc->tcxltp_gain; - } - - smooth_gain = dotp( hTcxEnc->ltpGainMemory, nf_tw_smoothing_coeffs, N_LTP_GAIN_MEMS ); - - noiseTransWidth = GetTransWidth( st->tcxonly, ( L_frame[ch][n] == st->L_frame >> 1 ), smooth_gain, ( st->hTcxCfg->ctx_hm && st->last_core != ACELP_CORE && hm_active[ch][n] ) ); - - mvr2r( q_spectrum[ch][n], combined_q_spectrum, L_frame[ch][n] ); - tcx_noise_factor( hTcxEnc->spectrum[n], combined_q_spectrum, iStart, maxNfCalcBw, noiseTransWidth, L_frame[ch][n], gain_tcx[ch][n], hTcxEnc->noiseTiltFactor, &fac_ns[ch][n], fac_ns_q, st->element_mode ); - - /* hysteresis for very tonal passages (more stationary noise filling level) */ - if ( *fac_ns_q == 1 ) - { - hTcxEnc->noiseLevelMemory_cnt = (int16_t) min( INT16_MAX, 1 + abs( hTcxEnc->noiseLevelMemory_cnt ) ); /* update counter */ - } - else - { - if ( ( *fac_ns_q == 2 ) && ( abs( hTcxEnc->noiseLevelMemory_cnt ) > 5 ) ) - { - *fac_ns_q = 1; /* reduce noise filling level by one step */ - fac_ns[ch][n] = 0.75f / ( 1 << NBITS_NOISE_FILL_LEVEL ); - - /* signal that noise level is changed by inverting sign of level memory */ - hTcxEnc->noiseLevelMemory_cnt = ( hTcxEnc->noiseLevelMemory_cnt < 0 ) ? 5 : -1 - hTcxEnc->noiseLevelMemory_cnt; - } - else - { - hTcxEnc->noiseLevelMemory_cnt = 0; /* reset memory since level is too different */ - } - } - } /* bitrate */ - } -#ifdef DEBUG_MODE_MDCT - dbgwrite( &smooth_gain, sizeof( float ), 1, 1, "./res/smooth_gain" ); - dbgwrite( &st->hTcxEnc->tcxltp_gain, sizeof( float ), 1, 1, "./res/tcxltp_gain" ); - dbgwrite( &noiseTransWidth, sizeof( int16_t ), 1, 1, "./res/noiseTrans" ); - dbgwrite( &fac_ns[ch][0], sizeof( float ), 2, 1, "./res/fac_ns" ); -#endif - } - - return; -} - - -/*-----------------------------------------------------------* - * DecideTonalSideInfo() - * - * - *-----------------------------------------------------------*/ - -static int16_t DecideTonalSideInfo( - const float spectrum[], - const int16_t L_frame_glob, - float SFM2 ) -{ - float SFM, K, K2; - int16_t Tonal_SideInfo; - - SFM = SFM_Cal( spectrum, min( 200, L_frame_glob ) ); - - if ( L_frame_glob <= 256 ) - { - K = 0.4f; - K2 = 0.1f; - } - else if ( L_frame_glob == 320 || L_frame_glob == 512 ) - { - K = 0.4f; - K2 = 0.1f; - } - else /*FrameSize_Core == 640*/ - { - K = 0.35f; - K2 = 0.04f; - } - - - Tonal_SideInfo = 0; - if ( SFM < K ) - { - Tonal_SideInfo = 1; - } - - if ( SFM2 < K2 ) - { - Tonal_SideInfo = 1; - } - - return Tonal_SideInfo; -} -#endif - /*-------------------------------------------------------------------* * GetTransWidth() * diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 05f838a3a..5c0e4911c 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -53,14 +53,7 @@ void init_coder_ace_plus_fx( /* Bitrate */ st->tcxonly = (Word8) getTcxonly( -#ifdef IVAS_CODE_SWITCHING - st->element_mode, -#endif st->total_brate -#ifdef IVAS_CODE_SWITCHING - , - MCT_flag, st->is_ism_format -#endif ); move16(); diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index 2f21f1015..fb5fd037a 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -49,11 +49,7 @@ void core_coder_mode_switch_fx( switchWB = 1; /*force init when coming from MODE1*/ } -#ifdef IVAS_CODE_SWITCHING - tcxonly_tmp = getTcxonly( 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 ) ) { @@ -71,11 +67,7 @@ void core_coder_mode_switch_fx( move32(); st->L_frame = extract_l( Mult_32_16( st->sr_core, 0x0290 ) ); assert( st->L_frame == st->sr_core / 50 ); -#ifdef IVAS_CODE_SWITCHING - st->tcxonly = getTcxonly( 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 */ @@ -118,9 +110,6 @@ void core_coder_mode_switch_fx( IF( st->hTcxCfg->fIsTNSAllowed != 0 ) { InitTnsConfigs( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, MCT_flag ); -#ifdef IVAS_CODE - SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, EQ_16( st->element_mode, IVAS_CPE_MDCT ) ); -#endif } st->narrowBand = 0; diff --git a/lib_enc/core_enc_updt_fx.c b/lib_enc/core_enc_updt_fx.c index ce2681e75..dcf57738a 100644 --- a/lib_enc/core_enc_updt_fx.c +++ b/lib_enc/core_enc_updt_fx.c @@ -48,20 +48,6 @@ void core_encode_update_fx( Encoder_State *st ) if ( hTcxEnc != NULL ) { Copy( hTcxEnc->buf_speech_ltp + st->L_frame, hTcxEnc->buf_speech_ltp, n ); - -#ifdef IVAS_CODE - IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) - { - st->hTcxEnc->kernel_switch_corr_past = 0.f; - st->hTcxEnc->kernel_type[0] = MDCT_IV; - st->hTcxEnc->kernel_symmetry_past = 0; - st->hTcxEnc->enc_ste_pre_corr_past = 0; - move16(); - move16(); - move16(); - move16(); - } -#endif } /* Update previous mode */ diff --git a/lib_enc/enc_pit_exc_fx.c b/lib_enc/enc_pit_exc_fx.c index 9180d73b8..f16dd80cb 100644 --- a/lib_enc/enc_pit_exc_fx.c +++ b/lib_enc/enc_pit_exc_fx.c @@ -250,13 +250,8 @@ void enc_pit_exc_fx( *----------------------------------------------------------------*/ Copy( &res[i_subfr], &exc[i_subfr], L_subfr ); /* Q_new */ /* condition on target (compared to float) has been put outside the loop */ -#if 1 // ndef BUG_FIX find_targets_fx( speech, hLPDmem->mem_syn, i_subfr, &hLPDmem->mem_w0, p_Aq, res, L_subfr, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); -#else - find_targets_fx( speech, hGSCEnc->mem_syn_tmp_fx, i_subfr, &hLPDmem->mem_w0, p_Aq, /*_DIFF_FLOAT_FIX_ --> Here I think mem_syn_tmp_fx should be used */ - res, L_subfr, p_Aw, st_fx->preemph_fac, xn, cn, h1 ); -#endif Copy_Scale_sig( h1, h2, L_subfr, -2 ); /* Q13 */ Scale_sig( h1, L_subfr, add( 1, shift ) ); /* set h1[] in Q14 with scaling for convolution */ diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c index 396e97c6f..624ec20fc 100644 --- a/lib_enc/evs_enc_fx.c +++ b/lib_enc/evs_enc_fx.c @@ -169,18 +169,6 @@ ivas_error evs_enc_fx( { updt_IO_switch_enc_fx( st, input_frame ); set16_fx( hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); -#if defined IVAS_CODE - PMT( "find scaling factor for prev_enr_EnvSHBres, prev_pow_exc16kWhtnd and prev_mix_factor " ) - set16_fx( st->hBWE_TD->old_speech_shb, 0, L_LOOK_16k + L_SUBFR16k ); - set16_fx( st->hBWE_TD->mem_shb_res, 0, MAX_LEN_MA_FILTER ); - set16_fx( st->hBWE_TD->old_EnvSHBres, 0, L_FRAME4k ); - st->hBWE_TD->old_mean_EnvSHBres = 0; - st->hBWE_TD->prev_enr_EnvSHBres = 1.0f; - st->hBWE_TD->prev_shb_env_tilt = 0; - st->hBWE_TD->prev_pow_exc16kWhtnd = 1.0f; - st->hBWE_TD->prev_mix_factor = 1.0f; - st->hBWE_TD->prev_Env_error = 0; -#endif cldfb_reset_memory( st->cldfbAnaEnc ); cldfb_reset_memory( st->cldfbSynTd ); } @@ -466,16 +454,6 @@ ivas_error evs_enc_fx( { set16_fx( hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); set16_fx( shb_speech, 0, L_FRAME16k ); -#if defined IVAS_CODE - set_f( st->hBWE_TD->mem_shb_res, 0.0f, MAX_LEN_MA_FILTER ); - set_f( st->hBWE_TD->old_EnvSHBres, 0.0f, L_FRAME4k ); - st->hBWE_TD->old_mean_EnvSHBres = 0.0f; - st->hBWE_TD->prev_enr_EnvSHBres = 1.0f; - st->hBWE_TD->prev_shb_env_tilt = 0.0f; - st->hBWE_TD->prev_pow_exc16kWhtnd = 1.0f; - st->hBWE_TD->prev_mix_factor = 1.0f; - st->hBWE_TD->prev_Env_error = 0.0f; -#endif } /* SWB TBE encoder */ diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index eeeb294b4..49d757be3 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -70,24 +70,12 @@ void core_signal_analysis_high_bitrate_fx( Word32 *tmpP32; Word16 Q_exp; -#ifdef IVAS_CODE - int16_t disable_ltp = 0; -#endif TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -#ifndef IVAS_CODE /* dummy */ (void) vad_hover_flag; (void) last_element_mode; -#endif -#ifdef IVAS_CODE - if ( NE_16( last_element_mode, st->element_mode ) ) - { - disable_ltp = 1; /* disable TCX-LTP in stereo switching to avoid discontinuities in synthesis */ - move16(); - } -#endif left_overlap = -1; move16(); right_overlap = -1; @@ -300,15 +288,6 @@ void core_signal_analysis_high_bitrate_fx( WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno], overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, tcx20Win, st->element_mode != IVAS_CPE_MDCT /* truncate_aldo */, 1 ); -#ifdef IVAS_CODE - if ( windowed_samples != NULL ) /* save windowed speech_TCX samples */ - { - assert( L_subframe + ( left_overlap + right_overlap ) / 2 < 2 * L_FRAME_MAX / nSubframes - L_FRAME_MAX / 8 ); - windowed_samples[frameno * L_FRAME_MAX + 0] = (float) overlap_mode[frameno]; - windowed_samples[frameno * L_FRAME_MAX + 1] = (float) overlap_mode[frameno + 1]; - mvr2r( tcx20Win, windowed_samples + frameno * L_FRAME_MAX + 2, L_subframe + ( left_overlap + right_overlap ) / 2 ); - } -#endif } IF( EQ_16( transform_type[frameno], TCX_5 ) ) @@ -321,15 +300,6 @@ void core_signal_analysis_high_bitrate_fx( tcx20Win[folding_offset + i] = sub_sat( tcx20Win[folding_offset + i], tcx20Win[folding_offset - 1 - i] ); // Q0 move16(); } -#ifdef IVAS_CODE - if ( st->element_mode == IVAS_CPE_MDCT && frameno == 0 && overlap_mode[0] == FULL_OVERLAP && L_subframe - left_overlap > minWindowLen ) - { - for ( i = minWindowLen; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ - { - tcx20Win[left_overlap + i] -= hTcxEnc->speech_TCX[-1 - i] * st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] * st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i]; - } - } -#endif /* Outter right folding */ tmp = shr( right_overlap, 1 ); FOR( i = 0; i < tmp; i++ ) @@ -365,13 +335,6 @@ void core_signal_analysis_high_bitrate_fx( tmpP16 += tcx5SizeFB; tmpP32 += tcx5SizeFB; -#ifdef IVAS_CODE - /* high-band gain control in case of BWS */ - if ( st->bwidth_sw_cnt > 0 ) - { - v_multc( hTcxEnc->spectrum[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, hTcxEnc->spectrum[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), L_subframe - L_FRAME16k / ( 2 * nSubframes ) ); - } -#endif } } ELSE /* transform_type[frameno] != TCX_5 */ @@ -414,33 +377,12 @@ void core_signal_analysis_high_bitrate_fx( } ELSE { -#ifdef IVAS_CODE - if ( st->element_mode == IVAS_CPE_MDCT && frameno == 0 && transform_type[0] == TCX_10 && overlap_mode[0] == FULL_OVERLAP && L_subframe - left_overlap > minWindowLen ) - { - for ( i = minWindowLen; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ - { - tcx20Win[left_overlap + i] -= hTcxEnc->speech_TCX[-1 - i] * st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] * st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i]; - } - } -#endif TCX_MDCT( tcx20Win, spectrum[frameno], &spectrum_e[frameno], left_overlap, sub( L_subframe, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st->element_mode ); } /* For TCX20 at bitrates up to 64 kbps we need the power spectrum */ /* high-band gain control in case of BWS */ -#ifdef IVAS_CODE - if ( st->bwidth_sw_cnt > 0 ) - { - v_multc( hTcxEnc->spectrum[frameno] + L_FRAME16k / nSubframes, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, hTcxEnc->spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); - } - - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - set_f( &hTcxEnc->spectrum[frameno][MCT_LFE_MAX_LINE], 0.f, L_subframe - MCT_LFE_MAX_LINE ); - st->hTcxCfg->tcx_coded_lines = MCT_LFE_MAX_LINE; - } -#endif IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { test(); @@ -461,94 +403,6 @@ void core_signal_analysis_high_bitrate_fx( pMdstWin, powerSpec, &powerSpec_e ); } } -#ifdef IVAS_CODE - if ( st->element_mode == IVAS_CPE_MDCT ) - { - L_subframe = L_frameTCX / nSubframes; - - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { - wtda_ext( hTcxEnc->new_speech_TCX, mdstWin, overlap_mode[frameno], overlap_mode[frameno + 1], L_frameTCX, 3 ); - } - else - { - /* Windowing for the MDST */ - WindowSignal( st->hTcxCfg, st->hTcxCfg->tcx_offsetFB, overlap_mode[frameno] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno], overlap_mode[frameno + 1] == ALDO_WINDOW ? FULL_OVERLAP : overlap_mode[frameno + 1], &left_overlap, &right_overlap, &hTcxEnc->speech_TCX[frameno * tcx10SizeFB], &L_subframe, mdstWin, 0, 1 ); - } - - if ( transform_type[frameno] == TCX_5 ) - { - /* Outer left folding */ - for ( i = 0; i < left_overlap / 2; i++ ) - { - mdstWin[left_overlap / 2 + i] += mdstWin[left_overlap / 2 - 1 - i]; - } - - if ( frameno == 0 && overlap_mode[0] == FULL_OVERLAP && L_subframe - left_overlap > minWindowLen ) - { - for ( i = minWindowLen; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ - { - mdstWin[left_overlap + i] += hTcxEnc->speech_TCX[-1 - i] * st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] * st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i]; - } - } - - /* Outer right folding */ - for ( i = 0; i < right_overlap / 2; i++ ) - { - mdstWin[L_subframe + left_overlap / 2 - 1 - i] -= mdstWin[L_subframe + left_overlap / 2 + i]; - } - - /* 2xTCX5 */ - L_subframe = tcx5SizeFB; - folding_offset = left_overlap / 2; - - for ( i = 0; i < 2; i++ ) - { - assert( st->mct_chan_mode != MCT_CHAN_MODE_LFE ); - WindowSignal( st->hTcxCfg, folding_offset, i == 0 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, i == 1 ? RECTANGULAR_OVERLAP : MIN_OVERLAP, &left_overlap, &right_overlap, mdstWin + i * tcx5SizeFB, &L_subframe, tcx5Win, 0, 1 ); - - TCX_MDST( tcx5Win, mdst_spectrum[frameno] + i * tcx5SizeFB, left_overlap, L_subframe - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); - /* high-band gain control in case of BWS */ - if ( st->bwidth_sw_cnt > 0 ) - { - v_multc( mdst_spectrum[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, mdst_spectrum[frameno] + i * tcx5SizeFB + L_FRAME16k / ( 2 * nSubframes ), L_subframe - L_FRAME16k / ( 2 * nSubframes ) ); - } - } - } - else /* transform_type[frameno] != TCX_5 */ - { - if ( transform_type[frameno] == TCX_20 && st->hTcxCfg->tcx_last_overlap_mode != TRANSITION_OVERLAP && st->mct_chan_mode != MCT_CHAN_MODE_LFE ) - { - edst( mdstWin, mdst_spectrum[frameno], L_subframe, st->element_mode ); - - v_multc( mdst_spectrum[frameno], (float) sqrt( (float) NORM_MDCT_FACTOR / L_subframe ), mdst_spectrum[frameno], L_subframe ); - } - else - { - if ( frameno == 0 && transform_type[0] == TCX_10 && overlap_mode[0] == FULL_OVERLAP && L_subframe - left_overlap > minWindowLen ) - { - for ( i = minWindowLen; i >= 0; i-- ) /* outer left folding of shortened long ALDO slope */ - { - mdstWin[left_overlap + i] += hTcxEnc->speech_TCX[-1 - i] * st->hTcxCfg->tcx_aldo_window_1_FB[left_overlap / 2 + minWindowLen - i] * st->hTcxCfg->tcx_mdct_window_minimumFB[minWindowLen - i]; - } - } - - TCX_MDST( mdstWin, mdst_spectrum[frameno], left_overlap, L_subframe - ( left_overlap + right_overlap ) / 2, right_overlap, st->element_mode ); - } - - /* high-band gain control in case of BWS */ - if ( st->bwidth_sw_cnt > 0 ) - { - v_multc( mdst_spectrum[frameno] + L_FRAME16k / nSubframes, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, mdst_spectrum[frameno] + L_FRAME16k / nSubframes, L_subframe - L_FRAME16k / nSubframes ); - } - } - - if ( st->mct_chan_mode == MCT_CHAN_MODE_LFE ) - { - set_f( &mdst_spectrum[frameno][MCT_LFE_MAX_LINE], 0.f, L_subframe - MCT_LFE_MAX_LINE ); - } - } -#endif } IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) @@ -559,9 +413,6 @@ void core_signal_analysis_high_bitrate_fx( st->hTcxCfg->tcx_coded_lines, transform_type[frameno], ( frameno == 0 ) && ( st->last_core == ACELP_CORE ), spectrum[frameno], &hTcxEnc->tnsData[frameno], &hTcxEnc->fUseTns[frameno], NULL ); -#ifdef IVAS_CODE - IF( st->hTcxCfg->fIsTNSAllowed ) -#endif { EncodeTnsData_fx( st->hTcxCfg->pCurrentTnsConfig, &hTcxEnc->tnsData[frameno], param_core + frameno * NPRM_DIV + 1 + NOISE_FILL_RANGES + LTPSIZE, pTnsSize + frameno, pTnsBits + frameno ); @@ -583,9 +434,6 @@ void core_signal_analysis_high_bitrate_fx( * LPC analysis *---------------------------------------------------------------*/ -#ifdef IVAS_CODE - IF( st->tcxonly ) -#endif { HBAutocorrelation_fx( st->hTcxCfg, lpc_left_overlap_mode, lpc_right_overlap_mode, &st->speech_enc_pe[frameno * tcx10Size], shr( L_frame, sub( nSubframes, 1 ) ), r, M ); diff --git a/lib_enc/hq_classifier_enc_fx.c b/lib_enc/hq_classifier_enc_fx.c index 558ae89a7..aa2c319f1 100644 --- a/lib_enc/hq_classifier_enc_fx.c +++ b/lib_enc/hq_classifier_enc_fx.c @@ -194,7 +194,6 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits Word16 *hqswb_clas /* o : HQ class Q0 */ ) { -#ifndef SOLVED_COMP_ENC_DEC Word16 bits; HQ_ENC_HANDLE hHQ_core = st_fx->hHQ_core; @@ -277,88 +276,7 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits *hqswb_clas = HQ_GEN_SWB; /* Q0 */ move16(); } -#else - Word16 bits; - HQ_ENC_HANDLE hHQ_core = st_fx->hHQ_core; - Word32 max_brate; - Word16 harmonic_decision; - - - max_brate = HQ_32k; - move32(); - if ( st_fx->element_mode > EVS_MONO ) - { - max_brate = HQ_48k; - move32(); - } - - *hqswb_clas = HQ_NORMAL; - bits = 1; - move16(); - IF( EQ_16( is_transient, 1 ) ) - { - *hqswb_clas = HQ_TRANSIENT; - move16(); - } - - /* classification and limit bandwidth for bit allocation */ - test(); - IF( EQ_16( length, L_SPEC32k ) || EQ_16( length, L_SPEC48k ) ) - { - IF( LE_32( st_fx->core_brate, max_brate ) ) - { - test(); - IF( !is_transient && EQ_16( st_fx->bwidth, st_fx->last_bwidth ) ) - { - /* Detect HQ_HARMONIC mode */ - *hqswb_clas = peak_avrg_ratio_fx( st_fx->total_brate, coefs, NUMC_N + 96, &hHQ_core->mode_count, &hHQ_core->mode_count1, 12 ); - -#if 0 - harmonic_decision = hf_spectrum_sparseness( st, coefs ); -#else - harmonic_decision = 0; - move16(); -#endif - test(); - IF( EQ_16( *hqswb_clas, HQ_HARMONIC ) && !harmonic_decision ) - { - *hqswb_clas = HQ_NORMAL; - move16(); - } - ELSE - { - /* Detect harmonic VQ mode HQ_HVQ */ - hvq_classifier_fx( coefs, &hHQ_core->prev_Npeaks, hHQ_core->prev_peaks, hqswb_clas, Npeaks, peaks, st_fx->core_brate, st_fx->last_core, - nf_gains, &hHQ_core->hvq_hangover, pe_gains ); - } - } - bits = 2; - move16(); - } - } - ELSE IF( EQ_16( length, L_SPEC16k_EXT ) || EQ_16( length, L_SPEC48k_EXT ) ) - { - bits = 0; /* HQ_NORMAL only -- no signalling needed */ - move16(); - } - /* write signalling info to the bitstream */ - 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 ) ) - { - IF( EQ_16( length, L_SPEC32k ) ) - { - *hqswb_clas = HQ_GEN_SWB; - move16(); - } - ELSE IF( EQ_16( length, L_SPEC48k ) ) - { - *hqswb_clas = HQ_GEN_FB; - move16(); - } - } -#endif return bits; } Word16 hq_classifier_enc_ivas_fx( /* o : Consumed bits Q0 */ @@ -677,11 +595,8 @@ Word16 peak_avrg_ratio_fx( test(); test(); test(); -#ifndef SOLVED_COMP_ENC_DEC /*This affect BE even if it shouldn't*/ + IF( ( GE_16( add( k, k1 ), 5 ) && GT_16( k1, 2 ) && EQ_32( total_brate, HQ_24k40 ) ) || ( ( ( GE_16( add( k, k1 ), 10 ) && GT_16( k1, 5 ) ) || GE_16( *mode_count, 5 ) ) && LT_16( *mode_count1, 5 ) ) ) -#else - if ( ( GE_16( add( k, k1 ), 5 ) && GT_16( k1, 2 ) && LT_32( total_brate, HQ_BWE_CROSSOVER_BRATE ) ) || ( ( ( GE_16( add( k, k1 ), 10 ) && GT_16( k1, 5 ) ) || GE_16( *mode_count, 5 ) ) && LT_16( *mode_count1, 5 ) ) ) -#endif { hqswb_clas = HQ_HARMONIC; move16(); @@ -1177,11 +1092,7 @@ void hvq_classifier_fx( L_input_max = L_deposit_l( 0 ); set32_fx( L_thr, 0, L_FRAME16k ); -#ifndef SOLVED_COMP_ENC_DEC IF( EQ_32( L_core_brate, HQ_24k40 ) ) -#else - IF( LT_32( L_core_brate, HQ_BWE_CROSSOVER_BRATE ) ) -#endif { nsub = HVQ_NSUB_24k; move16(); @@ -1420,7 +1331,6 @@ void hvq_classifier_fx( num_peak_cands = add( num_peak_cands, 1 ); } } -#ifndef ADD_IVAS_HQ_CODE IF( EQ_32( L_core_brate, HQ_24k40 ) ) { peak_th = HVQ_MAX_PEAKS_24k_CLAS; @@ -1431,9 +1341,6 @@ void hvq_classifier_fx( peak_th = HVQ_MAX_PEAKS_32k; move16(); } -#else - peak_th = (int16_t) ( ( core_brate * HVQ_PEAKS_PER_DELTA_THR + HVQ_PEAKS_PER_DELTA_THR_OFFS ) / HVQ_PEAKS_BPS_DELTA ); -#endif /* Find peaks */ pindx = maximum_32_fx( L_input_abs, num_peak_cands, &L_m ); i = 0; @@ -1555,7 +1462,6 @@ void hvq_classifier_fx( move16(); } -#ifndef ADD_IVAS_HQ_CODE IF( EQ_32( L_core_brate, HQ_24k40 ) ) { *Npeaks = s_min( HVQ_MAX_PEAKS_24k, *Npeaks ); /* Q0 */ @@ -1566,9 +1472,6 @@ void hvq_classifier_fx( *Npeaks = s_min( HVQ_MAX_PEAKS_32k, *Npeaks ); /* Q0 */ move16(); } -#else - *Npeaks = (int16_t) ( min( ( core_brate * HVQ_PEAKS_PER_DELTA + HVQ_PEAKS_PER_DELTA_OFFS ) / HVQ_PEAKS_BPS_DELTA, *Npeaks ) ); -#endif } ELSE { @@ -1581,99 +1484,3 @@ void hvq_classifier_fx( return; } - -#ifdef ADD_IVAS_HQ_CODE -/*--------------------------------------------------------------------------* - * hf_spectrum_sparseness() - * - * Detection of sparse spectrum in high band for activation of harmonic - * modes HQ_HARMONIC and HQ_HVQ - *--------------------------------------------------------------------------*/ -/*! r: Harmonic decision for high band */ -static int16_t hf_spectrum_sparseness( - Encoder_State *st, /* i/o: encoder state structure */ - const float *coefs /* i : MDCT spectrum */ -) -{ - int16_t i; - float thr; - int16_t low_count; - float A[L_SPEC_HB]; - float Amax; - float movmean; - float inv_rms; - float crest; - float crest_mod; - const float *p_num; - float *crest_lp; - float *crest_mod_lp; - int16_t result; - - crest_lp = &st->hHQ_core->crest_lp; - crest_mod_lp = &st->hHQ_core->crest_mod_lp; - - result = TRUE; - if ( st->element_mode != EVS_MONO ) - { - for ( i = 0; i < L_SPEC_HB; i++ ) - { - A[i] = (float) fabsf( coefs[i + L_SPEC_HB] ); - } - low_count = 0; - inv_rms = 0.0f; - crest_mod = 0.0f; - maximum( A, L_SPEC_HB, &Amax ); - thr = Amax * PEAK_THRESHOLD; - movmean = 0.0f; /* avoid uninitialized warning */ - p_num = &inv_tbl[HALF_WIN_LENGTH + 1]; /* Table for division 1./(11:21) */ - for ( i = 0; i < L_SPEC_HB; i++ ) - { - inv_rms += A[i] * A[i]; - if ( A[i] < thr ) - { - low_count += 1; - } - if ( i <= HALF_WIN_LENGTH ) - { - if ( i == 0 ) - { - movmean = sum_f( &A[0], i + HALF_WIN_LENGTH + 1 ) * ( *p_num ); - } - else - { - p_num++; - movmean = movmean + ( A[i + HALF_WIN_LENGTH] - movmean ) * ( *p_num ); - } - } - else - { - if ( L_SPEC_HB <= i + HALF_WIN_LENGTH ) - { - p_num--; - movmean = movmean + ( movmean - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num ); - } - else - { - movmean = movmean + ( A[i + HALF_WIN_LENGTH] - A[i - HALF_WIN_LENGTH - 1] ) * ( *p_num ); - } - } - if ( crest_mod < movmean ) - { - crest_mod = movmean; - } - } - inv_rms = 1.0f / (float) sqrtf( inv_rms / L_SPEC_HB ); - crest = Amax * inv_rms; - crest_mod = crest_mod * inv_rms; - *crest_lp = HQ_CREST_FAC_SM * ( *crest_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest; - *crest_mod_lp = HQ_CREST_FAC_SM * ( *crest_mod_lp ) + ( 1.0f - HQ_CREST_FAC_SM ) * crest_mod; - - if ( ( ( *crest_lp ) > HQ_CREST_THRESHOLD ) && ( ( *crest_mod_lp ) > HQ_CREST_MOD_THRESHOLD ) && ( low_count > LOW_COUNT_THRESHOLD ) ) - { - result = FALSE; - } - } - - return result; -} -#endif diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index 66430cb8e..b5e1abbca 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -35,15 +35,6 @@ void hq_core_enc_fx( Word16 tmp; Word32 L_tmp; UWord16 lsb; -#ifdef ADD_IVAS_HQ_CODE_L_SPEC - Word16 L_spec; -#endif -#ifdef ADD_IVAS_HQ_CODE - Word16 left_overlap, right_overlap; - Word16 overlap, nz, tcx_offset, L_frame; - Word16 Aq_old[M + 1]; - Word16 output[L_FRAME16k]; -#endif Word16 two_frames_buffer[2 * L_FRAME48k]; BSTR_ENC_HANDLE hBstr = st_fx->hBstr; @@ -87,37 +78,6 @@ void hq_core_enc_fx( is_transient = detect_transient_fx( audio, input_frame, 0, st_fx ); /* Q0 */ -#ifdef ADD_IVAS_HQ_CODE - test(); - test(); - test(); - IF( ( st_fx->element_mode > EVS_MONO ) && ( ( st_fx->last_core == ACELP_CORE ) || EQ_16( st_fx->last_core, AMR_WB_CORE ) ) ) - { - /*-------------------------------------------------------------------------- - * IVAS switching frame - *--------------------------------------------------------------------------*/ - - L_spec = input_frame; - left_overlap = -1; - right_overlap = -1; - move16(); - move16(); - move16(); - - WindowSignal( &( st_fx->tcx_cfg ), st_fx->hTcxCfg->tcx_offsetFB, TRANSITION_OVERLAP, FULL_OVERLAP, &left_overlap, &right_overlap, st_fx->hTcxEnc->speech_TCX, &L_spec, wtda_audio, 1, 1 ); - Q_audio = 16; - move16(); /*tbv inspired from core_enc_ol*/ - TCX_MDCT( wtda_audio, t_audio, &Q_audio, left_overlap, sub( L_spec, shr( add( left_overlap, right_overlap ), 1 ) ), right_overlap, st_fx->element_mode ); - - inner_frame = inner_frame_tbl[st_fx->bwidth]; - L_spec = l_spec_ext_tbl[st_fx->bwidth]; - is_transient = 0; - move16(); - move16(); - move16(); - } - ELSE -#endif { /*-------------------------------------------------------------------------- * Windowing and time-domain aliasing @@ -144,10 +104,8 @@ void hq_core_enc_fx( move16(); } } -#ifndef ADD_IVAS_HQ_CODE /* subtract signalling bits */ num_bits = sub( num_bits, hBstr->nb_bits_tot ); /* Q0 */ -#endif direct_transform_fx( wtda_audio, t_audio, is_transient, input_frame, &Q_audio, st_fx->element_mode ); /* scale coefficients to their nominal level (8kHz) */ @@ -174,10 +132,6 @@ void hq_core_enc_fx( /* limit encoded band-width according to the command-line OR BWD limitation */ inner_frame = inner_frame_tbl[st_fx->bwidth]; /* Q0 */ move16(); -#ifdef ADD_IVAS_HQ_CODE_L_SPEC - L_spec = l_spec_tbl[st_fx->bwidth]; - move16(); -#endif IF( GT_16( input_frame, inner_frame ) ) { IF( EQ_16( is_transient, 1 ) ) @@ -193,31 +147,10 @@ void hq_core_enc_fx( set32_fx( t_audio + inner_frame, 0, sub( input_frame, inner_frame ) ); } } -#ifdef ADD_IVAS_HQ_CODE_L_SPEC - /* subtract signalling bits */ - num_bits = sub( num_bits, hBstr->nb_bits_tot_fx ); -#endif - /*-------------------------------------------------------------------------- * High-band gain control in case of BWS *--------------------------------------------------------------------------*/ -#ifdef ADD_IVAS_HQ_CODE - IF( st_fx->bwidth_sw_cnt > 0 ) - { - IF( is_transient ) - { - FOR( i = 0; i < NUM_TIME_SWITCHING_BLOCKS; i++ ) - { - v_multc( t_audio + i * inner_frame / NUM_TIME_SWITCHING_BLOCKS + L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, t_audio + i * inner_frame / NUM_TIME_SWITCHING_BLOCKS + L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS, inner_frame / NUM_TIME_SWITCHING_BLOCKS - L_FRAME16k / NUM_TIME_SWITCHING_BLOCKS ); - } - } - ELSE - { - v_multc( t_audio + L_FRAME16k, (float) ( st->bwidth_sw_cnt ) / (float) BWS_TRAN_PERIOD, t_audio + L_FRAME16k, L_spec - L_FRAME16k ); - } - } -#endif /*-------------------------------------------------------------------------- * Classify whether to put extra bits for FER mitigation *--------------------------------------------------------------------------*/ @@ -263,12 +196,7 @@ void hq_core_enc_fx( t_audio[i] = L_shr( t_audio[i], sub( Q_audio, 12 ) ); /* Q12 */ move32(); } - -#ifdef ADD_IVAS_HQ_CODE_L_SPEC - hq_hr_enc_fx( st_fx, t_audio, L_spec, &num_bits, is_transient, vad_hover_flag ); -#else hq_hr_enc_fx( st_fx, t_audio, inner_frame, &num_bits, is_transient, vad_hover_flag ); -#endif Q_audio = 12; move16(); } @@ -286,51 +214,6 @@ void hq_core_enc_fx( { 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 ) ) - { - overlap = st->hTcxCfg->tcx_mdct_window_length; - nz = NS2SA( st->sr_core, N_ZERO_MDCT_NS ); - L_frame = (int16_t) ( st->L_frame + st->hTcxCfg->tcx_offset - st->hTcxCfg->lfacNext ); - tcx_offset = st->hTcxCfg->lfacNext; - set_f( Aq_old, 0, M + 1 ); /* Dummy filter */ - Aq_old[0] = 1; - - /* Code taken from InternalTCXDecoder() */ - TCX_MDCT_Inverse( t_audio, wtda_audio, overlap, L_frame - overlap, overlap, st->element_mode ); - - /* Window current frame */ - tcx_windowing_synthesis_current_frame( wtda_audio, st->hTcxCfg->tcx_aldo_window_2, st->hTcxCfg->tcx_mdct_window_half, st->hTcxCfg->tcx_mdct_window_minimum, overlap, /*st->hTcxCfg->tcx_mdct_window_length*/ st->hTcxCfg->tcx_mdct_window_half_length, st->hTcxCfg->tcx_mdct_window_min_length, st->last_core == ACELP_CORE, st->hTcxCfg->tcx_last_overlap_mode, /*left mode*/ st->hTcxEnc->acelp_zir, st->hTcxEnc->Txnq, NULL, Aq_old, st->hTcxCfg->tcx_mdct_window_trans, st->L_frame >> 1, tcx_offset < 0 ? -tcx_offset : 0, st->last_core, 0, 0 ); - - /*Compute windowed synthesis in case of switching to ALDO windows in next frame*/ - mvr2r( wtda_audio + L_frame - nz, st->hTcxEnc->old_out, nz + overlap ); - set_zero( st->hTcxEnc->old_out + nz + overlap, nz ); - - tcx_windowing_synthesis_past_frame( st->hTcxEnc->old_out + nz, st->hTcxCfg->tcx_aldo_window_1_trunc, st->hTcxCfg->tcx_mdct_window_half, st->hTcxCfg->tcx_mdct_window_minimum, overlap, st->hTcxCfg->tcx_mdct_window_half_length, st->hTcxCfg->tcx_mdct_window_min_length, FULL_OVERLAP ); - - for ( i = 0; i < nz; i++ ) - { - st->hTcxEnc->old_out[nz + overlap + i] = wtda_audio[L_frame - 1 - i] * st->hTcxCfg->tcx_aldo_window_1_trunc[-1 - i]; - } - mvr2r( wtda_audio + ( overlap >> 1 ) - tcx_offset, output, st->L_frame ); - } - else - { - ener_match = (float) sqrt( (float) L_FRAME16k / (float) NORM_MDCT_FACTOR ); - v_multc( t_audio, ener_match, t_audio, inner_frame ); - - inverse_transform( t_audio, wtda_audio, is_transient, L_FRAME16k, inner_frame, st->element_mode ); - - window_ola( wtda_audio, output, st->hTcxEnc->old_out, L_FRAME16k, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, 0, 0, NULL ); - } - - if ( st->element_mode > EVS_MONO ) - { - /* Store LB synthesis in case of switch to ACELP */ - mvr2r( output, st->hLPDmem->old_exc, L_FRAME16k ); - } -#endif - return; } diff --git a/lib_enc/hq_hr_enc_fx.c b/lib_enc/hq_hr_enc_fx.c index 705db9ecd..05654e775 100644 --- a/lib_enc/hq_hr_enc_fx.c +++ b/lib_enc/hq_hr_enc_fx.c @@ -249,20 +249,6 @@ void hq_hr_enc_fx( move16(); /* Prepare synthesis for LB generation in case of switch to ACELP */ -#ifdef ADD_IVAS_HQ_CODE - IF( NE_16( hqswb_clas, HQ_HVQ ) ) - { - apply_envelope_enc( t_audio_q, ynrm, num_sfm, sfm_start, sfm_end ); - } - - IF( is_transient ) - { - de_interleave_spectrum( t_audio_q, length ); - } - Copy32( t_audio_q, t_audio, length ); -#endif - - return; } diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 98d7fe957..e80ca0d59 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -20,7 +20,6 @@ * * Initialization of state variables *-----------------------------------------------------------------------*/ -#if 1 ivas_error init_encoder_fx( Encoder_State *st_fx /* i/o: Encoder static variables structure */ ) @@ -946,7 +945,7 @@ ivas_error init_encoder_fx( move32(); return error; } -#endif + /*-----------------------------------------------------------------------* * LPDmem_enc_init_fx() * @@ -1193,10 +1192,8 @@ ivas_error init_encoder_ivas_fx( st->exp_mem_preemph_enc = 0; move16(); -#if 1 // TODO: Float Initializations. To be removed later st->active_cnt = 0; move16(); -#endif st->pst_mem_deemp_err_fx = 0; move16(); @@ -1438,8 +1435,6 @@ ivas_error init_encoder_ivas_fx( st->input32_fx = st->input_buff32_fx + Mpy_32_32( st->input_Fs, 42949673 ) /* 1/50 in Q31*/; // st->input_Fs / FRAMES_PER_SEC st->input_fx = st->input_buff_fx + frame_length; } -#if 1 // TODO: To be removed later -#endif } ELSE { @@ -1454,8 +1449,6 @@ ivas_error init_encoder_ivas_fx( st->buf_speech_enc = NULL; st->buf_wspeech_enc = NULL; st->input_buff_fx = NULL; -#if 1 -#endif } /*-----------------------------------------------------------------* @@ -1956,12 +1949,6 @@ ivas_error init_encoder_ivas_fx( st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_e[1] = 0; move16(); move16(); -#if 1 - // set_f( st->hTcxEnc->spectrum_long, 0, N_MAX ); - // st->hTcxEnc->spectrum[0] = st->hTcxEnc->spectrum_long; - // st->hTcxEnc->spectrum[1] = st->hTcxEnc->spectrum_long + N_TCX10_MAX; - // set_f( st->hTcxEnc->old_out, 0, L_FRAME32k ); -#endif set16_fx( st->hTcxEnc->old_out_fx, 0, L_FRAME32k ); st->hTcxEnc->Q_old_out = 0; diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index f1187bc6c..b5b592582 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -1112,11 +1112,6 @@ static void ivas_omasa_param_est_enc_fx( { q = q_data; move16(); -#if 0 - scale_sig32( hOMasa->cldfbAnaEnc[i]->cldfb_state_fx, hOMasa->cldfbAnaEnc[i]->cldfb_state_length, sub( q, hOMasa->cldfbAnaEnc[i]->Q_cldfb_state ) ); - hOMasa->cldfbAnaEnc[i]->Q_cldfb_state = q; - move16(); -#endif cldfbAnalysis_ts_fx_var_q( &( data[i][l_ts * ts] ), Chnl_RealBuffer_fx[i], Chnl_ImagBuffer_fx[i], l_ts, hOMasa->cldfbAnaEnc[i], &q ); /*q_data-5*/ norm_buff = s_min( norm_buff, L_norm_arr( Chnl_RealBuffer_fx[i], 60 ) ); norm_buff = s_min( norm_buff, L_norm_arr( Chnl_ImagBuffer_fx[i], 60 ) ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 063f39dea..f90b2d8ec 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -2650,41 +2650,7 @@ static ivas_error sanitizeBandwidth_fx( } } - IF( EQ_16( hEncoderConfig->ivas_format, MONO_FORMAT ) ) - { -#if 0 // IVAS_fmToDo: temporary disabled to keep EVS bit-exactness -> to be verified - if (max_bwidth_tmp == FB && hEncoderConfig->ivas_total_brate < ACELP_16k40) - { - if (hEncoderConfig->ivas_total_brate < ACELP_9k60) - { - max_bwidth_tmp = WB; - } - else - { - max_bwidth_tmp = SWB; - } - } - - if (max_bwidth_tmp == SWB && hEncoderConfig->ivas_total_brate < ACELP_9k60) - { - max_bwidth_tmp = WB; - } - - /* in case of 8kHz input sampling or "-max_band NB", require the total bitrate to be below 24.40 kbps */ - if ((max_bwidth_tmp == NB || hEncoderConfig->input_Fs == 8000) && hEncoderConfig->ivas_total_brate > ACELP_24k40) - { - if (hEncoderConfig->input_Fs >= 16000) - { - max_bwidth_tmp = WB; - } - else - { - return IVAS_ERR_INVALID_BITRATE; - } - } -#endif - } - ELSE + IF( NE_16( hEncoderConfig->ivas_format, MONO_FORMAT ) ) { Word32 quo = 0, rem; move32(); diff --git a/lib_enc/mdct_classifier_fx.c b/lib_enc/mdct_classifier_fx.c index a4e19e040..ea06878c1 100644 --- a/lib_enc/mdct_classifier_fx.c +++ b/lib_enc/mdct_classifier_fx.c @@ -117,88 +117,15 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision Word32 gain1_tmp = 0, gain2_tmp = 0; Word16 exp, exp1, exp2, exp3; Word32 L_tmp, L_tmp1; -#ifdef IVAS_CODE - Word16 gain2_start, gain3_start, gain4_start, H1_start, H2_start, H_length; - Word16 gain2_start_rs, gain3_start_rs; -#endif TCX_ENC_HANDLE hTcxEnc = st_fx->hTcxEnc; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif test(); -#ifdef IVAS_CODE - IF( EQ_32( st_fx->input_Fs, 32000 ) || EQ_32( st_fx->input_Fs, 48000 ) ) - { - gain2_start = GAIN2_START_SWB; - gain2_start_rs = GAIN2_START_SWB_RS; - gain3_start = GAIN3_START_SWB; - gain3_start_rs = GAIN3_START_SWB_RS; - gain4_start = GAIN4_START_SWB; - // gain4_start_rs = GAIN4_START_SWB_RS; - H1_start = H1_START_SWB; - H2_start = H2_START_SWB; - H_length = H_LENGTH_SWB; - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - } - ELSE IF( EQ_32( st_fx->input_Fs, 16000 ) ) - { - gain2_start = GAIN2_START_WB; - gain2_start_rs = GAIN2_START_SWB_RS; - gain3_start = GAIN3_START_WB; - gain2_start_rs = GAIN2_START_SWB_RS; - gain4_start = GAIN4_START_WB; - H1_start = H1_START_WB; - H2_start = H2_START_WB; - H_length = H_LENGTH_WB; - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - } - ELSE - { - assert( !"Unknown sampling frequency in MDCT_classifier" ); - H1_start = -1; /* to avoid compilation warning */ - H2_start = -1; /* to avoid compilation warning */ - H_length = -1; /* to avoid compilation warning */ - gain2_start = -1; /* to avoid compilation warning */ - gain3_start = -1; /* to avoid compilation warning */ - gain4_start = -1; /* to avoid compilation warning */ - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - } -#endif -#ifdef IVAS_CODE - if ( NE_16( st_fx->element_mode, IVAS_CPE_DFT ) ) -#endif { dft_mag_square_fx( fft_buff, magSq, 256 ); } -#ifdef IVAS_CODE - ELSE - { - float norm_val; - - norm_val = ( L_FFT * L_FFT ) / 4.f; - for ( k = 0; k < 128; k++ ) - { - X[k + 1] = st->Bin_E_old[k] * norm_val; - } - X[0] = X[1]; - } -#endif nf = L_add( magSq[0], 0 ); pe = L_add( magSq[0], 0 ); np = 0; @@ -295,10 +222,7 @@ Word16 mdct_classifier_fx( /* o: MDCT A/B decision gain1 = L_deposit_l( 0 ); gain2 = L_deposit_l( 0 ); gain3 = L_deposit_l( 0 ); -#ifdef IVAS_CODE - PMT( "MDCT_classifier needs review for different sampling rate" ) -#endif - // IVAS_CODE to adapt + FOR( k = 0; k < 8; k++ ) { gain1 = L_add( gain1, L_shr( cldfbBuf_Ener[k], 3 ) ); diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 7d5f486cc..acc52c2aa 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3761,7 +3761,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 */ @@ -3893,7 +3893,7 @@ void ProcessIGF_fx( } #endif } -#endif + void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) { Word16 i, length, att; diff --git a/lib_enc/transient_detection_fx.c b/lib_enc/transient_detection_fx.c index 2ade624b6..1ad69a330 100644 --- a/lib_enc/transient_detection_fx.c +++ b/lib_enc/transient_detection_fx.c @@ -638,16 +638,6 @@ void RunTransientDetection_fx( Word16 const *input, Word16 nSamplesAvailable, Tr /* Update the delay buffer. */ UpdateDelayBuffer( filteredInput, nSamplesAvailable, &pTransientDetection->delayBuffer ); -#ifdef IVAS_CODE - /* compute ramp up flag */ - pSubblockEnergies->ramp_up_flag = ( ( pSubblockEnergies->ramp_up_flag << 1 ) & 0x0003 ); - e0 = dotp( filteredInput + length / 2, filteredInput + length / 2, pSubblockEnergies->pDelayBuffer->nSubblockSize / 2 ) + 0.5f * MIN_BLOCK_ENERGY; - e1 = pSubblockEnergies->subblockNrg[pSubblockEnergies->nDelay + 4] - e0; - if ( e1 > e0 ) - { - pSubblockEnergies->ramp_up_flag |= 0x0001; - } -#endif } @@ -1582,72 +1572,7 @@ static void CalculateSubblockEnergies_ivas_fx( Word16 const *input, Word16 nSamp } } } -#ifdef IVAS_CODE -/*-------------------------------------------------------------------* - * set_transient_stereo() - * - * - *-------------------------------------------------------------------*/ - -void set_transient_stereo( - CPE_ENC_HANDLE hCPE, /* i : CPE structure */ - float currFlatness[] /* i/o: current flatness */ -) -{ - int16_t n, attackIsPresent; - float currFlatnessMax; - Encoder_State **sts; - - sts = hCPE->hCoreCoder; - - /* for DFT/TD based stereo ,map avg. flatness to individual stereo channels (M/S or X/Y) */ - maximum( currFlatness, CPE_CHANNELS, &currFlatnessMax ); - attackIsPresent = 0; - - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - attackIsPresent = max( attackIsPresent, sts[n]->hTranDet->transientDetector.bIsAttackPresent ); - } - - set_f( currFlatness, currFlatnessMax, CPE_CHANNELS ); - - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - sts[n]->hTranDet->transientDetector.bIsAttackPresent = attackIsPresent; - } - - if ( hCPE->hStereoDft != NULL ) - { - if ( hCPE->hStereoDft->attackPresent ) - { - hCPE->hStereoDft->wasTransient = 1; - } - else if ( hCPE->hStereoDft->wasTransient ) - { - hCPE->hStereoDft->wasTransient = 0; - } - - hCPE->hStereoDft->attackPresent = attackIsPresent; - hCPE->hStereoDft->hItd->currFlatness = 0; - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - hCPE->hStereoDft->hItd->currFlatness = max( hCPE->hStereoDft->hItd->currFlatness, currFlatness[n] ); - } - } - - if ( hCPE->hStereoMdct != NULL ) - { - hCPE->hStereoMdct->hItd->currFlatness = 0; - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - hCPE->hStereoMdct->hItd->currFlatness = max( hCPE->hStereoMdct->hItd->currFlatness, currFlatness[n] ); - } - } - - return; -} -#endif /*-------------------------------------------------------------------* * transient_analysis() * diff --git a/lib_enc/updt_enc_fx.c b/lib_enc/updt_enc_fx.c index 1210bfd04..aed3bf812 100644 --- a/lib_enc/updt_enc_fx.c +++ b/lib_enc/updt_enc_fx.c @@ -204,20 +204,6 @@ void updt_IO_switch_enc_fx( set16_fx( hBWE_TD->old_speech_wb_fx, 0, ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16 ); set16_fx( hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); set16_fx( hBWE_TD->old_bwe_exc_extended_fx, 0, NL_BUFF_OFFSET ); -#ifdef IVAS_CODE - set16_fx( st->hBWE_TD->mem_shb_res, 0, MAX_LEN_MA_FILTER ); - set16_fx( st->hBWE_TD->old_EnvSHBres, 0, L_FRAME4k ); - st->hBWE_TD->old_mean_EnvSHBres = 0; - st->hBWE_TD->prev_enr_EnvSHBres = 32767; - st->hBWE_TD->prev_pow_exc16kWhtnd = 32767; - st->hBWE_TD->prev_mix_factor = 32767; - st->hBWE_TD->prev_Env_error = 0; - move16(); - move16(); - move16(); - move16(); - move16(); -#endif hBWE_TD->bwe_non_lin_prev_scale_fx = 0; move16(); set16_fx( hBWE_TD->decim_state1_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); @@ -251,23 +237,6 @@ void updt_IO_switch_enc_fx( st->use_acelp_preq = 0; move16(); -#ifdef IVAS_CODE - set16_fx( st->hSpMusClas->finc_prev, 0, ATT_NSEG ); - set16_fx( st->hSpMusClas->tod_lt_Bin_E, 0, TOD_NSPEC ); - set16_fx( st->hSpMusClas->tod_S_map_lt, 0, TOD_NSPEC ); - st->hSpMusClas->lt_finc = 0; - st->hSpMusClas->last_strong_attack = 0; - st->hSpMusClas->tod_thr_lt = TOD_THR_MASS; - st->hSpMusClas->tod_weight = 0; - st->hSpMusClas->tod_S_mass_prev = TOD_THR_MASS; - st->hSpMusClas->tod_S_mass_lt = TOD_THR_MASS; - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); -#endif } ELSE /* switching to AMR-WB IO mode */ { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c index 412b8c226..16fefa3bb 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions_fx.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions_fx.c @@ -3327,17 +3327,10 @@ static void eig2x2_fx( tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); -#if 1 tmp2 = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, tmp3, &exp ); exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); -#else - /* Note: This code part does not work yet, see pipeline issue for BASOP #1009 */ - /* although the same code works at other places: mantissa and q_format is fine */ - normVal_fx = ISqrt32( tmp3, &exp ); - q_tmp2 = sub( 31, exp ); -#endif IF( LT_16( q_tmp1, q_c ) ) { @@ -3403,17 +3396,10 @@ static void eig2x2_fx( tmp3 = BASOP_Util_Add_Mant32Exp( tmp2, sub( 31, q_tmp2 ), epsilon_mant, epsilon_exp, &exp_tmp3 ); -#if 1 tmp2 = BASOP_Util_Divide3232_Scale_newton( ONE_IN_Q30, tmp3, &exp ); exp = sub( exp, sub( Q30, sub( 31, exp_tmp3 ) ) ); normVal_fx = Sqrt32( tmp2, &exp ); // q_tmp2 q_tmp2 = sub( 31, exp ); -#else - /* Note: This code part does not work yet, see pipeline issue for BASOP #1009 */ - /* although the same code works at other places: mantissa and q_format is fine */ - normVal_fx = ISqrt32( tmp3, &exp_tmp3 ); - q_tmp2 = sub( 31, exp_tmp3 ); -#endif IF( LT_16( q_tmp1, q_c ) ) { -- GitLab From 6f1ac6e49513f6ba4d675f428489cd8fba35fdc2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 30 Apr 2025 12:01:49 +0530 Subject: [PATCH 2/2] Clang formatting changes --- lib_com/bitstream_fx.c | 2 +- lib_com/prot_fx.h | 35 ++- lib_com/swb_tbe_com_fx.c | 428 +++++++++++++++--------------- lib_dec/FEC_HQ_phase_ecu_fx.c | 27 +- lib_dec/core_dec_init_fx.c | 2 +- lib_dec/core_dec_switch_fx.c | 6 +- lib_dec/dec_ace_fx.c | 3 +- lib_dec/er_dec_tcx_fx.c | 10 +- lib_dec/fd_cng_dec_fx.c | 1 - lib_dec/gs_dec_amr_wb_fx.c | 6 +- lib_dec/tns_base_dec_fx.c | 3 +- lib_dec/tonalMDCTconcealment_fx.c | 3 +- lib_enc/core_enc_init_fx.c | 3 +- 13 files changed, 252 insertions(+), 277 deletions(-) diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 4fcac20b6..2b66f92cd 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -52,7 +52,7 @@ int16_t FEC_seed = 12558; /* Seed for random FEC generator */ FILE *FEC_pattern = NULL; /* FEC pattern file (for simulation of FEC) */ -float FEC_random = 0; /* FEC rate in percent (for simulation of FEC) */ +float FEC_random = 0; /* FEC rate in percent (for simulation of FEC) */ /*-------------------------------------------------------------------* * file_read_FECpattern() * diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index fde3949fd..f422d5e50 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -3061,8 +3061,7 @@ void GenShapedSHBExcitation_fx( Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */ Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */ const Word32 bitrate, - const Word16 prev_bfi -); + const Word16 prev_bfi ); void GenShapedSHBExcitation_ivas_enc_fx( Word16 *excSHB, /* o : synthesized shaped shb excitation Q_bwe_exc*/ @@ -3137,8 +3136,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */ Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */ const Word32 bitrate, - const Word16 prev_bfi - , /* i : previous frame was concealed */ + const Word16 prev_bfi, /* i : previous frame was concealed */ const Word16 element_mode, /* i : element mode */ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ Word16 *nlExc16k, /* i/o: NL exc for IC-BWE */ @@ -3292,7 +3290,7 @@ void synthesise_fb_high_band_fx( #ifndef REMOVE_EVS_DUPLICATES void prep_tbe_exc_fx( - const Word16 L_frame_fx, /* i : length of the frame */ + const Word16 L_frame_fx, /* i : length of the frame */ const Word16 i_subfr_fx, /* i : subframe index */ const Word16 gain_pit_fx, /* i : Pitch gain Q14*/ const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/ @@ -3326,12 +3324,11 @@ void prep_tbe_exc_ivas_fx( Word16 T0, /* i : integer pitch variables Q0 */ Word16 T0_frac, /* i : Fractional pitch variables Q0*/ const Word16 coder_type, /* i : coding type */ - Word32 core_brate - , /* i : core bitrate */ - const Word16 element_mode, /* i : element mode */ - const Word16 idchan, /* i : channel ID */ - const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ - const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ + Word32 core_brate, /* i : core bitrate */ + const Word16 element_mode, /* i : element mode */ + const Word16 idchan, /* i : channel ID */ + const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ + const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ ); Word16 swb_formant_fac_fx( /* o : Formant filter strength [0,1] */ @@ -6539,8 +6536,7 @@ void TonalMDCTConceal_SaveFreqSignal( Word16 nNewSamplesCore, const Word16 *scaleFactors, const Word16 *scaleFactors_exp, - const Word16 gain_tcx_exp -); + const Word16 gain_tcx_exp ); void TonalMDCTConceal_SaveFreqSignal_ivas_fx( TonalMDCTConcealPtr hTonalMDCTConc, @@ -8389,7 +8385,7 @@ ivas_error ppp_quarter_decoder_fx( void open_decoder_LPD_fx( Decoder_State *st, const Word32 total_brate, /* Q0 */ - const Word16 bwidth /* Q0 */ + const Word16 bwidth /* Q0 */ ); void open_decoder_LPD_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ @@ -8951,12 +8947,11 @@ ReadTnsData( STnsConfig const *pTnsConfig, Word16 *stream, Word16 *pnSize ); -void -ReadTnsData_ivas_fx( STnsConfig const *pTnsConfig, - Decoder_State *st, - Word16 *pnBits, - Word16 *stream, - Word16 *pnSize ); +void ReadTnsData_ivas_fx( STnsConfig const *pTnsConfig, + Decoder_State *st, + Word16 *pnBits, + Word16 *stream, + Word16 *pnSize ); Word16 DecodeTnsData( STnsConfig const *pTnsConfig, Word16 const *stream, diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index d1883efde..c4605393d 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -2102,8 +2102,7 @@ void GenShapedSHBExcitation_fx( Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */ Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */ const Word32 bitrate, - const Word16 prev_bfi -) + const Word16 prev_bfi ) { Word16 i, j, k; Word16 wht_fil_mem[LPC_WHTN_ORDER]; @@ -2366,258 +2365,257 @@ void GenShapedSHBExcitation_fx( } } ELSE /* decoder side */ - { { - /* *vf_ind is an integer scale by 0.125f*/ - tmp = shl( *vf_ind, ( 15 - 3 ) ); - tmp2 = MAX_16; - move16(); - if ( LE_16( tmp, 22938 /*0.7f Q15*/ ) ) - { - tmp2 = 26214 /*0.8f Q15*/; - move16(); - } - } - } + { /* *vf_ind is an integer scale by 0.125f*/ + tmp = shl( *vf_ind, ( 15 - 3 ) ); + tmp2 = MAX_16; + move16(); + if ( LE_16( tmp, 22938 /*0.7f Q15*/ ) ) { - voice_factors[0] = mult_r( voice_factors[0], tmp2 ); - move16(); - voice_factors[1] = mult_r( voice_factors[1], tmp2 ); - move16(); - voice_factors[2] = mult_r( voice_factors[2], tmp2 ); - move16(); - voice_factors[3] = mult_r( voice_factors[3], tmp2 ); - move16(); - voice_factors[4] = mult_r( voice_factors[4], tmp2 ); + tmp2 = 26214 /*0.8f Q15*/; move16(); } } +} +{ + voice_factors[0] = mult_r( voice_factors[0], tmp2 ); + move16(); + voice_factors[1] = mult_r( voice_factors[1], tmp2 ); + move16(); + voice_factors[2] = mult_r( voice_factors[2], tmp2 ); + move16(); + voice_factors[3] = mult_r( voice_factors[3], tmp2 ); + move16(); + voice_factors[4] = mult_r( voice_factors[4], tmp2 ); + move16(); +} +} - tmp = sub( Q_temp, 3 ); - FOR( k = 0; k < L_FRAME16k; k++ ) +tmp = sub( Q_temp, 3 ); +FOR( k = 0; k < L_FRAME16k; k++ ) +{ + White_exc16k_FB[k] = round_fx( L_shl( White_exc16k_32[k], tmp ) ); /* Q_bwe_exc +5 +1 +Q_temp -16 -3 */ +} +prev_Q_bwe_exc_fb = *Q_bwe_exc_fb; +move16(); +*Q_bwe_exc_fb = sub( add( *Q_bwe_exc, Q_temp ), 13 ); +move16(); +deemph_fx( White_exc16k, PREEMPH_FAC, L_FRAME16k, tbe_demph ); +/* i/o: White_exc16k (Q_bwe_exc-NOISE_QADJ) */ +/* i: tbe_demph (Q_bwe_exc-NOISE_QADJ) */ +{ + IF( EQ_16( coder_type, UNVOICED ) ) { - White_exc16k_FB[k] = round_fx( L_shl( White_exc16k_32[k], tmp ) ); /* Q_bwe_exc +5 +1 +Q_temp -16 -3 */ + L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp ); + scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ + FOR( k = 0; k < L_FRAME16k; k++ ) + { + /* White_exc16k: (Q_bwe_exc-NOISE_QADJ), scale: Q15 */ + L_tmp = L_mult( White_exc16k[k], scale ); + /* L_tmp: (Q_bwe_exc-NOISE_QADJ) + 15 + 1 */ + exc16kWhtnd[k] = round_fx( L_shl( L_tmp, NOISE_QADJ ) ); + move16(); + /* exc16kWhtnd: Q_bwe_exc */ + } + PREEMPH_FX( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph ); + /* i/o: exc16kWhtnd (Q_bwe_exc) */ + /* i/o: tbe_premph (Q_bwe_exc) */ } - prev_Q_bwe_exc_fb = *Q_bwe_exc_fb; - move16(); - *Q_bwe_exc_fb = sub( add( *Q_bwe_exc, Q_temp ), 13 ); - move16(); - deemph_fx( White_exc16k, PREEMPH_FAC, L_FRAME16k, tbe_demph ); - /* i/o: White_exc16k (Q_bwe_exc-NOISE_QADJ) */ - /* i: tbe_demph (Q_bwe_exc-NOISE_QADJ) */ + ELSE { - IF( EQ_16( coder_type, UNVOICED ) ) + Word16 nbSubFr, lSubFr; + Word16 tempQ15; + Word32 tempQ31; + /*nbSubFr = ( bitrate < ACELP_24k40 )? NB_SUBFR : NB_SUBFR16k;*/ + nbSubFr = NB_SUBFR16k; + lSubFr = ( L_FRAME16k / NB_SUBFR16k ); + IF( LT_32( bitrate, ACELP_24k40 ) ) { - L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp ); - scale = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /*Q15 */ - FOR( k = 0; k < L_FRAME16k; k++ ) - { - /* White_exc16k: (Q_bwe_exc-NOISE_QADJ), scale: Q15 */ - L_tmp = L_mult( White_exc16k[k], scale ); - /* L_tmp: (Q_bwe_exc-NOISE_QADJ) + 15 + 1 */ - exc16kWhtnd[k] = round_fx( L_shl( L_tmp, NOISE_QADJ ) ); - move16(); - /* exc16kWhtnd: Q_bwe_exc */ - } - PREEMPH_FX( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph ); - /* i/o: exc16kWhtnd (Q_bwe_exc) */ - /* i/o: tbe_premph (Q_bwe_exc) */ + nbSubFr = NB_SUBFR; + move16(); + lSubFr = ( L_FRAME16k / NB_SUBFR ); + move16(); } - ELSE + k = 0; + FOR( i = 0; i < nbSubFr; i++ ) { - Word16 nbSubFr, lSubFr; - Word16 tempQ15; - Word32 tempQ31; - /*nbSubFr = ( bitrate < ACELP_24k40 )? NB_SUBFR : NB_SUBFR16k;*/ - nbSubFr = NB_SUBFR16k; - lSubFr = ( L_FRAME16k / NB_SUBFR16k ); - IF( LT_32( bitrate, ACELP_24k40 ) ) + test(); + IF( EQ_16( coder_type, VOICED ) && ( LT_32( bitrate, ACELP_24k40 ) ) ) { - nbSubFr = NB_SUBFR; + exp = 0; move16(); - lSubFr = ( L_FRAME16k / NB_SUBFR ); + tempQ15 = Sqrt16( voice_factors[i], &exp ); /* Q15 */ + temp = shl( tempQ15, exp ); /* Q15 exc16kWhtnd scale factor */ + exp = 0; move16(); + tempQ15 = Sqrt16( temp, &exp ); /* Q15 */ + temp1 = shl( tempQ15, exp ); /* Q15 exc16kWhtnd scale factor */ + + /*temp2 = root_a_over_b_fx( pow1 * (1.0f - temp), pow22 ); */ + temp = sub( MAX_16, temp ); + tempQ31 = Mult_32_16( pow1, temp ); + L_tmp = root_a_over_b_fx( tempQ31, Q_pow1, pow22, Q_pow22, &exp ); + temp2 = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q15 whiteEnvShapedExc scale factor */ } - k = 0; - FOR( i = 0; i < nbSubFr; i++ ) + ELSE { - test(); - IF( EQ_16( coder_type, VOICED ) && ( LT_32( bitrate, ACELP_24k40 ) ) ) - { - exp = 0; - move16(); - tempQ15 = Sqrt16( voice_factors[i], &exp ); /* Q15 */ - temp = shl( tempQ15, exp ); /* Q15 exc16kWhtnd scale factor */ - exp = 0; - move16(); - tempQ15 = Sqrt16( temp, &exp ); /* Q15 */ - temp1 = shl( tempQ15, exp ); /* Q15 exc16kWhtnd scale factor */ - - /*temp2 = root_a_over_b_fx( pow1 * (1.0f - temp), pow22 ); */ - temp = sub( MAX_16, temp ); - tempQ31 = Mult_32_16( pow1, temp ); - L_tmp = root_a_over_b_fx( tempQ31, Q_pow1, pow22, Q_pow22, &exp ); - temp2 = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q15 whiteEnvShapedExc scale factor */ - } - ELSE - { - /* Adjust noise mixing for formant sharpening filter */ - tempQ15 = mult_r( SWB_NOISE_MIX_FAC_FX, formant_fac ); - /* vf_tmp = voice_factors[i] * (1.0f - vf_tmp); */ - vf_tmp = sub( MAX_16, tempQ15 ); - vf_tmp = mult_r( voice_factors[i], vf_tmp ); - - exp = 0; - move16(); - tempQ15 = Sqrt16( vf_tmp, &exp ); /* Q15 */ - temp1 = shl( tempQ15, exp ); /* Q15 exc16kWhtnd scale factor */ - - /*temp2 = root_a_over_b(pow1 * (1.0f - vf_tmp), pow22); */ - temp = sub( MAX_16, vf_tmp ); - tempQ31 = Mult_32_16( pow1, temp ); - L_tmp = root_a_over_b_fx( tempQ31, Q_pow1, pow22, Q_pow22, &exp ); - temp2 = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q15 whiteEnvShapedExc scale factor */ - } + /* Adjust noise mixing for formant sharpening filter */ + tempQ15 = mult_r( SWB_NOISE_MIX_FAC_FX, formant_fac ); + /* vf_tmp = voice_factors[i] * (1.0f - vf_tmp); */ + vf_tmp = sub( MAX_16, tempQ15 ); + vf_tmp = mult_r( voice_factors[i], vf_tmp ); - FOR( j = 0; j < lSubFr; j++ ) - { - /*exc16kWhtnd[k+j] = temp1 * exc16kWhtnd[k+j] + temp2 * White_exc16k[k+j]; */ - L_tmp = L_mult( temp2, White_exc16k[k + j] ); /* 16+(Q_bwe_exc-NOISE_QADJ)*/ - L_tmp = L_shl_sat( L_tmp, NOISE_QADJ ); /* 16+(Q_bwe_exc) */ - exc16kWhtnd[k + j] = mac_r_sat( L_tmp, temp1, exc16kWhtnd[k + j] ); - move16(); - /* Q_bwe_exc */ - } - k = add( k, lSubFr ); - - /* estimate the pre-emph factor */ - tempQ15 = sub( MAX_16, voice_factors[i] ); exp = 0; move16(); - temp = Sqrt16( tempQ15, &exp ); - temp = shl( temp, exp - 1 ); - - temp2 = add( temp, shl( temp1, -1 ) ); /* shift right by 1 to avoid overflow */ - temp = div_s( temp, temp2 ); /* Q15 */ - temp = mult_r( PREEMPH_FAC, temp ); + tempQ15 = Sqrt16( vf_tmp, &exp ); /* Q15 */ + temp1 = shl( tempQ15, exp ); /* Q15 exc16kWhtnd scale factor */ + + /*temp2 = root_a_over_b(pow1 * (1.0f - vf_tmp), pow22); */ + temp = sub( MAX_16, vf_tmp ); + tempQ31 = Mult_32_16( pow1, temp ); + L_tmp = root_a_over_b_fx( tempQ31, Q_pow1, pow22, Q_pow22, &exp ); + temp2 = round_fx_sat( L_shl_sat( L_tmp, exp ) ); /* Q15 whiteEnvShapedExc scale factor */ + } - PREEMPH_FX( &exc16kWhtnd[i * lSubFr], temp, lSubFr, tbe_premph ); - /* exc16kWhtnd: Q_bwe_exc; - tbe_premph: Q_bwe_exc*/ + FOR( j = 0; j < lSubFr; j++ ) + { + /*exc16kWhtnd[k+j] = temp1 * exc16kWhtnd[k+j] + temp2 * White_exc16k[k+j]; */ + L_tmp = L_mult( temp2, White_exc16k[k + j] ); /* 16+(Q_bwe_exc-NOISE_QADJ)*/ + L_tmp = L_shl_sat( L_tmp, NOISE_QADJ ); /* 16+(Q_bwe_exc) */ + exc16kWhtnd[k + j] = mac_r_sat( L_tmp, temp1, exc16kWhtnd[k + j] ); + move16(); + /* Q_bwe_exc */ } + k = add( k, lSubFr ); + + /* estimate the pre-emph factor */ + tempQ15 = sub( MAX_16, voice_factors[i] ); + exp = 0; + move16(); + temp = Sqrt16( tempQ15, &exp ); + temp = shl( temp, exp - 1 ); + + temp2 = add( temp, shl( temp1, -1 ) ); /* shift right by 1 to avoid overflow */ + temp = div_s( temp, temp2 ); /* Q15 */ + temp = mult_r( PREEMPH_FAC, temp ); + + PREEMPH_FX( &exc16kWhtnd[i * lSubFr], temp, lSubFr, tbe_premph ); + /* exc16kWhtnd: Q_bwe_exc; + tbe_premph: Q_bwe_exc*/ } } +} - IF( LT_32( bitrate, ACELP_24k40 ) ) - { - Syn_filt_s( 0, lpc_shb, LPC_SHB_ORDER, exc16kWhtnd, excSHB, L_FRAME16k, state_lpc_syn, 1 ); - /* i: exc16kWhtnd in Q_bwe_exc */ - /* o: excSHB in Q_bwe_exc */ - } - ELSE - { - set16_fx( zero_mem, 0, LPC_SHB_ORDER ); +IF( LT_32( bitrate, ACELP_24k40 ) ) +{ + Syn_filt_s( 0, lpc_shb, LPC_SHB_ORDER, exc16kWhtnd, excSHB, L_FRAME16k, state_lpc_syn, 1 ); + /* i: exc16kWhtnd in Q_bwe_exc */ + /* o: excSHB in Q_bwe_exc */ +} +ELSE +{ + set16_fx( zero_mem, 0, LPC_SHB_ORDER ); - Syn_filt_s( 0, lpc_shb_sf, LPC_SHB_ORDER, exc16kWhtnd, tempSHB, 80, zero_mem, 1 ); - syn_shb_ener_sf[0] = L_shr( sum2_fx( tempSHB, 80 ), 3 ); - move32(); + Syn_filt_s( 0, lpc_shb_sf, LPC_SHB_ORDER, exc16kWhtnd, tempSHB, 80, zero_mem, 1 ); + syn_shb_ener_sf[0] = L_shr( sum2_fx( tempSHB, 80 ), 3 ); + move32(); - Syn_filt_s( 0, lpc_shb_sf + ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 80, tempSHB, 80, zero_mem, 1 ); - syn_shb_ener_sf[1] = L_shr( sum2_fx( tempSHB, 80 ), 3 ); - move32(); + Syn_filt_s( 0, lpc_shb_sf + ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 80, tempSHB, 80, zero_mem, 1 ); + syn_shb_ener_sf[1] = L_shr( sum2_fx( tempSHB, 80 ), 3 ); + move32(); - Syn_filt_s( 0, lpc_shb_sf + 2 * ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 160, tempSHB, 80, zero_mem, 1 ); - syn_shb_ener_sf[2] = L_shr( sum2_fx( tempSHB, 80 ), 3 ); - move32(); + Syn_filt_s( 0, lpc_shb_sf + 2 * ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 160, tempSHB, 80, zero_mem, 1 ); + syn_shb_ener_sf[2] = L_shr( sum2_fx( tempSHB, 80 ), 3 ); + move32(); - Syn_filt_s( 0, lpc_shb_sf + 3 * ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 240, tempSHB, 80, zero_mem, 1 ); - syn_shb_ener_sf[3] = L_shr( sum2_fx( tempSHB, 80 ), 3 ); - move32(); + Syn_filt_s( 0, lpc_shb_sf + 3 * ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 240, tempSHB, 80, zero_mem, 1 ); + syn_shb_ener_sf[3] = L_shr( sum2_fx( tempSHB, 80 ), 3 ); + move32(); - /* i: exc16kWhtnd in Q_bwe_exc */ - /* o: tempSHB in Q_bwe_exc */ - /* o: syn_shb_ener_sf in (2*Q_bwe_exc+1) */ - IF( LE_32( bitrate, ACELP_32k ) ) - { - L_tmp = sum32_fx( syn_shb_ener_sf, 4 ); + /* i: exc16kWhtnd in Q_bwe_exc */ + /* o: tempSHB in Q_bwe_exc */ + /* o: syn_shb_ener_sf in (2*Q_bwe_exc+1) */ + IF( LE_32( bitrate, ACELP_32k ) ) + { + L_tmp = sum32_fx( syn_shb_ener_sf, 4 ); - /* find root_a(tempSHB[0]) = root_a_over_b(shb_ener_sf[0]), L_tmp) */ - tmp = shl( Q_shb, 1 ); - tmp2 = add( shl( *Q_bwe_exc, 1 ), 1 ); - L_tmp2 = root_a_over_b_fx( shb_ener_sf_32, tmp, L_tmp, tmp2, &exp ); /* L_tmp2 in (Q31-exp) */ + /* find root_a(tempSHB[0]) = root_a_over_b(shb_ener_sf[0]), L_tmp) */ + tmp = shl( Q_shb, 1 ); + tmp2 = add( shl( *Q_bwe_exc, 1 ), 1 ); + L_tmp2 = root_a_over_b_fx( shb_ener_sf_32, tmp, L_tmp, tmp2, &exp ); /* L_tmp2 in (Q31-exp) */ - *Q_bwe_exc = sub( *Q_bwe_exc, exp ); - move16(); /* compensate for the exp shift */ - tmp2 = add( prev_Q_bwe_syn, n_mem2 ); - IF( GT_16( *Q_bwe_exc, tmp2 ) ) - { - L_tmp2 = L_shl( L_tmp2, sub( tmp2, *Q_bwe_exc ) ); - *Q_bwe_exc = tmp2; - move16(); - } - FOR( i = 0; i < L_FRAME16k; i++ ) - { - L_tmp3 = Mult_32_16( L_tmp2, exc16kWhtnd[i] ); /* *Q_bwe_exc + (31-exp) - 15 */ - exc16kWhtnd[i] = round_fx( L_tmp3 ); /* *Q_bwe_exc - exp */ - move16(); - } - } - /* i: L_tmp2 in (Q31-exp) */ - /* i: exc16kWhtnd in Q_bwe_exc */ - /* o: exc16kWhtnd in Q_bwe_exc: (Q_bwe_exc-exp) */ - - /* Rescale the past memories: LP synth and SHB look ahead buffers */ - tmp = sub( *Q_bwe_exc, prev_Q_bwe_syn ); - FOR( i = 0; i < LPC_SHB_ORDER; i++ ) + *Q_bwe_exc = sub( *Q_bwe_exc, exp ); + move16(); /* compensate for the exp shift */ + tmp2 = add( prev_Q_bwe_syn, n_mem2 ); + IF( GT_16( *Q_bwe_exc, tmp2 ) ) { - state_lpc_syn[i] = shl( state_lpc_syn[i], tmp ); + L_tmp2 = L_shl( L_tmp2, sub( tmp2, *Q_bwe_exc ) ); + *Q_bwe_exc = tmp2; move16(); } - FOR( i = -L_SHB_LAHEAD; i < 0; i++ ) + FOR( i = 0; i < L_FRAME16k; i++ ) { - excSHB[i] = shl( excSHB[i], tmp ); + L_tmp3 = Mult_32_16( L_tmp2, exc16kWhtnd[i] ); /* *Q_bwe_exc + (31-exp) - 15 */ + exc16kWhtnd[i] = round_fx( L_tmp3 ); /* *Q_bwe_exc - exp */ move16(); } - /* Do mem_stp_swb_fx scaling before PostShortTerm_fx */ - - Syn_filt_s( 0, lpc_shb_sf, LPC_SHB_ORDER, exc16kWhtnd, excSHB, 80, state_lpc_syn, 1 ); - Syn_filt_s( 0, lpc_shb_sf + ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 80, excSHB + 80, 80, state_lpc_syn, 1 ); - Syn_filt_s( 0, lpc_shb_sf + 2 * ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 160, excSHB + 160, 80, state_lpc_syn, 1 ); - Syn_filt_s( 0, lpc_shb_sf + 3 * ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 240, excSHB + 240, 80, state_lpc_syn, 1 ); - /* i: exc16kWhtnd in (Q_bwe_exc) */ - /* o: excSHB in (Q_bwe_exc) */ } + /* i: L_tmp2 in (Q31-exp) */ + /* i: exc16kWhtnd in Q_bwe_exc */ + /* o: exc16kWhtnd in Q_bwe_exc: (Q_bwe_exc-exp) */ - IF( EQ_16( extl, FB_TBE ) ) + /* Rescale the past memories: LP synth and SHB look ahead buffers */ + tmp = sub( *Q_bwe_exc, prev_Q_bwe_syn ); + FOR( i = 0; i < LPC_SHB_ORDER; i++ ) { - tmp = sub( add( *Q_bwe_exc_fb, 20 ), prev_Q_bwe_exc_fb ); - Scale_sig( fb_state_lpc_syn, LPC_SHB_ORDER, tmp ); - Scale_sig( fb_tbe_demph, 1, tmp ); - Syn_filt_s( 0, lpc_shb, LPC_SHB_ORDER, White_exc16k_FB, White_exc16k_FB_temp, L_FRAME16k, fb_state_lpc_syn, 1 ); - /* i: White_exc16k_FB in (14-n2) */ - /* o: White_exc16k_FB_temp in (14-n2) */ + state_lpc_syn[i] = shl( state_lpc_syn[i], tmp ); + move16(); + } + FOR( i = -L_SHB_LAHEAD; i < 0; i++ ) + { + excSHB[i] = shl( excSHB[i], tmp ); + move16(); + } + /* Do mem_stp_swb_fx scaling before PostShortTerm_fx */ - FOR( i = 0; i < 10; i++ ) - { - FOR( j = 0; j < 32; ++j ) - { - White_exc16k_FB_temp[i * 32 + j] = mult_r( White_exc16k_FB_temp[i * 32 + j], cos_fb_exc_fx[j] ); - move16(); - } - } + Syn_filt_s( 0, lpc_shb_sf, LPC_SHB_ORDER, exc16kWhtnd, excSHB, 80, state_lpc_syn, 1 ); + Syn_filt_s( 0, lpc_shb_sf + ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 80, excSHB + 80, 80, state_lpc_syn, 1 ); + Syn_filt_s( 0, lpc_shb_sf + 2 * ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 160, excSHB + 160, 80, state_lpc_syn, 1 ); + Syn_filt_s( 0, lpc_shb_sf + 3 * ( LPC_SHB_ORDER + 1 ), LPC_SHB_ORDER, exc16kWhtnd + 240, excSHB + 240, 80, state_lpc_syn, 1 ); + /* i: exc16kWhtnd in (Q_bwe_exc) */ + /* o: excSHB in (Q_bwe_exc) */ +} - *Q_bwe_exc_fb = add( *Q_bwe_exc_fb, 20 ); - move16(); /**Q_bwe_exc_fb +35 +1 -16*/ - flip_spectrum_fx( White_exc16k_FB_temp, White_exc16k_FB, L_FRAME16k ); +IF( EQ_16( extl, FB_TBE ) ) +{ + tmp = sub( add( *Q_bwe_exc_fb, 20 ), prev_Q_bwe_exc_fb ); + Scale_sig( fb_state_lpc_syn, LPC_SHB_ORDER, tmp ); + Scale_sig( fb_tbe_demph, 1, tmp ); + Syn_filt_s( 0, lpc_shb, LPC_SHB_ORDER, White_exc16k_FB, White_exc16k_FB_temp, L_FRAME16k, fb_state_lpc_syn, 1 ); + /* i: White_exc16k_FB in (14-n2) */ + /* o: White_exc16k_FB_temp in (14-n2) */ - deemph_fx( White_exc16k_FB, fb_deemph_fac, L_FRAME16k, fb_tbe_demph ); - } - ELSE + FOR( i = 0; i < 10; i++ ) { - set16_fx( White_exc16k_FB, 0, L_FRAME16k ); + FOR( j = 0; j < 32; ++j ) + { + White_exc16k_FB_temp[i * 32 + j] = mult_r( White_exc16k_FB_temp[i * 32 + j], cos_fb_exc_fx[j] ); + move16(); + } } - return; + *Q_bwe_exc_fb = add( *Q_bwe_exc_fb, 20 ); + move16(); /**Q_bwe_exc_fb +35 +1 -16*/ + flip_spectrum_fx( White_exc16k_FB_temp, White_exc16k_FB, L_FRAME16k ); + + deemph_fx( White_exc16k_FB, fb_deemph_fac, L_FRAME16k, fb_tbe_demph ); +} +ELSE +{ + set16_fx( White_exc16k_FB, 0, L_FRAME16k ); +} + +return; } void GenShapedSHBExcitation_ivas_enc_fx( @@ -7264,7 +7262,7 @@ void Estimate_mix_factors_fx( #ifndef REMOVE_EVS_DUPLICATES void prep_tbe_exc_fx( - const Word16 L_frame_fx, /* i : length of the frame */ + const Word16 L_frame_fx, /* i : length of the frame */ const Word16 i_subfr_fx, /* i : subframe index */ const Word16 gain_pit_fx, /* i : Pitch gain Q14*/ const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/ @@ -7278,8 +7276,7 @@ void prep_tbe_exc_fx( Word16 T0, /* i : integer pitch variables Q0 */ Word16 T0_frac, /* i : Fractional pitch variables Q0*/ const Word16 coder_type, /* i : coding type */ - Word32 core_brate -) + Word32 core_brate ) { Word16 i; Word16 tmp_code_fx[2 * L_SUBFR * HIBND_ACB_L_FAC]; @@ -7425,12 +7422,11 @@ void prep_tbe_exc_ivas_fx( Word16 T0, /* i : integer pitch variables Q0 */ Word16 T0_frac, /* i : Fractional pitch variables Q0*/ const Word16 coder_type, /* i : coding type */ - Word32 core_brate - , /* i : core bitrate */ - const Word16 element_mode, /* i : element mode */ - const Word16 idchan, /* i : channel ID */ - const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ - const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ + Word32 core_brate, /* i : core bitrate */ + const Word16 element_mode, /* i : element mode */ + const Word16 idchan, /* i : channel ID */ + const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */ + const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */ ) { Word16 i; diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index dedf9f859..ad2f86073 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -64,11 +64,9 @@ static void windowing( const Word16 *, Word16 *, const Word16 *, const Word16, c static void windowing_ROM_optimized( const Word16 *, Word16 *, const Word16, const Word16, const Word16 ); static void fft_spec2_fx( const Word16[], Word32[], const Word16 ); static void trans_ana_fx( const Word16 *, Word16 *, Word16 *, Word16 *, const Word16, const Word16, const Word16, const Word16, Word16 *, Word16 *, Word16 *, Word16 * ); -static void peakfinder_fx( const Word16 *, const Word16, Word16 *, Word16 *, const Word16 -); +static void peakfinder_fx( const Word16 *, const Word16, Word16 *, Word16 *, const Word16 ); static Word16 imax_fx( const Word16 *, const Word16 ); -static void spec_ana_fx( const Word16 *prevsynth, Word16 *plocs, Word32 *plocsi, Word16 *num_plocs, Word16 *X_sav, const Word16 output_frame, const Word16 bwidth_fx, Word16 *Q -); +static void spec_ana_fx( const Word16 *prevsynth, Word16 *plocs, Word32 *plocsi, Word16 *num_plocs, Word16 *X_sav, const Word16 output_frame, const Word16 bwidth_fx, Word16 *Q ); static void subst_spec_fx( const Word16 *, const Word32 *, Word16 *, const Word16, Word16 *, const Word16 *, const Word16, const Word16 *, const Word16, Word16 *, const Word16 *, const Word16 *, Word16, const Word16 * ); static Word16 rand_phase_fx( const Word16 seed, Word16 *sin_F, Word16 *cos_F ); @@ -1779,8 +1777,7 @@ static void spec_ana_fx( { sel = mult_r( sub( Xmax, Xmin ), CMPLMNT_PFIND_SENS_FX ); } - peakfinder_fx( xfp, Lprot2_1, plocs, num_plocs, sel - ); + peakfinder_fx( xfp, Lprot2_1, plocs, num_plocs, sel ); { @@ -2875,8 +2872,7 @@ static void rec_frame_fx( Word16 *X, /* i : FFT spectrum */ Word32 *ecu_rec, /* o : Reconstructed frame in tda domain */ const Word16 output_frame, /* i : Frame length */ - const Word16 Q -) + const Word16 Q ) { const Word16 *pFftTbl; Word16 Lprot, lprotLog2Minus1; @@ -4402,13 +4398,11 @@ static void fec_alg_fx( Word16 exp; Word16 n, Q; - fec_ecu_dft_fx( prevsynth_LP, N, Tfr, Tfi, &sum_Tf_abs, Tf_abs, &Nfft, &exp - ); + fec_ecu_dft_fx( prevsynth_LP, N, Tfr, Tfi, &sum_Tf_abs, Tf_abs, &Nfft, &exp ); sinusoidal_synthesis_fx( Tfr, Tfi, Tf_abs, N, output_frame, decimatefactor, Nfft, sum_Tf_abs, synthesis, HqVoicing, exp ); - fec_noise_filling_fx( prevsynth, synthesis, ni_seed_forfec, output_frame, i_mult2( N, decimatefactor ), HqVoicing, gapsynth - ); + fec_noise_filling_fx( prevsynth, synthesis, ni_seed_forfec, output_frame, i_mult2( N, decimatefactor ), HqVoicing, gapsynth ); n = R1_48 - R2_48; move16(); @@ -4629,8 +4623,7 @@ static void hq_phase_ecu_fx( trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab, *last_fec, alpha, beta, beta_mute, Xavg ); - spec_ana_fx( prevsynth + offset, plocs, plocsi, num_p, X_sav, output_frame, bwidth_fx, Q_spec - ); + spec_ana_fx( prevsynth + offset, plocs, plocsi, num_p, X_sav, output_frame, bwidth_fx, Q_spec ); test(); IF( prev_bfi != 0 && *last_fec != 0 ) @@ -4660,12 +4653,10 @@ static void hq_phase_ecu_fx( } subst_spec_fx( plocs, plocsi, num_p, *time_offs, X, mag_chg, ph_dith, old_is_transient, output_frame, &seed, - alpha, beta, *beta_mute, Xavg - ); + alpha, beta, *beta_mute, Xavg ); /* reconstructed frame in tda domain */ - rec_frame_fx( X, ecu_rec, output_frame, *Q_spec - ); + rec_frame_fx( X, ecu_rec, output_frame, *Q_spec ); *last_fec = 0; move16(); diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index 86d8e805a..eb34e1bc1 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -20,7 +20,7 @@ void open_decoder_LPD_fx( Decoder_State *st, const Word32 total_brate, /* Q0 */ - const Word16 bwidth /* Q0 */ + const Word16 bwidth /* Q0 */ ) { Word16 i; diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index 8c68f39ce..94b6efb1b 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -10,9 +10,9 @@ #include "rom_com.h" void mode_switch_decoder_LPD_fx( - Decoder_State *st, /* i/o: decoder state structure */ - Word16 bwidth, /* i : audio bandwidth Q0*/ - Word32 total_brate, /* i : total bitrate Q0*/ + Decoder_State *st, /* i/o: decoder state structure */ + Word16 bwidth, /* i : audio bandwidth Q0*/ + Word32 total_brate, /* i : total bitrate Q0*/ Word16 frame_size_index /* i : index determining the frame size Q0*/ ) { diff --git a/lib_dec/dec_ace_fx.c b/lib_dec/dec_ace_fx.c index 55d3ebbae..ad89ca556 100644 --- a/lib_dec/dec_ace_fx.c +++ b/lib_dec/dec_ace_fx.c @@ -538,8 +538,7 @@ void decoder_acelp_fx( #else prep_tbe_exc_fx( st->L_frame, i_subfr, gain_pit, gain_code, code, st->voice_fac, &voice_factors[idx], bwe_exc, - gain_preQ, code_preQ, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate - ); + gain_preQ, code_preQ, st->Q_exc, T0, T0_frac, st->coder_type, st->core_brate ); #endif } diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 1a8a8b30d..161cefe76 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -550,8 +550,8 @@ void con_tcx_fx( { calcGainc2_fx( &exc[0], Q_exc, L_subfr, &( st->Mode2_lp_gainc ) ); } - set32_fx( pitch_buf, L_deposit_h( L_SUBFR ), st->nb_subfr ); /*Q16*/ - /* PLC: calculate damping factor */ + set32_fx( pitch_buf, L_deposit_h( L_SUBFR ), st->nb_subfr ); /*Q16*/ + /* PLC: calculate damping factor */ alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &( st->Mode2_lp_gainp ), 0 ); /*Q14*/ } @@ -681,7 +681,7 @@ void con_tcx_fx( /* PLC: [TCX: Fade-out] retrieve background level */ tmp16 = 32767; move16(); - gainSynthDeemph = getLevelSynDeemph_fx( &( tmp16 ), A_local, M, shr( L_frame, 2 ), st->preemph_fac, 1, &gainSynthDeemph_e ); /*Q5*/ + gainSynthDeemph = getLevelSynDeemph_fx( &( tmp16 ), A_local, M, shr( L_frame, 2 ), st->preemph_fac, 1, &gainSynthDeemph_e ); /*Q5*/ IF( st->tcxonly != 0 ) { /* gainCNG = st->conCngLevelBackgroundTrace/gainSynthDeemph; */ @@ -1419,8 +1419,8 @@ void con_tcx_ivas_fx( { calcGainc2_fx( &exc[0], Q_exc, L_subfr, &( st->Mode2_lp_gainc ) ); } - set32_fx( pitch_buf, L_deposit_h( L_SUBFR ), st->nb_subfr ); /*Q16*/ - /* PLC: calculate damping factor */ + set32_fx( pitch_buf, L_deposit_h( L_SUBFR ), st->nb_subfr ); /*Q16*/ + /* PLC: calculate damping factor */ alpha = Damping_fact_fx( st->core_ext_mode, st->nbLostCmpt, st->last_good, st->stab_fac_fx, &( st->Mode2_lp_gainp ), 0 ); /*Q14*/ } diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 893b49241..3fe93854e 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -792,7 +792,6 @@ Word16 ApplyFdCng_fx( { /* Perform noise estimation in active frames in the decoder for downward updates */ perform_noise_estimation_dec_fx( timeDomainInput, Q, hFdCngDec ); - } } test(); diff --git a/lib_dec/gs_dec_amr_wb_fx.c b/lib_dec/gs_dec_amr_wb_fx.c index 331142a44..eea37431a 100644 --- a/lib_dec/gs_dec_amr_wb_fx.c +++ b/lib_dec/gs_dec_amr_wb_fx.c @@ -31,8 +31,7 @@ static void NoiseFill_fx( Word16 *exc_diffQ_fx, Word16 *seed_tcx, const Word16 M static void Ener_per_band_fx( const Word16 exc_diff_fx[], const Word16 exc_diff_exp, Word32 y_gain4_fx[] ); static void Apply_gain_fx( Word16 exc_diffQ_fx[], Word32 L_Ener_per_bd_iQ[], Word32 L_Ener_per_bd_yQ[], const Word16 Q_out ); static void normalize_spec_fx( Word16 fac_up_fx, Word16 fy_norm_fx[], const Word16 L_frame, const Word16 Q_out ); -static void gs_dec_amr_wb_fx( const long core_brate, Word16 *seed_tcx, const Word16 dct_in_fx[], const Word16 Q_dct_in, Word16 dct_out_fx[], Word16 Q_dct_out, const Word16 pitch_fx[], const Word16 voice_fac, const Word16 clas, const Word16 coder_type -); +static void gs_dec_amr_wb_fx( const long core_brate, Word16 *seed_tcx, const Word16 dct_in_fx[], const Word16 Q_dct_in, Word16 dct_out_fx[], Word16 Q_dct_out, const Word16 pitch_fx[], const Word16 voice_fac, const Word16 clas, const Word16 coder_type ); /*-------------------------------------------------------------------* * NoiseFill_fx() @@ -455,8 +454,7 @@ void improv_amr_wb_gs_fx( * Go back to time domain -> Overwrite exctiation *------------------------------------------------------------*/ edct_16fx( exc2_fx, dct_exc_in_fx, L_FRAME, 6, EVS_MONO ); - gs_dec_amr_wb_fx( core_brate, seed_tcx, dct_exc_in_fx, Q_exc2, dct_exc_out_fx, Q_exc2, pitch_buf_fx, lt_voice_fac_fx, clas, coder_type - ); + gs_dec_amr_wb_fx( core_brate, seed_tcx, dct_exc_in_fx, Q_exc2, dct_exc_out_fx, Q_exc2, pitch_buf_fx, lt_voice_fac_fx, clas, coder_type ); edct_16fx( dct_exc_out_fx, exc2_fx, L_FRAME, 6, EVS_MONO ); /*------------------------------------------------------------* diff --git a/lib_dec/tns_base_dec_fx.c b/lib_dec/tns_base_dec_fx.c index def1ffefb..a5df03490 100644 --- a/lib_dec/tns_base_dec_fx.c +++ b/lib_dec/tns_base_dec_fx.c @@ -67,8 +67,7 @@ ReadTnsData( return TNS_NO_ERROR; } -void -ReadTnsData_ivas_fx( +void ReadTnsData_ivas_fx( STnsConfig const *pTnsConfig, Decoder_State *st, Word16 *pnBits, /*Q0*/ diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 7465a7f65..b45b78ad1 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -227,8 +227,7 @@ void TonalMDCTConceal_SaveFreqSignal( Word16 nNewSamplesCore, // Q0 const Word16 *scaleFactors, // Q31-scaleFactors_exp const Word16 *scaleFactors_exp, - const Word16 gain_tcx_exp -) + const Word16 gain_tcx_exp ) { Word16 *temp; Word16 nOldSamples, tmp_exp, s, i, max_exp; diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 5c0e4911c..2f7870ab6 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -53,8 +53,7 @@ void init_coder_ace_plus_fx( /* Bitrate */ st->tcxonly = (Word8) getTcxonly( - st->total_brate - ); + st->total_brate ); move16(); /* Core Sampling Rate */ -- GitLab