Commit ec5d8afa authored by vaclav's avatar vaclav
Browse files

extend NONBE_FIX_898_ISM_BRATE_CRASH to further simplify the function ivas_ism_dtx_dec()

parent 8d829881
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1154,7 +1154,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                     */
);
+4 −0
Original line number Diff line number Diff line
@@ -172,10 +172,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 )
+7 −0
Original line number Diff line number Diff line
@@ -657,6 +657,13 @@ ivas_error ivas_dec_setup(
            }
            k--;

#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
            if ( 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 */
+22 −3
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 );
@@ -86,9 +104,6 @@ ivas_error ivas_ism_dtx_dec(

        last_ism_mode = st_ivas->ism_mode;

#ifdef NONBE_FIX_898_ISM_BRATE_CRASH
        /* ism_mode was read in ivas_dec_setup() as well as reconfiguration ivas_ism_dec_config() */
#else
        /* read ism_mode */
        if ( nchan_ism > 2 )
        {
@@ -163,7 +178,11 @@ ivas_error ivas_ism_dtx_dec(
        }
    }

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


+4 −0
Original line number Diff line number Diff line
@@ -143,10 +143,14 @@ 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 )