Possible wrong usage of Copy_Scale_sig_16_32
Basic info
- Fixed point:
- Encoder (fixed): 0ca1f14f
Bug description
While debugging, I stubbled across a few places where Copy_Scale_sig_16_32 is used to perform a 16 bits left shift
but inside Copy_Scale_sig_16_32() , when exp > 0, it does the following which that works for all exp <= 15, but it can't handle the case where exp == 16: (This date from EVS time (or even earlier) when L_shl was costlier than L_mult)
tmp = shl_o(1, exp0, &Overflow);
FOR(i = 0; i < lg; i++)
{
y[i] = L_mult0(x[i], tmp);
move32(); /* saturation can occur here */
}
All cases using Copy_Scale_sig_16_32 should be check and change to Copy_Scale_sig_16_32_no_sat() and/or the following operations/comments should be corrected (because if you used Copy_Scale_sig_16_32 with exp == 16, you are not getting Q31, Q30 after the operation).
I found at least cases in (maybe I overlook some_:
- ivas_stereo_icbwe_enc.c
- ivas_core_enc.c
- acelp_core_enc.c
- ivas_stereo_dft_dec_fx.c
- FEC_HQ_phase_ecu_fx.c