From a94b819d361a8e8e982ab956f9a95c2e2cf9248e Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 30 Jul 2024 16:05:45 -0400 Subject: [PATCH 1/9] propose fix for 826, increasing precision in icBWE and lowering noise floor in BWE in general --- lib_com/options.h | 1 + lib_dec/ivas_core_dec.c | 10 ++ lib_dec/ivas_stat_dec.h | 4 + lib_dec/ivas_stereo_dft_dec_fx.c | 9 +- lib_dec/ivas_stereo_icbwe_dec.c | 235 +++++++++++++++++++++++++++++-- 5 files changed, 247 insertions(+), 12 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index be93e6a44..2180b9414 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,6 +161,7 @@ #define FIX_802__NON_BE_DECODING /* Fix possible difference float and fixed point when computing the GSC bit allocation */ #define FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING /* VA: ISSUES 802 and 1137 Made sure that float and fixed point GCS bit allocation is the same during IVAS modes */ #define FIX_810_PREVENT_UNECESSARY_SAT_IN_TC /* VA : Prevent an unnecessary saturation that can happen in TC, have a minimal impact on most cases. Significant improvement for the last segment of LTV when TC is triggered */ +#define FIX_826_PRECISION_LOST_AND_COMPL /// TV /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 9d2aa6d7e..f5dd31657 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -1215,7 +1215,10 @@ ivas_error ivas_core_dec_fx( { Copy_Scale_sig_16_32( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, ( Q11 + q ) ); } + +#ifndef FIX_826_PRECISION_LOST_AND_COMPL Copy_Scale_sig_16_32( synth_fxl, synth_32_fx[n], L_FRAME48k, ( Q11 + q ) ); +#endif Scale_sig( st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, -( Q8 - st->prev_Q_bwe_syn ) ); Scale_sig32( st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, -( st->prev_Q_bwe_syn2 - Q11 ) ); Copy_Scale_sig_16_32( st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 2 * ALLPASSSECTIONS_STEEP, -( st->prev_Q_bwe_syn2 - Q11 ) ); @@ -1351,10 +1354,17 @@ ivas_error ivas_core_dec_fx( move16(); FOR( i = 0; i < tmps; i++ ) { + +#ifndef FIX_826_PRECISION_LOST_AND_COMPL tmp_buffer_fx[i] = round_fx( L_add( L_shr( L_mult( st->hb_prev_synth_buffer_fx[i], sin_table256_fx[255 - tmp16] ), 1 ), L_shr( L_mult( st->hb_prev_synth_buffer_fx[sub( sub( st->old_bwe_delay, 1 ), i )], sin_table256_fx[tmp16] ), 1 ) ) ); move16(); tmp_buffer_fx[i] = shl_sat( tmp_buffer_fx[i], 1 ); move16(); +#else + tmp_buffer_fx[i] = round_fx_sat( L_mac_sat( L_mult( st->hb_prev_synth_buffer_fx[i], sin_table256_fx[sub( 255, tmp16 )] ), st->hb_prev_synth_buffer_fx[sub( sub( st->old_bwe_delay, 1 ), i )], sin_table256_fx[tmp16] ) ); + move16(); +#endif + tmp16 = add( tmp16, incr ); } Copy( tmp_buffer_fx, st->hb_prev_synth_buffer_fx, tmps ); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ba197492c..1542469a4 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -322,7 +322,11 @@ typedef struct stereo_dft_dec_data_struct Word16 Q_nrg_subr; Word16 prev_Q_stefi_sig; +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + Word16 q_td_gain[STEREO_DFT_CORE_HIST_MAX]; +#else Word32 q_td_gain[STEREO_DFT_CORE_HIST_MAX]; +#endif Word16 q_hb_stefi_sig_fx; #endif diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index ea5f56998..b1927af31 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -202,8 +202,11 @@ void stereo_dft_dec_reset_fx( set32_fx( hStereoDft->hb_stefi_sig_fx, 0, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); set32_fx( hStereoDft->hb_nrg_fx, 0, STEREO_DFT_CORE_HIST_MAX ); set32_fx( hStereoDft->td_gain_fx, 0, STEREO_DFT_CORE_HIST_MAX ); +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + set16_fx( hStereoDft->q_td_gain, 0, STEREO_DFT_CORE_HIST_MAX ); +#else set32_fx( hStereoDft->q_td_gain, 0, STEREO_DFT_CORE_HIST_MAX ); - +#endif hStereoDft->q_dft = 0; move16(); @@ -668,7 +671,11 @@ void stereo_dft_dec_update_fx( Copy32( hStereoDft->hb_stefi_sig_fx + output_frame, hStereoDft->hb_stefi_sig_fx, hStereoDft->hb_stefi_delay ); Copy32( hStereoDft->hb_nrg_fx, hStereoDft->hb_nrg_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); Copy32( hStereoDft->td_gain_fx, hStereoDft->td_gain_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + Copy( hStereoDft->q_td_gain, hStereoDft->q_td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); +#else Copy32( hStereoDft->q_td_gain, hStereoDft->q_td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); +#endif IF( sba_dirac_stereo_flag ) { diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 95d43ad48..218fa1b05 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -554,9 +554,9 @@ static Word16 FindScale( 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 Q_syn/Q_syn - 1 */ - Word32 *synth_fx, /* o : Non reference channel HB synthesis at output Fs Q_syn/Q_syn - 1 */ - const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz Qx */ + Word32 *synthRef_fx, /* i/o: Reference channel HB synthesis at output Fs Q11 */ + Word32 *synth_fx, /* o : Non reference channel HB synthesis at output Fs Q11 */ + const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz Q11 */ const Word16 *voice_factors_fx, /* i : voicing factors Q15 */ const Word16 output_frame, /* i : frame length */ Word16 *Q_syn /* i : Q of synth and synthRef buffers */ @@ -635,17 +635,47 @@ void stereo_icBWE_dec_fx( synthRef_shift = 31; move16(); } +#ifndef FIX_826_PRECISION_LOST_AND_COMPL /* Not needed Q11 is already enough */ synthRef_shift = sub( synthRef_shift, shr( add( find_guarded_bits_fx( output_frame ), 1 ), 1 ) ); +#else + synthRef_shift = sub( synthRef_shift, shr( add( find_guarded_bits_fx( shr( output_frame, 1 ) ), 1 ), 1 ) ); +#endif test(); - IF( st->core == ACELP_CORE || st->last_core == ACELP_CORE ) - { - FOR( i = 0; i < output_frame / 2; i++ ) + IF( EQ_16( st->core, ACELP_CORE ) || EQ_16( st->last_core, ACELP_CORE ) ) + { +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + Word64 W_tmp = 0; + move64(); + tmp = shl_sat( 1, synthRef_shift ); +#endif + FOR( i = 0; i < shr( output_frame, 1 ); i++ ) { // needed to be adjusted for q +#ifndef FIX_826_PRECISION_LOST_AND_COMPL L_tmp = L_shl( synthRef_fx[i], synthRef_shift ); hb_nrg2_fx = L_add( hb_nrg2_fx, Mpy_32_32( L_tmp, L_tmp ) ); // 2*(Qx + SynthRef_shift) - 31 +#else + L_tmp = Mpy_32_16_1( synthRef_fx[i], tmp ); + W_tmp = W_mac_32_32(W_tmp, L_tmp, L_tmp ); +#endif + } +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + hb_nrg_fx = W_round48_L( W_tmp ); + hCPE->hStereoDft->hb_nrg_subr_fx[0] = hb_nrg_fx; + move32(); + hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 45 ); + move16(); + W_tmp = 0; + move64(); + FOR( ; i < output_frame; i++ ) + { + L_tmp = Mpy_32_16_1( synthRef_fx[i], tmp ); + W_tmp = W_mac_32_32( W_tmp, L_tmp, L_tmp ); } + hCPE->hStereoDft->hb_nrg_subr_fx[1] = W_round48_L( W_tmp ); // 2*(Qx + SynthRef_shift) - 45 + hb_nrg_fx = L_add( hCPE->hStereoDft->hb_nrg_subr_fx[0], hCPE->hStereoDft->hb_nrg_subr_fx[1] ); +#else hCPE->hStereoDft->hb_nrg_subr_fx[0] = hb_nrg2_fx; move32(); hStereoDft->q_hb_nrg_subr = sub( add( *Q_syn, synthRef_shift ), 31 ); @@ -662,10 +692,13 @@ void stereo_icBWE_dec_fx( hCPE->hStereoDft->hb_nrg_subr_fx[1] = hb_nrg2_fx; // 2*(Qx + SynthRef_shift) - 31 move32(); hb_nrg_fx = L_add( hb_nrg_fx, hb_nrg2_fx ); +#endif - Copy32( synthRef_fx, hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame ); + Copy32( synthRef_fx, hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame ); +#ifndef FIX_826_PRECISION_LOST_AND_COMPL Scale_sig32( hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame, -5 ); +#endif } ELSE { @@ -681,7 +714,11 @@ void stereo_icBWE_dec_fx( move32(); hCPE->hStereoDft->hb_nrg_subr_fx[1] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[1], shl( hCPE->hStereoDft->NFFT / 2, 6 ) ) ); // 2 * (Qx + SynthRef_shift) - 40 move32(); +#ifndef FIX_826_PRECISION_LOST_AND_COMPL hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 40 ); +#else + hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 45+9 ); +#endif hCPE->hStereoDft->hb_nrg_fx[0] = hb_nrg_fx; // 2 * (Qx + SynthRef_shift) - 31 move32(); hCPE->hStereoDft->td_gain_fx[0] = 0; @@ -759,6 +796,7 @@ void stereo_icBWE_dec_fx( move16(); FOR( i = 0; i < winLen_fx; i++ ) { +#ifndef FIX_826_PRECISION_LOST_AND_COMPL L_tmp = L_mult0( alpha_fx, icbweM2Ref_fx ); // Q15 + Q14 L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), ( hStereoICBWE->icbweM2Ref_prev_fx ) ); // Q15 + Q14; tmp = shl( round_fx( L_tmp ), 1 ); // Q = 15 + 14 - 16 + 1 = Q14 @@ -773,6 +811,20 @@ void stereo_icBWE_dec_fx( { alpha_fx = add( alpha_fx, winSlope_fx ); } +#else + /*synthRef[i] *= ( alpha * ( icbweM2Ref ) + ( 1.0f - alpha ) * ( hStereoICBWE->icbweM2Ref_prev ) );*/ + temp1_fx = sub( 32767, alpha_fx ); + L_tmp = L_mult( alpha_fx, icbweM2Ref_fx ); // Q15 + Q14 + 1 + L_tmp = L_mac( L_tmp, temp1_fx, hStereoICBWE->icbweM2Ref_prev_fx ); // Q15 + Q14 +1 ; + synthRef_fx[i] = L_shl( Mpy_32_32( synthRef_fx[i], L_tmp ), 1 ); + move32(); + /*synth[i] *= ( alpha * ( gsMapping ) + ( 1.0f - alpha ) * ( prevgsMapping ) );*/ + L_tmp = L_mult( alpha_fx, gsMapping_fx ); + L_tmp = L_mac( L_tmp, temp1_fx, prevgsMapping_fx ); + synth_fx[i] = L_shl( Mpy_32_32( synth_fx[i], L_tmp ), 1 ); + move32(); + alpha_fx = add_sat( alpha_fx, winSlope_fx ); +#endif } FOR( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) { @@ -786,7 +838,9 @@ void stereo_icBWE_dec_fx( hStereoICBWE->prevgsMapping_fx = gsMapping_fx; move16(); +#ifndef FIX_826_PRECISION_LOST_AND_COMPL *Q_syn = sub( *Q_syn, 1 ); +#endif } return; @@ -1683,7 +1737,11 @@ void stereo_icBWE_decproc_fx( Word16 core, memOffset, refChanIndx_bwe; Word32 temp0_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )], temp1_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; +#if defined FIX_826_PRECISION_LOST_AND_COMPL + Word16 winSlope_fx = 0, alpha_fx; +#else Word32 winSlope_fx = 0, alpha_fx; +#endif move32(); const Word16 *win_dft_fx; Word32 extl_brate, output_Fs; @@ -1754,7 +1812,11 @@ void stereo_icBWE_decproc_fx( /* stereo to mono downmix */ FOR( i = 0; i < output_frame; i++ ) { +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + outputHB[0][i] = W_extract_h( W_mac_32_16( W_mult_32_16( outputHB[0][i], 16384 ), outputHB[1][i], 16384 ) ); +#else outputHB[0][i] = L_shr( ( outputHB[0][i] + outputHB[1][i] ), 1 ); +#endif move32(); } v_add_32( output[0], outputHB[0], output[0], output_frame ); @@ -1809,6 +1871,20 @@ void stereo_icBWE_decproc_fx( { SWITCH( memOffset ) { +#if defined FIX_826_PRECISION_LOST_AND_COMPL + case 15: + winSlope_fx = 2185; + move32(); + BREAK; + case 30: + winSlope_fx = 1092; + move32(); + BREAK; + case 45: + winSlope_fx = 728; + move32(); + BREAK; +#else case 15: winSlope_fx = 71582792; move32(); @@ -1821,6 +1897,7 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 23860930; move32(); BREAK; +#endif } // memOffset for 16K 32K 48K are 15 30 45 respectively.camera } @@ -1829,11 +1906,20 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 0; move32(); } +#if defined FIX_826_PRECISION_LOST_AND_COMPL + alpha_fx = 0; + move16(); +#endif FOR( i = 0; i < memOffset; i++ ) { +#if defined FIX_826_PRECISION_LOST_AND_COMPL + alpha_fx = add_sat( alpha_fx, winSlope_fx ); + outputHB[refChanIndx_bwe][i] = W_round48_L( W_mult_32_16( outputHB[refChanIndx_bwe][i] /* Q11 + Q15 + 1 - 16 = Q11)*/, winSlope_fx ) ); // +#else Word32 mul_win = Mpy_32_16_1( winSlope_fx, ( i + 1 ) ); // Q30 + Q0 - 15 = Q15 mul_win = L_shl( mul_win, 15 ); // Q30 outputHB[refChanIndx_bwe][i] = L_shl( Mpy_32_32( outputHB[refChanIndx_bwe][i] /* Q11 + Q30 - 31 = Q10)*/, mul_win ), 1 ); // +#endif move32(); } } @@ -1860,6 +1946,24 @@ void stereo_icBWE_decproc_fx( assert( icbweOLASize > 0 ); SWITCH( icbweOLASize ) { +#if defined FIX_826_PRECISION_LOST_AND_COMPL + case 60: + winSlope_fx = 546; + move16(); + BREAK; + case 40: + winSlope_fx = 819; + move16(); + BREAK; + case 20: + winSlope_fx = 1638; + move16(); + BREAK; + default: + fprintf( stderr, "icbweOLASize of size %d not implemented \n", icbweOLASize ); + assert( 0 ); + BREAK; +#else case 60: winSlope_fx = 17895698; move32(); @@ -1872,16 +1976,25 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 53687092; move32(); BREAK; +#endif } alpha_fx = winSlope_fx; // Q30 move32(); FOR( ; i < add( decoderDelay, icbweOLASize ); i++ ) { +#if defined FIX_826_PRECISION_LOST_AND_COMPL + temp0_fx[i] = W_round48_L( W_mult_32_16( temp0_fx[i], alpha_fx ) ); // Q11 + move32(); + temp1_fx[i] = W_round48_L( W_mult_32_16( temp1_fx[i], alpha_fx ) ); + move32(); + alpha_fx = add_sat( alpha_fx, winSlope_fx ); +#else temp0_fx[i] = L_shl_sat( Mpy_32_32( temp0_fx[i], alpha_fx ), 1 ); // Q11 move32(); temp1_fx[i] = L_shl_sat( Mpy_32_32( temp1_fx[i], alpha_fx ), 1 ); move32(); alpha_fx = L_add( alpha_fx, winSlope_fx ); +#endif } } ELSE @@ -1892,6 +2005,20 @@ void stereo_icBWE_decproc_fx( { SWITCH( memOffset ) { +#if defined FIX_826_PRECISION_LOST_AND_COMPL + case 15: + winSlope_fx = 2185; + move16(); + BREAK; + case 30: + winSlope_fx = 1092; + move16(); + BREAK; + case 45: + winSlope_fx = 728; + move16(); + BREAK; +#else case 15: winSlope_fx = 71582792; move32(); @@ -1904,6 +2031,7 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 23860930; // Q30 move32(); BREAK; +#endif } // memOffset for 16K 32K 48K are 15 30 45 respectively.camera } @@ -1912,14 +2040,27 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 0; move32(); } +#if defined FIX_826_PRECISION_LOST_AND_COMPL + Word16 Incr = 0; + Word16 Decr = MAX_16; +#endif + move16(); + move16(); FOR( i = 0; i < memOffset; i++ ) { +#ifndef FIX_826_PRECISION_LOST_AND_COMPL temp0_fx[i] = L_add( L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( i + 1 ) ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i] ), 16 ), L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, 1 - ( i + 1 ) ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i] ), 16 ) ); move32(); temp1_fx[i] = L_add( L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( i + 1 ) ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i] ), 16 ), L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( 1 - ( i + 1 ) ) ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i] ), 16 ) ); +#elif defined FIX_826_PRECISION_LOST_AND_COMPL + Incr = add_sat( Incr, winSlope_fx ); + Decr = sub( Decr, winSlope_fx ); + temp0_fx[i] = W_round48_L( W_mac_32_16( W_mult_32_16( hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i], Incr ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i], Decr ) ); + temp1_fx[i] = W_round48_L( W_mac_32_16( W_mult_32_16( hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i], Incr ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i], Decr ) ); +#endif move32(); } } @@ -1932,14 +2073,25 @@ void stereo_icBWE_decproc_fx( IF( EQ_16( hCPE->nchan_out, 1 ) ) { +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + Word64 W_tmp; +#endif /* stereo to mono downmix */ FOR( i = 0; i < output_frame; i++ ) { +#ifndef FIX_826_PRECISION_LOST_AND_COMPL temp0_fx[i] = L_add( temp0_fx[i], temp1_fx[i] ); move32(); temp0_fx[i] = L_shr( temp0_fx[i], 1 ); move32(); output[0][i] = L_add( output[0][i], temp0_fx[i] ); +#else + W_tmp = W_mult_32_16( output[0][i], 32767 ); + W_tmp = W_mac_32_16( W_tmp, temp0_fx[i], 16384 ); + output[0][i] = W_round48_L( W_mac_32_16( W_tmp, temp1_fx[i], 16384 ) ); + move32(); + +#endif move32(); } } @@ -1960,26 +2112,53 @@ void stereo_icBWE_decproc_fx( move16(); /* Preparing buffers in anticipation of an ACELP to TCX switch */ + +#ifndef FIX_826_PRECISION_LOST_AND_COMPL j = 0; move16(); +#else + j = sub( dftOvlLen, 1 ); +#endif FOR( i = 0; i < memOffset; i++ ) { +#ifndef FIX_826_PRECISION_LOST_AND_COMPL Word16 tmp_mul = mult0( STEREO_DFT32MS_STEP, ( sub( dftOvlLen, add( 1, j ) ) ) ); hStereoICBWE->memTransitionHB_fx[0][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[0][i], win_dft_fx[tmp_mul] ); move32(); hStereoICBWE->memTransitionHB_fx[1][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[1][i], win_dft_fx[tmp_mul] ); move32(); j = add( j, 1 ); +#else + Word16 tmp_mul = i_mult( STEREO_DFT32MS_STEP, j ); + hStereoICBWE->memTransitionHB_fx[0][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[0][i], win_dft_fx[tmp_mul] ); + move32(); + hStereoICBWE->memTransitionHB_fx[1][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[1][i], win_dft_fx[tmp_mul] ); + move32(); + j = sub( j, 1 ); +#endif } +#ifndef FIX_826_PRECISION_LOST_AND_COMPL FOR( i = 0; j < dftOvlLen; i++ ) +#else + FOR( i = 0; i < dftOvlLen; i++ ) +#endif { +#ifndef FIX_826_PRECISION_LOST_AND_COMPL Word16 tmp_mul = mult0( STEREO_DFT32MS_STEP, ( sub( dftOvlLen, add( 1, j ) ) ) ); hStereoICBWE->memTransitionHB_fx[0][memOffset + i] = Mpy_32_16_1( outputHB[0][output_frame - i - 1], win_dft_fx[tmp_mul] ); move32(); hStereoICBWE->memTransitionHB_fx[1][memOffset + i] = Mpy_32_16_1( outputHB[1][output_frame - i - 1], win_dft_fx[tmp_mul] ); move32(); j = add( j, 1 ); +#else + Word16 tmp_mul = i_mult( STEREO_DFT32MS_STEP, j ); + hStereoICBWE->memTransitionHB_fx[0][memOffset + i] = Mpy_32_16_1( outputHB[0][output_frame - i - 1], win_dft_fx[tmp_mul] ); + move32(); + hStereoICBWE->memTransitionHB_fx[1][memOffset + i] = Mpy_32_16_1( outputHB[1][output_frame - i - 1], win_dft_fx[tmp_mul] ); + move32(); + j = sub( j, 1 ); +#endif } } @@ -2034,8 +2213,12 @@ void stereo_icBWE_decproc_fx( test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && GT_32( L_max( hCPE->hStereoDft->td_gain_fx[0], hCPE->hStereoDft->td_gain_fx[1] ), 0 ) ) { +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + Word32 win_in_fx, win_out_fx, tmp_fx; + Word64 W_tmp, W_tmp1; +#else Word32 win_in_fx, win_out_fx, tmp_fx, gain0_fx, gain1_fx; - +#endif win_dft_fx = hCPE->hStereoDft->win32ms_fx; dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; move16(); @@ -2044,6 +2227,31 @@ void stereo_icBWE_decproc_fx( FOR( i = 0; i < dftOvlLen; i++ ) { +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + j = i_mult( STEREO_DFT32MS_STEP, i ); + win_in_fx = L_mult( win_dft_fx[j], win_dft_fx[j] ); /* Q31 */ + win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ + /* hCPE->hStereoDft->q_hb_stefi_sig_fx is always 31 here */ + /* tmp = ( win_in * hCPE->hStereoDft->td_gain[0] + win_out * hCPE->hStereoDft->td_gain[1] ) * hCPE->hStereoDft->hb_stefi_sig[i]; */ + + W_tmp = W_mult_32_32( hCPE->hStereoDft->td_gain_fx[0], win_in_fx ); + if ( hCPE->hStereoDft->q_td_gain[0] != 0 ) + { + W_tmp = W_shl( W_tmp, sub( 31, hCPE->hStereoDft->q_td_gain[0] ) ); + } + W_tmp1 = W_mult_32_32( hCPE->hStereoDft->td_gain_fx[1], win_out_fx ); + if ( hCPE->hStereoDft->q_td_gain[1] != 0 ) + { + W_tmp1 = W_shl( W_tmp1, sub( 31, hCPE->hStereoDft->q_td_gain[1] ) ); + } + tmp_fx = W_extract_h( W_add_nosat( W_tmp, W_tmp1 ) ); + tmp_fx = W_extract_h( W_mult_32_32( tmp_fx, hCPE->hStereoDft->hb_stefi_sig_fx[i] ) ); + + output[0][i] = L_add_sat( output[0][i], tmp_fx ); + move32(); + output[1][i] = L_sub_sat( output[1][i], tmp_fx ); + move32(); +#else win_in_fx = L_mult( win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )], win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )] ); /* Q31 */ win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ @@ -2053,9 +2261,9 @@ void stereo_icBWE_decproc_fx( gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ #else - gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ - gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ - gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ + gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ + gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ + gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ #endif tmp_fx = L_add_sat( gain0_fx, gain1_fx ); /* Q --> q_output */ @@ -2063,13 +2271,18 @@ void stereo_icBWE_decproc_fx( move32(); output[1][i] = L_sub_sat( output[1][i], tmp_fx ); move32(); +#endif } FOR( i = dftOvlLen; i < output_frame; i++ ) { +#ifdef FIX_826_PRECISION_LOST_AND_COMPL + tmp_fx = W_extract_h( W_mult_32_32( hCPE->hStereoDft->td_gain_fx[0], hCPE->hStereoDft->hb_stefi_sig_fx[i] ) ); /* Q11 --> Q11 */ +#else #ifdef FIX_736_BWE_SECT_C tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ #else tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ +#endif #endif output[0][i] = L_add_sat( output[0][i], tmp_fx ); move32(); -- GitLab From 4a6865a888cf19e6fea93dc5e2df112591ba3e47 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 31 Jul 2024 08:44:16 -0400 Subject: [PATCH 2/9] small fixes --- lib_dec/ivas_core_dec.c | 2 +- lib_dec/ivas_stereo_icbwe_dec.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index f5dd31657..141c844c0 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -1361,7 +1361,7 @@ ivas_error ivas_core_dec_fx( tmp_buffer_fx[i] = shl_sat( tmp_buffer_fx[i], 1 ); move16(); #else - tmp_buffer_fx[i] = round_fx_sat( L_mac_sat( L_mult( st->hb_prev_synth_buffer_fx[i], sin_table256_fx[sub( 255, tmp16 )] ), st->hb_prev_synth_buffer_fx[sub( sub( st->old_bwe_delay, 1 ), i )], sin_table256_fx[tmp16] ) ); + tmp_buffer_fx[i] = round_fx_sat( L_mac_sat( L_mult( st->hb_prev_synth_buffer_fx[i], sin_table256_fx[ 255 - tmp16 ] ), st->hb_prev_synth_buffer_fx[sub( sub( st->old_bwe_delay, 1 ), i )], sin_table256_fx[tmp16] ) ); move16(); #endif diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 218fa1b05..358164fba 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -663,7 +663,7 @@ void stereo_icBWE_dec_fx( hb_nrg_fx = W_round48_L( W_tmp ); hCPE->hStereoDft->hb_nrg_subr_fx[0] = hb_nrg_fx; move32(); - hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 45 ); + hStereoDft->q_hb_nrg_subr = sub( shl( add( *Q_syn, synthRef_shift ), 1 ), 45 ); move16(); W_tmp = 0; move64(); @@ -2055,7 +2055,7 @@ void stereo_icBWE_decproc_fx( temp1_fx[i] = L_add( L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( i + 1 ) ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i] ), 16 ), L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( 1 - ( i + 1 ) ) ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i] ), 16 ) ); -#elif defined FIX_826_PRECISION_LOST_AND_COMPL +#else Incr = add_sat( Incr, winSlope_fx ); Decr = sub( Decr, winSlope_fx ); temp0_fx[i] = W_round48_L( W_mac_32_16( W_mult_32_16( hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i], Incr ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i], Decr ) ); -- GitLab From fec71f13d9b7bea08d9eac2c4cd337060ac465af Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 31 Jul 2024 08:48:26 -0400 Subject: [PATCH 3/9] add switch description --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2180b9414..9c45fb1bc 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,7 +161,7 @@ #define FIX_802__NON_BE_DECODING /* Fix possible difference float and fixed point when computing the GSC bit allocation */ #define FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING /* VA: ISSUES 802 and 1137 Made sure that float and fixed point GCS bit allocation is the same during IVAS modes */ #define FIX_810_PREVENT_UNECESSARY_SAT_IN_TC /* VA : Prevent an unnecessary saturation that can happen in TC, have a minimal impact on most cases. Significant improvement for the last segment of LTV when TC is triggered */ -#define FIX_826_PRECISION_LOST_AND_COMPL /// TV +#define FIX_826_PRECISION_LOST_AND_COMPL /* VA : Fix lost of precision that leads to unnecessary high noise floor and to some framing artifacts */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ -- GitLab From f85e8279e6966ea651f1f2c29791bb4f49eefa94 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 31 Jul 2024 09:04:02 -0400 Subject: [PATCH 4/9] fix linux compiler --- lib_com/ivas_prot_fx.h | 5 ++++- lib_dec/ivas_cpe_dec_fx.c | 4 ++++ lib_dec/ivas_stereo_icbwe_dec.c | 13 +++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 8ed4fd451..059f06ce1 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1326,8 +1326,11 @@ void stereo_icBWE_decproc_fx( Word32 outputHB[CPE_CHANNELS][L_FRAME48k], /* i : HB synthesis */ const Word16 last_core, /* i : last core, primary channel */ const Word16 last_bwidth, /* i : last bandwidth */ - const Word16 output_frame, /* i : frame length */ + const Word16 output_frame /* i : frame length */ +#ifndef FIX_826_PRECISION_LOST_AND_COMPL + , Word16 q_output /* i : Q-fac of output */ +#endif ); void add_HB_to_mono_dmx_fx( diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 59969dba2..914b85472 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -848,7 +848,11 @@ ivas_error ivas_cpe_dec_fx( * IC-BWE: output LB and HB mix in ACELP mode *----------------------------------------------------------------*/ +#ifndef FIX_826_PRECISION_LOST_AND_COMPL stereo_icBWE_decproc_fx( hCPE, output, outputHB_fx, last_core, last_bwidth, output_frame, *q_output ); +#else + stereo_icBWE_decproc_fx( hCPE, output, outputHB_fx, last_core, last_bwidth, output_frame); +#endif smooth_dft2td_transition_fx( hCPE, output, output_frame ); diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 358164fba..4ec3222ca 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -578,7 +578,11 @@ void stereo_icBWE_dec_fx( Word16 temp1_fx, temp2_fx; Word16 icbweM2Ref_fx, ratio_L_fx; Word16 gsMapping_fx; +#ifndef FIX_826_PRECISION_LOST_AND_COMPL Word32 hb_nrg_fx, hb_nrg2_fx; +#else + Word32 hb_nrg_fx; +#endif Word16 Q_syn_shb; Word16 shift_prev_pow, synthRef_shift; Word32 L_tmp; @@ -626,7 +630,9 @@ void stereo_icBWE_dec_fx( { hb_nrg_fx = 0; move32(); +#ifndef FIX_826_PRECISION_LOST_AND_COMPL hb_nrg2_fx = 0; +#endif move32(); maximum_abs_32_fx( synthRef_fx, output_frame, &maxVal ); synthRef_shift = norm_l( maxVal ); @@ -1729,8 +1735,11 @@ void stereo_icBWE_decproc_fx( Word32 outputHB[CPE_CHANNELS][L_FRAME48k], /* i : HB synthesis */ const Word16 last_core, /* i : last core, primary channel */ const Word16 last_bwidth, /* i : last bandwidth */ - const Word16 output_frame, /* i : frame length */ - Word16 q_output /* i : Q-fac of output */ + const Word16 output_frame /* i : frame length */ +#ifndef FIX_826_PRECISION_LOST_AND_COMPL + , + Word16 q_output /* i : Q-fac of output */ +#endif ) { Word16 i, j, n, decoderDelay, icbweOLASize, dftOvlLen; -- GitLab From 0310b9148b6e889f8ae7c866b6dde4b412c784c1 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 31 Jul 2024 09:05:09 -0400 Subject: [PATCH 5/9] fix clang-format --- lib_dec/ivas_core_dec.c | 4 +-- lib_dec/ivas_stereo_icbwe_dec.c | 52 ++++++++++++++++----------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 141c844c0..b9aa93ae7 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -1216,7 +1216,7 @@ ivas_error ivas_core_dec_fx( Copy_Scale_sig_16_32( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, ( Q11 + q ) ); } -#ifndef FIX_826_PRECISION_LOST_AND_COMPL +#ifndef FIX_826_PRECISION_LOST_AND_COMPL Copy_Scale_sig_16_32( synth_fxl, synth_32_fx[n], L_FRAME48k, ( Q11 + q ) ); #endif Scale_sig( st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, -( Q8 - st->prev_Q_bwe_syn ) ); @@ -1361,7 +1361,7 @@ ivas_error ivas_core_dec_fx( tmp_buffer_fx[i] = shl_sat( tmp_buffer_fx[i], 1 ); move16(); #else - tmp_buffer_fx[i] = round_fx_sat( L_mac_sat( L_mult( st->hb_prev_synth_buffer_fx[i], sin_table256_fx[ 255 - tmp16 ] ), st->hb_prev_synth_buffer_fx[sub( sub( st->old_bwe_delay, 1 ), i )], sin_table256_fx[tmp16] ) ); + tmp_buffer_fx[i] = round_fx_sat( L_mac_sat( L_mult( st->hb_prev_synth_buffer_fx[i], sin_table256_fx[255 - tmp16] ), st->hb_prev_synth_buffer_fx[sub( sub( st->old_bwe_delay, 1 ), i )], sin_table256_fx[tmp16] ) ); move16(); #endif diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 4ec3222ca..ac51e6130 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -641,7 +641,7 @@ void stereo_icBWE_dec_fx( synthRef_shift = 31; move16(); } -#ifndef FIX_826_PRECISION_LOST_AND_COMPL /* Not needed Q11 is already enough */ +#ifndef FIX_826_PRECISION_LOST_AND_COMPL /* Not needed Q11 is already enough */ synthRef_shift = sub( synthRef_shift, shr( add( find_guarded_bits_fx( output_frame ), 1 ), 1 ) ); #else synthRef_shift = sub( synthRef_shift, shr( add( find_guarded_bits_fx( shr( output_frame, 1 ) ), 1 ), 1 ) ); @@ -653,7 +653,7 @@ void stereo_icBWE_dec_fx( Word64 W_tmp = 0; move64(); tmp = shl_sat( 1, synthRef_shift ); -#endif +#endif FOR( i = 0; i < shr( output_frame, 1 ); i++ ) { // needed to be adjusted for q @@ -661,8 +661,8 @@ void stereo_icBWE_dec_fx( L_tmp = L_shl( synthRef_fx[i], synthRef_shift ); hb_nrg2_fx = L_add( hb_nrg2_fx, Mpy_32_32( L_tmp, L_tmp ) ); // 2*(Qx + SynthRef_shift) - 31 #else - L_tmp = Mpy_32_16_1( synthRef_fx[i], tmp ); - W_tmp = W_mac_32_32(W_tmp, L_tmp, L_tmp ); + L_tmp = Mpy_32_16_1( synthRef_fx[i], tmp ); + W_tmp = W_mac_32_32( W_tmp, L_tmp, L_tmp ); #endif } #ifdef FIX_826_PRECISION_LOST_AND_COMPL @@ -675,8 +675,8 @@ void stereo_icBWE_dec_fx( move64(); FOR( ; i < output_frame; i++ ) { - L_tmp = Mpy_32_16_1( synthRef_fx[i], tmp ); - W_tmp = W_mac_32_32( W_tmp, L_tmp, L_tmp ); + L_tmp = Mpy_32_16_1( synthRef_fx[i], tmp ); + W_tmp = W_mac_32_32( W_tmp, L_tmp, L_tmp ); } hCPE->hStereoDft->hb_nrg_subr_fx[1] = W_round48_L( W_tmp ); // 2*(Qx + SynthRef_shift) - 45 @@ -720,10 +720,10 @@ void stereo_icBWE_dec_fx( move32(); hCPE->hStereoDft->hb_nrg_subr_fx[1] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[1], shl( hCPE->hStereoDft->NFFT / 2, 6 ) ) ); // 2 * (Qx + SynthRef_shift) - 40 move32(); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL +#ifndef FIX_826_PRECISION_LOST_AND_COMPL hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 40 ); #else - hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 45+9 ); + hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 45 + 9 ); #endif hCPE->hStereoDft->hb_nrg_fx[0] = hb_nrg_fx; // 2 * (Qx + SynthRef_shift) - 31 move32(); @@ -820,7 +820,7 @@ void stereo_icBWE_dec_fx( #else /*synthRef[i] *= ( alpha * ( icbweM2Ref ) + ( 1.0f - alpha ) * ( hStereoICBWE->icbweM2Ref_prev ) );*/ temp1_fx = sub( 32767, alpha_fx ); - L_tmp = L_mult( alpha_fx, icbweM2Ref_fx ); // Q15 + Q14 + 1 + L_tmp = L_mult( alpha_fx, icbweM2Ref_fx ); // Q15 + Q14 + 1 L_tmp = L_mac( L_tmp, temp1_fx, hStereoICBWE->icbweM2Ref_prev_fx ); // Q15 + Q14 +1 ; synthRef_fx[i] = L_shl( Mpy_32_32( synthRef_fx[i], L_tmp ), 1 ); move32(); @@ -1386,7 +1386,7 @@ void stereo_icBWE_dec_fx( #ifdef FIX_TMP_714 tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 #else - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 + tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 #endif tmp = mult_r( tmp, gsMapping_fx ); // Q14 tmp = mult_r( tmp, gsMapping_fx ); // Q13 @@ -1746,7 +1746,7 @@ void stereo_icBWE_decproc_fx( Word16 core, memOffset, refChanIndx_bwe; Word32 temp0_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )], temp1_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; -#if defined FIX_826_PRECISION_LOST_AND_COMPL +#if defined FIX_826_PRECISION_LOST_AND_COMPL Word16 winSlope_fx = 0, alpha_fx; #else Word32 winSlope_fx = 0, alpha_fx; @@ -1915,20 +1915,20 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 0; move32(); } -#if defined FIX_826_PRECISION_LOST_AND_COMPL +#if defined FIX_826_PRECISION_LOST_AND_COMPL alpha_fx = 0; move16(); -#endif +#endif FOR( i = 0; i < memOffset; i++ ) { -#if defined FIX_826_PRECISION_LOST_AND_COMPL - alpha_fx = add_sat( alpha_fx, winSlope_fx ); +#if defined FIX_826_PRECISION_LOST_AND_COMPL + alpha_fx = add_sat( alpha_fx, winSlope_fx ); outputHB[refChanIndx_bwe][i] = W_round48_L( W_mult_32_16( outputHB[refChanIndx_bwe][i] /* Q11 + Q15 + 1 - 16 = Q11)*/, winSlope_fx ) ); // #else Word32 mul_win = Mpy_32_16_1( winSlope_fx, ( i + 1 ) ); // Q30 + Q0 - 15 = Q15 mul_win = L_shl( mul_win, 15 ); // Q30 outputHB[refChanIndx_bwe][i] = L_shl( Mpy_32_32( outputHB[refChanIndx_bwe][i] /* Q11 + Q30 - 31 = Q10)*/, mul_win ), 1 ); // -#endif +#endif move32(); } } @@ -1955,7 +1955,7 @@ void stereo_icBWE_decproc_fx( assert( icbweOLASize > 0 ); SWITCH( icbweOLASize ) { -#if defined FIX_826_PRECISION_LOST_AND_COMPL +#if defined FIX_826_PRECISION_LOST_AND_COMPL case 60: winSlope_fx = 546; move16(); @@ -1991,10 +1991,10 @@ void stereo_icBWE_decproc_fx( move32(); FOR( ; i < add( decoderDelay, icbweOLASize ); i++ ) { -#if defined FIX_826_PRECISION_LOST_AND_COMPL +#if defined FIX_826_PRECISION_LOST_AND_COMPL temp0_fx[i] = W_round48_L( W_mult_32_16( temp0_fx[i], alpha_fx ) ); // Q11 move32(); - temp1_fx[i] = W_round48_L( W_mult_32_16( temp1_fx[i], alpha_fx ) ); + temp1_fx[i] = W_round48_L( W_mult_32_16( temp1_fx[i], alpha_fx ) ); move32(); alpha_fx = add_sat( alpha_fx, winSlope_fx ); #else @@ -2049,7 +2049,7 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 0; move32(); } -#if defined FIX_826_PRECISION_LOST_AND_COMPL +#if defined FIX_826_PRECISION_LOST_AND_COMPL Word16 Incr = 0; Word16 Decr = MAX_16; #endif @@ -2084,7 +2084,7 @@ void stereo_icBWE_decproc_fx( { #ifdef FIX_826_PRECISION_LOST_AND_COMPL Word64 W_tmp; -#endif +#endif /* stereo to mono downmix */ FOR( i = 0; i < output_frame; i++ ) { @@ -2239,10 +2239,10 @@ void stereo_icBWE_decproc_fx( #ifdef FIX_826_PRECISION_LOST_AND_COMPL j = i_mult( STEREO_DFT32MS_STEP, i ); win_in_fx = L_mult( win_dft_fx[j], win_dft_fx[j] ); /* Q31 */ - win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ + win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ /* hCPE->hStereoDft->q_hb_stefi_sig_fx is always 31 here */ /* tmp = ( win_in * hCPE->hStereoDft->td_gain[0] + win_out * hCPE->hStereoDft->td_gain[1] ) * hCPE->hStereoDft->hb_stefi_sig[i]; */ - + W_tmp = W_mult_32_32( hCPE->hStereoDft->td_gain_fx[0], win_in_fx ); if ( hCPE->hStereoDft->q_td_gain[0] != 0 ) { @@ -2270,9 +2270,9 @@ void stereo_icBWE_decproc_fx( gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ #else - gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ - gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ - gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ + gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ + gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ + gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ #endif tmp_fx = L_add_sat( gain0_fx, gain1_fx ); /* Q --> q_output */ -- GitLab From 7baf20ee5370227028b295f8317ff232eeb319d4 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 31 Jul 2024 09:14:18 -0400 Subject: [PATCH 6/9] fix another linux compiler issue --- lib_com/ivas_prot_fx.h | 1 + lib_dec/ivas_cpe_dec_fx.c | 7 +++++-- lib_dec/ivas_jbm_dec.c | 28 ++++++++++++++++++++++++++++ lib_dec/ivas_mct_dec.c | 5 ++++- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 059f06ce1..5ba09a75e 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2572,3 +2572,4 @@ void ivas_spar_bitrate_dist_fx( const Word16 sba_order, /* i : Ambisonic (SBA) order */ const Word16 bwidth /* i : audio bandwidth */ ); + \ No newline at end of file diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 914b85472..a666b1fd3 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -66,8 +66,11 @@ ivas_error ivas_cpe_dec_fx( const Word16 cpe_id, /* i : CPE # identifier */ Word32 *output[CPE_CHANNELS], /* o : output synthesis signal */ const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nb_bits_metadata, /* i : number of metadata bits */ - Word16 *q_output /* i/o : Q of output synthesis signal */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ +#ifndef FIX_826_PRECISION_LOST_AND_COMPL + , + Word16 *q_output /* i/o : Q of output synthesis signal */ +#endif ) { Word16 i, n, n_channels; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 42605102d..a7d657a1d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -175,7 +175,11 @@ ivas_error ivas_jbm_dec_tc_fx( set32_fx( &p_output_fx[0][0], 0, L_FRAME48k ); set32_fx( &p_output_fx[1][0], 0, L_FRAME48k ); +#ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, 0, &q_output ) ) != IVAS_ERR_OK ) +#else + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, 0) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -338,7 +342,11 @@ ivas_error ivas_jbm_dec_tc_fx( set32_fx( &p_output_fx[0][0], 0, L_FRAME48k ); set32_fx( &p_output_fx[1][0], 0, L_FRAME48k ); +#ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) +#else + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0]) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -719,7 +727,11 @@ ivas_error ivas_jbm_dec_tc_fx( } /* decode MASA channels */ +#ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, p_output_fx, output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) +#else + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, p_output_fx, output_frame, nb_bits_metadata[0]) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -823,7 +835,11 @@ ivas_error ivas_jbm_dec_tc_fx( ELSE IF( EQ_16( st_ivas->nCPE, 1 ) ) { +#ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] + nb_bits_metadata[1], &q_output ) ) != IVAS_ERR_OK ) +#else + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] + nb_bits_metadata[1] ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1142,7 +1158,11 @@ ivas_error ivas_jbm_dec_tc_fx( { Word16 q_output = 11; +#ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) +#else + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1202,7 +1222,11 @@ ivas_error ivas_jbm_dec_tc_fx( /* Decode the transport audio signals */ Word16 q_output = 11; +#ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) +#else + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -1252,7 +1276,11 @@ ivas_error ivas_jbm_dec_tc_fx( ELSE IF( EQ_16( st_ivas->nCPE, 1 ) ) { +#ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) +#else + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 34ab57de5..5f8acae6e 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -363,8 +363,11 @@ ivas_error ivas_mct_dec_fx( set32_fx( &output_fx[0][0], 0, L_FRAME48k ); set32_fx( &output_fx[1][0], 0, L_FRAME48k ); - +#ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, cpe_id, &output_fx[0], output_frame, 0, &q_output ) ), IVAS_ERR_OK ) ) +#else + IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, cpe_id, &output_fx[0], output_frame, 0) ), IVAS_ERR_OK ) ) +#endif { return error; } -- GitLab From 9f21284fba9edeaa1b32ebebb7366111229724e2 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 31 Jul 2024 09:35:23 -0400 Subject: [PATCH 7/9] fix lock issue --- lib_com/ivas_prot_fx.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 5ba09a75e..d418c69b4 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -780,8 +780,11 @@ ivas_error ivas_cpe_dec_fx( const Word16 cpe_id, /* i : CPE # identifier */ Word32 *output[CPE_CHANNELS], /* o : output synthesis signal */ const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nb_bits_metadata, /* i : number of metadata bits */ - Word16 *q_output /* i/o : Q of output synthesis signal */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ +#ifndef FIX_826_PRECISION_LOST_AND_COMPL + , + Word16 *q_output /* i/o : Q of output synthesis signal */ +#endif ); void ivas_post_proc_fx( @@ -2572,4 +2575,4 @@ void ivas_spar_bitrate_dist_fx( const Word16 sba_order, /* i : Ambisonic (SBA) order */ const Word16 bwidth /* i : audio bandwidth */ ); - \ No newline at end of file + -- GitLab From f918a702c0c63e5d6c6c8a2743ee802a0c1a3e53 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 31 Jul 2024 09:37:55 -0400 Subject: [PATCH 8/9] fix clang-format --- lib_com/ivas_prot_fx.h | 17 ++++++++--------- lib_dec/ivas_cpe_dec_fx.c | 12 ++++++------ lib_dec/ivas_jbm_dec.c | 6 +++--- lib_dec/ivas_mct_dec.c | 2 +- lib_dec/ivas_stereo_icbwe_dec.c | 4 ++-- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index d418c69b4..8af2698fc 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -776,14 +776,14 @@ void destroy_cpe_dec( ); ivas_error ivas_cpe_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 cpe_id, /* i : CPE # identifier */ - Word32 *output[CPE_CHANNELS], /* o : output synthesis signal */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 cpe_id, /* i : CPE # identifier */ + Word32 *output[CPE_CHANNELS], /* o : output synthesis signal */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ #ifndef FIX_826_PRECISION_LOST_AND_COMPL - , - Word16 *q_output /* i/o : Q of output synthesis signal */ + , + Word16 *q_output /* i/o : Q of output synthesis signal */ #endif ); @@ -1332,7 +1332,7 @@ void stereo_icBWE_decproc_fx( const Word16 output_frame /* i : frame length */ #ifndef FIX_826_PRECISION_LOST_AND_COMPL , - Word16 q_output /* i : Q-fac of output */ + Word16 q_output /* i : Q-fac of output */ #endif ); @@ -2575,4 +2575,3 @@ void ivas_spar_bitrate_dist_fx( const Word16 sba_order, /* i : Ambisonic (SBA) order */ const Word16 bwidth /* i : audio bandwidth */ ); - diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index a666b1fd3..ae3f9ee2b 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -62,11 +62,11 @@ static void stereo_mode_combined_format_dec_fx( const Decoder_Struct *st_ivas, C *--------------------------------------------------------------------------*/ ivas_error ivas_cpe_dec_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const Word16 cpe_id, /* i : CPE # identifier */ - Word32 *output[CPE_CHANNELS], /* o : output synthesis signal */ - const Word16 output_frame, /* i : output frame length per channel */ - const Word16 nb_bits_metadata /* i : number of metadata bits */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 cpe_id, /* i : CPE # identifier */ + Word32 *output[CPE_CHANNELS], /* o : output synthesis signal */ + const Word16 output_frame, /* i : output frame length per channel */ + const Word16 nb_bits_metadata /* i : number of metadata bits */ #ifndef FIX_826_PRECISION_LOST_AND_COMPL , Word16 *q_output /* i/o : Q of output synthesis signal */ @@ -854,7 +854,7 @@ ivas_error ivas_cpe_dec_fx( #ifndef FIX_826_PRECISION_LOST_AND_COMPL stereo_icBWE_decproc_fx( hCPE, output, outputHB_fx, last_core, last_bwidth, output_frame, *q_output ); #else - stereo_icBWE_decproc_fx( hCPE, output, outputHB_fx, last_core, last_bwidth, output_frame); + stereo_icBWE_decproc_fx( hCPE, output, outputHB_fx, last_core, last_bwidth, output_frame ); #endif smooth_dft2td_transition_fx( hCPE, output, output_frame ); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index a7d657a1d..e242907c8 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -178,7 +178,7 @@ ivas_error ivas_jbm_dec_tc_fx( #ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, 0, &q_output ) ) != IVAS_ERR_OK ) #else - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, 0) ) != IVAS_ERR_OK ) + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, 0 ) ) != IVAS_ERR_OK ) #endif { return error; @@ -345,7 +345,7 @@ ivas_error ivas_jbm_dec_tc_fx( #ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) #else - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0]) ) != IVAS_ERR_OK ) + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) #endif { return error; @@ -730,7 +730,7 @@ ivas_error ivas_jbm_dec_tc_fx( #ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, p_output_fx, output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) #else - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, p_output_fx, output_frame, nb_bits_metadata[0]) ) != IVAS_ERR_OK ) + IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, p_output_fx, output_frame, nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) #endif { return error; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 5f8acae6e..ff46590d1 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -366,7 +366,7 @@ ivas_error ivas_mct_dec_fx( #ifndef FIX_826_PRECISION_LOST_AND_COMPL IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, cpe_id, &output_fx[0], output_frame, 0, &q_output ) ), IVAS_ERR_OK ) ) #else - IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, cpe_id, &output_fx[0], output_frame, 0) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, cpe_id, &output_fx[0], output_frame, 0 ) ), IVAS_ERR_OK ) ) #endif { return error; diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index ac51e6130..88f52c3e5 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -630,7 +630,7 @@ void stereo_icBWE_dec_fx( { hb_nrg_fx = 0; move32(); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL +#ifndef FIX_826_PRECISION_LOST_AND_COMPL hb_nrg2_fx = 0; #endif move32(); @@ -1738,7 +1738,7 @@ void stereo_icBWE_decproc_fx( const Word16 output_frame /* i : frame length */ #ifndef FIX_826_PRECISION_LOST_AND_COMPL , - Word16 q_output /* i : Q-fac of output */ + Word16 q_output /* i : Q-fac of output */ #endif ) { -- GitLab From 9857f9b1181054a504cbf25e9b2fec51c4212869 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Wed, 31 Jul 2024 11:05:18 -0400 Subject: [PATCH 9/9] fix 16 kHz output --- lib_dec/ivas_stereo_icbwe_dec.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 88f52c3e5..d5acccc7a 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -844,9 +844,7 @@ void stereo_icBWE_dec_fx( hStereoICBWE->prevgsMapping_fx = gsMapping_fx; move16(); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL *Q_syn = sub( *Q_syn, 1 ); -#endif } return; -- GitLab