Missing parameter update in speech/music classifier
The parameter `lowrate_pitchGain` which is part of the speech / music classifier handle `st_fx->hSpMusClas` is not updated in IVAS ACELP core, GC coder type. In FLP, there is in the function `encod_gen_voic()` the following code: ``` /* update long-term pitch gain for speech/music classifier */ st->hSpMusClas->lowrate_pitchGain = 0.9f * st->hSpMusClas->lowrate_pitchGain + 0.1f * gain_pit; ``` In BASOP, there is in the EVS function `encod_gen_voic_fx()` the following counterpart. ``` /*st_fx->lowrate_pitchGain = 0.9f * st_fx->lowrate_pitchGain + 0.1f * gain_pit_fx;*/ hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit_fx ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/ ``` However, **this code is missing in the IVAS function** `encod_gen_voic_ivas_fx()`. Note: I observed this issue when working on !2685, see https://forge.3gpp.org/rep/sa4/audio/ivas-basop/-/blob/basop-2304-remove-duplicated-code-in-core-encoder-acelp-excitation-coding/lib_enc/enc_gen_voic_fx.c#L688. --- Another observation is that this parameter is not updated consistently: different operations are used at different places, namely: ``` hSpMusClas->lowrate_pitchGain = mac_r_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 3277, gain_pit ); /* Q14*Q16(0.1) + Q15 -> Q15 Q14*Q15 + Q14 -> Q14 lowrate_pitchGain is compared to Q14 in sp_music_classif */ ``` ``` hSpMusClas->lowrate_pitchGain = round_fx_sat( L_mac_sat( L_mult( 29491, hSpMusClas->lowrate_pitchGain ), 6554, gain_pit ) ); /*Q14*Q16(0.1) + Q15 -> Q15*/ ``` ``` #ifdef FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE st->hSpMusClas->lowrate_pitchGain = mac_r( L_mult( 29491, st->hSpMusClas->lowrate_pitchGain ), 3277 /*Q15*/, gain_pit ); // Q14 #else st->hSpMusClas->lowrate_pitchGain = add( mult( 29491, st->hSpMusClas->lowrate_pitchGain ), mult( 3277 /*Q15*/, gain_pit ) ); // Q14 #endif ``` I am tagging here @vaillancour as the author of `FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE` for a possible comment. <!--- 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