Skip to content

TBE FB bits not read when decoder output sampling rate is not 48 kHz

For the FB extension of the ACELP TBE (which, in IVAS, is only enabled for 32 kbps Unified Stereo) an additional parameter i is written. At the decoder this parameter is read inside the function fb_tbe_dec():

if ( st->codec_mode == MODE2 )
{
    i = hBWE_TD->idxGain;
}
else
{
    i = get_next_indice( st, 4 );
}

However, this reading of the parameter only happens if the output sampling rate at the decoder is 48 kHz. If the output sampling rate is smaller than 48 kHz the whole function call of fb_tbe_dec() is skipped and the written parameter therefore never read:

if ( st->extl == FB_TBE && output_frame == L_FRAME48k )
{
   fb_tbe_dec( st, fb_exc, hb_synth, NULL );
}

While this doesn't seem to lead to any crashes, it causes wrong reading of the bits belonging to IC-BWE which are next in the bitstream. This, in turn, leads to broken IC-BWE processing (wrong panning, energies etc.).

The issue can be reproduced with the following commandlines (coding any (speech) item that triggers ACELP TBE and has actual FB content above 16 kHz):

IVAS_cod -stereo 32000 48 in.48k.pcm bit
IVAS_dec stereo 32 bit out.32k.pcm

As a side note: This same issue also exists for EVS mono (if codec_mode is MODE1, e.g. 32 kbps). Here, it doesn’t seem to have any effect on the output – at least not that I could find. The fact that the 4 bits of this parameter are never read doesn’t cause any crashes and the output is bit-exact to a fixed version where the bits are read in such a scenario. My assumption is that for EVS mono with ACELP and TBE these bits are the very last ones in the bitstream of a frame and the leftover bits are somehow thrown away.

Even so, having this write-read mismatch between encoder and decoder seems like a potentially dangerous issue and providing a fix to avoid it might be the safer option also for EVS mono.