Commit 05f93dc7 authored by multrus's avatar multrus
Browse files

[cleanup] accept NONBE_FIX_898_ISM_BRATE_CRASH

parent 981a3429
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1150,11 +1150,7 @@ 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                     */
);
+0 −1
Original line number Diff line number Diff line
@@ -163,7 +163,6 @@
/* all switches in this category should start with "NONBE_" */

#define NONBE_FIX_856_TCX_LTP_SYNTH_FILTER                    /* FhG: issue 856: correct filtering length for tcx-ltp synth filtering*/
#define NONBE_FIX_898_ISM_BRATE_CRASH                         /* VA: issue 898: fix decoder crash in ISM bitrate switching with DTX and binaural output */
#define NONBE_FIX_862_UBSAN_SPAR_DEC_BR_SW_PLC                /* DLB: issue 862 : UBSAN: out-of-bound error in SPAR for OSBA bitrate switching with PLC*/
#define NONBE_FIX_DISCRETE_ISM_NOISE_SEED_HANDLING            /* FhG: fix handling of common and differing noise seeds in SCEs for ISM DTX */
#define NONBE_FIX_913_OMASA_BITBUDGET_VIOLATION               /* VA/Nok: issue 913: Resolve "Crash in OMASA encoder - DFT-Stereo bit-budget violated" */
+0 −18
Original line number Diff line number Diff line
@@ -625,15 +625,9 @@ 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;
@@ -646,12 +640,10 @@ 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;

@@ -664,25 +656,15 @@ 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;
+0 −58
Original line number Diff line number Diff line
@@ -47,29 +47,15 @@
 * 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;
@@ -79,50 +65,10 @@ 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 );

        while ( get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ) == 1 && nchan_ism < MAX_NUM_OBJECTS )
        {
            ( nchan_ism )++;
            pos--;
        }
        st_ivas->nchan_ism = nchan_ism;
        pos--;

        if ( nchan_ism != nchan_ism_prev )
        {
            return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" );
        }

        last_ism_mode = st_ivas->ism_mode;

        /* read ism_mode */
        if ( nchan_ism > 2 )
        {
            pos -= nchan_ism; /* SID metadata flags */

            idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 );
            ism_mode_bstr = (ISM_MODE) ( idx + 1 );
            st_ivas->ism_mode = ism_mode_bstr;
        }

#ifdef SPLIT_REND_WITH_HEAD_ROT
        if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, NULL, PCM_NOT_KNOW, NULL ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, NULL, NULL ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
#endif
    }
    else
    {
@@ -189,11 +135,7 @@ ivas_error ivas_ism_dtx_dec(
        }
    }

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


+0 −7
Original line number Diff line number Diff line
@@ -154,14 +154,7 @@ ivas_error ivas_jbm_dec_tc(
        /* 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 )