Skip to content

unified stereo dtx with limited bandwidth

For unified stereo with dtx the SID encoding is not correct If the bandwidth detection is limiting the bandwidth of the encoding.

Example command lines: IVAS_cod -stereo -dtx 24400 32 Car32mono_WB.wav bit IVAS_dec stereo 32 bit Car32mono_WB_24400_dtx.wav

In this case the function stereo_dft_cng_side_gain on line 568 in ivas_cpe_enc is correctly calculating the side gain parameter for 5 bands instead of 6 due to the limitation in input signal bandwidth. The next function on line 573 stereo_dft_enc_update is called with sts[0]->max_bwidth as the input bandwidth parameter which results in that the number of bands is set to 6 as if the bandwidth was not limited.

In function stereo_dft_enc_write_BS on line 595 in ivas_cpe_enc the function stereo_dft_band_config on line 2180 in stereo_dft_enc_write_BS is not run when the frame is a SID frame which means that nbands will still be 6 later in the function and that will result in that 6 bands of side gain and coherence will be put in the bitstream. The code will not crash since the vectors used for side gain and coherence are allocated for the full resolution used in active frames. In the decoder the decoding will however be done correctly using 5 bands. This leads to that the bitstream is misinterpreted and incorrect values are used for the stereo parameters. In the example file the source is a file with the same signal in both left and right channel which gives a narrow stereo image (coherence ideally = 1 for all bands). Before the bandwidth detection has detected the limited bandwidth the CNG sounds ok but in frame 431 (8.62 s) the first inactive period with the limited (WB) bandwidth starts. The decoder misinterprets the coherence values with the result that the stereo image is suddenly becoming very wide.

The solution in the branch is to change the bandwidth parameter in the call to function stereo_dft_enc_update on line 573 in ivas_cpe_enc to use the current bandwidth sts[0]->bwidth instead of the maximum bandwidth. The solution is bit exact with the trunk for input signals where the bandwidth is not limited.

An alternate solution tested was to allow the call to stereo_dft_band_config on line 2180 of ivas_dft_enc also in SID frames. This does however not work in FB since it will set the number of bands to 7 instead of 6 in non band limited operation.

Car32mono_WB_24400_dtx Car32mono_WB

Edited by janssonfr