Skip to content

BASOP assert in OMASA decoder in complexity pipeline

Basic info

Bug description

A BASOP assert is hit in the OMASA decoder in the complexity pipeline: https://forge.3gpp.org/rep/sa4/audio/ivas-basop/-/pipelines/44427

Frames processed:       4351    Assertion failed: (0), function L_mult, file basop32.c, line 1131.

LLDB Stacktrace:

  * frame #4: 0x00000001002e82ac IVAS_dec_fx`L_mult(var1=-32768, var2=-32768) at basop32.c:1131:9
    frame #5: 0x00000001002e8758 IVAS_dec_fx`L_msu(L_var3=-32768, var1=-32768, var2=-32768) at basop32.c:1503:17
    frame #6: 0x000000010032ff38 IVAS_dec_fx`enhancer_fx(core_brate=21100, Opt_AMR_WB=0, coder_type=4, i_subfr=0, L_frame=320, voice_fac=-32765, stab_fac=0, norm_gain_code=1764080, gain_inov=512, gc_threshold=0x000000015003ac08, code=0x000000016fdca518, exc2=0x000000016fdd2fbc, gain_pit=0, dm_fx=0x000000015003ac0c, Q_exc=3) at enhancer_fx.c:248:21
    frame #7: 0x000000010009b48c IVAS_dec_fx`decod_tran_fx(st_fx=0x0000000150038000, L_frame_fx=320, tc_subfr_fx=64, Aq_fx=0x000000016fdd323c, Es_pred_fx=4647, pitch_buf_fx=0x000000016fdde350, voice_factors_fx=0x000000016fdde364, exc_fx=0x000000016fdd3a06, exc2_fx=0x000000016fdd2fbc, bwe_exc_fx=0x000000016fdd26d8, unbits=0x000000016fdd63c8, sharpFlag=1, gain_buf=0x000000016fdd12d2) at dec_tran_fx.c:279:13
    frame #8: 0x0000000100039fa4 IVAS_dec_fx`acelp_core_dec_ivas_fx(st=0x0000000150038000, output_fx=0x000000016fddca48, synth_fx16=0x000000016fddac48, save_hb_synth_fx16=0x0000000000000000, bwe_exc_extended_fx=0x000000016fdde378, voice_factors_fx=0x000000016fdde364, old_syn_12k8_16k_fx=0x000000016fdd8b88, sharpFlag=1, pitch_buf_fx=0x000000016fdde350, unbits=0x000000016fdd63c8, sid_bw=0x000000016fdd63c4, hStereoTD=0x0000000000000000, tdm_lspQ_PCh_fx=0x000000016fdd8e08, tdm_lsfQ_PCh_fx=0x000000016fdd8e28, use_cldfb_for_dft=0, last_element_mode=1, last_element_brate=24000, flag_sec_CNA=-1, nchan_out=1, hStereoCng=0x0000000000000000, read_sid_info=1) at acelp_core_dec_ivas_fx.c:1059:17
    frame #9: 0x00000001000f97b0 IVAS_dec_fx`ivas_core_dec_fx(st_ivas=0x000000015a808200, hSCE=0x00006000018282d0, hCPE=0x0000000000000000, hMCT=0x0000000000000000, n_channels=1, output_32_fx=0x000000016fde1810, hb_synth_32_fx=0x000000016fde0038, DFT_fx=0x0000000000000000, sba_dirac_stereo_flag=0) at ivas_core_dec.c:539:17
    frame #10: 0x0000000100197f6c IVAS_dec_fx`ivas_sce_dec_fx(st_ivas=0x000000015a808200, sce_id=3, output=0x000000016fde1810, output_frame=320, nb_bits_metadata=10) at ivas_sce_dec_fx.c:300:5
    frame #11: 0x00000001001355cc IVAS_dec_fx`ivas_jbm_dec_tc_fx(st_ivas=0x000000015a808200, data_fx=0x0000000000000000) at ivas_jbm_dec.c:782:13
    frame #12: 0x00000001001f8c98 IVAS_dec_fx`IVAS_DEC_GetTcSamples(hIvasDec=0x0000600000328000, pcmBuf_fx=0x0000000000000000, nOutSamples=0x000000016fde1982) at lib_dec_fx.c:1426:9
    frame #13: 0x00000001001f75ac IVAS_dec_fx`IVAS_DEC_GetSamples(hIvasDec=0x0000600000328000, nSamplesAsked=320, pcmBuf=0x000000015a80a000, nOutSamples=0x000000016fdf8848, needNewFrame=0x000000016fdf884d) at lib_dec_fx.c:1071:9
    frame #14: 0x0000000100008314 IVAS_dec_fx`decodeG192(arg=DecArguments @ 0x000000016fdfdc38, hBsReader=0x0000600002928000, headRotReader=0x0000000000000000, externalOrientationFileReader=0x0000000000000000, refRotReader=0x0000000000000000, referenceVectorReader=0x0000000000000000, hIvasDec=0x0000600000328000, pcmBuf=0x000000015a80a000) at decoder.c:1684:28
    frame #15: 0x0000000100004974 IVAS_dec_fx`main(argc=5, argv=0x000000016fdff0c8) at decoder.c:577:17

Relevant code part seems to be in enhancer_fx.c:248. code[i] has the value of -32768 here, see stacktrace above.

        FOR( i = 1; i < L_SUBFR - 1; i++ )
        {
            /* pt_exc2[i] += code[i] - tmp * code[i-1] - tmp * code[i+1] */
            L_tmp = L_msu( -32768, code[i], -32768 ); // <--------------- HERE
            L_tmp = L_msu( L_tmp, code[i + 1], tmp );
#ifdef BASOP_NOGLOB
            tmp16 = msu_r_sat( L_tmp, code[i - 1], tmp );
            L_tmp = L_shl_sat( L_mult( gain_code_hi, tmp16 ), sc );
            pt_exc2[i] = msu_r_sat( L_tmp, -32768, pt_exc2[i] );
            move16();
#else
            tmp16 = msu_r( L_tmp, code[i - 1], tmp );
            L_tmp = L_shl( L_mult( gain_code_hi, tmp16 ), sc );
            pt_exc2[i] = msu_r( L_tmp, -32768, pt_exc2[i] );
            move16(); /* in Q_exc */
#endif
        }

Ways to reproduce

Bitstream:

bitstream.zip

Crash is triggered by either of these commands:

IVAS_dec_fx BINAURAL 16 ltv48_OMASA_4ISM_2TC_OMASA_ISM4_2TC_ball_wb_rs_fer_ep_10pct_fer_g192.192 out.wav
IVAS_dec_fx HOA3 16 ltv48_OMASA_4ISM_2TC_OMASA_ISM4_2TC_ball_wb_rs_fer_ep_10pct_fer_g192.192 out.wav
Edited by Jan Kiene