Commit d6a3cca3 authored by norvell's avatar norvell
Browse files

Format lib_com/fft_evs.c, resolve include of constants

parent ba0e860d
Loading
Loading
Loading
Loading
Loading
+1691 −1696
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
/************************************************************************/
/* FFT                                                                  */
/************************************************************************/

#if 0
#define SCALEFACTORN2   ( 3 )
#define SCALEFACTOR2    ( 2 )
#define SCALEFACTOR3    ( 3 )
@@ -48,6 +48,10 @@
#define SCALEFACTOR400  ( 10 )
#define SCALEFACTOR480  ( 11 )
#define SCALEFACTOR600  ( 10 )
#endif
// Todo: Resolve include of these constants. Some of them are included via prot_fx1.h, cnst.h.
#define SCALEFACTOR16 ( 5 )
#define SCALEFACTOR20 ( 5 )


void fft16_with_cmplx_data( cmplx *pInp, Word16 bsacle );
@@ -116,15 +120,15 @@ void fft16_with_cmplx_data( cmplx *pInp, Word16 bsacle);
#define C166 ( FFTC( 0xcf043ab3 ) ) /* FL2WORD32(-3.826834323650898e-1) -COS_3PI_DIV8 */


#define cplxMpy4_8_0(re,im,a,b,c,d)   re = L_shr(L_sub(Mpy_32_xx(a,c),Mpy_32_xx(b,d)),1); \
#define cplxMpy4_8_0( re, im, a, b, c, d )                          \
    re = L_shr( L_sub( Mpy_32_xx( a, c ), Mpy_32_xx( b, d ) ), 1 ); \
    im = L_shr( L_add( Mpy_32_xx( a, d ), Mpy_32_xx( b, c ) ), 1 );

#define cplxMpy4_8_1(re,im,a,b)       re = L_shr(a,1); \
#define cplxMpy4_8_1( re, im, a, b ) \
    re = L_shr( a, 1 );              \
    im = L_shr( b, 1 );




/**
 * \brief    Function performs a complex 5-point FFT
 *           The FFT is performed inplace. The result of the FFT
@@ -181,7 +185,6 @@ static void fft5_with_cmplx_data(cmplx *inp)
#if ( WMOPS )
    multiCounter[currCounter].CL_move += 5;
#endif

}

/**
@@ -262,8 +265,6 @@ static void fft8_with_cmplx_data(cmplx *inp)
#if ( WMOPS )
    multiCounter[currCounter].CL_move += 8;
#endif
	

}


@@ -373,7 +374,6 @@ static void fft10_with_cmplx_data(cmplx *inp_data)
#if ( WMOPS )
    multiCounter[currCounter].CL_move += 10;
#endif

}


@@ -479,7 +479,6 @@ static void fft15_with_cmplx_data(cmplx *inp_data)
    c_z14 = CL_mac_j( c_y1, c_y2 );



    /* 1. FFT3 stage */

    c_y1 = CL_add( c_z5, c_z10 );
@@ -526,7 +525,6 @@ static void fft15_with_cmplx_data(cmplx *inp_data)
#if ( WMOPS )
    multiCounter[currCounter].CL_move += 15;
#endif

}


@@ -687,7 +685,6 @@ void fft16_with_cmplx_data(cmplx *input, Word16 bScale )
            y[14] = CL_sub( t0, t4 );
            y[15] = CL_mac_j( t2, t7 );
        }

    }

    x0 = CL_scale_t( y[11], C162 );
@@ -759,7 +756,6 @@ void fft16_with_cmplx_data(cmplx *input, Word16 bScale )
#if ( WMOPS )
    multiCounter[currCounter].CL_move += 16;
#endif

}


@@ -1008,7 +1004,6 @@ static void fft20_with_cmplx_data(cmplx *inp_data)
#if ( WMOPS )
    multiCounter[currCounter].CL_move += 20;
#endif
	
}


@@ -1329,14 +1324,16 @@ static void fft30_with_cmplx_data(cmplx * inp)
    rs2 = CL_shr( z[15], SCALEFACTOR30_2 );
    *l = CL_add( rs1, rs2 );
    *h = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 2. FFT2 stage */
    rs1 = CL_shr( z[8], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[23], SCALEFACTOR30_2 );
    *h = CL_add( rs1, rs2 );
    *l = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;


    /* 3. FFT2 stage */
@@ -1344,7 +1341,8 @@ static void fft30_with_cmplx_data(cmplx * inp)
    rs2 = CL_shr( z[16], SCALEFACTOR30_2 );
    *l = CL_add( rs1, rs2 );
    *h = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;


    /* 4. FFT2 stage */
@@ -1352,89 +1350,100 @@ static void fft30_with_cmplx_data(cmplx * inp)
    rs2 = CL_shr( z[24], SCALEFACTOR30_2 );
    *h = CL_add( rs1, rs2 );
    *l = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 5. FFT2 stage */
    rs1 = CL_shr( z[2], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[17], SCALEFACTOR30_2 );
    *l = CL_add( rs1, rs2 );
    *h = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 6. FFT2 stage */
    rs1 = CL_shr( z[10], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[25], SCALEFACTOR30_2 );
    *h = CL_add( rs1, rs2 );
    *l = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 7. FFT2 stage */
    rs1 = CL_shr( z[3], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[18], SCALEFACTOR30_2 );
    *l = CL_add( rs1, rs2 );
    *h = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 8. FFT2 stage */
    rs1 = CL_shr( z[11], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[26], SCALEFACTOR30_2 );
    *h = CL_add( rs1, rs2 );
    *l = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 9. FFT2 stage */
    rs1 = CL_shr( z[4], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[19], SCALEFACTOR30_2 );
    *l = CL_add( rs1, rs2 );
    *h = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 10. FFT2 stage */
    rs1 = CL_shr( z[12], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[27], SCALEFACTOR30_2 );
    *h = CL_add( rs1, rs2 );
    *l = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 11. FFT2 stage */
    rs1 = CL_shr( z[5], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[20], SCALEFACTOR30_2 );
    *l = CL_add( rs1, rs2 );
    *h = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 12. FFT2 stage */
    rs1 = CL_shr( z[13], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[28], SCALEFACTOR30_2 );
    *h = CL_add( rs1, rs2 );
    *l = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 13. FFT2 stage */
    rs1 = CL_shr( z[6], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[21], SCALEFACTOR30_2 );
    *l = CL_add( rs1, rs2 );
    *h = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 14. FFT2 stage */
    rs1 = CL_shr( z[14], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[29], SCALEFACTOR30_2 );
    *h = CL_add( rs1, rs2 );
    *l = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

    /* 15. FFT2 stage */
    rs1 = CL_shr( z[7], SCALEFACTOR30_2 );
    rs2 = CL_shr( z[22], SCALEFACTOR30_2 );
    *l = CL_add( rs1, rs2 );
    *h = CL_sub( rs1, rs2 );
    l+=1; h+=1;
    l += 1;
    h += 1;

#if ( WMOPS )
    multiCounter[currCounter].CL_move += 30;
#endif

}

/**
@@ -1808,8 +1817,6 @@ static void fft32_with_cmplx_data(cmplx * inp)
#if ( WMOPS )
    multiCounter[currCounter].CL_move += 32;
#endif


}


@@ -1838,8 +1845,7 @@ static void fftN2(
    Word16 dim2,
    Word16 sc,
    Word32 *x,
	Word16 Woff
)
    Word16 Woff )
{
    Word16 i, j;
    cmplx *x_cmplx = (cmplx *) x;
@@ -2003,7 +2009,6 @@ static void fftN2(
                pComplexBuf[i + 5 * dim1] = CL_sub( s5, s6 );
                pComplexBuf[i + 6 * dim1] = CL_add( s2, s3 );
                pComplexBuf[i + 7 * dim1] = CL_sub( s4, s7 );

            }

            BREAK;
@@ -2035,7 +2040,6 @@ static void fftN2(
                        pComplexBuf[i + j * dim1] = y[j];
                    }
                }

            }
            BREAK;
        }
@@ -2069,7 +2073,6 @@ static void fftN2(
                    pComplexBuf[i + j * dim1] = y[j];
                }
            }

        }
            BREAK;

@@ -2104,7 +2107,6 @@ static void fftN2(
                        pComplexBuf[i + j * dim1] = y[j];
                    }
                }

            }
            ELSE
            {
@@ -2134,14 +2136,12 @@ static void fftN2(
                        pComplexBuf[i + j * dim1] = y[j];
                    }
                }

            }
            BREAK;
    }
#if ( WMOPS )
    multiCounter[currCounter].CL_move += len;
#endif

}


@@ -2300,7 +2300,6 @@ void BASOP_cfft(cmplx *pComplexBuf, Word16 sizeOfFft, Word16 *scale, Word32 x[2*
}



#define RFFT_TWIDDLE1( x, t1, t2, t3, t4, w1, w2, xb0, xb1, xt0, xt1 ) \
    {                                                                  \
        xb0 = L_shr( x[2 * i + 0], 2 );                                \
@@ -2359,7 +2358,6 @@ void BASOP_rfft(Word32 *x, Word16 sizeOfFft, Word16 *scale, Word16 isign)
    Word32 workBuffer[2 * BASOP_CFFT_MAX_LENGTH];



    sizeOfFft2 = shr( sizeOfFft, 1 );
    sizeOfFft4 = shr( sizeOfFft, 2 );
    sizeOfFft8 = shr( sizeOfFft, 3 );
@@ -2510,7 +2508,4 @@ void BASOP_rfft(Word32 *x, Word16 sizeOfFft, Word16 *scale, Word16 isign)
            move16();
            BREAK;
    }

}