Commit 04a2a969 authored by vaclav's avatar vaclav
Browse files

Merge branch '898-decoder-crash-in-ism-bitrate-switching-with-dtx-and-binaural-output' into 'main'

[Non-BE] Resolve "Decoder crash in ISM bitrate switching with DTX and binaural output"

See merge request !1222
parents 7f0c7462 7a18f825
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1155,7 +1155,11 @@ int16_t ivas_ism_dtx_enc(
    int16_t *sid_flag                                           /* o  : indication of SID frame                     */
);

#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
void ivas_ism_dtx_dec(
#else
ivas_error ivas_ism_dtx_dec(
#endif
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                      */
    int16_t *nb_bits_metadata                                   /* o  : number of metadata bits                     */
);

lib_com/options.h

100755 → 100644
+2 −0
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@
#define NONBE_FIX_906_SBA_LBR_SMOOTHING                       /* FhG: issue #906: fix SBA low bit rate smoothing for HOA2/HOA3 output */
#define NONBE_FIX_878_RS_FEC_STEREO_CNG                       /* Eri: Frame loss and Unified Stereo CNG may cause false BER detection which results in corrupt bitstream decoding */
#define NONBE_FIX_904_JBM_SBA_RS_FOA                          /* FhG: issue #904: fix JBM SBA RS to FOA decoding */
#define NONBE_FIX_898_ISM_BRATE_CRASH                         /* VA: issue 898: fix decoder crash in ISM bitrate switching with DTX and binaural output */

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

/* ################## End DEVELOPMENT switches ######################### */
+4 −0
Original line number Diff line number Diff line
@@ -185,10 +185,14 @@ ivas_error ivas_dec(
        /* Metadata decoding and configuration */
        if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA )
        {
#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
            ivas_ism_dtx_dec( st_ivas, nb_bits_metadata );
#else
            if ( ( error = ivas_ism_dtx_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK )
            {
                return error;
            }
#endif

            /* decode dominant object first so the noise energy of the other objects can be limited */
            if ( ( error = ivas_sce_dec( st_ivas, st_ivas->hISMDTX.sce_id_dtx, &p_output[st_ivas->hISMDTX.sce_id_dtx], output_frame, nb_bits_metadata[st_ivas->hISMDTX.sce_id_dtx] ) ) != IVAS_ERR_OK )
+30 −0
Original line number Diff line number Diff line
@@ -636,8 +636,16 @@ ivas_error ivas_dec_setup(
            }
        }

#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
        if ( st_ivas->ivas_format == ISM_FORMAT )
#else
        if ( st_ivas->ini_frame == 0 && st_ivas->ivas_format == ISM_FORMAT )
#endif
        {
#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
            ISM_MODE last_ism_mode = st_ivas->ism_mode;
#endif

            /* read the number of objects */
            st_ivas->nchan_transport = 1;
            nchan_ism = 1;
@@ -649,6 +657,13 @@ ivas_error ivas_dec_setup(
            }
            k--;

#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
            if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism )
            {
                return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" );
            }
#endif

            st_ivas->nchan_ism = nchan_ism;

            /* read ism_mode */
@@ -660,10 +675,25 @@ ivas_error ivas_dec_setup(
                st_ivas->ism_mode = (ISM_MODE) ( idx + 1 );
            }

#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
            if ( st_ivas->ini_frame == 0 )
            {
                last_ism_mode = st_ivas->ism_mode;
            }
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
            if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
            if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK )
#endif
#endif
            {
                return error;
+23 −0
Original line number Diff line number Diff line
@@ -47,17 +47,29 @@
 * ISM DTX Metadata decoding routine
 *-------------------------------------------------------------------*/

#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
void ivas_ism_dtx_dec(
#else
ivas_error ivas_ism_dtx_dec(
#endif
    Decoder_Struct *st_ivas,  /* i/o: IVAS decoder structure    */
    int16_t *nb_bits_metadata /* o  : number of metadata bits   */
)
{
#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
    int16_t ch, nchan_ism, nchan_ism_prev;
#else
    int16_t ch, pos, nchan_ism, nchan_ism_prev;
#endif
    int32_t ivas_total_brate;
    int16_t md_diff_flag[MAX_NUM_OBJECTS];
#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
    int16_t flag_noisy_speech, sce_id_dtx;
#else
    int16_t idx, flag_noisy_speech, sce_id_dtx;
    ISM_MODE last_ism_mode, ism_mode_bstr;
    ivas_error error;
#endif
    Decoder_State *st;

    ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
@@ -67,6 +79,12 @@ ivas_error ivas_ism_dtx_dec(

    if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 )
    {
#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
        /* 'nchan_ism' was read in ivas_dec_setup() */
        nchan_ism = st_ivas->nchan_ism;

        /* ism_mode was read in ivas_dec_setup() as well as reconfiguration ivas_ism_dec_config() */
#else
        /* read number of objects */
        nchan_ism = 1;
        pos = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS );
@@ -104,6 +122,7 @@ ivas_error ivas_ism_dtx_dec(
        {
            return error;
        }
#endif
    }
    else
    {
@@ -159,7 +178,11 @@ ivas_error ivas_ism_dtx_dec(
        }
    }

#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
    return;
#else
    return IVAS_ERR_OK;
#endif
}


Loading