TD stereo: Quantization of LSFs in Secondary Channel
This is a follow-up of #1299 (comment 67917).
The logic to select the TD stereo Secondary Channel (SCh) LSFs intra-frame prediction ("beta" index) quantizer is not robust to frame loss.
The logic depends on the value of the parameter active_cnt:
- encoder: https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/blob/main/lib_enc/acelp_core_enc.c#L420
- decoder: https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/blob/main/lib_dec/acelp_core_dec.c#L658
The parameter value can become desynchronized between the encoder and the decoder in the case of frame erasures. E.g., in a sequence when TD stereo frames follow SID/NO_DATA frames, and the first TD stereo frame is lost, the parameter active_cntbecomes different between the encoder and decoder. Consequently, the beta-index might not be read while it was written. Then, the bitstream reading is buggy from this point and propagates to all subsequent ACELP modules. Finally, the synthesis is garbage.
A fix - that ensures that the parameter active_cnt is always synchronized between the encoder and the decoder - is needed.