Bug with TD-ITD shift in pre_proc_front_ivas_fx() produces delayed input to core compared to float
# Basic info <!--- Add commit SHA used to reproduce --> - Float reference: - Encoder (float):53594392095aa5d3b5ad748c4a092634216338e2 - Decoder (float):53594392095aa5d3b5ad748c4a092634216338e2 - Fixed point: - Encoder (fixed):7dad9ef38ab24ba9ee8492be7c2a2e5f21f9cb00 - Decoder (fixed): # Bug description While debugging a +10dB input item with high MLD, it was noticed that for some segments the difference between the two signals was very high. Some example snapshots of the **difference** signal float-BASOP are shown below: ![Screenshot_2025-04-07_at_12.40.44](/uploads/fb823cceaa05b582185d388f8973bbee/Screenshot_2025-04-07_at_12.40.44.png) ![Screenshot_2025-04-07_at_12.41.26](/uploads/d59f1848ee8dbf456d6aa73baa85a640/Screenshot_2025-04-07_at_12.41.26.png) After debugging the frames where this large difference is noticed, I found that the lag of the left channel input signal, that was shifted with the TD-ITD functionality to be aligned with the right, was re-introduced due to the following code at the beginning of function `pre_proc_front_ivas_fx()`: ```c Word16 Q_min = add( sub( 15, st->exp_old_inp_12k8 ), norm_arr( st->old_inp_12k8_fx, L_INP_MEM ) ); Word16 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( -1, 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(); ``` As an example for frame 847, the `st->input` with the `st->input_fx` before applying the copy-scale of `st->input32_fx` and after applying it is shown in the plot below: ![td_itd_error](/uploads/65e591e34d21b0619975d935497d335c/td_itd_error.png) As can be seen from the plot, after applying the copy-scale the lag of the left channel is re-introduced. Additionally, it can be seen that the extrapolation for the shifting of the channel does not seem to be the same, which also needs to be investigated. Disabling the update of the input channel as above it is confirmed that the large differences are gone: ![Screenshot_2025-04-07_at_18.31.28](/uploads/6b20a810180f8bf51fcf579a58f6630f/Screenshot_2025-04-07_at_18.31.28.png) ![Screenshot_2025-04-07_at_18.32.08](/uploads/bebf444e042eb5280d7b899b83f60d43/Screenshot_2025-04-07_at_18.32.08.png) This may not only affect MDCT stereo with ITD operation modes, but also DFT and consequently unified stereo modes. # Ways to reproduce Box folder: ...\Box_EXTERNAL_IVAS_BASOP_VERIFICATION\issues\issue-1463 <!-- Commandline or script --> ```bash ./IVAS_cod -stereo -max_band SWB 48000 32 stereo-noisy_speech-p800-1-cat5-lab_d-20ms_aligned_files_concatenated_32.10dB.wav bit.192 ./IVAS_dec stereo 32 bit.192 stereo-noisy_speech-p800-1-cat5-lab_d-20ms_aligned_files_concatenated_32.10dB.dec.wav ``` <!--- Below are labels that will be added but are not shown in description. This is a template to help fill them. Add further information to the first row and remove and add labels as necessary. -->
issue