Commit 97b17e51 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

use 32b sin_cos

parent fe8d6785
Loading
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -306,13 +306,22 @@ void fft_rel_16_32fx(
    Word16 i_subfr,
    const Word16 n, /* i  : vector length          */
    const Word16 m  /* i  : log2 of vector length  */
#ifdef FFT_PREC32
    ,
    Word32 x32[],
    Word16 *q_x32
#endif
)
{
    Word16 i, j, k, n1, n2, n4;
    Word16 step;
    Word32 xt, t1, t2;
    Word32 *x0, *x1, *x2;
#ifdef FFT_PREC32
    const Word32 *s32, *c32;
#else
    const Word16 *s, *c;
#endif
    Word32 *xi2, *xi3, *xi4, *xi1;

    Word32 fft_bff32[L_FFT];
@@ -404,8 +413,13 @@ void fft_rel_16_32fx(
            move32(); /* x[i+n2+n4] = -x[i+n2+n4];     */


#ifdef FFT_PREC32
            s32 = sincos_t_fx32 + step; // Q31
            c32 = s32 + 64;             // Q31
#else
            s = sincos_t_fx + step; // Q15
            c = s + 64;             // Q15
#endif
            xi1 = fft_bff32 + add( i, 1 );
            xi3 = xi1 + n2;
            xi2 = xi3 - 2;
@@ -413,8 +427,13 @@ void fft_rel_16_32fx(

            FOR( j = 1; j < n4; j++ )
            {
#ifdef FFT_PREC32
                t1 = L_add( Mpy_32_32( *xi3, *c32 ), Mpy_32_32( *xi4, *s32 ) ); /* t1 = *xi3**(pt_c+ind) + *xi4**(pt_s+ind); Qx  */
                t2 = L_sub( Mpy_32_32( *xi3, *s32 ), Mpy_32_32( *xi4, *c32 ) ); /* t2 = *xi3**(pt_s+ind) - *xi4**(pt_c+ind); Qx    */
#else
                t1 = L_add( Mpy_32_16_1( *xi3, *c ), Mpy_32_16_1( *xi4, *s ) ); /* t1 = *xi3**(pt_c+ind) + *xi4**(pt_s+ind); Qx  */
                t2 = L_sub( Mpy_32_16_1( *xi3, *s ), Mpy_32_16_1( *xi4, *c ) ); /* t2 = *xi3**(pt_s+ind) - *xi4**(pt_c+ind); Qx    */
#endif
                *xi4 = L_sub( *xi2, t2 );
                move32();
                *xi3 = L_negate( L_add( *xi2, t2 ) );
@@ -428,8 +447,13 @@ void fft_rel_16_32fx(
                xi2--;
                xi3++;
                xi1++;
#ifdef FFT_PREC32
                c32 += step;
                s32 += step; /* autoincrement by ar0 */
#else
                c += step;
                s += step; /* autoincrement by ar0 */
#endif
            }

            x0 += n1;
@@ -443,6 +467,11 @@ void fft_rel_16_32fx(
    {
        Copy_Scale_sig32_16( fft_bff32, x, L_FFT, norm );
        *q_x = sub( norm, 16 );

#ifdef FFT_PREC32
        Copy_Scale_sig32( fft_bff32, x32, L_FFT, norm );
        *q_x32 = norm;
#endif
        move16();
    }
    ELSE
@@ -458,6 +487,21 @@ void fft_rel_16_32fx(
        {
            Copy_Scale_sig32_16( fft_bff32, x, L_FFT, add( 16, *q_x ) );
        }

#ifdef FFT_PREC32
        IF( LT_16( norm, *q_x32 ) )
        {
            scale_sig32( x32 - L_FFT, L_FFT, sub( norm, *q_x32 ) );
            Copy_Scale_sig32( fft_bff32, x32, L_FFT, norm );
            *q_x32 = norm;
            move16();
        }
        ELSE
        {
            Copy_Scale_sig32( fft_bff32, x32, L_FFT, *q_x32 );
        }
#endif

    }

    return;
+9 −2
Original line number Diff line number Diff line
@@ -41,10 +41,10 @@

/* ################### Start DEBUGGING switches ######################## */

/*#define DEBUGGING*/                             /* Allows debugging message to be printed out during runtime */
#define DEBUGGING                             /* Allows debugging message to be printed out during runtime */
#ifdef DEBUGGING
#define DEBUG_MODE_INFO                       /* Define to output most important parameters to the subdirectory "res/" */
#define DEBUG_MODE_INFO_TWEAK                 /* Enable command line switch to specify subdirectory for debug info output inside "./res/" */
//#define DEBUG_MODE_INFO_TWEAK                 /* Enable command line switch to specify subdirectory for debug info output inside "./res/" */
#define DEBUG_FORCE_MDCT_STEREO_MODE          /* Force stereo mode decision for MDCT stereo: -stereo 3 1 forces L/R coding and -stereo 3 2 forces full M/S coding */
/*#define DEBUG_FORCE_DIR*/                       /* Force modes/parameters by reading from external binary files */
/*#define DBG_WAV_WRITER*/                    /* Enable dbgwrite_wav() function for generating ".wav" files */
@@ -61,6 +61,13 @@
/*#define MEM_COUNT_DETAILS*/                   /* Output detailed memory analysis for the worst-case frame (writes to the file "mem_analysis.csv") */
#endif


//#define ENFORCE_float_PS
//#define ENFORCE_float_fft
#define ENFORCE_float_inp_12k8
#define ENFORCE_float_smc_vad
#define FFT_PREC32

/* #################### End DEBUGGING switches ############################ */

#ifndef BASOP_NOGLOB_DEV_USE_GLOBALS
+5 −0
Original line number Diff line number Diff line
@@ -1534,6 +1534,11 @@ void fft_rel_16_32fx(
    Word16 i_subfr,
    const Word16 n, /* i  : vector length          */
    const Word16 m  /* i  : log2 of vector length  */
#ifdef FFT_PREC32
    ,
    Word32 x32[],
    Word16 *q_x32
#endif
);
void fft_rel_fx32(
    Word32 x[],     /* i/o: i  /output vector    */
+39 −0
Original line number Diff line number Diff line
@@ -1002,6 +1002,45 @@ const Word16 sincos_t_fx[161] =
  -20787,	  -21403,	  -22005,	  -22594,	  -23170,
};
#ifdef FFT_PREC32
const Word32 sincos_t_fx32[161] =
{
 /* Q31 */
 0,
 52701887, 105372028, 157978697, 210490206, 262874923,
 315101295, 367137861, 418953276, 470516330, 521795963,
 572761285, 623381598, 673626408, 723465451, 772868706,
 821806413, 870249095, 918167572, 965532978, 1012316784,
 1058490808, 1104027237, 1148898640, 1193077991, 1236538675,
 1279254516, 1321199781, 1362349204, 1402678000, 1442161874,
 1480777044, 1518500250, 1555308768, 1591180426, 1626093616,
  1660027308, 1692961062, 1724875040, 1755750017, 1785567396,
 1814309216, 1841958164, 1868497586, 1893911494, 1918184581,
 1941302225, 1963250501, 1984016189, 2003586779, 2021950484,
 2039096241, 2055013723, 2069693342, 2083126254, 2095304370,
 2106220352, 2115867626, 2124240380, 2131333572, 2137142927,
 2141664948, 2144896910, 2146836866, 2147483647, 2146836866,
 2144896910, 2141664948, 2137142927, 2131333572, 2124240380,
 2115867626, 2106220352, 2095304370, 2083126254, 2069693342,
 2055013723, 2039096241, 2021950484, 2003586779, 1984016189,
 1963250501, 1941302225, 1918184581, 1893911494, 1868497586,
 1841958164, 1814309216, 1785567396, 1755750017, 1724875040,
 1692961062, 1660027308, 1626093616, 1591180426, 1555308768,
 1518500250, 1480777044, 1442161874, 1402678000, 1362349204,
 1321199781, 1279254516, 1236538675, 1193077991, 1148898640,
 1104027237, 1058490808, 1012316784, 965532978, 918167572,
 870249095, 821806413, 772868706, 723465451, 673626408,
 623381598, 572761285, 521795963, 470516330, 418953276,
 367137861, 315101295, 262874923, 210490206, 157978697,
 105372028, 52701887, 0, -52701887, -105372028,
 -157978697, -210490206, -262874923, -315101295, -367137861,
 -418953276, -470516330, -521795963, -572761285, -623381598,
 -673626408, -723465451, -772868706, -821806413, -870249095,
 -918167572, -965532978, -1012316784, -1058490808, -1104027237,
 -1148898640, -1193077991, -1236538675, -1279254516, -1321199781,
 -1362349204, -1402678000, -1442161874, -1480777044, -1518500250
 };
#endif
/*----------------------------------------------------------------------------------*
 * Sinus & Cosinus - table for the FFT and IFFT of 1024 points,  value range [0 ... sin(-5pi/4)]
+3 −0
Original line number Diff line number Diff line
@@ -167,6 +167,9 @@ extern const FrameSizeParams FrameSizeConfig[FRAME_SIZE_NB];

extern const Word16 h_high_fx[5];      // Q15
extern const Word16 sincos_t_fx[161];  // Q15
#ifdef FFT_PREC32
extern const Word32 sincos_t_fx32[161]; // Q31
#endif
extern const Word16 sincos_t_ext_fx[]; // Q15
extern const Word32 crit_bands_fx[];
extern const float sincos_t_ext[];         // fft_rel dep
Loading