diff --git a/apps/decoder.c b/apps/decoder.c index 0073ad93508926ed913586bbffa91f5afa3e49e5..270c644db6f9b481e464714d194cb1cb3886d8b4 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -159,11 +159,7 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); -#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); -#else -static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); -#endif static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); @@ -670,11 +666,7 @@ int main( } else { -#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &hIvasDec, pcmBuf ); -#else - error = decodeG192( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, hIvasDec, pcmBuf ); -#endif } if ( error == IVAS_ERR_OK || error == IVAS_ERR_END_OF_FILE ) @@ -2002,11 +1994,7 @@ static ivas_error decodeG192( Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, -#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH IVAS_DEC_HANDLE *phIvasDec, -#else - IVAS_DEC_HANDLE hIvasDec, -#endif int16_t *pcmBuf ) { @@ -2014,9 +2002,7 @@ static ivas_error decodeG192( uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8]; int16_t i, num_bits; int16_t bfi = 0; -#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH IVAS_DEC_HANDLE hIvasDec = *phIvasDec; -#endif AudioFileWriter *afWriter = NULL; MasaFileWriter *masaWriter = NULL; bool decodedGoodFrame = false; @@ -2040,9 +2026,7 @@ static ivas_error decodeG192( int16_t isSplitRend, isSplitCoded; IVAS_RENDER_CONFIG_DATA renderConfig; RenderConfigReader *renderConfigReader = NULL; -#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH bool restartNeeded; -#endif #ifdef VARIABLE_SPEED_DECODING if ( arg.tsmEnabled ) @@ -2297,7 +2281,6 @@ static ivas_error decodeG192( return error; } -#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH if ( ( error = IVAS_DEC_isRestartNeeded( hIvasDec, &restartNeeded ) ) != IVAS_ERR_OK ) { return error; @@ -2311,7 +2294,6 @@ static ivas_error decodeG192( goto cleanup; } } -#endif /* Placeholder for memory reallocation */ /* ... */ diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index 3bea7756b8aac348b325cc0573e12b9b38a8fad3..697fc2153dcb39f46af5833adee2c55e57ca50ca 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -1146,22 +1146,14 @@ static Word16 Find_bit_alloc_IVAS_fx( /* bits_per_bands[i] = 112; */ bits_per_bands[i] = Q18_112; move32(); -#ifndef FIX_2585_BIT_ALLOCATION_DIFF - j = add( j, add( i, 1 ) ); -#else j = add( i, 1 ); -#endif } /* safety check for overage bit reallocation */ /* else if (bits_per_bands[i] + sum_bit / 3 > 112) */ ELSE IF( GT_32( L_add( bits_per_bands[i], Mpy_32_16_1( sum_bit, Q15_0_33 ) ), Q18_112 ) ) { -#ifndef FIX_2585_BIT_ALLOCATION_DIFF - j = add( j, add( i, 1 ) ); -#else j = add( i, 1 ); -#endif } } diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 8c7a31bc1a954909ce54252a25bb63500ee8f46e..f329d1343cc306433b5257dc77936fb54712d20c 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1173,12 +1173,8 @@ void stereo_dft_dec_fx( Word32 stereo_dft_enc_synthesize_fx( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ -#ifdef NONBE_FIX_ISSUE_2206 Word32 *output_fx, /* i/o : output synthesis q_output */ Word16 *q_output, /* i/o : output synthesis Q0 */ -#else - Word32 *output_fx, /* o : output synthesis Q16 */ -#endif Word16 *output_start_index, Word16 *output_end_index, const Word16 chan, /* i : channel number */ @@ -1358,12 +1354,8 @@ void stereo_tcx_init_dec_fx( void stereo_icBWE_enc_fx( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT const Word16 shb_speech_ref_fx16[], /* i : SHB speech ref channel shb_speech_ref_q*/ const Word16 shb_speech_ref_q, /* i : SHB speech ref channel Q */ -#else - const Word16 shb_speech_ref_fx16[], /* i : SHB speech ref channel Q0*/ -#endif Word16 shb_speech_nonref_fx_16[], /* i/o: SHB speech non-ref channel shb_speech_nonref_e*/ Word16 shb_speech_nonref_e, /* i/o: SHB speech non-ref channel */ const Word16 *voice_factors_fx /* i : voicing factors Q15 */ @@ -2673,9 +2665,7 @@ Word16 ivas_acelp_tcx20_switching_fx( Word16 *inp_fx, /* i : new input signal */ Word16 q_inp, /* i : i/p Q */ Word16 *wsp, /* i : input weighted signal */ -#ifdef NONBE_FIX_ISSUE_2206 Word16 q_wsp, /* i : Q of input weighted signal */ -#endif Word32 non_staX, /* i : unbound non-stationarity for sp/mu clas */ Word16 *pitch_fr, /* i : fraction pitch values */ Word16 *voicing_fr, /* i : fractional voicing values */ @@ -5707,12 +5697,8 @@ void pre_proc_ivas_fx( Word16 *epsP_fx_q, /* i : LP prediction errors */ Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame Q15*/ Word16 lsp_mid_fx[M], /* i/o: LSPs in the middle of the frame Q15*/ -#ifdef NONBE_FIX_ISSUE_2206 Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE q_new_inp_resamp16k_fx*/ Word16 *q_new_inp_resamp16k_fx, /* o : Q value of new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ -#else - Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE Q_new-1*/ -#endif Word16 *Voicing_flag, /* o : voicing flag for HQ FEC Q0*/ Word16 old_wsp_fx[], /* i : weighted input signal buffer e_old_wsp*/ const Word16 e_old_wsp, /* i : Q value of weighted input signal buffer */ @@ -6087,12 +6073,8 @@ UWord16 get_indice_st( void stereo_mdct_core_enc_fx( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ -#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 Word16 new_samples[CPE_CHANNELS][L_INP], /* i : new samples new_samples_q*/ Word16 *new_samples_q, -#else - Word16 new_samples[CPE_CHANNELS][L_INP], /* i : new samples Qnew-1*/ -#endif Word16 old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP Qx*/ Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k] /* o : floating pitch for each subframe Q6*/ ); @@ -6139,12 +6121,8 @@ void stereo_switching_dec_fx( void ivas_mdct_core_whitening_enc_fx( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ -#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i : new samples Q_new[]-1*/ Word16 *Q_new, /* i : new samples q */ -#else - Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i : new samples */ -#endif Word16 old_wsp_fx[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP */ Word16 pitch_buf[CPE_CHANNELS][NB_SUBFR16k], /* o : floating pitch for each subframe */ Word32 *mdst_spectrum_long[CPE_CHANNELS], /* o : buffer for MDST spectrum */ diff --git a/lib_com/ivas_stereo_td_bit_alloc_fx.c b/lib_com/ivas_stereo_td_bit_alloc_fx.c index 8b1b892cf49d4fc2d85db4614973793ebe537010..799dca4d5e570c6ea5074853b80912bc5bd958ac 100644 --- a/lib_com/ivas_stereo_td_bit_alloc_fx.c +++ b/lib_com/ivas_stereo_td_bit_alloc_fx.c @@ -204,7 +204,6 @@ void tdm_bit_alloc( } ELSE { -#ifdef FIX_2585_BIT_ALLOCATION_DIFF Word16 neg = 0; move16(); if ( bit_rate_diff_fx < 0 ) @@ -212,17 +211,12 @@ void tdm_bit_alloc( neg = 1; move16(); } -#endif IF( LT_16( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) ) { bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( LRTD_STEREO_MID_IS_PRIM, ener_ratio_idx ) ); /*Q0*/ bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 ); /*Q0*/ bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ ); /*Q0*/ -#ifdef FIX_2585_BIT_ALLOCATION_DIFF if ( neg != 0 ) -#else - if ( bit_rate_diff_fx < 0 ) -#endif { bit_rate_diff_fx = L_negate( bit_rate_diff_fx ); } @@ -232,11 +226,7 @@ void tdm_bit_alloc( bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) ); /*Q0*/ bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 ); /*Q0*/ bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ ); /*Q0*/ -#ifdef FIX_2585_BIT_ALLOCATION_DIFF if ( neg != 0 ) -#else - if ( bit_rate_diff_fx < 0 ) -#endif { bit_rate_diff_fx = L_negate( bit_rate_diff_fx ); } @@ -338,11 +328,7 @@ void tdm_bit_alloc( *tdm_low_rate_mode = 0; move16(); } -#ifndef FIX_2585_BIT_ALLOCATION_DIFF - ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LE_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) ) -#else ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) ) -#endif { *total_brate_sec = L_add( *total_brate_sec, MID_LP_BRATE ); /*Q0*/ move32(); diff --git a/lib_com/options.h b/lib_com/options.h index aacc67cc772fbb92eadb419217e66e681e3038b9..a1b758cfc563aca2adef722e54399cc2355c02f1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -86,14 +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 NONBE_FIX_ISSUE_2206 /* FhG: Calculate st->q_inp and Q_new dynamically for all data paths instead of assuming constant values */ -#define NONBE_FIX_ISSUE_2206_TV1 /* VA/FhG: Calculate st->q_inp also considering st->mem_q decimation memory to avoid saturation */ -#define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT /* FhG: Dynamic scale of shb_speech buffers */ -#define NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION /* FhG: Use different scale to avoid saturation of LPC coefficient in TD Stereo signal extrapolation. */ -#define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_SWB_fenv_fx2 /* FhG: Avoid overflow of SWB_fenv_fx in SWB_BWE_encoding_fx because of very small energies. */ -#define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */ -#define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ -#define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ #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 */ @@ -111,11 +103,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 NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */ -#define FIX_2585_BIT_ALLOCATION_DIFF /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */ -#define FIX_BASOP_2592_OVERFLOW /* FhG: BASOP #2592: fix overflow in GetF0() */ -#define FIX_BASOP_2591_EDGE_DETECT_COMP /* FhG: BASOP #2591: Wrong comparison in edge_detect_fx() */ -#define FIX_NONBE_2580_USE_LENGTH_NOT_CONSTANT /* Dolby: fix 2580: use dynamic length denominator for average energy in unclr_calc_corr_features_fx() */ #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. */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 39092d3025c5bd594997cf34a6ec2c1e8c8d6ed5..6458662e7e8522d0f2acdea2d7b0c5b6262879dc 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -3991,11 +3991,7 @@ Word16 find_guarded_bits_fx( const Word32 n ); Word16 L_norm_arr( const Word32 *arr, Word16 size ); Word16 L_norm_arr_cmplx( const cmplx *arr, Word16 size ); -#ifdef NONBE_FIX_ISSUE_2206 Word16 norm_arr( const Word16 *arr, Word16 size ); -#else -Word16 norm_arr( Word16 *arr, Word16 size ); -#endif Word16 W_norm_arr( Word64 *arr, Word16 size ); Word16 get_min_scalefactor( Word32 x, Word32 y ); @@ -8537,14 +8533,12 @@ void Copy_Scale_sig( const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */ ); -#ifdef NONBE_FIX_ISSUE_2206 void Copy_Scale_sig_nosat( const Word16 x[], /* i : signal to scale i Qx */ Word16 y[], /* o : scaled signal output Qx */ const Word16 lg, /* i : size of x[] Q0 */ const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */ ); -#endif void Scale_sig32( Word32 x[], /* i/o: signal to scale Qx */ @@ -8580,14 +8574,12 @@ void Copy_Scale_sig_32_16( const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */ ); -#ifdef NONBE_FIX_ISSUE_2206 void Copy_Scale_sig_32_16_nosat( const Word32 x[], /* i : signal to scale input Qx */ Word16 y[], /* o : scaled signal output Qx */ const Word16 lg, /* i : size of x[] Q0 */ const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */ ); -#endif void Random_Fill( Word16 *seed, /* i/o: random seed */ diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 70684ccd5050dc0aeb077d7ae52e2d54db6cac76..0ce926375bce539a8dc24de5a589f80dfce0e862 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -5281,11 +5281,7 @@ static void Estimate_mix_factors_fx( pow3 = Dot_product( shb_res_local, shb_res_local, L_FRAME16k ); /* (2*Q_shb+1) */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT pow3 = L_add_sat( pow3, L_shl( 21475l /*0.00001f in Q31*/, 2 * Q_shb + 1 - 31 ) ); /* (2*Q_shb+1) */ -#else - pow3 = L_add( pow3, L_shl( 21475l /*0.00001f in Q31*/, 2 * Q_shb + 1 - 31 ) ); /* (2*Q_shb+1) */ -#endif if ( pow3 == 0 ) { pow3 = 1; diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index e15184cbaa4b89174dc1a79a7e576cddfefe1541..699da8103429e9b41fed5c701bb31277a84a4a79 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -1249,7 +1249,6 @@ void Copy_Scale_sig( return; } -#ifdef NONBE_FIX_ISSUE_2206 /*-------------------------------------------------------------------* * Copy_Scale_sig * @@ -1302,7 +1301,6 @@ void Copy_Scale_sig_nosat( return; } -#endif /*-------------------------------------------------------------------* * Copy_Scale_sig @@ -1461,7 +1459,6 @@ void Copy_Scale_sig_32_16( return; } -#ifdef NONBE_FIX_ISSUE_2206 void Copy_Scale_sig_32_16_nosat( const Word32 x[], /* i : signal to scale input Qx */ Word16 y[], /* o : scaled signal output Qx */ @@ -1493,7 +1490,6 @@ void Copy_Scale_sig_32_16_nosat( return; } -#endif /*-------------------------------------------------------------------* * Scale_sig32 @@ -5443,15 +5439,9 @@ Word16 L_norm_arr_cmplx( return q; } -#ifdef NONBE_FIX_ISSUE_2206 Word16 norm_arr( const Word16 *arr, Word16 size ) -#else -Word16 norm_arr( - Word16 *arr, - Word16 size ) -#endif { Word16 q = 15; Word16 exp = 0; diff --git a/lib_dec/TonalComponentDetection_fx.c b/lib_dec/TonalComponentDetection_fx.c index bc9c4c0c7a0556f2b9f1f3e852dec878031f2695..639b1d9cb355fa2539794787b4cc44cf786fb280 100644 --- a/lib_dec/TonalComponentDetection_fx.c +++ b/lib_dec/TonalComponentDetection_fx.c @@ -444,11 +444,7 @@ static void GetF0( { Word16 tmp_32 = 0; Word32 F0_32 = BASOP_Util_Divide3232_Scale_newton( L_shl( nSamplesCore, Q16 ), tmpPitchLag, &tmp_32 ); -#ifdef FIX_BASOP_2592_OVERFLOW F0_32 = L_shl_sat( F0_32, tmp_32 - Q16 ); /* saturation needed to allow 0x40000000 << 1 */ -#else - F0_32 = L_shl( F0_32, tmp_32 - Q16 ); -#endif *pF0_32 = F0_32; move32(); *pOrigF0_32 = *pF0_32; /*Q26*/ diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index 4550af71528705f32ed9b3427e0f6f777a98d9af..5f9856c4ecc3decf5d7180af120f092d3cddcad1 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -108,9 +108,6 @@ ivas_error ivas_dec_get_format_fx( Word16 nchan_ism, element_mode_flag; Word16 sba_order, sba_planar, sba_analysis_order; Word32 ivas_total_brate; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - Word16 Opt_tsm; -#endif UWord16 *bit_stream_orig; AUDIO_CONFIG signaled_config; ivas_error error; @@ -122,10 +119,6 @@ ivas_error ivas_dec_get_format_fx( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; move32(); -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - Opt_tsm = st_ivas->hDecoderConfig->Opt_tsm; - move16(); -#endif bit_stream_orig = st_ivas->bit_stream; /*-------------------------------------------------------------------* @@ -146,24 +139,10 @@ ivas_error ivas_dec_get_format_fx( !( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && EQ_32( st_ivas->last_ivas_format, MASA_ISM_FORMAT ) ) && !( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) && EQ_32( st_ivas->last_ivas_format, MASA_FORMAT ) ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); - } -#endif + return IVAS_ERR_OK; } /*-------------------------------------------------------------------* @@ -201,24 +180,10 @@ ivas_error ivas_dec_get_format_fx( test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); - } -#endif + return IVAS_ERR_OK; } st_ivas->nchan_ism = nchan_ism; @@ -242,24 +207,10 @@ ivas_error ivas_dec_get_format_fx( test(); IF( st_ivas->ini_frame > 0 && NE_16( sba_planar, st_ivas->sba_planar ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Changing the SBA planar/3D layout is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA planar flag signalled!" ); - } -#endif + return IVAS_ERR_OK; } /* read Ambisonic (SBA) order */ @@ -270,24 +221,10 @@ ivas_error ivas_dec_get_format_fx( test(); IF( st_ivas->ini_frame > 0 && NE_16( sba_order, st_ivas->sba_order ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); - } -#endif + return IVAS_ERR_OK; } sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, sba_order ); @@ -303,12 +240,7 @@ ivas_error ivas_dec_get_format_fx( k = extract_l( Mpy_32_32_r( ivas_total_brate, ONE_BY_FRAMES_PER_SEC_Q31 ) ); IF( st_ivas->bit_stream[k - 1] ) { -#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH if ( st_ivas->nchan_transport == 1 ) -#else - test(); - if ( st_ivas->nchan_transport == 1 && Opt_tsm ) -#endif { masaRestartCandidate = 1; move16(); @@ -321,12 +253,7 @@ ivas_error ivas_dec_get_format_fx( } ELSE { -#ifdef FIX_FLOAT_1539_G192_FORMAT_SWITCH if ( st_ivas->nchan_transport == 2 ) -#else - test(); - if ( st_ivas->nchan_transport == 2 && Opt_tsm ) -#endif { masaRestartCandidate = 1; move16(); @@ -376,24 +303,10 @@ ivas_error ivas_dec_get_format_fx( test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); - } -#endif + return IVAS_ERR_OK; } st_ivas->nchan_ism = nchan_ism; @@ -412,24 +325,10 @@ ivas_error ivas_dec_get_format_fx( test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); - } -#endif + return IVAS_ERR_OK; } st_ivas->nchan_ism = nchan_ism; @@ -444,24 +343,10 @@ ivas_error ivas_dec_get_format_fx( test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); - } -#endif + return IVAS_ERR_OK; } st_ivas->nchan_ism = nchan_ism; @@ -489,24 +374,10 @@ ivas_error ivas_dec_get_format_fx( test(); IF( st_ivas->ini_frame > 0 && NE_16( sba_order, st_ivas->sba_order ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Changing the SBA order is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong SBA order signalled!" ); - } -#endif + return IVAS_ERR_OK; } st_ivas->ism_mode = ivas_osba_ism_mode_select( ivas_total_brate, st_ivas->nchan_ism ); @@ -533,24 +404,10 @@ ivas_error ivas_dec_get_format_fx( test(); IF( st_ivas->ini_frame > 0 && NE_32( st_ivas->transport_config, signaled_config ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Switching of MC configurations is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong MC configuration signalled!" ); - } -#endif + return IVAS_ERR_OK; } st_ivas->mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( signaled_config ), ivas_total_brate ); @@ -649,24 +506,10 @@ ivas_error ivas_dec_get_format_fx( test(); IF( st_ivas->ini_frame > 0 && NE_16( nchan_ism, st_ivas->nchan_ism ) ) { -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - IF( Opt_tsm ) - { -#endif - st_ivas->restartNeeded = 1; - move16(); + st_ivas->restartNeeded = 1; + move16(); - return IVAS_ERR_OK; -#ifndef FIX_FLOAT_1539_G192_FORMAT_SWITCH - } - ELSE - { -#ifdef DEBUGGING - fprintf( stderr, "\nError: Changing the number of ISMs is not supported!\n" ); -#endif - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Wrong number of objects signalled!" ); - } -#endif + return IVAS_ERR_OK; } st_ivas->nchan_ism = nchan_ism; diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index 8d9bf9f1f1d00b22ace4fd03bdb9410e2bf5300c..02b6142c99ef860456318e6ff4b16821ae085d1c 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -20,12 +20,8 @@ *--------------------------------------------------------------------*/ ivas_error acelp_core_enc_fx( - Encoder_State *st, /* i/o: encoder state structure */ -#ifdef NONBE_FIX_ISSUE_2206 - const Word16 inp[], /* i : input signal of the current frame Q_new-1*/ -#else - const Word16 inp[], /* i : input signal of the current frame Q_new*/ -#endif + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 inp[], /* i : input signal of the current frame Q_new-1*/ Word16 A[NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ Word16 Aw[NB_SUBFR16k * ( M + 1 )], /* i : weighted A(z) unquant. for subframes Q12*/ const Word32 epsP[M + 1], /* i : LP prediction errors Qx*/ diff --git a/lib_enc/cng_enc_fx.c b/lib_enc/cng_enc_fx.c index c28d008abbd43c157e985030dbc931603e0b0ea5..33c43038095f5f951395f724d552d58edd5f4d89 100644 --- a/lib_enc/cng_enc_fx.c +++ b/lib_enc/cng_enc_fx.c @@ -27,11 +27,7 @@ *---------------------------------------------------------------------*/ static void shb_CNG_encod_fx( Encoder_State *st_fx, const Word16 update_fx ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT static Word16 shb_DTX_fx( Encoder_State *st_fx, const Word16 *shb_speech_fx, const Word16 shb_speech_q, const Word16 *syn_12k8_16k ); -#else -static Word16 shb_DTX_fx( Encoder_State *st_fx, const Word16 *shb_speech_fx, const Word16 *syn_12k8_16k ); -#endif /*---------------------------------------------------------------------* * CNG_enc() @@ -894,11 +890,7 @@ void CNG_enc_fx( L_tmp = L_add_sat( L_tmp, L_tmp ); /* 2*Q_new+1 */ L_tmp = Mult_32_16( L_tmp, 128 ); /* 2*Q_new+1 */ tmp1 = add( add( Q_new, Q_new ), 1 ); -#ifdef NONBE_FIX_ISSUE_2206 env[i] = L_shr_sat( L_tmp, sub( tmp1, 6 ) ); -#else - env[i] = L_shr( L_tmp, sub( tmp1, 6 ) ); -#endif move32(); /* Q6 */ ptR++; ptI--; @@ -1459,13 +1451,9 @@ void calculate_hangover_attenuation_gain_fx( *---------------------------------------------------------------------*/ void swb_CNG_enc_fx( - Encoder_State *st, /* i/o: State structure */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT - const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz shb_speech_q */ - const Word16 shb_speech_q, /* i : SHB target signal Q (6-14kHz) at 16kHz Q0 */ -#else - const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz Q0 */ -#endif + Encoder_State *st, /* i/o: State structure */ + const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz shb_speech_q */ + const Word16 shb_speech_q, /* i : SHB target signal Q (6-14kHz) at 16kHz Q0 */ const Word16 *syn_12k8_16k_fx /* i : ACELP core synthesis at 12.8kHz or 16kHz Q0 */ ) { @@ -1480,11 +1468,7 @@ void swb_CNG_enc_fx( IF( GE_32( st->input_Fs, L_FRAME32k * FRAMES_PER_SEC ) ) { /* decide if SHB SID encoding or not */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT shb_SID_updt = shb_DTX_fx( st, shb_speech_fx, shb_speech_q, syn_12k8_16k_fx ); -#else - shb_SID_updt = shb_DTX_fx( st, shb_speech_fx, syn_12k8_16k_fx ); -#endif /* SHB CNG encoding */ shb_CNG_encod_fx( st, shb_SID_updt ); @@ -1568,11 +1552,7 @@ static void shb_CNG_encod_fx( Word16 tmp, tmp1, tmp2, scale, exp1, exp2, ener_mid_dec_thr_e; tmp = BASOP_Util_Divide1616_Scale( st->hTdCngEnc->last_idx_ener, 22938, &scale ); // 0.7 in Q15 ->exp 0 scale = add( scale, ( 15 - 0 ) ); -#ifdef NONBE_FIX_ISSUE_2206 tmp = sub( tmp, shl_sat( 6, sub( Q15, scale ) ) ); /* Saturate, because the computation goes into a threshold decision. */ -#else - tmp = sub( tmp, shl( 6, sub( Q15, scale ) ) ); -#endif tmp1 = BASOP_Util_Divide1616_Scale( tmp, 3277, &exp1 ); exp1 = add( exp1, ( scale - 0 ) ); @@ -1580,11 +1560,7 @@ static void shb_CNG_encod_fx( tmp = BASOP_Util_Divide1616_Scale( idx_ener, 22938, &scale ); // 0.7 in Q15 ->exp 0 scale = add( scale, ( 15 - 0 ) ); -#ifdef NONBE_FIX_ISSUE_2206 tmp = sub( tmp, shl_sat( 6, sub( Q15, scale ) ) ); /* Saturate, because the computation goes into a threshold decision. */ -#else - tmp = sub( tmp, shl( 6, sub( Q15, scale ) ) ); -#endif tmp1 = BASOP_Util_Divide1616_Scale( tmp, 3277, &exp2 ); exp2 = add( exp2, ( scale - 0 ) ); @@ -1643,13 +1619,9 @@ static void shb_CNG_encod_fx( *---------------------------------------------------------------------*/ static Word16 shb_DTX_fx( - Encoder_State *st, /* i/o: State structure */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT - const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz shb_speech_q */ - const Word16 shb_speech_q, /* i : SHB target signal (6-14kHz) at 16kHz Q Q0 */ -#else - const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz Q0 */ -#endif + Encoder_State *st, /* i/o: State structure */ + const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz shb_speech_q */ + const Word16 shb_speech_q, /* i : SHB target signal (6-14kHz) at 16kHz Q Q0 */ const Word16 *syn_12k8_16k_fx /* i : ACELP core synthesis at 12.8kHz or 16kHz Q0 */ ) { @@ -1661,9 +1633,7 @@ static Word16 shb_DTX_fx( Word16 *shb_new_speech_fx; Word32 wb_ener_fx; Word32 shb_ener_fx; -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Word16 shb_ener_q; -#endif Word16 log_wb_ener_fx; Word16 log_shb_ener_fx; Word16 tmp; @@ -1675,20 +1645,13 @@ static Word16 shb_DTX_fx( TD_BWE_ENC_HANDLE hBWE_TD = st->hBWE_TD; shb_new_speech_fx = shb_old_speech_fx + ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4; -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Copy_Scale_sig_nosat( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4, sub( shb_speech_q, hBWE_TD->old_speech_shb_q ) ); Copy( shb_speech_fx, shb_new_speech_fx, L_FRAME16k ); Copy( shb_old_speech_fx + L_FRAME16k, hBWE_TD->old_speech_shb_fx, ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4 ); hBWE_TD->old_speech_shb_q = shb_speech_q; move16(); -#else - Copy( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4 ); // old_speech_shb_fx -> Q0 - Copy( shb_speech_fx, shb_new_speech_fx, L_FRAME16k ); // Q0 - Copy( shb_old_speech_fx + L_FRAME16k, hBWE_TD->old_speech_shb_fx, ( ACELP_LOOK_12k8 + L_SUBFR ) * 5 / 4 ); // Q0 -#endif shb_ener_fx = L_deposit_l( 0 ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT FOR( i = 0; i < L_FRAME16k; i++ ) { shb_ener_fx = L_mac_sat( shb_ener_fx, shb_old_speech_fx[i], shb_old_speech_fx[i] ); // ( 2 * hBWE_TD->old_speech_shb_q + Q1 ) --> Q1 due to left shift in L_mac @@ -1696,14 +1659,6 @@ static Word16 shb_DTX_fx( shb_ener_q = add( shl( hBWE_TD->old_speech_shb_q, 1 ), 1 ); shb_ener_fx = L_add( Mpy_32_16_1( shb_ener_fx, 102 ), 1 ); /* ( 1 / L_FRAME16K ) -> 102 in Q15, shb_ener_fx in shb_ener_q */ -#else - FOR( i = 0; i < L_FRAME16k; i++ ) - { - shb_ener_fx = L_mac_sat( shb_ener_fx, shb_old_speech_fx[i], shb_old_speech_fx[i] ); // ( Q0 + Q0 + Q1 ) --> Q1 due to left shift in L_mac - } - - shb_ener_fx = L_add( Mpy_32_16_1( shb_ener_fx, 102 ), 1 ); /* ( 1 / L_FRAME16K ) -> 102 in Q15, shb_ener_fx in Q1 */ -#endif wb_ener_fx = L_deposit_l( 0 ); FOR( i = 0; i < st->L_frame; i++ ) @@ -1721,11 +1676,7 @@ static Word16 shb_DTX_fx( log_wb_ener_fx = round_fx_sat( L_shl_sat( wb_ener_fx, 10 ) ); /* log_wb_ener_fx in Q8 */ exp = norm_l( shb_ener_fx ); fra = Log2_norm_lc( L_shl( shb_ener_fx, exp ) ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT exp = sub( sub( 30, shb_ener_q ), exp ); -#else - exp = sub( 30 - 1, exp ); -#endif shb_ener_fx = Mpy_32_16( exp, fra, LG10 ); test(); diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 4769d574795418843e5312dc5ed40a89617ba9c3..c962072f5f0d483e9458086208301297965ef6d8 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -3896,27 +3896,12 @@ void coder_tcx_post_ivas_fx( Word16 *wsig, Word16 Q_new ) { -#ifdef NONBE_FIX_ISSUE_2206 /*-----------------------------------------------------------* * Memory update * *-----------------------------------------------------------*/ /* Update LPDmem (Txnq,syn,syn_pe,old_exc,wsyn,Ai,Aq) */ tcx_encoder_memory_update_ivas_fx( wsig, synth, st->L_frame, Ai, A, hTcxCfg->preemph_fac, LPDmem, st, Q_new ); -#else - Word16 xn_buf[L_FRAME_MAX]; - - /* TCX output */ - Copy( synth, xn_buf, st->L_frame ); - - - /*-----------------------------------------------------------* - * Memory update * - *-----------------------------------------------------------*/ - - /* Update LPDmem (Txnq,syn,syn_pe,old_exc,wsyn,Ai,Aq) */ - tcx_encoder_memory_update_ivas_fx( wsig, xn_buf, st->L_frame, Ai, A, hTcxCfg->preemph_fac, LPDmem, st, synth, Q_new ); -#endif return; } diff --git a/lib_enc/core_enc_init_fx.c b/lib_enc/core_enc_init_fx.c index 1953e8410828d058a6dff3cb70d1b7a8c043eca1..64434f7fe5831b7767262beb3bb4da2744f5b7a3 100644 --- a/lib_enc/core_enc_init_fx.c +++ b/lib_enc/core_enc_init_fx.c @@ -1545,18 +1545,12 @@ static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_ol move16(); st->exp_mem_preemph_enc = st->exp_buf_speech_enc; move16(); -#ifdef NONBE_FIX_ISSUE_2206 st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame + L_SUBFR - 1]; move16(); -#else - st->mem_wsp_enc = shr( st->buf_wspeech_enc[st->L_frame + L_SUBFR - 1], sub( Q16, st->exp_buf_wspeech_enc ) ); // Q-1 - move16(); -#endif } /*coming from TCXonly modes*/ ELSE IF( !st->tcxonly && GE_32( last_total_brate, ACELP_32k ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Word16 exp_buf_wspeech_enc; exp_buf_wspeech_enc = s_max( st->exp_old_wsp, st->exp_buf_wspeech_enc ); @@ -1564,27 +1558,14 @@ static void init_sig_buffers_ivas_fx( Encoder_State *st, const Word16 L_frame_ol Copy_Scale_sig_nosat( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM, sub( st->exp_old_wsp, exp_buf_wspeech_enc ) ); st->exp_buf_wspeech_enc = exp_buf_wspeech_enc; move16(); /*Resamp buffers needed only for ACELP*/ -#else - - Scale_sig( st->buf_wspeech_enc, L_FRAME16k + L_SUBFR + L_FRAME16k + L_NEXT_MAX_16k + 320, sub( 0, sub( st->exp_old_wsp, st->exp_buf_wspeech_enc ) ) ); - Copy( st->old_wsp_fx, st->buf_wspeech_enc + st->L_frame + L_SUBFR - L_WSP_MEM, L_WSP_MEM ); - // 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 ) ); - st->exp_buf_wspeech_enc = st->exp_old_wsp; - move16(); /*Resamp buffers needed only for ACELP*/ -#endif 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(); -#ifdef NONBE_FIX_ISSUE_2206 st->mem_wsp_enc = st->buf_wspeech_enc[st->L_frame + L_SUBFR - 1]; move16(); -#else - st->mem_wsp_enc = shr( st->buf_wspeech_enc[st->L_frame + L_SUBFR - 1], sub( Q16, st->exp_buf_wspeech_enc ) ); // Q-1 - move16(); -#endif } } diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index 2ba41243a28a055fddae02c24eddb3e008c2e696..9d9bb4b550524e872313004e0de0d512144737b3 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -411,13 +411,8 @@ void core_switching_pre_enc_fx( } tmp = sub( L_LOOK_16k + L_SUBFR16k, Sample_Delay_HP ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Copy( &hBWE_TD->old_speech_shb_fx[tmp], hBWE_FD->new_input_hp_fx, Sample_Delay_HP ); /*Q(hBWE_TD->old_speech_shb_q)*/ hBWE_FD->Q_new_input_hp = hBWE_TD->old_speech_shb_q; -#else - Copy( &hBWE_TD->old_speech_shb_fx[tmp], hBWE_FD->new_input_hp_fx, Sample_Delay_HP ); /*Q(Q_shb_spch)*/ - hBWE_FD->Q_new_input_hp = 0; -#endif move16(); IF( NE_16( st_fx->last_extl, WB_BWE ) ) @@ -567,10 +562,8 @@ void core_switching_post_enc_fx( ELSE { set16_fx( hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT hBWE_TD->old_speech_shb_q = Q15; move16(); -#endif } swb_tbe_reset_fx( hBWE_TD->mem_csfilt_fx, hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->state_lpc_syn_fx, @@ -578,10 +571,8 @@ void core_switching_post_enc_fx( hBWE_TD->mem_stp_swb_fx, &( hBWE_TD->gain_prec_swb_fx ) ); set16_fx( hBWE_TD->dec_2_over_3_mem_fx, 0, L_FILT_2OVER3 ); -#ifdef NONBE_FIX_ISSUE_2206 hBWE_TD->dec_2_over_3_mem_q = Q15; move16(); -#endif IF( NE_16( st_fx->element_mode, EVS_MONO ) ) { set16_fx( st_fx->hBWE_TD->dec_2_over_3_mem_lp_fx, 0, L_FILT_2OVER3_LP ); diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 1ca20c9a6bec082cb7157dd4551994bd49fab953..5f1b69807f2454e301f9a1e69f74b887a8850878 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -34,12 +34,8 @@ static void rem_offset( tmp = round_fx_sat( loffset ); FOR( i = 0; i < l_subfr; i++ ) { -#ifdef NONBE_FIX_ISSUE_2206 /* The need of sub_sat() here should be revisited. */ out[i] = sub_sat( in[i], tmp ); -#else - out[i] = sub( in[i], tmp ); -#endif move16(); } diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c index 7b6c6ddd3c112c84123745be6e7d5d93495bd24d..a8a177e0dec9d33883c76c68b305b09966d3fd71 100644 --- a/lib_enc/evs_enc_fx.c +++ b/lib_enc/evs_enc_fx.c @@ -87,7 +87,6 @@ ivas_error evs_enc_fx( Q_shb_spch = 0; move16(); /* to avoid compiler warnings */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT hBWE_TD->old_speech_shb_q = 0; move16(); st->hBWE_FD->Q_new_input_hp = 0; @@ -96,7 +95,6 @@ ivas_error evs_enc_fx( move16(); st->hBWE_FD->old_input_q = 0; move16(); -#endif /*------------------------------------------------------------------* * Initializiation @@ -424,26 +422,16 @@ ivas_error evs_enc_fx( IF( GE_32( st->input_Fs, 16000 ) && ( LT_16( st->bwidth, SWB ) ) ) { /* Common pre-processing for WB TBE and WB BWE */ -#ifdef NONBE_FIX_ISSUE_2206 wb_pre_proc_fx( st, EVS_MONO, new_inp_resamp16k, hb_speech, -Q1 ); -#else - wb_pre_proc_fx( st, EVS_MONO, new_inp_resamp16k, hb_speech ); -#endif } -#ifdef NONBE_FIX_ISSUE_2206 st->q_inp = -Q1; /* meaning Q0 */ move16(); -#endif IF( EQ_16( st->extl, WB_TBE ) ) { /* WB TBE encoder */ -#ifdef NONBE_FIX_ISSUE_2206 wb_tbe_enc_fx( st, hb_speech, -Q1, bwe_exc_extended, Q_new, voice_factors, pitch_buf ); -#else - wb_tbe_enc_fx( st, hb_speech, bwe_exc_extended, Q_new, voice_factors, pitch_buf ); -#endif IF( EQ_16( st->codec_mode, MODE2 ) ) { tbe_write_bitstream_fx( st ); @@ -452,11 +440,7 @@ ivas_error evs_enc_fx( ELSE IF( EQ_16( st->extl, WB_BWE ) ) { /* WB BWE encoder */ -#ifdef NONBE_FIX_ISSUE_2206 wb_bwe_enc_fx( st, new_inp_resamp16k, -Q1 ); -#else - wb_bwe_enc_fx( st, new_inp_resamp16k ); -#endif } /*---------------------------------------------------------------------* @@ -468,11 +452,7 @@ ivas_error evs_enc_fx( IF( !st->Opt_SC_VBR && GE_32( st->input_Fs, 32000 ) ) { /* Common pre-processing for SWB(FB) TBE and SWB BWE */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT swb_pre_proc_fx( st, new_swb_speech, shb_speech, NULL, realBuffer, imagBuffer, 0, &cldfbScale, NULL ); -#else - swb_pre_proc_fx( st, new_swb_speech, shb_speech, realBuffer, imagBuffer, 0, &cldfbScale, NULL ); -#endif } ELSE IF( GE_32( st->input_Fs, 32000 ) ) { @@ -548,11 +528,7 @@ ivas_error evs_enc_fx( test(); IF( st->Opt_DTX_ON && GE_16( input_frame, L_FRAME32k ) ) { -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT swb_CNG_enc_fx( st, shb_speech, 0, old_syn_12k8_16k ); -#else - swb_CNG_enc_fx( st, shb_speech, old_syn_12k8_16k ); -#endif } /*---------------------------------------------------------------------* diff --git a/lib_enc/ext_sig_ana_fx.c b/lib_enc/ext_sig_ana_fx.c index 33c2aa8f5f0cfb994620bb29f14447e4e6502e75..deb0b09945bad3a4049d62e036cc2c5a2de84c7d 100644 --- a/lib_enc/ext_sig_ana_fx.c +++ b/lib_enc/ext_sig_ana_fx.c @@ -473,14 +473,10 @@ void core_signal_analysis_high_bitrate_fx( *-------------------------------------------------------------------*/ void core_signal_analysis_high_bitrate_ivas_fx( -#ifdef NONBE_FIX_ISSUE_2206 const Word16 *new_samples, /*i : *Q_new-1 */ -#else - const Word16 *new_samples, /*i : Q0 */ -#endif - const Word16 T_op[3], /* i : open-loop pitch values for quantiz. Q0*/ - Word16 lsp_new[], /* Q15 */ - Word16 lsp_mid[], /* Q15 */ + const Word16 T_op[3], /* i : open-loop pitch values for quantiz. Q0*/ + Word16 lsp_new[], /* Q15 */ + Word16 lsp_mid[], /* Q15 */ Encoder_State *st, Word16 pTnsSize[], /* Q0 */ Word16 pTnsBits[], /* Q0 */ @@ -531,9 +527,6 @@ void core_signal_analysis_high_bitrate_ivas_fx( Word16 tmp, *tmpP16; Word16 q_mdstWin = st->q_inp, q_tcx20Win = st->q_inp; Word32 *tmpP32; -#ifndef NONBE_FIX_ISSUE_2206 - Word16 Q_exp; -#endif Word32 L_tmpbuf[N_MAX + L_MDCT_OVLP_MAX]; move16(); move16(); @@ -570,7 +563,6 @@ void core_signal_analysis_high_bitrate_ivas_fx( test(); IF( st->tcxonly && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { -#ifdef NONBE_FIX_ISSUE_2206 IF( st->element_mode > EVS_MONO ) { Word16 nq; @@ -590,11 +582,6 @@ void core_signal_analysis_high_bitrate_ivas_fx( /* st->new_speech_enc copied from new_samples in Q st->exp_buf_speech_enc This is considering new_samples is in q 0 in current code*/ } -#else - Copy_Scale_sig( new_samples, st->new_speech_enc, L_frame, sub( 15, st->exp_buf_speech_enc ) ); - /* st->new_speech_enc copied from new_samples in Q st->exp_buf_speech_enc - This is considering new_samples is in q 0 in current code*/ -#endif } /*--------------------------------------------------------------* @@ -630,7 +617,6 @@ void core_signal_analysis_high_bitrate_ivas_fx( test(); IF( st->tcxonly && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Word16 nexp; nexp = s_max( s_max( st->exp_buf_speech_enc, st->exp_buf_speech_enc_pe ), st->exp_mem_preemph_enc ); @@ -641,31 +627,10 @@ void core_signal_analysis_high_bitrate_ivas_fx( move16(); st->exp_buf_speech_enc_pe = nexp; move16(); -#else - Copy( st->speech_enc + st->encoderLookahead_enc, st->new_speech_enc_pe, L_frame ); // Assuming both exp_buf_speech_enc_pe and exp_buf_speech_enc are same -#endif preemph_fx( st->new_speech_enc_pe, st->preemph_fac, L_frame, &( st->mem_preemph_enc ) ); // using this to keep values alligned in Q-1 } -#ifndef NONBE_FIX_ISSUE_2206 - /* Rescale Memory */ - Q_exp = sub( *Q_new, st->prev_Q_new ); - move16(); - - Scale_sig( st->old_inp_16k_fx, L_INP_MEM, sub( *Q_new, sub( Q15, st->exp_old_inp_16k ) ) ); // *Q_new - st->exp_old_inp_16k = sub( Q15, *Q_new ); - move16(); - IF( Q_exp != 0 ) - { -#ifndef NONBE_FIX_ISSUE_2206 - Scale_sig( st->buf_speech_enc_pe, st->encoderPastSamples_enc + st->encoderLookahead_enc, sub( Q_exp, sub( Q15, st->exp_buf_speech_enc_pe ) ) ); // *Q_new - st->exp_buf_speech_enc_pe = sub( Q15, Q_exp ); - move16(); -#endif - Scale_sig( &( st->mem_wsp_enc ), 1, Q_exp ); // *Q_new - } -#endif IF( EQ_16( hTcxEnc->tcxMode, TCX_10 ) ) { diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index ba5ddaba5def326b9b8aa474ce64bf54fc78a7fa..8f2419ee4e60f087d4faa40c78e2e8d27241fbdc 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -394,12 +394,10 @@ ivas_error init_encoder_fx( st->Bin_E_old_fx = st->hSignalBuf->Bin_E_old_fx; st->mem_decim_fx = st->hSignalBuf->mem_decim_fx; st->mem_decim16k_fx = st->hSignalBuf->mem_decim16k_fx; -#ifdef NONBE_FIX_ISSUE_2206 st->q_mem_decim_fx = Q15; move16(); st->q_mem_decim16k_fx = Q15; move16(); -#endif st->old_inp_12k8_fx = st->hSignalBuf->old_inp_12k8_fx; st->old_inp_16k_fx = st->hSignalBuf->old_inp_16k_fx; st->buf_speech_enc_pe = st->hSignalBuf->buf_speech_enc_pe; diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 550e7656c07c2cf4b0086d8892adbe5683529386..0f00ec642b546783ff53537317247a94be5a42b6 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -49,16 +49,12 @@ *-------------------------------------------------------------------*/ ivas_error ivas_core_enc_fx( - SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ - const Word16 n_CoreChannels, /* i : number of core channels to be coded Q0*/ - Word16 old_inp_12k8_fx[][L_INP_12k8], /* i : buffer of old input signal Q_new-1*/ -#ifdef NONBE_FIX_ISSUE_2206 - Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q_new-1*/ -#else - Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q-1*/ -#endif + SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ + const Word16 n_CoreChannels, /* i : number of core channels to be coded Q0*/ + Word16 old_inp_12k8_fx[][L_INP_12k8], /* i : buffer of old input signal Q_new-1*/ + Word16 old_inp_16k_fx[][L_INP], /* i : buffer of old input signal Q_new-1*/ Word16 Q_new[], /* i : Q factor of speech buffers */ Word32 ener_fx[], /* i : residual energy from Levinson-Durbin epsP_fx_q*/ Word16 A_fx[][NB_SUBFR16k * ( M + 1 )], /* i : A(z) unquantized for the 4 subframes Q12*/ @@ -94,9 +90,7 @@ ivas_error ivas_core_enc_fx( Word16 *inp_fx[CPE_CHANNELS]; Word16 *shb_speech_fx; Word16 new_inp_resamp16k_fx[CPE_CHANNELS][L_FRAME16k]; /* new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ -#ifdef NONBE_FIX_ISSUE_2206 Word16 q_new_inp_resamp16k_fx[CPE_CHANNELS]; -#endif Word16 *hb_speech_fx; Word32 bwe_exc_extended_fx[CPE_CHANNELS][L_FRAME32k + NL_BUFF_OFFSET]; /* 2 * Q_new */ Word16 old_syn_12k8_16k_fx[CPE_CHANNELS][L_FRAME16k]; /* ACELP core synthesis at 12.8kHz or 16kHz to be used by the SWB BWE */ @@ -218,15 +212,9 @@ ivas_error ivas_core_enc_fx( move32(); } -#ifdef NONBE_FIX_ISSUE_2206 pre_proc_ivas_fx( st, last_element_mode, element_brate, last_element_brate_tmp, input_frame, old_inp_12k8_fx[n] /* i/o: Q_new - 1 */, old_inp_16k_fx[n] /* i/o: Q_new - 1 */, &inp_fx[n], &ener_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], &epsP_fx_q[n], lsp_new_fx[n], lsp_mid_fx[n], new_inp_resamp16k_fx[n], &q_new_inp_resamp16k_fx[n], &Voicing_flag[n], old_wsp_fx[n], e_old_wsp[n], loc_harm[n], vad_flag_dtx[n], MCT_flag, vad_hover_flag[n], flag_16k_smc, enerBuffer_fx[n], enerBuffer_fx_exp[n], fft_buff_fx[n], cor_map_sum_fx[n], &Q_new[n] ); -#else - pre_proc_ivas_fx( st, last_element_mode, element_brate, last_element_brate_tmp, input_frame, old_inp_12k8_fx[n] /* i: -1, o: Q_new - 1 */, old_inp_16k_fx[n] /* i: -1, o: Q_new - 1 */, - &inp_fx[n], &ener_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], &epsP_fx_q[n], lsp_new_fx[n], lsp_mid_fx[n], new_inp_resamp16k_fx[n], &Voicing_flag[n], old_wsp_fx[n], e_old_wsp[n], loc_harm[n], - vad_flag_dtx[n], MCT_flag, vad_hover_flag[n], flag_16k_smc, enerBuffer_fx[n], enerBuffer_fx_exp[n], fft_buff_fx[n], cor_map_sum_fx[n], &Q_new[n] ); -#endif test(); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) || EQ_16( st->element_mode, IVAS_SCE ) ) @@ -351,18 +339,8 @@ ivas_error ivas_core_enc_fx( Q_spec_old[1] = hCPE->hCoreCoder[1]->hTcxEnc->spectrum_long_e; move16(); -#ifndef NONBE_FIX_ISSUE_2206 - ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx_new, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id], - hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e ); -#else -#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, Q_new, old_wsp_fx, pitch_buf_fx, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id], hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e ); -#else - ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id], - hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e ); -#endif -#endif FOR( i = 0; i < CPE_CHANNELS; i++ ) { @@ -389,11 +367,7 @@ ivas_error ivas_core_enc_fx( } ELSE { -#if !defined( NONBE_FIX_ISSUE_2206 ) || defined( NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 ) stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, Q_new, old_wsp_fx, pitch_buf_fx ); -#else - stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx ); -#endif } } ELSE IF( EQ_32( sts[0]->core_brate, SID_2k40 ) && EQ_32( sts[1]->core_brate, SID_2k40 ) ) @@ -437,19 +411,10 @@ ivas_error ivas_core_enc_fx( IF( st->hBWE_FD != NULL ) { -#ifdef NONBE_FIX_ISSUE_2206 Word16 tmp = norm_arr( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k ); scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, tmp ); st->Q_old_wtda = add( st->Q_old_wtda, tmp ); move16(); -#else - Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( negate( 1 ), st->Q_old_wtda ) ); // Q(-1) - st->Q_old_wtda = -1; // This reset is required for resolving crash issue. Needs to be looked into further - move16(); - Scale_sig( st->hBWE_FD->old_input_lp_fx, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS ), sub( sub( Q_new[n], 1 ), st->hBWE_FD->prev_Q_input_lp ) ); /* Q_new[n] - 1 */ - st->hBWE_FD->prev_Q_input_lp = sub( Q_new[n], 1 ); - move16(); -#endif } /*---------------------------------------------------------------------* @@ -470,11 +435,7 @@ ivas_error ivas_core_enc_fx( IF( GE_32( input_Fs, 16000 ) && LT_16( st->bwidth, SWB ) && st->hBWE_TD != NULL ) { /* Common pre-processing for WB TBE and WB BWE */ -#ifdef NONBE_FIX_ISSUE_2206 wb_pre_proc_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx, q_new_inp_resamp16k_fx[n] ); -#else - wb_pre_proc_fx( st, last_element_mode, new_inp_resamp16k_fx[n], hb_speech_fx ); -#endif } test(); @@ -482,20 +443,12 @@ ivas_error ivas_core_enc_fx( IF( EQ_16( st->extl, WB_TBE ) ) { /* WB TBE encoder */ -#ifdef NONBE_FIX_ISSUE_2206 wb_tbe_enc_fx( st, hb_speech_fx, q_new_inp_resamp16k_fx[n], bwe_exc_extended_fx[n], Q_new[n], voice_factors_fx[n], pitch_buf_fx[n] ); -#else - wb_tbe_enc_fx( st, hb_speech_fx, bwe_exc_extended_fx[n], Q_new[n], voice_factors_fx[n], pitch_buf_fx[n] ); -#endif } ELSE IF( EQ_16( st->extl, WB_BWE ) && n == 0 && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { /* WB BWE encoder */ -#ifdef NONBE_FIX_ISSUE_2206 wb_bwe_enc_fx( st, new_inp_resamp16k_fx[n], q_new_inp_resamp16k_fx[n] ); -#else - wb_bwe_enc_fx( st, new_inp_resamp16k_fx[n] ); -#endif } /*---------------------------------------------------------------------* @@ -503,7 +456,6 @@ ivas_error ivas_core_enc_fx( * SWB(FB) BWE encoding *---------------------------------------------------------------------*/ -#ifdef NONBE_FIX_ISSUE_2206 test(); IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL ) { @@ -520,40 +472,20 @@ ivas_error ivas_core_enc_fx( st->q_inp = tmp; move16(); } -#else - Word16 q_inp_orig; - q_inp_orig = st->q_inp; - move16(); - test(); - IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL ) - { - st->q_inp = -1; - st->q_old_inp = -1; - move16(); - move16(); - Scale_sig( st->input_fx - input_frame, shl( input_frame, 1 ), sub( st->q_inp, q_inp_orig ) ); - } -#endif new_swb_speech_fx_16 = new_swb_speech_buffer_fx_16 + STEREO_DFT_OVL_MAX; set16_fx( new_swb_speech_buffer_fx_16, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); shb_speech_fx = new_inp_resamp16k_fx[n]; /* reuse existing buffer: shb_speech[L_FRAME16k] */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Word16 shb_speech_q = Q15; move16(); -#endif test(); IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL ) { /* Common pre-processing for SWB(FB) TBE and SWB(FB) BWE */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT shb_speech_q = st->hBWE_TD->old_speech_shb_q; move16(); swb_pre_proc_fx( st, new_swb_speech_fx_16, shb_speech_fx, &shb_speech_q, realBuffer_fx[n], imagBuffer_fx[n], q_re_im_buf[n], NULL, hCPE ); -#else - swb_pre_proc_fx( st, new_swb_speech_fx_16, shb_speech_fx, realBuffer_fx[n], imagBuffer_fx[n], q_re_im_buf[n], NULL, hCPE ); -#endif } ELSE IF( GE_32( input_Fs, 32000 ) ) { @@ -582,11 +514,7 @@ ivas_error ivas_core_enc_fx( Word16 Q_fb_exc; Word16 fb_exc_fx[L_FRAME16k]; -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT swb_tbe_enc_fx( st, hStereoICBWE, shb_speech_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], fb_exc_fx, &Q_fb_exc, Q_new[n], shb_speech_q, st->voicing_fx, pitch_buf_fx[n] ); -#else - swb_tbe_enc_fx( st, hStereoICBWE, shb_speech_fx, bwe_exc_extended_fx[n], voice_factors_fx[n], fb_exc_fx, &Q_fb_exc, Q_new[n], 0, st->voicing_fx, pitch_buf_fx[n] ); -#endif IF( EQ_16( st->extl, FB_TBE ) ) { @@ -598,16 +526,11 @@ ivas_error ivas_core_enc_fx( ELSE IF( EQ_16( st->extl, SWB_BWE ) || EQ_16( st->extl, FB_BWE ) ) { /* SWB(FB) BWE encoder */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT swb_bwe_enc_fx( st, last_element_mode, old_inp_12k8_fx[n], old_inp_16k_fx[n], old_syn_12k8_16k_fx[n], new_swb_speech_fx_16, st->q_inp, shb_speech_fx, shb_speech_q, sub( Q_new[n], 1 ) ); -#else - swb_bwe_enc_fx( st, last_element_mode, old_inp_12k8_fx[n], old_inp_16k_fx[n], old_syn_12k8_16k_fx[n], new_swb_speech_fx_16, st->q_inp, shb_speech_fx, 0, sub( Q_new[n], 1 ) ); -#endif } Scale_sig( old_syn_12k8_16k_fx[n], L_FRAME16k, sub( Q1, Q_new[n] ) ); // Q0 -#ifdef NONBE_FIX_ISSUE_2206 test(); IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL ) { @@ -616,14 +539,6 @@ ivas_error ivas_core_enc_fx( st->q_inp = add( st->q_inp, 1 ); move16(); } -#else - IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL ) - { - Scale_sig( st->input_fx, input_frame, sub( q_inp_orig, st->q_inp ) ); - st->q_inp = q_inp_orig; - move16(); - } -#endif /*---------------------------------------------------------------------* * SWB DTX/CNG encoding @@ -635,11 +550,7 @@ ivas_error ivas_core_enc_fx( IF( st->hTdCngEnc != NULL && st->Opt_DTX_ON && ( GE_16( input_frame, L_FRAME32k ) || EQ_16( st->element_mode, IVAS_CPE_DFT ) ) ) { /* SHB DTX/CNG encoder */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT swb_CNG_enc_fx( st, shb_speech_fx, shb_speech_q, old_syn_12k8_16k_fx[n] ); -#else - swb_CNG_enc_fx( st, shb_speech_fx, old_syn_12k8_16k_fx[n] ); -#endif } /*-------------------------------------------------------------------* @@ -652,11 +563,7 @@ ivas_error ivas_core_enc_fx( { stereo_icBWE_preproc_fx( hCPE, input_frame, new_swb_speech_buffer_fx_16 /*tmp buffer*/, st->q_inp ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT stereo_icBWE_enc_fx( hCPE, shb_speech_fx, shb_speech_q, new_swb_speech_buffer_fx_16, st->q_inp, voice_factors_fx[0] ); -#else - stereo_icBWE_enc_fx( hCPE, shb_speech_fx, new_swb_speech_buffer_fx_16, st->q_inp, voice_factors_fx[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 0cb69bfdec2075472ef8dee0efc065ccaf1b6b78..016e6adfe607156c510afdd0bf3e7dfc73b464c3 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -77,18 +77,14 @@ static Word16 get_zero_flag( const Word32 arr[], const Word16 len ) *--------------------------------------------------------------------*/ void pre_proc_front_ivas_fx( - SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const Word32 element_brate, /* i : SCE/CPE element bitrate Q0*/ - const Word16 nb_bits_metadata, /* i : number of metadata bits Q0*/ - const Word16 input_frame, /* i : frame length Q0*/ - const Word16 n, /* i : channel number Q0*/ - Word16 old_inp_12k8_fx[], /* o : buffer of old input signal (st->Q_inp until preemph, then Q_new, then Q_new-1 towards the end)*/ -#ifdef NONBE_FIX_ISSUE_2206 - Word16 old_inp_16k_fx[], /* o : buffer of old input signal @16kHz (st->Q_inp until preemph, then Q_new, then Q_new-1 towards the end)*/ -#else - Word16 old_inp_16k_fx[], /* o : buffer of old input signal @16kHz Q_new-1*/ -#endif + SCE_ENC_HANDLE hSCE, /* i/o: SCE encoder structure */ + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const Word32 element_brate, /* i : SCE/CPE element bitrate Q0*/ + const Word16 nb_bits_metadata, /* i : number of metadata bits Q0*/ + const Word16 input_frame, /* i : frame length Q0*/ + const Word16 n, /* i : channel number Q0*/ + Word16 old_inp_12k8_fx[], /* o : buffer of old input signal (st->Q_inp until preemph, then Q_new, then Q_new-1 towards the end)*/ + Word16 old_inp_16k_fx[], /* o : buffer of old input signal @16kHz (st->Q_inp until preemph, then Q_new, then Q_new-1 towards the end)*/ Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ Word16 *relE_fx, /* o : frame relative energy Q8*/ Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* o : A(z) unquantized for the 4 subframes Q12*/ @@ -344,7 +340,6 @@ void pre_proc_front_ivas_fx( move16(); } -#ifdef NONBE_FIX_ISSUE_2206 Word16 Q_old_in = st->q_inp; move16(); @@ -352,13 +347,11 @@ void pre_proc_front_ivas_fx( Q_min = add( sub( 15, st->exp_old_inp_12k8 ), norm_arr( st->old_inp_12k8_fx, L_INP_MEM ) ); input_frame_full = shl( input_frame, 1 ); //(old frame input length + new frame input length) Q_min = s_min( Q_min, sub( add( L_norm_arr( st->input32_fx - input_frame, input_frame_full ), st->q_inp32 ), 16 ) ); -#ifdef NONBE_FIX_ISSUE_2206_TV1 /* Take into account resampling memory for Q_min, and 1 bit headroom for resampling overshoot. */ IF( NE_32( input_Fs, INT_FS_12k8 ) ) { Q_min = sub( s_min( Q_min, add( st->mem_q, norm_arr( st->mem_decim_fx_q_inp, 2 * L_FILT_MAX ) ) ), Q1 ); } -#endif /* Limit Q_min to avoid rescale larger than 15 against Q-1 */ Q_min = s_min( Q14, Q_min ); Copy_Scale_sig_32_16_nosat( st->input32_fx - input_frame, st->input_fx - input_frame, input_frame_full, s_max( -31, sub( Q_min, st->q_inp32 ) ) ); // Q_min @@ -369,17 +362,6 @@ void pre_proc_front_ivas_fx( scale_sig( old_inp_12k8_fx, L_INP_12k8, sub( st->q_inp, Q_old_in ) ); scale_sig( old_inp_16k_fx, L_INP, sub( st->q_inp, Q_old_in ) ); -#else - Q_min = add( sub( 15, st->exp_old_inp_12k8 ), norm_arr( st->old_inp_12k8_fx, L_INP_MEM ) ); - input_frame_full = shl( input_frame, 1 ); //(old frame input length + new frame input length) - Q_min = s_min( Q_min, sub( add( getScaleFactor32( st->input32_fx - input_frame, input_frame_full ), st->q_inp32 ), 16 ) ); - Q_min = s_max( -2, Q_min ); - Copy_Scale_sig_32_16( st->input32_fx - input_frame, st->input_fx - input_frame, input_frame_full, sub( Q_min, st->q_inp32 ) ); // Q_min - st->q_inp = Q_min; - move16(); - st->q_old_inp = Q_min; - move16(); -#endif L_look = L_LOOK_12k8; /* lookahead at 12.8kHz */ move16(); @@ -394,27 +376,15 @@ void pre_proc_front_ivas_fx( IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - STEREO_DFT_OVL_12k8, sub( st->q_inp, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* st->q_inp */ -#else - Copy_Scale_sig( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - STEREO_DFT_OVL_12k8, sub( st->q_inp, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* st->q_inp */ -#endif } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->old_inp_12k8_fx, old_inp_12k8_fx, sub( L_INP_MEM - L_FILT, lMemRecalc_12k8 ), sub( st->q_inp, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* st->q_inp */ -#else - Copy_Scale_sig( st->old_inp_12k8_fx, old_inp_12k8_fx, sub( L_INP_MEM - L_FILT, lMemRecalc_12k8 ), sub( st->q_inp, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* st->q_inp */ -#endif } ELSE { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - L_FILT, sub( st->q_inp, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* st->q_inp */ -#else - Copy_Scale_sig( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - L_FILT, sub( st->q_inp, sub( Q15, st->exp_old_inp_12k8 ) ) ); /* st->q_inp */ -#endif } Copy( st->old_wsp_fx, old_wsp_fx, L_WSP_MEM ); /* exp(st->exp_old_wsp) */ @@ -478,38 +448,20 @@ void pre_proc_front_ivas_fx( * (if not available from downsampled DMX) *----------------------------------------------------------------*/ -#ifdef NONBE_FIX_ISSUE_2206 scale_sig( st->mem_decim_fx_q_inp, 2 * L_FILT_MAX, sub( st->q_inp, st->mem_q ) ); /* st->q_inp */ st->mem_q = st->q_inp; move16(); -#else - Scale_sig( st->mem_decim_fx_q_inp, 2 * L_FILT_MAX, sub( st->q_inp, st->mem_q ) ); /* st->q_inp */ -#endif test(); IF( EQ_16( element_mode, IVAS_SCE ) ) { new_inp_out_size = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_12k8_fx, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#else - Scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ - st->mem_q = st->q_inp; - move16(); -#endif + scale_sig( new_inp_12k8_fx, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#ifdef NONBE_FIX_ISSUE_2206 Copy( st->mem_decim_fx_q_inp, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* q_inp */ -#else - Copy( st->mem_decim_fx_q_inp, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ -#endif set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#else - Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#endif + scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_MDCT ) ) { @@ -521,24 +473,12 @@ void pre_proc_front_ivas_fx( Word16 length_12k8 = NS2SA( INT_FS_12k8, L_MEM_RECALC_SCH_NS ); new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#else - Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#endif + scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ } new_inp_out_size = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx_q_inp, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#ifndef NONBE_FIX_ISSUE_2206 - st->mem_q = st->q_inp; - move16(); -#endif - Copy( st->mem_decim_fx_q_inp, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* st->q_inp */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_12k8_fx - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#else - Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#endif + Copy( st->mem_decim_fx_q_inp, mem_decim_dummy_fx, 2 * L_FILT_MAX ); /* st->q_inp */ + scale_sig( new_inp_12k8_fx - lMemRecalc_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ IF( lMemRecalc > 0 ) { @@ -547,31 +487,14 @@ void pre_proc_front_ivas_fx( } set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); new_inp_out_size = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_12k8_fx + L_FRAME, INT_FS_12k8, mem_decim_dummy_fx, 0, &Q_new_inp, &mem_decim_size ); /* st->q_inp */ -#ifdef NONBE_FIX_ISSUE_2206 /* The scaling below can saturate if Q_new_inp <= -2 */ scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#else - Scale_sig( new_inp_12k8_fx + L_FRAME, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to st->q_inp*/ -#endif } ELSE /* DFT stereo */ { /* update the FIR resampling filter memory, needed for switching to time-domain (FIR) resampling */ Copy( signal_in_fx + sub( input_frame, add( NS2SA_FX2( input_Fs, L_MEM_RECALC_NS ), 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ) ), st->mem_decim_fx_q_inp, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* st->q_inp */ -#ifndef NONBE_FIX_ISSUE_2206 - st->mem_q = st->q_inp; - move16(); - scale_sig( old_inp_12k8_fx, L_INP_MEM - STEREO_DFT_OVL_12k8, sub( Q_inp_const, st->q_inp ) ); - scale_sig( st->input_fx - input_frame, input_frame_full, sub( Q_inp_const, st->q_inp ) ); - Copy_Scale_sig( st->mem_decim_fx_q_inp, st->mem_decim_fx, 2 * L_FILT_MAX, sub( Q_inp_const, st->q_inp ) ); /* Q(-1) */ - // Scale_sig( st->mem_decim_fx, 2 * L_FILT_MAX, sub( Q_inp_const, st->q_inp ) ); /* Q(-1) */ - st->q_inp = Q_inp_const; - move16(); - st->q_old_inp = Q_inp_const; - move16(); -#endif } -#ifdef NONBE_FIX_ISSUE_2206 st->q_mem_decim_fx = add( st->q_inp, norm_arr( st->mem_decim_fx_q_inp, 2 * L_FILT_MAX ) ); move16(); Copy_Scale_sig_nosat( st->mem_decim_fx_q_inp, st->mem_decim_fx, 2 * L_FILT_MAX, sub( st->q_mem_decim_fx, st->q_inp ) ); @@ -597,31 +520,6 @@ void pre_proc_front_ivas_fx( { Copy_Scale_sig_nosat( new_inp_12k8_fx, st->buf_speech_enc + L_FRAME32k, L_FRAME, sub( q_buf_speech_enc, st->q_inp ) ); /* q_buf_speech_enc */ } -#else - IF( NE_16( Q_inp_const, st->q_inp ) ) - { - Copy_Scale_sig( st->mem_decim_fx_q_inp, st->mem_decim_fx, 2 * L_FILT_MAX, sub( Q_inp_const, st->q_inp ) ); /* Q(-1) */ - } - - Scale_sig( st->buf_speech_enc, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( -1, sub( 15, st->exp_buf_speech_enc ) ) ); /* Q(-1) */ - st->exp_buf_speech_enc = 16; - move16(); - - /* save input resampled at 12.8kHz, non-preemhasised */ - test(); - IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) - { - Copy_Scale_sig( new_inp_12k8_fx - STEREO_DFT_OVL_12k8, st->buf_speech_enc + L_FRAME32k - STEREO_DFT_OVL_12k8, L_FRAME + STEREO_DFT_OVL_12k8, sub( Q_inp_const, st->q_inp ) ); /* Q_inp_const */ - } - ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_MDCT ) ) - { - Copy_Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8, st->buf_speech_enc + L_FRAME32k - lMemRecalc_12k8 - L_FILT, add( L_FRAME + L_FILT, lMemRecalc_12k8 ), sub( Q_inp_const, st->q_inp ) ); /* Q_inp_const */ - } - ELSE - { - Copy_Scale_sig( new_inp_12k8_fx, st->buf_speech_enc + L_FRAME32k, L_FRAME, sub( Q_inp_const, st->q_inp ) ); /* Q_inp_const */ - } -#endif /*------------------------------------------------------------------* * Perform fixed preemphasis (12.8 kHz signal) through 1 - g*z^-1 @@ -744,9 +642,7 @@ void pre_proc_front_ivas_fx( Copy_Scale_sig32_16( sig_out, preemp_start_idx, preemp_len, sub( add( *Q_new, 1 ), st->q_inp ) ); /* Q_new */ Scale_sig( old_inp_12k8_fx, (Word16) ( preemp_start_idx - old_inp_12k8_fx ), sub( *Q_new, st->q_inp ) ); /* Q_new */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( old_inp_16k_fx, L_INP, sub( *Q_new, st->q_inp ) ); /* Q_new */ -#endif + scale_sig( old_inp_16k_fx, L_INP, sub( *Q_new, st->q_inp ) ); /* Q_new */ cldfbScale.hb_scale = cldfbScale.lb_scale; move16(); @@ -872,11 +768,7 @@ void pre_proc_front_ivas_fx( IF( st->idchan == 0 && NE_16( element_mode, IVAS_CPE_MDCT ) ) { Word16 input_fx_tmp[480]; -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( st->input_fx, input_fx_tmp, shr( input_frame, 1 ), negate( st->q_inp ) ); /*scaling from st->q_inp to q0*/ -#else - Copy_Scale_sig( st->input_fx, input_fx_tmp, shr( input_frame, 1 ), negate( st->q_inp ) ); /*scaling from Q_inp_const to q0*/ -#endif bw_detect_fx( st, input_fx_tmp, NULL, enerBuffer_fx, sf_energySum, ivas_format, 0, 0 ); } @@ -1527,49 +1419,14 @@ void pre_proc_front_ivas_fx( IF( flag_16k_smc ) { -#ifdef NONBE_FIX_ISSUE_2206 Word16 Q_old_inp_16k = sub( *Q_new, 1 ); move16(); Word16 Q_old_inp_12k8 = sub( *Q_new, 1 ); move16(); -#else - Word16 Q_old_inp_16k = -1; - move16(); - - Scale_sig( st->old_inp_16k_fx, L_INP_MEM, sub( Q_old_inp_16k, sub( Q15, st->exp_old_inp_16k ) ) ); /* Q15 - Q_old_inp_16k */ - st->exp_old_inp_16k = sub( Q15, Q_old_inp_16k ); - move16(); - - IF( st->hBWE_FD != NULL ) - { - Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( -1, st->Q_old_wtda ) ); /* Q(-1) */ - st->Q_old_wtda = -1; // This reset needs to be looked into - move16(); - } - st->mem_preemph_enc = shl( st->mem_preemph_enc, sub( Q_old_inp_16k, sub( Q15, st->exp_mem_preemph_enc ) ) ); /* Q15 - Q_old_inp_16k */ - move16(); - st->exp_mem_preemph_enc = sub( Q15, Q_old_inp_16k ); - move16(); - Scale_sig( st->buf_wspeech_enc, L_FRAME16k + L_SUBFR + L_FRAME16k + L_NEXT_MAX_16k + 320, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_wspeech_enc ) ) ); /* Q15 - Q_old_inp_16k */ - st->mem_wsp_enc = shl( st->mem_wsp_enc, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_wspeech_enc ) ) ); // Q_old_inp_16k - move16(); - st->exp_buf_wspeech_enc = sub( Q15, Q_old_inp_16k ); - move16(); - Scale_sig( st->buf_speech_enc_pe, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_speech_enc_pe ) ) ); /* Q15 - Q_old_inp_16k */ - st->exp_buf_speech_enc_pe = sub( Q15, Q_old_inp_16k ); - move16(); - Scale_sig( st->buf_speech_enc, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_speech_enc ) ) ); /* Q15 - Q_old_inp_16k */ - st->exp_buf_speech_enc = sub( Q15, Q_old_inp_16k ); - move16(); - - Word16 Q_old_inp_12k8 = *Q_new; - move16(); -#endif /* Compute core-coder buffers at internal sampling rate */ ivas_compute_core_buffers_fx( st, NULL, old_inp_16k_fx, NULL, input_frame, IVAS_SCE /*last_element_mode*/, INT_FS_16k /*sr_core_tmp*/, ener_fx, A_fx, Aw_fx, epsP_fx, lsp_new_fx, lsp_mid_fx, Q_old_inp_16k, Q_r, Q_new ); -#ifdef NONBE_FIX_ISSUE_2206 IF( GT_16( *Q_new, Q_old_inp_12k8 ) ) { scale_sig( old_inp_16k_fx, L_INP, sub( Q_old_inp_12k8, *Q_new ) ); @@ -1581,47 +1438,21 @@ void pre_proc_front_ivas_fx( *Q_new = *Q_new; } move16(); -#endif *epsP_fx_q = add( Q_r[0], 1 ); move16(); -#ifndef NONBE_FIX_ISSUE_2206 - st->mem_wsp_enc = shl( st->mem_wsp_enc, sub( 0, sub( Q15, st->exp_buf_wspeech_enc ) ) ); // Q0 - move16(); -#endif *Q_new = add( *Q_new, Q_inp_const ); // actual Q_new move16(); -#ifdef NONBE_FIX_ISSUE_2206 assert( ( *Q_new - 1 ) <= Q_old_inp_12k8 ); scale_sig( old_inp_12k8_fx, L_INP_12k8, sub( sub( *Q_new, 1 ), Q_old_inp_12k8 ) ); /* Q_new-1 */ smc_dec = ivas_acelp_tcx20_switching_fx( st, st->speech_enc, sub( Q15, st->exp_buf_speech_enc ), st->wspeech_enc, sub( Q15, st->exp_buf_wspeech_enc ), non_staX_fx, pitch_fr_fx, voicing_fr_fx, currFlatness_fx, lsp_mid_fx, stab_fac_fx, res_cod_SNR_M_fx, res_cod_SNR_M_fx_e, flag_16k_smc ); -#else - Scale_sig( old_inp_12k8_fx, L_INP_12k8, sub( *Q_new, Q_old_inp_12k8 ) ); /* Q_new */ - - Scale_sig( st->buf_speech_enc, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( 0, sub( Q15, st->exp_buf_speech_enc ) ) ); /* Q0 */ - st->exp_buf_speech_enc = Q15; - move16(); - Scale_sig( st->buf_wspeech_enc, L_FRAME16k + L_SUBFR + L_FRAME16k + L_NEXT_MAX_16k + 320, sub( 0, sub( Q15, st->exp_buf_wspeech_enc ) ) ); /* Q0 */ - st->exp_buf_wspeech_enc = Q15; - move16(); - smc_dec = ivas_acelp_tcx20_switching_fx( st, st->speech_enc, 0, st->wspeech_enc, non_staX_fx, pitch_fr_fx, voicing_fr_fx, currFlatness_fx, lsp_mid_fx, stab_fac_fx, res_cod_SNR_M_fx, res_cod_SNR_M_fx_e, flag_16k_smc ); /* Q0 */ -#endif } ELSE { -#ifdef NONBE_FIX_ISSUE_2206 smc_dec = ivas_acelp_tcx20_switching_fx( st, inp_12k8_fx, *Q_new, wsp_fx, *q_old_wsp, non_staX_fx, pitch_fr_fx, voicing_fr_fx, currFlatness_fx, lsp_mid_fx, stab_fac_fx, res_cod_SNR_M_fx, res_cod_SNR_M_fx_e, flag_16k_smc ); /* Q0 */ -#else - Scale_sig( old_wsp_fx, L_WSP, sub( *Q_new, *q_old_wsp ) ); /* Q_new */ - *q_old_wsp = *Q_new; - move16(); - Q_wsp = *Q_new; - move16(); - smc_dec = ivas_acelp_tcx20_switching_fx( st, inp_12k8_fx, *Q_new, wsp_fx, non_staX_fx, pitch_fr_fx, voicing_fr_fx, currFlatness_fx, lsp_mid_fx, stab_fac_fx, res_cod_SNR_M_fx, res_cod_SNR_M_fx_e, flag_16k_smc ); /* Q0 */ -#endif } } /* Switch to ACELP for non-harmonic transient signals */ diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index 2ca70b60579a9bed9aadb50021c80466cd72ba5f..28ef7d7d6faff4b10a81d6b80e9b6372d10c9e2c 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -47,31 +47,23 @@ *--------------------------------------------------------------------*/ void pre_proc_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - const Word16 last_element_mode, /* i : last element mode Q0*/ - const Word32 element_brate, /* i : element bitrate Q0*/ - const Word32 last_element_brate, /* i : last element bitrate Q0*/ - const Word16 input_frame, /* i : frame length Q0*/ - Word16 old_inp_12k8_fx[], /* i/o: buffer of old input signal Q_new-1 */ -#ifdef NONBE_FIX_ISSUE_2206 - Word16 old_inp_16k_fx[], /* i/o: buffer of old input signal @ 16kHz Q_new */ -#else - Word16 old_inp_16k_fx[], /* i/o: buffer of old input signal @ 16kHz Q_new-1 */ -#endif - Word16 **inp_fx, /* o : ptr. to inp. signal in the current frame Q_new*/ - Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ - Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes Q12*/ - Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes Q14*/ - Word32 epsP_fx[M + 1], /* i : LP prediction errors epsP_fx_q*/ - Word16 *epsP_fx_q, /* i : LP prediction errors */ - Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame Q15*/ - Word16 lsp_mid_fx[M], /* i/o: LSPs in the middle of the frame Q15*/ -#ifdef NONBE_FIX_ISSUE_2206 - Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE q_new_inp_resamp16k_fx*/ - Word16 *q_new_inp_resamp16k_fx, /* o : Q value of new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ -#else - Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE Q_new-1*/ -#endif + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 last_element_mode, /* i : last element mode Q0*/ + const Word32 element_brate, /* i : element bitrate Q0*/ + const Word32 last_element_brate, /* i : last element bitrate Q0*/ + const Word16 input_frame, /* i : frame length Q0*/ + Word16 old_inp_12k8_fx[], /* i/o: buffer of old input signal Q_new-1 */ + Word16 old_inp_16k_fx[], /* i/o: buffer of old input signal @ 16kHz Q_new */ + Word16 **inp_fx, /* o : ptr. to inp. signal in the current frame Q_new*/ + Word32 *ener_fx, /* o : residual energy from Levinson-Durbin epsP_fx_q*/ + Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes Q12*/ + Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes Q14*/ + Word32 epsP_fx[M + 1], /* i : LP prediction errors epsP_fx_q*/ + Word16 *epsP_fx_q, /* i : LP prediction errors */ + Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame Q15*/ + Word16 lsp_mid_fx[M], /* i/o: LSPs in the middle of the frame Q15*/ + Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE q_new_inp_resamp16k_fx*/ + Word16 *q_new_inp_resamp16k_fx, /* o : Q value of new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ Word16 *Voicing_flag, /* o : voicing flag for HQ FEC Q0*/ Word16 old_wsp_fx[], /* i : weighted input signal buffer e_old_wsp*/ const Word16 e_old_wsp, /* i : Q value of weighted input signal buffer */ @@ -557,18 +549,13 @@ void pre_proc_ivas_fx( inp_16k_fx = old_inp_16k_fx + L_INP_MEM - L_look; -#ifdef NONBE_FIX_ISSUE_2206 Word16 Q_old_inp_16k = sub( *Q_new, 1 ); -#else - Word16 Q_old_inp_16k = -1; -#endif move16(); Word16 Q_r[2] = { 0 }; move16(); move16(); inp_16k_fx = old_inp_16k_fx + L_INP_MEM - L_look; -#ifdef NONBE_FIX_ISSUE_2206 Word16 shift = norm_arr( st->old_inp_12k8_fx, L_INP_MEM ); scale_sig( st->old_inp_12k8_fx, L_INP_MEM, shift ); /* exp(st->exp_old_inp_12k8 - shift) */ st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); @@ -584,74 +571,28 @@ void pre_proc_ivas_fx( st->Q_old_wtda = add( st->Q_old_wtda, shift ); move16(); } -#else - Word16 shift = getScaleFactor16( st->old_inp_12k8_fx, L_INP_MEM ); - Scale_sig( st->old_inp_12k8_fx, L_INP_MEM, shift ); /* exp(st->exp_old_inp_12k8 - shift) */ - st->exp_old_inp_12k8 = sub( st->exp_old_inp_12k8, shift ); - move16(); - - Scale_sig( st->old_inp_16k_fx, L_INP_MEM, sub( Q_old_inp_16k, sub( Q15, st->exp_old_inp_16k ) ) ); /* Q15 - st->exp_old_inp_16k */ - st->exp_old_inp_16k = sub( Q15, Q_old_inp_16k ); - move16(); - - IF( st->hBWE_FD != NULL ) - { - Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( -1, st->Q_old_wtda ) ); /* -1Q */ - st->Q_old_wtda = -1; // This reset needs to be looked into - move16(); - } - - st->mem_preemph_enc = shl( st->mem_preemph_enc, sub( Q_old_inp_16k, sub( Q15, st->exp_mem_preemph_enc ) ) ); /* Q15 - Q_old_inp_16k */ - move16(); - st->exp_mem_preemph_enc = sub( Q15, Q_old_inp_16k ); - move16(); - Scale_sig( st->buf_speech_enc, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_speech_enc ) ) ); /* Q15 - Q_old_inp_16k */ - st->exp_buf_speech_enc = sub( Q15, Q_old_inp_16k ); - move16(); - Scale_sig( st->buf_speech_enc_pe, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_speech_enc_pe ) ) ); /* Q15 - Q_old_inp_16k */ - st->exp_buf_speech_enc_pe = sub( Q15, Q_old_inp_16k ); - move16(); - Scale_sig( st->buf_wspeech_enc, L_FRAME16k + L_SUBFR + L_FRAME16k + L_NEXT_MAX_16k + 320, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_wspeech_enc ) ) ); /* Q15 - Q_old_inp_16k */ - st->mem_wsp_enc = shl( st->mem_wsp_enc, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_wspeech_enc ) ) ); // Q_old_inp_16k - move16(); - st->exp_buf_wspeech_enc = sub( Q15, Q_old_inp_16k ); - move16(); -#endif IF( !flag_16k_smc ) { Word16 Q_inp_12k8 = *Q_new; move16(); -#ifdef NONBE_FIX_ISSUE_2206 Word16 Q_inp_16k = *Q_new; move16(); -#else - Word16 Q_inp_16k; -#endif ivas_compute_core_buffers_fx( st, &inp_16k_fx, old_inp_16k_fx, new_inp_resamp16k_fx, input_frame, last_element_mode, sr_core_tmp, ener_fx, A_fx, Aw_fx, epsP_fx, lsp_new_fx, lsp_mid_fx, Q_old_inp_16k, Q_r, &Q_inp_16k ); IF( GT_16( Q_inp_16k, Q_inp_12k8 ) ) { -#ifdef NONBE_FIX_ISSUE_2206 scale_sig( old_inp_16k_fx, L_INP, sub( Q_inp_12k8, Q_inp_16k ) ); -#else - Scale_sig( old_inp_16k_fx, L_INP, sub( Q_inp_12k8, Q_inp_16k ) ); -#endif *Q_new = Q_inp_12k8; } ELSE { -#ifdef NONBE_FIX_ISSUE_2206 scale_sig( old_inp_12k8_fx, L_INP_12k8, sub( Q_inp_16k, Q_inp_12k8 ) ); -#else - Scale_sig( old_inp_12k8_fx, L_INP_12k8, sub( Q_inp_16k, Q_inp_12k8 ) ); -#endif *Q_new = Q_inp_16k; } move16(); -#ifdef NONBE_FIX_ISSUE_2206 IF( ( EQ_32( sr_core_tmp, INT_FS_16k ) && NE_16( element_mode, IVAS_CPE_MDCT ) ) || ( GT_32( sr_core_tmp, INT_FS_16k ) ) ) { shift = norm_arr( new_inp_resamp16k_fx, L_FRAME16k ); @@ -662,7 +603,6 @@ void pre_proc_ivas_fx( move16(); } -#endif test(); IF( EQ_16( st->L_frame, L_FRAME16k ) && NE_16( element_mode, IVAS_CPE_MDCT ) ) { @@ -675,7 +615,6 @@ void pre_proc_ivas_fx( IF( !( EQ_16( st->L_frame, L_FRAME16k ) && NE_16( element_mode, IVAS_CPE_MDCT ) ) ) { /* update signal buffers */ -#ifdef NONBE_FIX_ISSUE_2206 Word16 tmp; tmp = add( norm_arr( new_inp_12k8_fx, L_FRAME ), sub( *Q_new, 1 ) ); tmp = s_min( tmp, add( norm_arr( st->buf_speech_enc_pe, st->L_frame ), sub( Q15, st->exp_buf_speech_enc_pe ) ) ); @@ -685,9 +624,6 @@ void pre_proc_ivas_fx( scale_sig( st->buf_speech_enc_pe + st->L_frame + L_FRAME, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k - st->L_frame - L_FRAME, sub( tmp, sub( Q15, st->exp_buf_speech_enc_pe ) ) ); Copy_Scale_sig_nosat( new_inp_12k8_fx, st->buf_speech_enc_pe + st->L_frame, L_FRAME, sub( tmp, sub( *Q_new, 1 ) ) ); st->exp_buf_speech_enc_pe = sub( Q15, tmp ); -#else - Copy_Scale_sig( new_inp_12k8_fx, st->buf_speech_enc_pe + st->L_frame, L_FRAME, sub( sub( Q15, st->exp_buf_speech_enc_pe ), sub( *Q_new, Q1 ) ) ); -#endif Copy( st->buf_speech_enc + L_FRAME32k, st->buf_speech_enc + st->L_frame, L_FRAME ); test(); @@ -706,7 +642,6 @@ void pre_proc_ivas_fx( IF( st->tcxonly == 0 ) { -#ifdef NONBE_FIX_ISSUE_2206 // L_FRAME16k + L_SUBFR + L_FRAME16k + L_NEXT_MAX_16k + 320 ); tmp = add( norm_arr( wsp_fx, L_FRAME + L_LOOK_12k8 ), sub( Q15, e_old_wsp ) ); tmp = s_min( tmp, add( norm_arr( &st->mem_wsp_enc, 1 ), sub( Q15, st->exp_buf_wspeech_enc ) ) ); @@ -719,21 +654,14 @@ void pre_proc_ivas_fx( st->mem_wsp_enc = shl( st->mem_wsp_enc, sub( st->exp_buf_wspeech_enc, sub( Q15, tmp ) ) ); st->exp_buf_wspeech_enc = sub( Q15, tmp ); move16(); -#else - Copy( wsp_fx, st->wspeech_enc, L_FRAME + L_LOOK_12k8 ); -#endif } } IF( flag_16k_smc ) { -#ifdef NONBE_FIX_ISSUE_2206 *q_new_inp_resamp16k_fx = sub( Q15, st->exp_buf_speech_enc ); move16(); Copy( st->buf_speech_enc + L_FRAME16k, new_inp_resamp16k_fx, L_FRAME16k ); /* q_new_inp_resamp16k_fx */ -#else - Copy( st->buf_speech_enc + L_FRAME16k, new_inp_resamp16k_fx, L_FRAME16k ); /* Q_old_inp_16k */ -#endif } /*-----------------------------------------------------------------* @@ -792,13 +720,9 @@ void pre_proc_ivas_fx( *--------------------------------------------------------------------*/ void ivas_compute_core_buffers_fx( - Encoder_State *st, /* i/o: encoder state structure */ - Word16 **inp16k_out_fx, /* o : ptr. to inp. signal in the current frame Q_new-1*/ -#ifdef NONBE_FIX_ISSUE_2206 - Word16 *old_inp_16k_fx, /* i/o: buffer of old input signal @ 16kHz in Q_old_inp_16k = Q_new, out Q_new-1 */ -#else - Word16 *old_inp_16k_fx, /* i/o: buffer of old input signal @ 16kHz Q_new-1*/ -#endif + Encoder_State *st, /* i/o: encoder state structure */ + Word16 **inp16k_out_fx, /* o : ptr. to inp. signal in the current frame Q_new-1*/ + Word16 *old_inp_16k_fx, /* i/o: buffer of old input signal @ 16kHz in Q_old_inp_16k = Q_new, out Q_new-1 */ Word16 new_inp_resamp16k_out_fx[], /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE Q_old_inp_16k*/ const Word16 input_frame, /* i : frame length Q0*/ const Word16 last_element_mode, /* i : last element mode Q0*/ @@ -825,27 +749,16 @@ void ivas_compute_core_buffers_fx( Word16 Q_tmp, mem_decim16k_size, size_modified; Word16 epsP_h[M + 1]; Word16 epsP_l[M + 1]; -#ifdef NONBE_FIX_ISSUE_2206 Word16 i, shift; -#else - Word16 i, shift, Q_min; -#endif Word16 preemp_len; Word16 *preemp_start_idx = NULL; Word32 sig_out[STEREO_DFT_OVL_16k + L_FRAME16k + L_FILT16k]; -#ifdef NONBE_FIX_ISSUE_2206 assert( Q_old_inp_16k == ( *Q_new - 1 ) ); Copy_Scale_sig_nosat( st->input_fx - input_frame, input_buf_fx, input_frame, sub( Q_old_inp_16k, st->q_old_inp ) ); Copy_Scale_sig_nosat( st->input_fx, input_buf_fx + input_frame, input_frame, sub( Q_old_inp_16k, st->q_inp ) ); signal_in_fx = &input_buf_fx[input_frame]; /* Q_old_inp_16k */ -#else - Copy_Scale_sig( st->input_fx - input_frame, input_buf_fx, input_frame, sub( -1, st->q_old_inp ) ); - Copy_Scale_sig( st->input_fx, input_buf_fx + input_frame, input_frame, sub( -1, st->q_inp ) ); - - signal_in_fx = &input_buf_fx[input_frame]; /* st->q_inp */ -#endif input_Fs = st->input_Fs; /* Q0 */ move32(); @@ -893,27 +806,15 @@ void ivas_compute_core_buffers_fx( IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( st->old_inp_16k_fx, old_inp_16k_fx, L_INP_MEM - STEREO_DFT_OVL_16k, sub( Q_old_inp_16k, sub( Q15, st->exp_old_inp_16k ) ) ); /* Q_old_inp_16k */ -#else - Copy( st->old_inp_16k_fx, old_inp_16k_fx, L_INP_MEM - STEREO_DFT_OVL_16k ); /* Q_new - 1 */ -#endif } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( st->old_inp_16k_fx, old_inp_16k_fx, L_INP_MEM - L_MEM_RECALC_16K - L_FILT16k, sub( Q_old_inp_16k, sub( Q15, st->exp_old_inp_16k ) ) ); /* Q_old_inp_16k */ -#else - Copy( st->old_inp_16k_fx, old_inp_16k_fx, L_INP_MEM - L_MEM_RECALC_16K - L_FILT16k ); /* Q_new - 1 */ -#endif } ELSE { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->old_inp_16k_fx, old_inp_16k_fx, L_INP_MEM - L_FILT16k, sub( Q_old_inp_16k, sub( Q15, st->exp_old_inp_16k ) ) ); /* Q_old_inp_16k */ -#else - Copy( st->old_inp_16k_fx, old_inp_16k_fx, L_INP_MEM - L_FILT16k ); /* Q_new - 1 */ -#endif } /*---------------------------------------------------------------* @@ -928,7 +829,6 @@ void ivas_compute_core_buffers_fx( /* no resampling needed, only delay adjustment to account for the FIR resampling delay */ delay = NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ); move16(); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->mem_decim16k_fx + delay, new_inp_16k_fx, delay, sub( Q_old_inp_16k, st->q_mem_decim16k_fx ) ); /* Q_old_inp_16k */ Copy( signal_in_fx, new_inp_16k_fx + delay, input_frame ); /* Q_old_inp_16k */ // Copy_Scale_sig( signal_in_fx + input_frame - shl( delay, 1 ), st->mem_decim16k_fx, shl( delay, 1 ), sub( -1, Q_old_inp_16k ) ); /* Q(-1) */ @@ -937,36 +837,21 @@ void ivas_compute_core_buffers_fx( scale_sig( st->mem_decim16k_fx, shl( delay, 1 ), Q_tmp ); st->q_mem_decim16k_fx = add( Q_tmp, Q_old_inp_16k ); move16(); -#else - Copy( st->mem_decim16k_fx + delay, new_inp_16k_fx, delay ); - Copy( signal_in_fx, new_inp_16k_fx + delay, input_frame ); /* st->q_inp */ - Copy( signal_in_fx + input_frame - shl( delay, 1 ), st->mem_decim16k_fx, shl( delay, 1 ) ); /* st->q_inp */ -#endif } ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) { -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( st->mem_decim16k_fx, 2 * L_FILT_MAX, sub( Q_old_inp_16k, st->q_mem_decim16k_fx ) ); /* Q_old_inp_16k */ -#endif + scale_sig( st->mem_decim16k_fx, 2 * L_FILT_MAX, sub( Q_old_inp_16k, st->q_mem_decim16k_fx ) ); /* Q_old_inp_16k */ size_modified = modify_Fs_fx( signal_in_fx, input_frame, input_Fs, new_inp_16k_fx, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_16k_fx, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#else - Scale_sig( new_inp_16k_fx, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#endif + scale_sig( new_inp_16k_fx, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ Copy( st->mem_decim16k_fx, mem_decim16k_dummy_fx, 2 * L_FILT_MAX ); /* Q(-1) */ set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ + scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ Q_tmp = norm_arr( st->mem_decim16k_fx, mem_decim16k_size ); scale_sig( st->mem_decim16k_fx, mem_decim16k_size, Q_tmp ); st->q_mem_decim16k_fx = add( Q_tmp, Q_old_inp_16k ); move16(); -#else - Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#endif } } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) @@ -977,7 +862,6 @@ void ivas_compute_core_buffers_fx( /* no resampling needed, only delay adjustment to account for the FIR resampling delay */ delay = NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ); move16(); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->mem_decim16k_fx + delay, new_inp_16k_fx - add( lMemRecalc, sub( delay, L_FILT16k ) ), delay, sub( Q_old_inp_16k, st->q_mem_decim16k_fx ) ); /* Q_old_inp_16k */ Copy( signal_in_fx - lMemRecalc, new_inp_16k_fx - sub( lMemRecalc, L_FILT16k ), add( input_frame, lMemRecalc ) ); /* Q_old_inp_16k */ // Copy_Scale_sig( signal_in_fx + sub( sub( input_frame, lMemRecalc ), shl( delay, 1 ) ), st->mem_decim16k_fx, shl( delay, 1 ), sub( -1, Q_old_inp_16k ) ); /* Q(-1) */ @@ -986,17 +870,10 @@ void ivas_compute_core_buffers_fx( scale_sig( st->mem_decim16k_fx, shl( delay, 1 ), Q_tmp ); st->q_mem_decim16k_fx = add( Q_tmp, Q_old_inp_16k ); move16(); -#else - Copy( st->mem_decim16k_fx + delay, new_inp_16k_fx - add( lMemRecalc, sub( delay, L_FILT16k ) ), delay ); /* Q(-1) */ - Copy( signal_in_fx - lMemRecalc, new_inp_16k_fx - sub( lMemRecalc, L_FILT16k ), add( input_frame, lMemRecalc ) ); /* st->q_inp */ - Copy( signal_in_fx + sub( sub( input_frame, lMemRecalc ), shl( delay, 1 ) ), st->mem_decim16k_fx, shl( delay, 1 ) ); /* st->q_inp */ -#endif } ELSE IF( EQ_32( input_Fs, 32000 ) || EQ_32( input_Fs, 48000 ) ) { -#ifdef NONBE_FIX_ISSUE_2206 scale_sig( st->mem_decim16k_fx, 2 * L_FILT_MAX, sub( Q_old_inp_16k, st->q_mem_decim16k_fx ) ); /* Q_old_inp_16k */ -#endif /* reconstruct past segment of input signal when switching from MDCT stereo */ IF( EQ_16( last_element_mode, IVAS_CPE_MDCT ) /*|| st->idchan == 1*/ ) { @@ -1007,51 +884,32 @@ void ivas_compute_core_buffers_fx( Copy( signal_in_fx - lMemRecalc - length_inp - 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), st->mem_decim16k_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* st->q_inp */ size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_16k_fx - lMemRecalc_16k - length_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_16k_fx - lMemRecalc_16k - length_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#else - Scale_sig( new_inp_16k_fx - lMemRecalc_16k - length_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#endif + scale_sig( new_inp_16k_fx - lMemRecalc_16k - length_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_16k_fx - lMemRecalc_16k, sr_core, st->mem_decim16k_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_16k_fx - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#else - Scale_sig( new_inp_16k_fx - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#endif + scale_sig( new_inp_16k_fx - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ Copy( st->mem_decim16k_fx, mem_decim16k_dummy_fx, 2 * L_FILT_MAX ); -#ifdef NONBE_FIX_ISSUE_2206 // Scale_sig( st->mem_decim16k_fx, mem_decim16k_size, sub( -1, Q_old_inp_16k ) ); /* Q(-1) */ Q_tmp = norm_arr( st->mem_decim16k_fx, mem_decim16k_size ); scale_sig( st->mem_decim16k_fx, mem_decim16k_size, Q_tmp ); st->q_mem_decim16k_fx = add( Q_tmp, Q_old_inp_16k ); move16(); -#endif IF( lMemRecalc > 0 ) { size_modified = modify_Fs_fx( signal_in_fx - lMemRecalc + input_frame, lMemRecalc, input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#else - Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#endif + scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ) - lMemRecalc_16k, size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } set16_fx( temp1F_icatdmResampBuf_fx, 0, L_FILT_MAX ); size_modified = modify_Fs_fx( temp1F_icatdmResampBuf_fx, NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), input_Fs, new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), sr_core, mem_decim16k_dummy_fx, 0, &Q_tmp, &mem_decim16k_size ); /* Q0 */ -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#else - Scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ -#endif + scale_sig( new_inp_16k_fx + NS2SA_FX2( sr_core, FRAME_SIZE_NS ), size_modified, negate( Q_tmp ) ); /* scaling back to Q_old_inp_16k */ } } ELSE IF( st->idchan == 0 ) { /* update the FIR resampling filter memory, needed for switching to time-domain (FIR) resampling */ -#ifdef NONBE_FIX_ISSUE_2206 // Copy_Scale_sig( signal_in_fx + input_frame - NS2SA_FX2( input_Fs, L_MEM_RECALC_NS ) - 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), st->mem_decim16k_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), sub( -1, Q_old_inp_16k ) ); /* Q(-1) */ mem_decim16k_size = 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ); move16(); @@ -1060,9 +918,6 @@ void ivas_compute_core_buffers_fx( scale_sig( st->mem_decim16k_fx, mem_decim16k_size, Q_tmp ); st->q_mem_decim16k_fx = add( Q_tmp, Q_old_inp_16k ); move16(); -#else - Copy( signal_in_fx + input_frame - NS2SA_FX2( input_Fs, L_MEM_RECALC_NS ) - 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ), st->mem_decim16k_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); /* st->q_inp */ -#endif } /*------------------------------------------------* @@ -1082,7 +937,6 @@ void ivas_compute_core_buffers_fx( IF( EQ_16( st->bwidth, WB ) ) { -#ifdef NONBE_FIX_ISSUE_2206 // Word16 wtda_q = s_min( st->Q_old_wtda, Q_old_inp_16k ); Word16 wtda_q = s_min( add( st->Q_old_wtda, norm_arr( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k ) ), Q_old_inp_16k ); Copy_Scale_sig_nosat( new_inp_16k_fx - delay, st->hBWE_FD->old_input_wb_fx, delay, sub( -1, Q_old_inp_16k ) ); /* Scaling to Q(-1) */ @@ -1090,13 +944,6 @@ void ivas_compute_core_buffers_fx( Copy_Scale_sig_nosat( new_inp_16k_fx - STEREO_DFT_OVL_16k, st->hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - STEREO_DFT_OVL_16k + delay, sub( STEREO_DFT_OVL_16k, delay ), sub( wtda_q, Q_old_inp_16k ) ); st->Q_old_wtda = wtda_q; move16(); -#else - Copy_Scale_sig( new_inp_16k_fx - delay, st->hBWE_FD->old_input_wb_fx, delay, negate( add( Q_old_inp_16k, 1 ) ) ); /* Scaling to Q(-1) */ - scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( Q_old_inp_16k, st->Q_old_wtda ) ); // st->Q_old_wtda->Q_old_inp_16k - Copy( new_inp_16k_fx - STEREO_DFT_OVL_16k, st->hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - STEREO_DFT_OVL_16k + delay, sub( STEREO_DFT_OVL_16k, delay ) ); - st->Q_old_wtda = Q_old_inp_16k; - move16(); -#endif } } ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) @@ -1107,7 +954,6 @@ void ivas_compute_core_buffers_fx( test(); IF( EQ_16( st->bwidth, WB ) && st->hBWE_FD != NULL ) { -#ifdef NONBE_FIX_ISSUE_2206 // Word16 wtda_q = s_min( st->Q_old_wtda, Q_old_inp_16k ); Word16 wtda_q = s_min( add( st->Q_old_wtda, norm_arr( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k ) ), Q_old_inp_16k ); Copy_Scale_sig_nosat( new_inp_16k_fx + L_FILT16k - delay, st->hBWE_FD->old_input_wb_fx, delay, sub( -1, Q_old_inp_16k ) ); /* Scaling to Q(-1) */ @@ -1115,13 +961,6 @@ void ivas_compute_core_buffers_fx( Copy_Scale_sig_nosat( new_inp_16k_fx - L_MEM_RECALC_16K, st->hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - L_MEM_RECALC_16K - L_FILT16k + delay, sub( L_MEM_RECALC_16K + L_FILT16k, delay ), sub( wtda_q, Q_old_inp_16k ) ); st->Q_old_wtda = wtda_q; move16(); -#else - Copy_Scale_sig( new_inp_16k_fx + L_FILT16k - delay, st->hBWE_FD->old_input_wb_fx, delay, negate( add( Q_old_inp_16k, 1 ) ) ); /* Scaling to Q(-1) */ - scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( Q_old_inp_16k, st->Q_old_wtda ) ); // st->Q_old_wtda->Q_old_inp_16k - Copy( new_inp_16k_fx - L_MEM_RECALC_16K, st->hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - L_MEM_RECALC_16K - L_FILT16k + delay, sub( L_MEM_RECALC_16K + L_FILT16k, delay ) ); - st->Q_old_wtda = Q_old_inp_16k; - move16(); -#endif } } ELSE IF( element_mode == IVAS_SCE ) @@ -1151,19 +990,11 @@ void ivas_compute_core_buffers_fx( test(); if ( st->tcxonly == 0 && !( ( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( st->idchan, 1 ) ) || EQ_16( element_mode, IVAS_CPE_MDCT ) ) ) { -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph_enc = new_inp_16k_fx[L_frame_tmp - 1]; /* Q_old_inp_16k */ st->exp_mem_preemph_enc = sub( Q15, Q_old_inp_16k ); -#else - st->mem_preemph_enc = new_inp_16k_fx[L_frame_tmp - 1]; /* Q(-1) */ -#endif move16(); } -#ifndef NONBE_FIX_ISSUE_2206 - *Q_new = 0; - move16(); -#endif test(); IF( EQ_32( sr_core, INT_FS_16k ) && NE_16( element_mode, IVAS_CPE_MDCT ) ) @@ -1173,24 +1004,15 @@ void ivas_compute_core_buffers_fx( IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( new_inp_16k_fx - STEREO_DFT_OVL_16k + L_FRAME16k, st->inp_16k_mem_stereo_sw_fx, STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k, sub( -1, Q_old_inp_16k ) ); /* update for TD/DFT stereo switching Q(-1) */ -#else - Copy( new_inp_16k_fx - STEREO_DFT_OVL_16k + L_FRAME16k, st->inp_16k_mem_stereo_sw_fx, STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k ); /* update for TD/DFT stereo switching Q(-1) */ -#endif st->mem_preemph16k_fx = st->mem_preemph16k_DFT_fx; /* Q(-1) */ move16(); -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_DFT_fx = shl( old_inp_16k_fx[L_INP_MEM - STEREO_DFT_OVL_16k + L_FRAME16k - 1], sub( -1, Q_old_inp_16k ) ); /* Q_old_inp_16k -> Q(-1) */ -#else - st->mem_preemph16k_DFT_fx = old_inp_16k_fx[L_INP_MEM - STEREO_DFT_OVL_16k + L_FRAME16k - 1]; /* Q_new - 1 */ -#endif move16(); IF( EQ_16( st->L_frame, L_FRAME16k ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Word16 buf_speech_enc_q; buf_speech_enc_q = s_min( sub( Q15, st->exp_buf_speech_enc ), Q_old_inp_16k ); @@ -1200,21 +1022,14 @@ void ivas_compute_core_buffers_fx( scale_sig( st->buf_speech_enc + L_FRAME16k + L_FRAME16k, L_PAST_MAX_32k + L_NEXT_MAX_32k, sub( buf_speech_enc_q, sub( Q15, st->exp_buf_speech_enc ) ) ); st->exp_buf_speech_enc = sub( Q15, buf_speech_enc_q ); move16(); -#else - Copy( new_inp_16k_fx - STEREO_DFT_OVL_16k, st->buf_speech_enc + L_FRAME16k - STEREO_DFT_OVL_16k, L_FRAME16k + STEREO_DFT_OVL_16k ); /* Q(-1) */ -#endif } -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_fx = shl( st->mem_preemph16k_fx, sub( Q_old_inp_16k, -1 ) ); move16(); -#endif preemph_copy_32fx2( new_inp_16k_fx - STEREO_DFT_OVL_16k, sig_out, PREEMPH_FAC_16k, L_FRAME16k, &( st->mem_preemph16k_fx ) ); /* Q(-1) */ tmp_fx = st->mem_preemph16k_fx; move16(); -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_fx = shl( tmp_fx, sub( -1, Q_old_inp_16k ) ); move16(); -#endif preemph_copy_32fx2( new_inp_16k_fx - STEREO_DFT_OVL_16k + L_FRAME16k, sig_out + L_FRAME16k, PREEMPH_FAC_16k, STEREO_DFT_OVL_16k, &tmp_fx ); /* Q(-1) */ preemp_start_idx = new_inp_16k_fx - STEREO_DFT_OVL_16k; @@ -1224,33 +1039,21 @@ void ivas_compute_core_buffers_fx( } ELSE IF( EQ_16( st->element_mode, IVAS_CPE_TD ) ) { -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_fx = shl( st->mem_preemph16k_fx, sub( Q_old_inp_16k, -1 ) ); move16(); -#endif IF( EQ_16( last_element_mode, IVAS_CPE_DFT ) ) { -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_fx = shl( st->mem_preemph16k_DFT_fx, sub( Q_old_inp_16k, -1 ) ); move16(); Copy_Scale_sig( st->inp_16k_mem_stereo_sw_fx, new_inp_16k_fx - L_MEM_RECALC_16K - ( STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k ), STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k, sub( Q_old_inp_16k, -1 ) ); /* Q(-1) */ -#else - st->mem_preemph16k_fx = st->mem_preemph16k_DFT_fx; - move16(); - Copy( st->inp_16k_mem_stereo_sw_fx, new_inp_16k_fx - L_MEM_RECALC_16K - ( STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k ), STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k ); /* Q(-1) */ -#endif - preemph_copy_32fx2( new_inp_16k_fx - L_MEM_RECALC_16K - ( STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k ), sig_out, PREEMPH_FAC_16k, STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k, &st->mem_preemph16k_fx ); /* Q(-1) */ + preemph_copy_32fx2( new_inp_16k_fx - L_MEM_RECALC_16K - ( STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k ), sig_out, PREEMPH_FAC_16k, STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k, &st->mem_preemph16k_fx ); /* Q(-1) */ preemp_start_idx = new_inp_16k_fx - L_MEM_RECALC_16K - ( STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k ); move16(); preemp_len = STEREO_DFT_OVL_16k - L_MEM_RECALC_16K - L_FILT16k; move16(); } -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_DFT_fx = shl( old_inp_16k_fx[L_INP_MEM - STEREO_DFT_OVL_16k + L_FRAME16k - 1], sub( -1, Q_old_inp_16k ) ); /* Q(-1) */ -#else - st->mem_preemph16k_DFT_fx = old_inp_16k_fx[L_INP_MEM - STEREO_DFT_OVL_16k + L_FRAME16k - 1]; /* Q_new - 1 */ -#endif move16(); /* preemphasise past segment of input signal when switching from MDCT stereo */ @@ -1267,7 +1070,6 @@ void ivas_compute_core_buffers_fx( IF( EQ_16( st->L_frame, L_FRAME16k ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Word16 buf_speech_enc_q; buf_speech_enc_q = s_min( sub( Q15, st->exp_buf_speech_enc ), Q_old_inp_16k ); @@ -1277,17 +1079,12 @@ void ivas_compute_core_buffers_fx( scale_sig( st->buf_speech_enc + L_FRAME16k + L_FRAME16k, L_PAST_MAX_32k + L_NEXT_MAX_32k, sub( buf_speech_enc_q, sub( Q15, st->exp_buf_speech_enc ) ) ); st->exp_buf_speech_enc = sub( Q15, buf_speech_enc_q ); move16(); -#else - Copy( new_inp_16k_fx - lMemRecalc_16k, st->buf_speech_enc + sub( L_FRAME16k - L_FILT16k, lMemRecalc_16k ), add( lMemRecalc_16k, L_FRAME16k + L_FILT16k ) ); /* Q_new - 1 */ -#endif } preemph_copy_32fx2( new_inp_16k_fx - lMemRecalc_16k, sig_out + preemp_len, PREEMPH_FAC_16k, L_FRAME16k, &( st->mem_preemph16k_fx ) ); /* Q(-1) */ tmp_fx = st->mem_preemph16k_fx; move16(); -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_fx = shl( st->mem_preemph16k_fx, sub( -1, Q_old_inp_16k ) ); move16(); -#endif preemph_copy_32fx2( new_inp_16k_fx - lMemRecalc_16k + L_FRAME16k, sig_out + preemp_len + L_FRAME16k, PREEMPH_FAC_16k, lMemRecalc_16k + L_FILT16k, &tmp_fx ); /* Q(-1) */ IF( preemp_start_idx && preemp_len ) { @@ -1303,18 +1100,14 @@ void ivas_compute_core_buffers_fx( } ELSE IF( EQ_16( element_mode, IVAS_SCE ) ) { -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_fx = shl( st->mem_preemph16k_fx, sub( Q_old_inp_16k, -1 ) ); move16(); -#endif preemph_copy_32fx2( new_inp_16k_fx, sig_out, PREEMPH_FAC_16k, L_FRAME16k, &( st->mem_preemph16k_fx ) ); /* Q(-1) */ tmp_fx = st->mem_preemph16k_fx; move16(); -#ifdef NONBE_FIX_ISSUE_2206 /* Saturation can occur. To avoid that the format of st->mem_preemph16k_fx needs to become variable. */ st->mem_preemph16k_fx = shl_sat( st->mem_preemph16k_fx, sub( -1, Q_old_inp_16k ) ); move16(); -#endif preemph_copy_32fx2( new_inp_16k_fx + L_FRAME16k, sig_out + L_FRAME16k, PREEMPH_FAC_16k, L_FILT16k, &tmp_fx ); /* Q(-1) */ preemp_start_idx = new_inp_16k_fx; preemp_len = L_FRAME16k + L_FILT16k; @@ -1334,13 +1127,8 @@ void ivas_compute_core_buffers_fx( *Q_new = s_min( shift, Q_MAX ); move16(); -#ifndef NONBE_FIX_ISSUE_2206 - Copy_Scale_sig32_16( sig_out, preemp_start_idx, preemp_len, add( *Q_new, 1 ) ); - Scale_sig( old_inp_16k_fx, (Word16) ( preemp_start_idx - old_inp_16k_fx ), *Q_new ); -#else Copy_Scale_sig32_16( sig_out, preemp_start_idx, preemp_len, sub( *Q_new, Q_old_inp_16k ) ); scale_sig( old_inp_16k_fx, (Word16) ( preemp_start_idx - old_inp_16k_fx ), sub( sub( *Q_new, 1 ), Q_old_inp_16k ) ); /* *Q_new-1 */ -#endif } ELSE /* keep memory up-to-date in case of bitrate switching */ { @@ -1351,18 +1139,10 @@ void ivas_compute_core_buffers_fx( } ELSE /* SCE */ { -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_fx = shl( new_inp_16k_fx[L_frame_tmp - 1], sub( -1, Q_old_inp_16k ) ); /* Q(-1)) */ -#else - st->mem_preemph16k_fx = new_inp_16k_fx[L_frame_tmp - 1]; /* Q_new - 1 */ -#endif move16(); } -#ifdef NONBE_FIX_ISSUE_2206 st->mem_preemph16k_DFT_fx = st->mem_preemph16k_fx; /* Q(-1)) */ -#else - st->mem_preemph16k_DFT_fx = st->mem_preemph16k_fx; /* Q_new - 1 */ -#endif move16(); } @@ -1374,7 +1154,6 @@ void ivas_compute_core_buffers_fx( test(); IF( EQ_16( st->L_frame, L_FRAME16k ) && NE_16( element_mode, IVAS_CPE_MDCT ) ) { -#ifdef NONBE_FIX_ISSUE_2206 /* update signal buffers */ IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { @@ -1421,24 +1200,6 @@ void ivas_compute_core_buffers_fx( Copy_Scale_sig_nosat( new_inp_16k_fx, st->buf_speech_enc_pe + L_FRAME16k, L_FRAME16k, sub( tmp, sub( *Q_new, 1 ) ) ); st->exp_buf_speech_enc_pe = sub( Q15, tmp ); } -#else - /* update signal buffers */ - shift = negate( *Q_new ); - move16(); - IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) - { - Copy_Scale_sig( new_inp_16k_fx - STEREO_DFT_OVL_16k, st->buf_speech_enc_pe + L_FRAME16k - STEREO_DFT_OVL_16k, L_FRAME16k + STEREO_DFT_OVL_16k, shift ); // Q-1 - } - ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) - { - Copy_Scale_sig( new_inp_16k_fx - lMemRecalc_16k, st->buf_speech_enc_pe + L_FRAME16k - lMemRecalc_16k - L_FILT16k, L_FRAME16k + lMemRecalc_16k + L_FILT16k, shift ); // Q-1 - } - ELSE - { - Copy( new_inp_resamp16k_fx, st->buf_speech_enc + L_FRAME16k, L_FRAME16k ); - Copy_Scale_sig( new_inp_16k_fx, st->buf_speech_enc_pe + L_FRAME16k, L_FRAME16k, shift ); // Q-1 - } -#endif /*--------------------------------------------------------------* * LPC analysis @@ -1468,13 +1229,10 @@ void ivas_compute_core_buffers_fx( /*--------------------------------------------------------------* * Compute Weighted Input *---------------------------------------------------------------*/ -#ifdef NONBE_FIX_ISSUE_2206 st->mem_wsp_enc = shl( st->mem_wsp_enc, sub( st->exp_buf_wspeech_enc, st->exp_buf_speech_enc_pe ) ); -#endif find_wsp_fx( A_fx, st->speech_enc_pe, st->wspeech_enc, &st->mem_wsp_enc, PREEMPH_FAC_16k, L_FRAME16k, L_LOOK_16k, L_SUBFR, Aw_fx, st->gamma, NB_SUBFR16k ); -#ifdef NONBE_FIX_ISSUE_2206 Word16 tmp; // L_FRAME16k + L_SUBFR / L_FRAME16k + L_NEXT_MAX_16k + 320 // L_FRAME16k + L_LOOK_16k @@ -1489,7 +1247,6 @@ void ivas_compute_core_buffers_fx( st->exp_buf_wspeech_enc = sub( Q15, tmp ); st->mem_wsp_enc = shl( st->mem_wsp_enc, sub( st->exp_buf_speech_enc_pe, st->exp_buf_wspeech_enc ) ); move16(); -#endif } /*-----------------------------------------------------------------* @@ -1514,14 +1271,8 @@ void ivas_compute_core_buffers_fx( ELSE { lerp( st->old_inp_12k8_fx + L_INP_MEM - L_INP_MEM * 4 / 5, st->old_inp_16k_fx, L_INP_MEM, L_INP_MEM * 4 / 5 ); -#ifdef NONBE_FIX_ISSUE_2206 st->exp_old_inp_16k = st->exp_old_inp_12k8; move16(); -#else - Scale_sig( st->old_inp_16k_fx, L_INP_MEM, sub( -1 /* Q st->old_inp_16k_fx = -1 */, sub( 15, st->exp_old_inp_12k8 ) ) ); - st->exp_old_inp_16k = Q16; // Q-1 - move16(); -#endif } IF( inp16k_out_fx != NULL ) diff --git a/lib_enc/ivas_cpe_enc_fx.c b/lib_enc/ivas_cpe_enc_fx.c index b43eb2142cf2286d9694736fa11da1ec159abfff..8dfe9582eba28a1c04fbaca65e72bdbbc8dda34b 100644 --- a/lib_enc/ivas_cpe_enc_fx.c +++ b/lib_enc/ivas_cpe_enc_fx.c @@ -437,7 +437,6 @@ ivas_error ivas_cpe_enc_fx( shift = s_min( L_norm_arr( sts[0]->input_buff32_fx, input_frame_2 ), L_norm_arr( sts[1]->input_buff32_fx, input_frame_2 ) ); q_min = add( sts[0]->q_inp32, sub( shift, find_guarded_bits_fx( input_frame ) ) ); -#ifdef NONBE_FIX_ISSUE_2206 IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) { q_min = sub( q_min, 1 ); // Fixes spike artefact for IVAS_cod -stereo 32000 16 stvST16c+10dB.wav out.192 at sample 793800. Saturation somewhere ? @@ -446,10 +445,6 @@ ivas_error ivas_cpe_enc_fx( scale_sig32( sts[0]->input_buff32_fx, input_frame, sub( q_min, sts[0]->q_old_inp32 ) ); /* q_min */ scale_sig32( sts[1]->input_buff32_fx + input_frame, input_frame, sub( q_min, sts[1]->q_inp32 ) ); /* q_min */ scale_sig32( sts[0]->input_buff32_fx + input_frame, input_frame, sub( q_min, sts[0]->q_inp32 ) ); /* q_min */ -#else - scale_sig32( sts[1]->input_buff32_fx, input_frame_2, sub( q_min, sts[1]->q_inp32 ) ); /* q_min */ - scale_sig32( sts[0]->input_buff32_fx, input_frame_2, sub( q_min, sts[0]->q_inp32 ) ); /* q_min */ -#endif sts[0]->q_inp32 = sts[1]->q_inp32 = sts[0]->q_old_inp32 = sts[1]->q_old_inp32 = q_min; move16(); move16(); @@ -460,15 +455,10 @@ ivas_error ivas_cpe_enc_fx( shift = sub( add( L_norm_arr( sts[0]->input_buff32_fx, input_frame_2 ), sts[0]->q_inp32 ), 16 ); shift = s_min( shift, sub( add( L_norm_arr( sts[1]->input_buff32_fx, input_frame_2 ), sts[1]->q_inp32 ), 16 ) ); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, input_frame, sub( add( Q16, shift ), sts[0]->q_old_inp32 ) ); // shift Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, input_frame, sub( add( Q16, shift ), sts[1]->q_old_inp32 ) ); // shift Copy_Scale_sig32_16( sts[0]->input_buff32_fx + input_frame, sts[0]->input_buff_fx + input_frame, input_frame, sub( add( Q16, shift ), sts[0]->q_inp32 ) ); // shift Copy_Scale_sig32_16( sts[1]->input_buff32_fx + input_frame, sts[1]->input_buff_fx + input_frame, input_frame, sub( add( Q16, shift ), sts[1]->q_inp32 ) ); // shift -#else - Copy_Scale_sig32_16( sts[0]->input_buff32_fx, sts[0]->input_buff_fx, input_frame_2, sub( add( Q16, shift ), sts[0]->q_inp32 ) ); // shift - Copy_Scale_sig32_16( sts[1]->input_buff32_fx, sts[1]->input_buff_fx, input_frame_2, sub( add( Q16, shift ), sts[1]->q_inp32 ) ); // shift -#endif sts[0]->q_inp = sts[1]->q_inp = sts[0]->q_old_inp = sts[1]->q_old_inp = shift; move16(); move16(); @@ -483,18 +473,10 @@ ivas_error ivas_cpe_enc_fx( { Copy32( sts[n]->input32_fx, orig_input_fx32[n], input_frame ); /* sts->q_inp32 */ Copy( sts[n]->input_fx, orig_input_fx[n], input_frame ); /* sts->q_inp */ -#ifdef NONBE_FIX_ISSUE_2206 Q_orig_inp[n] = sts[n]->q_inp; Q_orig_inp32[n] = sts[n]->q_inp32; move16(); move16(); -#else - Scale_sig( orig_input_fx[n], input_frame, sub( -1, sts[n]->q_inp ) ); // Q(-1) - Q_orig_inp[n] = -1; - Q_orig_inp32[n] = sts[n]->q_inp32; - move16(); - move16(); -#endif IF( hCPE->hStereoICBWE != NULL ) { @@ -690,7 +672,6 @@ ivas_error ivas_cpe_enc_fx( hCPE->hStereoDft->Spd_R_smooth_fx_e = sub( hCPE->hStereoDft->Spd_R_smooth_fx_e, temp ); move16(); -#ifdef NONBE_FIX_ISSUE_2206 q_com = MAX_16; move16(); /* Align Q values of the signals that need to be aligned in stereo_td_channel_extrapolate_fx() */ @@ -714,36 +695,6 @@ ivas_error ivas_cpe_enc_fx( hCPE->q_input_mem[n] = q_com; move16(); } -#else - q_com = MAX_16; - move16(); - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - q_com = s_min( q_com, sub( add( L_norm_arr( sts[n]->input32_fx, input_frame ), sts[n]->q_inp32 ), 16 ) ); - q_com = s_min( q_com, sub( add( L_norm_arr( sts[n]->old_input_signal32_fx, input_frame ), sts[n]->q_old_inp32 ), 16 ) ); - q_com = s_min( q_com, add( norm_arr( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl ), hCPE->q_input_mem[n] ) ); - - if ( EQ_16( q_com, Q15 ) ) - { - q_com = 0; - move16(); - } - } - FOR( n = 0; n < CPE_CHANNELS; n++ ) - { - Copy_Scale_sig_32_16( sts[n]->input32_fx, sts[n]->input_fx, input_frame, sub( q_com, sts[n]->q_inp32 ) ); - sts[n]->q_inp = q_com; - move16(); - - Copy_Scale_sig_32_16( sts[n]->old_input_signal32_fx, sts[n]->old_input_signal_fx, input_frame, sub( q_com, sts[n]->q_old_inp32 ) ); - sts[n]->q_old_inp = q_com; - move16(); - - scale_sig( hCPE->input_mem_fx[n], hCPE->hStereoDft->dft_ovl, sub( q_com, hCPE->q_input_mem[n] ) ); - hCPE->q_input_mem[n] = q_com; - move16(); - } -#endif stereo_dft_hybrid_ITD_flag_fx( hConfigDft, input_Fs, hCPE->hStereoDft->hItd->hybrid_itd_max ); @@ -762,7 +713,6 @@ ivas_error ivas_cpe_enc_fx( } ELSE IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) { -#ifdef NONBE_FIX_ISSUE_2206 /* Make scale of L/R equal, required inside stereo_tdm_ener_analysis_fx()->Get_dt_lt_ener_fx() */ Q_min = s_min( sts[0]->q_inp, sts[1]->q_inp ); scale_sig( sts[0]->input_fx, input_frame, sub( Q_min, sts[0]->q_inp ) ); /* min Q of both channels */ @@ -771,14 +721,6 @@ ivas_error ivas_cpe_enc_fx( scale_sig( sts[1]->input_fx, input_frame, sub( Q_min, sts[1]->q_inp ) ); /* min Q of both channels */ sts[1]->q_inp = Q_min; move16(); -#else - Scale_sig( sts[0]->input_fx, input_frame, negate( sts[0]->q_inp ) ); /* Q0 */ - sts[0]->q_inp = 0; - move16(); - Scale_sig( sts[1]->input_fx, input_frame, negate( sts[1]->q_inp ) ); /* Q0 */ - sts[1]->q_inp = 0; - move16(); -#endif /* Determine the energy ratio between the 2 channels */ tdm_ratio_idx = stereo_tdm_ener_analysis_fx( ivas_format, hCPE, input_frame, &tdm_SM_or_LRTD_Pri, &tdm_ratio_idx_SM ); /* Q0 */ @@ -828,44 +770,6 @@ ivas_error ivas_cpe_enc_fx( sts[1]->exp_old_inp_12k8 = Q15; move16(); } - -#ifndef NONBE_FIX_ISSUE_2206 - q_min = sts[1]->q_old_inp; - move16(); - q_min = s_min( q_min, sts[1]->q_inp ); - q_min = s_min( q_min, sts[0]->q_old_inp ); - q_min = s_min( q_min, sts[0]->q_inp ); - q_min = s_min( q_min, hCPE->q_input_mem[0] ); - q_min = s_min( q_min, hCPE->q_input_mem[1] ); - - shift = norm_arr( sts[1]->old_input_signal_fx, input_frame ); - shift = s_min( shift, norm_arr( sts[1]->input_fx, input_frame ) ); - shift = s_min( shift, norm_arr( sts[0]->old_input_signal_fx, input_frame ) ); - shift = s_min( shift, norm_arr( sts[0]->input_fx, input_frame ) ); - shift = s_min( shift, norm_arr( hCPE->input_mem_fx[0], hCPE->hStereoMdct->hDft_ana->dft_ovl ) ); - shift = s_min( shift, norm_arr( hCPE->input_mem_fx[1], hCPE->hStereoMdct->hDft_ana->dft_ovl ) ); - - q_min = add( q_min, shift ); - - scale_sig( sts[1]->input_fx, input_frame, sub( q_min, sts[1]->q_inp ) ); /* q_min */ - scale_sig( sts[1]->old_input_signal_fx, input_frame, sub( q_min, sts[1]->q_old_inp ) ); /* q_min */ - scale_sig( sts[0]->input_fx, input_frame, sub( q_min, sts[0]->q_inp ) ); /* q_min */ - scale_sig( sts[0]->old_input_signal_fx, input_frame, sub( q_min, sts[0]->q_old_inp ) ); /* q_min */ - scale_sig( hCPE->input_mem_fx[0], hCPE->hStereoMdct->hDft_ana->dft_ovl, sub( q_min, hCPE->q_input_mem[0] ) ); /* q_min */ - scale_sig( hCPE->input_mem_fx[1], hCPE->hStereoMdct->hDft_ana->dft_ovl, sub( q_min, hCPE->q_input_mem[1] ) ); /* q_min */ - hCPE->q_input_mem[1] = q_min; - hCPE->q_input_mem[0] = q_min; - sts[1]->q_old_inp = q_min; - sts[0]->q_old_inp = q_min; - sts[1]->q_inp = q_min; - sts[0]->q_inp = q_min; - move16(); - move16(); - move16(); - move16(); - move16(); - move16(); -#endif } stereo_td_itd_mdct_stereo_fx( hCPE, vad_flag_dtx, vad_hover_flag, input_frame ); @@ -896,7 +800,6 @@ ivas_error ivas_cpe_enc_fx( move16(); move16(); -#ifdef NONBE_FIX_ISSUE_2206 Word16 q_inp32 = sts[0]->q_old_inp32; move16(); @@ -934,33 +837,8 @@ ivas_error ivas_cpe_enc_fx( move16(); sts[0]->q_old_inp = sub( sts[0]->q_old_inp32, Q16 ); move16(); -#else - stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, sts[0]->input32_fx, &out_start_ind, &out_end_ind, 0, input_Fs, input_Fs, 0, NULL ); - - Scale_sig32( sts[0]->input32_fx - input_frame, add( out_start_ind, input_frame ), sub( Q15, sts[0]->q_old_inp32 ) ); // scaling initial part of the input buffer - Scale_sig32( sts[0]->input32_fx + out_end_ind, sub( input_frame, out_end_ind ), sub( Q15, sts[0]->q_inp32 ) ); // scaling initial part of the input buffer - sts[0]->q_inp32 = Q15; - sts[0]->q_old_inp32 = Q15; - move16(); - move16(); - - // Normalise the input buffer from Q15 - Word16 input_norm, q_inp; //, common_q, fir_delay_len; - input_norm = L_norm_arr( sts[0]->input32_fx - input_frame, input_frame_2 ); - q_inp = sub( add( Q15, input_norm ), 16 ); - - // Rescale the old input, input and FIR delay section of input buffer - Copy_Scale_sig32_16( sts[0]->input32_fx - input_frame, sts[0]->input_fx - input_frame, input_frame_2, sub( add( Q16, q_inp ), Q15 ) ); // Q15 -> q_inp - - // Update the Q-factors - sts[0]->q_inp = q_inp; - move16(); - sts[0]->q_old_inp = q_inp; - move16(); -#endif /* iDFT & resampling to 12.8kHz internal sampling rate */ -#ifdef NONBE_FIX_ISSUE_2206 q_inp32 = sts[0]->q_inp32; move16(); stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_inp_12k8_fx[0] + L_INP_MEM, &q_inp32, &out_12k8_start_ind[0], &out_12k8_end_ind[0], 0, input_Fs, INT_FS_12k8, 0, NULL ); @@ -968,48 +846,28 @@ ivas_error ivas_cpe_enc_fx( Copy_Scale_sig_32_16( old_inp_12k8_fx[0], old_inp_12k8_16fx[0], add( L_INP_MEM, out_12k8_start_ind[0] ), sub( sts[0]->q_inp, sts[0]->q_inp32 ) ); // q_inp32->sts[0]->q_inp Copy_Scale_sig_32_16( old_inp_12k8_fx[0] + L_INP_MEM + out_12k8_start_ind[0], old_inp_12k8_16fx[0] + L_INP_MEM + out_12k8_start_ind[0], sub( out_12k8_end_ind[0], out_12k8_start_ind[0] ), sub( sts[0]->q_inp, q_inp32 ) ); // q_inp32->sts[0]->q_inp Copy_Scale_sig_32_16( old_inp_12k8_fx[0] + L_INP_MEM + out_12k8_end_ind[0], old_inp_12k8_16fx[0] + L_INP_MEM + out_12k8_end_ind[0], s_max( 0, sub( L_INP_12k8 - L_INP_MEM, out_12k8_end_ind[0] ) ), sub( sts[0]->q_inp, sts[0]->q_inp32 ) ); // sts[0]->q_inp32->sts[0]->q_inp -#else - stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_inp_12k8_fx[0] + L_INP_MEM, &out_12k8_start_ind[0], &out_12k8_end_ind[0], 0, input_Fs, INT_FS_12k8, 0, NULL ); - Copy_Scale_sig_32_16( old_inp_12k8_fx[0], old_inp_12k8_16fx[0], L_INP_12k8, -Q16 ); // Q-1 -#endif /* iDFT & resampling to 16kHz internal sampling rate for M channel */ IF( EQ_32( input_Fs, internal_Fs ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy32( sts[0]->input32_fx - STEREO_DFT_OVL_16k, old_inp_16k_fx[0] + L_INP_MEM - STEREO_DFT_OVL_16k, add( input_frame, STEREO_DFT_OVL_16k ) ); /* sts[0]->q_inp32 */ Copy_Scale_sig_32_16( old_inp_16k_fx[0], old_inp_16k_16fx[0], L_INP, sub( sts[0]->q_inp, sts[0]->q_inp32 ) ); // q_inp32 -> sts[0]->q_inp -#else - Copy32( sts[0]->input32_fx - STEREO_DFT_OVL_16k, old_inp_16k_fx[0] + L_INP_MEM - STEREO_DFT_OVL_16k, add( input_frame, STEREO_DFT_OVL_16k ) ); /* sts[0]->q_inp32 */ - out_16k_start_ind = -STEREO_DFT_OVL_16k; - out_16k_end_ind = add( out_16k_start_ind, add( input_frame, STEREO_DFT_OVL_16k ) ); - move16(); - move16(); -#endif } ELSE { -#ifdef NONBE_FIX_ISSUE_2206 q_inp32 = sts[0]->q_inp32; move16(); stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_inp_16k_fx[0] + L_INP_MEM, &q_inp32, &out_16k_start_ind, &out_16k_end_ind, 0, input_Fs, internal_Fs, 0, NULL ); Copy_Scale_sig_32_16( old_inp_16k_fx[0], old_inp_16k_16fx[0], add( L_INP_MEM, out_16k_start_ind ), sub( sts[0]->q_inp, sts[0]->q_inp32 ) ); // q_inp32->sts[0]->q_inp Copy_Scale_sig_32_16( old_inp_16k_fx[0] + L_INP_MEM + out_16k_start_ind, old_inp_16k_16fx[0] + L_INP_MEM + out_16k_start_ind, sub( out_16k_end_ind, out_16k_start_ind ), sub( sts[0]->q_inp, q_inp32 ) ); // q_inp32->sts[0]->q_inp Copy_Scale_sig_32_16( old_inp_16k_fx[0] + L_INP_MEM + out_16k_end_ind, old_inp_16k_16fx[0] + L_INP_MEM + out_16k_end_ind, s_max( 0, sub( L_INP - L_INP_MEM, out_16k_end_ind ) ), sub( sts[0]->q_inp, sts[0]->q_inp32 ) ); // sts[0]->q_inp32->sts[0]->q_inp -#else - stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_inp_16k_fx[0] + L_INP_MEM, &out_16k_start_ind, &out_16k_end_ind, 0, input_Fs, internal_Fs, 0, NULL ); -#endif } -#ifndef NONBE_FIX_ISSUE_2206 - Copy_Scale_sig32_16( old_inp_16k_fx[0], old_inp_16k_16fx[0], L_INP, 0 ); // Q15->Q-1 -#endif /* DFT Stereo: iDFT of residual signal at 8kHz sampling rate */ test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && hCPE->hStereoDft->res_cod_mode[STEREO_DFT_OFFSET] ) { Copy_Scale_sig_16_32_no_sat( sts[1]->old_inp_12k8_fx, old_inp_12k8_fx[1], L_INP_MEM, 15 - 0 ); // Q15 -#ifdef NONBE_FIX_ISSUE_2206 q_inp32 = Q15; move16(); stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_inp_12k8_fx[1] + L_INP_MEM, &q_inp32, &out_12k8_start_ind[1], &out_12k8_end_ind[1], 1, input_Fs, 8000, 0, NULL ); @@ -1024,15 +882,6 @@ ivas_error ivas_cpe_enc_fx( Copy_Scale_sig_32_16( old_inp_12k8_fx[1], old_inp_12k8_16fx[1], add( L_INP_MEM, out_12k8_start_ind[1] ), sub( -1, sts[1]->q_inp32 ) ); // sts[1]->q_inp32 -> Q-1 Copy_Scale_sig_32_16( old_inp_12k8_fx[1] + L_INP_MEM + out_12k8_start_ind[1], old_inp_12k8_16fx[1] + L_INP_MEM + out_12k8_start_ind[1], sub( out_12k8_end_ind[1], out_12k8_start_ind[1] ), sub( -1, q_inp32 ) ); // q_inp32 -> Q-1 Copy_Scale_sig_32_16( old_inp_12k8_fx[1] + L_INP_MEM + out_12k8_end_ind[1], old_inp_12k8_16fx[1] + L_INP_MEM + out_12k8_end_ind[1], s_max( 0, sub( L_INP_12k8 - L_INP_MEM, out_12k8_end_ind[1] ) ), sub( -1, sts[1]->q_inp32 ) ); // sts[1]->q_inp32 -> Q-1 -#else - stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_inp_12k8_fx[1] + L_INP_MEM, &out_12k8_start_ind[1], &out_12k8_end_ind[1], 1, input_Fs, 8000, 0, NULL ); - - /* update old input signal buffer */ - Copy_Scale_sig_32_16( old_inp_12k8_fx[1] + L_FRAME8k, sts[1]->old_inp_12k8_fx, L_INP_MEM, 0 - 15 ); // Q0 - sts[1]->exp_old_inp_12k8 = Q15; - move16(); - Copy_Scale_sig_32_16( old_inp_12k8_fx[1], old_inp_12k8_16fx[1], L_INP_12k8, -Q16 ); // Q-1 -#endif } /* no iDFT at input sampling rate for Side channel -> reset the buffer */ @@ -1335,14 +1184,7 @@ ivas_error ivas_cpe_enc_fx( } } -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_16_32_no_sat( old_inp_12k8_16fx[1], old_inp_12k8_fx[1], L_INP_12k8, Q15 + 1 ); // Q(-1) -> Q15 -#else - FOR( i = 0; i < CPE_CHANNELS; i++ ) - { - Copy_Scale_sig_16_32_no_sat( old_inp_12k8_16fx[i], old_inp_12k8_fx[i], L_INP_12k8, Q16 ); // Q(-1) -> Q15 - } -#endif stereo_dft_enc_res_fx( hCPE->hStereoDft, old_inp_12k8_fx[1] + L_INP_MEM - STEREO_DFT_OVL_8k, hCPE->hMetaData, &nb_bits, max_bits ); } @@ -1377,14 +1219,6 @@ ivas_error ivas_cpe_enc_fx( * Core Encoder *----------------------------------------------------------------*/ -#ifndef NONBE_FIX_ISSUE_2206 - FOR( n = 0; n < n_CoreChannels; n++ ) - { - Scale_sig( old_wsp_fx[n], L_WSP, sub( e_old_wsp[n], Q16 ) ); /* exp(16) */ - e_old_wsp[n] = 16; - move16(); - } -#endif IF( NE_32( ( error = ivas_core_enc_fx( NULL, hCPE, st_ivas->hMCT, n_CoreChannels, old_inp_12k8_16fx, old_inp_16k_16fx, Q_new, ener_fx, A_fx, Aw_fx, epsP_fx, epsP_fx_q, lsp_new_fx, lsp_mid_fx, vad_hover_flag, attack_flag, realBuffer_fx, imagBuffer_fx, q_re_im_buf, old_wsp_fx, e_old_wsp, loc_harm, cor_map_sum_fx, vad_flag_dtx, enerBuffer_fx, enerBuffer_fx_exp, fft_buff_fx, tdm_SM_or_LRTD_Pri, ivas_format, 0 ) ), IVAS_ERR_OK ) ) { return error; diff --git a/lib_enc/ivas_ism_enc_fx.c b/lib_enc/ivas_ism_enc_fx.c index cd0b36f1eb911bfbd37239aea3824fef1cd0424b..c48dd6b44ecfde2abce40555431f71b87fe781a7 100644 --- a/lib_enc/ivas_ism_enc_fx.c +++ b/lib_enc/ivas_ism_enc_fx.c @@ -446,11 +446,6 @@ ivas_error ivas_ism_enc_fx( test(); IF( !dtx_flag || ( dtx_flag && EQ_16( sce_id, st_ivas->hISMDTX->sce_id_dtx ) ) ) { -#ifndef NONBE_FIX_ISSUE_2206 - Scale_sig( old_wsp_fx[sce_id][0], L_WSP, sub( e_old_wsp[sce_id][0], Q16 ) ); /* exp(16) */ - e_old_wsp[sce_id][0] = 16; - move16(); -#endif IF( NE_32( ( error = ivas_core_enc_fx( hSCE, NULL, NULL, 1, old_inp_12k8_fx[sce_id], old_inp_16k_fx[sce_id], Q_new[sce_id], ener_fx[sce_id], A_fx[sce_id], Aw_fx[sce_id], epsP_fx[sce_id], epsP_fx_q[sce_id], lsp_new_fx[sce_id], lsp_mid_fx[sce_id], vad_hover_flag[sce_id], attack_flag[sce_id], realBuffer_fx[sce_id], imagBuffer_fx[sce_id], &q_re_im_buf[sce_id], old_wsp_fx[sce_id], e_old_wsp[sce_id], loc_harm[sce_id], cor_map_sum_fx[sce_id], vad_flag_dtx[sce_id], enerBuffer_fx[sce_id], enerBuffer_fx_exp[sce_id], fft_buff_fx[sce_id], 0, ISM_FORMAT, 0 ) ), IVAS_ERR_OK ) ) { return error; diff --git a/lib_enc/ivas_mdct_core_enc_fx.c b/lib_enc/ivas_mdct_core_enc_fx.c index e5e0ab31159486a592a05c4b320b104f3b2d1c88..18210878e7ba614564e89d054e16261ea51a586b 100644 --- a/lib_enc/ivas_mdct_core_enc_fx.c +++ b/lib_enc/ivas_mdct_core_enc_fx.c @@ -1163,13 +1163,9 @@ static void compute_power_spec( *-------------------------------------------------------------------*/ void ivas_mdct_core_whitening_enc_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ -#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 - Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i : new samples Q_new[]-1*/ - Word16 *Q_new, /* i : new samples q */ -#else - Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i : new samples Q0*/ -#endif + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i : new samples Q_new[]-1*/ + Word16 *Q_new, /* i : new samples q */ Word16 old_wsp_fx[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP Qx*/ Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k], /* o : floating pitch for each subframe Q6*/ Word32 *mdst_spectrum_long_fx[CPE_CHANNELS], /* o : buffer for MDST spectrum mdst_spectrum_e*/ @@ -1209,9 +1205,6 @@ void ivas_mdct_core_whitening_enc_fx( Word16 zero_side_flag[NB_DIV]; Word16 q_com, q_min; Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV]; -#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 - Word16 Q_new; -#endif Word16 q_windowedSignal[CPE_CHANNELS]; Word16 shift = 0; /* 0 for one subframe and 1 for two subframes*/ Word16 *speech; @@ -1236,12 +1229,6 @@ void ivas_mdct_core_whitening_enc_fx( move16(); move16(); -#if ( defined SIMPLIFY_CORE_ENC && !defined NONBE_FIX_ISSUE_2206 ) - FOR( i = 0; i < CPE_CHANNELS; i++ ) - { - Scale_sig( new_samples_fx[i], L_INP, sub( Q1, Q_new_orig[i] ) ); // Q0 - } -#endif /*--------------------------------------------------------------* * Initialization @@ -1333,14 +1320,7 @@ void ivas_mdct_core_whitening_enc_fx( tcx_ltp_encode_ivas_fx( st, st->hTcxEnc->tcxMode, L_FRAME, old_wsp_fx[ch] + L_WSP_MEM + L_LOOK_12k8, NULL, old_wsp_fx[ch] + L_WSP_MEM + L_LOOK_12k8, T_op[ch], ¶m_core[ch][1 + NOISE_FILL_RANGES], <pBits[ch], NULL, 0, IVAS_CPE_MDCT ); -#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 core_signal_analysis_high_bitrate_ivas_fx( new_samples_fx[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal_fx[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0, mdst_spectrum_fx[ch], mdst_spectrum_e[ch], Q_new, &q_windowedSignal[ch] ); -#else - Q_new = 0; - move16(); - - core_signal_analysis_high_bitrate_ivas_fx( new_samples_fx[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, tnsSize[ch], tnsBits[ch], param_core[ch], <pBits[ch], windowedSignal_fx[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0, mdst_spectrum_fx[ch], mdst_spectrum_e[ch], &Q_new, &q_windowedSignal[ch] ); -#endif /* BWD in MDCT domain */ IF( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) ) @@ -2517,13 +2497,6 @@ void ivas_mdct_core_whitening_enc_fx( } } -#if ( defined SIMPLIFY_CORE_ENC && !defined NONBE_FIX_ISSUE_2206 ) - FOR( i = 0; i < CPE_CHANNELS; i++ ) - { - Scale_sig( new_samples_fx[i], L_INP, sub( Q_new_orig[i], Q1 ) ); // Q_new[] - 1 - } - -#endif pop_wmops(); return; } diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 400e2228442e90b0e69b72085c0504a9354d15e2..4ec8174e481eaf20b9fb37cb0b8f258827beda63 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -353,11 +353,6 @@ ivas_error ivas_sce_enc_fx( * Encoder *----------------------------------------------------------------*/ -#ifndef NONBE_FIX_ISSUE_2206 - Scale_sig( old_wsp_fx[0], L_WSP, sub( e_old_wsp[0], Q16 ) ); // Q(15-16) - e_old_wsp[0] = Q16; - move16(); -#endif IF( NE_32( ( error = ivas_core_enc_fx( hSCE, NULL, NULL, 1, old_inp_12k8_fx, old_inp_16k_fx, Q_new, ener_fx, A_fx, Aw_fx, epsP_fx, epsP_fx_q, lsp_new_fx, lsp_mid_fx, vad_hover_flag, attack_flag, realBuffer_fx, imagBuffer_fx, &q_re_im_buf, old_wsp_fx, e_old_wsp, loc_harm, cor_map_sum_fx, vad_flag_dtx, enerBuffer_fx, enerBuffer_fx_exp, fft_buff_fx, 0, ivas_format, flag_16k_smc ) ), IVAS_ERR_OK ) ) { return error; diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index ac59949d6dabd5f8452400e53dfdc429db231a16..0bdd3d3fc4ddc428738daa20d5b4f745e4053a37 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -276,12 +276,8 @@ typedef struct stereo_dft_enc_data_struct const Word16 *dft_trigo_16k_fx; const Word16 *dft_trigo_32k_fx; -#ifdef NONBE_FIX_ISSUE_2206 Word32 output_mem_res_8k_fx[STEREO_DFT_OVL_8k]; // output_mem_res_8k_q Word16 output_mem_res_8k_q; // Q15 -#else - Word32 output_mem_res_8k_fx[STEREO_DFT_OVL_8k]; // Q15 -#endif Word32 res_cod_NRG_M_fx[STEREO_DFT_BAND_MAX]; // Q(31 - res_cod_NRG_M_fx_e[]) Word16 res_cod_NRG_M_fx_e[STEREO_DFT_BAND_MAX]; @@ -298,7 +294,6 @@ typedef struct stereo_dft_enc_data_struct Word16 past_dot_prod_real_fx_e[STEREO_DFT_NRG_PAST_LEN * STEREO_DFT_BAND_MAX]; Word32 past_dot_prod_imag_fx[STEREO_DFT_NRG_PAST_LEN * STEREO_DFT_BAND_MAX]; // Q(31 - past_dot_prod_imag_fx_e[]) Word16 past_dot_prod_imag_fx_e[STEREO_DFT_NRG_PAST_LEN * STEREO_DFT_BAND_MAX]; -#ifdef NONBE_FIX_ISSUE_2206 Word32 output_mem_dmx_fx[STEREO_DFT_OVL_MAX]; // output_mem_dmx_q Word32 output_mem_dmx_12k8_fx[STEREO_DFT_OVL_12k8]; // output_mem_dmx_12k8_q Word32 output_mem_dmx_16k_fx[STEREO_DFT_OVL_16k]; /*can hold 16, 12.8 or 32kHz signals*/ // output_mem_dmx_16k_q @@ -309,13 +304,6 @@ typedef struct stereo_dft_enc_data_struct Word16 output_mem_dmx_16k_q; /*can hold 16, 12.8 or 32kHz signals*/ // Q0 Word16 output_mem_dmx_32k_q; /*can hold 16, 12.8 or 32kHz signals*/ // Q0 Word16 output_mem_dmx_16k_shb_q; // Q0 -#else - Word32 output_mem_dmx_fx[STEREO_DFT_OVL_MAX]; // Q15 - Word32 output_mem_dmx_12k8_fx[STEREO_DFT_OVL_12k8]; // Q15 - Word32 output_mem_dmx_16k_fx[STEREO_DFT_OVL_16k]; /*can hold 16, 12.8 or 32kHz signals*/ // Q15 - Word32 output_mem_dmx_32k_fx[STEREO_DFT_OVL_32k]; /*can hold 16, 12.8 or 32kHz signals*/ // Q15 - Word32 output_mem_dmx_16k_shb_fx[STEREO_DFT_OVL_16k]; // Q15 -#endif Word16 input_mem_itd_fx[CPE_CHANNELS][STEREO_DFT_OVL_MAX]; Word16 q_input_mem_itd[CPE_CHANNELS]; Word32 gipd_fx[STEREO_DFT_ENC_DFT_NB]; // Q13 diff --git a/lib_enc/ivas_stereo_classifier_fx.c b/lib_enc/ivas_stereo_classifier_fx.c index f38e7c9158f2670e404024ab06782860335b4334..5ab5f221377533ba012ccfdad667b211a45ddfd9 100644 --- a/lib_enc/ivas_stereo_classifier_fx.c +++ b/lib_enc/ivas_stereo_classifier_fx.c @@ -1583,11 +1583,7 @@ static void edge_detect_fx( set_zero_fx( edge, EDGE_MAX_LEN ); /* set error at 0th index */ -#ifdef FIX_BASOP_2591_EDGE_DETECT_COMP IF( GT_32( L_shr( inp[0], 3 ), inp_max ) ) -#else - IF( GT_32( L_shr( inp[0], 6 ), inp_max ) ) -#endif { err0 = 0; move32(); diff --git a/lib_enc/ivas_stereo_dft_enc_fx.c b/lib_enc/ivas_stereo_dft_enc_fx.c index 095b918ef85b6d0a96458616d69cadb16edf9745..8d999b3e24f484ef5e4ae0087fb5aba67a45910a 100644 --- a/lib_enc/ivas_stereo_dft_enc_fx.c +++ b/lib_enc/ivas_stereo_dft_enc_fx.c @@ -444,10 +444,8 @@ static void stereo_dft_enc_open_fx( move16(); set32_fx( hStereoDft->output_mem_dmx_32k_fx, 0, STEREO_DFT_OVL_32k ); -#ifdef NONBE_FIX_ISSUE_2206 hStereoDft->output_mem_dmx_32k_q = Q31; move16(); -#endif hStereoDft->dft_zp = extract_l( Mpy_32_32( input_Fs, 12079596 /* STEREO_DFT_ZP_MAX_ENC / 48000 in Q31 */ ) ); move16(); @@ -501,7 +499,6 @@ static void stereo_dft_enc_open_fx( set_zero_fx( hStereoDft->output_mem_dmx_16k_fx, STEREO_DFT_OVL_16k ); set_zero_fx( hStereoDft->output_mem_dmx_16k_shb_fx, STEREO_DFT_OVL_16k ); set_zero_fx( hStereoDft->output_mem_res_8k_fx, STEREO_DFT_OVL_8k ); -#ifdef NONBE_FIX_ISSUE_2206 hStereoDft->output_mem_dmx_q = Q31; move16(); hStereoDft->output_mem_dmx_12k8_q = Q31; @@ -512,7 +509,6 @@ static void stereo_dft_enc_open_fx( move16(); hStereoDft->output_mem_res_8k_q = Q31; move16(); -#endif /*Bands: find the number of bands, Nyquist freq. is not taken into account*/ /* NFFT_inner = STEREO_DFT_N_MAX_ENC * inner_frame_tbl[max_bwidth] / L_FRAME48k; */ @@ -1039,7 +1035,6 @@ void stereo_dft_enc_analyze_fx( move32(); } -#ifdef NONBE_FIX_ISSUE_2206 /* Align Q values of the signals that need to be aligned in stereo_td_channel_extrapolate_fx() */ FOR( n = 0; n < n_channels; n++ ) { @@ -1095,59 +1090,10 @@ void stereo_dft_enc_analyze_fx( scale_sig32( pDFT_R, NFFT, q_shift ); DFT_e[1] = sub( DFT_e[1], q_shift ); move16(); -#else - FOR( n = 0; n < n_channels; n++ ) - { - Scale_sig( &mem[n][0], dft_ovl, sub( sts[n]->q_inp, q_input_mem[n] ) ); // Q(sts[n]->q_inp) - q_input_mem[n] = sts[n]->q_inp; - move16(); - } - /*overlapping parts*/ - FOR( i = 0; i < dft_ovl; i++ ) - { - pDFT_L[( dft_zp + i )] = L_mult0( mem[0][i], pWin[i] ); - move32(); - pDFT_L[( ( ( dft_zp + N ) + dft_ovl ) - 1 - i )] = L_mult0( input[0][offset + N + dft_ovl - 1 - i], pWin[i] ); - move32(); - - pDFT_R[dft_zp + i] = L_mult0( mem[1][i], pWin[i] ); - move32(); - pDFT_R[( ( dft_zp + N ) + dft_ovl ) - 1 - i] = L_mult0( input[1][offset + N + dft_ovl - 1 - i], pWin[i] ); - move32(); - } - - /*middle part*/ - FOR( i = 0; i < N - dft_ovl; i++ ) - { - pDFT_L[dft_zp + dft_ovl + i] = L_shr( L_deposit_h( input[0][offset + dft_ovl + i] ), 1 ); - move32(); - - pDFT_R[dft_zp + dft_ovl + i] = L_shr( L_deposit_h( input[1][offset + dft_ovl + i] ), 1 ); - move32(); - } - DFT_e[0] = sub( 31, add( 15, sts[0]->q_inp ) ); - move16(); - DFT_e[1] = sub( 31, add( 15, sts[1]->q_inp ) ); - move16(); - - Word16 q_shift, guarded_bits; - guarded_bits = find_guarded_bits_fx( NFFT ); - - q_shift = sub( L_norm_arr( pDFT_L, NFFT ), guarded_bits ); - scale_sig32( pDFT_L, NFFT, q_shift ); - DFT_e[0] = sub( DFT_e[0], q_shift ); - move16(); - - q_shift = sub( L_norm_arr( pDFT_R, NFFT ), guarded_bits ); - scale_sig32( pDFT_R, NFFT, q_shift ); - DFT_e[1] = sub( DFT_e[1], q_shift ); - move16(); -#endif rfft_fx( pDFT_L, trigo_enc, NFFT, -1 ); rfft_fx( pDFT_R, trigo_enc, NFFT, -1 ); -#ifdef NONBE_FIX_ISSUE_2206 test(); test(); IF( hStereoDft != NULL && hStereoDft->hConfig->hybrid_itd_flag && hStereoDft->hItd->td_itd[STEREO_DFT_OFFSET] ) @@ -1169,32 +1115,6 @@ void stereo_dft_enc_analyze_fx( move16(); } } -#else - /* update pointers to overlap memory */ - FOR( n = 0; n < n_channels; n++ ) - { - mem[n] = &input[n][sub( N, dft_ovl )]; - } - test(); - test(); - IF( hStereoDft != NULL && hStereoDft->hConfig->hybrid_itd_flag && hStereoDft->hItd->td_itd[STEREO_DFT_OFFSET] ) - { - FOR( n = 0; n < n_channels; n++ ) - { - Scale_sig( hStereoDft->input_mem_itd_fx[n], dft_ovl, sub( sts[n]->q_inp, hStereoDft->q_input_mem_itd[n] ) ); // Q(sts[n]->q_inp) - hStereoDft->q_input_mem_itd[n] = sts[n]->q_inp; - move16(); - Copy( hStereoDft->input_mem_itd_fx[n], input_mem[n], dft_ovl ); - } - } - ELSE - { - FOR( n = 0; n < n_channels; n++ ) - { - Copy( input[n] + input_frame - dft_ovl, input_mem[n], dft_ovl ); - } - } -#endif pop_wmops(); return; @@ -1208,12 +1128,8 @@ void stereo_dft_enc_analyze_fx( Word32 stereo_dft_enc_synthesize_fx( STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i/o: encoder stereo handle */ -#ifdef NONBE_FIX_ISSUE_2206 - Word32 *output_fx, /* i/o : output synthesis q_output */ - Word16 *q_output, /* i/o : output synthesis Q */ -#else - Word32 *output_fx, /* o : output synthesis Q15 */ -#endif + Word32 *output_fx, /* i/o : output synthesis q_output */ + Word16 *q_output, /* i/o : output synthesis Q */ Word16 *output_start_index, Word16 *output_end_index, const Word16 chan, /* i : channel number */ @@ -1229,9 +1145,7 @@ Word32 stereo_dft_enc_synthesize_fx( Word16 temp_exp; Word32 fac_fx; Word32 *mem_fx; -#ifdef NONBE_FIX_ISSUE_2206 Word16 *mem_q; -#endif const Word16 *trigo_fx; const Word32 *win_fx; const Word16 *win_ana_fx; @@ -1298,16 +1212,12 @@ Word32 stereo_dft_enc_synthesize_fx( IF( L_frame > 0 ) { mem_fx = hStereoDft->output_mem_dmx_16k_shb_fx; -#ifdef NONBE_FIX_ISSUE_2206 mem_q = &hStereoDft->output_mem_dmx_16k_shb_q; -#endif } ELSE { mem_fx = hStereoDft->output_mem_dmx_fx; -#ifdef NONBE_FIX_ISSUE_2206 mem_q = &hStereoDft->output_mem_dmx_q; -#endif } win_fx = hStereoDft->win_fx; win_ana_fx = hStereoDft->win_ana_fx; @@ -1333,9 +1243,7 @@ Word32 stereo_dft_enc_synthesize_fx( trigo_step = STEREO_DFT_TRIGO_SRATE_12k8_STEP; move16(); mem_fx = hStereoDft->output_mem_dmx_12k8_fx; -#ifdef NONBE_FIX_ISSUE_2206 mem_q = &hStereoDft->output_mem_dmx_12k8_q; -#endif win_fx = hStereoDft->win_12k8_fx; win_ana_fx = hStereoDft->win_ana_12k8_fx; @@ -1362,18 +1270,14 @@ Word32 stereo_dft_enc_synthesize_fx( IF( L_frame > 0 ) { mem_fx = hStereoDft->output_mem_dmx_16k_shb_fx; -#ifdef NONBE_FIX_ISSUE_2206 mem_q = &hStereoDft->output_mem_dmx_16k_shb_q; -#endif push_wmops( "DFT_synth_16k_shb" ); } ELSE { mem_fx = hStereoDft->output_mem_dmx_16k_fx; -#ifdef NONBE_FIX_ISSUE_2206 mem_q = &hStereoDft->output_mem_dmx_16k_q; -#endif push_wmops( "DFT_synth_16k" ); } @@ -1399,9 +1303,7 @@ Word32 stereo_dft_enc_synthesize_fx( trigo_step = STEREO_DFT_TRIGO_SRATE_32k_STEP; move16(); mem_fx = hStereoDft->output_mem_dmx_32k_fx; -#ifdef NONBE_FIX_ISSUE_2206 mem_q = &hStereoDft->output_mem_dmx_32k_q; -#endif win_fx = hStereoDft->win_32k_fx; win_ana_fx = hStereoDft->win_ana_32k_fx; @@ -1426,9 +1328,7 @@ Word32 stereo_dft_enc_synthesize_fx( trigo_step = STEREO_DFT_TRIGO_SRATE_8k_STEP; move16(); mem_fx = hStereoDft->output_mem_res_8k_fx; -#ifdef NONBE_FIX_ISSUE_2206 mem_q = &hStereoDft->output_mem_res_8k_q; -#endif win_fx = hStereoDft->win_8k_fx; win_ana_fx = hStereoDft->win_ana_8k_fx; @@ -1452,9 +1352,7 @@ Word32 stereo_dft_enc_synthesize_fx( ovl = -1; /* to avoid compilation warning */ move16(); mem_fx = NULL; /* to avoid compilation warning */ -#ifdef NONBE_FIX_ISSUE_2206 mem_q = NULL; -#endif win_ana_fx = NULL; /* to avoid compilation warning */ } @@ -1595,7 +1493,6 @@ Word32 stereo_dft_enc_synthesize_fx( /*Reconstruct */ /*IFFT*/ -#ifdef NONBE_FIX_ISSUE_2206 Word16 mem_shift, tmp_shift, tmp_q; scal_fac = sub( L_norm_arr( tmp_fx, NFFT ), find_guarded_bits_fx( NFFT ) ); @@ -1643,46 +1540,6 @@ Word32 stereo_dft_enc_synthesize_fx( output_fx[offset + N + i] = L_add_sat( L_temp, ifft_deviation ); // *q_output move32(); } -#else - scal_fac = sub( 1, find_guarded_bits_fx( NFFT ) ); - scale_sig32( tmp_fx, NFFT, scal_fac ); // Q16 - rfft_fx( tmp_fx, trigo_enc_fx, NFFT, +1 ); - Scale_sig32( tmp_fx, NFFT, sub( sub( DFT_in_fx_e, scal_fac ), 16 ) ); // Q15 - - FOR( i = 0; i < ovl; i++ ) - { - // output[offset + i] = mem[i] + tmp[zp + i] * win[i]; - output_fx[offset + i] = L_add_sat( mem_fx[i], Mpy_32_32( tmp_fx[zp + i], win_fx[i] ) ); // Q15 - move32(); - // mem[i] = tmp[zp + N + i] * win[ovl - 1 - i]; - mem_fx[i] = Mpy_32_32( tmp_fx[zp + N + i], win_fx[ovl - 1 - i] ); // Q15 - move32(); - } - - /*Middle->Copy*/ - FOR( i = 0; i < N - ovl; i++ ) - { - // output_fx[offset + ovl + i] = tmp[zp + ovl + i]; - output_fx[offset + ovl + i] = tmp_fx[zp + ovl + i]; // Q15 - move32(); - } - - /*-----------------------------------------------------------------* - * Lookahead: redress signal - *-----------------------------------------------------------------*/ - - FOR( i = 0; i < ovl; i++ ) - { - Word32 ifft_deviation = tmp_fx[zp + N + ovl]; // Q15 - move32(); - // output[offset + N + i] = ( tmp[zp + N + i] - ifft_deviation ) / win_ana[ovl - 1 - i] + ifft_deviation; - Word16 L_temp_e; - Word32 L_temp = BASOP_Util_Divide3232_Scale_newton( L_sub_sat( tmp_fx[zp + N + i], ifft_deviation ), L_deposit_h( win_ana_fx[ovl - 1 - i] ), &L_temp_e ); - L_temp = L_shl_sat( L_temp, L_temp_e ); - output_fx[offset + N + i] = L_add_sat( L_temp, ifft_deviation ); // Q15 - move32(); - } -#endif *output_start_index = offset; move16(); diff --git a/lib_enc/ivas_stereo_dft_td_itd_fx.c b/lib_enc/ivas_stereo_dft_td_itd_fx.c index 4a643aec88d2e2fc0547e7b0867163c15cff167f..d9c3608365e14fc780faba5826a325cf9bdf230e 100644 --- a/lib_enc/ivas_stereo_dft_td_itd_fx.c +++ b/lib_enc/ivas_stereo_dft_td_itd_fx.c @@ -304,7 +304,6 @@ static void stereo_td_channel_extrapolate_fx( r_l[0] = s_max( r_l[0], 1 ); move16(); flag = E_LPC_lev_dur_fx( r_h, r_l, A, NULL, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER, NULL ); -#ifdef NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION const Word16 headroom = sub( 0, norm_arr( A, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER + 1 ) ); /* headroom to avoid saturation of LPC synthesis */ Word16 q_A = sub( Q14, norm_s( A[0] ) ); Word16 q_residual = add( sub( q_shift, norm_s( A[0] ) ), sub( 1, headroom ) ); @@ -313,9 +312,6 @@ static void stereo_td_channel_extrapolate_fx( scale_sig( shift_input, input_frame, sub( s_min( q_shift, q_synthesis ), q_shift ) ); scale_sig( shift_combined, add( input_frame, input_frame ), sub( s_min( q_shift, q_synthesis ), q_shift ) ); q_shift = s_min( q_shift, q_synthesis ); -#else - Copy_Scale_sig( A, A, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER + 1, sub( norm_s( A[0] ), 2 ) ); -#endif IF( EQ_16( flag, 1 ) ) { g_lpc = 0; @@ -324,11 +320,7 @@ static void stereo_td_channel_extrapolate_fx( ELSE { /* get the residual */ -#ifdef NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION fir_fx( shift_combined + input_frame + size_ovl - itd_shift - STEREO_DFT_CHANNEL_EXTR_LPC_VEC_LIMIT, A, residual, mem_zero, STEREO_DFT_CHANNEL_EXTR_LPC_VEC_LIMIT, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER, 0, sub( Q15, q_A ) ); -#else - fir_fx( shift_combined + input_frame + size_ovl - itd_shift - STEREO_DFT_CHANNEL_EXTR_LPC_VEC_LIMIT, A, residual, mem_zero, STEREO_DFT_CHANNEL_EXTR_LPC_VEC_LIMIT, STEREO_DFT_CHANNEL_EXTR_LPC_ORDER, 0, 3 ); -#endif /* extend the residual */ /* to prevent out of bound reading */ diff --git a/lib_enc/ivas_stereo_ica_enc_fx.c b/lib_enc/ivas_stereo_ica_enc_fx.c index de17deb22718c77bb8f335f0738566256e75c932..6940f073f0bf632d465649fa266b740a2ada43fb 100644 --- a/lib_enc/ivas_stereo_ica_enc_fx.c +++ b/lib_enc/ivas_stereo_ica_enc_fx.c @@ -2278,9 +2278,7 @@ static void unclr_calc_corr_features_fx( } /* average energy of L and R channels */ -#ifdef FIX_NONBE_2580_USE_LENGTH_NOT_CONSTANT /* Note, that length is a fixed value equal to L_FRAME_DS, so 1/length = 1/160 = 13421772 */ -#endif hStereoClassif->ave_ener_L_fx = Mpy_32_32( hStereoTCA->E1_mem_fx, 13421772 /* 1/length in Q31*/ ); /* Q31-hStereoClassif->ave_ener_L_fx_e */ move32(); hStereoClassif->ave_ener_L_fx_e = hStereoTCA->E1_mem_exp; diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 91b6c24a69085e987b612ad02104bf8500e876e2..3694290b486bb388b5d974330d43a5bf17e27e10 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -612,16 +612,12 @@ static void icbwe_dft_stereo_param_fx( *-------------------------------------------------------------------*/ void stereo_icBWE_enc_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const Word16 shb_speech_ref_fx16[], /* i : SHB speech ref channel shb_speech_ref_q*/ const Word16 shb_speech_ref_q, /* i : SHB speech ref channel Q */ -#else - const Word16 shb_speech_ref_fx16[], /* i : SHB speech ref channel Q0*/ -#endif - Word16 shb_speech_nonref_fx_16[], /* i/o: SHB speech non-ref channel shb_speech_nonref_e*/ - Word16 shb_speech_nonref_e, /* i/o: SHB speech non-ref channel */ - const Word16 *voice_factors_fx16 /* i : voicing factors Q15 */ + Word16 shb_speech_nonref_fx_16[], /* i/o: SHB speech non-ref channel shb_speech_nonref_e*/ + Word16 shb_speech_nonref_e, /* i/o: SHB speech non-ref channel */ + const Word16 *voice_factors_fx16 /* i : voicing factors Q15 */ ) { Word16 i, j, k, nbSubFr; @@ -652,11 +648,7 @@ void stereo_icBWE_enc_fx( shb_speech_ref_e = add( getScaleFactor16( shb_speech_ref_fx16, L_FRAME16k ), Q16 ); Copy_Scale_sig_16_32_no_sat( shb_speech_ref_fx16, shb_speech_ref_fx, L_FRAME16k, shb_speech_ref_e ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT shb_speech_ref_e = sub( sub( Q31, shb_speech_ref_e ), shb_speech_ref_q ); -#else - shb_speech_ref_e = Q31 - shb_speech_ref_e; -#endif shb_speech_nonref_e = Q15 - shb_speech_nonref_e; Copy_Scale_sig_16_32_no_sat( shb_speech_nonref_fx_16, shb_speech_nonref_fx, L_FRAME48k + STEREO_DFT_OVL_MAX, Q16 ); // q_new_swb_speech_buffer+st->q_inp - 16 - > q_new_swb_speech_buffer+st->q_inp diff --git a/lib_enc/ivas_stereo_mdct_core_enc_fx.c b/lib_enc/ivas_stereo_mdct_core_enc_fx.c index 288b5c25baa2f1d12261620ec95ef55b94b84fff..72b47efc70414736b79248f26e0a87bbb2ad0688 100644 --- a/lib_enc/ivas_stereo_mdct_core_enc_fx.c +++ b/lib_enc/ivas_stereo_mdct_core_enc_fx.c @@ -128,13 +128,9 @@ static void sync_tcx_mode_fx( *-------------------------------------------------------------------*/ void stereo_mdct_core_enc_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ -#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ Word16 new_samples[CPE_CHANNELS][L_INP], /* i : new samples Q_new[]-1*/ Word16 *Q_new, -#else - Word16 new_samples[CPE_CHANNELS][L_INP], /* i : new samples Q0*/ -#endif Word16 old_wsp[CPE_CHANNELS][L_WSP], /* i : 12.8kHz weighted speech (for LTP Qx*/ Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k] /* o : floating pitch for each subframe Q6*/ ) @@ -213,21 +209,13 @@ void stereo_mdct_core_enc_fx( st = sts[i]; shift = norm_arr( st->input_fx, input_frame ); -#ifdef NONBE_FIX_ISSUE_2206 Q_min = add( st->q_inp, shift ); -#else - Q_min = s_max( -2, add( st->q_inp, shift ) ); -#endif scale_sig( st->input_fx, input_frame, sub( Q_min, st->q_inp ) ); st->q_inp = Q_min; move16(); shift = norm_arr( st->input_fx - input_frame, input_frame ); -#ifdef NONBE_FIX_ISSUE_2206 Q_min = add( st->q_old_inp, shift ); -#else - Q_min = s_max( -2, add( st->q_old_inp, shift ) ); -#endif scale_sig( st->input_fx - input_frame, input_frame, sub( Q_min, st->q_old_inp ) ); st->q_old_inp = Q_min; move16(); @@ -328,13 +316,8 @@ void stereo_mdct_core_enc_fx( * - TNS *---------------------------------------------------------------*/ -#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549 ivas_mdct_core_whitening_enc_fx( hCPE, new_samples, Q_new, old_wsp, pitch_buf_fx, p_mdst_spectrum_long_fx, tnsBits, p_orig_spectrum_long_fx, tnsSize, p_param, hBstr, 0, CPE_CHANNELS, mdst_spectrum_e, orig_spectrum_e ); -#else - ivas_mdct_core_whitening_enc_fx( hCPE, new_samples, old_wsp, pitch_buf_fx, p_mdst_spectrum_long_fx, - tnsBits, p_orig_spectrum_long_fx, tnsSize, p_param, hBstr, 0, CPE_CHANNELS, mdst_spectrum_e, orig_spectrum_e ); -#endif FOR( i = 0; i < CPE_CHANNELS; i++ ) { diff --git a/lib_enc/ivas_stereo_switching_enc_fx.c b/lib_enc/ivas_stereo_switching_enc_fx.c index 6eb239f1e6589484acb9c9b98e1d8982ef4b880b..84f2c721367ae809d6f8f1eddea2b5823b544795 100644 --- a/lib_enc/ivas_stereo_switching_enc_fx.c +++ b/lib_enc/ivas_stereo_switching_enc_fx.c @@ -667,10 +667,8 @@ void stereo_switching_enc_fx( /* save original stereo input (MDCT overlap part) for both channels in unused old input of right channel for possible DFT->MDCT transition */ IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) { -#ifdef NONBE_FIX_ISSUE_2206 assert( sts[0]->q_inp32 == sts[1]->q_old_inp32 ); assert( sts[1]->q_inp32 == sts[1]->q_old_inp32 ); -#endif Copy32( sts[0]->input32_fx + sub( extract_l( Mpy_32_32( sts[0]->input_Fs, 42949673 /* 1/50 in Q31*/ ) ), sts[0]->encoderLookahead_FB ), sts[1]->input32_fx - shl( sts[0]->encoderLookahead_FB, 1 ), sts[0]->encoderLookahead_FB ); /* sts[0]->q_inp32 */ Copy32( sts[1]->input32_fx + sub( extract_l( Mpy_32_32( sts[1]->input_Fs, 42949673 /* 1/50 in Q31*/ ) ), sts[1]->encoderLookahead_FB ), sts[1]->input32_fx - sts[1]->encoderLookahead_FB, sts[1]->encoderLookahead_FB ); /* sts[1]->q_inp32 */ @@ -683,23 +681,15 @@ void stereo_switching_enc_fx( /* window DFT synthesis overlap memory @input_Fs, primary channel */ FOR( i = 0; i < dft_ovl; i++ ) { -#ifdef NONBE_FIX_ISSUE_2206 hCPE->hStereoDft->output_mem_dmx_fx[i] = Mpy_32_32_r( hCPE->hStereoDft->win_fx[dft_ovl - 1 - i], old_input_signal_pri[input_frame - dft_ovl + i] ); // q_inp -#else - hCPE->hStereoDft->output_mem_dmx_fx[i] = L_shl_sat( Mpy_32_32_r( hCPE->hStereoDft->win_fx[dft_ovl - 1 - i], old_input_signal_pri[input_frame - dft_ovl + i] ), sub( 15, q_inp ) ); // Q15 -#endif move32(); } -#ifdef NONBE_FIX_ISSUE_2206 hCPE->hStereoDft->output_mem_dmx_q = q_inp; move16(); -#endif /* reset 48kHz BWE overlap memory */ set32_fx( hCPE->hStereoDft->output_mem_dmx_32k_fx, 0, STEREO_DFT_OVL_32k ); -#ifdef NONBE_FIX_ISSUE_2206 hCPE->hStereoDft->output_mem_dmx_32k_q = Q31; move16(); -#endif stereo_dft_enc_reset_fx( hCPE->hStereoDft ); @@ -726,7 +716,6 @@ void stereo_switching_enc_fx( hCPE->hStereoDft->res_pred_counter = STEREO_DFT_FEC_THRESHOLD; move16(); -#ifdef NONBE_FIX_ISSUE_2206 /* update DFT synthesis overlap memory @12.8kHz */ FOR( i = 0; i < STEREO_DFT_OVL_12k8; i++ ) { @@ -735,46 +724,18 @@ void stereo_switching_enc_fx( } hCPE->hStereoDft->output_mem_dmx_12k8_q = sub( Q31, sts[0]->exp_buf_speech_enc ); move16(); -#else - /* update DFT synthesis overlap memory @12.8kHz */ - FOR( i = 0; i < STEREO_DFT_OVL_12k8; i++ ) - { - hCPE->hStereoDft->output_mem_dmx_12k8_fx[i] = L_shr( Mpy_32_16_r( hCPE->hStereoDft->win_12k8_fx[STEREO_DFT_OVL_12k8 - 1 - i], sts[0]->buf_speech_enc[L_FRAME32k + L_FRAME - STEREO_DFT_OVL_12k8 + i] ), sub( 16, sts[0]->exp_buf_speech_enc ) ); /* Q15 */ - move32(); - } -#endif -#ifdef NONBE_FIX_ISSUE_2206 Word16 q_dmx = hCPE->hStereoDft->output_mem_dmx_q; -#else - Word16 q_dmx = Q15; -#endif move16(); /* update DFT synthesis overlap memory @16kHz, primary channel only */ L_lerp_fx( hCPE->hStereoDft->output_mem_dmx_fx, hCPE->hStereoDft->output_mem_dmx_16k_fx, STEREO_DFT_OVL_16k, dft_ovl, &q_dmx ); -#ifdef NONBE_FIX_ISSUE_2206 hCPE->hStereoDft->output_mem_dmx_16k_q = q_dmx; move16(); -#else - FOR( i = 0; i < STEREO_DFT_OVL_16k; i++ ) - { - hCPE->hStereoDft->output_mem_dmx_16k_fx[i] = L_shl( hCPE->hStereoDft->output_mem_dmx_16k_fx[i], sub( Q15, q_dmx ) ); // Q15 - move32(); - } - - FOR( i = 0; i < STEREO_DFT_OVL_MAX; i++ ) - { - hCPE->hStereoDft->output_mem_dmx_fx[i] = L_shl( hCPE->hStereoDft->output_mem_dmx_fx[i], sub( Q15, q_dmx ) ); // Q15 - move32(); - } -#endif /* reset DFT synthesis overlap memory @8kHz, secondary channel */ set32_fx( hCPE->hStereoDft->output_mem_res_8k_fx, 0, STEREO_DFT_OVL_8k ); -#ifdef NONBE_FIX_ISSUE_2206 hCPE->hStereoDft->output_mem_res_8k_q = Q15; move16(); -#endif hCPE->hCoreCoder[1]->vad_flag = 0; move16(); @@ -893,10 +854,8 @@ void stereo_switching_enc_fx( /* no secondary channel in the previous frame -> memory resets */ set16_fx( sts[1]->old_inp_12k8_fx, 0, L_INP_MEM ); set16_fx( sts[1]->mem_decim_fx, 0, 2 * L_FILT_MAX ); -#ifdef NONBE_FIX_ISSUE_2206 sts[1]->q_mem_decim_fx = Q15; move16(); -#endif sts[1]->mem_preemph_fx = 0; move16(); @@ -963,9 +922,7 @@ void stereo_switching_enc_fx( { /* cross-fade overlap region of DFT Stereo downmix and original stereo channels */ tmp_fx = div_s( 64, shl( sts[0]->encoderLookahead_FB, Q6 ) ); /* Q15 */ -#ifdef NONBE_FIX_ISSUE_2206 assert( sts[0]->q_old_inp32 == sts[1]->q_old_inp32 ); -#endif FOR( i = 0; i < sts[0]->encoderLookahead_FB; i++ ) { sts[1]->input32_fx[-sts[0]->encoderLookahead_FB + i] = ( Mpy_32_16_1( L_add( imult3216( sts[0]->input32_fx[-sts[0]->encoderLookahead_FB + i], sts[0]->encoderLookahead_FB - i ), imult3216( sts[1]->input32_fx[-sts[0]->encoderLookahead_FB + i], i ) ), tmp_fx ) ); /* sts[0]->q_inp32 */ diff --git a/lib_enc/ivas_stereo_td_analysis_fx.c b/lib_enc/ivas_stereo_td_analysis_fx.c index 19dbdd93e043df073ab90ecffe0d3d69d3e8739b..4a0e90bf05c4dd0264e5bfd07c477732b0d54460 100644 --- a/lib_enc/ivas_stereo_td_analysis_fx.c +++ b/lib_enc/ivas_stereo_td_analysis_fx.c @@ -173,10 +173,8 @@ Word16 stereo_tdm_ener_analysis_fx( Get_LR_rms_fx( sts[0]->input_fx, sts[1]->input_fx, input_frame, &rms_L_fx, &q_rms_L, &rms_R_fx, &q_rms_R ); -#ifdef NONBE_FIX_ISSUE_2206 q_rms_L = add( q_rms_L, sts[0]->q_inp ); q_rms_R = add( q_rms_R, sts[1]->q_inp ); -#endif /*----------------------------------------------------------------* * Compute the 1st order energy difference difference @@ -840,35 +838,13 @@ static Word16 Get_dt_lt_ener_fx( Word32 es_em_fx; Word16 tmp_SM_flag, tdm_SM_flag_loc; Word32 L_tmp, L_tmp1; -#ifdef NONBE_FIX_ISSUE_2206 Word16 exp_diff; -#else - Word16 exp_diff, tmp; -#endif sts = hCPE->hCoreCoder; Left_in_fx = sts[0]->input_fx; /* Left channel sts[0]->q_inp*/ Right_in_fx = sts[1]->input_fx; /* Right channel sts[1]->q_inp*/ -#ifndef NONBE_FIX_ISSUE_2206 - tmp = sub( getScaleFactor16( sts[0]->input_fx, input_frame ), 1 ); - Scale_sig( sts[0]->input_fx, input_frame, tmp ); /* sts[0]->q_inp + tmp */ - sts[0]->q_inp = add( tmp, sts[0]->q_inp ); - move16(); - - tmp = getScaleFactor16( sts[1]->input_fx, input_frame ); - Scale_sig( sts[1]->input_fx, input_frame, tmp ); /* sts[1]->q_inp + tmp */ - sts[1]->q_inp = add( tmp, sts[1]->q_inp ); - move16(); - - Scale_sig( sts[0]->input_fx, input_frame, sub( s_min( sts[0]->q_inp, sts[1]->q_inp ), sts[0]->q_inp ) ); /* s_min( sts[0]->q_inp, sts[1]->q_inp ) */ - Scale_sig( sts[1]->input_fx, input_frame, sub( s_min( sts[0]->q_inp, sts[1]->q_inp ), sts[1]->q_inp ) ); /* s_min( sts[0]->q_inp, sts[1]->q_inp ) */ - sts[1]->q_inp = s_min( sts[0]->q_inp, sts[1]->q_inp ); - move16(); - sts[0]->q_inp = sts[1]->q_inp; - move16(); -#endif tdm_SM_flag_loc = tdm_last_SM_flag; /* Q0 */ move16(); diff --git a/lib_enc/ivas_tcx_core_enc_fx.c b/lib_enc/ivas_tcx_core_enc_fx.c index fdc43a6db8b586c1dc5a02c3778e13d0dce15f62..0522658cb8cb029444907481f5fd816fd5efd8d6 100644 --- a/lib_enc/ivas_tcx_core_enc_fx.c +++ b/lib_enc/ivas_tcx_core_enc_fx.c @@ -315,21 +315,11 @@ void stereo_tcx_core_enc( IF( EQ_16( st->L_frame, L_FRAME ) ) { -#if ( defined SIMPLIFY_CORE_ENC && !defined NONBE_FIX_ISSUE_2206 ) - Scale_sig( new_samples_12k8 - L_INP_MEM, L_INP_12k8, sub( Q1, Q_new ) ); /* Q0 */ - p_new_samples = new_samples_12k8; /* Q0 */ -#else p_new_samples = new_samples_12k8; /* Q_new */ -#endif } ELSE { -#if ( defined SIMPLIFY_CORE_ENC && !defined NONBE_FIX_ISSUE_2206 ) - Scale_sig( new_samples_16k - L_INP_MEM, L_INP, sub( Q1, Q_new ) ); /* Q0 */ - p_new_samples = new_samples_16k; /* Q0 */ -#else p_new_samples = new_samples_16k; /* Q_new */ -#endif } /*--------------------------------------------------------------* @@ -394,13 +384,6 @@ void stereo_tcx_core_enc( * Core Signal Analysis: MDCT, TNS, LPC analysis *---------------------------------------------------------------*/ -#ifndef NONBE_FIX_ISSUE_2206 - st->prev_Q_new = 0; - st->Q_old = 0; - - Q_new = 0; - move16(); -#endif core_signal_analysis_high_bitrate_ivas_fx( p_new_samples, T_op, lsp_new_fx, lsp_mid_fx, st, tnsSize, tnsBits, param_core, <pBits, NULL, st->L_frame, hTcxEnc->L_frameTCX, last_element_mode, vad_hover_flag, NULL, NULL, &Q_new, NULL ); bitsAvailable = sub( st->bits_frame_core, nbits_header ); @@ -581,33 +564,22 @@ void stereo_tcx_core_enc( s = sub( norm_arr( st->synth, st->L_frame ), 2 ); s = s_min( s, norm_arr( st->hLPDmem->syn, M ) ); -#ifdef NONBE_FIX_ISSUE_2206 Word16 wspeech_backup = 0; move16(); -#endif IF( st->tcxonly == 0 ) { -#ifdef NONBE_FIX_ISSUE_2206 s = s_min( s, add( norm_s( st->wspeech_enc[st->L_frame - 1] ), sub( Q15, st->exp_buf_wspeech_enc ) ) ); /* st->wspeech_enc[st->L_frame - 1] needs to be at the same scale as st->synth, st->Q_syn = 0 + s, inside tcx_encoder_memory_update_ivas_fx() */ wspeech_backup = st->wspeech_enc[st->L_frame - 1]; move16(); st->wspeech_enc[st->L_frame - 1] = shl( st->wspeech_enc[st->L_frame - 1], sub( s, sub( Q15, st->exp_buf_wspeech_enc ) ) ); -#else - s = s_min( s, norm_s( st->wspeech_enc[st->L_frame - 1] ) ); - st->wspeech_enc[st->L_frame - 1] = shl( st->wspeech_enc[st->L_frame - 1], s ); -#endif } Scale_sig( st->synth, st->L_frame, s ); /* st->Q_syn + s */ Scale_sig( st->hLPDmem->syn, M + 1, s ); /* st->Q_syn + s */ st->hLPDmem->q_lpd_syn = add( st->hLPDmem->q_lpd_syn, s ); -#ifdef NONBE_FIX_ISSUE_2206 assert( st->Q_syn == 0 ); Q_new = s; -#else - Q_new = add( Q_new, s ); -#endif move16(); coder_tcx_post_ivas_fx( st, st->hLPDmem, st->hTcxCfg, st->synth, A_q_fx, Aw_fx, st->wspeech_enc, Q_new ); @@ -741,39 +713,17 @@ void stereo_tcx_core_enc( move16(); } } -#ifdef NONBE_FIX_ISSUE_2206 Scale_sig( st->synth, st->L_frame, negate( s ) ); -#else - Scale_sig( st->synth, st->L_frame, -Q_new ); -#endif IF( st->tcxonly == 0 ) { -#ifdef NONBE_FIX_ISSUE_2206 /* Revert scale change from above. */ st->wspeech_enc[st->L_frame - 1] = wspeech_backup; -#else - st->wspeech_enc[st->L_frame - 1] = shl( st->wspeech_enc[st->L_frame - 1], -st->Q_syn ); - move16(); -#endif } /*--------------------------------------------------------------------------------* * Scaling of buffers *--------------------------------------------------------------------------------*/ -#ifndef NONBE_FIX_ISSUE_2206 - IF( EQ_16( st->L_frame, L_FRAME ) ) - { - Scale_sig( new_samples_12k8 - L_INP_MEM, L_INP_12k8, sub( Q_new_orig, Q1 ) ); /* Q_new - 1 */ - } - ELSE - { - Scale_sig( new_samples_16k - L_INP_MEM, L_INP, sub( Q_new_orig, Q1 ) ); /* Q_new - 1 */ - } - Scale_sig( hTcxEnc->old_out_fx, L_FRAME32k, negate( hTcxEnc->Q_old_out ) ); // scaling back to Q0 - hTcxEnc->Q_old_out = 0; - move16(); -#endif stereo_tcx_enc_scale_buffers( st, 1, Q_spec_old ); pop_wmops(); @@ -849,12 +799,8 @@ Word16 ivas_acelp_tcx20_switching_fx( Encoder_State *st, /* i/o: encoder state structure */ Word16 *inp_fx, Word16 q_inp, -#ifdef NONBE_FIX_ISSUE_2206 - Word16 *wsp, /* q_wsp i : input weighted signal */ - Word16 q_wsp, /* i : Q of input weighted signal */ -#else - Word16 *wsp, /*q_inp i : input weighted signal */ -#endif + Word16 *wsp, /* q_wsp i : input weighted signal */ + Word16 q_wsp, /* i : Q of input weighted signal */ Word32 non_staX, /*Q20 i : unbound non-stationarity for sp/mu clas*/ Word16 *pitch_fr, /*Q6 i : fraction pitch values */ Word16 *voicing_fr, /*Q15 i : fractional voicing values */ @@ -1029,11 +975,7 @@ Word16 ivas_acelp_tcx20_switching_fx( xn_buf_fx[L_frame + i] = mult( xn_buf_fx[L_frame + i], window_fx[overlap - 1 - i] ); /* q_inp */ move16(); } -#ifdef NONBE_FIX_ISSUE_2206 e_x = sub( Q15, q_inp ); /*exponent for xn_buf_fx*/ -#else - e_x = sub( 16, q_inp ); /*exponent for xn_buf_fx*/ -#endif move16(); TCX_MDCT( xn_buf_fx, x_fx, &e_x, overlap, sub( L_frame, overlap ), overlap, st->element_mode ); scale_A = getScaleFactor32( x_fx, L_frame ); @@ -1048,11 +990,7 @@ Word16 ivas_acelp_tcx20_switching_fx( move32(); move32(); } -#ifdef NONBE_FIX_ISSUE_2206 e_x = add( e_x, Q15 - Q9 + 1 ); -#else - e_x = add( e_x, 6 ); -#endif basop_weight_a( A_q_tcx_fx, Ap_fx, 30147 /*0.92 in Q15*/ ); basop_lpc2mdct_fx( Ap_fx, M, gainlpc_fx, gainlpc_e, gainlpc_noinv, gainlpc_noinv_e ); @@ -1261,11 +1199,7 @@ Word16 ivas_acelp_tcx20_switching_fx( FOR( j = 0; j < L_SUBFR; j++ ) { -#ifdef NONBE_FIX_ISSUE_2206 tmp32 = BASOP_Util_Add_Mant32Exp( tmp32, temp32_e, L_mult0( wsp[i + j], wsp[i + j] ), sub( 31, add( q_wsp, q_wsp ) ), &temp32_e ); /* Q31-temp32_e */ -#else - tmp32 = BASOP_Util_Add_Mant32Exp( tmp32, temp32_e, L_mult0( wsp[i + j], wsp[i + j] ), sub( 31, add( q_inp, q_inp ) ), &temp32_e ); /* Q31-temp32_e */ -#endif } IF( tmp32 == 0 ) { @@ -1337,19 +1271,11 @@ Word16 ivas_acelp_tcx20_switching_fx( move16(); FOR( j = 0; j < L_SUBFR; j++ ) { -#ifdef NONBE_FIX_ISSUE_2206 tmp32 = Mpy_32_16_1( gain, wsp[i + j - T0] ); // Q16 + q_wsp - 15 tmp32 = L_sub( wsp[i + j], L_shr( tmp32, 1 ) ); // q_wsp tmp16 = norm_l( tmp32 ); tmp32 = L_shl( tmp32, tmp16 ); // q_wsp +tmp16 noise = BASOP_Util_Add_Mant32Exp( noise, noise_e, Mpy_32_32( tmp32, tmp32 ), shl( sub( 31, add( q_wsp, tmp16 ) ), 1 ), &noise_e ); // noise_e -#else - tmp32 = Mpy_32_16_1( gain, wsp[i + j - T0] ); // Q16 + q_inp - 15 - tmp32 = L_sub( wsp[i + j], L_shr( tmp32, 1 ) ); // q_inp - tmp16 = norm_l( tmp32 ); - tmp32 = L_shl( tmp32, tmp16 ); // q_inp +tmp16 - noise = BASOP_Util_Add_Mant32Exp( noise, noise_e, Mpy_32_32( tmp32, tmp32 ), shl( sub( 31, add( q_inp, tmp16 ) ), 1 ), &noise_e ); // noise_e -#endif } test(); IF( noise == 0 || EQ_32( noise, 1 ) ) diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 9e5ffe732f0f4e85dc3ada309ca0b89f69351569..7dc28e4964ad3459d30340be8ee3ed45e6f513e1 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -531,26 +531,17 @@ void swb_bwe_enc_fx( Word16 Q_slb_speech ); void swb_CNG_enc_fx( - Encoder_State *st_fx, /* i/o: State structure */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT - const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz */ - const Word16 shb_speech_q, /* i : SHB target signal Q (6-14kHz) at 16kHz */ -#else - const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz */ -#endif + Encoder_State *st_fx, /* i/o: State structure */ + const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz */ + const Word16 shb_speech_q, /* i : SHB target signal Q (6-14kHz) at 16kHz */ const Word16 *syn_12k8_16k_fx /* i : ACELP core synthesis at 12.8kHz or 16kHz */ ); void swb_pre_proc_fx( - Encoder_State *st, /* i/o: encoder state structure */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT - Word16 *new_swb_speech, /* o : original input signal at 32kHz - st->q_inp */ - Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz - shb_speech_q */ - Word16 *shb_speech_q, /* o : SHB target signal (6-14kHz) at 16kHz - Q */ -#else - Word16 *new_swb_speech, /* o : original input signal at 32kHz - Q0 */ - Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz - Q0*/ -#endif + Encoder_State *st, /* i/o: encoder state structure */ + Word16 *new_swb_speech, /* o : original input signal at 32kHz - st->q_inp */ + Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz - shb_speech_q */ + Word16 *shb_speech_q, /* o : SHB target signal (6-14kHz) at 16kHz - Q */ Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real buffer Q - q_reImbuffer */ Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag buffer Q - q_reImbuffer */ Word16 q_reImBuffer, /* i : scale data of real and imag CLDFB buffers*/ @@ -617,36 +608,23 @@ void vad_param_updt_fx( ); void wb_bwe_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ -#ifdef NONBE_FIX_ISSUE_2206 + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *new_wb_speech_fx, /* i : original i signal at 16kHz */ const Word16 new_wb_speech_q /* i : Q of new_wb_speech_fx */ -#else - const Word16 *new_wb_speech_fx /* i : original i signal at 16kHz */ -#endif ); void wb_pre_proc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 last_element_mode, /* i : last element mode */ -#ifdef NONBE_FIX_ISSUE_2206 + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 last_element_mode, /* i : last element mode */ const Word16 *new_inp_resamp16k, /* i : original input signal in new_inp_resamp16k_q */ Word16 *hb_speech, /* o : HB target signal (6-8kHz) at 16kHz in Q-1 */ const Word16 new_inp_resamp16k_q /* i : Q of new_inp_resamp16k */ -#else - const Word16 *new_inp_resamp16k, /* i : original input signal in Q-1 */ - Word16 *hb_speech /* o : HB target signal (6-8kHz) at 16kHz in Q-1 */ -#endif ); void wb_tbe_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ -#ifdef NONBE_FIX_ISSUE_2206 - const Word16 *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz q_hb_speech */ - const Word16 q_hb_speech, /* i : Q of HB target signal (6-8kHz) at 16kHz Q0 */ -#else - const Word16 *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz Q(-1) */ -#endif + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz q_hb_speech */ + const Word16 q_hb_speech, /* i : Q of HB target signal (6-8kHz) at 16kHz Q0 */ const Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation Q(2*Q_new) */ const Word16 Q_new, /* i : input HB speech Q factor */ const Word16 voice_factors[], /* i : voicing factors Q15 */ @@ -1144,9 +1122,6 @@ void tcx_encoder_memory_update_ivas_fx( Word16 preemph, /* i : preemphasis factor, Q15 */ LPD_state *LPDmem, /* i/o: coder memory state */ Encoder_State *st, -#ifndef NONBE_FIX_ISSUE_2206 - Word16 *synthout, /* Q_new */ -#endif Word16 Q_new ); void tcx_encoder_memory_update_fx( @@ -1976,14 +1951,10 @@ void core_signal_analysis_high_bitrate_fx( Word16 *Q_new ); void core_signal_analysis_high_bitrate_ivas_fx( -#ifdef NONBE_FIX_ISSUE_2206 const Word16 *new_samples, /*i : Q_new-1 */ -#else - const Word16 *new_samples, /*i : Q0 */ -#endif - const Word16 T_op[3], /* i : open-loop pitch values for quantiz. Q0*/ - Word16 lsp_new[], /* Q15 */ - Word16 lsp_mid[], /* Q15 */ + const Word16 T_op[3], /* i : open-loop pitch values for quantiz. Q0*/ + Word16 lsp_new[], /* Q15 */ + Word16 lsp_mid[], /* Q15 */ Encoder_State *st, Word16 pTnsSize[], /* Q0 */ Word16 pTnsBits[], /* Q0 */ diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 865550aad3e62cac168df8f6adfb8bae00b43b6e..34f3c56bc60c4213bad7dff4acbf9554d4420b3b 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -916,20 +916,14 @@ typedef struct amrwb_io_enc_structure typedef struct td_bwe_enc_structure { -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Word16 old_speech_shb_fx[L_LOOK_16k + L_SUBFR16k]; /* Buffer memories Q(old_speech_shb_q) */ Word16 old_speech_shb_q; -#else - Word16 old_speech_shb_fx[L_LOOK_16k + L_SUBFR16k]; /* Buffer memories Q(Q_shb_spch) */ -#endif Word16 old_speech_wb_fx[( L_LOOK_12k8 + L_SUBFR ) * 5 / 16]; /* Buffer memories Q(-1) */ Word16 old_input_fhb_fx[NS2SA( 48000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) - L_FRAME48k / 2]; /* Q(old_input_fhb_fx_Q) */ Word16 old_input_fhb_fx_Q; Word16 prev_lsp_shb_fx[LPC_SHB_ORDER]; /* Q15 */ Word16 state_ana_filt_shb_fx[( 2 * ALLPASSSECTIONS_STEEP + 1 )]; /* states for the analysis filters */ -#ifdef NONBE_FIX_ISSUE_2206 Word16 state_ana_filt_shb_fx_Q; -#endif Word16 cldfbHBLT; /* Q13 */ /* states for the filters used in generating SHB excitation from WB excitation*/ Word32 mem_csfilt_fx[2]; /* Q(prev_Q_bwe_exc) */ @@ -965,12 +959,8 @@ typedef struct td_bwe_enc_structure Word32 prev_gainFr_SHB_fx; /* Q18 */ Word16 lsp_shb_slow_interpl_fx[LPC_SHB_ORDER]; /* Q15 */ Word16 lsp_shb_fast_interpl_fx[LPC_SHB_ORDER]; /* Q15 */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT - Word16 shb_inv_filt_mem_fx[LPC_SHB_ORDER]; /* Q(shb_inv_filt_mem_q) */ + Word16 shb_inv_filt_mem_fx[LPC_SHB_ORDER]; /* Q(shb_inv_filt_mem_q) */ Word16 shb_inv_filt_mem_q; -#else - Word16 shb_inv_filt_mem_fx[LPC_SHB_ORDER]; /* Q(Q_shb_spch) */ -#endif Word16 lsp_shb_spacing_fx[3]; /* Q15 */ Word16 prev_swb_GainShape_fx; /* Q15 */ Word16 prev_frGainAtten; @@ -1001,14 +991,9 @@ typedef struct td_bwe_enc_structure Word16 gFrame_WB; Word16 idxGain; -#ifdef NONBE_FIX_ISSUE_2206 Word16 dec_2_over_3_mem_fx[L_FILT_2OVER3]; /* dec_2_over_3_mem_q */ Word16 dec_2_over_3_mem_lp_fx[6]; /* dec_2_over_3_mem_q */ Word16 dec_2_over_3_mem_q; -#else - Word16 dec_2_over_3_mem_fx[L_FILT_2OVER3]; - Word16 dec_2_over_3_mem_lp_fx[6]; -#endif Word16 tbe_demph_fx; /* Q(prev_Q_bwe_exc - 16 - NOISE_QADJ) */ Word16 tbe_premph_fx; /* Q(prev_Q_bwe_exc - 16) */ @@ -1035,21 +1020,13 @@ typedef struct fd_bwe_enc_structure { Word16 new_input_hp_fx[NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS )]; // Q_new_input_hp Word16 Q_new_input_hp; -#ifdef NONBE_FIX_ISSUE_2206 Word16 old_input_fx[NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS )]; // Q(old_input_q) Word16 old_input_q; -#else - Word16 old_input_fx[NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS )]; // st->q_inp -#endif Word16 old_input_wb_fx[NS2SA( 16000, DELAY_FD_BWE_ENC_NS )]; /* Q(-1) */ Word16 old_input_lp_fx[NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS )]; // st->hBWE_FD->prev_Q_input_lp Word16 old_syn_12k8_16k_fx[NS2SA( 16000, DELAY_FD_BWE_ENC_NS )]; // st->Q_syn -#ifdef NONBE_FIX_ISSUE_2206 - Word16 old_fdbwe_speech_fx[L_FRAME48k]; // Q(old_fdbwe_speech_q) for IVAS, Q(-1) for EVS. + Word16 old_fdbwe_speech_fx[L_FRAME48k]; // Q(old_fdbwe_speech_q) for IVAS, Q(-1) for EVS. Word16 old_fdbwe_speech_q; -#else - Word16 old_fdbwe_speech_fx[L_FRAME48k]; -#endif Word16 mem_deemph_old_syn_fx; Word16 q_mem_deemph_old_syn; Word16 prev_mode; @@ -1449,19 +1426,13 @@ typedef struct enc_core_structure SIGNAL_BUFFERS_ENC_HANDLE hSignalBuf; Word32 *Bin_E_old_fx; /* per bin energy of old 2nd frames */ Word16 q_Bin_E_old; -#ifdef NONBE_FIX_ISSUE_2206 Word16 *mem_decim_fx; /* decimation filter memory Q(q_mem_decim_fx) */ Word16 q_mem_decim_fx; /* Q of ACELP@12.8kHz - decimation filter memory @12.8kHz */ Word16 mem_decim_fx_q_inp[2 * L_FILT_MAX]; /* decimation filter memory st->q_inp */ Word16 *mem_decim16k_fx; /* ACELP@16kHz - decimation filter memory @16kHz q_mem_decim16k_fx */ Word16 q_mem_decim16k_fx; /* Q of ACELP@16kHz - decimation filter memory @16kHz */ -#else - Word16 *mem_decim_fx; /* decimation filter memory Q(-1) */ - Word16 mem_decim_fx_q_inp[2 * L_FILT_MAX]; /* decimation filter memory Q(-1) */ - Word16 *mem_decim16k_fx; /* ACELP@16kHz - decimation filter memory @16kHz Q(-1) */ -#endif - Word16 *old_inp_12k8_fx; /* memory of input signal at 12.8kHz */ - Word16 *old_inp_16k_fx; /* ACELP@16kHz - memory of input signal @16 kHz */ + Word16 *old_inp_12k8_fx; /* memory of input signal at 12.8kHz */ + Word16 *old_inp_16k_fx; /* ACELP@16kHz - memory of input signal @16 kHz */ Word16 *buf_speech_enc_pe; // exp_buf_speech_enc_pe Word16 *buf_synth; /* can be reduced to PIT_MAX_MAX+L_FRAME_MAX if no rate switching*/ diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 31bcd1e8963174d5d616ed1e6feb384270f1e841..01d9ae8bd1e7a71e3036a637b90cf9437a046cfe 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -103,13 +103,9 @@ static void delay_input_signal_fx( *-------------------------------------------------------------------*/ void wb_bwe_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ -#ifdef NONBE_FIX_ISSUE_2206 + Encoder_State *st_fx, /* i/o: encoder state structure */ const Word16 *new_wb_speech_fx, /* i : original input signal at 16kHz */ const Word16 new_wb_speech_q /* i : Q of new_wb_speech_fx */ -#else - const Word16 *new_wb_speech_fx /* i : original input signal at 16kHz */ -#endif ) { Word16 mode = 0; @@ -134,22 +130,15 @@ void wb_bwe_enc_fx( move16(); new_input_fx = old_input_fx + Sample_Delay_WB_BWE; -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input_fx, Sample_Delay_WB_BWE, sub( new_wb_speech_q, -1 ) ); Copy( new_wb_speech_fx, new_input_fx, L_FRAME16k ); Copy_Scale_sig( old_input_fx + L_FRAME16k, hBWE_FD->old_input_wb_fx, Sample_Delay_WB_BWE, sub( -1, new_wb_speech_q ) ); -#else - Copy( hBWE_FD->old_input_wb_fx, old_input_fx, Sample_Delay_WB_BWE ); - Copy( new_wb_speech_fx, new_input_fx, L_FRAME16k ); - Copy( old_input_fx + L_FRAME16k, hBWE_FD->old_input_wb_fx, Sample_Delay_WB_BWE ); -#endif /*---------------------------------------------------------------------*/ /* WB BWE encoding */ /* MDCT of the core synthesis signal */ /*---------------------------------------------------------------------*/ -#ifdef NONBE_FIX_ISSUE_2206 new_input_fx_exp = new_wb_speech_q; move16(); if ( st_fx->element_mode == EVS_MONO ) @@ -158,15 +147,6 @@ void wb_bwe_enc_fx( new_input_fx_exp = 0; move16(); } -#else - new_input_fx_exp = -Q1; - move16(); - if ( st_fx->element_mode == EVS_MONO ) - { - new_input_fx_exp = 0; - move16(); - } -#endif wtda_fx( old_input_fx, &new_input_fx_exp, L_wtda_synth_fx, hBWE_FD->L_old_wtda_swb_fx, &st_fx->Q_old_wtda, ALDO_WINDOW, ALDO_WINDOW, /* window overlap of current frame (0: full, 2: none, or 3: half) */ L_FRAME16k ); @@ -201,11 +181,7 @@ void swb_bwe_enc_fx( const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ const Word16 *new_swb_speech_fx, /* i : original input signal at 32kHz */ const Word16 Q_new_swb_speech, /* i : Q for new_swb_speech_fx */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT - Word16 *shb_speech_fx_input, /* i : SHB target signal (6-14kHz) at 16kHz Q_shb_speech */ -#else - Word16 *shb_speech_fx_Q0, /* i : SHB target signal (6-14kHz) at 16kHz Q0 */ -#endif + Word16 *shb_speech_fx_input, /* i : SHB target signal (6-14kHz) at 16kHz Q_shb_speech */ Word16 Q_shb_speech, Word16 Q_slb_speech ) { @@ -246,23 +222,14 @@ void swb_bwe_enc_fx( IF( st_fx->element_mode == EVS_MONO ) { -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT assert( Q_shb_speech == 0 ); Copy( shb_speech_fx_input, shb_speech_fx, L_FRAME16k ); -#else - Copy( shb_speech_fx_Q0, shb_speech_fx, L_FRAME16k ); -#endif } ELSE { -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT tmp = norm_arr( shb_speech_fx_input, L_FRAME16k ); Copy_Scale_sig_nosat( shb_speech_fx_input, shb_speech_fx, L_FRAME16k, tmp ); Q_shb_speech = add( Q_shb_speech, tmp ); -#else - Q_shb_speech = getScaleFactor16( shb_speech_fx_Q0, L_FRAME16k ); - Copy_Scale_sig( shb_speech_fx_Q0, shb_speech_fx, L_FRAME16k, Q_shb_speech ); // Q0 -> Q_shb_spch -#endif } /*---------------------------------------------------------------------* @@ -345,7 +312,6 @@ void swb_bwe_enc_fx( q_new_input_hp = s_min( Q_shb_speech, hBWE_FD->Q_new_input_hp ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT IF( st_fx->element_mode == EVS_MONO ) { Copy( hBWE_FD->new_input_hp_fx, new_input_hp_fx, Sample_Delay_HP ); @@ -363,40 +329,12 @@ void swb_bwe_enc_fx( Q_shb_speech = q_new_input_hp; move16(); -#else - IF( st_fx->element_mode == EVS_MONO ) - { - Copy( hBWE_FD->new_input_hp_fx, new_input_hp_fx, Sample_Delay_HP ); - Copy( shb_speech_fx, &new_input_hp_fx[Sample_Delay_HP], L_FRAME16k - Sample_Delay_HP ); - } - ELSE IF( LT_16( Q_shb_speech, hBWE_FD->Q_new_input_hp ) ) - { - Copy_Scale_sig( hBWE_FD->new_input_hp_fx, new_input_hp_fx, Sample_Delay_HP, sub( Q_shb_speech, hBWE_FD->Q_new_input_hp ) ); // Q_shb_speech - Copy( shb_speech_fx, &new_input_hp_fx[Sample_Delay_HP], L_FRAME16k - Sample_Delay_HP ); // Q_shb_speech - } - ELSE - { - Copy( hBWE_FD->new_input_hp_fx, new_input_hp_fx, Sample_Delay_HP ); // hBWE_FD->Q_new_input_hp - Copy_Scale_sig( shb_speech_fx, &new_input_hp_fx[Sample_Delay_HP], L_FRAME16k - Sample_Delay_HP, sub( hBWE_FD->Q_new_input_hp, Q_shb_speech ) ); // hBWE_FD->Q_new_input_hp - } - hBWE_FD->Q_new_input_hp = Q_shb_speech; - move16(); - Copy( shb_speech_fx + L_FRAME16k - Sample_Delay_HP, hBWE_FD->new_input_hp_fx, Sample_Delay_HP ); - new_input_fx = old_input_fx + Sample_Delay_SWB_BWE; -#endif - -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( hBWE_FD->old_input_fx, old_input_fx, Sample_Delay_SWB_BWE, sub( Q_new_swb_speech, hBWE_FD->old_input_q ) ); Copy( new_swb_speech_fx, new_input_fx, inner_frame ); Copy( old_input_fx + inner_frame, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); hBWE_FD->old_input_q = Q_new_swb_speech; move16(); -#else - Copy( hBWE_FD->old_input_fx, old_input_fx, Sample_Delay_SWB_BWE ); - Copy( new_swb_speech_fx, new_input_fx, inner_frame ); - Copy( old_input_fx + inner_frame, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); -#endif /*----------------------------------------------------------------------* * Calculate tilt of the input signal and the ACELP core synthesis @@ -1352,12 +1290,7 @@ static void MSVQ_Interpol_Tran_fx( FOR( n_band = 0; n_band < DIM_TR2 - 1; n_band++ ) { /*quant_tmp2[n_band] = env_temp12[n_band] - ((quant_tmp[n_band]+quant_tmp[n_band+1])/2.f); */ -#ifdef NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx tmp = add( shr( quant_tmp[n_band], 1 ), shr( quant_tmp[n_band + 1], 1 ) ); /*Q8 */ -#else - tmp = add( quant_tmp[n_band], quant_tmp[n_band + 1] ); /*Q8 */ - tmp = shr( tmp, 1 ); -#endif quant_tmp2[n_band] = sub( env_temp12[n_band], tmp ); move16(); /*Q8 */ } @@ -1376,12 +1309,7 @@ static void MSVQ_Interpol_Tran_fx( FOR( n_band = 0; n_band < DIM_TR2 - 1; n_band++ ) { /*quant_select[n_band*2+1] = ((quant_tmp[n_band]+quant_tmp[n_band+1])/2.f) + quant_tmp2[n_band]; */ -#ifdef NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx tmp = add( shr( quant_tmp[n_band], 1 ), shr( quant_tmp[n_band + 1], 1 ) ); /*Q8 */ -#else - tmp = add( quant_tmp[n_band], quant_tmp[n_band + 1] ); /*Q8 */ - tmp = shr( tmp, 1 ); -#endif quant_select[n_band * 2 + 1] = add( tmp, quant_tmp2[n_band] ); move16(); } @@ -2066,12 +1994,8 @@ static Word16 WB_BWE_encoding_fx( tmp = Log2_norm_lc( L_shl( L_tmp, exp ) ); /* exp = 30-exp-(2*Q_synth-2 / exp = 30-exp-(q_WB_fenv[i]+4) */ exp = sub( sub( 30, exp ), Q_fenv[i] ); - L_tmp = Mpy_32_16( exp, tmp, 32767 ); /* Q16 */ -#ifdef NONBE_FIX_ISSUE_2206 + L_tmp = Mpy_32_16( exp, tmp, 32767 ); /* Q16 */ WB_fenv_fx[i] = round_fx( L_shl_sat( L_tmp, 10 ) ); /* Q10 */ -#else - WB_fenv_fx[i] = round_fx( L_shl( L_tmp, 10 ) ); /* Q10 */ -#endif move16(); } ELSE @@ -2309,12 +2233,8 @@ static Word16 SWB_BWE_encoding_fx( L_tmp = Mpy_32_16( exp, tmp, 24660 ); /* Q14 */ /*10log10(2) in Q13 */ tmp = round_fx( L_shl( L_tmp, 10 ) ); /* Q8 */ -#ifdef NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_SWB_fenv_fx2 /* For very small energies, log10 in Q8 smaller than -128.0, saturation can occur here. */ SWB_fenv_fx[n_band] = sub_sat( tmp, Mean_env_tr_fx[n_band] ); -#else - SWB_fenv_fx[n_band] = sub( tmp, Mean_env_tr_fx[n_band] ); -#endif move16(); /*Q8 */ } } @@ -2645,12 +2565,8 @@ static Word16 SWB_BWE_encoding_fx( { expn = sub( 30, add( expn, q_SWB_fenv[n_band] ) ); } - L_tmp = Mpy_32_16( expn, tmp, 24660 ); /* Q14 */ /*10log10(2) in Q13 */ -#ifdef NONBE_FIX_ISSUE_2206 + L_tmp = Mpy_32_16( expn, tmp, 24660 ); /* Q14 */ /*10log10(2) in Q13 */ SWB_fenv_fx[n_band] = round_fx( L_shl_sat( L_tmp, 10 ) ); /* Q8 */ -#else - SWB_fenv_fx[n_band] = round_fx( L_shl( L_tmp, 10 ) ); /* Q8 */ -#endif move16(); } ELSE @@ -2663,12 +2579,8 @@ static Word16 SWB_BWE_encoding_fx( FOR( n_band = 0; n_band < SWB_FENV; n_band++ ) { -#ifdef NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_SWB_fenv_fx2 /* For very small energies, log10 in Q8 smaller than -128.0, saturation can occur here. */ SWB_fenv_fx[n_band] = sub_sat( SWB_fenv_fx[n_band], Mean_env_fx[n_band] ); -#else - SWB_fenv_fx[n_band] = sub( SWB_fenv_fx[n_band], Mean_env_fx[n_band] ); -#endif move16(); } @@ -3117,10 +3029,8 @@ void fd_bwe_enc_init_fx( hBWE_FD->Q_new_input_hp = 0; move16(); set16_fx( hBWE_FD->old_input_fx, 0, NS2SA( 48000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) ); -#ifdef NONBE_FIX_ISSUE_2206 hBWE_FD->old_input_q = Q15; move16(); -#endif set16_fx( hBWE_FD->old_input_wb_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_12k8_NS ) ); set16_fx( hBWE_FD->old_input_lp_fx, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS ) ); set16_fx( hBWE_FD->old_syn_12k8_16k_fx, 0, NS2SA( 16000, DELAY_FD_BWE_ENC_NS ) ); @@ -3143,10 +3053,8 @@ void fd_bwe_enc_init_fx( hBWE_FD->prev_Q_input_lp = 0; move16(); set16_fx( hBWE_FD->old_fdbwe_speech_fx, 0, L_FRAME48k ); -#ifdef NONBE_FIX_ISSUE_2206 hBWE_FD->old_fdbwe_speech_q = Q15; move16(); -#endif hBWE_FD->mem_deemph_old_syn_fx = 0; move16(); diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index bd8a8b16070eff3013d6ce207d8b2219c1f2aaed..52444b37ac1612760a01680481464c72af38c7a0 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -35,16 +35,11 @@ /*========================================================================*/ void wb_pre_proc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ - const Word16 last_element_mode, /* i : last element mode */ -#ifdef NONBE_FIX_ISSUE_2206 + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 last_element_mode, /* i : last element mode */ const Word16 *new_inp_resamp16k, /* i : original input signal in new_inp_resamp16k_q */ Word16 *hb_speech, /* o : HB target signal (6-8kHz) at 16kHz in new_inp_resamp16k_q */ const Word16 new_inp_resamp16k_q /* i : Q of new_inp_resamp16k */ -#else - const Word16 *new_inp_resamp16k, /* i : original input signal in Q-1 */ - Word16 *hb_speech /* o : HB target signal (6-8kHz) at 16kHz in Q-1 */ -#endif ) { Word16 Sample_Delay_WB_BWE; @@ -149,7 +144,6 @@ void wb_pre_proc_fx( } } -#ifdef NONBE_FIX_ISSUE_2206 IF( st_fx->element_mode != EVS_MONO ) { /* In case of EVS, hBWE_FD->old_input_wb_fx might saturate furher below. */ @@ -162,12 +156,6 @@ void wb_pre_proc_fx( Scale_sig( hBWE_TD->decim_state1_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), sub( Q_wb_sp, -1 ) ); Scale_sig( hBWE_TD->decim_state2_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), sub( Q_wb_sp, -1 ) ); /* temp_buf, and the memory states are in Q_wb_sp */ -#else - Copy_Scale_sig( new_inp_resamp16k, temp_buf, L_FRAME16k, Q_wb_sp ); - Scale_sig( hBWE_TD->decim_state1_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), Q_wb_sp ); - Scale_sig( hBWE_TD->decim_state2_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), Q_wb_sp ); - /* temp_buf, and the memory states are in Q_wb_sp */ -#endif test(); test(); @@ -203,31 +191,18 @@ void wb_pre_proc_fx( move16(); } -#ifdef NONBE_FIX_ISSUE_2206 /*Get past signal*/ Copy_Scale_sig( hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - STEREO_DFT_OVL_16k, old_input, STEREO_DFT_OVL_16k, sub( Q_wb_sp, st_fx->Q_old_wtda ) ); Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input + STEREO_DFT_OVL_16k, Sample_Delay_WB_BWE, sub( Q_wb_sp, -1 ) ); /*Get new signal*/ Copy( temp_buf, &old_input[Sample_Delay_WB_BWE + STEREO_DFT_OVL_16k], L_FRAME16k ); -#else - /*Get past signal*/ - Copy_Scale_sig( hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - STEREO_DFT_OVL_16k, old_input, STEREO_DFT_OVL_16k, Q_wb_sp ); - Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input + STEREO_DFT_OVL_16k, Sample_Delay_WB_BWE, Q_wb_sp ); - - /*Get new signal*/ - Copy( temp_buf, &old_input[Sample_Delay_WB_BWE + STEREO_DFT_OVL_16k], L_FRAME16k ); -#endif /*compute hb_speech on delayed input*/ flip_spectrum_and_decimby4_fx( old_input + Sample_Delay_WB_BWE, hb_speech, L_FRAME16k, hBWE_TD->decim_state1_fx, hBWE_TD->decim_state2_fx, ramp_flag ); /*Update memory*/ -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( hb_speech, hBWE_TD->old_speech_wb_fx + ( L_SUBFR * 5 / 16 ), STEREO_DFT_OVL_16k / 4, sub( -1, Q_wb_sp ) ); -#else - Copy_Scale_sig( hb_speech, hBWE_TD->old_speech_wb_fx + ( L_SUBFR * 5 / 16 ), STEREO_DFT_OVL_16k / 4, -Q_wb_sp ); -#endif Copy( hb_speech + STEREO_DFT_OVL_16k / 4, hb_speech, ( L_FRAME16k - STEREO_DFT_OVL_16k ) / 4 ); /*rest without memory update*/ @@ -252,21 +227,12 @@ void wb_pre_proc_fx( move16(); } -#ifdef NONBE_FIX_ISSUE_2206 /*Get past signal*/ Copy_Scale_sig( hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - l_recalc_16k, old_input, l_recalc_16k, sub( Q_wb_sp, st_fx->Q_old_wtda ) ); Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input + l_recalc_16k, Sample_Delay_WB_BWE, sub( Q_wb_sp, -1 ) ); /* Saturation added to prevent the crash. Needs further review */ old_input[Sample_Delay_WB_BWE] = shl_sat( hBWE_FD->mem_old_wtda_swb_fx, sub( Q_wb_sp, -1 ) ); -#else - /*Get past signal*/ - Copy_Scale_sig( hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - l_recalc_16k, old_input, l_recalc_16k, Q_wb_sp ); - Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input + l_recalc_16k, Sample_Delay_WB_BWE, Q_wb_sp ); - - /* Saturation added to prevent the crash. Needs further review */ - old_input[Sample_Delay_WB_BWE] = shl_sat( hBWE_FD->mem_old_wtda_swb_fx, Q_wb_sp ); -#endif /*Get new signal*/ Copy( temp_buf, old_input + Sample_Delay_WB_BWE + l_recalc_16k, L_FRAME16k ); @@ -275,11 +241,7 @@ void wb_pre_proc_fx( flip_spectrum_and_decimby4_fx( old_input + Sample_Delay_WB_BWE, hb_speech, L_FRAME16k, hBWE_TD->decim_state1_fx, hBWE_TD->decim_state2_fx, ramp_flag ); /*Update memory*/ -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( hb_speech, hBWE_TD->old_speech_wb_fx + ( ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16 ) - l_recalc_4k, l_recalc_4k, sub( -1, Q_wb_sp ) ); -#else - Copy_Scale_sig( hb_speech, hBWE_TD->old_speech_wb_fx + ( ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16 ) - l_recalc_4k, l_recalc_4k, -Q_wb_sp ); -#endif Copy( hb_speech + l_recalc_4k, hb_speech, ( L_FRAME16k / 4 ) - l_recalc_4k ); /*rest without memory update*/ @@ -302,13 +264,8 @@ void wb_pre_proc_fx( Sample_Delay_WB_BWE = NS2SA( 16000, DELAY_FD_BWE_ENC_12k8_NS ); /*Get past signal*/ -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - l_recalc_16k, old_input, l_recalc_16k, sub( Q_wb_sp, st_fx->Q_old_wtda ) ); Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input + l_recalc_16k, Sample_Delay_WB_BWE, sub( Q_wb_sp, -1 ) ); -#else - Copy_Scale_sig( hBWE_FD->L_old_wtda_swb_fx + L_FRAME16k - l_recalc_16k, old_input, l_recalc_16k, Q_wb_sp ); - Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input + l_recalc_16k, Sample_Delay_WB_BWE, Q_wb_sp ); -#endif /*Get new signal*/ Copy( temp_buf, old_input + Sample_Delay_WB_BWE + l_recalc_16k, L_FRAME16k ); @@ -317,11 +274,7 @@ void wb_pre_proc_fx( flip_spectrum_and_decimby4_fx( old_input + Sample_Delay_WB_BWE, hb_speech, L_FRAME16k, hBWE_TD->decim_state1_fx, hBWE_TD->decim_state2_fx, ramp_flag ); /* update hBWE_TD->old_speech_wb memory */ -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( hb_speech, hBWE_TD->old_speech_wb_fx + ( ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16 ) - l_recalc_4k, l_recalc_4k, sub( -1, Q_wb_sp ) ); -#else - Copy_Scale_sig( hb_speech, hBWE_TD->old_speech_wb_fx + ( ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16 ) - l_recalc_4k, l_recalc_4k, -Q_wb_sp ); -#endif Copy( hb_speech + l_recalc_4k, hb_speech, ( L_FRAME16k / 4 ) - l_recalc_4k ); /*rest without memory update*/ @@ -336,7 +289,6 @@ void wb_pre_proc_fx( flip_spectrum_and_decimby4_fx( temp_buf, hb_speech, L_FRAME16k, hBWE_TD->decim_state1_fx, hBWE_TD->decim_state2_fx, ramp_flag ); } -#ifdef NONBE_FIX_ISSUE_2206 /* rescale the hb_speech and memories back to -1 */ Scale_sig( hb_speech, L_FRAME16k / 4, sub( new_inp_resamp16k_q, Q_wb_sp ) ); Scale_sig( hBWE_TD->decim_state1_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), sub( -1, Q_wb_sp ) ); @@ -346,12 +298,6 @@ void wb_pre_proc_fx( Q_wb_sp = new_inp_resamp16k_q; move16(); } -#else - /* rescale the hb_speech and memories back to Q-1 to keep the downstream BWE coding unaffected */ - Scale_sig( hb_speech, L_FRAME16k / 4, negate( Q_wb_sp ) ); - Scale_sig( hBWE_TD->decim_state1_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), negate( Q_wb_sp ) ); - Scale_sig( hBWE_TD->decim_state2_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), negate( Q_wb_sp ) ); -#endif IF( NE_16( st_fx->extl, WB_TBE ) ) { @@ -360,11 +306,7 @@ void wb_pre_proc_fx( highband_new_speech = highband_old_speech + Sample_Delay_WB_BWE; Copy( hb_speech, highband_new_speech, L_FRAME16k / 4 ); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig( highband_old_speech + L_FRAME16k / 4, hBWE_TD->old_speech_wb_fx, Sample_Delay_WB_BWE, sub( -1, new_inp_resamp16k_q ) ); -#else - Copy( highband_old_speech + L_FRAME16k / 4, hBWE_TD->old_speech_wb_fx, Sample_Delay_WB_BWE ); -#endif } } } @@ -378,11 +320,7 @@ void wb_pre_proc_fx( test(); if ( hBWE_FD != NULL && st_fx->element_mode != EVS_MONO ) { -#ifdef NONBE_FIX_ISSUE_2206 hBWE_FD->mem_old_wtda_swb_fx = shl( new_inp_resamp16k[L_FRAME16k - L_MEM_RECALC_16K - L_FILT16k - 1], sub( -1, new_inp_resamp16k_q ) ); -#else - hBWE_FD->mem_old_wtda_swb_fx = new_inp_resamp16k[L_FRAME16k - L_MEM_RECALC_16K - L_FILT16k - 1]; -#endif move16(); } @@ -394,7 +332,6 @@ void wb_pre_proc_fx( { Sample_Delay_WB_BWE = NS2SA( 16000, DELAY_FD_BWE_ENC_12k8_NS ); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( new_inp_resamp16k, &old_input[Sample_Delay_WB_BWE], L_FRAME16k, sub( Q_wb_sp, new_inp_resamp16k_q ) ); Copy_Scale_sig( hBWE_FD->old_input_wb_fx, old_input, Sample_Delay_WB_BWE, sub( Q_wb_sp, -1 ) ); IF( LT_16( sub( -1, new_inp_resamp16k_q ), -15 ) ) @@ -406,22 +343,13 @@ void wb_pre_proc_fx( /* Saturation can occur. To avoid that the format of hBWE_FD->old_input_wb_fx needs to become variable. */ Copy_Scale_sig( new_inp_resamp16k + L_FRAME16k - Sample_Delay_WB_BWE, hBWE_FD->old_input_wb_fx, Sample_Delay_WB_BWE, sub( -1, new_inp_resamp16k_q ) ); } -#else - Copy( new_inp_resamp16k, &old_input[Sample_Delay_WB_BWE], L_FRAME16k ); - Copy( hBWE_FD->old_input_wb_fx, old_input, Sample_Delay_WB_BWE ); - Copy( new_inp_resamp16k + L_FRAME16k - Sample_Delay_WB_BWE, hBWE_FD->old_input_wb_fx, Sample_Delay_WB_BWE ); -#endif test(); IF( NE_16( st_fx->extl, SWB_BWE ) && NE_16( st_fx->extl, FB_BWE ) ) { Copy( old_input, hBWE_FD->L_old_wtda_swb_fx, L_FRAME16k ); if ( st_fx->element_mode != EVS_MONO ) { -#ifdef NONBE_FIX_ISSUE_2206 st_fx->Q_old_wtda = Q_wb_sp; -#else - st_fx->Q_old_wtda = -Q1; -#endif move16(); } } @@ -457,14 +385,10 @@ void wb_pre_proc_fx( /*========================================================================*/ void swb_pre_proc_fx( - Encoder_State *st, /* i/o: encoder state structure */ - Word16 *new_swb_speech, /* o : original input signal at 32kHz - st->q_inp */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT - Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz - shb_speech_q */ - Word16 *shb_speech_q, /* o : SHB target signal (6-14kHz) at 16kHz - Q */ -#else - Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz - Q0 */ -#endif + Encoder_State *st, /* i/o: encoder state structure */ + Word16 *new_swb_speech, /* o : original input signal at 32kHz - st->q_inp */ + Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz - shb_speech_q */ + Word16 *shb_speech_q, /* o : SHB target signal (6-14kHz) at 16kHz - Q */ Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real buffer Q - q_reImbuffer */ Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag buffer Q - q_reImbuffer */ Word16 q_reImBuffer, /* i : scale data of real and imag CLDFB buffers */ @@ -515,13 +439,11 @@ void swb_pre_proc_fx( set16_fx( old_input_fx, 0, NS2SA( 48000, DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME48k ); -#ifdef NONBE_FIX_ISSUE_2206 IF( st->element_mode > EVS_MONO ) { scale_sig( st->hBWE_TD->dec_2_over_3_mem_lp_fx, 6, sub( st->q_inp, st->hBWE_TD->dec_2_over_3_mem_q ) ); scale_sig( st->hBWE_TD->dec_2_over_3_mem_fx, L_FILT_2OVER3, sub( st->q_inp, st->hBWE_TD->dec_2_over_3_mem_q ) ); } -#endif IF( EQ_32( st->input_Fs, 32000 ) ) { @@ -533,46 +455,27 @@ void swb_pre_proc_fx( Sample_Delay_SWB_BWE = NS2SA( 32000, DELAY_FD_BWE_ENC_16k_NS ); } -#ifdef NONBE_FIX_ISSUE_2206 hBWE_FD->old_fdbwe_speech_q = s_min( Q14, add( st->q_old_inp, norm_arr( st->input_fx - L_FRAME32k, L_FRAME32k ) ) ); move16(); Copy( st->input_fx - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); hBWE_FD->old_input_q = st->q_old_inp; move16(); Copy_Scale_sig_nosat( st->input_fx - L_FRAME32k, hBWE_FD->old_fdbwe_speech_fx, L_FRAME32k, sub( hBWE_FD->old_fdbwe_speech_q, st->q_old_inp ) ); -#else - Copy( st->input_fx - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); - Copy( st->input_fx - L_FRAME32k, hBWE_FD->old_fdbwe_speech_fx, L_FRAME32k ); -#endif -#ifdef NONBE_FIX_ISSUE_2206 Word16 tmp = s_min( st->q_inp, st->Q_old_wtda ); scale_sig( hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( tmp, st->Q_old_wtda ) ); // st->Q_old_wtda -> tmp st->Q_old_wtda = tmp; // st->Q_old_wtda = tmp; move16(); -#else - scale_sig( hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( st->q_inp, st->Q_old_wtda ) ); // st->Q_old_wtda -> st->q_inp - st->Q_old_wtda = st->q_inp; // st->Q_old_wtda = st->q_inp; - move16(); -#endif test(); test(); IF( EQ_16( st->element_mode, IVAS_CPE_TD ) && GE_16( st->bwidth, SWB ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->input_fx - hCPE->hStereoTCA->lMemRecalc, hBWE_FD->L_old_wtda_swb_fx + L_FRAME32k - sub( hCPE->hStereoTCA->lMemRecalc, Sample_Delay_SWB_BWE ), sub( hCPE->hStereoTCA->lMemRecalc, Sample_Delay_SWB_BWE ), sub( st->Q_old_wtda, st->q_inp ) ); -#else - Copy( st->input_fx - hCPE->hStereoTCA->lMemRecalc, hBWE_FD->L_old_wtda_swb_fx + L_FRAME32k - sub( hCPE->hStereoTCA->lMemRecalc, Sample_Delay_SWB_BWE ), sub( hCPE->hStereoTCA->lMemRecalc, Sample_Delay_SWB_BWE ) ); -#endif } ELSE IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) && GE_16( st->bwidth, SWB ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->input_fx - hCPE->hStereoDft->dft_ovl, hBWE_FD->L_old_wtda_swb_fx + L_FRAME32k - sub( hCPE->hStereoDft->dft_ovl, Sample_Delay_SWB_BWE ), sub( hCPE->hStereoDft->dft_ovl, Sample_Delay_SWB_BWE ), sub( st->Q_old_wtda, st->q_inp ) ); -#else - Copy( st->input_fx - hCPE->hStereoDft->dft_ovl, hBWE_FD->L_old_wtda_swb_fx + L_FRAME32k - sub( hCPE->hStereoDft->dft_ovl, Sample_Delay_SWB_BWE ), sub( hCPE->hStereoDft->dft_ovl, Sample_Delay_SWB_BWE ) ); -#endif } } @@ -593,7 +496,6 @@ void swb_pre_proc_fx( Sample_Delay_SWB_BWE = sub( Sample_Delay_SWB_BWE, NS2SA( 32000, DELAY_FIR_RESAMPL_NS ) ); } -#ifdef NONBE_FIX_ISSUE_2206 IF( st->element_mode > EVS_MONO ) { Copy_Scale_sig_nosat( hBWE_FD->old_fdbwe_speech_fx, &old_input_fx[Sample_Delay_SWB_BWE], L_FRAME32k, sub( st->q_inp, hBWE_FD->old_fdbwe_speech_q ) ); @@ -607,12 +509,6 @@ void swb_pre_proc_fx( Copy( hBWE_FD->old_fdbwe_speech_fx + L_FRAME32k - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); } set16_fx( old_input_fx, 0, Sample_Delay_SWB_BWE ); -#else - Copy( hBWE_FD->old_fdbwe_speech_fx, &old_input_fx[Sample_Delay_SWB_BWE], L_FRAME32k ); - - set16_fx( old_input_fx, 0, Sample_Delay_SWB_BWE ); - Copy( hBWE_FD->old_fdbwe_speech_fx + L_FRAME32k - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); -#endif IF( NE_16( st->extl, WB_BWE ) ) { @@ -628,13 +524,9 @@ void swb_pre_proc_fx( test(); IF( NE_16( st->extl, SWB_BWE ) && NE_16( st->extl, FB_BWE ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy( st->input_fx, hBWE_FD->old_fdbwe_speech_fx, L_FRAME32k ); hBWE_FD->old_fdbwe_speech_q = st->q_inp; move16(); -#else - Copy( st->input_fx, hBWE_FD->old_fdbwe_speech_fx, L_FRAME32k ); -#endif } } ELSE /* 48 kHz */ @@ -668,33 +560,19 @@ void swb_pre_proc_fx( } ELSE IF( EQ_16( st->bwidth, FB ) ) { -#ifdef NONBE_FIX_ISSUE_2206 Copy( st->input_fx - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); hBWE_FD->old_input_q = st->q_old_inp; move16(); -#else - Copy( st->input_fx - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); -#endif } -#ifdef NONBE_FIX_ISSUE_2206 Copy( st->input_fx - L_FRAME48k, hBWE_FD->old_fdbwe_speech_fx, L_FRAME48k ); hBWE_FD->old_fdbwe_speech_q = st->q_old_inp; move16(); -#else - Copy( st->input_fx - L_FRAME48k, hBWE_FD->old_fdbwe_speech_fx, L_FRAME48k ); -#endif -#ifdef NONBE_FIX_ISSUE_2206 Word16 tmp = s_min( st->Q_old_wtda, st->q_inp ); scale_sig( hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( tmp, st->Q_old_wtda ) ); st->Q_old_wtda = tmp; move16(); -#else - scale_sig( hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( st->q_inp, st->Q_old_wtda ) ); // st->Q_old_wtda -> st->q_inp - st->Q_old_wtda = st->q_inp; - move16(); -#endif test(); test(); @@ -707,27 +585,17 @@ void swb_pre_proc_fx( decimate_2_over_3_allpass_fx( st->input_fx - hCPE->hStereoTCA->lMemRecalc, hCPE->hStereoTCA->lMemRecalc, spchTmp, hBWE_TD->dec_2_over_3_mem_fx, allpass_poles_3_ov_2, decimate_3_ov_2_lowpass_num_fx, decimate_3_ov_2_lowpass_den_fx, hBWE_TD->dec_2_over_3_mem_lp_fx ); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( spchTmp, hBWE_FD->L_old_wtda_swb_fx + L_FRAME32k - sub( lMemRecalc32k, Sample_Delay_SWB_BWE32k ), sub( lMemRecalc32k, Sample_Delay_SWB_BWE32k ), sub( st->Q_old_wtda, st->q_inp ) ); Copy( spchTmp + lMemRecalc32k - Sample_Delay_SWB_BWE32k, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE32k ); hBWE_FD->old_input_q = st->q_inp; move16(); -#else - Copy( spchTmp, hBWE_FD->L_old_wtda_swb_fx + L_FRAME32k - sub( lMemRecalc32k, Sample_Delay_SWB_BWE32k ), sub( lMemRecalc32k, Sample_Delay_SWB_BWE32k ) ); - Copy( spchTmp + lMemRecalc32k - Sample_Delay_SWB_BWE32k, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE32k ); -#endif } ELSE /* FB_BWE */ { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->input_fx - hCPE->hStereoTCA->lMemRecalc, hBWE_FD->L_old_wtda_swb_fx + L_FRAME48k - sub( hCPE->hStereoTCA->lMemRecalc, Sample_Delay_SWB_BWE ), sub( hCPE->hStereoTCA->lMemRecalc, Sample_Delay_SWB_BWE ), sub( st->Q_old_wtda, st->q_old_inp ) ); Copy( st->input_fx - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); hBWE_FD->old_input_q = st->q_old_inp; move16(); -#else - Copy( st->input_fx - hCPE->hStereoTCA->lMemRecalc, hBWE_FD->L_old_wtda_swb_fx + L_FRAME48k - sub( hCPE->hStereoTCA->lMemRecalc, Sample_Delay_SWB_BWE ), sub( hCPE->hStereoTCA->lMemRecalc, Sample_Delay_SWB_BWE ) ); - Copy( st->input_fx - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); -#endif } } ELSE IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) && GE_16( st->bwidth, SWB ) ) @@ -736,19 +604,11 @@ void swb_pre_proc_fx( { lerp( st->input_fx - hCPE->hStereoDft->dft_ovl, spchTmp, dft_ovl32k - Sample_Delay_SWB_BWE32k, hCPE->hStereoDft->dft_ovl - Sample_Delay_SWB_BWE ); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( spchTmp, hBWE_FD->L_old_wtda_swb_fx + L_FRAME32k - ( dft_ovl32k - Sample_Delay_SWB_BWE32k ), dft_ovl32k - Sample_Delay_SWB_BWE32k, sub( st->Q_old_wtda, st->q_inp ) ); -#else - Copy( spchTmp, hBWE_FD->L_old_wtda_swb_fx + L_FRAME32k - ( dft_ovl32k - Sample_Delay_SWB_BWE32k ), dft_ovl32k - Sample_Delay_SWB_BWE32k ); -#endif } ELSE { -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( st->input_fx - hCPE->hStereoDft->dft_ovl, hBWE_FD->L_old_wtda_swb_fx + L_FRAME48k - ( hCPE->hStereoDft->dft_ovl - Sample_Delay_SWB_BWE ), hCPE->hStereoDft->dft_ovl - Sample_Delay_SWB_BWE, sub( st->Q_old_wtda, st->q_inp ) ); -#else - Copy( st->input_fx - hCPE->hStereoDft->dft_ovl, hBWE_FD->L_old_wtda_swb_fx + L_FRAME48k - ( hCPE->hStereoDft->dft_ovl - Sample_Delay_SWB_BWE ), hCPE->hStereoDft->dft_ovl - Sample_Delay_SWB_BWE ); -#endif } } } @@ -760,13 +620,9 @@ void swb_pre_proc_fx( IF( ( NE_16( st->extl, SWB_BWE ) && NE_16( st->extl, FB_BWE ) && ( st->core == ACELP_CORE ) ) || ( EQ_16( st->element_mode, IVAS_CPE_DFT ) && ( st->core != ACELP_CORE ) ) /*resampling not needed for MDCT cores*/ ) { /* move the resampling out of the TDBWE path as new_swb_speech is not needed for TDBWE. */ -#ifdef NONBE_FIX_ISSUE_2206 Copy( st->input_fx, hBWE_FD->old_fdbwe_speech_fx, L_FRAME48k ); hBWE_FD->old_fdbwe_speech_q = st->q_inp; move16(); -#else - Copy( st->input_fx, hBWE_FD->old_fdbwe_speech_fx, L_FRAME48k ); -#endif } ELSE { @@ -780,11 +636,7 @@ void swb_pre_proc_fx( move16(); inner_Fs = 48000; move32(); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( hBWE_FD->old_fdbwe_speech_fx, new_swb_speech, L_FRAME48k, sub( st->q_inp, hBWE_FD->old_fdbwe_speech_q ) ); -#else - Copy( hBWE_FD->old_fdbwe_speech_fx, new_swb_speech, L_FRAME48k ); -#endif } ELSE { @@ -793,7 +645,6 @@ void swb_pre_proc_fx( inner_Fs = 32000; move32(); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( hBWE_FD->old_fdbwe_speech_fx, new_swb_speech, L_FRAME48k, sub( st->q_inp, hBWE_FD->old_fdbwe_speech_q ) ); IF( NE_16( st->element_mode, IVAS_CPE_DFT ) ) @@ -804,21 +655,10 @@ void swb_pre_proc_fx( { lerp( new_swb_speech, new_swb_speech, inner_frame, L_FRAME48k ); } -#else - IF( NE_16( st->element_mode, IVAS_CPE_DFT ) ) - { - decimate_2_over_3_allpass_fx( hBWE_FD->old_fdbwe_speech_fx, L_FRAME48k, new_swb_speech, hBWE_TD->dec_2_over_3_mem_fx, allpass_poles_3_ov_2, decimate_3_ov_2_lowpass_num_fx, decimate_3_ov_2_lowpass_den_fx, hBWE_TD->dec_2_over_3_mem_lp_fx ); - } - ELSE - { - lerp( hBWE_FD->old_fdbwe_speech_fx, new_swb_speech, inner_frame, L_FRAME48k ); - } -#endif test(); IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) && st->idchan == 0 ) { -#ifdef NONBE_FIX_ISSUE_2206 FOR( i = 0; i < STEREO_DFT_OVL_32k; i++ ) { hCPE->hStereoDft->output_mem_dmx_32k_fx[i] = Mpy_32_16_1( hCPE->hStereoDft->win_32k_fx[STEREO_DFT_OVL_32k - 1 - i], new_swb_speech[( ( inner_frame + i ) - STEREO_DFT_OVL_32k )] ); @@ -826,13 +666,6 @@ void swb_pre_proc_fx( } hCPE->hStereoDft->output_mem_dmx_32k_q = add( st->q_inp, 16 ); move16(); -#else - FOR( i = 0; i < STEREO_DFT_OVL_32k; i++ ) - { - hCPE->hStereoDft->output_mem_dmx_32k_fx[i] = L_shr( Mpy_32_16_1( hCPE->hStereoDft->win_32k_fx[STEREO_DFT_OVL_32k - 1 - i], new_swb_speech[( ( inner_frame + i ) - STEREO_DFT_OVL_32k )] ), 1 ); // Q15 - move32(); - } -#endif } } @@ -851,16 +684,12 @@ void swb_pre_proc_fx( Copy( new_swb_speech, &old_input_fx[Sample_Delay_SWB_BWE], inner_frame ); set16_fx( old_input_fx, 0, Sample_Delay_SWB_BWE ); -#ifdef NONBE_FIX_ISSUE_2206 Copy( new_swb_speech + inner_frame - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); if ( st->element_mode != EVS_MONO ) { hBWE_FD->old_input_q = st->q_inp; move16(); } -#else - Copy( new_swb_speech + inner_frame - Sample_Delay_SWB_BWE, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE ); -#endif Copy( old_input_fx, hBWE_FD->L_old_wtda_swb_fx, inner_frame ); st->Q_old_wtda = st->q_inp; move16(); @@ -895,7 +724,6 @@ void swb_pre_proc_fx( } ELSE /* IVAS_CPE_DFT */ { -#ifdef NONBE_FIX_ISSUE_2206 Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX]; Word16 out_start_ind, out_end_ind, new_swb_speech_q; Word32 *new_swb_speech_fx; @@ -909,17 +737,6 @@ void swb_pre_proc_fx( Copy( new_swb_speech - Sample_Delay_SWB_BWE32k, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE32k ); hBWE_FD->old_input_q = st->q_inp; move16(); -#else - Word16 out_start_ind, out_end_ind; - Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX]; - Word32 *new_swb_speech_fx; - set32_fx( new_swb_speech_buffer_fx, 0, L_FRAME48k + STEREO_DFT_OVL_MAX ); - new_swb_speech_fx = new_swb_speech_buffer_fx + STEREO_DFT_OVL_MAX; - stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, new_swb_speech_fx, &out_start_ind, &out_end_ind, st->idchan, input_Fs, 32000, 0, NULL ); - Copy_Scale_sig32_16( new_swb_speech_fx - STEREO_DFT_OVL_MAX, new_swb_speech - STEREO_DFT_OVL_MAX, L_FRAME48k + STEREO_DFT_OVL_MAX, add( st->q_inp, add( q_reImBuffer, 1 ) ) ); // st->q_inp - - Copy( new_swb_speech - Sample_Delay_SWB_BWE32k, hBWE_FD->old_input_fx, Sample_Delay_SWB_BWE32k ); // st->q_inp -#endif } } } @@ -962,28 +779,16 @@ void swb_pre_proc_fx( { Word16 out_start_ind, out_end_ind; Word16 exp_icbweRefEner_fx; -#ifdef NONBE_FIX_ISSUE_2206 Word16 old_input32_q = add( st->q_inp, Q16 ); move16(); Copy_Scale_sig_16_32_no_sat( (const Word16 *) &old_input_fx[0], &old_input_fx_32[0], NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME48k, Q16 ); // old_input_q CldfbHB_fx = stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_input_fx_32 + STEREO_DFT_OVL_16k, &old_input32_q, &out_start_ind, &out_end_ind, st->idchan, input_Fs, 16000, st->L_frame, &CldfbHB_fx_e ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Word16 old_input_q; old_input_q = s_min( sub( old_input32_q, Q16 ), st->q_inp ); Copy_Scale_sig_32_16_nosat( (const Word32 *) &old_input_fx_32[0], &old_input_fx[0], out_end_ind + STEREO_DFT_OVL_16k, sub( old_input_q, old_input32_q ) ); Copy_Scale_sig_32_16_nosat( (const Word32 *) &old_input_fx_32[out_end_ind + STEREO_DFT_OVL_16k], &old_input_fx[out_end_ind + STEREO_DFT_OVL_16k], NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME48k - STEREO_DFT_OVL_16k - out_end_ind, sub( old_input_q, add( st->q_inp, Q16 ) ) ); -#else - Copy_Scale_sig_32_16( (const Word32 *) &old_input_fx_32[0], &old_input_fx[0], out_end_ind + STEREO_DFT_OVL_16k, sub( 0, old_input32_q ) ); // Q0 - Copy_Scale_sig_32_16( (const Word32 *) &old_input_fx_32[out_end_ind + STEREO_DFT_OVL_16k], &old_input_fx[out_end_ind + STEREO_DFT_OVL_16k], NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME48k - STEREO_DFT_OVL_16k - out_end_ind, sub( 0, add( st->q_inp, Q16 ) ) ); // Q0 -#endif -#else - Copy_Scale_sig_16_32_DEPREC( (const Word16 *) &old_input_fx[0], &old_input_fx_32[0], NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME48k, Q15 ); // Q15 - CldfbHB_fx = stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, old_input_fx_32 + STEREO_DFT_OVL_16k, &out_start_ind, &out_end_ind, st->idchan, input_Fs, 16000, st->L_frame, &CldfbHB_fx_e ); - Copy_Scale_sig_32_16( (const Word32 *) &old_input_fx_32[0], &old_input_fx[0], NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS ) + L_FRAME48k, -Q15 ); // Q0 -#endif /* delay corresponding to CLDFB delay */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Copy( old_input_fx + STEREO_DFT_OVL_16k - 20, shb_speech, L_FRAME16k ); // old_input_q *shb_speech_q = old_input_q; move16(); @@ -995,11 +800,6 @@ void swb_pre_proc_fx( Copy( old_input_fx, hCPE->hStereoICBWE->mem_shb_speech_ref_fx, STEREO_DFT_OVL_16k - 20 ); // old_input_q hCPE->hStereoICBWE->mem_shb_speech_ref_e = sub( Q15, old_input_q ); move16(); -#else - Copy( old_input_fx + STEREO_DFT_OVL_16k - 20, shb_speech, L_FRAME16k ); - Copy( old_input_fx, hBWE_TD->old_speech_shb_fx + L_LOOK_16k + L_SUBFR16k - ( STEREO_DFT_OVL_16k - 20 ), STEREO_DFT_OVL_16k - 20 ); - Copy( old_input_fx, hCPE->hStereoICBWE->mem_shb_speech_ref_fx, STEREO_DFT_OVL_16k - 20 ); // Q0 -#endif hCPE->hStereoICBWE->mem_shb_speech_ref_e = 15; move16(); @@ -1110,9 +910,7 @@ void swb_pre_proc_fx( hBWE_TD->cldfbHBLT = mac_r( lbEner, 29491 /*0.9 Q15*/, hBWE_TD->cldfbHBLT ); /* cldfbHBLT is in Q13 */ cldfbSynthesis_fx( st->cldfbSynTd, realBufferFlipped, imagBufferFlipped, cldfbScale, shb_speech, 0, CLDFB_NO_COL_MAX, cldfbWorkBuffer ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT assert( shb_speech_q == NULL ); -#endif } test(); @@ -1122,9 +920,7 @@ void swb_pre_proc_fx( /* Update the previous superwideband speech buffer in case of a SWB_BWE frame - this code is in swb_tbe_enc */ delay = L_LOOK_16k + L_SUBFR16k; Copy( shb_speech + L_FRAME16k - delay, hBWE_TD->old_speech_shb_fx, delay ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT assert( shb_speech_q == NULL ); -#endif } thr = 0; // just to avoid warnings @@ -1279,13 +1075,9 @@ void swb_pre_proc_fx( regV = icbwe_regressionValuesTDM_fx; cldfbSynthesis_ivas_fx( realBufferFlipped, imagBufferFlipped, shb_speech_fx_32, -1, 0, 0, st->cldfbSynTd ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Copy_Scale_sig_32_16( shb_speech_fx_32, shb_speech, L_FRAME16k, 0 ); *shb_speech_q = sub( q_reImBuffer, 1 ); move16(); -#else - Copy_Scale_sig_32_16( shb_speech_fx_32, shb_speech, L_FRAME16k, negate( sub( q_reImBuffer, 1 ) ) ); // Q0 -#endif st->cldfbSynTd->Q_cldfb_state = sub( q_reImBuffer, 1 ); } @@ -1383,13 +1175,11 @@ void swb_pre_proc_fx( delay = L_LOOK_16k + L_SUBFR16k; move16(); Copy( shb_speech + sub( L_FRAME16k, delay ), hBWE_TD->old_speech_shb_fx, delay ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT if ( shb_speech_q != NULL ) { hBWE_TD->old_speech_shb_q = *shb_speech_q; move16(); } -#endif } } ELSE @@ -1442,7 +1232,6 @@ void swb_pre_proc_fx( } } -#ifdef NONBE_FIX_ISSUE_2206 Word16 spchTmp_Q; IF( st->element_mode == EVS_MONO ) @@ -1455,14 +1244,10 @@ void swb_pre_proc_fx( scale_sig( hBWE_TD->state_ana_filt_shb_fx, ( 2 * ALLPASSSECTIONS_STEEP + 1 ), sub( spchTmp_Q, hBWE_TD->state_ana_filt_shb_fx_Q ) ); scale_sig( spchTmp, L_FRAME32k, sub( spchTmp_Q, st->q_inp ) ); } -#endif Decimate_allpass_steep_fx( spchTmp, hBWE_TD->state_ana_filt_shb_fx, L_FRAME32k, shb_speech ); -#ifdef NONBE_FIX_ISSUE_2206 hBWE_TD->state_ana_filt_shb_fx_Q = spchTmp_Q; move16(); -#endif -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT if ( shb_speech_q != NULL ) { *shb_speech_q = spchTmp_Q; @@ -1471,35 +1256,17 @@ void swb_pre_proc_fx( Copy( shb_speech + L_FRAME16k - ( L_LOOK_16k + L_SUBFR16k ), hBWE_TD->old_speech_shb_fx, L_LOOK_16k + L_SUBFR16k ); hBWE_TD->old_speech_shb_q = spchTmp_Q; move16(); -#else -#ifdef NONBE_FIX_ISSUE_2206 - scale_sig( shb_speech, L_FRAME16k, sub( 0, spchTmp_Q ) ); // Q_shb_spch = 0 -#endif - Copy( shb_speech + L_FRAME16k - ( L_LOOK_16k + L_SUBFR16k ), hBWE_TD->old_speech_shb_fx, L_LOOK_16k + L_SUBFR16k ); -#endif /*Compute the past overlap for potential next iDFTs SHB*/ IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) ) { -#ifdef NONBE_FIX_ISSUE_2206 FOR( i = 0; i < STEREO_DFT_OVL_16k; i++ ) { hCPE->hStereoDft->output_mem_dmx_16k_shb_fx[i] = L_mult( shb_speech[20 + i], mult_r( hCPE->hStereoDft->win_ana_16k_fx[STEREO_DFT_OVL_16k - 1 - i], hCPE->hStereoDft->win_ana_16k_fx[STEREO_DFT_OVL_16k - 1 - i] ) ); move32(); } -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT hCPE->hStereoDft->output_mem_dmx_16k_shb_q = add( Q16, spchTmp_Q ); -#else - hCPE->hStereoDft->output_mem_dmx_16k_shb_q = Q16; -#endif move16(); -#else - FOR( i = 0; i < STEREO_DFT_OVL_16k; i++ ) - { - hCPE->hStereoDft->output_mem_dmx_16k_shb_fx[i] = L_mult0( shb_speech[20 + i], mult_r( hCPE->hStereoDft->win_ana_16k_fx[STEREO_DFT_OVL_16k - 1 - i], hCPE->hStereoDft->win_ana_16k_fx[STEREO_DFT_OVL_16k - 1 - i] ) ); // Q15 - move32(); - } -#endif } } @@ -1535,13 +1302,11 @@ void swb_pre_proc_fx( } } -#ifdef NONBE_FIX_ISSUE_2206 IF( st->element_mode > EVS_MONO ) { st->hBWE_TD->dec_2_over_3_mem_q = st->q_inp; move16(); } -#endif return; } diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index 5128ca77f790a27f9d03869a8ded9f16402dd1cb..4b0b8b5e284f284687a944170a053c3b7a6bd23f 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -65,11 +65,7 @@ static void Quant_shb_ener_sf_fx( Encoder_State *st_fx, Word32 *shb_ener_sf_Q31, static void Quant_shb_res_gshape_fx( Encoder_State *st, Word16 shb_res_gshape_fx[] ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT static void gainFrSmooth_En_fx( Encoder_State *st_fx, Word16 *shb_frame_fx, Word16 shb_frame_q, const Word16 *lpc_shb_fx /* Q12 */, const Word16 *lsp_shb_fx /* Q15 */, Word16 *MA_lsp_shb_spacing /* Q15 */, Word16 *frGainAttenuate /* Q0 */, Word16 *frGainSmoothEn /* Q0 */ ); -#else -static void gainFrSmooth_En_fx( Encoder_State *st_fx, Word16 *shb_frame_fx /* Q_in */, const Word16 *lpc_shb_fx /* Q12 */, const Word16 *lsp_shb_fx /* Q15 */, Word16 *MA_lsp_shb_spacing /* Q15 */, Word16 *frGainAttenuate /* Q0 */, Word16 *frGainSmoothEn /* Q0 */ ); -#endif /*-------------------------------------------------------------------* @@ -398,10 +394,8 @@ void InitSWBencBuffer_fx( move32(); set16_fx( hBWE_TD->state_ana_filt_shb_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); -#ifdef NONBE_FIX_ISSUE_2206 hBWE_TD->state_ana_filt_shb_fx_Q = Q15; move16(); -#endif set32_fx( hBWE_TD->elliptic_bpf_2_48k_mem_fx[0], 0, 4 ); set32_fx( hBWE_TD->elliptic_bpf_2_48k_mem_fx[1], 0, 4 ); set32_fx( hBWE_TD->elliptic_bpf_2_48k_mem_fx[2], 0, 4 ); @@ -410,10 +404,8 @@ void InitSWBencBuffer_fx( move16(); set16_fx( hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT hBWE_TD->old_speech_shb_q = Q15; move16(); -#endif set16_fx( hBWE_TD->old_speech_wb_fx, 0, ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16 ); set16_fx( hBWE_TD->old_input_fhb_fx, 0, NS2SA( 48000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) - L_FRAME48k / 2 ); hBWE_TD->old_input_fhb_fx_Q = 0; @@ -434,10 +426,8 @@ void InitSWBencBuffer_fx( set16_fx( hBWE_TD->lsp_shb_slow_interpl_fx, 0, LPC_SHB_ORDER ); set16_fx( hBWE_TD->lsp_shb_fast_interpl_fx, 0, LPC_SHB_ORDER ); set16_fx( hBWE_TD->shb_inv_filt_mem_fx, 0, LPC_SHB_ORDER ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT hBWE_TD->shb_inv_filt_mem_q = Q15; move16(); -#endif set16_fx( hBWE_TD->lsp_shb_spacing_fx, 3277 /* 0.1f in Q15 */, 3 ); set16_fx( hBWE_TD->elliptic_bpf_2_48k_mem_fx_Q, 0, 4 ); @@ -474,10 +464,8 @@ void InitSWBencBuffer_fx( set16_fx( hBWE_TD->dec_2_over_3_mem_fx, 0, 12 ); set16_fx( hBWE_TD->dec_2_over_3_mem_lp_fx, 0, 6 ); -#ifdef NONBE_FIX_ISSUE_2206 hBWE_TD->dec_2_over_3_mem_q = Q15; move16(); -#endif hBWE_TD->prev_fb_energy_fx_Q = 0; move16(); @@ -576,13 +564,9 @@ void ResetSHBbuffer_Enc_fx( #define WBTBE_LPCWIN_LENGTH ( L_LOOK_12k8 + L_SUBFR + L_FRAME ) * 5 / 16 - 1 void wb_tbe_enc_fx( - Encoder_State *st_fx, /* i/o: encoder state structure */ -#ifdef NONBE_FIX_ISSUE_2206 - const Word16 *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz q_hb_speech */ - const Word16 q_hb_speech, /* i : Q of HB target signal (6-8kHz) at 16kHz Q0 */ -#else - const Word16 *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz Q(-1) */ -#endif + Encoder_State *st_fx, /* i/o: encoder state structure */ + const Word16 *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz q_hb_speech */ + const Word16 q_hb_speech, /* i : Q of HB target signal (6-8kHz) at 16kHz Q0 */ const Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation Q(2*Q_new) */ const Word16 Q_new, /* i : input HB speech Q factor */ const Word16 voice_factors[], /* i : voicing factors Q15 */ @@ -634,21 +618,13 @@ void wb_tbe_enc_fx( hb_new_speech = hb_old_speech + WBTBE_LOOK_LSUFBR_5_OVER_16; hb_frame = hb_old_speech + WBTBE_LSUBFR_5_OVER_16 + WBTBE_ANA_ALIGNDELAY; -#ifdef NONBE_FIX_ISSUE_2206 IF( st_fx->element_mode != EVS_MONO ) { Q_ns = s_min( q_hb_speech, add( -1, norm_arr( hBWE_TD->old_speech_wb_fx, WBTBE_LOOK_LSUFBR_5_OVER_16 ) ) ); } Copy_Scale_sig_nosat( hBWE_TD->old_speech_wb_fx, hb_old_speech, WBTBE_LOOK_LSUFBR_5_OVER_16, s_min( 15, sub( Q_ns, -1 ) ) ); -#else - Copy( hBWE_TD->old_speech_wb_fx, hb_old_speech, WBTBE_LOOK_LSUFBR_5_OVER_16 ); -#endif Copy( hb_speech, hb_new_speech, LFRAME16K_OVER_4 ); -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( hb_old_speech + LFRAME16K_OVER_4, hBWE_TD->old_speech_wb_fx, WBTBE_LOOK_LSUFBR_5_OVER_16, sub( -1, Q_ns ) ); -#else - Copy( hb_old_speech + LFRAME16K_OVER_4, hBWE_TD->old_speech_wb_fx, WBTBE_LOOK_LSUFBR_5_OVER_16 ); -#endif test(); test(); @@ -659,11 +635,7 @@ void wb_tbe_enc_fx( IF( ( NE_16( st_fx->last_extl, WB_TBE ) && NE_16( st_fx->last_extl, WB_BWE ) ) && ( st_fx->clas == UNVOICED_CLAS || ( LT_16( st_fx->voicing_fx[0], 16384 ) && LT_16( st_fx->voicing_fx[1], 16384 ) && LT_16( st_fx->voicing_fx[2], 16384 ) ) ) && !st_fx->igf ) { /* In case of unvoiced signals after switching cores, back-propagate the target signal */ -#ifdef NONBE_FIX_ISSUE_2206 Copy_Scale_sig_nosat( hb_speech, hb_old_speech, WBTBE_LOOK_LSUFBR_5_OVER_16, sub( Q_ns, q_hb_speech ) ); -#else - Copy( hb_speech, hb_old_speech, WBTBE_LOOK_LSUFBR_5_OVER_16 ); -#endif i = WBTBE_LOOK_LSUFBR_5_OVER_16; move16(); @@ -685,11 +657,7 @@ void wb_tbe_enc_fx( FOR( j = 0; j < L_SUBFR16k; j = j + 4 ) { L_tmp = L_mult( hb_old_speech[i], ola_win_shb_switch_fold_fx[j] ); -#ifdef NONBE_FIX_ISSUE_2206 hb_old_speech[i] = mac_r_sat( L_tmp, shl( hb_speech[k], sub( Q_ns, q_hb_speech ) ), ola_win_shb_switch_fold_fx[L_SUBFR16k - 4 - j] ); -#else - hb_old_speech[i] = mac_r_sat( L_tmp, hb_speech[k], ola_win_shb_switch_fold_fx[L_SUBFR16k - 4 - j] ); -#endif move16(); i--; k++; @@ -1398,19 +1366,15 @@ void fb_tbe_reset_enc_fx( void swb_tbe_enc_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ STEREO_ICBWE_ENC_HANDLE hStereoICBWE, /* i/o: IC-BWE state structure */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT - Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz Q_shb */ -#else - Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz Q0 */ -#endif - Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation 2 * Q_new */ - const Word16 voice_factors_fx[], /* i : voicing factors Q15 */ - Word16 *White_exc16k_fx, /* o : shaped white excitation for the FB TBE Q_white_exc */ - Word16 *Q_white_exc, /* o : generated white noise for FB Q factor */ - Word16 Q_new, /* i : Q_new */ - Word16 Q_shb, /* i : SHB target Q factor */ - Word16 *voicing, /* i : OL maximum normalized correlation */ - const Word16 pitch_buf[] /* i : subframe pitch Q6 */ + Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz Q_shb */ + Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation 2 * Q_new */ + const Word16 voice_factors_fx[], /* i : voicing factors Q15 */ + Word16 *White_exc16k_fx, /* o : shaped white excitation for the FB TBE Q_white_exc */ + Word16 *Q_white_exc, /* o : generated white noise for FB Q factor */ + Word16 Q_new, /* i : Q_new */ + Word16 Q_shb, /* i : SHB target Q factor */ + Word16 *voicing, /* i : OL maximum normalized correlation */ + const Word16 pitch_buf[] /* i : subframe pitch Q6 */ ) { @@ -1564,7 +1528,6 @@ void swb_tbe_enc_fx( shb_new_speech_fx = shb_old_speech_fx + delay; } -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Word16 Q_shb2; Q_shb2 = s_min( Q_shb, hBWE_TD->old_speech_shb_q ); @@ -1581,11 +1544,6 @@ void swb_tbe_enc_fx( Copy_Scale_sig_nosat( shb_old_speech_fx + L_FRAME16k, hBWE_TD->old_speech_shb_fx, delay, Q_shb2 ); hBWE_TD->old_speech_shb_q = add( Q_shb, Q_shb2 ); move16(); -#else - Copy( hBWE_TD->old_speech_shb_fx, shb_old_speech_fx, delay ); - Copy( shb_speech_fx, shb_new_speech_fx, L_FRAME16k ); - Copy( shb_old_speech_fx + L_FRAME16k, hBWE_TD->old_speech_shb_fx, delay ); -#endif /* autocorrelation of SHB speech for 10-th order LP analysis */ autocorr_fx( shb_old_speech_fx, @@ -1708,11 +1666,7 @@ void swb_tbe_enc_fx( /* Input signal filtering in case of tonal sounds in the high band gain Frame smoothing and attenuation control */ -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT gainFrSmooth_En_fx( st_fx, shb_frame_fx, Q_shb, lpc_shb_fx, lsf_shb_fx, &MA_lsp_shb_spacing, &frGainAttenuate, &frGainSmoothEn ); -#else - gainFrSmooth_En_fx( st_fx, shb_frame_fx, lpc_shb_fx, lsf_shb_fx, &MA_lsp_shb_spacing, &frGainAttenuate, &frGainSmoothEn ); -#endif test(); test(); @@ -2159,11 +2113,7 @@ void swb_tbe_enc_fx( /* calculate variance of the SHB autocorrelation function */ // acorr_v2a = sum2_f( acorr_EnvSHBres, ENVSHBRES_ACORR_MAX - ENVSHBRES_ACORR_MIN ) / ( ENVSHBRES_ACORR_MAX - ENVSHBRES_ACORR_MIN ); tmp_e = sub( 15, Q_shb ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT L_tmp = Mpy_32_32( sum2_16_exp_fx( acorr_EnvSHBres, ENVSHBRES_ACORR_MAX - ENVSHBRES_ACORR_MIN, &tmp_e, 0 ), 53687091 /* 1 / ( ENVSHBRES_ACORR_MAX - ENVSHBRES_ACORR_MIN ) in Q31 */ ); -#else - L_tmp = Mpy_32_32( sum2_16_exp_fx( acorr_EnvSHBres, ENVSHBRES_ACORR_MAX - ENVSHBRES_ACORR_MIN, &tmp_e, 0 ), 53687091 /* 1 / ( ENVSHBRES_ACORR_MAX - ENVSHBRES_ACORR_MIN ) in Q31 */ ); -#endif /* multiply with the maximum of the SHB autocorrelation function */ maximum_fx( acorr_EnvSHBres, ENVSHBRES_ACORR_MAX - ENVSHBRES_ACORR_MIN, &temp ); @@ -4773,12 +4723,8 @@ static Word16 Find_LSF_grid_fx( static void gainFrSmooth_En_fx( Encoder_State *st_fx, -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT Word16 *shb_frame_fx /* shb_frame_q */, Word16 shb_frame_q /* Q_in */, -#else - Word16 *shb_frame_fx /* Q_in */, -#endif const Word16 *lpc_shb_fx /* Q12 */, const Word16 *lsp_shb_fx /* Q15 */, Word16 *MA_lsp_shb_spacing /* Q15 */, @@ -4864,10 +4810,8 @@ static void gainFrSmooth_En_fx( hBWE_TD->prev_frGainAtten = 1; move16(); set16_fx( hBWE_TD->shb_inv_filt_mem_fx, 0, LPC_SHB_ORDER ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT hBWE_TD->shb_inv_filt_mem_q = Q15; move16(); -#endif } /* Estimate the moving average LSP spacing */ @@ -4894,15 +4838,9 @@ static void gainFrSmooth_En_fx( IF( NE_32( st_fx->total_brate, ACELP_24k40 ) ) { -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 Scale_sig( hBWE_TD->shb_inv_filt_mem_fx, LPC_SHB_ORDER, sub( shb_frame_q, hBWE_TD->shb_inv_filt_mem_q ) ); -#else - scale_sig( hBWE_TD->shb_inv_filt_mem_fx, LPC_SHB_ORDER, sub( shb_frame_q, hBWE_TD->shb_inv_filt_mem_q ) ); -#endif hBWE_TD->shb_inv_filt_mem_q = shb_frame_q; move16(); -#endif Copy( shb_frame_fx, temp_shb_frame, L_FRAME16k + L_SHB_LAHEAD ); fir_fx( temp_shb_frame, lpc_shb_fx, shb_frame_fx, hBWE_TD->shb_inv_filt_mem_fx, L_FRAME16k + L_SHB_LAHEAD, LPC_SHB_ORDER, 1, 3 ); } @@ -5745,10 +5683,8 @@ void TBEreset_enc_fx( ELSE IF( ( EQ_16( bandwidth, SWB ) ) || ( EQ_16( bandwidth, FB ) ) ) { set16_fx( hBWE_TD->state_ana_filt_shb_fx, 0, ( 2 * ALLPASSSECTIONS_STEEP + 1 ) ); -#ifdef NONBE_FIX_ISSUE_2206 hBWE_TD->state_ana_filt_shb_fx_Q = Q15; move16(); -#endif swb_tbe_reset_fx( hBWE_TD->mem_csfilt_fx, hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->state_lpc_syn_fx, hBWE_TD->syn_overlap_fx, hBWE_TD->state_syn_shbexc_fx, &( hBWE_TD->tbe_demph_fx ), &( hBWE_TD->tbe_premph_fx ), @@ -5783,10 +5719,8 @@ void InitSWBencBufferStates_fx( } set16_fx( hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT hBWE_TD->old_speech_shb_q = Q15; move16(); -#endif set16_fx( hBWE_TD->mem_shb_res_fx, 0, MAX_LEN_MA_FILTER ); set16_fx( hBWE_TD->old_EnvSHBres_fx, 0, L_FRAME4k ); hBWE_TD->old_mean_EnvSHBres_fx = 0; diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 82ff1cb614ee9d6d5ed4cce42e1de2e4db2b4584..628a06440c828ed19cad0d4cf4e5e2f5821e5835 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -2433,24 +2433,15 @@ void tcx_encoder_memory_update_ivas_fx( Word16 preemph, /* i : preemphasis factor, Q15 */ LPD_state *LPDmem, /* i/o: coder memory state */ Encoder_State *st, -#ifndef NONBE_FIX_ISSUE_2206 - Word16 *synthout, /* Q_new */ -#endif Word16 Q_new ) { Word16 tmp; Word16 buf[1 + M + LFAC + L_FRAME_PLUS]; Word16 *synth; -#ifndef NONBE_FIX_ISSUE_2206 - /* Output synth */ - Copy( xn_buf, synthout, L_frame_glob ); -#endif /* Update synth */ synth = buf + M + 1; -#ifdef NONBE_FIX_ISSUE_2206 assert( Q_new == LPDmem->q_lpd_syn ); -#endif Copy( LPDmem->syn, buf, M + 1 ); Copy( xn_buf, synth, L_frame_glob ); diff --git a/lib_enc/updt_enc_fx.c b/lib_enc/updt_enc_fx.c index b1d4db1c6213df244993798d4e65a700c6cf307a..a3b89edfd6730ac0fa061af385c13057d3f4582b 100644 --- a/lib_enc/updt_enc_fx.c +++ b/lib_enc/updt_enc_fx.c @@ -236,10 +236,8 @@ void updt_IO_switch_enc_fx( /* reset TD BWE buffers */ set16_fx( hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); -#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT hBWE_TD->old_speech_shb_q = Q15; move16(); -#endif set16_fx( hBWE_TD->old_speech_wb_fx, 0, ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16 ); set16_fx( hBWE_TD->old_bwe_exc_fx, 0, PIT16k_MAX * 2 ); set16_fx( hBWE_TD->old_bwe_exc_extended_fx, 0, NL_BUFF_OFFSET );