Commit ace75c67 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '1222-mr1855-resolve-decoder-crash-in-masa-dtx-bitrateswitch' into 'main'

Resolve "Port MR1855 (Resolve "Decoder crash in MASA DTX bitrateswitch")"

See merge request !1012
parents 5474633d 14834742
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -319,6 +319,7 @@
    <ClInclude Include="..\lib_com\ivas_error.h" />
    <ClInclude Include="..\lib_com\ivas_error_utils.h" />
    <ClInclude Include="..\lib_com\ivas_prot.h" />
    <ClInclude Include="..\lib_com\ivas_prot_fx.h" />
    <ClInclude Include="..\lib_com\ivas_rom_com.h" />
    <ClInclude Include="..\lib_com\ivas_stat_com.h" />
    <ClInclude Include="..\lib_com\move.h" />
+3 −0
Original line number Diff line number Diff line
@@ -501,6 +501,9 @@
      <Filter>common_h</Filter>
    </ClInclude>
    <ClInclude Include="..\lib_com\options_warnings.h" />
    <ClInclude Include="..\lib_com\ivas_prot_fx.h">
      <Filter>common_h</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <Filter Include="common_evs_c">
+3 −0
Original line number Diff line number Diff line
@@ -248,6 +248,9 @@ ivas_error pre_proc_front_ivas_fx(
    const Word16 front_vad_dtx_flag, /* i  : front-VAD DTX flag to overwrite VAD decision				Q0*/
    const IVAS_FORMAT ivas_format,   /* i  : IVAS format												*/
    const Word16 MCT_flag,           /* i  : hMCT handle allocated (1) or not (0)						Q0*/
#ifdef NONBE_1211_DTX_BR_SWITCHING
    const Word32 last_ivas_total_brate, /* i  : last IVAS total bitrate                                    Q0*/
#endif
    const Word32 ivas_total_brate,   /* i  : IVAS total bitrate - for setting the DTX					Q0*/
    Word16 *Q_new
#ifdef DEBUG_MODE_INFO
+1 −0
Original line number Diff line number Diff line
@@ -134,4 +134,5 @@
#define FIX_1010_OPT_GIVENS_INV                 /* FhG: SVD complexity optimizations (non-be) */
#define FIX_1010_OPT_NORM_NOSAT                 /* FhG: SVD complexity optimizations (non-be) */
#define FIX_1010_OPT_SEC_SINGLE_RESCALE         /* FhG: SVD complexity optimizations (non-be) */
#define NONBE_1211_DTX_BR_SWITCHING             /* VA: port float issue 1211: fix crash in MASA DTX bitrate switching */
#endif
+33 −1
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ static void update_SID_cnt_fx( DTX_ENC_HANDLE hDtxEnc, const Word32 core_brate,
/*==================================================================================*/
void dtx_ivas_fx(
    Encoder_State *st_fx, /* i/o: encoder state structure                  */
#ifdef NONBE_1211_DTX_BR_SWITCHING
    const Word32 last_ivas_total_brate, /* i  : last IVAS total bitrate                  Q0*/
#endif
    const Word32 ivas_total_brate, /* i  : IVAS total bitrate                       Q0*/
    const Word16 vad,              /* i  : vad flag for DTX                         Q0*/
    const Word16 speech[],         /* i  : Pointer to the speech frame              Q_speech*/
@@ -81,13 +84,21 @@ void dtx_ivas_fx(
    Flag Overflow = 0;
    move32();
#endif
#ifdef NONBE_1211_DTX_BR_SWITCHING
    Word32 total_brate_ref;

    total_brate_ref = st_fx->total_brate;
    move32();
#endif

    IF( st_fx->dtx_sce_sba != 0 )
    {
        last_br_cng_flag = 1;
        last_br_flag = 1;
#ifndef NONBE_1211_DTX_BR_SWITCHING
        br_dtx_flag = 1;
        move16();
#endif
        move16();
        move16();
    }
@@ -102,10 +113,18 @@ void dtx_ivas_fx(
        test();
        test();
        test();

#ifdef NONBE_1211_DTX_BR_SWITCHING
        last_br_flag = ( st_fx->element_mode == EVS_MONO && LE_32( st_fx->last_total_brate, MAX_BRATE_DTX_EVS ) ) ||
                       ( st_fx->element_mode != EVS_MONO && LE_32( last_ivas_total_brate, MAX_BRATE_DTX_IVAS ) ) ||
                       LT_16( st_fx->lp_noise_fx, LP_NOISE_LV * 256 );
#else
        last_br_flag = LE_32( st_fx->last_total_brate, ACELP_24k40 ) || LT_16( st_fx->lp_noise_fx, LP_NOISE_LV * 256 ) || ( EQ_16( st_fx->element_mode, IVAS_SCE ) && LE_32( st_fx->last_total_brate, ACELP_32k ) );
        br_dtx_flag = 0;
        move16();
#endif
    }

    /* Initialization */
    IF( st_fx->ini_frame == 0 )
    {
@@ -199,6 +218,12 @@ void dtx_ivas_fx(
    /*------------------------------------------------------------------------*
     * Select SID or FRAME_NO_DATA frame if DTX is enabled
     *------------------------------------------------------------------------*/

#ifdef NONBE_1211_DTX_BR_SWITCHING
    br_dtx_flag = 1;
    move16();
#endif

    IF( st_fx->dtx_sce_sba == 0 )
    {
        test();
@@ -325,6 +350,13 @@ void dtx_ivas_fx(
            reset_indices_enc( st_fx->hBstr, st_fx->hBstr->nb_ind_tot );
        }
    }
#ifdef NONBE_1211_DTX_BR_SWITCHING
    ELSE IF( st_fx->element_mode != EVS_MONO )
    {
        st_fx->total_brate = total_brate_ref;
        move32();
    }
#endif

    /*------------------------------------------------------------------------*
     * Reset counters when in active frame (not in SID or FRAME_NO_DATA frame)
Loading