Skip to content

Mismatch of st->old_lsp[] between TCX encoder and decoder after switching from MDCT stereo to DFT stereo

In the TCX decoder, the st->old_lsp[] buffer, which contains the previous frame's LSP coefficients, diverges from the corresponding buffer in the TCX encoder. This occurs due to the following update applied to st->lsp_old[] in the init_acelp() function around line 652:

else if ( st->L_frame != L_frame_old ) /* Rate switching involving TCX-only modes */
{
    ...
    /* unquantized LPC */
    mvr2r( st->lsp_old1, st->lspold_enc, M ); /* lsp old @12.8kHz */
    if ( st->L_frame == L_FRAME16k )
    {
        lsp_convert_poly( st->lspold_enc, st->L_frame, 0 );
    }
    mvr2r( st->lspold_enc, st->lsp_old, M ); /* use unquantized values for mid-LSF Q */
    lsp2lsf( st->lsp_old, st->lsf_old, M, st->sr_core );
}

This update is triggered by the function call chain: pre_proc_ivas()SetModeIndex()core_coder_mode_switch()init_coder_acelp_plus()init_acelp().

You can reproduce this issue 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

p800-2-c1d_short

The st->lsp_old[] mismatch can be observed, for example, in frame 110 by breaking at the function calls lsf_mid_enc() and lsf_mid_dec():

index ENC DEC
0 0.997636139 0.998510301
1 0.983784318 0.995159566
2 0.920961082 0.931735814
3 0.876956403 0.889710605
4 0.763475955 0.761608839
5 0.676072538 0.610322177
6 0.532760620 0.424051106
7 0.330092698 0.182524323
8 0.0108799851 -0.0353682600
... ... ...

The st->old_lsp[] discrepancy affects the LP filter Aq[] and ultimately the synthesis signal output. However, the exact impact of this mismatch remains unclear as it was discovered during the investigation of issues #1204 (closed) and #1205 (closed).