Commit 41465f08 authored by vasilache's avatar vasilache
Browse files

Merge branch '797-omasa-crash-in-inactive-static-separated-object' into 'main'

[non-BE] Resolve "OMASA crash in inactive static separated object"

See merge request !1079
parents 18937cdd 04cbbed6
Loading
Loading
Loading
Loading
Loading
+28 −2
Original line number Diff line number Diff line
@@ -335,11 +335,22 @@ int32_t ivas_interformat_brate(
void ivas_combined_format_brate_sanity(
    const int32_t element_brate, /* i  : element bitrate                */
    const int16_t core,          /* i  : core                           */
#ifdef NONBE_FIX_797_OMASA_INACTIVE_SEP_OBJ
    const int32_t total_brate, /* i  : total bitrate                  */
#endif
    int32_t *core_brate, /* i/o: core bitrate                   */
#ifdef NONBE_FIX_797_OMASA_INACTIVE_SEP_OBJ
    int16_t *inactive_coder_type_flag, /* o  : inactive coder_type flag       */
#endif
    int16_t *diff_nBits /* o  : number of differential bits    */
)
{
    int16_t limit_high, nBits;
#ifdef NONBE_FIX_797_OMASA_INACTIVE_SEP_OBJ
    int32_t brate_diff;

    brate_diff = total_brate - *core_brate;
#endif

    /* sanity check: at lowest IVAS bit-rates and one ISM channel coded by
    low-rate core-coder mode, it can happen that the CPE (MASA) bit-budget
@@ -364,6 +375,21 @@ void ivas_combined_format_brate_sanity(
        }
    }

#ifdef NONBE_FIX_797_OMASA_INACTIVE_SEP_OBJ
    /*-----------------------------------------------------------------*
     * set inactive coder_type flag in ACELP core
     *-----------------------------------------------------------------*/

    if ( core == ACELP_CORE )
    {
        *inactive_coder_type_flag = 0; /* AVQ by default */
        if ( *core_brate + brate_diff <= MAX_GSC_INACTIVE_BRATE )
        {
            *inactive_coder_type_flag = 1; /* GSC */
        }
    }
#endif

    return;
}

+6 −0
Original line number Diff line number Diff line
@@ -5827,7 +5827,13 @@ int32_t ivas_interformat_brate(
void ivas_combined_format_brate_sanity(
    const int32_t element_brate,                                /* i  : element bitrate                         */
    const int16_t core,                                         /* i  : core                                    */
#ifdef NONBE_FIX_797_OMASA_INACTIVE_SEP_OBJ
    const int32_t total_brate,                                  /* i  : total bitrate                           */
#endif
    int32_t *core_brate,                                        /* i/o: core bitrate                            */
#ifdef NONBE_FIX_797_OMASA_INACTIVE_SEP_OBJ
    int16_t *inactive_coder_type_flag,                          /* o  : inactive coder_type flag                */
#endif
    int16_t *diff_nBits                                         /* o  : number of differential bits             */
);

+3 −2
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@
#define NONBE_CR_FIX_735_SBA_HP20_BRATE_SWITCHING       /* VA: Issue 735: Resolve "HP20 filtering bug in SBA/OSBA bitrate switching" */
#define NONBE_FIX_588_UPDATE_FASTCONV_SD                      /* FhG: issue 588: update FastConv SD HRTFs in CLDFB domain with new conversion method */
#define NONBE_FIX_778_TNS_UNFIED_STEREO_MSAN                  /* FhG: Issue 778: MSAN error due to uninitialized TNS configuration */
#define NONBE_FIX_797_OMASA_INACTIVE_SEP_OBJ                 /* VA: issue 797:  fix of crash when the separated object is inactive and the MASA metadata is using very few bits */


/* ##################### End NON-BE switches ########################### */
+4 −0
Original line number Diff line number Diff line
@@ -803,7 +803,11 @@ ivas_error acelp_core_dec(
            {
                decod_tran( st, st->L_frame, tc_subfr, Aq, Es_pred, pitch_buf, voice_factors, exc, exc2, bwe_exc, unbits, sharpFlag, gain_buf );
            }
#ifdef NONBE_FIX_797_OMASA_INACTIVE_SEP_OBJ
            else if ( st->coder_type == AUDIO || ( st->coder_type == INACTIVE && st->inactive_coder_type_flag ) )
#else
            else if ( st->coder_type == AUDIO || ( st->coder_type == INACTIVE && st->total_brate <= MAX_GSC_INACTIVE_BRATE ) )
#endif
            {
                /* AUDIO and INACTIVE frames (coded by GSC technology) */
                decod_audio( st, dct_exc_tmp, Aq, &tmp_noise, pitch_buf, voice_factors, exc, exc2, bwe_exc, lsf_new, gain_buf, tdm_lp_reuse_flag, tdm_low_rate_mode, tdm_Pitch_reuse_flag, p_tdm_Pri_pitch_buf );
+12 −1
Original line number Diff line number Diff line
@@ -406,7 +406,6 @@ void decision_matrix_dec(
    /* set core bitrate */
    st->core_brate = st->total_brate - st->extl_brate;


    /*-----------------------------------------------------------------*
     * Read HQ signaling bits from the bitstream
     * Set HQ core type
@@ -559,5 +558,17 @@ void decision_matrix_dec(
        st->last_extl = st->extl;
    }

#ifdef NONBE_FIX_797_OMASA_INACTIVE_SEP_OBJ
    /*-----------------------------------------------------------------*
     * set inactive coder_type flag in ACELP core
     *-----------------------------------------------------------------*/

    st->inactive_coder_type_flag = 0; /* AVQ by default */
    if ( st->total_brate <= MAX_GSC_INACTIVE_BRATE )
    {
        st->inactive_coder_type_flag = 1; /* GSC */
    }
#endif

    return;
}
Loading