diff --git a/lib_com/core_com_config_fx.c b/lib_com/core_com_config_fx.c index bc3fb90d86592dc434d516565a46be29fcc25e72..dbd6fa4d23875f87d720ae5be3a9d5c33ade79a8 100644 --- a/lib_com/core_com_config_fx.c +++ b/lib_com/core_com_config_fx.c @@ -825,11 +825,7 @@ Word16 getTcxLpcShapedAri( * Initialization of TCX *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_functions void init_tcx_cfg_fx( -#else -void init_tcx_cfg_ivas_fx( -#endif TCX_CONFIG_HANDLE hTcxCfg, const Word32 total_brate, /*Q0*/ const Word32 sr_core, /*Q0*/ @@ -845,12 +841,8 @@ void init_tcx_cfg_ivas_fx( const Word16 infoIGFStopFreq, /*Q0*/ const Word16 element_mode, /*Q0*/ const Word16 ini_frame, /*Q0*/ -#ifdef HARMONIZE_2567_init_functions - const Word16 MCT_flag, /*Q0*/ + const Word16 MCT_flag, /*Q0*/ const Word16 fscaleFB /*Q0*/ ) -#else - const Word16 MCT_flag /*Q0*/ ) -#endif { Word16 i; Word16 mdctWindowLength; @@ -867,12 +859,8 @@ void init_tcx_cfg_ivas_fx( hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length; /*Q0*/ move16(); - mdctWindowLength = getMdctWindowLength_fx( fscale ); /*Q0*/ -#ifdef HARMONIZE_2567_init_functions + mdctWindowLength = getMdctWindowLength_fx( fscale ); /*Q0*/ mdctWindowLengthFB = getMdctWindowLength_fx( fscaleFB ); /*Q0*/ /* this replaces (int16_t) ( mdctWindowLength * input_Fs / sr_core ) as used in float */ -#else - mdctWindowLengthFB = (Word16) ( mdctWindowLength * input_Fs / sr_core ); -#endif init_tcx_window_cfg_fx( hTcxCfg, sr_core, input_Fs, L_frame, L_frameTCX, mdctWindowLength, mdctWindowLengthFB, element_mode ); /* SQ deadzone & memory quantization*/ @@ -1092,153 +1080,3 @@ void init_tcx_window_cfg_fx( return; } - -#ifndef HARMONIZE_2567_init_functions -void init_tcx_cfg_fx( - TCX_CONFIG_HANDLE hTcxCfg, - const Word32 total_brate, /*Q0*/ - const Word32 sr_core, /*Q0*/ - const Word32 input_Fs, /*Q0*/ - const Word16 L_frame, /*Q0*/ - const Word16 bwidth, /*Q0*/ - const Word16 L_frameTCX, /*Q0*/ - const Word16 fscale, /*Q0*/ - const Word16 preemph_fac, /*Q15*/ - const Word16 tcxonly, /*Q0*/ - const Word16 rf_mode, /*Q0*/ - const Word16 igf, /*Q0*/ - const Word16 infoIGFStopFreq, /*Q0*/ - const Word16 element_mode, /*Q0*/ - const Word16 ini_frame, /*Q0*/ - const Word16 MCT_flag, /*Q0*/ - const Word16 fscaleFB /*Q0*/ ) -{ - Word16 i; - Word16 mdctWindowLength; - Word16 mdctWindowLengthFB; - Word16 na_scale_bwidth; - - hTcxCfg->preemph_fac = preemph_fac; - move16(); - - hTcxCfg->tcx5Size = shr( L_frame, 2 ); /* Always 5 ms Q0*/ - hTcxCfg->tcx5SizeFB = shr( L_frameTCX, 2 ); /* Always 5 ms Q0*/ - move16(); - move16(); - - hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length; /*Q0*/ - move16(); - mdctWindowLength = getMdctWindowLength_fx( fscale ); /*Q0*/ - mdctWindowLengthFB = getMdctWindowLength_fx( fscaleFB ); /*Q0*/ - init_tcx_window_cfg_fx( hTcxCfg, sr_core, input_Fs, L_frame, L_frameTCX, mdctWindowLength, mdctWindowLengthFB, element_mode ); - /* SQ deadzone & memory quantization*/ - hTcxCfg->sq_rounding = 12288 /*0.375f Q15*/; /*deadzone of 1.25->rounding=1-1.25/2 (No deadzone=0.5)*/ - move16(); - - /* TCX rate loop */ - hTcxCfg->tcxRateLoopOpt = 0; - move16(); - - if ( tcxonly != 0 ) - { - hTcxCfg->tcxRateLoopOpt = 2; - move16(); - } - if ( EQ_16( element_mode, IVAS_CPE_MDCT ) ) - { - hTcxCfg->tcxRateLoopOpt = 3; - move16(); - } - hTcxCfg->bandwidth = getTcxBandwidth( bwidth ); /*Q15*/ - move16(); - - /* set number of coded lines */ - hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth ); /*Q0*/ - move16(); - - /* TNS in TCX */ - hTcxCfg->pCurrentTnsConfig = NULL; - hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, igf, element_mode ); /*Q0*/ - move16(); - - IF( hTcxCfg->fIsTNSAllowed ) - { - InitTnsConfigs_fx( bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, MCT_flag ); - - SetAllowTnsOnWhite( hTcxCfg->tnsConfig, (Word8) EQ_16( element_mode, IVAS_CPE_MDCT ) ); - } - - IF( ini_frame == 0 ) - { - hTcxCfg->tcx_curr_overlap_mode = hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; - hTcxCfg->last_aldo = 1; - move16(); - move16(); - move16(); - } - - /* Context HM*/ - hTcxCfg->ctx_hm = getCtxHm( element_mode, total_brate, rf_mode ); /*Q0*/ - move16(); - - /* Residual Coding*/ - hTcxCfg->resq = getResq( total_brate ); /*Q0*/ - move16(); - test(); - if ( hTcxCfg->resq && !tcxonly ) - { - hTcxCfg->tcxRateLoopOpt = 1; - move16(); - } - - /*Set bandwidth scale*/ - IF( EQ_16( bwidth, NB ) ) - { - na_scale_bwidth = NB; - } - ELSE IF( LE_32( sr_core, INT_FS_16k ) ) - { - na_scale_bwidth = WB; - } - ELSE - { - na_scale_bwidth = SWB; - } - move16(); - hTcxCfg->na_scale = 32767 /*1.0f Q15*/; - move16(); - - test(); - IF( LT_16( na_scale_bwidth, SWB ) && !tcxonly ) - { - FOR( i = 0; i < SIZE_SCALE_TABLE_TCX; i++ ) - { - test(); - test(); - IF( ( EQ_16( na_scale_bwidth, scaleTcxTable[i].bwmode ) ) && - ( GE_32( total_brate, scaleTcxTable[i].bitrateFrom ) ) && - ( LT_32( total_brate, scaleTcxTable[i].bitrateTo ) ) ) - { - if ( rf_mode ) - { - i = sub( i, 1 ); - } - hTcxCfg->na_scale = scaleTcxTable[i].scale; /*Q15*/ - move16(); - BREAK; - } - } - } - - IF( tcxonly ) - { - InitPsychLPC_fx( sr_core, L_frame, hTcxCfg ); - } - ELSE - { - hTcxCfg->psychParamsCurrent = NULL; - } - - return; -} -#endif diff --git a/lib_com/options.h b/lib_com/options.h index e551595cf5517369f8909a709caa2d3d7bbd8e34..aebd87cb0b43e3205fe7119a528b0c78e1e22d37 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -86,16 +86,6 @@ #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */ #define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define HARMONIZE_2595_reconfig_decoder_LPD /* FhG: Harmonize reconfig_decoder_LPD with its ivas derivate */ -#define HARMONIZE_2596_SetModeIndex /* FhG: Harmonize SetModeIndex with its ivas derivate */ -#define HARMONIZE_2597_ShapeSpectrum /* FhG: Harmonize ShapeSpectrum with its ivas derivate */ -#define HARMONIZE_2567_init_functions /* FhG: harmonize derivates for evs/ivas regarding functions init_acelp*(),init_tcx_cfg*(), init_tcx*(), init_coder_ace_plus*(), init_core_sig_ana*() and init_modes*() */ -#define HARMONIZE_2607_GetFilterParameters /* FhG: Harmonize GetFilterParameters with its ivas derivate */ -#define HAMRONIZE_2606_ENC_PRM /* FhG: Harmonize enc_prm_fx(), to match floating-point code */ -#define HARMONIZE_2604_decoder_tcx_post /* FhG: Harmonize decoder_tcx_post with its ivas derivate */ -#define HARMONIZE_2598_tcx_arith_decode_envelope /* FhG: harmonize tcx_arith_decode_envelope between EVS and IVAS versions */ -#define HARMONIZE_2598_tcx_arith_encode_envelope /* FhG: harmonize tcx_arith_encode_envelope between EVS and IVAS versions */ -#define FIX_ISSUE_2594_FALSE_COMMENT /* FhG: basop issue 2594: fixing false comments about Q value*/ #define FIX_ISSUE_2616_BOUNDARY_CONDITION /* FhG: basop issue 2616: Inconsistent boundary conditions in function stereo_dft_dequantize_res_gains*/ #define FIX_ISSUE_2613_WRONG_COMP_MACRO /* FhG: basop issue 2613: Inconsistent comparison macros in function tdm_SCh_LSF_intra_pred_fx*/ #define FIX_ISSUE_2611_WRONG_COMMENT /* FhG: basop issue 2611: Wrong Q value comment in fucntion stereo_dft_sg_recovery_fx()*/ @@ -107,8 +97,6 @@ /* any switch which is non-be wrt. TS 26.251 V3.0 */ #define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */ -#define FIX_BASOP_2599_TCA_OVERFLOW /* VA: issue 2599, Fix TCA overflow */ -#define FIX_2588_MISSING_CONDITIONS /* VA: Proposed fix to 2588, addition of a condition in lsf_dec */ #define FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI /* Nokia: BASOP issue 2442: Increase accuracy of computations and add additional gain clamp for low energy decorrelated signal rendering. */ #define FIX_FMSW_DEC_EXT /* float issue 1566: fix EXT output in format switching */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 6458662e7e8522d0f2acdea2d7b0c5b6262879dc..1ae85a4d1269a91d4984ed459e85ff1264f4e18a 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -3794,14 +3794,6 @@ void tcx_get_gain( Word16 *en_y_e /* o: energy of y exponent (optional) */ ); -#ifndef HARMONIZE_2567_init_functions -void init_TCX_config( - TCX_CONFIG_HANDLE hTcxCfg, - Word16 L_frame, - Word16 fscale, - Word16 L_frameTCX, - Word16 fscaleFB ); -#endif void resetTecDec_Fx( TEC_DEC_HANDLE hTecDec ); @@ -5723,26 +5715,6 @@ void init_tcx_window_cfg_fx( const Word16 element_mode /* i : mode of CPE/SCE */ ); -#ifndef HARMONIZE_2567_init_functions -void init_tcx_cfg_fx( - TCX_CONFIG_HANDLE hTcxCfg, - const Word32 total_brate, - const Word32 sr_core, - const Word32 input_Fs, - const Word16 L_frame, - const Word16 bwidth, - const Word16 L_frameTCX, - const Word16 fscale, - const Word16 preemph_fac, /*Q15*/ - const Word16 tcxonly, - const Word16 rf_mode, - const Word16 igf, - const Word16 infoIGFStopFreq, - const Word16 element_mode, - const Word16 ini_frame, - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */, - const Word16 fscaleFB ); -#endif void syn_output_fx( const Word16 codec_mode, /* i : MODE1 or MODE2 */ @@ -7821,21 +7793,8 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx( CONTEXT_HM_CONFIG *hm_cfg /* i : context-based harmonic model configuration*/ ); -#ifndef HARMONIZE_2595_reconfig_decoder_LPD -void reconfig_decoder_LPD_fx( - Decoder_State *st, /* i/o: decoder state structure */ - Word16 bits_frame, /* i : bit budget Q0*/ - Word16 bwidth, /* i : audio bandwidth Q0*/ - Word32 total_brate, /* i : total bitrate Q0*/ - Word16 L_frame_old /* i : frame length Q0*/ -); -#endif -#ifdef HARMONIZE_2595_reconfig_decoder_LPD void reconfig_decoder_LPD_fx( -#else -void reconfig_decoder_LPD_ivas_fx( -#endif Decoder_State *st, /* i/o: decoder state structure */ const Word16 bits_frame, /* i : bit budget Q0*/ const Word16 bwidth, /* i : audio bandwidth Q0*/ @@ -7996,34 +7955,6 @@ void decoder_tcx_ivas_fx( const Word16 frame_cnt, const Word16 sba_dirac_stereo_flag ); -#ifndef HARMONIZE_2604_decoder_tcx_post -void decoder_tcx_post_fx( - Decoder_State *st_fx, - Word16 *synth, - Word16 *synthFB, - Word16 *A, - Word16 bfi ); -#endif - -#ifndef HARMONIZE_2598_tcx_arith_decode_envelope -void tcx_arith_decode_envelope_fx( - Word32 q_spectrum[], /* o: quantised MDCT coefficients Q31-e */ - Word16 *q_spectrum_e, /* o: MDCT exponent Q0 */ - Word16 L_frame, /* i: frame or MDCT length */ - Word16 L_frame_orig, /* i: length w/o BW limitation */ - Decoder_State *st, - const Word16 A_ind[], /* i: quantised LPC coefficients */ - Word16 target_bits, /* i: number of available bits */ - Word16 prm[], /* i: bitstream parameters */ - Word8 use_hm, /* i: use HM in current frame? */ - Word16 prm_hm[], /* i: HM parameter area */ - Word16 tcxltp_pitch, /* i: TCX LTP pitch in FD, -1 if n/a*/ - Word16 *arith_bits, /* o: bits used for ari. coding */ - Word16 *signaling_bits, /* o: bits used for signaling */ - Word16 *nf_seed, /* o: noise filling seed Q0 */ - Word16 low_complexity /* i: low-complexity flag Q0 */ -); -#endif void tcx_decoder_memory_update( Word16 *xn_buf, /* i/o: mdct output buffer used also as temporary buffer : Q0 */ @@ -8429,7 +8360,6 @@ UWord32 mvl2s_r( const Word16 n /* i : vector size */ ); -#ifdef HARMONIZE_2604_decoder_tcx_post void decoder_tcx_post_fx( Decoder_State *st_fx, Word16 *synth, // Q_syn Word16 *synthFB, // Q_syn @@ -8437,15 +8367,6 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, Word16 *A, // Q: 14 - norm_s(A[0]) Word16 bfi, Word16 MCT_flag ); -#else -void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, - Word16 *synth, // Q_syn - Word16 *synthFB, // Q_syn - Word16 Q_syn, - Word16 *A, // Q: 14 - norm_s(A[0]) - Word16 bfi, - Word16 MCT_flag ); -#endif void con_tcx_fx( Decoder_State *st, /* i/o: coder memory state */ @@ -9538,20 +9459,12 @@ void writeTCXparam_fx( const Word16 target_bitsTCX10[2], const Word16 pre_past_flag ); -#ifdef HARMONIZE_2567_init_functions void init_coder_ace_plus_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ const Word32 igf_brate, /* i : IGF configuration bitrate */ const Word16 shift, const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -#else -void init_coder_ace_plus_ivas_fx( - Encoder_State *st, /* i : Encoder state */ - const Word32 last_total_brate, /* i : last total bitrate */ - const Word32 igf_brate, /* i : IGF configuration bitrate */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -#endif ); void core_coder_reconfig_ivas_fx( @@ -9565,26 +9478,14 @@ void core_coder_mode_switch_ivas_fx( ); -#ifdef HARMONIZE_2596_SetModeIndex void SetModeIndex_fx( -#else -void SetModeIndex_ivas_fx( -#endif Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate Q0*/ const Word16 last_element_mode, /* i : last IVAS element mode Q0*/ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) Q0*/ -#ifdef HARMONIZE_2596_SetModeIndex - , - const Word16 shift -#endif -); + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ + const Word16 shift ); -#ifdef HARMONIZE_2567_init_functions void init_tcx_cfg_fx( -#else -void init_tcx_cfg_ivas_fx( -#endif TCX_CONFIG_HANDLE hTcxCfg, const Word32 total_brate, /*Q0*/ const Word32 sr_core, /*Q0*/ @@ -9600,12 +9501,8 @@ void init_tcx_cfg_ivas_fx( const Word16 infoIGFStopFreq, /*Q0*/ const Word16 element_mode, /*Q0*/ const Word16 ini_frame, /*Q0*/ -#ifdef HARMONIZE_2567_init_functions - const Word16 MCT_flag, /*Q0*/ + const Word16 MCT_flag, /*Q0*/ const Word16 fscaleFB /*Q0*/ ); -#else - const Word16 MCT_flag /*Q0*/ ); -#endif Word16 msvq_stage1_dct_search_fx( const Word32 *u_fx, /* i : target exp : u_e */ @@ -9999,7 +9896,6 @@ void tcx_arith_render_envelope_ivas_fx( Word32 env[] /* o : shaped signal envelope Q16*/ ); -#ifdef HARMONIZE_2598_tcx_arith_decode_envelope void tcx_arith_decode_envelope_fx( Decoder_State *st, /* i/o: coder state */ /*EVS: move argument 5->1 */ @@ -10017,23 +9913,6 @@ void tcx_arith_decode_envelope_fx( Word16 *signaling_bits, /* o : bits used for signaling */ Word16 *nf_seed, /* o : noise filling seed Q0 */ const Word16 low_complexity /* i : low-complexity flag */ -#else -void tcx_arith_decode_envelope_ivas_fx( - Decoder_State *st, /* i/o: coder state */ - Word32 q_spectrum[], /* o : quantised MDCT coefficients Q(31-q_spectrum_e) */ - Word16 *q_spectrum_e, /* o : MDCT exponent */ - const Word16 L_frame, /* i : frame or MDCT length */ - Word16 L_spec, /* i : length w/o BW limitation */ - const Word16 A_ind[], /* i : quantised LPC coefficients */ - const Word16 target_bits, /* i : number of available bits */ - Word16 prm[], /* i : bitstream parameters */ - const Word16 use_hm, /* i : use HM in current frame? */ - Word16 prm_hm[], /* i : HM parameter area */ - Word16 tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a*/ - Word16 *arith_bits, /* o : bits used for ari. coding */ - Word16 *signaling_bits, /* o : bits used for signaling */ - const Word16 low_complexity /* i : low-complexity flag */ -#endif ); void UnmapIndex_fx( diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index dd8b02cc0b780bfaec14fa3017d492f02c9c84e8..686f1f3ccbc5593a565f44e7e860b969ef2919ff 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -2155,57 +2155,3 @@ void tcx_get_gain( return; } - - -#ifndef HARMONIZE_2567_init_functions -void init_TCX_config( - TCX_CONFIG_HANDLE hTcxCfg, - Word16 L_frame, /*Q0*/ - Word16 fscale, /*Q0*/ - Word16 L_frameTCX, /*Q0*/ - Word16 fscaleFB /*Q0*/ ) -{ - /* Initialize the TCX MDCT windows */ - hTcxCfg->tcx_mdct_window_length = extract_l( L_shr( L_mult0( L_LOOK_12k8, fscale ), LD_FSCALE_DENOM ) ); /*Q0*/ - move16(); - hTcxCfg->tcx_mdct_window_delay = hTcxCfg->tcx_mdct_window_length; /*Q0*/ - move16(); - - hTcxCfg->tcx_mdct_window_half_length = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), fscale ), LD_FSCALE_DENOM ) ); - move16(); - hTcxCfg->tcx_mdct_window_min_length = shr( L_frame, 4 ); /* 1.25ms Q0*/ - move16(); - hTcxCfg->tcx_mdct_window_trans_length = shr( L_frame, 4 ); /* 1.25ms Q0*/ - move16(); - hTcxCfg->tcx5Size = shr( L_frame, 2 ); /* 5ms Q0*/ - move16(); - hTcxCfg->tcx_mdct_window_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8, fscaleFB ), LD_FSCALE_DENOM ) ); /*Q0*/ - move16(); - hTcxCfg->tcx_mdct_window_delayFB = hTcxCfg->tcx_mdct_window_lengthFB; /*Q0*/ - move16(); - - hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l( L_shr( L_mult0( L_LOOK_12k8 - NS2SA( 12800, 5000000L ), fscaleFB ), LD_FSCALE_DENOM ) ); /*Q0*/ - move16(); - hTcxCfg->tcx_mdct_window_min_lengthFB = shr( L_frameTCX, 4 ); /* 1.25ms Q0*/ - move16(); - hTcxCfg->tcx_mdct_window_trans_lengthFB = shr( L_frameTCX, 4 ); /* 1.25ms Q0*/ - move16(); - hTcxCfg->tcx5SizeFB = shr( L_frameTCX, 2 ); /* 5ms Q0*/ - move16(); - mdct_window_sine( hTcxCfg->tcx_mdct_window, hTcxCfg->tcx_mdct_window_length ); - mdct_window_sine( hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_half_length ); - mdct_window_sine( hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_min_length ); - mdct_window_sine( hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_trans_length ); - - mdct_window_sine( hTcxCfg->tcx_mdct_windowFB, hTcxCfg->tcx_mdct_window_lengthFB ); - mdct_window_sine( hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_half_lengthFB ); - mdct_window_sine( hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_min_lengthFB ); - mdct_window_sine( hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_trans_lengthFB ); - - /*ALDO windows for MODE2*/ - mdct_window_aldo( hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, L_frame ); - mdct_window_aldo( hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, L_frameTCX ); - - return; -} -#endif diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index 639b1d9cb355fa2539794787b4cc44cf786fb280..8582d24c666d0ea2ad98a73981a455a47e99c7f8 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -408,10 +408,9 @@ static void GetF0( Word32 /*int*/ const pitchLag, /*i - Q16*/ Word16 /*short*/ *const pOrigF0, /*o - Q10*/ Word32 *const pOrigF0_32, /*o - Q10+16*/ - Word16 /*short*/ *const pF0 /*o - Q10*/ - , - Word32 *const pF0_32, /*o - Q10+16*/ - const Word16 element_mode /*i EVS_MONO or anything else */ + Word16 /*short*/ *const pF0, /*o - Q10*/ + Word32 *const pF0_32, /*o - Q10+16*/ + const Word16 element_mode /*i EVS_MONO or anything else */ ) { Word16 /*short*/ tmpPitchLag; @@ -587,10 +586,9 @@ static void findStrongestHarmonics( static void CorrectF0( const Word16 /*short*/ *pHarmonicIndexes, /*I - Q0 */ const Word16 /*short*/ nHarmonics, /*I - Q0 */ - Word16 /*short*/ *pF0 /*I/O - Q10 range: {0}, [4..18) */ - , - Word32 /*long*/ *pF0_32, /*I/O - Q10+16 range: {0}, [4..18), NULL for EVS_MONO */ - const Word16 element_mode /*I EVS_MONO or anything else */ + Word16 /*short*/ *pF0, /*I/O - Q10 range: {0}, [4..18) */ + Word32 /*long*/ *pF0_32, /*I/O - Q10+16 range: {0}, [4..18), NULL for EVS_MONO */ + const Word16 element_mode /*I EVS_MONO or anything else */ ) { Word16 /*short*/ i; @@ -797,13 +795,12 @@ static void CorrectF0( static void modifyThreshold( - Word16 /*short*/ i, /*I - Q0 */ - Word16 /*short*/ F0, /*I - Q10*/ - Word32 F0_32, /*I - Q26*/ - Word16 /*short*/ threshold, /*I - Q10*/ - Word32 threshold_32, /*I - Q26*/ - Word16 * /*short*/ thresholdModification /*I - Q10*/ - , + Word16 /*short*/ i, /*I - Q0 */ + Word16 /*short*/ F0, /*I - Q10*/ + Word32 F0_32, /*I - Q26*/ + Word16 /*short*/ threshold, /*I - Q10*/ + Word32 threshold_32, /*I - Q26*/ + Word16 * /*short*/ thresholdModification, /*I - Q10*/ Word32 * /*long*/ thresholdModification32, /*I - Q26*/ const Word16 element_mode /*I/O - Q10*/ ) @@ -847,12 +844,11 @@ static void modifyThreshold( static void modifyThresholds( - Word16 /*short*/ F0, /*I - Q10*/ - Word32 F0_32, /*I - Q26*/ - Word16 /*short*/ origF0, /*I - Q10*/ - Word32 origF0_32, /*I - Q26*/ - Word16 * /*short*/ thresholdModification /*Q10*/ - , + Word16 /*short*/ F0, /*I - Q10*/ + Word32 F0_32, /*I - Q26*/ + Word16 /*short*/ origF0, /*I - Q10*/ + Word32 origF0_32, /*I - Q26*/ + Word16 * /*short*/ thresholdModification, /*Q10*/ Word32 * /*long*/ thresholdModification32, /*Q26*/ const Word16 element_mode /*I EVS_MONO or anything else */ ) @@ -1264,13 +1260,12 @@ static void findTonalComponents_fx( static void RefineThresholdsUsingPitch_fx( const Word16 nSamples, const Word16 nSamplesCore, - const Word32 powerSpectrum[], /*Qx*/ - const Word32 lastPitchLag, /*Qx*/ - const Word32 currentPitchLag, /*Qx*/ - Word16 *pF0, /*Q10*/ - Word32 *pF0_32, /*Q10+Q16, NULL in EVS_MONO mode */ - Word16 *thresholdModification /*Q10*/ - , + const Word32 powerSpectrum[], /*Qx*/ + const Word32 lastPitchLag, /*Qx*/ + const Word32 currentPitchLag, /*Qx*/ + Word16 *pF0, /*Q10*/ + Word32 *pF0_32, /*Q10+Q16, NULL in EVS_MONO mode */ + Word16 *thresholdModification, /*Q10*/ Word32 *thresholdModification32, /*Q10+Q16, NULL in EVS_MONO mode */ const Word16 element_mode /*Q0 EVS_MONO or anything else */ ) diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index 96efe3fcd19624f62c5892295a3635794628d8a7..26bd9680b9bf5884b5a7a958f03ee543f5d44fa7 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -90,127 +90,6 @@ static Word16 tcx_arith_decode_fx( return bp; } -#ifndef HARMONIZE_2598_tcx_arith_decode_envelope -void tcx_arith_decode_envelope_fx( - Word32 q_spectrum[], /* o : quantised MDCT coefficients Q31-e */ - Word16 *q_spectrum_e, /* o : MDCT exponent Q0 */ - Word16 L_frame, /* i : frame or MDCT length Q0 */ - Word16 L_spec, /* i : length w/o BW limitation Q0 */ - Decoder_State *st, /* i/o: coder state */ - const Word16 A_ind[], /* i : quantised LPC coefficients Q12 */ - Word16 target_bits, /* i : number of available bits Q0 */ - Word16 prm[], /* i : bitstream parameters Q0 */ - Word8 use_hm, /* i : use HM in current frame? */ - Word16 prm_hm[], /* i : HM parameter area Q0 */ - Word16 tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a Q0 */ - Word16 *arith_bits, /* o : bits used for ari. coding Q0 */ - Word16 *signaling_bits, /* o : bits used for signaling Q0 */ - Word16 *nf_seed, /* o : noise filling seed Q0 */ - Word16 low_complexity /* i : low-complexity flag Q0 */ -) -{ - Word32 env[N_MAX_ARI]; /* unscaled envelope */ - Word16 *envelope; /* scaled envelope */ - Word16 envelope_e; - Word16 L_spec_core; - TCX_CONFIG_HANDLE tcx_cfg; - Word16 gamma_w, gamma_uw; - Word16 hm_bits; - tcx_cfg = st->hTcxCfg; - - test(); - test(); - test(); - test(); - test(); - test(); - test(); - IF( GT_16( L_spec, N_MAX_ARI ) || ( EQ_16( st->element_mode, EVS_MONO ) && GT_16( target_bits, ( ACELP_13k20 / FRAMES_PER_SEC ) ) ) || - ( EQ_16( st->element_mode, IVAS_SCE ) && ( GT_16( st->bits_frame_nominal, ( LPC_SHAPED_ARI_MAX_RATE / FRAMES_PER_SEC ) ) ) ) || - ( GT_16( st->element_mode, IVAS_SCE ) && ( GT_16( st->bits_frame_nominal, ( LPC_SHAPED_ARI_MAX_RATE_CPE / FRAMES_PER_SEC ) ) ) ) || - ( target_bits <= 0 ) ) - { - /* this could happen in case of bit errors */ - st->BER_detect = 1; - move16(); - L_spec = N_MAX_ARI; - move16(); - *signaling_bits = 0; - move16(); - *arith_bits = 0; - move16(); - set32_fx( q_spectrum, 0, L_frame ); - - return; - } - - *signaling_bits = 0; - move16(); - assert( st->hTcxDec->enableTcxLpc ); - - gamma_w = 32767 /*1.0f Q15*/; - move16(); - gamma_uw = st->inv_gamma; - move16(); - - tcx_arith_render_envelope( A_ind, L_frame, L_spec, tcx_cfg->preemph_fac, gamma_w, gamma_uw, env ); - - IF( use_hm ) - { - IF( prm_hm[0] ) - { - tcx_hm_decode( L_spec, env, target_bits, tcx_cfg->coder_type, prm_hm, tcxltp_pitch, &hm_bits ); - - IF( hm_bits < 0 ) - { - st->BER_detect = 1; - move16(); - *signaling_bits = 0; - move16(); - *arith_bits = 0; - move16(); - set32_fx( q_spectrum, 0, L_frame ); - return; - } - } - ELSE - { - hm_bits = 1; - move16(); - } - *signaling_bits = add( *signaling_bits, hm_bits ); - move16(); - } - ELSE - { - prm_hm[0] = 0; /* just to be sure */ - move16(); - } - - L_spec_core = L_spec; - move16(); - IF( st->igf ) - { - L_spec_core = s_min( L_spec_core, st->hIGFDec->infoIGFStartLine ); - } - envelope = (Word16 *) env; - - tcx_arith_scale_envelope( L_spec, L_spec_core, env, target_bits, low_complexity, envelope, &envelope_e ); - - *arith_bits = tcx_arith_decode_fx( L_spec, envelope, envelope_e, target_bits, prm, q_spectrum, q_spectrum_e, nf_seed ); - move16(); - - /* safety check in case of bit errors */ - IF( *arith_bits < 0 ) - { - st->BER_detect = 1; - move16(); - set32_fx( q_spectrum, 0, L_frame ); - } - - set32_fx( q_spectrum + L_spec, 0, sub( L_frame, L_spec ) ); -} -#endif /*-------------------------------------------------------* * tcx_arith_decode() @@ -295,7 +174,6 @@ static Word16 tcx_arith_decode_ivas_fx( * *-------------------------------------------------------*/ -#ifdef HARMONIZE_2598_tcx_arith_decode_envelope void tcx_arith_decode_envelope_fx( Decoder_State *st, /* i/o: coder state */ /*EVS: move argument 5->1 */ @@ -314,23 +192,6 @@ void tcx_arith_decode_envelope_fx( Word16 *nf_seed, /* o : noise filling seed Q0 */ /*IVAS: 0*/ const Word16 low_complexity /* i : low-complexity flag */ -#else -void tcx_arith_decode_envelope_ivas_fx( - Decoder_State *st, /* i/o: coder state */ - Word32 q_spectrum[], /* o : quantised MDCT coefficients Q(31-q_spectrum_e) */ - Word16 *q_spectrum_e, /* o : MDCT exponent */ - const Word16 L_frame, /* i : frame or MDCT length */ - Word16 L_spec, /* i : length w/o BW limitation */ - const Word16 A_ind[], /* i : quantised LPC coefficients */ - const Word16 target_bits, /* i : number of available bits */ - Word16 prm[], /* i : bitstream parameters */ - const Word16 use_hm, /* i : use HM in current frame? */ - const Word16 prm_hm[], /* i : HM parameter area */ - Word16 tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a*/ - Word16 *arith_bits, /* o : bits used for ari. coding */ - Word16 *signaling_bits, /* o : bits used for signaling */ - const Word16 low_complexity /* i : low-complexity flag */ -#endif ) { Word32 env[N_MAX_ARI]; /* unscaled envelope (Q16) */ @@ -376,18 +237,14 @@ void tcx_arith_decode_envelope_ivas_fx( move16(); gamma_uw = st->inv_gamma; move16(); -#ifdef HARMONIZE_2598_tcx_arith_decode_envelope IF( EQ_16( st->element_mode, EVS_MONO ) ) { tcx_arith_render_envelope( A_ind, L_frame, L_spec, hTcxCfg->preemph_fac, gamma_w, gamma_uw, env ); } ELSE { -#endif tcx_arith_render_envelope_ivas_fx( A_ind, L_frame, L_spec, hTcxCfg->preemph_fac, gamma_w, gamma_uw, env ); -#ifdef HARMONIZE_2598_tcx_arith_decode_envelope } -#endif IF( use_hm != 0 ) @@ -427,18 +284,14 @@ void tcx_arith_decode_envelope_ivas_fx( envelope = (Word16 *) env; tcx_arith_scale_envelope( L_spec, L_spec_core, env, target_bits, low_complexity, envelope, &envelope_e ); -#ifdef HARMONIZE_2598_tcx_arith_decode_envelope IF( EQ_16( st->element_mode, EVS_MONO ) ) { *arith_bits = tcx_arith_decode_fx( L_spec, envelope, envelope_e, target_bits, prm, q_spectrum, q_spectrum_e, nf_seed ); } ELSE { -#endif *arith_bits = tcx_arith_decode_ivas_fx( L_spec, envelope, envelope_e, target_bits, prm, q_spectrum, q_spectrum_e ); -#ifdef HARMONIZE_2598_tcx_arith_decode_envelope } -#endif move16(); /* safety check in case of bit errors */ diff --git a/lib_dec/core_dec_reconf_fx.c b/lib_dec/core_dec_reconf_fx.c index e7905e262b27b9a14f5b76aa69ab3999e97ce147..38904a725f4cb2e5356c508ab4b254e03e8c0c6a 100644 --- a/lib_dec/core_dec_reconf_fx.c +++ b/lib_dec/core_dec_reconf_fx.c @@ -10,11 +10,7 @@ #include "rom_com.h" -#ifdef HARMONIZE_2595_reconfig_decoder_LPD void reconfig_decoder_LPD_fx( -#else -void reconfig_decoder_LPD_ivas_fx( -#endif Decoder_State *st, /* i/o: decoder state structure */ const Word16 bits_frame, /* i : bit budget Q0*/ const Word16 bwidth, /* i : audio bandwidth Q0*/ @@ -172,10 +168,8 @@ void reconfig_decoder_LPD_ivas_fx( ELSE { set16_fx( st->mem_syn_clas_estim_fx, 0, L_SYN_MEM_CLAS_ESTIM ); /* Qx */ -#ifdef HARMONIZE_2595_reconfig_decoder_LPD st->classifier_Q_mem_syn = 0; move16(); -#endif } } } @@ -200,199 +194,3 @@ void reconfig_decoder_LPD_ivas_fx( return; } - -#ifndef HARMONIZE_2595_reconfig_decoder_LPD -void reconfig_decoder_LPD_fx( - Decoder_State *st, /* i/o: decoder state structure */ - Word16 bits_frame, /* i : bit budget Q0*/ - Word16 bwidth, /* i : audio bandwidth Q0*/ - Word32 total_brate, /* i : total bitrate Q0*/ - Word16 L_frame_old /* i : frame length Q0*/ -) -{ - Word16 newLen; - Word16 oldLen; - Word32 lowrate_tcxlpc_max_br; - - TCX_LTP_DEC_HANDLE hTcxLtpDec; - TCX_DEC_HANDLE hTcxDec; - - hTcxLtpDec = st->hTcxLtpDec; - hTcxDec = st->hTcxDec; - - move16(); - st->bits_frame = bits_frame; - - IF( EQ_16( bwidth, NB ) ) - { - move16(); - st->narrowBand = 1; - } - ELSE IF( GT_16( bwidth, NB ) ) - { - move16(); - st->narrowBand = 0; - } - - BITS_ALLOC_init_config_acelp( st->total_brate, st->narrowBand, st->nb_subfr, &( st->acelp_cfg ) ); - - /*Configuration of partial copy*/ - st->acelp_cfg_rf.mode_index = 1; - move16(); - st->acelp_cfg_rf.midLpc = 0; - move16(); - st->acelp_cfg_rf.midLpc_enable = 0; - move16(); - st->acelp_cfg_rf.pre_emphasis = 0; - move16(); - st->acelp_cfg_rf.formant_enh = 1; - move16(); - st->acelp_cfg_rf.formant_tilt = 1; - move16(); - st->acelp_cfg_rf.voice_tilt = 1; - move16(); - st->acelp_cfg_rf.formant_enh_num = FORMANT_SHARPENING_G1; - move16(); - st->acelp_cfg_rf.formant_enh_den = FORMANT_SHARPENING_G2; - move16(); - - - IF( NE_16( st->element_mode, IVAS_SCE ) ) - { - st->flag_cna = (Word8) getCnaPresent_fx( st->element_mode, st->element_brate, total_brate, bwidth ); - move16(); - } - - /* TCX-LTP */ - IF( hTcxLtpDec != NULL ) - { - hTcxLtpDec->tcxltp = getTcxLtp( st->sr_core ); - move16(); - } - - IF( st->hTcxCfg != NULL ) - { - Word16 i; - - /*Scale TCX for non-active frames to adjust loudness with ACELP*/ - st->hTcxCfg->na_scale = 32767 /*1.0f Q15*/; - test(); - IF( ( LT_16( bwidth, SWB ) ) && !( st->tcxonly ) ) - { - Word16 scaleTableSize = idiv1616( sizeof( scaleTcxTable ), sizeof( scaleTcxTable[0] ) ); /* is a constant */ - - FOR( i = 0; i < scaleTableSize; i++ ) - { - test(); - test(); - IF( ( EQ_16( bwidth, scaleTcxTable[i].bwmode ) ) && - ( GE_32( total_brate, scaleTcxTable[i].bitrateFrom ) ) && - ( LT_32( total_brate, scaleTcxTable[i].bitrateTo ) ) ) - { - IF( st->rf_flag ) - { - i = i - 1; - move16(); - } - st->hTcxCfg->na_scale = scaleTcxTable[i].scale; - move16(); - BREAK; - } - } - } - } - - /*if its not the first frame resample overlap buffer to new sampling rate */ - IF( ( st->ini_frame != 0 ) ) - { - test(); - test(); - test(); - test(); - test(); - IF( st->hTcxCfg != NULL && - ( NE_16( st->fscale, st->fscale_old ) && - !( st->element_mode == EVS_MONO && EQ_16( st->last_codec_mode, MODE1 ) && - EQ_16( st->last_core, ACELP_CORE ) && st->prev_bfi != 0 ) ) ) - /* no resempling is needed here when recovering from mode 1 - acelp plc, since the buffers are already sampled with the - correct sampling rate in open_decoder_LPD_fx() */ - { - - newLen = st->hTcxCfg->tcx_mdct_window_length; - oldLen = st->hTcxCfg->tcx_mdct_window_length_old; - move16(); - move16(); - test(); - test(); - IF( ( st->prev_bfi && EQ_16( st->last_core_bfi, ACELP_CORE ) ) || EQ_16( st->last_core, ACELP_CORE ) ) - { - newLen = shr( st->L_frame, 1 ); - oldLen = shr( L_frame_old, 1 ); - } - IF( st->hTcxDec != NULL ) - { - lerp( hTcxDec->old_syn_Overl, hTcxDec->old_syn_Overl, newLen, oldLen ); - lerp( hTcxDec->syn_Overl, hTcxDec->syn_Overl, newLen, oldLen ); - - test(); - IF( st->prev_bfi && EQ_16( st->last_core_bfi, ACELP_CORE ) ) - { - lerp( hTcxDec->syn_Overl_TDAC, hTcxDec->syn_Overl_TDAC, newLen, oldLen ); - } - } - } - - - IF( LE_16( st->L_frame, L_FRAME16k ) ) - { - IF( LE_16( st->last_L_frame, L_FRAME16k ) ) - { - IF( NE_16( st->L_frame, st->last_L_frame ) ) - { - IF( GT_16( st->L_frame, st->last_L_frame ) ) - { - oldLen = extract_l( L_shr( Mpy_32_16_1( L_mult0( st->last_L_frame, getInvFrameLen( st->L_frame ) /*Q21*/ ) /*Q21*/, L_SYN_MEM_CLAS_ESTIM /*Q0*/ ) /*Q6*/, 6 ) /*Q0*/ ); - newLen = L_SYN_MEM_CLAS_ESTIM; - move16(); - move16(); - } - ELSE - { - oldLen = L_SYN_MEM_CLAS_ESTIM; - move16(); - newLen = extract_l( L_shr( Mpy_32_16_1( L_mult0( st->L_frame, getInvFrameLen( st->last_L_frame ) /*Q21*/ ) /*Q21*/, L_SYN_MEM_CLAS_ESTIM /*Q0*/ ) /*Q6*/, 6 ) /*Q0*/ ); - } - lerp( &st->mem_syn_clas_estim_fx[L_SYN_MEM_CLAS_ESTIM - oldLen], &st->mem_syn_clas_estim_fx[L_SYN_MEM_CLAS_ESTIM - newLen], newLen, oldLen ); - } - } - ELSE - { - set16_fx( st->mem_syn_clas_estim_fx, 0, L_SYN_MEM_CLAS_ESTIM ); - st->classifier_Q_mem_syn = 0; - move16(); - } - } - } - test(); - test(); - test(); - lowrate_tcxlpc_max_br = LOWRATE_TCXLPC_MAX_BR; - move16(); - IF( GT_16( st->element_mode, IVAS_SCE ) ) - { - lowrate_tcxlpc_max_br = LOWRATE_TCXLPC_MAX_BR_CPE; - move16(); - } - hTcxDec->enableTcxLpc = EQ_16( st->numlpc, 1 ) && EQ_16( st->lpcQuantization, 1 ) && ( LE_32( total_brate, lowrate_tcxlpc_max_br ) /*LOWRATE_TCXLPC_MAX_BR*/ || st->rf_flag ); - move16(); - IF( EQ_16( st->ini_frame, 0 ) ) - { - hTcxDec->envWeighted = 0; - move16(); - } - - - return; -} -#endif diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index 07c9f68a197a3f2db429a6fabccfd68057a6d40c..bf0f78081c71734aa87e81f1d61355a42d2107db 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -383,11 +383,7 @@ void mode_switch_decoder_LPD_ivas_fx( frame_size = FrameSizeConfig[frame_size_index].frame_net_bits; move16(); -#ifdef HARMONIZE_2595_reconfig_decoder_LPD reconfig_decoder_LPD_fx( st, frame_size, bwidth, total_brate, st->last_L_frame ); -#else - reconfig_decoder_LPD_ivas_fx( st, frame_size, bwidth, total_brate, st->last_L_frame ); -#endif test(); IF( hTcxDec->envWeighted && !hTcxDec->enableTcxLpc ) diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index 9fee8f8a4b8af5cad3fc27fefcd697f9a6330f39..7630e504b179a8a6de648d8afd3cbf3ff3159878 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -770,11 +770,7 @@ void decoder_LPD_fx( { TonalMDCTConceal_SaveTimeSignal_fx( st->element_mode, st->hTonalMDCTConc, synthFB, 0, L_frameTCX ); } -#ifdef HARMONIZE_2604_decoder_tcx_post decoder_tcx_post_fx( st, synth, synthFB, 0, 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_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 0fb432b8be08dfc30e5fa046decf5b60cadf6b55..002856959d78e03a6b83a6c2b6e7e1deb3266fdf 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -356,7 +356,6 @@ void decoder_tcx_fx( move16(); } -#ifdef HARMONIZE_2598_tcx_arith_decode_envelope tcx_arith_decode_envelope_fx( st, x, &x_e, @@ -373,24 +372,6 @@ void decoder_tcx_fx( &nf_seed, shr( st->bwidth, 1 ) /* equivalent to: (st->bwidth > WB)?1:0 */ ); -#else - tcx_arith_decode_envelope_fx( - x, &x_e, - L_frame, - L_spec, - st, - Aind, - *prm_target, - prm_sqQ, - tmp8, - prm_hm, /* HM parameter area */ - hTcxDec->tcx_hm_LtpPitchLag, - &arith_bits, - &signaling_bits, - &nf_seed, - shr( st->bwidth, 1 ) /* equivalent to: (st->bwidth > WB)?1:0 */ - ); -#endif hTcxDec->resQBits[frame_cnt] = sub( *prm_target, arith_bits ); move16(); @@ -1275,270 +1256,7 @@ void decoder_tcx_fx( Copy( xn_bufFB + sub( shr( overlapFB, 1 ), tcx_offsetFB ), synthFB, L_frameTCX_glob ); } -#ifndef HARMONIZE_2604_decoder_tcx_post -void decoder_tcx_post_fx( Decoder_State *st_fx, - Word16 *synth, - Word16 *synthFB, - Word16 *A, - Word16 bfi ) -{ - Word16 i; - Word16 level_syn; - Word16 level_syn_e; - Word32 step; - Word16 gainCNG, gainCNG_e; - Word16 xn_buf[L_FRAME_MAX]; - Word16 tmp1, tmp2, s; - Word32 tmp32; - Word32 tmp32_1, tmp32_2; - TCX_DEC_HANDLE hTcxDec; - - hTcxDec = st_fx->hTcxDec; - - /* TCX output */ - Copy( synth, xn_buf, st_fx->L_frame ); - - /* first TCX frame after ACELP; overwrite ltp initialization done during acelp PLC */ - test(); - test(); - if ( !st_fx->bfi && st_fx->prev_bfi && st_fx->last_core == ACELP_CORE ) - { - hTcxDec->tcxltp_last_gain_unmodified = 0; - move16(); - } - test(); - IF( bfi != 0 && st_fx->use_partial_copy == 0 ) - { - test(); - /* run lpc gain compensation not for waveform adjustment */ - IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) ) - { - UWord32 dmy; - tmp32_1 /*gainHelperFB*/ = L_shl_r( L_deposit_h( hTcxDec->gainHelper ), sub( hTcxDec->gainHelper_e, 31 - 28 ) ); /*Q28*/ - tmp32_2 /*stepCompensateFB*/ = L_shl_r( L_deposit_h( hTcxDec->stepCompensate ), sub( hTcxDec->stepCompensate_e, 31 - 28 ) ); /*Q28*/ - - Mpy_32_32_ss( tmp32_2 /*Q28*/, - L_shl( L_mult0( st_fx->L_frame, - getInvFrameLen( hTcxDec->L_frameTCX ) /*Q21*/ ) /*Q21*/, - 8 ) /*Q29*/, - &tmp32_2, - &dmy ); /*Q26*/ - - tmp32_2 = L_shl( tmp32_2, 3 - 1 ); /*Q28*/ - - FOR( i = 0; i < hTcxDec->L_frameTCX; i++ ) - { - tmp32 = L_shl( tmp32_1 /*Q28*/, -( 28 - 15 ) ); /*16Q15*/ - synthFB[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( tmp32, synthFB[i] ), 16 ) ); - move16(); - tmp32_1 = L_sub( tmp32_1, tmp32_2 ); - } - } - tmp32_1 /*gainHelper*/ = L_shl_r( L_deposit_h( hTcxDec->gainHelper ), sub( hTcxDec->gainHelper_e, 31 - 28 ) ); /*Q28*/ - tmp32_2 /*stepCompensate*/ = L_shl_r( L_deposit_h( hTcxDec->stepCompensate ), sub( hTcxDec->stepCompensate_e, 31 - 28 ) ); /*Q28*/ - FOR( i = 0; i < st_fx->L_frame; i++ ) - { - tmp32 = L_shl( tmp32_1 /*Q28*/, -( 28 - 15 ) ); /*16Q15*/ - xn_buf[i] = extract_l( Mpy_32_16_1( tmp32, xn_buf[i] ) ); - move16(); - tmp32_1 = L_sub( tmp32_1, tmp32_2 ); - } - } - - /* PLC: [TCX: Fade-out] - * PLC: estimate and update CNG energy */ - /* level_syn = (float)sqrt(( dot_product(synthFB, synthFB, L_frame)) / L_frame ); */ - s = sub( getScaleFactor16( synthFB, hTcxDec->L_frameTCX ), 4 ); - { - Word64 tmp64; - tmp64 = 0; - move64(); - FOR( i = 0; i < hTcxDec->L_frameTCX; i++ ) - { - tmp1 = shl( synthFB[i], s ); - tmp64 = W_mac0_16_16( tmp64, tmp1, tmp1 ); - } - tmp32 = W_sat_l( tmp64 ); - } - tmp32 = Mpy_32_16_1( tmp32, getInvFrameLen( hTcxDec->L_frameTCX ) ); - tmp2 = norm_l( tmp32 ); - tmp1 = round_fx_sat( L_shl( tmp32, tmp2 ) ); - s = sub( sub( sub( 1, shl( s, 1 ) ), 6 /*table lookup for inverse framelength*/ ), tmp2 ); - tmp1 = Sqrt16( tmp1, &s ); - move16(); - level_syn = tmp1; /*Q0*/ - - /* PLC: [TCX: Fade-out] - * PLC: estimate and update CNG energy */ - - level_syn_e = add( s, 15 ); - test(); - test(); - IF( bfi == 0 && st_fx->tcxonly != 0 && EQ_16( st_fx->clas_dec, UNVOICED_CLAS ) ) - { - - Word16 Qnew_levelBackgroundTrace; - Qnew_levelBackgroundTrace = 0; - move16(); - minimumStatistics_fx( hTcxDec->conNoiseLevelMemory, /*Q15*/ - &hTcxDec->conNoiseLevelIndex, /*Q0 */ - &hTcxDec->conCurrLevelIndex, /*Q0 */ - &hTcxDec->conCngLevelBackgroundTrace, /*Q15*/ - &hTcxDec->conLastFrameLevel, /*Q15*/ - level_syn, /*Q15*/ - hTcxDec->conNoiseLevelMemory_e, - hTcxDec->conCngLevelBackgroundTrace_e, - &Qnew_levelBackgroundTrace, - &hTcxDec->conLastFrameLevel_e, - level_syn_e /*scaling of level_syn*/ - ); - - /*note: All parameters being different from Q0 have to have the same Q-format*/ - - hTcxDec->conCngLevelBackgroundTrace_e = Qnew_levelBackgroundTrace; - move16(); - } - - /* PLC: [TCX: Fade-out] - * PLC: fade-out in time domain */ - IF( bfi != 0 ) - { - Word32 conceal_eof_gain32; - Word32 conceal_eof_gainFB; - move16(); - move16(); - gainCNG = 1; - gainCNG_e = 14 + 15 + 6; /*gainCNG is 2`097`152 - should be enough in case tracinglevel =~0 */ - IF( st_fx->tcxonly != 0 ) - { - /*gainCNG = st_fx->conCngLevelBackgroundTrace/(tracingLevel+0.01f);*/ - - IF( level_syn != 0 ) - { - BASOP_Util_Divide_MantExp( - hTcxDec->conCngLevelBackgroundTrace, - hTcxDec->conCngLevelBackgroundTrace_e, - level_syn, - level_syn_e, - &gainCNG, - &gainCNG_e ); - } - } - ELSE - { - /*gainCNG = st_fx->cngTDLevel/(tracingLevel+0.01f);*/ - IF( level_syn != 0 ) - { - BASOP_Util_Divide_MantExp( - st_fx->cngTDLevel, - st_fx->cngTDLevel_e, - level_syn, - level_syn_e, - &gainCNG, - &gainCNG_e ); - } - } - - if ( ( EQ_16( st_fx->nbLostCmpt, 1 ) ) ) - { - hTcxDec->conceal_eof_gain = 16384 /*1.0f Q14*/; /*Q14*/ - move16(); - } - - /* step = (st_fx->conceal_eof_gain - ( st_fx->conceal_eof_gain * st_fx->damping + gainCNG * (1 - st_fx->damping) )) / st_fx->L_frame; */ - tmp2 = BASOP_Util_Add_MantExp( - mult_r( hTcxDec->conceal_eof_gain /*Q14*/, - hTcxDec->damping /*Q14*/ ), - 15 - 13 /*->Q15*/, - mult_r( gainCNG /*Q15*/, sub( 0x4000, hTcxDec->damping /*Q14*/ ) ) /*Q14*/, - add( gainCNG_e, 15 - 14 ) /*->Q15*/, - &tmp1 ); - tmp2 = BASOP_Util_Add_MantExp( hTcxDec->conceal_eof_gain, 15 - 14, negate( tmp1 ), tmp2, &tmp1 ); - - step = L_shl_sat( L_mult( tmp1, getInvFrameLen( st_fx->L_frame ) ), sub( tmp2, 6 /*scaling from table lookup*/ + 1 /*go to Q30*/ ) ); /*Q30*/ - { - Word32 stepFB; - UWord32 dmy; - conceal_eof_gainFB = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ - Mpy_32_32_ss( step, L_shl( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ), &stepFB, &dmy ); - stepFB = L_shl_sat( stepFB, 3 - 1 ); /*Q30*/ - FOR( i = 0; i < hTcxDec->L_frameTCX; i++ ) - { - synthFB[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, synthFB[i] ), 1 ) ); - move16(); - conceal_eof_gainFB = L_sub_sat( conceal_eof_gainFB, stepFB ); - } - } - conceal_eof_gain32 = L_deposit_h( hTcxDec->conceal_eof_gain ); /*Q30*/ - FOR( i = 0; i < st_fx->L_frame; i++ ) - { - xn_buf[i] = round_fx_sat( L_shl_sat( Mpy_32_16_1( conceal_eof_gain32 /*Q30*/, xn_buf[i] ), 1 ) ); - move16(); - conceal_eof_gain32 = L_sub_sat( conceal_eof_gain32, step ); - } - hTcxDec->conceal_eof_gain = round_fx_sat( conceal_eof_gain32 ); /*Q14*/ - move16(); - /* run lpc gain compensation not for waveform adjustment */ - test(); - IF( 0 == st_fx->enablePlcWaveadjust || EQ_16( st_fx->hPlcInfo->concealment_method, TCX_TONAL ) ) - { - st_fx->hPlcInfo->recovery_gain = extract_h( L_shl_sat( Mpy_32_16_1( conceal_eof_gainFB, - st_fx->last_concealed_gain_syn_deemph ), - st_fx->last_concealed_gain_syn_deemph_e ) ); - /*Q30->Q14*/ - move16(); - } - ELSE - { - st_fx->hPlcInfo->recovery_gain = extract_h( conceal_eof_gainFB ); /*Q14*/ - move16(); - } - st_fx->hPlcInfo->step_concealgain_fx = round_fx_sat( L_shl_sat( L_mult0( round_fx_sat( step ), round_fx_sat( L_shl_sat( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ) ) ), 3 ) ); /*Q15*/ - move16(); - } - - /*-----------------------------------------------------------* - * Memory update * - *-----------------------------------------------------------*/ - - /* Update synth, exc and old_Aq */ - tcx_decoder_memory_update( xn_buf, /*Q0*/ - synth, /*Q0*/ - A, - st_fx, - 0 ); - - - /* PLC: [TCX: Memory update] */ - - st_fx->old_pitch_buf_fx[0] = st_fx->old_pitch_buf_fx[st_fx->nb_subfr]; - move32(); - st_fx->old_pitch_buf_fx[1] = st_fx->old_pitch_buf_fx[st_fx->nb_subfr + 1]; - move32(); - Copy32( &st_fx->old_pitch_buf_fx[st_fx->nb_subfr + 2], &st_fx->old_pitch_buf_fx[2], st_fx->nb_subfr ); - set32_fx( &st_fx->old_pitch_buf_fx[st_fx->nb_subfr + 2], st_fx->old_fpitch, st_fx->nb_subfr ); - st_fx->bfi_pitch_fx = shl_sat( round_fx( st_fx->old_fpitch ), 6 ); - move16(); - st_fx->bfi_pitch_frame = st_fx->L_frame; - move16(); - - st_fx->mem_pitch_gain[add( shl( st_fx->nb_subfr, 1 ), 1 )] = st_fx->mem_pitch_gain[st_fx->nb_subfr + 1]; - move16(); - st_fx->mem_pitch_gain[st_fx->nb_subfr * 2] = st_fx->mem_pitch_gain[st_fx->nb_subfr]; - move16(); - - FOR( i = 0; i < st_fx->nb_subfr; i++ ) - { - st_fx->mem_pitch_gain[sub( sub( shl( st_fx->nb_subfr, 1 ), 1 ), i )] = st_fx->mem_pitch_gain[sub( sub( st_fx->nb_subfr, 1 ), i )]; - move16(); - st_fx->mem_pitch_gain[sub( sub( st_fx->nb_subfr, 1 ), i )] = hTcxDec->tcxltp_last_gain_unmodified; - move16(); - } -} -#endif /*HARMONIZE_2604_decoder_tcx_post*/ - -#ifdef HARMONIZE_2604_decoder_tcx_post void decoder_tcx_post_fx( Decoder_State *st_fx, Word16 *synth, // Q_syn Word16 *synthFB, // Q_syn @@ -1546,15 +1264,6 @@ void decoder_tcx_post_fx( Decoder_State *st_fx, Word16 *A, // Q: 14 - norm_s(A[0]) Word16 bfi, Word16 MCT_flag ) /*EVS: 0*/ -#else -void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, - Word16 *synth, // Q_syn - Word16 *synthFB, // Q_syn - Word16 Q_syn, - Word16 *A, // Q: 14 - norm_s(A[0]) - Word16 bfi, - Word16 MCT_flag ) -#endif { Word16 i; Word16 level_syn; @@ -1566,9 +1275,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, Word16 tmp1, tmp2, s; Word32 tmp32; Word32 tmp32_1, tmp32_2; -#ifdef HARMONIZE_2604_decoder_tcx_post Word16 tcxltp_last_gain_unmodified_tmp; -#endif TCX_DEC_HANDLE hTcxDec; hTcxDec = st_fx->hTcxDec; @@ -1674,7 +1381,6 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, Word16 Qnew_levelBackgroundTrace; Qnew_levelBackgroundTrace = 0; move16(); -#ifdef HARMONIZE_2604_decoder_tcx_post Word16 *NoiseLevelIndex_tmp, *CurrLevelIndex_tmp; IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { @@ -1699,20 +1405,6 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, &hTcxDec->conLastFrameLevel_e, level_syn_e /*scaling of level_syn*/ ); -#else - minimumStatistics_fx( hTcxDec->conNoiseLevelMemory, /*Q15*/ - &hTcxDec->NoiseLevelIndex_bfi, /*Q0 */ - &hTcxDec->CurrLevelIndex_bfi, /*Q0 */ - &hTcxDec->conCngLevelBackgroundTrace, /*Q15*/ - &hTcxDec->conLastFrameLevel, /*Q15*/ - level_syn, /*Q15*/ - hTcxDec->conNoiseLevelMemory_e, - hTcxDec->conCngLevelBackgroundTrace_e, - &Qnew_levelBackgroundTrace, - &hTcxDec->conLastFrameLevel_e, - level_syn_e /*scaling of level_syn*/ - ); -#endif /*note: All parameters being different from Q0 have to have the same Q-format*/ @@ -1724,9 +1416,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, * PLC: fade-out in time domain */ IF( bfi != 0 ) { -#ifdef HARMONIZE_2604_decoder_tcx_post Word32 conceal_eof_gain32; -#endif Word32 conceal_eof_gainFB; Word16 conceal_eof_gainFB_e; move16(); @@ -1736,10 +1426,8 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, IF( st_fx->tcxonly != 0 ) { /*gainCNG = st_fx->conCngLevelBackgroundTrace/(tracingLevel+0.01f);*/ -#ifdef HARMONIZE_2604_decoder_tcx_post IF( GT_16( st_fx->element_mode, EVS_MONO ) ) { -#endif IF( level_syn ) { level_syn_e = BASOP_Util_Add_MantExp( level_syn, level_syn_e, 20992, -6, &level_syn ); /* 0.01 in Q21*/ @@ -1751,9 +1439,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, move16(); move16(); } -#ifdef HARMONIZE_2604_decoder_tcx_post } -#endif IF( level_syn != 0 ) { @@ -1784,10 +1470,8 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, ELSE { /*gainCNG = st_fx->cngTDLevel/(tracingLevel+0.01f);*/ -#ifdef HARMONIZE_2604_decoder_tcx_post IF( GT_16( st_fx->element_mode, EVS_MONO ) ) { -#endif IF( level_syn ) { level_syn_e = BASOP_Util_Add_MantExp( level_syn, level_syn_e, 20992, -6, &level_syn ); /* 0.01 in Q21*/ @@ -1799,9 +1483,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, move16(); move16(); } -#ifdef HARMONIZE_2604_decoder_tcx_post } -#endif IF( level_syn != 0 ) { @@ -1816,7 +1498,6 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, } -#ifdef HARMONIZE_2604_decoder_tcx_post IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) { IF( ( EQ_16( st_fx->nbLostCmpt, 1 ) ) ) @@ -1878,7 +1559,6 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, } ELSE { -#endif IF( ( EQ_16( st_fx->nbLostCmpt, 1 ) ) ) { hTcxDec->conceal_eof_gain32 = ONE_IN_Q30 /*1.0f Q30*/; @@ -1944,9 +1624,7 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, st_fx->hPlcInfo->step_concealgain_fx = round_fx_sat( L_shl_sat( L_mult0( round_fx_sat( L_shr_sat( step, sub( 1, step_e ) ) ), round_fx_sat( L_shl_sat( L_mult0( st_fx->L_frame, getInvFrameLen( hTcxDec->L_frameTCX ) ), 8 ) ) ), 4 ) ); /*Q15*/ move16(); } -#ifdef HARMONIZE_2604_decoder_tcx_post } -#endif } /*-----------------------------------------------------------* @@ -1978,23 +1656,17 @@ void decoder_tcx_post_ivas_fx( Decoder_State *st_fx, st_fx->mem_pitch_gain[st_fx->nb_subfr * 2] = st_fx->mem_pitch_gain[st_fx->nb_subfr]; // Q14 move16(); -#ifdef HARMONIZE_2604_decoder_tcx_post tcxltp_last_gain_unmodified_tmp = hTcxDec->tcxltp_last_gain_unmodified; if ( GT_16( st_fx->element_mode, EVS_MONO ) ) { tcxltp_last_gain_unmodified_tmp = shr( tcxltp_last_gain_unmodified_tmp, 1 ); } -#endif FOR( i = 0; i < st_fx->nb_subfr; i++ ) { st_fx->mem_pitch_gain[( st_fx->nb_subfr * 2 - 1 ) - i] = st_fx->mem_pitch_gain[st_fx->nb_subfr - 1 - i]; // Q14 move16(); -#ifdef HARMONIZE_2604_decoder_tcx_post st_fx->mem_pitch_gain[st_fx->nb_subfr - 1 - i] = tcxltp_last_gain_unmodified_tmp; /* Q14 */ -#else - st_fx->mem_pitch_gain[st_fx->nb_subfr - 1 - i] = shr( hTcxDec->tcxltp_last_gain_unmodified, 1 ); /* Q14 */ -#endif move16(); } } @@ -4408,19 +4080,11 @@ void decoder_tcx_invQ_fx( IF( GT_32( st->bwidth, WB ) ) { -#ifdef HARMONIZE_2598_tcx_arith_decode_envelope tcx_arith_decode_envelope_fx( st, x, x_e, L_frame, L_spec, Aind, *prm_target, prm_sqQ, (Word16) NE_16( st->last_core_from_bs, ACELP_CORE ), prm_hm, /* HM parameter area */ hTcxDec->tcx_hm_LtpPitchLag, &arith_bits, &signaling_bits, 0, 1 ); -#else - tcx_arith_decode_envelope_ivas_fx( st, x, x_e, L_frame, L_spec, Aind, *prm_target, prm_sqQ, (Word16) NE_16( st->last_core_from_bs, ACELP_CORE ), prm_hm, /* HM parameter area */ hTcxDec->tcx_hm_LtpPitchLag, &arith_bits, &signaling_bits, 1 ); -#endif } ELSE { -#ifdef HARMONIZE_2598_tcx_arith_decode_envelope tcx_arith_decode_envelope_fx( st, x, x_e, L_frame, L_spec, Aind, *prm_target, prm_sqQ, (Word16) NE_16( st->last_core_from_bs, ACELP_CORE ), prm_hm, /* HM parameter area */ hTcxDec->tcx_hm_LtpPitchLag, &arith_bits, &signaling_bits, 0, 0 ); -#else - tcx_arith_decode_envelope_ivas_fx( st, x, x_e, L_frame, L_spec, Aind, *prm_target, prm_sqQ, (Word16) NE_16( st->last_core_from_bs, ACELP_CORE ), prm_hm, /* HM parameter area */ hTcxDec->tcx_hm_LtpPitchLag, &arith_bits, &signaling_bits, 0 ); -#endif } hTcxDec->resQBits[frame_cnt] = sub( *prm_target, arith_bits ); diff --git a/lib_dec/ivas_mdct_core_dec_fx.c b/lib_dec/ivas_mdct_core_dec_fx.c index ee96a43e8b940b1f85ec64b54174284e65c69d25..3d12c57107bc566441fd2227f30e96c0772c49c1 100755 --- a/lib_dec/ivas_mdct_core_dec_fx.c +++ b/lib_dec/ivas_mdct_core_dec_fx.c @@ -1259,11 +1259,7 @@ void ivas_mdct_core_reconstruct_fx( { TonalMDCTConceal_SaveTimeSignal_fx( st->element_mode, st->hTonalMDCTConc, synthFB_fx, q_winFB, L_frameTCX[ch] ); } -#ifdef HARMONIZE_2604_decoder_tcx_post decoder_tcx_post_fx( st, synth_fx, synthFB_fx, q_winFB, NULL, bfi, MCT_flag ); -#else - decoder_tcx_post_ivas_fx( st, synth_fx, synthFB_fx, q_winFB, NULL, bfi, MCT_flag ); -#endif // norm(synth_buf) >= q_syn - q_win // norm(synth_buf) + q_win >= q_syn diff --git a/lib_dec/ivas_stereo_ica_dec_fx.c b/lib_dec/ivas_stereo_ica_dec_fx.c index d88bdd3a959178fb7d9af5ed31da0935fdaa45cb..942eb79d833e142cfc34f0700804184aab8ccd93 100644 --- a/lib_dec/ivas_stereo_ica_dec_fx.c +++ b/lib_dec/ivas_stereo_ica_dec_fx.c @@ -436,19 +436,11 @@ void stereo_tca_scale_R_channel_fx( move32(); BREAK; case 32000: -#ifndef FIX_ISSUE_2594_FALSE_COMMENT - winSlope_fx = 13421773; // 0.00625 in Q30 -#else winSlope_fx = 13421773; // 0.00625 in Q31 -#endif // !FIX_ISSUE_2594_FALSE_COMMENT move32(); BREAK; case 48000: -#ifndef FIX_ISSUE_2594_FALSE_COMMENT - winSlope_fx = 8947849; // 0.00416 in Q30 -#else winSlope_fx = 8947849; // 0.00416 in Q31 -#endif // !FIX_ISSUE_2594_FALSE_COMMENT move32(); BREAK; diff --git a/lib_dec/ivas_tcx_core_dec_fx.c b/lib_dec/ivas_tcx_core_dec_fx.c index 59932995308c88f81fc563d19779520b4a2cb3e8..f5c8e028ae5ada7bf906314927564959b0914bbb 100644 --- a/lib_dec/ivas_tcx_core_dec_fx.c +++ b/lib_dec/ivas_tcx_core_dec_fx.c @@ -634,11 +634,7 @@ void stereo_tcx_core_dec_fx( TonalMDCTConceal_SaveTimeSignal_fx( st->element_mode, st->hTonalMDCTConc, synthFB_fx, st->Q_syn, hTcxDec->L_frameTCX ); } -#ifdef HARMONIZE_2604_decoder_tcx_post decoder_tcx_post_fx( st, synth_fx, synthFB_fx, st->Q_syn, Aq_fx, bfi, 0 ); -#else - decoder_tcx_post_ivas_fx( st, synth_fx, synthFB_fx, st->Q_syn, Aq_fx, bfi, 0 ); -#endif IF( EQ_16( st->core, TCX_20_CORE ) ) { diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index 8022cc7d3fc92facc4d040a481a14bcb432124f8..896b83a9b3e856cfe5a647ce00c3847cb2835cf3 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -409,12 +409,8 @@ void lsf_end_dec_fx( test(); test(); -#ifndef FIX_2588_MISSING_CONDITIONS - IF( ( EQ_16( coder_type_org, GENERIC ) ) && ( EQ_32( st->sr_core, INT_FS_16k ) ) && ( mode2_flag == 0 ) ) -#else test(); IF( ( EQ_16( coder_type_org, GENERIC ) ) && ( EQ_32( st->sr_core, INT_FS_16k ) ) && ( mode2_flag == 0 ) && st->idchan == 0 ) -#endif { /* this bit is used only for primary channel or mono */ coder_type = (Word16) get_next_indice_fx( st, 1 ); /* Q0 */ diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 25fb8be67e946a69fa4635be471e7af581b9241f..c067e63e914b917802041db2b1937fb1a3e0c8fc 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -417,9 +417,8 @@ static void FindPhases( /* o: Phase difference [-pi;pi] 2Q13*/ static void FindPhaseDifferences( TonalMDCTConcealPtr const hTonalMDCTConc, /* i : Pointer to internal structure */ - Word32 powerSpectrum[] /* i : Power spectrum data Qx */ - , - const Word16 element_mode /* i : EVS_MONO or anything else */ + Word32 powerSpectrum[], /* i : Power spectrum data Qx */ + const Word16 element_mode /* i : EVS_MONO or anything else */ ) { Word16 i, k; diff --git a/lib_enc/arith_coder_enc_fx.c b/lib_enc/arith_coder_enc_fx.c index 1469136ecfa340b87ab5551b854a98f12e17a2c6..aabe1f03f42e590942959f5acc380b2e6803c293 100644 --- a/lib_enc/arith_coder_enc_fx.c +++ b/lib_enc/arith_coder_enc_fx.c @@ -658,151 +658,7 @@ static Word16 tcx_arith_encode( * * *-------------------------------------------------------------------*/ -#ifndef HARMONIZE_2598_tcx_arith_encode_envelope -void tcx_arith_encode_envelope_fx( - Word32 spectrum[], /* i/o: MDCT coefficients Q31-e */ - Word16 *spectrum_e, /* i/o: MDCT exponent Q0 */ - Word16 signs[], /* o : signs (spectrum[.]<0) Q0 */ - const Word16 L_frame, /* i : frame or MDCT length Q0 */ - const Word16 L_spec, /* i : frame or MDCT length Q0 */ - Encoder_State *st, /* i/o: coder state */ - const Word16 A_ind[], /* i : quantised LPC coefficients Q12 */ - Word16 target_bits, /* i : number of available bits Q0 */ - Word16 prm[], /* o : bitstream parameters Q0 */ - const Word8 use_hm, /* i : use HM in current frame? */ - Word16 prm_hm[], /* o : HM parameter area Q0 */ - const Word16 tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a Q0*/ - Word16 *arith_bits, /* o : bits used for ari. coding Q0 */ - Word16 *signaling_bits, /* o : bits used for signaling Q0 */ - Word16 *nf_seed, /* o : noise filling seed Q0 */ - const Word16 low_complexity /* i : low-complexity flag Q0 */ -) -{ - Word32 env[N_MAX_ARI]; /* unscaled envelope (Q16) */ - Word16 *envelope; /* scaled envelope (Q15-e) */ - Word16 envelope_e; - Word16 exponents[N_MAX_ARI]; /* Q15 */ - Word16 L_spec_core; - Word16 *q_spectrum; - TCX_CONFIG_HANDLE hTcxCfg; - Word16 scale, scale_e; - Word16 k, kMax; - Word16 deadzone; - const Word8 *deadzone_flags; - Word16 gamma_w, gamma_uw; - Word16 hm_bits; - Word32 L_tmp; - Word64 W_tmp2; - Word16 tmp; - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - assert( L_spec <= N_MAX_ARI ); - - hTcxCfg = st->hTcxCfg; - deadzone = hTcxCfg->sq_rounding; - move16(); - deadzone_flags = hTcxEnc->memQuantZeros; - *signaling_bits = 0; - move16(); - - assert( st->enableTcxLpc ); - gamma_w = 32767 /*1.0f Q15*/; - move16(); - gamma_uw = st->inv_gamma; - move16(); - - tcx_arith_render_envelope( A_ind, L_frame, L_spec, hTcxCfg->preemph_fac, gamma_w, gamma_uw, env ); - - FOR( k = 0; k < L_spec; k++ ) - { - signs[k] = extract_l( L_lshr( spectrum[k], 31 ) ); - move16(); - if ( spectrum[k] < 0 ) - { - spectrum[k] = L_abs( spectrum[k] ); - move32(); - } - } - - IF( use_hm != 0 ) - { - tcx_hm_analyse_fx( spectrum, spectrum_e, L_spec, env, target_bits, hTcxCfg->coder_type, prm_hm, tcxltp_pitch, hTcxEnc->tcxltp_gain, &hm_bits ); - - target_bits = sub( target_bits, hm_bits ); - *signaling_bits = add( *signaling_bits, hm_bits ); - move16(); - } - ELSE - { - prm_hm[0] = 0; /* just to be sure */ - move16(); - hm_bits = 0; - move16(); - } - - L_spec_core = L_spec; - move16(); - if ( st->igf ) - { - L_spec_core = s_min( L_spec_core, st->hIGFEnc->infoStartLine ); - } - envelope = (Word16 *) env; - - tcx_arith_scale_envelope( L_spec, L_spec_core, env, target_bits, low_complexity, envelope, &envelope_e ); - - tmp = sub( envelope_e, 1 + 15 ); - FOR( k = 0; k < L_spec; k++ ) - { - exponents[k] = round_fx( expfp( envelope[k], tmp ) ); - move16(); - } - - scale = tcx_arith_rateloop( spectrum, *spectrum_e, L_spec, envelope, envelope_e, exponents, target_bits, deadzone, deadzone_flags, &( hTcxEnc->tcx_target_bits_fac ), &scale_e ); - - /* Final quantization */ - kMax = tcx_arith_find_kMax( spectrum, *spectrum_e, L_spec, scale, scale_e, deadzone, deadzone_flags ); - - q_spectrum = (Word16 *) env; /* Reuse buffer */ - - L_tmp = L_mult( deadzone, 1 ); /* Q16 */ - tmp = add( sub( *spectrum_e, 15 ), scale_e ); - FOR( k = 0; k <= kMax; k++ ) - { - /* quantise using dead-zone */ - q_spectrum[k] = extract_h( L_add( L_shl( Mpy_32_16_1( spectrum[k], scale ), tmp ), L_tmp ) ); - move16(); - } - - /* Final encoding */ - *arith_bits = tcx_arith_encode( q_spectrum, signs, kMax, L_spec, exponents, target_bits, prm ); - move16(); - - /* Multiply back the signs */ - W_tmp2 = 0; - FOR( k = 0; k <= kMax; k++ ) - { - W_tmp2 = W_mac_16_16( W_tmp2, q_spectrum[k], k ); - - if ( signs[k] != 0 ) - L_tmp = L_mult( q_spectrum[k], -( 1 << ( 30 - SPEC_EXP_DEC ) ) ); - if ( signs[k] == 0 ) - L_tmp = L_mult( q_spectrum[k], 1 << ( 30 - SPEC_EXP_DEC ) ); - spectrum[k] = L_tmp; - move32(); - } - *spectrum_e = SPEC_EXP_DEC; - move16(); - set32_fx( spectrum + k, 0, sub( s_max( L_frame, L_spec ), k ) ); - - /* noise filling seed */ - *nf_seed = extract_l( W_extract_l( W_tmp2 ) ); - move16(); - - return; -} -#endif - -#ifdef HARMONIZE_2598_tcx_arith_encode_envelope void tcx_arith_encode_envelope_fx( Word32 spectrum[], /* i/o: MDCT coefficients Q31-e */ Word16 *spectrum_e, /* i/o: MDCT exponent Q0 */ @@ -821,25 +677,6 @@ void tcx_arith_encode_envelope_fx( Word16 *nf_seed, /* o : noise filling seed; might be NULL Q0 */ const Word16 low_complexity /* i : low-complexity flag Q0 */ ) -#else -void tcx_arith_encode_envelope_ivas_fx( - Word32 spectrum[], /* i/o: MDCT coefficients Q31-e */ - Word16 *spectrum_e, /* i/o: MDCT exponent Q0 */ - Word16 signs[], /* o : signs (spectrum[.]<0) Q0 */ - const Word16 L_frame, /* i : frame or MDCT length Q0 */ - const Word16 L_spec, /* i : frame or MDCT length Q0 */ - Encoder_State *st, /* i/o: coder state */ - const Word16 A_ind[], /* i : quantised LPC coefficients Q12 */ - Word16 target_bits, /* i : number of available bits Q0 */ - Word16 prm[], /* o : bitstream parameters Q0 */ - const Word8 use_hm, /* i : use HM in current frame? */ - Word16 prm_hm[], /* o : HM parameter area Q0 */ - const Word16 tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a Q0*/ - Word16 *arith_bits, /* o : bits used for ari. coding Q0 */ - Word16 *signaling_bits, /* o : bits used for signaling Q0 */ - const Word16 low_complexity /* i : low-complexity flag Q0 */ -) -#endif { Word32 env[N_MAX_ARI]; /* unscaled envelope (Q16) */ Word16 *envelope; /* scaled envelope (Q15-e) */ @@ -855,9 +692,7 @@ void tcx_arith_encode_envelope_ivas_fx( Word16 gamma_w, gamma_uw; Word16 hm_bits; Word32 L_tmp; -#ifdef HARMONIZE_2598_tcx_arith_encode_envelope Word64 W_tmp2; -#endif Word16 tmp; TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; @@ -943,18 +778,14 @@ void tcx_arith_encode_envelope_ivas_fx( move16(); /* Multiply back the signs */ -#ifdef HARMONIZE_2598_tcx_arith_encode_envelope W_tmp2 = 0; move32(); -#endif FOR( k = 0; k <= kMax; k++ ) { -#ifdef HARMONIZE_2598_tcx_arith_encode_envelope if ( nf_seed != NULL ) { W_tmp2 = W_mac_16_16( W_tmp2, q_spectrum[k], k ); } -#endif if ( signs[k] != 0 ) { L_tmp = L_mult( q_spectrum[k], -( 1 << ( 30 - SPEC_EXP_DEC ) ) ); @@ -971,14 +802,12 @@ void tcx_arith_encode_envelope_ivas_fx( move16(); set32_fx( spectrum + k, 0, sub( s_max( L_frame, L_spec ), k ) ); -#ifdef HARMONIZE_2598_tcx_arith_encode_envelope if ( nf_seed != NULL ) { /* noise filling seed */ *nf_seed = extract_l( W_extract_l( W_tmp2 ) ); move16(); } -#endif return; } diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index c962072f5f0d483e9458086208301297965ef6d8..aba8e0a54369daa74167818f6fd987ba55fe0a87 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -221,253 +221,8 @@ void TNSAnalysis_fx( } } -#ifndef HARMONIZE_2597_ShapeSpectrum -void ShapeSpectrum_fx( - TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ - Word16 A[], /* input: quantized coefficients NxAz_q[M+1] Q = 14 - norm(A[0])*/ - Word16 gainlpc[], /* output: MDCT gains for the previous frame Q(15-gainlpc_e)*/ - Word16 gainlpc_e[], /* output: MDCT gains exponents */ - Word16 L_frame_glob, /* input: frame length */ - Word16 L_spec, - Word32 spectrum[], /* i/o: MDCT spectrum */ - Word8 pfUseTns, /* output: Flag indicating if TNS is used */ - Encoder_State *st ) -{ - Word16 L_frame; - Word16 Ap[M + 2]; - Word16 gamma1; - Word16 gainlpc_noinv[FDNS_NPTS]; - Word16 gainlpc_noinv_e[FDNS_NPTS]; - Word16 i; - Word32 max_low_pre = 0, max_high_pre = 0; - move32(); - move32(); - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - - /*-----------------------------------------------------------* - * Init * - *-----------------------------------------------------------*/ - - /* Init lengths */ - L_frame = L_frame_glob; - move16(); - gamma1 = st->gamma; - move16(); - if ( st->enableTcxLpc != 0 ) - { - gamma1 = 0x7FFF; - move16(); - } - - /* if past frame is ACELP */ - - IF( st->last_core == ACELP_CORE ) - { - L_frame = add( L_frame, hTcxCfg->tcx_offset ); - L_spec = add( L_spec, shr( hTcxCfg->tcx_coded_lines, 2 ) ); - if ( hTcxCfg->lfacNext < 0 ) - { - L_frame = sub( L_frame, hTcxCfg->lfacNext ); - move16(); - } - } - - test(); - tcxGetNoiseFillingTilt( A, - M, - L_frame, - ( GE_32( st->total_brate, ACELP_13k20 ) && st->rf_mode == 0 ), - &hTcxEnc->noiseTiltFactor ); - - /* Calculate Spectrum Flatness Measure for the TCX Concealment */ - IF( st->enablePlcWaveadjust ) - { - hTcxCfg->SFM2 = SFM_Cal_fx( spectrum, s_min( 200, L_frame ) ); - move32(); - } - - test(); - test(); - test(); - IF( ( EQ_32( st->total_brate, ACELP_9k60 ) && EQ_16( st->bwidth, SWB ) ) || - ( EQ_32( st->total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) ) - { - max_low_pre = 0; - move32(); - FOR( i = 0; i < L_frame; i++ ) - { - Word32 tmp = L_abs( spectrum[i] ); - if ( GT_32( tmp, max_low_pre ) ) - { - max_low_pre = tmp; - move32(); - } - } - - max_high_pre = 0; - move32(); - FOR( i = 0; i < L_spec - L_frame; i++ ) - { - Word32 tmp = L_abs( spectrum[L_frame + i] ); - if ( GT_32( tmp, max_high_pre ) ) - { - max_high_pre = tmp; - move32(); - } - } - } - - /*-----------------------------------------------------------* - * Pre-shaping in frequency domain using weighted LPC (Wz) * - *-----------------------------------------------------------*/ - - weight_a_fx( A, Ap, gamma1, M ); - - lpc2mdct( Ap, M, gainlpc_noinv, gainlpc_noinv_e, gainlpc, gainlpc_e, FDNS_NPTS, 0 ); - - mdct_shaping( spectrum, L_frame, gainlpc_noinv, gainlpc_noinv_e ); - FOR( i = L_frame; i < L_spec; i++ ) - { - spectrum[i] = L_shl( Mpy_32_16_1( spectrum[i], gainlpc_noinv[FDNS_NPTS - 1] ), gainlpc_noinv_e[FDNS_NPTS - 1] ); - move32(); - } - - /* reduce the peaks in the IGF region, to make life of the core-coder easier... */ - test(); - test(); - test(); - IF( ( EQ_32( st->total_brate, ACELP_9k60 ) && EQ_16( st->bwidth, SWB ) ) || - ( EQ_32( st->total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) ) - { - Word16 sf_width; - Word16 dist_low, dist_high; - Word16 max_fac_s, max_fac_m; - Word32 max_low, max_low1, max_low2, max_high; - Word16 headroom, shift, tmp16; - - - max_fac_m = 24576; - move16(); - /* max_fac = 3 */ - max_fac_s = 2; - move16(); - if ( hTcxEnc->tcx_lpc_shaped_ari ) - { - /* max_fac = 1.5 */ - max_fac_s = 1; - move16(); - } - - sf_width = shr( L_frame, 1 ); - - max_low2 = 0; - move32(); - dist_low = 0; - move16(); - FOR( i = 0; i < sf_width; i++ ) - { - Word32 tmp = L_abs( spectrum[L_frame - 1 - i] ); - IF( GT_32( tmp, max_low2 ) ) - { - max_low2 = tmp; - move32(); - dist_low = i; - move16(); - } - } - - max_low1 = 0; - move32(); - FOR( i = 0; i < ( L_frame - sf_width ); i++ ) - { - Word32 tmp = L_abs( spectrum[L_frame - sf_width - 1 - i] ); - if ( GT_32( tmp, max_low1 ) ) - { - max_low1 = tmp; - move32(); - } - if ( GT_32( tmp, max_low2 ) ) - { - dist_low = add( sf_width, i ); - } - } - - max_low = L_max( max_low1, max_low2 ); - - max_high = 0; - move32(); - dist_high = 0; - move16(); - FOR( i = 0; i < ( L_spec - L_frame ); i++ ) - { - Word32 tmp = L_abs( spectrum[L_frame + i] ); - IF( GT_32( tmp, max_high ) ) - { - max_high = tmp; - move32(); - dist_high = i; - move16(); - } - } - - /* at least 9 bits headroom are needed for below multiplicitions */ - shift = 0; - move16(); - headroom = 31; - move16(); - - tmp16 = norm_l( max_low ); - if ( max_low != 0 ) - headroom = s_min( headroom, tmp16 ); - - tmp16 = norm_l( max_low2 ); - if ( max_low2 != 0 ) - headroom = s_min( headroom, tmp16 ); - - tmp16 = norm_l( max_high ); - if ( max_high != 0 ) - headroom = s_min( headroom, tmp16 ); - - if ( LT_16( headroom, 9 ) ) - { - shift = sub( 9, headroom ); - } - max_low = L_shr( max_low, shift ); - max_low2 = L_shr( max_low2, shift ); - max_high = L_shr( max_high, shift ); - - test(); - test(); - IF( GT_32( imult3216( max_high, dist_high ), imult3216( L_shr( max_low, 2 ), dist_low ) ) && ( GT_32( max_low_pre, L_shr( max_high_pre, 4 ) ) ) && ( GT_32( max_high, L_shl( Mpy_32_16_r( max_low2, max_fac_m ), max_fac_s ) ) ) ) - { - Word16 fac; - fac = divide3232( max_low2, max_high ); - fac = shl( mult_r( fac, max_fac_m ), max_fac_s ); - - FOR( i = 0; i < sub( L_spec, L_frame ); i++ ) - { - spectrum[L_frame + i] = Mpy_32_16_1( spectrum[L_frame + i], fac ); - move32(); - } - } - } - - - test(); - test(); - test(); - IF( st->tcxonly && hTcxEnc->tcxltp && ( hTcxEnc->tcxltp_gain > 0 ) && !pfUseTns ) - { - PsychAdaptLowFreqEmph_fx( spectrum, gainlpc, gainlpc_e ); - } -} -#endif -#ifdef HARMONIZE_2597_ShapeSpectrum void ShapeSpectrum_fx( -#else -void ShapeSpectrum_ivas_fx( -#endif TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ Word16 A[], /* input: quantized coefficients NxAz_q[M+1], Q = 14 - norm(A[0]) */ Word16 gainlpc[], /* output: MDCT gains for the previous frame Q(15-gainlpc_e)*/ @@ -731,11 +486,7 @@ void ShapeSpectrum_ivas_fx( { Word16 fac; fac = divide3232( max_low2, max_high ); -#ifdef HARMONIZE_2597_ShapeSpectrum IF( GE_16( norm_s( fac ), max_fac_s ) || EQ_16( st->element_mode, EVS_MONO ) ) -#else - IF( GE_16( norm_s( fac ), max_fac_s ) ) -#endif { fac = shl( mult_r( fac, max_fac_m ), max_fac_s ); FOR( i = 0; i < ( L_spec - L_frame ); i++ ) @@ -3504,11 +3255,7 @@ void QuantizeTCXSpectrum_fx( low_complexiety = 1; move16(); } -#ifdef HARMONIZE_2598_tcx_arith_encode_envelope tcx_arith_encode_envelope_fx( spectrum_fx, spectrum_e, hm_cfg->indexBuffer, L_frame, L_spec, st, Aqind, sqTargetBits, sqQ, tmp8, prm_hm, /* HM parameter area */ LtpPitchLag, &sqBits, &signaling_bits, NULL, low_complexiety ); -#else - tcx_arith_encode_envelope_ivas_fx( spectrum_fx, spectrum_e, hm_cfg->indexBuffer, L_frame, L_spec, st, Aqind, sqTargetBits, sqQ, tmp8, prm_hm, /* HM parameter area */ LtpPitchLag, &sqBits, &signaling_bits, low_complexiety ); -#endif sqTargetBits = sub( sqTargetBits, signaling_bits ); *prm_target = sqTargetBits; move16(); @@ -3807,7 +3554,6 @@ void coder_tcx_fx( ProcessIGF_fx( st, 0, spectrum, &q_spectrum, NULL, 0, powerSpec, &powerSpec_e, 1, 0, 0, 0 ); } -#ifdef HARMONIZE_2597_ShapeSpectrum ShapeSpectrum_fx( hTcxCfg, A, gainlpc, gainlpc_e, L_frame_glob, L_spec, @@ -3816,14 +3562,6 @@ void coder_tcx_fx( hTcxEnc->fUseTns[0], st, 0 ); -#else - ShapeSpectrum_fx( hTcxCfg, A, gainlpc, gainlpc_e, - L_frame_glob, - L_spec, - spectrum, - hTcxEnc->fUseTns[0], - st ); -#endif if ( st->igf ) { nb_bits = sub( nb_bits, st->hIGFEnc->infoTotalBitsPerFrameWritten ); diff --git a/lib_enc/core_enc_2div_fx.c b/lib_enc/core_enc_2div_fx.c index 6c77619f35817893f9f5798a20fff057675ecf68..b5494d89dda8889b32ad364b28694738564364c4 100644 --- a/lib_enc/core_enc_2div_fx.c +++ b/lib_enc/core_enc_2div_fx.c @@ -171,7 +171,6 @@ void core_encode_twodiv_fx( } /* Shape spectrum */ -#ifdef HARMONIZE_2597_ShapeSpectrum ShapeSpectrum_fx( st->hTcxCfg, A_q, gainlpc[n], @@ -183,17 +182,6 @@ void core_encode_twodiv_fx( hTcxEnc->fUseTns[n], st, 0 ); -#else - ShapeSpectrum_fx( st->hTcxCfg, - A_q, - gainlpc[n], - gainlpc_e[n], - shr( st->L_frame, 1 ), - shr( st->hTcxCfg->tcx_coded_lines, 1 ), - spectrum[n], - hTcxEnc->fUseTns[n], - st ); -#endif st->last_core = st->core; move16(); @@ -280,7 +268,6 @@ void core_encode_twodiv_fx( E_LPC_f_lsp_a_conversion( lsp_q, A_q, M ); -#ifdef HARMONIZE_2597_ShapeSpectrum ShapeSpectrum_fx( st->hTcxCfg, A_q, gainlpc[0], @@ -292,17 +279,6 @@ void core_encode_twodiv_fx( hTcxEnc->fUseTns[0], st, 0 ); -#else - ShapeSpectrum_fx( st->hTcxCfg, - A_q, - gainlpc[0], - gainlpc_e[0], - st->L_frame, - st->hTcxCfg->tcx_coded_lines, - spectrum[0], - hTcxEnc->fUseTns[0], - st ); -#endif /*_DIFF_FLOAT_FIX_EVS_IVAS -> The line below is present in float */ // hTcxEnc->measuredBwRatio = 0x4000; @@ -360,9 +336,5 @@ void core_encode_twodiv_fx( * Generate Bitstream *---------------------------------------------------------------*/ -#ifdef HAMRONIZE_2606_ENC_PRM enc_prm_fx( st, param_core, param_lpc, hm_cfg, bits_param_lpc, no_param_lpc ); -#else - enc_prm_fx( coder_type, param_core, param_lpc, st, st->L_frame, hm_cfg, bits_param_lpc, no_param_lpc ); -#endif } diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 64434f7fe5831b7767262beb3bb4da2744f5b7a3..23d58603de54fc5b5e8b8bf5d374956926cf0207 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -19,444 +19,13 @@ * Local functions *-----------------------------------------------------------------------*/ -#ifndef HARMONIZE_2567_init_functions -static void init_tcx_fx( Encoder_State *st, Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); -#endif static void init_core_sig_ana_fx( Encoder_State *st ); -#ifdef HARMONIZE_2567_init_functions static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ); -#else -static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift ); -#endif -#ifndef HARMONIZE_2567_init_functions -static void init_modes_fx( Encoder_State *st, const Word32 Last_total_brate ); -#endif static void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr ); -#ifdef HARMONIZE_2567_init_functions static void init_tcx_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); -#else -static void init_tcx_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, const Word32 last_total_brate, const Word16 MCT_flag ); -#endif -#ifndef HARMONIZE_2567_init_functions -static void init_core_sig_ana_ivas_fx( Encoder_State *st ); -#endif -#ifdef HARMONIZE_2567_init_functions static void init_modes_fx( Encoder_State *st, const Word32 last_total_brate ); -#else -static void init_modes_ivas_fx( Encoder_State *st, const Word32 last_total_brate ); -#endif static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr, const Word32 last_total_brate ); -#ifndef HARMONIZE_2567_init_functions -static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Word32 last_total_brate ); -#endif -#ifndef HARMONIZE_2567_init_functions -/*-----------------------------------------------------------------------* - * init_coder_ace_plus_fx() - * - * Initialization of state variables - *-----------------------------------------------------------------------*/ - -void init_coder_ace_plus_fx( - Encoder_State *st, - const Word32 last_total_brate, /* i : last total bitrate */ - const Word16 shift, - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -) -{ - Word16 L_frame_old; /*keep old frame size for switching */ - Word16 L_subfr; - TD_BWE_ENC_HANDLE hBWE_TD = st->hBWE_TD; - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - - /* Bitrate */ - st->tcxonly = (Word8) getTcxonly_fx( st->element_mode, st->total_brate, MCT_flag, st->is_ism_format ); - move16(); - - /* Core Sampling Rate */ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format ); - st->fscale = sr2fscale_fx( st->sr_core ); - move32(); - move16(); - - /* Narrowband? */ - st->narrowBand = 0; - move16(); - if ( EQ_16( st->bwidth, NB ) ) - { - st->narrowBand = 1; - move16(); - } - - /* Core Framing */ - L_frame_old = st->last_L_frame; - move16(); - st->L_frame = extract_l( Mult_32_16( st->sr_core, INV_FRAME_PER_SEC_Q15 ) ); - st->L_frame_past = -1; - move16(); - move16(); - - hTcxEnc->L_frameTCX = extract_l( Mult_32_16( st->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); - move16(); - st->nb_subfr = NB_SUBFR; - move16(); - L_subfr = shr( st->L_frame, 2 ); - test(); - IF( EQ_16( st->L_frame, L_FRAME16k ) && LE_32( st->total_brate, 32000 ) ) - { - st->nb_subfr = NB_SUBFR16k; - move16(); - L_subfr = mult( st->L_frame, 0x199A ); /*1/5 = 0x199A Q15*/ - move16(); - } - - /* Core Lookahead */ - st->encoderLookahead_enc = NS2SA_FX2( st->sr_core, ACELP_LOOK_NS ); - move16(); - st->encoderLookahead_FB = NS2SA_FX2( st->input_Fs, ACELP_LOOK_NS ); - move16(); - - IF( st->ini_frame == 0 ) - { - st->acelpFramesCount = 0; - move16(); - st->prevTempFlatness_fx = 128 /*1.0f Q7*/; - move16(); - } - - /* Initialize TBE */ - hBWE_TD->prev_coder_type = GENERIC; - move16(); - set16_fx( hBWE_TD->prev_lsf_diff_fx, 16384 /*.5f Q15*/, LPC_SHB_ORDER - 2 ); - hBWE_TD->prev_tilt_para_fx = 0; - move16(); - set16_fx( hBWE_TD->cur_sub_Aq_fx, 0, M + 1 ); - - st->currEnergyHF_fx = 0; - move16(); - st->currEnergyHF_e_fx = 0; - move16(); - st->energyCoreLookahead_Fx = 0; - move16(); - - /* Initialize LPC analysis/quantization */ - st->lpcQuantization = 0; - move16(); - test(); - if ( LE_32( st->sr_core, 16000 ) && st->tcxonly == 0 ) - { - st->lpcQuantization = 1; - move16(); - } - - - st->next_force_safety_net = 0; - move16(); - test(); - test(); - IF( NE_16( st->last_L_frame, st->L_frame ) || EQ_16( st->last_core, AMR_WB_CORE ) || EQ_16( st->last_core, HQ_CORE ) ) - { - set16_fx( st->mem_MA_fx, 0, M ); - Copy( GEWB_Ave_fx, st->mem_AR_fx, M ); - } - - /* Initialize IGF */ - if ( st->hIGFEnc != NULL ) - { - st->hIGFEnc->infoStopFrequency = -1; - move16(); - } - - IF( st->igf ) - { - IGFEncSetMode_fx( st->hIGFEnc, st->total_brate, st->bwidth, st->element_mode, st->rf_mode ); - } - ELSE IF( st->hIGFEnc != NULL ) - { - st->hIGFEnc->infoTotalBitsWritten = 0; - move16(); - if ( EQ_16( MCT_flag, -10 ) ) - { - st->hIGFEnc->infoTotalBitsPerFrameWritten = 0; - move16(); - } - /* the line above is needed for some transition, but when going from low rate to high rate, ex 7k2 to 96k, EVS fix point doesn't do the reset (or it does somewhere else */ - } - - /* Initialize TCX */ - if ( hTcxEnc != NULL ) - { - init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); - } - /* Initialize Core Signal Analysis Module */ - init_core_sig_ana_fx( st ); - - /* Initialize Signal Buffers */ - init_sig_buffers_fx( st, L_frame_old, L_subfr ); - - /* Initialize ACELP */ - init_acelp_fx( st, L_frame_old, shift ); - - if ( st->ini_frame == 0 ) - { - st->tec_tfa = 0; - move16(); - } - IF( st->tec_tfa == 0 ) - { - resetTecEnc_Fx( st->hTECEnc, 0 ); - } - ELSE - { - resetTecEnc_Fx( st->hTECEnc, 1 ); - } - st->tec_tfa = 0; - move16(); - test(); - test(); - if ( EQ_16( st->bwidth, SWB ) && ( EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) ) - { - st->tec_tfa = 1; - move16(); - } - - st->tec_flag = 0; - move16(); - st->tfa_flag = 0; - move16(); - - st->glr = 0; - move16(); - - test(); - test(); - test(); - if ( ( EQ_32( st->total_brate, ACELP_9k60 ) ) || ( EQ_32( st->total_brate, ACELP_16k40 ) ) || - ( EQ_32( st->total_brate, ACELP_24k40 ) ) || ( EQ_32( st->total_brate, ACELP_32k ) ) ) - { - st->glr = 1; - move16(); - } - - st->glr_reset = 0; - move16(); - - /* Initialize ACELP/TCX Modes */ - init_modes_fx( st, last_total_brate ); - - /* Init I/O */ - - - /* Adaptive BPF */ - set16_fx( st->mem_bpf_fx.noise_buf, 0, 2 * L_FILT16k ); - set16_fx( st->mem_bpf_fx.error_buf, 0, L_FILT16k ); - set16_fx( st->bpf_gainT, 0, NB_SUBFR16k ); - - set16_fx( st->bpf_T, PIT_MIN_12k8, NB_SUBFR16k ); - - st->mem_bpf_fx.lp_error = 0; - move16(); - st->mem_bpf_fx.noise_shift_old = 0; - move16(); - - IF( st->ini_frame == 0 ) - { - st->Q_max_enc[0] = 15; - move16(); - st->Q_max_enc[1] = 15; - move16(); - } - - st->enablePlcWaveadjust = 0; - move16(); - if ( GE_32( st->total_brate, 48000 ) ) - { - st->enablePlcWaveadjust = 1; - move16(); - } - - init_PLC_enc_fx( st->hPlcExt, st->sr_core ); - - st->glr_idx[0] = 0; - move16(); - st->glr_idx[1] = 0; - move16(); - move16(); - move16(); /* casts */ - st->mean_gc[0] = 0; - st->mean_gc[1] = 0; - st->prev_lsf4_mean = 0; - move16(); - - st->last_stab_fac = 0; - move16(); - - - return; -} -#endif - -#ifndef HARMONIZE_2567_init_functions -static void init_tcx_fx( - Encoder_State *st, - Word16 L_frame_old, - const Word32 total_brate, - const Word32 last_total_brate, - const Word16 MCT_flag ) -{ - Word16 i; - Word16 fscaleFB; - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - (void) MCT_flag; - (void) total_brate; - (void) last_total_brate; - fscaleFB = div_l( L_shl( st->input_Fs, LD_FSCALE_DENOM + 1 ), 12800 ); - - init_TCX_config( st->hTcxCfg, st->L_frame, st->fscale, hTcxEnc->L_frameTCX, fscaleFB ); - - st->hTcxCfg->tcx_mdct_window_length_old = st->hTcxCfg->tcx_mdct_window_length; - move16(); - - /* TCX Offset */ - st->hTcxCfg->tcx_offset = shr( st->hTcxCfg->tcx_mdct_window_delay, 1 ); - move16(); - st->hTcxCfg->tcx_offsetFB = shr( st->hTcxCfg->tcx_mdct_window_delayFB, 1 ); - move16(); - - /*<0 rectangular transition with optimized window size = L_frame+L_frame/4*/ - st->hTcxCfg->lfacNext = sub( st->hTcxCfg->tcx_offset, shr( st->L_frame, 2 ) ); - move16(); - st->hTcxCfg->lfacNextFB = sub( st->hTcxCfg->tcx_offsetFB, shr( hTcxEnc->L_frameTCX, 2 ) ); - move16(); - IF( st->ini_frame == 0 ) - { - st->hTcxCfg->tcx_curr_overlap_mode = st->hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW; - move16(); - move16(); - } - - /* Init TCX target bits correction factor */ - hTcxEnc->tcx_target_bits_fac = 0x4000; /*1.0f in 1Q14*/ - move16(); - hTcxEnc->measuredBwRatio = 0x4000; /*1.0f in 1Q14*/ - move16(); - hTcxEnc->noiseTiltFactor = 9216; /*0.5625f in 1Q14*/ - move16(); - hTcxEnc->noiseLevelMemory_cnt = 0; - move16(); - /*SQ deadzone & memory quantization*/ - - /*0.375f: deadzone of 1.25->rounding=1-1.25/2 (No deadzone=0.5)*/ - st->hTcxCfg->sq_rounding = 12288 /*0.375f Q15*/; - move16(); - - FOR( i = 0; i < L_FRAME_PLUS; i++ ) - { - hTcxEnc->memQuantZeros[i] = 0; - move16(); - } - - /* TCX rate loop */ - st->hTcxCfg->tcxRateLoopOpt = 0; - move16(); - - if ( st->tcxonly != 0 ) - { - st->hTcxCfg->tcxRateLoopOpt = 2; - move16(); - } - - /* TCX bandwidth */ - move16(); - st->hTcxCfg->bandwidth = getTcxBandwidth( st->bwidth ); - - - /* set number of coded lines */ - st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( st->bwidth ); - - /* TNS in TCX */ - move16(); - move16(); - st->hTcxCfg->fIsTNSAllowed = (Word8) getTnsAllowed( st->total_brate, st->igf, st->element_mode ); - - st->hTcxCfg->pCurrentTnsConfig = NULL; - - IF( st->hTcxCfg->fIsTNSAllowed != 0 ) - { - InitTnsConfigs_fx( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->total_brate, st->element_mode, 0 /*is_mct*/ ); - } - - /* TCX-LTP */ - hTcxEnc->tcxltp = getTcxLtp( st->sr_core ); - move16(); - test(); - test(); - test(); - test(); - IF( st->ini_frame == 0 ) - { - - hTcxEnc->tcxltp_pitch_int_past = st->L_frame; - move16(); - hTcxEnc->tcxltp_pitch_fr_past = 0; - move16(); - hTcxEnc->tcxltp_gain_past = 0; - move16(); - hTcxEnc->tcxltp_norm_corr_past = 0; - move16(); - } - ELSE IF( NE_16( st->L_frame, L_frame_old ) && !( ( EQ_32( st->total_brate, 16400 ) || EQ_32( st->total_brate, 24400 ) ) && ( EQ_32( st->total_brate, st->last_total_brate ) ) && ( EQ_32( st->last_bwidth, st->bwidth ) ) ) ) - { - Word16 pitres, pitres_old; - Word16 pit, pit_old; - - pitres_old = 4; - move16(); - if ( EQ_16( 160, shr( L_frame_old, sub( 7, norm_s( L_frame_old ) ) ) ) ) /*if ( L_frame_old%160==0 )*/ - { - pitres_old = 6; - move16(); - } - - /*pit_old = (float)st->tcxltp_pitch_int_past + (float)st->tcxltp_pitch_fr_past/(float)pitres_old;*/ - pit_old = add( hTcxEnc->tcxltp_pitch_int_past, mult_r( hTcxEnc->tcxltp_pitch_fr_past, div_s( 1, pitres_old ) ) ); - - pitres = 4; - move16(); - if ( EQ_16( 160, shr( st->L_frame, sub( 7, norm_s( st->L_frame ) ) ) ) ) /*if ( st->L_frame%160==0 )*/ - { - pitres = 6; - move16(); - } - - /*pit = pit_old * (float)st->L_frame/(float)L_frame_old;*/ - pit = shl_sat( mult_r( pit_old, div_s( st->L_frame, shl( L_frame_old, 2 ) ) ), 2 ); - /* Note : the saturation here that can happens when FS == 32kHz*/ - /* assert(pit <= st->L_frame);*/ - - hTcxEnc->tcxltp_pitch_int_past = pit; - move16(); - hTcxEnc->tcxltp_pitch_fr_past = i_mult2( sub( pit, hTcxEnc->tcxltp_pitch_int_past ), pitres ); - move16(); - } - - /* Residual Coding*/ - st->hTcxCfg->resq = getResq( st->total_brate ); - move16(); - - test(); - if ( st->hTcxCfg->resq != 0 && st->tcxonly == 0 ) - { - st->hTcxCfg->tcxRateLoopOpt = 1; - move16(); - } - - st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, st->total_brate, st->rf_mode ); - move16(); - hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->total_brate, st->rf_mode, st->element_mode ); - move16(); -} -#endif void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Word16 L_subfr ) { @@ -482,492 +51,94 @@ void init_sig_buffers_fx( Encoder_State *st, const Word16 L_frame_old, const Wor ELSE { test(); - test(); - test(); - test(); - test(); - IF( NE_16( st->L_frame, L_frame_old ) && !( ( EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, st->last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) ) ) - { - lerp( st->buf_speech_enc, st->buf_speech_enc, st->L_frame, L_frame_old ); - test(); - IF( NE_16( st->last_core, TCX_20_CORE ) && NE_16( st->last_core, TCX_10_CORE ) ) /* condition should be checked again */ - { - Copy( st->buf_speech_enc, hTcxEnc->buf_speech_ltp, st->L_frame ); - } - - Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM, sub( st->prev_Q_new, st->prev_Q_old ) ); // Q(prev_Q_new) - - /*Resamp buffers needed only for ACELP*/ - test(); - test(); - IF( EQ_16( st->L_frame, L_FRAME ) && !st->tcxonly ) - { - Copy_Scale_sig( st->old_inp_12k8_fx, st->buf_speech_enc_pe + st->L_frame - L_INP_MEM, L_INP_MEM, sub( st->prev_Q_new, st->prev_Q_old ) ); // Q(prev_Q_new) - } - ELSE IF( EQ_16( st->L_frame, L_FRAME16k ) && !st->tcxonly ) - { - lerp( st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, st->buf_wspeech_enc + st->L_frame + L_SUBFR - 310, 310, L_WSP_MEM ); - Copy( st->old_inp_16k_fx, st->buf_speech_enc_pe + st->L_frame - L_INP_MEM, L_INP_MEM ); - } - - st->mem_preemph_enc = st->buf_speech_enc[st->encoderPastSamples_enc + st->encoderLookahead_enc - 1]; - move16(); - st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame + L_SUBFR - 1]; - move16(); - } - /*coming from TCXonly modes*/ - ELSE IF( !st->tcxonly && GE_32( st->last_total_brate, ACELP_32k ) ) - { - - Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM, sub( st->prev_Q_new, st->prev_Q_old ) ); // Q(prev_Q_new) - - /*Resamp buffers needed only for ACELP*/ - IF( EQ_16( st->L_frame, L_FRAME16k ) ) - { - lerp( st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, st->buf_wspeech_enc + st->L_frame + L_SUBFR - 310, 310, L_WSP_MEM ); - } - hLPDmem->mem_w0 = 0; - move16(); - st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame + L_SUBFR - 1]; - move16(); - } - } - - st->new_speech_enc = st->buf_speech_enc + st->encoderPastSamples_enc + st->encoderLookahead_enc; - st->new_speech_enc_pe = st->buf_speech_enc_pe + st->encoderPastSamples_enc + st->encoderLookahead_enc; - hTcxEnc->new_speech_ltp = hTcxEnc->buf_speech_ltp + st->encoderPastSamples_enc + st->encoderLookahead_enc; - hTcxEnc->new_speech_TCX = st->input_buff_fx + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) - NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ); - - st->speech_enc = st->buf_speech_enc + st->encoderPastSamples_enc; - st->speech_enc_pe = st->buf_speech_enc_pe + st->encoderPastSamples_enc; - hTcxEnc->speech_ltp = hTcxEnc->buf_speech_ltp + st->encoderPastSamples_enc; - hTcxEnc->speech_TCX = hTcxEnc->new_speech_TCX - st->encoderLookahead_FB; - - st->wspeech_enc = st->buf_wspeech_enc + st->L_frame + L_subfr; - - test(); - test(); - IF( st->ini_frame == 0 || NE_16( st->L_frame, L_frame_old ) || EQ_16( st->last_codec_mode, MODE1 ) ) - { - set16_fx( st->buf_synth, 0, OLD_SYNTH_SIZE_ENC + L_FRAME32k ); - } - - st->synth = st->buf_synth + st->L_frame + L_subfr; - - - return; -} - -#ifndef HARMONIZE_2567_init_functions -static void init_core_sig_ana_fx( Encoder_State *st ) -{ - - /* Pre-emphasis factor and memory */ - - st->preemph_fac = PREEMPH_FAC_SWB; /*SWB*/ - move16(); - IF( LT_16( st->fscale, ( 16000 * FSCALE_DENOM ) / 12800 ) ) - { - st->preemph_fac = PREEMPH_FAC; /*WB*/ - move16(); - } - ELSE IF( LT_16( st->fscale, ( 24000 * FSCALE_DENOM ) / 12800 ) ) - { - st->preemph_fac = PREEMPH_FAC_16k; /*WB*/ - move16(); - } - - st->hTcxCfg->preemph_fac = st->preemph_fac; - move16(); - - st->gamma = GAMMA1; - move16(); - st->inv_gamma = GAMMA1_INV; - move16(); - IF( EQ_32( st->sr_core, 16000 ) ) - { - st->gamma = GAMMA16k; - move16(); - st->inv_gamma = GAMMA16k_INV; - move16(); - } - - - st->min_band = 1; - move16(); - st->max_band = 16; - move16(); - - IF( st->narrowBand == 0 ) - { - st->min_band = 0; - move16(); - st->max_band = 19; - move16(); - } - - - return; -} -#endif - -#ifndef HARMONIZE_2567_init_functions -static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift ) -{ - Word16 mem_syn_r_size_old; - Word16 mem_syn_r_size_new; - LPD_state_HANDLE hLPDmem = st->hLPDmem; - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - - /* Init pitch lag */ - st->pit_res_max = initPitchLagParameters( st->sr_core, &st->pit_min, &st->pit_fr1, &st->pit_fr1b, &st->pit_fr2, &st->pit_max ); - move16(); - - /* Init LPDmem */ - IF( st->ini_frame == 0 ) - { - set16_fx( hLPDmem->syn, 0, 1 + M ); - - set16_fx( hTcxEnc->Txnq, 0, L_FRAME32k / 2 + 64 ); - st->hTcxEnc->q_Txnq = Q15; - move16(); - hTcxEnc->acelp_zir = hTcxEnc->Txnq + shr( st->L_frame, 1 ); - set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM ); - } - ELSE /*Rate switching*/ - { - IF( EQ_16( st->last_core, ACELP_CORE ) ) - { - lerp( hTcxEnc->Txnq, hTcxEnc->Txnq, shr( st->L_frame, 1 ), shr( L_frame_old, 1 ) ); - } - ELSE - { - lerp( hTcxEnc->Txnq, hTcxEnc->Txnq, st->hTcxCfg->tcx_mdct_window_length, st->hTcxCfg->tcx_mdct_window_length_old ); - } - hTcxEnc->acelp_zir = hTcxEnc->Txnq + shr( st->L_frame, 1 ); - - /* Rate switching */ - IF( EQ_16( st->last_codec_mode, MODE1 ) ) - { - Copy( hLPDmem->mem_syn1_fx, hLPDmem->mem_syn2, M ); - set16_fx( hTcxEnc->Txnq, 0, L_FRAME32k / 2 + 64 ); - st->hTcxEnc->q_Txnq = Q15; - move16(); - set16_fx( hLPDmem->syn, 0, M ); - } - - /*AMR-WBIO->MODE2*/ - IF( EQ_16( st->last_core, AMR_WB_CORE ) ) - { - st->next_force_safety_net = 1; - move16(); - st->last_core = ACELP_CORE; - move16(); - } - /*HQ-CORE->MODE2*/ - test(); - IF( EQ_16( st->last_codec_mode, MODE1 ) && EQ_16( st->last_core, HQ_CORE ) ) - { - /*Reset of ACELP memories*/ - st->next_force_safety_net = 1; - move16(); - st->rate_switching_reset = 1; - move16(); - hLPDmem->tilt_code = TILT_CODE; - move16(); - set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM ); - set16_fx( hLPDmem->syn, 0, 1 + M ); - hLPDmem->mem_w0 = 0; - move16(); - set16_fx( hLPDmem->mem_syn, 0, M ); - set16_fx( hLPDmem->mem_syn2, 0, M ); - - /* unquantized LPC*/ - test(); - test(); + test(); + test(); + test(); + test(); + IF( NE_16( st->L_frame, L_frame_old ) && !( ( EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, st->last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) ) ) + { + lerp( st->buf_speech_enc, st->buf_speech_enc, st->L_frame, L_frame_old ); test(); - IF( !( ( EQ_32( st->total_brate, ACELP_16k40 ) || EQ_32( st->total_brate, ACELP_24k40 ) ) && ( EQ_32( st->total_brate, st->last_total_brate ) ) && ( EQ_16( st->last_bwidth, st->bwidth ) ) ) ) + IF( NE_16( st->last_core, TCX_20_CORE ) && NE_16( st->last_core, TCX_10_CORE ) ) /* condition should be checked again */ { - Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/ - IF( EQ_16( st->L_frame, L_FRAME16k ) ) - { - lsp_convert_poly_fx( st->lspold_enc_fx, st->L_frame, 0 ); - } + Copy( st->buf_speech_enc, hTcxEnc->buf_speech_ltp, st->L_frame ); } - Copy( st->lspold_enc_fx, st->lsp_old_fx, M ); /*used unquantized values for mid-LSF Q*/ - IF( st->tcxonly == 0 ) + + Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM, sub( st->prev_Q_new, st->prev_Q_old ) ); // Q(prev_Q_new) + + /*Resamp buffers needed only for ACELP*/ + test(); + test(); + IF( EQ_16( st->L_frame, L_FRAME ) && !st->tcxonly ) { - lsp2lsf_fx( st->lsp_old_fx, st->lsf_old_fx, M, st->sr_core ); + Copy_Scale_sig( st->old_inp_12k8_fx, st->buf_speech_enc_pe + st->L_frame - L_INP_MEM, L_INP_MEM, sub( st->prev_Q_new, st->prev_Q_old ) ); // Q(prev_Q_new) } - ELSE + ELSE IF( EQ_16( st->L_frame, L_FRAME16k ) && !st->tcxonly ) { - E_LPC_lsp_lsf_conversion( st->lsp_old_fx, st->lsf_old_fx, M ); + lerp( st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, st->buf_wspeech_enc + st->L_frame + L_SUBFR - 310, 310, L_WSP_MEM ); + Copy( st->old_inp_16k_fx, st->buf_speech_enc_pe + st->L_frame - L_INP_MEM, L_INP_MEM ); } - st->last_core = TCX_20_CORE; - move16(); - st->hTcxCfg->last_aldo = 1; /*It was previously ALDO*/ - st->hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; + st->mem_preemph_enc = st->buf_speech_enc[st->encoderPastSamples_enc + st->encoderLookahead_enc - 1]; move16(); + st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame + L_SUBFR - 1]; move16(); - /*ALDO overlap windowed past: also used in MODE1 but for other MDCT-FB*/ - set16_fx( hTcxEnc->old_out_fx, 0, st->L_frame ); } - ELSE + /*coming from TCXonly modes*/ + ELSE IF( !st->tcxonly && GE_32( st->last_total_brate, ACELP_32k ) ) { - test(); - test(); - IF( ( NE_16( st->L_frame, L_frame_old ) ) && ( LE_16( st->L_frame, L_FRAME16k ) ) && ( LE_16( L_frame_old, L_FRAME16k ) ) ) - { - /* convert quantized LSP vector */ - st->rate_switching_reset = lsp_convert_poly_fx( st->lsp_old_fx, st->L_frame, 0 ); - move16(); - IF( st->tcxonly == 0 ) - { - lsp2lsf_fx( st->lsp_old_fx, st->lsf_old_fx, M, st->sr_core ); - } - ELSE - { - E_LPC_lsp_lsf_conversion( st->lsp_old_fx, st->lsf_old_fx, M ); - } - IF( EQ_16( st->L_frame, L_FRAME16k ) ) - { - Copy( st->lsp_old_fx, st->lspold_enc_fx, M ); - } - ELSE - { - Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); - } - synth_mem_updt2_fx( st->L_frame, st->last_L_frame, hLPDmem->old_exc, hLPDmem->mem_syn_r, hLPDmem->mem_syn2, hLPDmem->mem_syn, ENC ); - - /*Mem of deemphasis stay unchanged : hLPDmem->syn*/ - { - Word16 tmp, A[M + 1], Ap[M + 1], tmp_buf[M + 1]; - /* Update wsyn */ - /* lsp2a_stab( st->lsp_old, A, M ); */ - E_LPC_f_lsp_a_conversion( st->lsp_old_fx, A, M ); - weight_a_fx( A, Ap, GAMMA1, M ); - tmp = 0; - move16(); - tmp_buf[0] = 0; - move16(); - Copy( hLPDmem->mem_syn2, tmp_buf + 1, M ); - deemph_fx( tmp_buf + 1, st->preemph_fac, M, &tmp ); - Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 ); - hLPDmem->mem_w0 = sub_sat( shr_sat( st->wspeech_enc[-1], shift ), tmp ); - move16(); - } - } - ELSE IF( ( NE_16( st->L_frame, L_frame_old ) ) ) - { - /*Partial reset of ACELP memories*/ - st->next_force_safety_net = 1; - move16(); - st->rate_switching_reset = 1; - move16(); - - /*reset partly some memories*/ - hLPDmem->tilt_code = TILT_CODE; - move16(); - set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM ); - move16(); - - /*Resamp others memories*/ - /*Size of LPC syn memory*/ - /* 1.25/20.0 = 1.0/16.0 -> shift 4 to the right. */ - mem_syn_r_size_old = shr( L_frame_old, 4 ); - mem_syn_r_size_new = shr( st->L_frame, 4 ); - - lerp( hLPDmem->mem_syn_r + L_SYN_MEM - mem_syn_r_size_old, hLPDmem->mem_syn_r + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); - Copy( hLPDmem->mem_syn_r + L_SYN_MEM - M, hLPDmem->mem_syn, M ); - Copy( hLPDmem->mem_syn, hLPDmem->mem_syn2, M ); - - /*Untouched memories : hLPDmem->syn & hLPDmem->mem_w0*/ - hLPDmem->mem_w0 = 0; - move16(); + Copy_Scale_sig( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM, sub( st->prev_Q_new, st->prev_Q_old ) ); // Q(prev_Q_new) - /* unquantized LPC*/ - Copy( st->lsp_old1_fx, st->lspold_enc_fx, M ); /*lsp old @12.8kHz*/ - IF( EQ_16( st->L_frame, L_FRAME16k ) ) - { - lsp_convert_poly_fx( st->lspold_enc_fx, st->L_frame, 0 ); - } - Copy( st->lspold_enc_fx, st->lsp_old_fx, M ); /*used unquantized values for mid-LSF Q*/ - IF( st->tcxonly == 0 ) - { - lsp2lsf_fx( st->lsp_old_fx, st->lsf_old_fx, M, st->sr_core ); - } - ELSE - { - E_LPC_lsp_lsf_conversion( st->lsp_old_fx, st->lsf_old_fx, M ); - } - } - ELSE IF( !st->tcxonly && EQ_16( st->L_frame, L_FRAME16k ) && GT_32( st->last_total_brate, ACELP_32k ) ) + /*Resamp buffers needed only for ACELP*/ + IF( EQ_16( st->L_frame, L_FRAME16k ) ) { - lsp2lsf_fx( st->lsp_old_fx, st->lsf_old_fx, M, st->sr_core ); + lerp( st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, st->buf_wspeech_enc + st->L_frame + L_SUBFR - 310, 310, L_WSP_MEM ); } + hLPDmem->mem_w0 = 0; + move16(); + st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame + L_SUBFR - 1]; + move16(); } } - test(); - test(); - if ( EQ_16( st->last_bwidth, NB ) && NE_16( st->bwidth, NB ) && st->ini_frame != 0 ) - { - st->rate_switching_reset = 1; - move16(); - } + st->new_speech_enc = st->buf_speech_enc + st->encoderPastSamples_enc + st->encoderLookahead_enc; + st->new_speech_enc_pe = st->buf_speech_enc_pe + st->encoderPastSamples_enc + st->encoderLookahead_enc; + hTcxEnc->new_speech_ltp = hTcxEnc->buf_speech_ltp + st->encoderPastSamples_enc + st->encoderLookahead_enc; + hTcxEnc->new_speech_TCX = st->input_buff_fx + L_FRAME48k + NS2SA( 48000, DELAY_FIR_RESAMPL_NS ) - NS2SA_FX2( st->input_Fs, DELAY_FIR_RESAMPL_NS ); - /* Post-processing */ - hLPDmem->dm_fx.prev_gain_code = 0; - move32(); - set16_fx( hLPDmem->dm_fx.prev_gain_pit, 0, 6 ); - hLPDmem->dm_fx.prev_state = 0; + st->speech_enc = st->buf_speech_enc + st->encoderPastSamples_enc; + st->speech_enc_pe = st->buf_speech_enc_pe + st->encoderPastSamples_enc; + hTcxEnc->speech_ltp = hTcxEnc->buf_speech_ltp + st->encoderPastSamples_enc; + hTcxEnc->speech_TCX = hTcxEnc->new_speech_TCX - st->encoderLookahead_FB; - move16(); - hLPDmem->gc_threshold = 0; - move16(); + st->wspeech_enc = st->buf_wspeech_enc + st->L_frame + L_subfr; - /* Pulse Search configuration */ - st->acelp_autocorr = 1; - move16(); test(); test(); - /*Use for 12.8 kHz sampling rate and low bitrates, the conventional pulse search->better SNR*/ - if ( ( LE_32( st->total_brate, ACELP_9k60 ) || st->rf_mode != 0 ) && ( EQ_32( st->sr_core, 12800 ) ) ) + IF( st->ini_frame == 0 || NE_16( st->L_frame, L_frame_old ) || EQ_16( st->last_codec_mode, MODE1 ) ) { - st->acelp_autocorr = 0; - move16(); + set16_fx( st->buf_synth, 0, OLD_SYNTH_SIZE_ENC + L_FRAME32k ); } - - /*BPF parameters for adjusting gain in function of background noise*/ - IF( EQ_16( st->codec_mode, MODE2 ) ) - { - st->mem_bpf_fx.lp_error_ener = 0; - move32(); - if ( EQ_16( st->last_codec_mode, MODE1 ) ) - { - st->mem_bpf_fx.lp_error = 0; - move32(); - } - } + st->synth = st->buf_synth + st->L_frame + L_subfr; return; } -#endif - -#ifndef HARMONIZE_2567_init_functions -static void init_modes_fx( - Encoder_State *st, - const Word32 last_total_brate ) -{ - Word8 n; - Word32 tmp32; - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - - - /* Restrict ACE/TCX20/TCX10 mode */ - move16(); - st->restrictedMode = getRestrictedMode( st->element_mode, st->total_brate, st->Opt_AMR_WB ); - move16(); - st->acelpEnabled = 0; - move16(); - st->tcx20Enabled = 0; - move16(); - st->tcx10Enabled = 0; - - if ( EQ_16( s_and( st->restrictedMode, 1 ), 1 ) ) - { - st->acelpEnabled = 1; - move16(); - } - if ( EQ_16( s_and( st->restrictedMode, 2 ), 2 ) ) - { - st->tcx20Enabled = 1; - move16(); - } - if ( EQ_16( s_and( st->restrictedMode, 4 ), 4 ) ) - { - st->tcx10Enabled = 1; - move16(); - } - - - /* TCX mode (TCX20 TCX10_10 or NO_TCX) */ - hTcxEnc->tcxMode = NO_TCX; - move16(); - - /* Bits Budget */ - /*st->bits_frame_nominal = (int)( (float)st->L_frame * (float)FSCALE_DENOM * (float)st->bitrate / ( (float)st->fscale * 12800.0f ) );*/ - /*st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f );*/ - /*328 = 0.010009765625 in 0Q15*/ - /* st->bits_frame_nominal = extract_h(L_add(L_mult(div_l(L_mult(shl(st->L_frame,2),st->bitrate),st->fscale),328),16056)); */ - - /* st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ); */ - assert( FSCALE_DENOM == 512 ); - assert( st->fscale == 2 * st->L_frame ); /* this assumption is true if operated in 20ms frames with FSCALE_DENOM == 512, which is the current default */ - tmp32 = L_shl( st->total_brate, 1 ); /* (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate */ - st->bits_frame_nominal = extract_l( L_shr( Mpy_32_16_1( tmp32, 20972 ), 6 ) ); /* 20972 = 0.01 * 64 * 32768 */ - move16(); - IF( st->Opt_AMR_WB ) - { - st->bits_frame = st->bits_frame_nominal; - st->bits_frame_core = st->bits_frame_nominal; - st->frame_size_index = 0; - move16(); - move16(); - move16(); - } - ELSE - { - FOR( n = 0; n < FRAME_SIZE_NB; n++ ) - { - IF( EQ_16( FrameSizeConfig[n].frame_bits, st->bits_frame_nominal ) ) - { - move16(); - move16(); - move16(); - st->frame_size_index = n; - st->bits_frame = FrameSizeConfig[n].frame_bits; - st->bits_frame_core = FrameSizeConfig[n].frame_net_bits; - BREAK; - } - } - if ( n == FRAME_SIZE_NB ) - { - assert( !"Bitrate not supported: not part of EVS" ); - } - } - - /* Reconfigure core */ - core_coder_reconfig_fx( st, last_total_brate ); - - return; -} -#endif /*-----------------------------------------------------------------------* * init_coder_ace_plus() * * Initialization of state variables *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_functions void init_coder_ace_plus_fx( Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate */ const Word32 igf_brate, /* i : IGF configuration bitrate */ const Word16 shift, const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -#else -void init_coder_ace_plus_ivas_fx( - Encoder_State *st, /* i : Encoder state */ - const Word32 last_total_brate, /* i : last total bitrate */ - const Word32 igf_brate, /* i : IGF configuration bitrate */ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -#endif ) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; @@ -1046,7 +217,6 @@ void init_coder_ace_plus_ivas_fx( { st->acelpFramesCount = 0; move16(); -#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { st->prevTempFlatness_fx = 128 /*1.0f Q7*/; @@ -1054,12 +224,9 @@ void init_coder_ace_plus_ivas_fx( } ELSE { -#endif st->prevTempFlatness_32fx = ONE_IN_Q21 /*1.0f Q21*/; move32(); -#ifdef HARMONIZE_2567_init_functions } -#endif } /* Initialize TBE */ @@ -1078,13 +245,11 @@ void init_coder_ace_plus_ivas_fx( st->currEnergyHF_e_fx = 0; move16(); -#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { st->energyCoreLookahead_Fx = 0; move16(); } -#endif /* Initialize LPC analysis/quantization */ test(); @@ -1125,60 +290,35 @@ void init_coder_ace_plus_ivas_fx( { st->hIGFEnc->infoTotalBitsWritten = 0; move16(); -#ifdef HARMONIZE_2567_init_functions /* TODO mul: check, why in BASOP we can't reset st->hIGFEnc->infoTotalBitsPerFrameWritten w/o affecting bit-exactness */ if ( GT_16( st->element_mode, EVS_MONO ) ) { -#endif st->hIGFEnc->infoTotalBitsPerFrameWritten = 0; move16(); -#ifdef HARMONIZE_2567_init_functions } -#endif } -#ifdef HARMONIZE_2567_init_functions /* Initialize Core Signal Analysis Module */ init_core_sig_ana_fx( st ); -#else - /* Initialize Core Signal Analysis Module */ - init_core_sig_ana_ivas_fx( st ); -#endif /*HARMONIZE_2567_init_functions*/ /* Initialize TCX */ IF( hTcxEnc != NULL ) { -#ifdef HARMONIZE_2567_init_functions init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); -#else - IF( GT_16( st->element_mode, EVS_MONO ) ) - { - init_tcx_ivas_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); - } - ELSE - { - init_tcx_fx( st, L_frame_old, st->total_brate, last_total_brate, MCT_flag ); - } -#endif } /* Initialize Signal Buffers */ -#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { init_sig_buffers_fx( st, L_frame_old, L_subfr ); } ELSE { -#endif init_sig_buffers_ivas_fx( st, L_frame_old, L_subfr, last_total_brate ); -#ifdef HARMONIZE_2567_init_functions } -#endif /* Initialize ACELP */ -#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { init_acelp_fx( st, L_frame_old, shift, last_total_brate ); @@ -1187,9 +327,6 @@ void init_coder_ace_plus_ivas_fx( { init_acelp_fx( st, L_frame_old, 0, last_total_brate ); } -#else - init_acelp_ivas_fx( st, L_frame_old, last_total_brate ); -#endif if ( st->ini_frame == 0 ) { @@ -1239,15 +376,10 @@ void init_coder_ace_plus_ivas_fx( move16(); /* Initialize ACELP/TCX Modes */ -#ifdef HARMONIZE_2567_init_functions init_modes_fx( st, last_total_brate ); -#else - init_modes_ivas_fx( st, last_total_brate ); -#endif /*HARMONIZE_2567_init_functions*/ /* Adaptive BPF */ -#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { set16_fx( st->mem_bpf_fx.noise_buf, 0, 2 * L_FILT16k ); @@ -1263,12 +395,9 @@ void init_coder_ace_plus_ivas_fx( } ELSE { -#endif set32_fx( st->mem_bpf_fx1, 0, 2 * L_FILT16k ); set32_fx( st->mem_error_bpf_fx, 0, 2 * L_FILT16k ); -#ifdef HARMONIZE_2567_init_functions } -#endif IF( st->ini_frame == 0 ) { @@ -1317,11 +446,7 @@ void init_coder_ace_plus_ivas_fx( *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_functions static void init_tcx_fx( -#else -static void init_tcx_ivas_fx( -#endif Encoder_State *st, const Word16 L_frame_old, const Word32 total_brate, @@ -1329,11 +454,9 @@ static void init_tcx_ivas_fx( const Word16 MCT_flag ) { TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; -#ifdef HARMONIZE_2567_init_functions Word16 fscaleFB; fscaleFB = div_l( L_shl( st->input_Fs, LD_FSCALE_DENOM + 1 ), 12800 ); -#endif /* Share the memories for 2xTCX10/4xTCX5 and for TCX20 */ hTcxEnc->spectrum_fx[0] = hTcxEnc->spectrum_long_fx; @@ -1341,15 +464,9 @@ static void init_tcx_ivas_fx( st->hTcxEnc->spectrum_e[0] = st->hTcxEnc->spectrum_e[1] = 0; move16(); move16(); -#ifdef HARMONIZE_2567_init_functions init_tcx_cfg_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag, fscaleFB ); -#else - init_tcx_cfg_ivas_fx( st->hTcxCfg, total_brate, st->sr_core, st->input_Fs, st->L_frame, st->bwidth, hTcxEnc->L_frameTCX, - st->fscale, st->preemph_fac, st->tcxonly, st->rf_mode, st->igf, - st->hIGFEnc != NULL ? st->hIGFEnc->infoStopFrequency : 0, st->element_mode, st->ini_frame, MCT_flag ); -#endif /* Init TCX target bits correction factor */ hTcxEnc->tcx_target_bits_fac = 0x4000; /*1.0f in 1Q14*/ @@ -1378,10 +495,8 @@ static void init_tcx_ivas_fx( hTcxEnc->tcxltp_gain_past = 0; hTcxEnc->tcxltp_norm_corr_past = 0; move16(); -#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { -#endif hTcxEnc->tcxltp_norm_corr_mem = 0; hTcxEnc->kernel_switch_corr_past = 0; hTcxEnc->kernel_symmetry_past = 0; /* MDCT_IV & 1 */ @@ -1396,9 +511,7 @@ static void init_tcx_ivas_fx( move16(); move16(); move16(); -#ifdef HARMONIZE_2567_init_functions } -#endif move16(); } ELSE IF( NE_16( st->L_frame, L_frame_old ) && !( ( GE_32( total_brate, ACELP_16k40 ) && LE_32( total_brate, ACELP_24k40 ) ) && @@ -1616,11 +729,7 @@ static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_ol * * *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_functions static void init_core_sig_ana_fx( Encoder_State *st ) -#else -static void init_core_sig_ana_ivas_fx( Encoder_State *st ) -#endif { /* Pre-emphasis factor and memory */ @@ -1637,13 +746,11 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) st->preemph_fac = PREEMPH_FAC_16k; /*WB*/ move16(); } -#ifdef HARMONIZE_2567_init_functions if ( EQ_16( st->element_mode, EVS_MONO ) ) { st->hTcxCfg->preemph_fac = st->preemph_fac; move16(); } -#endif st->gamma = GAMMA1; move16(); @@ -1680,11 +787,7 @@ static void init_core_sig_ana_ivas_fx( Encoder_State *st ) * * *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_functions static void init_acelp_fx( Encoder_State *st, Word16 L_frame_old, const Word16 shift, const Word32 last_total_brate ) -#else -static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Word32 last_total_brate ) -#endif { Word16 mem_syn_r_size_old; Word16 mem_syn_r_size_new; @@ -1711,17 +814,13 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Wor { set16_fx( hLPDmem->syn, 0, 1 + M ); set16_fx( hLPDmem->mem_syn_r, 0, L_SYN_MEM ); -#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { -#endif hLPDmem->q_lpd_syn = Q15; hLPDmem->q_mem_syn = Q15; move16(); move16(); -#ifdef HARMONIZE_2567_init_functions } -#endif } IF( st->hTcxEnc != NULL ) @@ -1751,12 +850,6 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Wor { Copy( hLPDmem->mem_syn1_fx, hLPDmem->mem_syn2, M ); set16_fx( hLPDmem->syn, 0, M ); -#ifndef HARMONIZE_2567_init_functions - hLPDmem->q_lpd_syn = Q15; - hLPDmem->q_mem_syn = Q15; - move16(); - move16(); -#endif } IF( st->hTcxEnc != NULL ) { @@ -1789,30 +882,22 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Wor move16(); set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM ); set16_fx( hLPDmem->syn, 0, 1 + M ); -#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { -#endif hLPDmem->q_lpd_syn = Q15; move16(); hLPDmem->q_lpd_old_exc = Q15; move16(); -#ifdef HARMONIZE_2567_init_functions } -#endif hLPDmem->mem_w0 = 0; move16(); set16_fx( hLPDmem->mem_syn, 0, M ); set16_fx( hLPDmem->mem_syn2, 0, M ); -#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { -#endif hLPDmem->q_mem_syn = Q15; move16(); -#ifdef HARMONIZE_2567_init_functions } -#endif } /* unquantized LPC*/ @@ -1890,7 +975,6 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Wor move16(); Copy( hLPDmem->mem_syn2, tmp_buf + 1, M ); deemph_fx( tmp_buf + 1, st->preemph_fac, M, &tmp ); -#ifdef HARMONIZE_2567_init_functions IF( EQ_16( st->element_mode, EVS_MONO ) ) { Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 1 ); @@ -1901,10 +985,6 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Wor Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 0 ); hLPDmem->mem_w0 = sub_sat( shl_sat( st->wspeech_enc[-1], sub( hLPDmem->q_mem_syn, sub( Q15, st->exp_buf_wspeech_enc ) ) ), tmp ); } -#else - Residu3_fx( Ap, tmp_buf + M, &tmp, 1, 0 ); - hLPDmem->mem_w0 = sub_sat( shl_sat( st->wspeech_enc[-1], sub( hLPDmem->q_mem_syn, sub( Q15, st->exp_buf_wspeech_enc ) ) ), tmp ); -#endif /*HARMONIZE_2567_init_functions*/ move16(); } } @@ -1923,15 +1003,11 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Wor move16(); set16_fx( hLPDmem->old_exc, 0, L_EXC_MEM ); move16(); -#ifdef HARMONIZE_2567_init_functions IF( GT_16( st->element_mode, EVS_MONO ) ) { -#endif hLPDmem->q_lpd_old_exc = Q15; move16(); -#ifdef HARMONIZE_2567_init_functions } -#endif /*Resamp others memories*/ /*Size of LPC syn memory*/ /* 1.25/20.0 = 1.0/16.0 -> shift 4 to the right. */ @@ -2019,28 +1095,20 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Wor { st->mem_bpf_fx.lp_error_ener = L_deposit_l( 0 ); move32(); -#ifdef HARMONIZE_2567_init_functions if ( GT_16( st->element_mode, EVS_MONO ) ) { -#endif st->pst_lp_ener_fx = 0; move16(); -#ifdef HARMONIZE_2567_init_functions } -#endif IF( EQ_16( st->last_codec_mode, MODE1 ) ) { st->mem_bpf_fx.lp_error = 0; move32(); -#ifdef HARMONIZE_2567_init_functions if ( GT_16( st->element_mode, EVS_MONO ) ) { -#endif st->pst_mem_deemp_err_fx = 0; move16(); -#ifdef HARMONIZE_2567_init_functions } -#endif } } @@ -2053,11 +1121,7 @@ static void init_acelp_ivas_fx( Encoder_State *st, Word16 L_frame_old, const Wor * *-----------------------------------------------------------------------*/ -#ifdef HARMONIZE_2567_init_functions static void init_modes_fx( -#else -static void init_modes_ivas_fx( -#endif Encoder_State *st, const Word32 last_total_brate ) { @@ -2105,13 +1169,11 @@ static void init_modes_ivas_fx( /* st->bits_frame_nominal = extract_h(L_add(L_mult(div_l(L_mult(shl(st->L_frame,2),st->bitrate),st->fscale),328),16056)); */ /* st->bits_frame_nominal = (int)( (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate/100.0f + 0.49f ); */ -#ifdef HARMONIZE_2567_init_functions if ( EQ_16( st->element_mode, EVS_MONO ) ) { assert( FSCALE_DENOM == 512 ); assert( st->fscale == 2 * st->L_frame ); /* this assumption is true if operated in 20ms frames with FSCALE_DENOM == 512, which is the current default */ } -#endif tmp32 = L_shl( st->total_brate, 1 ); /* (float)st->L_frame/(float)st->fscale * (float)FSCALE_DENOM/128.0f * (float)st->bitrate */ st->bits_frame_nominal = extract_l( L_shr( Mpy_32_16_1( tmp32, 20972 ), 6 ) ); /* 20972 = 0.01 * 64 * 32768 */ move16(); @@ -2158,28 +1220,22 @@ static void init_modes_ivas_fx( } } -#ifdef HARMONIZE_2567_init_functions test(); if ( EQ_16( (Word16) n, FRAME_SIZE_NB ) && ( EQ_16( st->element_mode, EVS_MONO ) ) ) { assert( !"Bitrate not supported: not part of EVS" ); } -#endif } /* Reconfigure core */ -#ifdef HARMONIZE_2567_init_functions if ( EQ_16( st->element_mode, EVS_MONO ) ) { core_coder_reconfig_fx( st, last_total_brate ); } ELSE { -#endif core_coder_reconfig_ivas_fx( st, last_total_brate ); -#ifdef HARMONIZE_2567_init_functions } -#endif return; diff --git a/lib_enc/core_enc_ol_fx.c b/lib_enc/core_enc_ol_fx.c index d7bba0701a27937d5b6978830091a0f046e835fa..173e9aaafdf3e389e0f147d5f82bb4356dc407df 100644 --- a/lib_enc/core_enc_ol_fx.c +++ b/lib_enc/core_enc_ol_fx.c @@ -523,11 +523,7 @@ void core_encode_openloop_fx( * Generate Bitstream *---------------------------------------------------------------*/ -#ifdef HAMRONIZE_2606_ENC_PRM enc_prm_fx( st, param_core, param_lpc, &hm_cfg, bits_param_lpc, no_param_lpc ); -#else - enc_prm_fx( coder_type, param_core, param_lpc, st, st->L_frame, &hm_cfg, bits_param_lpc, no_param_lpc ); -#endif /* Channel-aware mode - encode partial copy */ IF( EQ_16( st->rf_mode, 1 ) ) diff --git a/lib_enc/core_enc_switch_fx.c b/lib_enc/core_enc_switch_fx.c index cd6818e3c1bec1151e21622a336ef828b448de21..dee4322611269916993eaa1fcb5bb858435fa4b1 100644 --- a/lib_enc/core_enc_switch_fx.c +++ b/lib_enc/core_enc_switch_fx.c @@ -157,11 +157,7 @@ void core_coder_mode_switch_fx( { st->igf = getIgfPresent_fx( st->element_mode, st->total_brate, st->bwidth, st->rf_mode ); move16(); -#ifdef HARMONIZE_2567_init_functions init_coder_ace_plus_fx( st, last_total_bitrate, st->total_brate, shift, MCT_flag ); -#else - init_coder_ace_plus_fx( st, last_total_bitrate, shift, MCT_flag ); -#endif } test(); @@ -391,11 +387,7 @@ void core_coder_mode_switch_ivas_fx( st->currEnergyHF_e_fx = 0; move16(); -#ifdef HARMONIZE_2567_init_functions init_coder_ace_plus_fx( st, last_total_brate, st->total_brate, 0, MCT_flag ); -#else - init_coder_ace_plus_ivas_fx( st, last_total_brate, st->total_brate, MCT_flag ); -#endif } test(); diff --git a/lib_enc/enc_prm_fx.c b/lib_enc/enc_prm_fx.c index 4a9f5ee23d0e70f6ad67a13e712bd40141ef8a42..32735488606d5d0d5519884719c2d55d0d577598 100644 --- a/lib_enc/enc_prm_fx.c +++ b/lib_enc/enc_prm_fx.c @@ -239,7 +239,6 @@ void enc_prm_rf_fx( * the FAC parameters when transition occurs. * *-----------------------------------------------------------------*/ -#ifdef HAMRONIZE_2606_ENC_PRM void enc_prm_fx( Encoder_State *st, /* i/o : quantization Analysis values */ Word16 param[], /* (i) : parameters Q0*/ @@ -458,685 +457,6 @@ void enc_prm_fx( return; } -#else -void enc_prm_fx( - const Word16 coder_type, /* (i) : coding type */ - Word16 param[], /* (i) : parameters Q0*/ - const Word16 param_lpc[], /* (i) : LPC parameters Q0*/ - Encoder_State *st, /* i/o : quantization Analysis values */ - const Word16 L_frame, /* Q0 */ - CONTEXT_HM_CONFIG hm_cfg[], - Word16 *bits_param_lpc, /* Q0 */ - const Word16 no_param_lpc /* Q0 */ -) -{ - Word16 j, k, n, sfr, core, last_core, *prm, tmp; - Word16 nbits_start, total_nbbits; - Word16 nbits_header; - Word16 nbits_lpc; - Word16 nbits_tcx; - Word16 lg, nb_subfr; - Word16 lgFB; - Word16 nTnsParams; - Word16 nTnsBits; - Word16 ix, j_old, wordcnt, bitcnt; - Word16 hm_size; - Word16 numlpc; - Word8 flag_ctx_hm; - Word16 index; - Word32 tmp32; - CONTEXT_HM_CONFIG *phm_cfg; - Word16 idx; - Word16 start_idx; - Word16 nBits; - TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc; - BSTR_ENC_HANDLE hBstr = st->hBstr; - - /*--------------------------------------------------------------------------------* - * INIT - *--------------------------------------------------------------------------------*/ - - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); - nbits_lpc = 0; - nbits_tcx = 0; - - flag_ctx_hm = 0; - - /* Useful parameters */ - move16(); - move16(); - move16(); - nb_subfr = st->nb_subfr; - core = st->core; - last_core = st->last_core; - - /* Initialize pointers */ - move16(); - prm = param; - - /* Init counters */ - move16(); - move16(); - j = 0; - nbits_start = hBstr->nb_bits_tot; /* Q0 */ - - - /*--------------------------------------------------------------------------------* - * HEADER - *--------------------------------------------------------------------------------*/ - - IF( EQ_16( st->mdct_sw, MODE1 ) ) - { - /* Adjust st->bits_frame_core not to subtract MODE2 bandwidth signaling */ - st->bits_frame_core = add( st->bits_frame_core, FrameSizeConfig[st->frame_size_index].bandwidth_bits ); /* Q0 */ - - /* Write MODE1 core mode signaling */ - signalling_mode1_tcx20_enc_fx( st, 1 ); - } - - /* Modes (ACE_GC, ACE_UC, TCX20, TCX10...) */ - - IF( st->tcxonly ) - { - push_next_indice( hBstr, core == TCX_10_CORE, 1 ); - { - index = 3; - move16(); - test(); - IF( EQ_16( st->clas, UNVOICED_CLAS ) ) - { - index = 0; - move16(); - } - ELSE IF( ( EQ_16( st->clas, VOICED_TRANSITION ) ) || ( EQ_16( st->clas, UNVOICED_TRANSITION ) ) ) - { - index = 1; - move16(); - } - ELSE IF( EQ_16( st->clas, VOICED_CLAS ) ) - { - index = 2; - move16(); - } - push_next_indice( hBstr, index, 2 ); - } - } - ELSE - { - IF( core == ACELP_CORE ) - { - /* write the RF signalling information */ - IF( EQ_16( st->rf_mode, 1 ) ) - { - /* find the section in the ACELP signalling table corresponding to bitrate */ - idx = 0; - WHILE( NE_32( acelp_sig_tbl[idx], st->total_brate ) ) /* total bitrate is kept at 13.2kbps */ - { - idx = add( idx, 1 ); - } - - /* retrieve the number of bits for signalling */ - nBits = (Word16) acelp_sig_tbl[++idx]; /* Q0 */ - - /* retrieve the signalling index */ - idx = add( idx, 1 ); /* Q0 */ - start_idx = idx; /* Q0 */ - tmp32 = SIG2IND_fx( coder_type, st->bwidth, st->sharpFlag, st->rf_mode ); - WHILE( NE_32( acelp_sig_tbl[idx], tmp32 ) ) - { - idx = add( idx, 1 ); /* Q0 */ - } - push_next_indice( hBstr, idx - start_idx, nBits ); - push_next_indice( hBstr, 0, 1 ); /* Indicate to the decoder that the core is ACELP*/ - nbits_start = 3; /* Q0 */ - } - ELSE - { - push_next_indice( hBstr, coder_type, 3 ); - } - } - ELSE - { - IF( EQ_16( st->mdct_sw, MODE1 ) ) - { - /* 2 bits instead of 3 as TCX is already signaled */ - push_next_indice( hBstr, st->hTcxCfg->coder_type, 2 ); - } - ELSE - { - IF( EQ_16( st->mdct_sw_enable, MODE2 ) ) - { - push_next_indice( hBstr, 1, 1 ); /* TCX */ - push_next_indice( hBstr, 0, 1 ); /* not HQ_CORE */ - push_next_indice( hBstr, st->hTcxCfg->coder_type, 2 ); - } - ELSE - { - /*write the RF signalling information*/ - IF( EQ_16( st->rf_mode, 1 ) ) - { - /* find the section in the ACELP signalling table corresponding to bitrate */ - idx = 0; - WHILE( NE_32( acelp_sig_tbl[idx], st->total_brate ) ) - { - idx = add( idx, 1 ); - } - - /* retrieve the number of bits for signalling */ - nBits = (Word16) acelp_sig_tbl[++idx]; /* Q0 */ - - test(); - test(); - IF( EQ_16( st->hTcxCfg->coder_type, VOICED ) || - EQ_16( st->hTcxCfg->coder_type, GENERIC ) || - EQ_16( st->hTcxCfg->coder_type, TRANSITION ) ) - { - st->sharpFlag = 1; - } - ELSE - { - st->sharpFlag = 0; - } - - /* retrieve the signalling index */ - idx = add( idx, 1 ); /* Q0 */ - start_idx = idx; /* Q0 */ - tmp32 = SIG2IND_fx( st->hTcxCfg->coder_type, st->bwidth, st->sharpFlag, st->rf_mode ); - WHILE( NE_32( acelp_sig_tbl[idx], tmp32 ) ) - { - idx = add( idx, 1 ); - } - push_next_indice( hBstr, idx - start_idx, nBits ); - push_next_indice( hBstr, 1, 1 ); /* Indicate to the decoder that the core is TCX*/ - nbits_start = 3; - } - ELSE - { - push_next_indice( hBstr, 4 + st->hTcxCfg->coder_type, 3 ); - } - } - } - } - } - - /* Encode previous mode for error concealment */ - test(); - IF( !( core == ACELP_CORE && st->hTcxCfg->lfacNext <= 0 ) ) - { - tmp = 0; - move16(); - test(); - IF( NE_16( last_core, ACELP_CORE ) || EQ_16( core, TCX_10_CORE ) ) - - { - tmp = TCX_20_CORE; - move16(); - } - push_next_indice( hBstr, tmp, 1 ); - } - - /* write TCX overlap mode (1 bit: full, 2 bits: half or no overlap) */ - IF( core != ACELP_CORE ) - { - Word16 overlap_code; - assert( st->hTcxCfg->tcx_curr_overlap_mode != NOT_SUPPORTED && st->hTcxCfg->tcx_curr_overlap_mode <= ALDO_WINDOW && st->hTcxCfg->tcx_curr_overlap_mode >= FULL_OVERLAP ); /*1 is not allowed!*/ - IF( EQ_16( st->hTcxCfg->tcx_curr_overlap_mode, MIN_OVERLAP ) ) - { - nbits_tcx = 2; - move16(); - overlap_code = 2; - move16(); - } - ELSE IF( EQ_16( st->hTcxCfg->tcx_curr_overlap_mode, HALF_OVERLAP ) ) - { - nbits_tcx = 2; - move16(); - overlap_code = 3; - move16(); - } - ELSE - { - nbits_tcx = 1; - move16(); - overlap_code = 0; - move16(); - } - push_next_indice( hBstr, overlap_code, nbits_tcx ); - } - - IF( st->hPlcExt->enableGplc ) - { - /* encode side information. */ - enc_prm_side_Info_fx( st->hPlcExt, st ); - } - - IF( st->glr != 0 ) - { - test(); - test(); - test(); - test(); - if ( core != ACELP_CORE || EQ_16( coder_type, INACTIVE ) || ( st->last_core == ACELP_CORE && EQ_16( st->last_coder_type_raw, INACTIVE ) ) || st->glr_reset != 0 ) - { - st->glr_idx[0] = 0; - move16(); - } - - IF( EQ_16( core, ACELP_CORE ) ) - { - push_next_indice( hBstr, st->glr_idx[0], G_LPC_RECOVERY_BITS ); - } - } - - st->glr_reset = 0; - move16(); - - nbits_header = sub( hBstr->nb_bits_tot, nbits_start ); /* Q0 */ - - - /*--------------------------------------------------------------------------------* - * LPC PARAMETERS - *--------------------------------------------------------------------------------*/ - - IF( s_and( st->enableTcxLpc != 0, core != ACELP_CORE ) ) - { - /* Encode the indices */ - nbits_lpc = enc_lsf_tcxlpc_fx( ¶m_lpc, hBstr ); /* Q0 */ - } - ELSE - { - IF( st->lpcQuantization == 0 ) - { - /* LPC quantizer */ - numlpc = 2; - move16(); - if ( EQ_16( core, TCX_20_CORE ) ) - { - numlpc = 1; - move16(); - } - - nbits_lpc = encode_lpc_avq_fx( hBstr, numlpc, param_lpc, st->core, st->element_mode ); /* Q0 */ - } - ELSE IF( EQ_16( st->lpcQuantization, 1 ) ) - { - test(); - test(); - IF( EQ_32( st->sr_core, 16000 ) && EQ_16( coder_type, VOICED ) && EQ_16( core, ACELP_CORE ) ) - { - nbits_lpc = lsf_bctcvq_encprm_fx( hBstr, param_lpc, bits_param_lpc, no_param_lpc ); /* Q0 */ - } - ELSE - { - nbits_lpc = lsf_msvq_ma_encprm_fx( hBstr, param_lpc, core, coder_type, st->acelp_cfg.midLpc, bits_param_lpc, no_param_lpc ); /* Q0 */ - } - } - ELSE - { - assert( 0 && "LPC quant not supported!" ); - } - } - - - /*--------------------------------------------------------------------------------* - * PRINT BIT ALLOCATION - *--------------------------------------------------------------------------------*/ - - - /*--------------------------------------------------------------------------------* - * ACELP - *--------------------------------------------------------------------------------*/ - - IF( core == ACELP_CORE ) - { - /* Adaptive BPF (2 bits)*/ - n = ACELP_BPF_BITS[st->acelp_cfg.bpf_mode]; - - IF( n != 0 ) - { - push_next_indice( hBstr, st->bpf_gain_param, n ); - } - - /* Mean energy (2 or 3 bits) */ - n = ACELP_NRG_BITS[st->acelp_cfg.nrg_mode]; /* Q0 */ - - IF( n != 0 ) - { - push_next_indice( hBstr, prm[j++], n ); - } - - /* Subframe parameters */ - - FOR( sfr = 0; sfr < nb_subfr; sfr++ ) - { - /* Pitch lag (4, 5, 6, 8 or 9 bits) */ - move16(); - n = ACELP_LTP_BITS_SFR[st->acelp_cfg.ltp_mode][sfr]; /* Q0 */ - - IF( n != 0 ) - { - push_next_indice( hBstr, prm[j++], n ); - } - - /* Adaptive codebook filtering (1 bit) */ - - IF( EQ_16( st->acelp_cfg.ltf_mode, 2 ) ) - { - push_next_indice( hBstr, prm[j++], 1 ); - } - - /*Innovative codebook*/ - { - move16(); - j_old = j; - - if ( ( st->acelp_cfg.fixed_cdk_index[sfr] >= ACELP_FIXED_CDK_NB ) || ( st->acelp_cfg.fixed_cdk_index[sfr] < 0 ) ) - { - fprintf( stderr, "ACELP bits allocation: wrong fixed cdk bit allocation\n" ); - assert( 0 ); - } - - - wordcnt = shr( ACELP_FIXED_CDK_BITS( st->acelp_cfg.fixed_cdk_index[sfr] ), 4 ); - - bitcnt = s_and( ACELP_FIXED_CDK_BITS( st->acelp_cfg.fixed_cdk_index[sfr] ), 15 ); - - - FOR( ix = 0; ix < wordcnt; ix++ ) - { - push_next_indice( hBstr, prm[j++], 16 ); - } - - IF( bitcnt ) - { - push_next_indice( hBstr, prm[j++], bitcnt ); - } - - j = add( j_old, 8 ); /* Q0 */ - } - - /* Gains (5b, 6b or 7b / subfr) */ - n = ACELP_GAINS_BITS[st->acelp_cfg.gains_mode[sfr]]; - push_next_indice( hBstr, prm[j++], n ); - } /*end of for(sfr)*/ - } /*end of mode[0]==0*/ - - - /*--------------------------------------------------------------------------------* - * TCX20 - *--------------------------------------------------------------------------------*/ - IF( s_or( (Word16) EQ_16( core, TCX_20_CORE ), (Word16) EQ_16( core, HQ_CORE ) ) ) - { - flag_ctx_hm = 0; - move16(); - IF( st->enablePlcWaveadjust ) - { - push_next_indice( hBstr, st->Tonal_SideInfo, 1 ); - } - - /* TCX Gain = 7 bits */ - push_next_indice( hBstr, prm[j++], 7 ); - - /* TCX Noise Filling = NBITS_NOISE_FILL_LEVEL bits */ - push_next_indice( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); - - /* LTP data */ - test(); - IF( hTcxEnc->tcxltp || GT_32( st->sr_core, 25600 ) ) - { - IF( prm[j] ) - { - push_next_indice( hBstr, 1, 1 ); - push_next_indice( hBstr, prm[j + 1], 9 ); - push_next_indice( hBstr, prm[j + 2], 2 ); - } - ELSE - { - push_next_indice( hBstr, 0, 1 ); - } - } - j = add( j, 3 ); - - /* TCX spectral data */ - lg = L_frame; /* Q0 */ - move16(); - lgFB = st->hTcxCfg->tcx_coded_lines; /* Q0 */ - move16(); - - IF( last_core == ACELP_CORE ) - { - /* ACE->TCX transition */ - lg = add( lg, st->hTcxCfg->tcx_offset ); - lgFB = add( lgFB, shr( lgFB, 2 ) ); - if ( st->hTcxCfg->lfacNext < 0 ) - { - lg = sub( lg, st->hTcxCfg->lfacNext ); /* Q0 */ - } - } - - /* TNS data */ - nTnsParams = 0; - move16(); - nTnsBits = 0; - move16(); - - IF( st->hTcxCfg->fIsTNSAllowed ) - { - WriteTnsData_fx( st->hTcxCfg->pCurrentTnsConfig, prm + j, &nTnsParams, st->hBstr, &nTnsBits ); - - j = add( j, nTnsParams ); /* Q0 */ - } - - hm_size = shl( mult( st->hTcxCfg->bandwidth, lg ), 1 ); - test(); - IF( hTcxEnc->tcx_lpc_shaped_ari && NE_16( last_core, ACELP_CORE ) ) - { - enc_prm_hm_fx( &prm[j], st, hm_size ); - } - - /*Context HM flag*/ - test(); - IF( st->hTcxCfg->ctx_hm && NE_16( last_core, ACELP_CORE ) ) - { - push_next_indice( hBstr, prm[j], 1 ); - - IF( prm[j] ) - { - EncodeIndex_fx( sub( hm_size, 256 ) >= 0, prm[j + 1], hBstr ); - flag_ctx_hm = 1; - move16(); - } - } - j = add( j, NPRM_CTX_HM ); - - IF( st->igf ) - { - st->hIGFEnc->infoTotalBitsPerFrameWritten = 0; - move16(); - IF( EQ_16( st->last_core, ACELP_CORE ) ) - { - IGFEncWriteBitstream_fx( st->hIGFEnc, hBstr, &st->hIGFEnc->infoTotalBitsPerFrameWritten, IGF_GRID_LB_TRAN, 1, st->element_mode ); - } - ELSE - { - IGFEncWriteBitstream_fx( st->hIGFEnc, hBstr, &st->hIGFEnc->infoTotalBitsPerFrameWritten, IGF_GRID_LB_NORM, 1, st->element_mode ); - } - } - total_nbbits = sub( hBstr->nb_bits_tot, nbits_start ); /* Q0 */ - if ( EQ_16( st->rf_mode, 1 ) ) - { - total_nbbits = add( total_nbbits, st->rf_target_bits_write ); /* Q0 */ - } - nbits_tcx = sub( st->bits_frame_core, total_nbbits ); /* Q0 */ - - IF( hTcxEnc->tcx_lpc_shaped_ari != 0 ) - { - push_next_bits( hBstr, (UWord16 *) &prm[++j], nbits_tcx ); - j = add( j, nbits_tcx ); /* Q0 */ - } - ELSE - { - phm_cfg = NULL; - move16(); - if ( flag_ctx_hm ) - { - phm_cfg = hm_cfg; - move16(); - } - ACcontextMapping_encode2_no_mem_s17_LC_fx( hBstr, prm + j, - lgFB, - prm[j - 1], /* lastnz */ - nbits_tcx, NPRM_RESQ * st->hTcxCfg->resq, phm_cfg ); - } - } - - - /*--------------------------------------------------------------------------------* - * TCX10 - *--------------------------------------------------------------------------------*/ - - - IF( EQ_16( core, TCX_10_CORE ) ) - { - Word16 nbits_igf = 0; - move16(); - IF( st->igf ) - { - nbits_igf = IGFEncWriteConcatenatedBitstream_fx( st->hIGFEnc, hBstr ); /* Q0 */ - } - FOR( k = 0; k < 2; k++ ) - { - flag_ctx_hm = 0; - move16(); - - move16(); - move16(); - prm = param + ( k * NPRM_DIV ); - - j = 0; - - move16(); - nbits_tcx = total_nbbits = sub( hBstr->nb_bits_tot, nbits_start ); /* Q0 */ - - test(); - IF( st->enablePlcWaveadjust && k ) - { - push_next_indice( hBstr, st->Tonal_SideInfo, 1 ); - } - - /* TCX Gain = 7 bits */ - push_next_indice( hBstr, prm[j++], 7 ); - - /* TCX Noise Filling = NBITS_NOISE_FILL_LEVEL bits */ - push_next_indice( hBstr, prm[j++], NBITS_NOISE_FILL_LEVEL ); - - /* LTP data */ - test(); - test(); - IF( ( k == 0 ) && ( hTcxEnc->tcxltp != 0 || GT_32( st->sr_core, 25600 ) ) ) /* PLC pitch info for HB */ - { - IF( prm[j] ) - { - push_next_indice( hBstr, 1, 1 ); - push_next_indice( hBstr, prm[j + 1], 9 ); - push_next_indice( hBstr, prm[j + 2], 2 ); - } - ELSE - { - push_next_indice( hBstr, 0, 1 ); - } - } - j = add( j, 3 ); - - /* TCX spectral data */ - lg = shr( L_frame, 1 ); - lgFB = shr( st->hTcxCfg->tcx_coded_lines, 1 ); - - IF( s_and( k == 0, last_core == ACELP_CORE ) ) - { - /* ACE->TCX transition */ - lg = add( lg, st->hTcxCfg->tcx_offset ); /* Q0 */ - lgFB = add( lgFB, shr( lgFB, 1 ) ); - if ( st->hTcxCfg->lfacNext < 0 ) - { - lg = sub( lg, st->hTcxCfg->lfacNext ); /* Q0 */ - } - } - - /* TNS data */ - move16(); - move16(); - nTnsParams = 0; - nTnsBits = 0; - - IF( st->hTcxCfg->fIsTNSAllowed ) - { - - SetTnsConfig( st->hTcxCfg, 0, ( last_core == ACELP_CORE ) && ( k == 0 ) ); - WriteTnsData_fx( st->hTcxCfg->pCurrentTnsConfig, prm + j, &nTnsParams, st->hBstr, &nTnsBits ); - - - j = add( j, nTnsParams ); - } - - hm_size = shl( mult( st->hTcxCfg->bandwidth, lgFB ), 1 ); - - /*Context HM flag*/ - test(); - test(); - IF( st->hTcxCfg->ctx_hm && !( last_core == ACELP_CORE && k == 0 ) ) - { - push_next_indice( hBstr, prm[j], 1 ); - - IF( prm[j] ) - { - EncodeIndex_fx( sub( hm_size, 256 ) >= 0, prm[j + 1], hBstr ); - flag_ctx_hm = 1; - move16(); - } - } - j = add( j, NPRM_CTX_HM ); - - total_nbbits = sub( hBstr->nb_bits_tot, nbits_start ); /* Q0 */ - - nbits_tcx = sub( shr( sub( add( sub( sub( sub( st->bits_frame_core, nbits_header ), nbits_lpc ), nbits_igf ), 1 ), k ), 1 ), sub( total_nbbits, nbits_tcx ) ); /* Q0 */ - - phm_cfg = NULL; - move16(); - if ( flag_ctx_hm ) - { - phm_cfg = &hm_cfg[k]; - move16(); - } - ACcontextMapping_encode2_no_mem_s17_LC_fx( hBstr, prm + j, - lgFB, - prm[j - 1], /* lastnz */ - nbits_tcx, NPRM_RESQ * st->hTcxCfg->resq, phm_cfg ); - - } /* k, window index */ - } - - /*--------------------------------------------------------------------------------* - * END - *--------------------------------------------------------------------------------*/ - - total_nbbits = sub( hBstr->nb_bits_tot, nbits_start ); /* Q0 */ - - /* Check if total encoded bits does not exceed CBR target bits (->this must never happen) */ - if ( st->bits_frame_core && ( total_nbbits > st->bits_frame_core ) ) - { - fprintf( stderr, "AllocatedBits: %d Used bits: %d \n", st->bits_frame_core, total_nbbits ); - assert( !"Core totalbits > CBR target bitrate" ); - } - - return; -} -#endif /*-------------------------------------------------------------------* * writeLPCparam_fx() diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index 8f2419ee4e60f087d4faa40c78e2e8d27241fbdc..ac865493ee486a293b2c6c901494599e4049ab7b 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -1130,11 +1130,7 @@ ivas_error init_encoder_fx( IF( st->element_mode == EVS_MONO ) { -#ifdef HARMONIZE_2567_init_functions init_coder_ace_plus_fx( st, st->last_total_brate, igf_brate, 0, 0 ); -#else - init_coder_ace_plus_fx( st, st->last_total_brate, 0, -10 /*hack*/ ); -#endif } ELSE { @@ -1149,11 +1145,7 @@ ivas_error init_encoder_fx( move16(); -#ifdef HARMONIZE_2567_init_functions init_coder_ace_plus_fx( st, st->last_total_brate, igf_brate, 0, 0 ); -#else - init_coder_ace_plus_ivas_fx( st, st->last_total_brate, igf_brate, 0 ); -#endif } diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 016e6adfe607156c510afdd0bf3e7dfc73b464c3..3bcad237f8d85a83a66be47fca6f22041b05ea08 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -1393,11 +1393,7 @@ void pre_proc_front_ivas_fx( test(); IF( EQ_32( ivas_format, SBA_FORMAT ) && st->core_brate != FRAME_NO_DATA && st->last_core_brate == FRAME_NO_DATA && st->sba_br_sw_while_no_data ) { -#ifdef HARMONIZE_2596_SetModeIndex SetModeIndex_fx( st, L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ), element_mode, MCT_flag, 0 ); -#else - SetModeIndex_ivas_fx( st, L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ), element_mode, MCT_flag ); -#endif st->sba_br_sw_while_no_data = 0; move16(); diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 28ef7d7d6faff4b10a81d6b80e9b6372d10c9e2c..324f0d552e8b1bbad8092e3be637b7e76ea64d62 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -343,11 +343,7 @@ void pre_proc_ivas_fx( st->total_brate = L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ); /* Q0 */ move32(); -#ifdef HARMONIZE_2596_SetModeIndex SetModeIndex_fx( st, imult3216( st->last_bits_frame_nominal, FRAMES_PER_SEC ), last_element_mode, MCT_flag, 0 ); -#else - SetModeIndex_ivas_fx( st, imult3216( st->last_bits_frame_nominal, FRAMES_PER_SEC ), last_element_mode, MCT_flag ); -#endif st->sr_core = getCoreSamplerateMode2( element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format ); /* Q0 */ move16(); @@ -408,11 +404,7 @@ void pre_proc_ivas_fx( IF( NE_32( st->core_brate, FRAME_NO_DATA ) ) { -#ifdef HARMONIZE_2596_SetModeIndex SetModeIndex_fx( st, L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ), element_mode, MCT_flag, 0 ); -#else - SetModeIndex_ivas_fx( st, L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ), element_mode, MCT_flag ); -#endif } test(); diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index 18210878e7ba614564e89d054e16261ea51a586b..5b58af8b43953f73a515a0efdf65574a6d6556aa 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -2105,11 +2105,7 @@ void ivas_mdct_core_whitening_enc_fx( move16(); /* Shape spectrum */ -#ifdef HARMONIZE_2597_ShapeSpectrum ShapeSpectrum_fx( st->hTcxCfg, A_q_fx[ch][n], NULL, NULL, L_subframe, tcx_subframe_coded_lines, st->hTcxEnc->spectrum_fx[n], &st->hTcxEnc->spectrum_e[n], st->hTcxEnc->fUseTns[n], st, scf_q_fx[ch][n] ); -#else - ShapeSpectrum_ivas_fx( st->hTcxCfg, A_q_fx[ch][n], NULL, NULL, L_subframe, tcx_subframe_coded_lines, st->hTcxEnc->spectrum_fx[n], &st->hTcxEnc->spectrum_e[n], st->hTcxEnc->fUseTns[n], st, scf_q_fx[ch][n] ); -#endif Scale_sig32( st->hTcxEnc->spectrum_fx[n] + L_subframe, sub( L_subframeTCX, L_subframe ), sub( exp_tmp, st->hTcxEnc->spectrum_e[n] ) ); } @@ -2249,11 +2245,7 @@ void ivas_mdct_core_whitening_enc_fx( move16(); /* Shape spectrum */ -#ifdef HARMONIZE_2597_ShapeSpectrum ShapeSpectrum_fx( st->hTcxCfg, A_q_fx[ch][n], NULL, NULL, L_subframe, tcx_subframe_coded_lines, mdst_spectrum_fx[ch][n], &mdst_spectrum_e[ch][n], st->hTcxEnc->fUseTns[n], st, scf_q_fx[ch][n] ); -#else - ShapeSpectrum_ivas_fx( st->hTcxCfg, A_q_fx[ch][n], NULL, NULL, L_subframe, tcx_subframe_coded_lines, mdst_spectrum_fx[ch][n], &mdst_spectrum_e[ch][n], st->hTcxEnc->fUseTns[n], st, scf_q_fx[ch][n] ); -#endif Scale_sig32( mdst_spectrum_fx[ch][n] + L_subframe, sub( L_subframeTCX, L_subframe ), sub( exp_tmp, mdst_spectrum_e[ch][n] ) ); } diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index 6940f073f0bf632d465649fa266b740a2ada43fb..f6fb654035f23bb784091859e8107ff2e4b5c6d2 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -1330,11 +1330,7 @@ static void estDownmixGain_fx( exp = 0; move16(); } -#ifdef FIX_BASOP_2599_TCA_OVERFLOW unclr_instTargetGain = BASOP_Util_Log10( L_add_sat( unclr_instTargetGain, L_shr( MAX_32, sub( Q31, exp ) ) ), exp ); -#else - unclr_instTargetGain = BASOP_Util_Log10( L_add( unclr_instTargetGain, L_shr( MAX_32, sub( Q31, exp ) ) ), exp ); -#endif // unclr_fv_fx is expected in Q15 - log result will be in Q25 - hence rightshift by 10. hStereoClassif->unclr_fv_fx[E_ica_instTargetGain] = L_shr( unclr_instTargetGain, Q10 ); /* Q15 */ move32(); diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index 0522658cb8cb029444907481f5fd816fd5efd8d6..9a49390bf3658176a7b2861c0444a0596903fbc9 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -503,11 +503,7 @@ void stereo_tcx_core_enc( bitsAvailable = sub( bitsAvailable, nbits_lpc[n] ); /* Shape spectrum */ -#ifdef HARMONIZE_2597_ShapeSpectrum ShapeSpectrum_fx( st->hTcxCfg, A_q_fx, gainlpc_fx[n], gainlpc_e[n], st->L_frame / n_subframes, st->hTcxCfg->tcx_coded_lines / n_subframes, hTcxEnc->spectrum_fx[n], &hTcxEnc->spectrum_e[n], hTcxEnc->fUseTns[n], st, NULL ); -#else - ShapeSpectrum_ivas_fx( st->hTcxCfg, A_q_fx, gainlpc_fx[n], gainlpc_e[n], st->L_frame / n_subframes, st->hTcxCfg->tcx_coded_lines / n_subframes, hTcxEnc->spectrum_fx[n], &hTcxEnc->spectrum_e[n], hTcxEnc->fUseTns[n], st, NULL ); -#endif st->last_core = st->core; move16(); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 7dc28e4964ad3459d30340be8ee3ed45e6f513e1..6137b71dbd10b19f6a4e0300a304a568e0218e37 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -1866,28 +1866,7 @@ Word16 ACcontextMapping_encode2_estimate_no_mem_s17_LC_fx( Word16 *stop, /* Q0 */ CONTEXT_HM_CONFIG *hm_cfg ); -#ifndef HARMONIZE_2598_tcx_arith_encode_envelope -void tcx_arith_encode_envelope_fx( - Word32 spectrum[], /* i/o: MDCT coefficients Q31-e */ - Word16 *spectrum_e, /* i/o: MDCT exponent Q0 */ - Word16 signs[], /* o : signs (spectrum[.]<0) Q0 */ - const Word16 L_frame, /* i : frame or MDCT length Q0 */ - const Word16 L_spec, /* i : frame or MDCT length Q0 */ - Encoder_State *st, /* i/o: coder state */ - const Word16 A_ind[], /* i : quantised LPC coefficients Q12 */ - Word16 target_bits, /* i : number of available bits Q0 */ - Word16 prm[], /* o : bitstream parameters Q0 */ - const Word8 use_hm, /* i : use HM in current frame? */ - Word16 prm_hm[], /* o : HM parameter area Q0 */ - const Word16 tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a Q0*/ - Word16 *arith_bits, /* o : bits used for ari. coding Q0 */ - Word16 *signaling_bits, /* o : bits used for signaling Q0 */ - Word16 *nf_seed, /* o : noise filling seed Q0 */ - const Word16 low_complexity /* i : low-complexity flag Q0 */ -); -#endif -#ifdef HARMONIZE_2598_tcx_arith_encode_envelope void tcx_arith_encode_envelope_fx( Word32 spectrum[], /* i/o: MDCT coefficients Q31-e */ Word16 *spectrum_e, /* i/o: MDCT exponent Q0 */ @@ -1906,25 +1885,6 @@ void tcx_arith_encode_envelope_fx( Word16 *nf_seed, /* o : noise filling seed, may be NULL Q0 */ const Word16 low_complexity /* i : low-complexity flag Q0 */ ); -#else -void tcx_arith_encode_envelope_ivas_fx( - Word32 spectrum[], /* i/o: MDCT coefficients Q31-e */ - Word16 *spectrum_e, /* i/o: MDCT exponent Q0 */ - Word16 signs[], /* o : signs (spectrum[.]<0) Q0 */ - const Word16 L_frame, /* i : frame or MDCT length Q0 */ - const Word16 L_spec, /* i : frame or MDCT length Q0 */ - Encoder_State *st, /* i/o: coder state */ - const Word16 A_ind[], /* i : quantised LPC coefficients Q12 */ - Word16 target_bits, /* i : number of available bits Q0 */ - Word16 prm[], /* o : bitstream parameters Q0 */ - const Word8 use_hm, /* i : use HM in current frame? */ - Word16 prm_hm[], /* o : HM parameter area Q0 */ - const Word16 tcxltp_pitch, /* i : TCX LTP pitch in FD, -1 if n/a Q0*/ - Word16 *arith_bits, /* o : bits used for ari. coding Q0 */ - Word16 *signaling_bits, /* o : bits used for signaling Q0 */ - const Word16 low_complexity /* i : low-complexity flag Q0 */ -); -#endif void QuantizeGain( Word16 n, @@ -1970,24 +1930,8 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word16 *Q_new, Word16 *q_win ); -#ifndef HARMONIZE_2597_ShapeSpectrum -void ShapeSpectrum_fx( - TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ - Word16 A[], /* i : quantized coefficients NxAz_q[M+1] */ - Word16 gainlpc[], /* o : MDCT gains for the previous frame */ - Word16 gainlpc_e[], /* o : MDCT gains exponents */ - Word16 L_frame_glob, /* i : frame length */ - Word16 L_spec, - Word32 spectrum[], /* i/o: MDCT spectrum */ - Word8 pfUseTns, /* o : Flag indicating if TNS is used */ - Encoder_State *st ); -#endif -#ifdef HARMONIZE_2597_ShapeSpectrum void ShapeSpectrum_fx( -#else -void ShapeSpectrum_ivas_fx( -#endif TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */ Word16 A[], /* input: quantized coefficients NxAz_q[M+1], Q = 14 - norm(A[0]) */ Word16 gainlpc[], /* output: MDCT gains for the previous frame Q(15-gainlpc_e)*/ @@ -2073,7 +2017,6 @@ void coder_tcx_post_ivas_fx( Word16 *wsig, Word16 Q_new ); -#ifdef HAMRONIZE_2606_ENC_PRM void enc_prm_fx( Encoder_State *st, /* i/o : quantization Analysis values */ Word16 param[], /* (i) : parameters Q0*/ @@ -2082,17 +2025,6 @@ void enc_prm_fx( Word16 *bits_param_lpc, /* Q0 */ const Word16 no_param_lpc /* Q0 */ ); -#else -void enc_prm_fx( - const Word16 coder_type, /* i : coding type */ - Word16 param[], /* i : parameters */ - const Word16 param_lpc[], /* i : LPC parameters */ - Encoder_State *st, /* i/o: quantization Analysis values */ - const Word16 L_Frame, - CONTEXT_HM_CONFIG hm_cfg[], - Word16 *bits_param_lpc, - const Word16 no_param_lpc ); -#endif void IGFEncSetMode_fx( const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i/o: instance handle of IGF Encoder */ @@ -2266,14 +2198,6 @@ void tcx_ltp_encode_ivas_fx( const Word16 disable_ltp, const Word16 element_mode ); -#ifndef HARMONIZE_2567_init_functions -void init_coder_ace_plus_fx( - Encoder_State *st, - const Word32 last_total_brate, /* i : last total bitrate */ - const Word16 shift, - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */ -); -#endif void enc_prm_rf_fx( Encoder_State *st, @@ -2685,14 +2609,6 @@ void spec_flatness_fx( Word16 sSFM[SFM_NUM] /*(o) spectral flatness rate*/ ); -#ifndef HARMONIZE_2596_SetModeIndex -void SetModeIndex_fx( - Encoder_State *st, - Word32 last_total_brate, /* Q0 */ - const Word16 last_element_mode, /* Q0 */ - const Word16 is_mct, /* Q0 */ - const Word16 shift ); -#endif void MDCT_selector_fx( Encoder_State *st, /* i/o: Encoder State */ diff --git a/lib_enc/setmodeindex_fx.c b/lib_enc/setmodeindex_fx.c index 7183e452f3448992a32f0f229399a1851f2f23d2..cae40451abf35d36fafa48602343e20e9b34adbb 100644 --- a/lib_enc/setmodeindex_fx.c +++ b/lib_enc/setmodeindex_fx.c @@ -21,58 +21,13 @@ ---------------------------------------------------------------------------*/ -#ifndef HARMONIZE_2596_SetModeIndex -void SetModeIndex_fx( - Encoder_State *st, - Word32 last_total_brate, /* Q0 */ - const Word16 last_element_mode, /* Q0 */ - const Word16 is_mct, /* Q0 */ - const Word16 shift ) -{ - Word16 ini_frame_loc = st->ini_frame; // Q0 - - test(); - test(); - if ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_MDCT ) && EQ_16( st->idchan, 1 ) ) - { - st->ini_frame = 0; - move16(); - } - /* Reconfigure the core coder */ - test(); - test(); - test(); - IF( - ( NE_32( last_total_brate, st->total_brate ) ) || - ( NE_16( st->last_bwidth, st->bwidth ) ) || - ( EQ_16( st->last_codec_mode, MODE1 ) && EQ_16( st->element_mode, EVS_MONO ) ) || - ( ( NE_16( st->last_core, TCX_20_CORE ) && NE_16( st->last_core, TCX_10_CORE ) ) && GT_16( st->element_mode, EVS_MONO ) ) || - ( NE_16( st->rf_mode_last, st->rf_mode ) ) || - ( GT_16( st->element_mode, EVS_MONO ) && st->ini_frame == 0 ) ) - { - core_coder_mode_switch_fx( st, last_total_brate, is_mct, shift ); - } - st->ini_frame = ini_frame_loc; // Q0 - - return; -} -#endif - -#ifdef HARMONIZE_2596_SetModeIndex void SetModeIndex_fx( -#else -void SetModeIndex_ivas_fx( -#endif Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate Q0*/ const Word16 last_element_mode, /* i : last IVAS element mode Q0*/ - const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) Q0*/ -#ifdef HARMONIZE_2596_SetModeIndex - , - const Word16 shift -#endif -) + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) Q0*/ + const Word16 shift ) { Word16 ini_frame_loc = st->ini_frame; // Q0 move16(); @@ -102,18 +57,14 @@ void SetModeIndex_ivas_fx( ( NE_16( st->rf_mode_last, st->rf_mode ) ) || ( st->element_mode > EVS_MONO && st->ini_frame == 0 ) ) { -#ifdef HARMONIZE_2596_SetModeIndex IF( EQ_16( st->element_mode, EVS_MONO ) ) { core_coder_mode_switch_fx( st, last_total_brate, MCT_flag, shift ); } ELSE { -#endif core_coder_mode_switch_ivas_fx( st, last_total_brate, MCT_flag ); -#ifdef HARMONIZE_2596_SetModeIndex } -#endif } st->ini_frame = ini_frame_loc; // Q0 diff --git a/lib_enc/tns_base_enc_fx.c b/lib_enc/tns_base_enc_fx.c index 061c576161ec5113b7a14c641955e0d98800dae5..11ef9ee70f43141d27422919adf7713fa3f0170c 100644 --- a/lib_enc/tns_base_enc_fx.c +++ b/lib_enc/tns_base_enc_fx.c @@ -23,13 +23,7 @@ * @param maxOrder Maximum filter order/number of coefficients. * @param pTnsFilter Pointer to the output filter. */ -#ifndef HARMONIZE_2607_GetFilterParameters -static void GetFilterParameters( Word32 rxx[], Word16 maxOrder, STnsFilter *pTnsFilter ); - -static void GetFilterParameters_ivas( Word32 rxx[], Word16 maxOrder, STnsFilter *pTnsFilter ); -#else static void GetFilterParameters( Word32 rxx[], Word16 maxOrder, STnsFilter *pTnsFilter, Word16 element_mode ); -#endif /** Quantization for reflection coefficients. * @@ -154,11 +148,7 @@ void CalculateTnsFilt_fx( pFilter->spectrumLength = spectrumLength; move16(); /* Limit the maximum order to spectrum length/4 */ -#ifdef HARMONIZE_2607_GetFilterParameters GetFilterParameters( rxx, s_min( pTnsConfig->maxOrder, shr( pFilter->spectrumLength, 2 ) ), pFilter, 1 /*signal non-EVS*/ ); -#else - GetFilterParameters_ivas( rxx, s_min( pTnsConfig->maxOrder, shr( pFilter->spectrumLength, 2 ) ), pFilter ); -#endif } } @@ -376,11 +366,7 @@ Word16 DetectTnsFilt_fx( pFilter->spectrumLength = spectrumLength; move16(); /* Limit the maximum order to spectrum length/4 */ -#ifdef HARMONIZE_2607_GetFilterParameters GetFilterParameters( rxx, s_min( pTnsConfig->maxOrder, shr( pFilter->spectrumLength, 2 ) ), pFilter, EVS_MONO ); -#else - GetFilterParameters( rxx, s_min( pTnsConfig->maxOrder, shr( pFilter->spectrumLength, 2 ) ), pFilter ); -#endif } } @@ -539,17 +525,11 @@ Word16 WriteTnsData_fx( STnsConfig const *pTnsConfig, Word16 const *stream, Word /********************************/ /* Private functions */ /********************************/ -#ifdef HARMONIZE_2607_GetFilterParameters static void GetFilterParameters( Word32 rxx[], Word16 maxOrder, STnsFilter *pTnsFilter, Word16 element_mode ) -#else -static void GetFilterParameters_ivas( Word32 rxx[], Word16 maxOrder, STnsFilter *pTnsFilter ) -#endif { Word16 i; Word16 parCoeff[TNS_MAX_FILTER_ORDER + 1]; -#ifdef HARMONIZE_2607_GetFilterParameters Word32 epsP[TNS_MAX_FILTER_ORDER + 1]; -#endif Word32 rxx_0; Word32 L_tmp; #if TNS_COEF_RES == 5 @@ -561,7 +541,6 @@ static void GetFilterParameters_ivas( Word32 rxx[], Word16 maxOrder, STnsFilter #endif Word16 *indexes = pTnsFilter->coefIndex; -#ifdef HARMONIZE_2607_GetFilterParameters IF( EQ_16( element_mode, EVS_MONO ) ) { /* compute TNS filter in lattice (ParCor) form with LeRoux-Gueguen algorithm */ @@ -572,7 +551,6 @@ static void GetFilterParameters_ivas( Word32 rxx[], Word16 maxOrder, STnsFilter } ELSE { -#endif rxx_0 = rxx[0]; move32(); /* compute TNS filter in lattice (ParCor) form with LeRoux-Gueguen algorithm */ @@ -588,9 +566,7 @@ static void GetFilterParameters_ivas( Word32 rxx[], Word16 maxOrder, STnsFilter pTnsFilter->predictionGain = shl_sat( temp, sub( temp_e, PRED_GAIN_E ) ); // Q7 move16(); BASOP_SATURATE_WARNING_ON_EVS -#ifdef HARMONIZE_2607_GetFilterParameters } -#endif /* non-linear quantization of TNS lattice coefficients with given resolution */ Parcor2Index( parCoeff, indexes, maxOrder ); @@ -626,61 +602,6 @@ static void GetFilterParameters_ivas( Word32 rxx[], Word16 maxOrder, STnsFilter pTnsFilter->avgSqrCoef = shr(pTnsFilter->avgSqrCoef, 3); */ } -#ifndef HARMONIZE_2607_GetFilterParameters -static void GetFilterParameters( Word32 rxx[], Word16 maxOrder, STnsFilter *pTnsFilter ) -{ - Word16 i; - Word16 parCoeff[TNS_MAX_FILTER_ORDER]; - Word32 epsP[TNS_MAX_FILTER_ORDER + 1], L_tmp; -#if TNS_COEF_RES == 5 - Word16 const *values = tnsCoeff5; -#elif TNS_COEF_RES == 4 - Word16 const *values = tnsCoeff4; -#elif TNS_COEF_RES == 3 - Word16 const *values = tnsCoeff3; -#endif - Word16 *indexes = pTnsFilter->coefIndex; - - - /* compute TNS filter in lattice (ParCor) form with LeRoux-Gueguen algorithm */ - L_tmp = E_LPC_schur( rxx, parCoeff, epsP, maxOrder ); - BASOP_SATURATE_WARNING_OFF_EVS /* Allow saturation, this value is compared against a threshold. */ - pTnsFilter->predictionGain = divide3232( L_shr( epsP[0], PRED_GAIN_E ), L_tmp ); - BASOP_SATURATE_WARNING_ON_EVS - /* non-linear quantization of TNS lattice coefficients with given resolution */ - Parcor2Index( parCoeff, indexes, maxOrder ); - - /* reduce filter order by truncating trailing zeros */ - i = sub( maxOrder, 1 ); - - test(); - WHILE( ( i >= 0 ) && ( indexes[i] == 0 ) ) - { - test(); - i = sub( i, 1 ); - } - - move16(); - pTnsFilter->order = add( i, 1 ); - - /* compute avg(coef*coef) */ - L_tmp = L_deposit_l( 0 ); - - FOR( i = pTnsFilter->order - 1; i >= 0; i-- ) - { - Word16 value; - - value = shr( values[indexes[i] + INDEX_SHIFT], 1 ); - - L_tmp = L_mac0( L_tmp, value, value ); - } - move16(); - pTnsFilter->avgSqrCoef = round_fx( L_tmp ); - - /* assert(maxOrder == 8); - pTnsFilter->avgSqrCoef = shr(pTnsFilter->avgSqrCoef, 3); */ -} -#endif /*HARMONIZE_2607_GetFilterParameters*/ static void Parcor2Index( const Word16 parCoeff[] /*Q15*/, Word16 index[], Word16 order ) {