Commit ff913ae4 authored by norvell's avatar norvell
Browse files

Merge branch '1002-usan-value-out-of-range-for-int16-in-fec_hq_phase_ecu-c' into 'main'

Resolve "USAN: value out of range for int16 in FEC_HQ_phase_ecu.c"

See merge request !1435
parents 9f0ec81c b1f78744
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@
#define FIX_998_UNUSED_FUNCTION                         /* FhG: issue 998: delete unused funtion ivas_dirac_dec_get_response_split_order */ 
#define FIX_1009_ISM_NONDIEGETIC_PANNING                /* FhG: issue #1009: use correct object buffer for ISM1 non-diegetic pan      */
#define FIX_993_REMOVE_SBA_GET_ORDER                    /* VA: issue 993: remove unused function ivas_sba_get_order() */
#define FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE            /* Eri: issue #1002, usan-value-out-of-range-for-int16, kept BE for PLC-conditions   */
#define FIX_960_SYN_OUTPUT                              /* VA: issue 960: unused function syn_output() is removed */

/* #################### End BE switches ################################## */
+11 −1
Original line number Diff line number Diff line
@@ -973,7 +973,6 @@ static void subst_spec(
    float alpha_local;
    float beta_local;


    sincos = sincos_t_ext + 128;
    Lprot = (int16_t) ( L_PROT32k * output_frame / 640 );
    Lprot_1 = 1.0f / Lprot;
@@ -1092,7 +1091,14 @@ static void subst_spec(
        }

        Xph = corr_phase[m];
#ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE
        /* extract fractional phase integer index in the range [0...1023] */
        Xph_short = (int16_t) ( 0x000003ff & (int32_t) ( ( Xph * 512 ) / EVS_PI ) );
#else
        Xph_short = (int16_t) ( ( (int32_t) ( Xph * 512 / EVS_PI ) ) % 32768 ) & 0x03ff;
#endif


        if ( Xph_short >= 512 )
        {
            sin_F = -sincos_t_ext[Xph_short - 512];
@@ -1136,7 +1142,11 @@ static void subst_spec(
                    mag_chg_local *= 0.5f + ( 1.0f - ( 1.0f / PHASE_DITH ) * ph_dith ) * 0.5f;
                }

#ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE
                Xph_short = (int16_t) ( ( (int32_t) ( ( Xph * 512 ) / EVS_PI ) ) & 0x000003ff );
#else
                Xph_short = (int16_t) ( Xph * 512 / EVS_PI ) & 0x03ff;
#endif

                if ( Xph_short >= 512 )
                {