Skip to content

Possible crash in stereo bitrate switching

with b96b632d and this bitstream :

P7c1a-dtx_-stereo_sw_13k2_to_128k_10fr.bin_48.bit.zip

Command line: STEREO 32 bit syn

A crash can happen when decoding a secondary channel unvoiced frame of the td-stereo.

   stepSize = shl( sub( topBound, lowBound ), sub( 14, bits ) ); /* Q14 */    <<<<<

    /*------------------------------------------------------------------------------------------*
     * Gaussian codebook gain
     *------------------------------------------------------------------------------------------*/

    /* enr_q = (float)index*stepSize ,lowBound); */
    L_enr_q = L_mult( index, stepSize );                             /* Q0 * Q14 -> Q15 */
    L_enr_q = L_shl( L_enr_q, 9 );                                   /* Q15 -> Q24 */
    L_enr_q = L_add( L_enr_q, L_shl( L_deposit_h( lowBound ), 8 ) ); /* Q24 */

The EVS gain decoder has been developed with using always 7 bits, while in IVAS we are using sometimes 6 bits. When 6 bits is used, the stepSize saturates (crashed). If we force the saturation, it will cause an artefact in the synthesis.