OMASA: missing reset of hCPE->brate_surplus
This is a spin-off from #831 (closed).
In the case of switching from OMASA DISC mode to MASA (ISM_NONE) mode with the TD stereo, there is missing a reset of parameter 'hCPE->brate_surplus'. Consequently, the following bitstream reading in ivas_stereeo_switching_dec.c, line 771 is wrong:
hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], hCPE->element_brate + hCPE->brate_surplus, (int16_t) ( ( hCPE->element_brate / FRAMES_PER_SEC ) - nb_bits_metadata + ( hCPE->brate_surplus / FRAMES_PER_SEC ) - TDM_SECONDARY_SIGNALLING - TDM_RATIO_BITS - TDM_LP_REUSE_BITS - TDM_LR_CONTENT_BITS ), TDM_LR_CONTENT_BITS );
causing a decoder crash.
Command line to recreate the issue:
IVAS_cod -q -ism_masa 4 2 NULL ltv48_OMASA_4ISM_2TC_ISM2.csv ltv48_OMASA_4ISM_2TC_ISM3.csv ltv48_OMASA_4ISM_2TC_ISM4.csv ltv48_OMASA_4ISM_2TC.met sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin 48 ltv48_OMASA_4ISM_2TC.wav bit
IVAS_dec -q HOA3 48 bit syn
The full report from https://ivas-codec-pc.3gpp.org/-/ivas-codec/-/jobs/17358/artifacts/report-ltv.html is
[gw31] linux -- Python 3.10.12 /usr/bin/python3
[gw31] linux -- Python 3.10.12 /usr/bin/python3[gw31] linux -- Python 3.10.12 /usr/bin/python3
tests/codec_be_on_mr_nonselection/test_param_file.py:273: in test_param_file_tests
stdout = decode(
tests/codec_be_on_mr_nonselection/test_param_file.py:498: in decode
decoder_frontend.run(
tests/conftest.py:439: in run
pytest.fail(
E Failed: DUT decoder terminated with a non-0 return code: -11[gw31] linux -- Python 3.10.12 /usr/bin/python3
tests/conftest.py:466: in dut_decoder_frontend
decoder._check_run()
tests/conftest.py:446: in _check_run
pytest.fail(
E Failed: DUT decoder terminated with a non-0 return code: -11
------------------------------Captured stdout call------------------------------
DUT encoder command:
/home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/IVAS_cod -q -ism_masa 4 2 NULL /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/scripts/testv/ltv48_OMASA_4ISM_2TC_ISM2.csv /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/scripts/testv/ltv48_OMASA_4ISM_2TC_ISM3.csv /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/scripts/testv/ltv48_OMASA_4ISM_2TC_ISM4.csv /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/scripts/testv/ltv48_OMASA_4ISM_2TC.met scripts/switchPaths/sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin 48 /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/scripts/testv/ltv48_OMASA_4ISM_2TC.wav /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/tests/dut/param_file/enc/ltv48_OMASA_4ISM_2TC.wav_OMASA_1Dir2TC_4ISM_at_bitrate_switching_techs_13_2_to_512_kbps_start_80_kbps_48kHz_in_48kHz_out_HOA3_out.192
DUT encoder stdout:
MASA inp. metadata file: /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/scripts/testv/ltv48_OMASA_4ISM_2TC.met
Input audio file: /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/scripts/testv/ltv48_OMASA_4ISM_2TC.wav
Output bitstream file: /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/tests/dut/param_file/enc/ltv48_OMASA_4ISM_2TC.wav_OMASA_1Dir2TC_4ISM_at_bitrate_switching_techs_13_2_to_512_kbps_start_80_kbps_48kHz_in_48kHz_out_HOA3_out.192
Bitrate switching file: scripts/switchPaths/sw_13k2_512k_2fr_start_80k_omasatechs_4ism.bin
Max. encoded bandwidth: FB
Input sampling rate: 48000 Hz
Bitrate: 64.00 kbps
IVAS format: combined ISM and MASA (4 ISM stream(s))
-- Start the encoder (quiet mode) --
Encoding finished
--- SNR report ---
CELP_output_ch0 4.688 dB SNR 7.252 dB SegSNR 7.232 dB WSegSNR
TCX_output.id1_ch0 8.750 dB SNR 8.461 dB SegSNR 11.312 dB WSegSNR
TCX_output.id1_ch1 6.134 dB SNR 6.682 dB SegSNR 6.808 dB WSegSNR
CELP_output.id1_ch0 3.849 dB SNR 5.652 dB SegSNR 5.591 dB WSegSNR
TCX_output.id2_ch0 12.255 dB SNR 7.764 dB SegSNR 23.819 dB WSegSNR
TCX_output.id3_ch0 13.022 dB SNR 13.194 dB SegSNR 23.240 dB WSegSNR
TCX_output.id4_ch0 10.954 dB SNR 11.720 dB SegSNR 13.647 dB WSegSNR
CELP_output.id4_ch0 6.504 dB SNR 4.975 dB SegSNR 5.313 dB WSegSNR
TCX_output_ch0 8.451 dB SNR 7.838 dB SegSNR 13.677 dB WSegSNR
TCX_output.id4_ch1 8.518 dB SNR 8.989 dB SegSNR 10.528 dB WSegSNR
CELP_output.id2_ch0 5.671 dB SNR 7.779 dB SegSNR 7.892 dB WSegSNR
CELP_output.id1_ch1 3.622 dB SNR 2.998 dB SegSNR 4.346 dB WSegSNR
CELP_output.id3_ch0 6.804 dB SNR 8.628 dB SegSNR 8.642 dB WSegSNR
CELP_output_ch1 4.511 dB SNR 4.676 dB SegSNR 4.704 dB WSegSNR
DUT encoder stderr:
==================================================================================================
IVAS Codec Baseline
Based on EVS Codec (Floating Point) 3GPP TS26.443 Nov 04, 2021,
Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
==================================================================================================
DUT decoder command:
/home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/IVAS_dec -q HOA3 48 /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/tests/dut/param_file/enc/ltv48_OMASA_4ISM_2TC.wav_OMASA_1Dir2TC_4ISM_at_bitrate_switching_techs_13_2_to_512_kbps_start_80_kbps_48kHz_in_48kHz_out_HOA3_out.192 /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/tests/dut/param_file/dec/ltv48_OMASA_4ISM_2TC.wav_OMASA_1Dir2TC_4ISM_at_bitrate_switching_techs_13_2_to_512_kbps_start_80_kbps_48kHz_in_48kHz_out_HOA3_out.dec.wav
DUT decoder stderr:
==================================================================================================
IVAS Codec Baseline
Based on EVS Codec (Floating Point) 3GPP TS26.443 Nov 04, 2021,
Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
==================================================================================================
Internal fatal error: Error: Too low bitrate (8800 bps) for ACELP@16k in frame 699. Exiting!
In function: config_acelp1(), /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/lib_com/bits_alloc.c:610
Internal fatal error: Error: Too low bitrate (-70200 bps) for ACELP@16k in frame 714. Exiting!
In function: config_acelp1(), /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/lib_com/bits_alloc.c:610
Internal fatal error: Error: Too low bitrate (-70200 bps) for ACELP@16k in frame 714. Exiting!
In function: config_acelp1(), /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/lib_com/bits_alloc.c:610
Internal fatal error: Error: Too low bitrate (-70200 bps) for ACELP@16k in frame 715. Exiting!
In function: config_acelp1(), /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/lib_com/bits_alloc.c:610
Internal fatal error: Error: Too low bitrate (-70200 bps) for ACELP@16k in frame 715. Exiting!
In function: config_acelp1(), /home/gitlab-runner/builds/jtzTJMmS/0/rep/ivas-codec-pc/ivas-codec/lib_com/bits_alloc.c:610```