Commit 5609487f authored by vaclav's avatar vaclav
Browse files

Merge branch...

Merge branch '1220-msan-crash-segfault-when-decoding-omasa-jbm-with-rate-switching-to-binaural' into 'main'

[non-BE] Resolve "MSAN/Crash: Segfault when decoding OMASA JBM with rate switching to BINAURAL"

See merge request !1858
parents 9b4bfb1a 95ef3919
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@
#define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH               /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */
#define NONBE_FIX_1205_TD_STEREO_MOD_CT                 /* VA: fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder */
#define NONBE_1203_MDCT2DFT_SWITCHING                   /* VA: issue 1203: fix severe artifacts during MDCT to DFT stereo switching when MDCT ITD is not used */
#define NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1220: fix bug in renderer flush in OMASA 1ISM JBM bitrate switching */

/* ##################### End NON-BE switches ########################### */

+11 −0
Original line number Diff line number Diff line
@@ -1517,7 +1517,11 @@ ivas_error ivas_jbm_dec_flush_renderer(
        {
            if ( ism_mode_old == ISM_MASA_MODE_DISC )
            {
#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
                float *tc_local[MAX_NUM_OBJECTS];
#else
                float *tc_local[MAX_TRANSPORT_CHANNELS];
#endif

                for ( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ )
                {
@@ -1525,6 +1529,12 @@ ivas_error ivas_jbm_dec_flush_renderer(
                    mvr2r( st_ivas->hMasaIsmData->delayBuffer[ch_idx], tc_local[ch_idx], st_ivas->hMasaIsmData->delayBuffer_size );
                }

#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
                if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
#else
                if ( st_ivas->nchan_ism > 0 )
                {
                    if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ) ) != IVAS_ERR_OK )
@@ -1541,6 +1551,7 @@ ivas_error ivas_jbm_dec_flush_renderer(
                    st_ivas->hTcBuffer->slots_rendered += 1;
                    st_ivas->hTcBuffer->subframes_rendered += 1;
                }
#endif
            }
        }
        else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
+5 −1
Original line number Diff line number Diff line
@@ -99,11 +99,15 @@ ivas_error ivas_td_binaural_renderer_sf(
    int16_t nchan_ism_internal, nchan_ism, ch_offset;

    /* Set the number of ISMs */
#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
    if ( st_ivas->ivas_format == MASA_ISM_FORMAT || ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_ism > 0 ) )
#else
    if ( st_ivas->ivas_format == MASA_ISM_FORMAT )
#endif
    {
        nchan_ism_internal = st_ivas->nchan_ism;
        nchan_ism = st_ivas->nchan_ism;
        ch_offset = 2;
        ch_offset = CPE_CHANNELS;
    }
    else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
    {
+13 −0
Original line number Diff line number Diff line
@@ -748,14 +748,26 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
)
{
    int16_t n;
#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
    float data_separated_objects[BINAURAL_CHANNELS][L_FRAME48k];
#else
    float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k];
#endif
    ivas_error error;
#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
    float *p_sepobj[BINAURAL_CHANNELS];
#else
    float *p_sepobj[MAX_NUM_OBJECTS];
#endif
    int16_t slot_idx_start;

    slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered;

#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
    for ( n = 0; n < BINAURAL_CHANNELS; n++ )
#else
    for ( n = 0; n < MAX_NUM_OBJECTS; n++ )
#endif
    {
        p_sepobj[n] = &data_separated_objects[n][0];
    }
@@ -806,6 +818,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm(
        {
            return error;
        }

        for ( n = 0; n < BINAURAL_CHANNELS; n++ )
        {
            v_add( output_f[n], p_sepobj[n], output_f[n], *nSamplesRendered );