Commit 3ba8b1fc authored by norvell's avatar norvell
Browse files

Add FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE

parent 30f20459
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -219,6 +219,7 @@

#define FIX_ACCESS_WITHIN_NULL_STRUCT_MC_BW_SWITCHING   /* FhG: fix usan error in MCT with bw swicthing */
#define NONBE_FIX_986_MC_BW_SWITCHING                   /* FhG: fix crash in bw and br switching with MC */
#define FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE            /* Eri: issue #1002, usan-value-out-of-range-for-int16, kept BE for PLC-conditions   */

/* #################### End BASOP porting switches ############################ */

+10 −0
Original line number Diff line number Diff line
@@ -1092,7 +1092,13 @@ 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 )
                {