Mismatch of coder_type between TD stereo encoder and decoder
In rare cases within the TD stereo coder, the coder_type
parameter in the primary channel of the TD stereo encoder may differ from the coder_type
in the TD stereo decoder. Since the coder_type
is crucial for bit allocation between the primary and secondary channels, this mismatch can cause incorrect decoding of the bitstream, resulting in artifacts in the synthesis signal, as demonstrated in the plot below:
This issue can be reproduced using the following commands:
./IVAS_cod -dtx -stereo sw_13k2_to_128k_10fr.bin 48 p800-2-c1d_short.wav bit
./IVAS_dec STEREO 48 bit syn
In the problematic frame 1191, the tdm_bit_alloc()
function should be called with identical parameters in both the TD stereo encoder and decoder:
tdm_bit_alloc( ivas_format, ism_mode, hCPE->element_brate - nb_bits_metadata * FRAMES_PER_SEC + hCPE->brate_surplus,
hStereoTD->tdm_lp_reuse_flag, &( sts[0]->total_brate ), &( sts[1]->total_brate ),
&( hStereoTD->tdm_low_rate_mode ), sts[1]->coder_type, tdm_ratio_bit_alloc_idx, hStereoTD->tdm_Pitch_reuse_flag,
sts[0]->bwidth, sts[1]->bwidth, sts[0]->flag_ACELP16k, hStereoTD->tdm_LRTD_flag, mod_ct, hStereoTD->tdm_inst_ratio_idx );
However, in the TD stereo encoder, the mod_ct
parameter (derived from coder_type
) has a value of 5 (AUDIO), while in the decoder, it has a value of 4 (TRANSITION). This results in a difference in st->core_brate
(7500 in the encoder vs. 8650 in the decoder), leading to incorrect decoding and artifacts in the synthesis signal.