Commit 5831e5bf authored by Jonas Svedberg's avatar Jonas Svedberg
Browse files

added element_mode != EVS_MONO logic

parent fa2b3f81
Loading
Loading
Loading
Loading
Loading
+33 −19
Original line number Diff line number Diff line
@@ -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 );
@@ -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
@@ -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 );
@@ -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 )