Commit baa5d9ca authored by Stefan Doehla's avatar Stefan Doehla
Browse files

Merge branch '150-crash-in-evs-mono-hq_harmonic-mode-related-to-basop_noglob' into 'main'

Resolve "Crash in EVS mono, HQ_HARMONIC mode, related to BASOP_NOGLOB"

See merge request !317
parents 42e71295 46222d0c
Loading
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -375,6 +375,13 @@ void hq2_bit_alloc_har(

    Word32 L_y[BANDS_MAX];

#ifdef FIX_150
#ifdef BASOP_NOGLOB
    Flag Overflow;
    Overflow = 0;
#endif
#endif

    grp_rngmax_fx[0] = 0;
    grp_rngmax_fx[1] = 0;

@@ -639,7 +646,16 @@ void hq2_bit_alloc_har(

    L_temp = Mpy_32_16( L_Ravg_sub[GRP_SB - 1], sub( GRP_SB, 1 ) ); /* Qbe+0+1 */
    L_temp = Mpy_32_16( L_temp, Inv_norm_sum_fx );                  /* Qbe+1+QIpb+1 */
#ifdef FIX_150
#ifdef BASOP_NOGLOB
    lf_hf_ge_r_fx = round_fx_o( L_shl_o( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ), &Overflow ), &Overflow );
    Overflow = 0; /* reset BASOP Overflow */
#else
    lf_hf_ge_r_fx = round_fx( L_shl( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) );
#endif
#else
    lf_hf_ge_r_fx = round_fx( L_shl( L_temp, sub( 15 + 16, sub( add( SWB_BWE_LR_Qbe, QIns ), 30 ) ) ) );
#endif

    exp_normn = norm_s( norm_sum_fx );
    exp_normn = sub( exp_normn, 1 );
+1 −1
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@
#define FIX_ITD                                         /* Contribution 16: TD renderer ITD improvement and code cleanup */
#define BRATE_SWITCHING_RENDERING                       /* Bitrate switching changes related to the renderers */
#define FIX_ISM_DECODER_PRINTOUT                        /* Issue 229: fix ISM decoder printout */
#define FIX_150                                         /* Issue 150: Crash in EVS mono, HQ_HARMONIC mode, related to BASOP_NOGLOB */
#define FIX_REND_ISM_XFADE                              /* Issue 193: Crossfade inconsistencies in ISM between decoder and external renderer */
#define FIX_REND_ISM_POS_ROUNDING                       /* Issue 193: (Temporary solution until fix for #215) Align rounding of ISM position data in external renderer */
#define FIX_REND_ISM_STEREO_PANNING                     /* Issue 193: Use tangent panning for ISM to stereo in external renderer */
@@ -163,7 +164,6 @@
#define IMPROVE_CMDLINE_ROBUSTNESS                      /* Issue 233: Improve robustness of command-line parameters */
#define FIX_MDCT_AND_MC_MONO_ISSUES                     /* Issue 242: Fix some issues with TCX-LTP and delay alignement for mono output */


/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+16 −1
Original line number Diff line number Diff line
@@ -1795,6 +1795,13 @@ void hq_generic_hf_encoding(
    {
        Word16 tmp, frac, exp;
        Word32 L_tmp;
#ifdef FIX_150
#ifdef BASOP_NOGLOB
        Flag Overflow;

        Overflow = 0;
#endif
#endif
        tmp = add( (int16_t) ( hq_generic_fenv[n_band] * 256 ), (int16_t) ( Mean_env[n_band] * 256 ) ); /*Q8 */

        L_tmp = L_mult( tmp, 21771 );       /* 0.166096 in Q17 -> Q26 */
@@ -1805,7 +1812,15 @@ void hq_generic_hf_encoding(
        /* output of Pow2() will be: */
        /* 16384 < Pow2() <= 32767 */
        exp = sub( exp, 13 );
#ifdef FIX_150
#ifdef BASOP_NOGLOB
        tmp = shl_o( tmp, add( exp, 1 ), &Overflow ); /*Q1 */
#else
        tmp = shl( tmp, add( exp, 1 ) ); /*Q1 */
#endif
#else
        tmp = shl( tmp, add( exp, 1 ) ); /*Q1 */
#endif
        hq_generic_fenv[n_band] = (float) tmp * 0.5f; /*Q1 */
    }