Minimum pitch calculation issue in GSC fixed point encoder
Basic info
- Float reference:
- Encoder (float):
- Decoder (float):
- Fixed point:
- Encoder (fixed): 43ca007c
- Decoder (fixed):
Bug description
In a specific configuration of the GSC codec, the encoder and decoder can become desynchronized due to incorrect minimum pitch calculation. This issue occurs when the number of subframes is set to 2 and the core bitrate is below 9.6 kbps.
The fixed-point encoder incorrectly determines the minimum pitch by checking only the first two pitch values instead of the entire pitch vector. For two subframes, the pitch vector follows the pattern: P1, P1, P2, P2. By considering only the first two values, the encoder may select an incorrect minimum pitch. The floating-point encoder and decoder as well as the fixed point decoder correctly analyze the full vector. This discrepancy can lead to mismatched bit allocation and, ultimately to a BER or an undefined behaviour.
A simple fix is to check all the pitch vector on the encoder.
Note: EVS uses the same approach, but the configuration where this could cause an issue (nb_subfr == 2) is not used at low bitrate. For nb_subfr == 1 or nb_subfr == 4, the different search method does not lead to a different result.
Ways to reproduce
Box folder: ...\Box_EXTERNAL_IVAS_BASOP_VERIFICATION\issues\issue-1115
Issue happens at frame 433 with the following command line:
ivas_cod_fx -no_delay_cmp -sba 2 13200 48 am5ba1s14_HOA2_48_-16.wav am5ba1s14_HOA2_48_-16_13200_CTX_dut.g192.fx
ivas_dec_flt -no_delay_cmp BINAURAL 48 am5ba1s14_HOA2_48_-16_13200_CTX_dut.g192.flt syn.fx.flt.wav