From a5d4aab0507a8596c8f2b9e81a6bbf83c89d0146 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 23 Jan 2026 09:49:15 +0100 Subject: [PATCH 1/2] FIX_2367_REMOVE_CODE_ICBWE --- lib_com/ivas_prot_fx.h | 2 +- lib_com/options.h | 1 + lib_enc/ivas_core_enc_fx.c | 4 +- lib_enc/ivas_stereo_icbwe_enc_fx.c | 90 +++++++++++++++--------------- 4 files changed, 51 insertions(+), 46 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 31dfb1ea2..a28bea6cd 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1357,7 +1357,7 @@ void stereo_tcx_init_dec_fx( const Word16 last_element_mode /* i : element mode of previous frame */ ); -void stereo_icBWE_enc_ivas_fx( +void stereo_icBWE_enc_fx( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const Word32 shb_speech_ref_fx[], /* i : SHB speech ref channel */ const Word16 shb_speech_ref_e, /* i : SHB speech ref channel */ diff --git a/lib_com/options.h b/lib_com/options.h index c7cd38dd8..b1a4e3c5a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -107,6 +107,7 @@ #define FIX_2330_CLANG_18_WARNINGS_REND /* FhG: Fix renderer warnings */ #define FIX_BASOP_2350_HARM_0B_BWE /* VA: basop issue 2350: harmonization of the 0b BWE */ #define FIX_2349_HARM_FIND_UV /* VA: basop issue 2349: harmonization of find_uv() function */ +#define FIX_2367_REMOVE_CODE_ICBWE /* VA: basop issue 2367: Remove IC-BWE obsolete code */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 3a19ad171..9ba980600 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -824,7 +824,8 @@ ivas_error ivas_core_enc_fx( Copy_Scale_sig_16_32_no_sat( new_swb_speech_buffer_fx_16, new_swb_speech_buffer_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 Copy_Scale_sig_16_32_no_sat( voice_factors_fx[0], voice_factors_fx32[0], NB_SUBFR16k, Q16 ); // Q31 - stereo_icBWE_enc_ivas_fx( hCPE, shb_speech_fx32, sub( Q31, Q_shb_spch ), new_swb_speech_buffer_fx, sub( Q31, q_new_swb_speech_buffer ), voice_factors_fx32[0] ); + stereo_icBWE_enc_fx( hCPE, shb_speech_fx32, sub( Q31, Q_shb_spch ), new_swb_speech_buffer_fx, sub( Q31, q_new_swb_speech_buffer ), voice_factors_fx32[0] ); +#ifndef FIX_2367_REMOVE_CODE_ICBWE IF( EQ_16( st->element_mode, IVAS_CPE_DFT ) ) { @@ -840,6 +841,7 @@ ivas_error ivas_core_enc_fx( move32(); } } +#endif } Copy( tmp_old_input_fx, st->input_fx - input_frame, input_frame ); diff --git a/lib_enc/ivas_stereo_icbwe_enc_fx.c b/lib_enc/ivas_stereo_icbwe_enc_fx.c index 61a2f0490..7ae50b177 100644 --- a/lib_enc/ivas_stereo_icbwe_enc_fx.c +++ b/lib_enc/ivas_stereo_icbwe_enc_fx.c @@ -39,6 +39,7 @@ #include "ivas_rom_com.h" #include "ivas_prot_fx.h" + /*-------------------------------------------------------------------* * ic_bwe_enc_reset() * @@ -90,21 +91,24 @@ static void ic_bwe_enc_reset_fx( return; } + /*--------------------------------------------------------------------------* * ic_bwe_specMapping() * * Encode and apply the spectral shape mapping of ref to the non-ref channel *---------------------------------------------------------------------------*/ -static Word16 ic_bwe_enc_specMapping_ivas_fx( - const Word32 *shb_frame_target_fx, /* i : target shb Q31-shb_frame_target_e*/ - Word16 shb_frame_target_e, - Word32 *shb_synth_nonref_fx, /* o : non-ref shb synth Q31-shb_synth_nonref_e*/ - Word16 *shb_synth_nonref_e, - Word32 *specMapping_fx, /* i/o: current frame's mapping Qx*/ - Word32 *memShbSpecMapping_fx, /* i/o: current frame's mapping Q31-memShbSpecMapping_e*/ - Word16 *memShbSpecMapping_e, - Word32 *memShbSpecXcorr_fx, /* i/o: ic bwe spec mapping scorr memory Q31-memShbSpecXcorr_e*/ - Word16 *memShbSpecXcorr_e ) + +static Word16 ic_bwe_enc_specMapping_fx( + const Word32 *shb_frame_target_fx, /* i : target shb Q31-shb_frame_target_e*/ + const Word16 shb_frame_target_e, /* i : Q value shb_frame_target_fx */ + Word32 *shb_synth_nonref_fx, /* o : non-ref shb synth Q31-shb_synth_nonref_e*/ + Word16 *shb_synth_nonref_e, /* i/o: Q value shb_synth_nonref_fx */ + Word32 *specMapping_fx, /* i/o: current frame's mapping Qx*/ + Word32 *memShbSpecMapping_fx, /* i/o: current frame's mapping Q31-memShbSpecMapping_e*/ + Word16 *memShbSpecMapping_e, /* i/o: Q value memShbSpecMapping_fx */ + Word32 *memShbSpecXcorr_fx, /* i/o: ic bwe spec mapping scorr memory Q31-memShbSpecXcorr_e*/ + Word16 *memShbSpecXcorr_e /* i/o: Q value memShbSpecMapping_fx */ +) { Word16 idx; Word16 max_exp; @@ -129,7 +133,6 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( move16(); /* Calculate rxx(1)/rxx(0) of the non ref target */ - temp00_fx = dotp_fx_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx, shb_frame_target_e, L_FRAME16k - 1, &temp00_exp ); /* Q31-temp0_exp */ temp11_fx = dotp_fx_ivas_fx( shb_frame_target_fx, shb_frame_target_e, shb_frame_target_fx + 1, shb_frame_target_e, L_FRAME16k - 1, &temp11_exp ); /* Q31-temp1_exp */ @@ -149,7 +152,6 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( temp3_fx = L_shr( temp3_fx, sub( exp, temp3_exp ) ); /* Smoothing */ - FOR( Word16 i = 0; i < 6; i++ ) { memShbSpecXcorr_fx[i] = L_shl( memShbSpecXcorr_fx[i], sub( *memShbSpecXcorr_e, exp ) ); @@ -175,7 +177,6 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( T_nonref_target_fx = BASOP_Util_Divide3232_Scale( temp11_fx, temp00_fx, &T_nonref_target_e ); } - memShbSpecXcorr_fx[0] = temp00_fx; move32(); memShbSpecXcorr_fx[1] = temp11_fx; @@ -189,7 +190,6 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( memShbSpecXcorr_fx[5] = temp3_fx; /* Q31-exp */ move32(); - IF( temp0_fx != 0 ) { Txx1_fx = BASOP_Util_Divide3232_Scale( temp1_fx, temp0_fx, &Txx1_e ); /* Q31-Txx1_e */ @@ -215,9 +215,7 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( u_fx = extract_l( *specMapping_fx ); - /* while performing (-32768)*(-32768), overflow occurs because the result comes out as 32768 after mult. This is the only case for mult where overflow happens. In order to avoid this scenario mult_sat is used */ - tmp = mult_sat( b_fx, b_fx ); // b_e + b_e; tmp1 = mult_sat( a_fx, c_fx ); // a_e + c_e + 2 @@ -314,14 +312,7 @@ static Word16 ic_bwe_enc_specMapping_ivas_fx( *-----------------------------------------------------------------------*/ /*! r: return quant. index value */ -/*----------------------------------------------------------------------* - * ic_bwe_gsMapping() - * - * Encode and apply the gain shape mapping of ref to the non-ref channel - *-----------------------------------------------------------------------*/ - -/*! r: return quant. index value */ -static Word16 ic_bwe_enc_gsMapping_ivas_fx( +static Word16 ic_bwe_enc_gsMapping_fx( const Word32 relG_targ_fx, /* i : gDes, rel gain target Q31-relG_targ_e*/ Word16 relG_targ_e, const Word16 *shbSynth_fx, /* i : ref synth signal Q15-shbSynth_e*/ @@ -416,8 +407,10 @@ static Word16 ic_bwe_enc_gsMapping_ivas_fx( move16(); idx = squant_fx( temp2_fx, &gsMapping_fx16, icbwe_gsMappingDFT_tbl_fx, ( 1 << STEREO_ICBWE_GSBITS_DFT ) ); // Q12 } + *gsMapping_fx = L_deposit_h( gsMapping_fx16 ); // Q28 move32(); + Word16 e; L_mult = Mult_32_16( *gsMapping_fx, 27213 /*=log2(10)*2^13*/ ); // Q28 + Q13 - Q15 -> Q26 *gsMapping_fx = BASOP_util_Pow2( L_mult, 5, &e ); /* Q31-e */ @@ -425,15 +418,18 @@ static Word16 ic_bwe_enc_gsMapping_ivas_fx( *gsMapping_e = e; // Q31 move16(); + return idx; } + /*----------------------------------------------------------------------* * icbwe_dft_stereo_param() * * Estimate ICBWE parameters in DFT stereo *-----------------------------------------------------------------------*/ -static void icbwe_dft_stereo_param_ivas_fx( + +static void icbwe_dft_stereo_param_fx( STEREO_ICBWE_ENC_HANDLE hStereoICBWE, /* i/o: */ STEREO_DFT_ENC_DATA_HANDLE hStereoDft, /* i : */ Encoder_State *st, /* i/o: */ @@ -486,7 +482,6 @@ static void icbwe_dft_stereo_param_ivas_fx( move16(); /* refChanIndex_bwe refinement */ - test(); test(); test(); @@ -563,7 +558,6 @@ static void icbwe_dft_stereo_param_ivas_fx( } /* gsMapping estimate */ - Word16 exp; IF( hStereoICBWE->refChanIndx_bwe == L_CH_INDX ) { @@ -592,7 +586,7 @@ static void icbwe_dft_stereo_param_ivas_fx( move32(); move16(); - gsIndx = ic_bwe_enc_gsMapping_ivas_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */ + gsIndx = ic_bwe_enc_gsMapping_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */ hStereoICBWE->gDes_pastFrame_fx = L_deposit_h( gDes_fx ); /* Q31-exp */ hStereoICBWE->gDes_pastFrame_e = exp; @@ -611,13 +605,20 @@ static void icbwe_dft_stereo_param_ivas_fx( return; } -void stereo_icBWE_enc_ivas_fx( - CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ - const Word32 shb_speech_ref_fx[], /* i : SHB speech ref channel Q31-shb_speech_ref_e*/ - const Word16 shb_speech_ref_e, /* i : SHB speech ref channel */ - Word32 shb_speech_nonref_fx[], /* i/o: SHB speech non-ref channel Q31-shb_speech_nonref_e*/ - Word16 shb_speech_nonref_e, /* i/o: SHB speech non-ref channel */ - const Word32 *voice_factors_fx /* i : voicing factors Q31 */ + +/*-------------------------------------------------------------------* + * stereo_icBWE_enc() + * + * Encode the spatial mapping of reference to the non-reference channels in HB + *-------------------------------------------------------------------*/ + +void stereo_icBWE_enc_fx( + CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ + const Word32 shb_speech_ref_fx[], /* i : SHB speech ref channel Q31-shb_speech_ref_e*/ + const Word16 shb_speech_ref_e, /* i : SHB speech ref channel */ + Word32 shb_speech_nonref_fx[], /* i/o: SHB speech non-ref channel Q31-shb_speech_nonref_e*/ + Word16 shb_speech_nonref_e, /* i/o: SHB speech non-ref channel */ + const Word32 *voice_factors_fx /* i : voicing factors Q31 */ ) { Word16 i, j, k, nbSubFr; @@ -641,7 +642,6 @@ void stereo_icBWE_enc_ivas_fx( Word32 temp1_fx, temp2_fx; Word16 temp1_e, temp2_e, shb_frame_ref_e, shb_frame_nonref_e, gDes_e, tmp, exp; - /* initialization */ hStereoDft = hCPE->hStereoDft; hStereoICBWE = hCPE->hStereoICBWE; @@ -702,7 +702,6 @@ void stereo_icBWE_enc_ivas_fx( move32(); /* SHB frame buffer offsets for TBE processing << re-adjust check >>*/ - max_e = s_max( hStereoICBWE->mem_shb_speech_ref_e, shb_speech_ref_e ); Copy_Scale_sig( hStereoICBWE->mem_shb_speech_ref_fx, hStereoICBWE->mem_shb_speech_ref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ) ); // mem_shb_speech_ref_e @@ -722,7 +721,6 @@ void stereo_icBWE_enc_ivas_fx( Copy_Scale_sig32( shb_speech_ref_fx, shb_frame_ref_fx + L_LOOK_16k - refMemLen, L_FRAME16k, negate( sub( max_e, shb_speech_ref_e ) ) ); /* shb_speech_ref_e */ Copy_Scale_sig_32_16( shb_frame_ref_fx + L_FRAME16k, hStereoICBWE->mem_shb_speech_ref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ) - Q16 ); // mem_shb_speech_ref_e - test(); test(); IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) ) @@ -798,8 +796,8 @@ void stereo_icBWE_enc_ivas_fx( excSHB_nonref_fx[j] = L_shr( excSHB_nonref_fx[j], sub( max_e, exp_buf[j] ) ); /* Q31-max_e */ move32(); } - /* LP synthesis */ + /* LP synthesis */ Copy_Scale_sig32( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, sub( hStereoICBWE->mem_lpc_shbsynth_nonref_e, s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e ) ) ); /* Q31-tmp_e */ Copy_Scale_sig32( excSHB_nonref_fx, excSHB_nonref_fx, L_FRAME16k, sub( max_e, s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e ) ) ); /* Q31-tmp_e */ max_e = s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e ); @@ -820,11 +818,10 @@ void stereo_icBWE_enc_ivas_fx( move16(); } - icbwe_dft_stereo_param_ivas_fx( hStereoICBWE, hStereoDft, st, shb_synth_nonref_fx, &shb_synth_nonref_e ); + icbwe_dft_stereo_param_fx( hStereoICBWE, hStereoDft, st, shb_synth_nonref_fx, &shb_synth_nonref_e ); } ELSE { - max_e = s_max( hStereoICBWE->mem_shb_speech_ref_e, shb_speech_ref_e ); Copy_Scale_sig( hStereoICBWE->mem_shb_speech_ref_fx, hStereoICBWE->mem_shb_speech_ref_fx, L_LOOK_16k, negate( sub( max_e, hStereoICBWE->mem_shb_speech_ref_e ) ) ); // mem_shb_speech_ref_e @@ -900,7 +897,6 @@ void stereo_icBWE_enc_ivas_fx( /*temp1 = 0.8f*hStereoICBWE->prevNonRefEner + 0.2f*temp1;*/ /*temp2 = 0.8f*hStereoICBWE->prevRefEner + 0.2f*temp2;*/ - IF( temp2_fx == 0 ) { gDes_fx = 1073741824; /* 1.0 in Q30 */ @@ -1012,6 +1008,7 @@ void stereo_icBWE_enc_ivas_fx( excSHB_nonref_fx[j] = L_shr( excSHB_nonref_fx[j], sub( max_e, exp_buf[j] ) ); /* Q31-max_e */ move32(); } + /* LP synthesis */ Copy_Scale_sig32( hStereoICBWE->mem_lpc_shbsynth_nonref_fx, hStereoICBWE->mem_lpc_shbsynth_nonref_fx, LPC_SHB_ORDER, sub( hStereoICBWE->mem_lpc_shbsynth_nonref_e, s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e ) ) ); /* Q31-tmp_e */ Copy_Scale_sig32( excSHB_nonref_fx, excSHB_nonref_fx, L_FRAME16k, sub( max_e, s_max( hStereoICBWE->mem_lpc_shbsynth_nonref_e, max_e ) ) ); /* Q31-tmp_e */ @@ -1039,7 +1036,7 @@ void stereo_icBWE_enc_ivas_fx( IF( ( EQ_16( st->extl, SWB_TBE ) || EQ_16( st->extl, WB_TBE ) || EQ_16( st->extl, FB_TBE ) ) && EQ_16( st->flag_ACELP16k, 1 ) ) { /* IC BWE spectral mapping */ - spIndx = ic_bwe_enc_specMapping_ivas_fx( shb_frame_nonref_fx, shb_frame_nonref_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_e ), hStereoICBWE->memShbSpecXcorr_fx, &( hStereoICBWE->memShbSpecXcorr_e ) ); /* Q0 */ + spIndx = ic_bwe_enc_specMapping_fx( shb_frame_nonref_fx, shb_frame_nonref_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_fx ), &( hStereoICBWE->memShbSpecMapping_e ), hStereoICBWE->memShbSpecXcorr_fx, &( hStereoICBWE->memShbSpecXcorr_e ) ); /* Q0 */ } ELSE { @@ -1063,7 +1060,7 @@ void stereo_icBWE_enc_ivas_fx( /* IC BWE GS mapping */ - gsIndx = ic_bwe_enc_gsMapping_ivas_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */ + gsIndx = ic_bwe_enc_gsMapping_fx( hStereoICBWE->gDes_pastFrame_fx, hStereoICBWE->gDes_pastFrame_e, hStereoICBWE->shbSynthRef_fx, hStereoICBWE->shbSynthRef_e, shb_synth_nonref_fx, &shb_synth_nonref_e, &( hStereoICBWE->prevgsMapping_fx ), &( hStereoICBWE->prevgsMapping_e ), hStereoICBWE->memGsEnerMap_fx, &hStereoICBWE->memGsEnerMap_e, st->element_mode ); /* Q0 */ hStereoICBWE->gDes_pastFrame_fx = gDes_fx; /* Q31-hStereoICBWE->gDes_pastFrame_e */ hStereoICBWE->gDes_pastFrame_e = gDes_e; @@ -1085,6 +1082,7 @@ void stereo_icBWE_enc_ivas_fx( * * Stereo (inter-channel) BWE mapping - encoder initialization *-------------------------------------------------------------------*/ + void stereo_icBWE_init_enc_fx( STEREO_ICBWE_ENC_HANDLE hStereoICBWE /* i/o: Stereo inter-channel BWE handle */ ) @@ -1173,11 +1171,14 @@ void stereo_icBWE_init_enc_fx( return; } + + /*-------------------------------------------------------------------* * findRefChanBWE() * * Inter-channel BWE pre-proc of the non-ref channel *-------------------------------------------------------------------*/ + static void findRefChanBWE_fx( const Word16 *input0_fx, /* i/o : input 0 Qx q_dataChan_fx*/ const Word16 *input1_fx, /* i/o : input 1 Qx q_dataChan_fx*/ @@ -1219,6 +1220,7 @@ static void findRefChanBWE_fx( * * Inter-channel BWE pre-proc of the non-ref channel *-------------------------------------------------------------------*/ + void stereo_icBWE_preproc_fx( CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */ const Word16 input_frame, /* i : input frame length Q0*/ -- GitLab From f006922fd16f3b5264fc785e32fa2d527cd9586b Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 23 Jan 2026 10:23:32 +0100 Subject: [PATCH 2/2] FIX_2367_REMOVE_CODE_ICBWE --- lib_dec/ivas_core_dec_fx.c | 2 ++ lib_dec/ivas_stereo_icbwe_dec_fx.c | 29 +++++++++++++++++++---------- lib_enc/ivas_core_enc_fx.c | 5 +++++ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index b71f0df7d..459d1b450 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -1181,11 +1181,13 @@ ivas_error ivas_core_dec_fx( q = 11; move16(); +#ifndef FIX_2367_REMOVE_CODE_ICBWE if ( hCPE->hStereoDft != NULL ) { hCPE->hStereoDft->td_gain_fx[0] = 1; move32(); } +#endif stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q, Q_white_exc ); test(); test(); diff --git a/lib_dec/ivas_stereo_icbwe_dec_fx.c b/lib_dec/ivas_stereo_icbwe_dec_fx.c index 0dc9e7886..1c51fc2d1 100644 --- a/lib_dec/ivas_stereo_icbwe_dec_fx.c +++ b/lib_dec/ivas_stereo_icbwe_dec_fx.c @@ -112,6 +112,12 @@ static Word16 FindScale( } +/*-------------------------------------------------------------------* + * stereo_icBWE_dec() + * + * Spatial mapping of reference to the non-reference channels in SHB + *-------------------------------------------------------------------*/ + void stereo_icBWE_dec_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ Word32 *synthRef_fx, /* i/o: Reference channel HB synthesis at output Fs Q11 */ @@ -150,6 +156,14 @@ void stereo_icBWE_dec_fx( STEREO_ICBWE_DEC_HANDLE hStereoICBWE = hCPE->hStereoICBWE; st = hCPE->hCoreCoder[0]; +#ifdef FIX_2367_REMOVE_CODE_ICBWE + if ( hCPE->hStereoDft != NULL ) + { + hCPE->hStereoDft->td_gain_fx[0] = 1; + move32(); + } + +#endif /*--------------------------------------------------------------------* * skip IC-BWE in case of mono DMX output * * -------------------------------------------------------------------*/ @@ -251,6 +265,7 @@ void stereo_icBWE_dec_fx( /*--------------------------------------------------------------------* * IC-BWE * * -------------------------------------------------------------------*/ + test(); test(); test(); @@ -265,7 +280,6 @@ void stereo_icBWE_dec_fx( return; } - set16_fx( fb_synth_nonref_fx, 0, L_FRAME48k ); /* core switching reset */ @@ -408,7 +422,6 @@ void stereo_icBWE_dec_fx( } // hStereoICBWE->prevgsMapping = powf( 10, hStereoICBWE->prevgsMapping ); - specMapping_fx = hStereoICBWE->prevSpecMapping_fx; // Q15 move16(); gsMapping_fx = hStereoICBWE->prevgsMapping_fx; // Q14 @@ -637,7 +650,6 @@ void stereo_icBWE_dec_fx( } /* generate 32kHz SHB synthesis from 12.8(16)kHz signal */ - tmp = 31; move16(); tmp = FindScale( shb_synth_nonref_fx, L_FRAME16k + L_SHB_LAHEAD, Q_syn_shb, tmp ); @@ -669,7 +681,6 @@ void stereo_icBWE_dec_fx( alpha_fx = winSlope_fx; /* Q15 */ move16(); - IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) { ratio_L_fx = 16384; /* 0.5 in Q15 */ @@ -685,7 +696,6 @@ void stereo_icBWE_dec_fx( move16(); IF( hStereoICBWE->refChanIndx_bwe == L_CH_INDX ) { - IF( GE_16( ratio_L_fx, 3276 /* 0.1 in Q15 */ ) ) { tmp = mult_r( sub( 32767 /* 1.0 in Q15 */, ratio_L_fx ), sub( 32767 /* 1.0 in Q15 */, ratio_L_fx ) ); // Q15 @@ -775,8 +785,6 @@ void stereo_icBWE_dec_fx( } /* resample to output FS */ - - IF( EQ_32( st->output_Fs, 48000 /* Q0 */ ) ) { tmp = 31; @@ -829,7 +837,6 @@ void stereo_icBWE_dec_fx( } /* copy to outputHB and reset hb_synth values */ - IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) { ratio_L_fx = 16384; /* 1.0 in Q15 */ @@ -926,6 +933,7 @@ void stereo_icBWE_dec_fx( return; } + /*-------------------------------------------------------------------* * stereo_icBWE_decproc() * @@ -1084,7 +1092,7 @@ void stereo_icBWE_decproc_fx( move32(); BREAK; } - // memOffset for 16K 32K 48K are 15 30 45 respectively.camera + // memOffset for 16K 32K 48K are 15 30 45 respectively } ELSE { @@ -1172,7 +1180,7 @@ void stereo_icBWE_decproc_fx( move16(); BREAK; } - // memOffset for 16K 32K 48K are 15 30 45 respectively.camera + // memOffset for 16K 32K 48K are 15 30 45 respectively } ELSE { @@ -1354,6 +1362,7 @@ void stereo_icBWE_decproc_fx( return; } + /*-------------------------------------------------------------------* * stereo_icBWE_init_dec() * diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index 9ba980600..3a945295b 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -810,13 +810,18 @@ ivas_error ivas_core_enc_fx( * Inter-channel BWE encoding *-------------------------------------------------------------------*/ +#ifndef FIX_2367_REMOVE_CODE_ICBWE Word16 q_new_swb_speech_buffer = getScaleFactor16( new_swb_speech_buffer_fx_16, L_FRAME48k + STEREO_DFT_OVL_MAX ); Scale_sig( new_swb_speech_buffer_fx_16, L_FRAME48k + STEREO_DFT_OVL_MAX, q_new_swb_speech_buffer ); // st->q_inp+q_new_swb_speech_buffer q_new_swb_speech_buffer = add( st->q_inp, q_new_swb_speech_buffer ); +#endif test(); test(); IF( n == 0 && GE_32( input_Fs, 32000 ) && hStereoICBWE != NULL ) { +#ifdef FIX_2367_REMOVE_CODE_ICBWE + Word16 q_new_swb_speech_buffer = st->q_inp; +#endif Word32 voice_factors_fx32[CPE_CHANNELS][NB_SUBFR16k]; stereo_icBWE_preproc_fx( hCPE, input_frame, new_swb_speech_buffer_fx_16 /*tmp buffer*/, q_new_swb_speech_buffer ); -- GitLab