Skip to content

Buggy stereo to FOA in JBM

When decoding stereo format to FOA output config. in JBM, the audio is buggy. The issue is that wrong samples are subject to the processing at https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/blob/main/lib_dec/ivas_jbm_dec.c#L971 in case that some samples were already renderer in the previous call of the renderer (i.e. st_ivas->hTcBuffer->n_samples_rendered > 0).

The fix consists of the following (https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/blob/main/lib_dec/ivas_jbm_dec.c#L971):

    for ( n = 0; n < *nSamplesRendered; n++ )
    {
        float tmp;
#ifdef FIX
        tmp = p_tc[0][n];
        p_output[0][n] = 0.5f * ( tmp + p_tc[1][n] ); /* W = 0.5 * ( L + R ) */
        p_output[1][n] = 0.5f * ( tmp - p_tc[1][n] ); /* Y = 0.5 * ( L - R ) */
#else
        tmp = p_output[0][n];
        p_output[0][n] = 0.5f * ( tmp + p_output[1][n] ); /* W = 0.5 * ( L + R ) */
        p_output[1][n] = 0.5f * ( tmp - p_output[1][n] ); /* Y = 0.5 * ( L - R ) */
#endif
    }

Note: the related code was introduced in !2346 (merged).

Edited by vaclav