Loading lib_dec/FEC_HQ_phase_ecu.c +33 −19 Original line number Diff line number Diff line Loading @@ -1096,9 +1096,11 @@ static void subst_spec( Xph = corr_phase[m]; #ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE if ( element_mode != EVS_MONO ) { #define WMC_TOOL_SKIP tmpf = Xph * ( 1.0f / PI2 ); /* normalize : mult() with a constant */ tmpf = ( 1024.0f ) * ( tmpf - floorf( tmpf ) ) + 0.5f; /* obtain fraction : floor(), sub(), mult(), rnd(), out: [0...1024.5[ */ tmpf = ( 1024.0f * ( tmpf - floorf( tmpf ))) + 0.5f; /* obtain fraction : floor(), sub(), mult(), rnd(), out: [0...1024.5[ */ Xph_short = ( (int16_t) tmpf ) & 0x03ff; /* mask to [0..1023]: s_and() , out: [0...1023] */ MULT( 2 ); Loading @@ -1106,6 +1108,11 @@ static void subst_spec( ADD( 2 ); /* sub, rnd */ LOGIC( 1 ); /* s_and */ #undef WMC_TOOL_SKIP } else { Xph_short = ( int16_t )( ( ( int32_t )( Xph * 512 / EVS_PI ) ) % 32768 ) & 0x03ff; /* WMC-costly % in use, no rounding */ } #else Xph_short = (int16_t) ( ( (int32_t) ( Xph * 512 / EVS_PI ) ) % 32768 ) & 0x03ff; #endif Loading Loading @@ -1155,11 +1162,13 @@ static void subst_spec( } #ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE if ( element_mode != EVS_MONO ) { /* fractional phase of Xph converted to an integer in the range [0..1023] */ /* in BASOP this is simply a truncation (through extract_l(Word32)) of a 32bit value at the Q16 bimal point + shifting to a 10 bit index */ #define WMC_TOOL_SKIP tmpf = Xph * ( 1.0f / PI2 ); /* normalize : mult() with a constant */ tmpf = ( 1024.0f ) * ( tmpf - floorf( tmpf ) ) + 0.5f; /* obtain fraction : floor(), sub(), mult(), rnd(), out: [0...1024.5[ */ tmpf = ( 1024.0f * ( tmpf - floorf( tmpf ) )) + 0.5f; /* obtain fraction : floor(), sub(), mult(), rnd(), out: [0...1024.5[ */ Xph_short = ( (int16_t) tmpf ) & 0x03ff; /* mask to [0..1023]: s_and() , out: [0...1023] */ MULT( 2 ); Loading @@ -1167,8 +1176,13 @@ static void subst_spec( ADD( 2 ); /* sub, rnd */ LOGIC( 1 ); /* s_and */ #undef WMC_TOOL_SKIP } else { Xph_short = ( int16_t )( Xph * 512 / EVS_PI ) & 0x03ff; /* NB! USAN warning for cast from float to int16_t, no rounding */ } #else Xph_short = (int16_t) ( Xph * 512 / EVS_PI ) & 0x03ff; /* yields out of range for int16 */ Xph_short = (int16_t) ( Xph * 512 / EVS_PI ) & 0x03ff; #endif if ( Xph_short >= 512 ) Loading Loading
lib_dec/FEC_HQ_phase_ecu.c +33 −19 Original line number Diff line number Diff line Loading @@ -1096,9 +1096,11 @@ static void subst_spec( Xph = corr_phase[m]; #ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE if ( element_mode != EVS_MONO ) { #define WMC_TOOL_SKIP tmpf = Xph * ( 1.0f / PI2 ); /* normalize : mult() with a constant */ tmpf = ( 1024.0f ) * ( tmpf - floorf( tmpf ) ) + 0.5f; /* obtain fraction : floor(), sub(), mult(), rnd(), out: [0...1024.5[ */ tmpf = ( 1024.0f * ( tmpf - floorf( tmpf ))) + 0.5f; /* obtain fraction : floor(), sub(), mult(), rnd(), out: [0...1024.5[ */ Xph_short = ( (int16_t) tmpf ) & 0x03ff; /* mask to [0..1023]: s_and() , out: [0...1023] */ MULT( 2 ); Loading @@ -1106,6 +1108,11 @@ static void subst_spec( ADD( 2 ); /* sub, rnd */ LOGIC( 1 ); /* s_and */ #undef WMC_TOOL_SKIP } else { Xph_short = ( int16_t )( ( ( int32_t )( Xph * 512 / EVS_PI ) ) % 32768 ) & 0x03ff; /* WMC-costly % in use, no rounding */ } #else Xph_short = (int16_t) ( ( (int32_t) ( Xph * 512 / EVS_PI ) ) % 32768 ) & 0x03ff; #endif Loading Loading @@ -1155,11 +1162,13 @@ static void subst_spec( } #ifdef FIX_1002_DEC_PHASE_ECU_USAN_OF_PHASE if ( element_mode != EVS_MONO ) { /* fractional phase of Xph converted to an integer in the range [0..1023] */ /* in BASOP this is simply a truncation (through extract_l(Word32)) of a 32bit value at the Q16 bimal point + shifting to a 10 bit index */ #define WMC_TOOL_SKIP tmpf = Xph * ( 1.0f / PI2 ); /* normalize : mult() with a constant */ tmpf = ( 1024.0f ) * ( tmpf - floorf( tmpf ) ) + 0.5f; /* obtain fraction : floor(), sub(), mult(), rnd(), out: [0...1024.5[ */ tmpf = ( 1024.0f * ( tmpf - floorf( tmpf ) )) + 0.5f; /* obtain fraction : floor(), sub(), mult(), rnd(), out: [0...1024.5[ */ Xph_short = ( (int16_t) tmpf ) & 0x03ff; /* mask to [0..1023]: s_and() , out: [0...1023] */ MULT( 2 ); Loading @@ -1167,8 +1176,13 @@ static void subst_spec( ADD( 2 ); /* sub, rnd */ LOGIC( 1 ); /* s_and */ #undef WMC_TOOL_SKIP } else { Xph_short = ( int16_t )( Xph * 512 / EVS_PI ) & 0x03ff; /* NB! USAN warning for cast from float to int16_t, no rounding */ } #else Xph_short = (int16_t) ( Xph * 512 / EVS_PI ) & 0x03ff; /* yields out of range for int16 */ Xph_short = (int16_t) ( Xph * 512 / EVS_PI ) & 0x03ff; #endif if ( Xph_short >= 512 ) Loading