Commit 07ad5d7b authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '3gpp_issue_1135_fix' into 'main'

Fix for 3GPP issue 1135: downmixing difference between float and fixed-point (DFT - stereo)

See merge request !1009
parents ef60dcf0 a01edd01
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@
#define FIX_ISSUE_1122                          /* Ittiam: Fix issue 1122: corrected incorrect scaling of a buffer leading to incorrect metadata bits */
#define FIX_1132_STACK_CORRUPTION               /* Stack corruption issue due of extending index access*/
#define FIX_ISSUE_1092                          /* Ittiam: Fix for Issue 1092: BASOP asserts in stereo fx encoder for selection test inputs*/
#define FIX_ISSUE_1135                          /* Ittiam: Fix for Issue 1135: downmixing difference between float and fixed-point (DFT - stereo) */
#define FIX_ISSUE_1148
#define FIX_ISSUE_1147                          /* Ittiam: Fix for issue 1147: Added saturation in DetectTnsFilt_fx.*/
#define FIX_ISSUE_1150                          /* Ittiam: Fix for Issue 1150: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from tcx_ltp_find_gain function*/
+13 −0
Original line number Diff line number Diff line
@@ -833,7 +833,20 @@ ivas_error ivas_cpe_enc_fx(
        move16();
        move16();
        stereo_dft_enc_synthesize_fx( hCPE->hStereoDft, sts[0]->input32_fx, &out_start_ind, &out_end_ind, 0, input_Fs, input_Fs, 0, NULL );

#ifdef FIX_ISSUE_1135
        Word16 common_q = s_min( sub( sts[0]->q_inp, 1 ), sts[0]->q_old_inp ); /* -1 from target Q-factor sts[0]->q_inp to avoid some saturations (issue 1135) */
        Word16 fir_delay_len = NS2SA( sts[0]->input_Fs, DELAY_FIR_RESAMPL_NS );
        Scale_sig( sts[0]->old_input_signal_fx, input_frame, sub( common_q, sts[0]->q_old_inp ) );                                                                        // q_old_inp -> common_q
        Copy_Scale_sig32_16( sts[0]->input32_fx + out_start_ind, sts[0]->input_fx + out_start_ind, sub( out_end_ind, out_start_ind ), sub( add( Q16, common_q ), Q15 ) ); // Q15 -> common_q
        Scale_sig( sts[0]->input_fx + out_end_ind, add( sub( input_frame, out_end_ind ), fir_delay_len ), sub( common_q, sts[0]->q_inp ) );                               // q_inp -> common_q
        sts[0]->q_inp = common_q;
        move16();
        sts[0]->q_old_inp = common_q;
        move16();
#else
        Copy_Scale_sig32_16( sts[0]->input32_fx + out_start_ind, sts[0]->input_fx + out_start_ind, sub( out_end_ind, out_start_ind ), sub( add( Q16, sts[0]->q_inp ), Q15 ) ); // Q15
#endif

        /* iDFT & resampling to 12.8kHz internal sampling rate */
        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 );