Commit 525f8562 authored by multrus's avatar multrus
Browse files

[cleanup] accept HARMONIZE_DoRTFTn

parent 55d4a3dc
Loading
Loading
Loading
Loading
+0 −307
Original line number Diff line number Diff line
@@ -87,9 +87,6 @@
 *-----------------------------------------------------------------*/

static void cdftForw( Word16 n, Word32 *a, const Word16 *ip, const Word16 *w );
#ifndef HARMONIZE_DoRTFTn
static void bitrv2_SR( Word16 n, const Word16 *ip, Word32 *a );
#endif
static void cftfsub( Word16 n, Word32 *a, const Word16 *w );
static void cft1st( Word16 n, Word32 *a, const Word16 *w );
static void cftmdl( Word16 n, Word16 l, Word32 *a, const Word16 *w );
@@ -1548,11 +1545,7 @@ static void fft5_4(
 * a low complexity 2-dimensional DFT of 80 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT80_fx(
#else
void DoRTFT80_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1579,11 +1572,7 @@ void DoRTFT80_fx(
 * a low complexity 2-dimensional DFT of 120 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT120_fx(
#else
void DoRTFT120_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1610,11 +1599,7 @@ void DoRTFT120_fx(
 * a low complexity 2-dimensional DFT of 160 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT160_fx(
#else
void DoRTFT160_fx(
#endif
    Word32 x[], /* i/o: real part of input and output data Qx      */
    Word32 y[]  /* i/o: imaginary part of input and output data Qx */
)
@@ -1641,11 +1626,7 @@ void DoRTFT160_fx(
 * a low complexity 2-dimensional DFT of 320 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT320_fx(
#else
void DoRTFT320_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1672,11 +1653,7 @@ void DoRTFT320_fx(
 * a low complexity 2-dimensional DFT of 480 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT480_fx(
#else
void DoRTFT480_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1703,11 +1680,7 @@ void DoRTFT480_fx(
 * a low complexity 2-dimensional DFT of 40 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT40_fx(
#else
void DoRTFT40_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1733,11 +1706,7 @@ void DoRTFT40_fx(
 * a low complexity 2-dimensional DFT of 20 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT20_fx(
#else
void DoRTFT20_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1764,11 +1733,7 @@ void DoRTFT20_fx(
 * FFT with 128 points
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void DoRTFT128_fx(
#else
void DoRTFT128_fx(
#endif
    Word32 *x, /* i/o: real part of input and output data Qx      */
    Word32 *y  /* i/o: imaginary part of input and output data Qx */
)
@@ -1815,11 +1780,7 @@ static void cdftForw(
)
{
    /* bit reversal */
#ifdef HARMONIZE_DoRTFTn
    bitrv2_SR_fx( n, ip + 2, a );
#else
    bitrv2_SR( n, ip + 2, a );
#endif

    /* Do FFT */
    cftfsub( n, a, w );
@@ -1828,209 +1789,6 @@ static void cdftForw(
}


#ifndef HARMONIZE_DoRTFTn
/*-----------------------------------------------------------------*
 * bitrv2_SR()
 * Bit reversal
 *-----------------------------------------------------------------*/

static void bitrv2_SR(
    Word16 n,         /* i  : data length of real and imag Q0 */
    const Word16 *ip, /* i/o: work area for bit reversal Q0   */
    Word32 *a         /* i/o: input/output data Qx            */
)
{
    Word16 j, j1, k, k1, m, m2;
    Word16 l;
    Word32 xr, xi, yr, yi;

    IF( EQ_16( n, 64 ) )
    {
        m = 4;
        move16();
        l = -1;
        move16();
    }
    ELSE IF( EQ_16( n, 256 ) )
    {
        m = 8;
        move16();
        l = -1;
        move16();
    }
    ELSE IF( EQ_16( n, 16 ) )
    {
        m = 2;
        move16();
        l = -1;
        move16();
    }
    ELSE
    {
        l = n;
        move16();
        m = 1;
        move16();

        WHILE( ( m << 3 ) < l )
        {
            l = shr( l, 1 );
            m = shl( m, 1 );
        }
        l = sub( l, shl( m, 3 ) );
    }

    m2 = shl( m, 1 );

    IF( l == 0 )
    {
        FOR( k = 0; k < m; k++ )
        {
            FOR( j = 0; j < k; j++ )
            {
                j1 = add( shl( j, 1 ), ip[k] );
                k1 = add( shl( k, 1 ), ip[j] );
                xr = a[j1]; // Qx
                move32();
                xi = a[j1 + 1]; // Qx
                move32();
                yr = a[k1]; // Qx
                move32();
                yi = a[k1 + 1]; // Qx
                move32();
                a[j1] = yr; // Qx
                move32();
                a[j1 + 1] = yi; // Qx
                move32();
                a[k1] = xr; // Qx
                move32();
                a[k1 + 1] = xi; // Qx
                move32();
                j1 = add( j1, m2 );
                k1 = add( k1, 2 * m2 );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
                j1 = add( j1, m2 );
                k1 = sub( k1, m2 );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
                j1 = add( j1, m2 );
                k1 = add( k1, shl( m2, 1 ) );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
            }

            j1 = add( shl( k, 1 ), add( m2, ip[k] ) );
            k1 = add( j1, m2 );
            xr = a[j1];
            move32();
            xi = a[j1 + 1];
            move32();
            yr = a[k1];
            move32();
            yi = a[k1 + 1];
            move32();
            a[j1] = yr;
            move32();
            a[j1 + 1] = yi;
            move32();
            a[k1] = xr;
            move32();
            a[k1 + 1] = xi;
            move32();
        }
    }
    ELSE
    {
        FOR( k = 1; k < m; k++ )
        {
            FOR( j = 0; j < k; j++ )
            {
                j1 = add( shl( j, 1 ), ip[k] );
                k1 = add( shl( k, 1 ), ip[j] );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
                j1 = add( j1, m2 );
                k1 = add( k1, m2 );
                xr = a[j1];
                move32();
                xi = a[j1 + 1];
                move32();
                yr = a[k1];
                move32();
                yi = a[k1 + 1];
                move32();
                a[j1] = yr;
                move32();
                a[j1 + 1] = yi;
                move32();
                a[k1] = xr;
                move32();
                a[k1 + 1] = xi;
                move32();
            }
        }
    }

    return;
}
#endif

/*-----------------------------------------------------------------*
 * cftfsub()
@@ -2474,63 +2232,6 @@ static void cftmdl(
    return;
}

#ifndef HARMONIZE_DoRTFTn
void DoRTFTn_fx_ivas(
    Word32 *x,     /* i/o: real part of input and output data Qx      */
    Word32 *y,     /* i/o: imaginary part of input and output data Qx */
    const Word16 n /* i  : size of the FFT up to 1024 Q0*/
)
{
    Word16 i;
    Word32 z[2048];

    FOR( i = 0; i < n; i++ )
    {
        z[2 * i] = x[i]; // Qx
        move32();
        z[( ( i << 1 ) + 1 )] = y[i]; // Qx
        move32();
    }

    SWITCH( n )
    {
        case ( 16 ):
            cdftForw( 2 * n, z, Ip_fft16, w_fft16_fx );
            BREAK;
        case ( 32 ):
            cdftForw( 2 * n, z, Ip_fft32, w_fft32_fx );
            BREAK;
        case ( 64 ):
            cdftForw( 2 * n, z, Ip_fft64, w_fft64_fx );
            BREAK;
        case ( 128 ):
            cdftForw( 2 * n, z, Ip_fft128, w_fft128_fx );
            BREAK;
        case ( 256 ):
            cdftForw( 2 * n, z, Ip_fft256, w_fft256_fx );
            BREAK;
        case ( 512 ):
            cdftForw( 2 * n, z, Ip_fft512, w_fft512_fx );
            BREAK;
        default:
            assert( 0 );
    }

    x[0] = z[0]; // Qx
    move32();
    y[0] = z[1]; // Qx
    move32();
    FOR( i = 1; i < n; i++ )
    {
        x[( n - i )] = z[2 * i];
        move32();
        y[( n - i )] = z[( ( i << 1 ) + 1 )];
        move32();
    }

    return;
}
#endif

static void rfft_post(
    const Word16 *sine_table, // Q15
@@ -3516,11 +3217,7 @@ void DoFFT_fx(
            DoRTFT320_fx( re2, im2 );
            BREAK;
        case 256:
#ifdef HARMONIZE_DoRTFTn
            DoRTFTn_fx( re2, im2, NULL, 256 );
#else
            DoRTFTn_fx_ivas( re2, im2, 256 );
#endif
            BREAK;
        case 240:
            DoRTFT240( re2, im2 );
@@ -3544,11 +3241,7 @@ void DoFFT_fx(
            DoRTFT80_fx( re2, im2 );
            BREAK;
        case 64:
#ifdef HARMONIZE_DoRTFTn
            DoRTFTn_fx( re2, im2, NULL, 64 );
#else
            DoRTFTn_fx_ivas( re2, im2, 64 );
#endif
            BREAK;
        case 40:
            DoRTFT40_fx( re2, im2 );
+0 −31
Original line number Diff line number Diff line
@@ -37,9 +37,6 @@ static void fft5_32_16fx( Word16 *zRe, Word16 *zIm, const Word16 *Idx );
static void cdftForw_16fx( Word16 n, Word16 *a, const Word16 *ip, const Word32 *w );

static void cdftForw_fx( Word16 n, Word32 *a, const Word16 *ip, const Word16 *w );
#ifndef HARMONIZE_DoRTFTn
static void bitrv2_SR_fx( Word16 n, const Word16 *ip, Word32 *a );
#endif
static void cftfsub_fx( Word16 n, Word32 *a, const Word16 *w );
static void cft1st_fx( Word16 n, Word32 *a, const Word16 *w );
static void cftmdl_fx( Word16 n, Word16 l, Word32 *a, const Word16 *w );
@@ -86,51 +83,27 @@ void DoRTFTn_fx(

    IF( EQ_16( n, 16 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft16, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft16, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 32 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft32, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft32, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 64 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft64, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft64, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 128 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft128, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft128, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 256 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft256, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft256, w_fft512_fx_evs );
#endif
    }
    ELSE IF( EQ_16( n, 512 ) )
    {
#ifdef HARMONIZE_DoRTFTn
        cdftForw_fx( 2 * n, z, Ip_fft512, w_fft512_fx );
#else
        cdftForw_fx( 2 * n, z, Ip_fft512, w_fft512_fx_evs );
#endif
    }
    ELSE
    {
@@ -197,11 +170,7 @@ static void cdftForw_fx(
 * Bit reversal
 *-----------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
void bitrv2_SR_fx(
#else
static void bitrv2_SR_fx(
#endif
    Word16 n,         /* i    : data length of real and imag              */
    const Word16 *ip, /* i/o  : work area for bit reversal                */
    Word32 *a         /* i/o  : input/output data                     Q(q)*/
+0 −21
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@

#define IVAS_ONE_BY_IMDCT_SCALING_GAIN_Q16 0x08432A51 /* 1 / 2115.165304808f */

#ifdef HARMONIZE_DoRTFTn

/*------------------------------------------------------------------------------------------*
 * Local functions prototypes
@@ -62,7 +61,6 @@

static void ivas_get_twid_factors_fx( const Word16 length, const Word16 **pTwid_re, const Word16 **pTwid_im );

#endif

/*-----------------------------------------------------------------------------------------*
 * Function ivas_tda_fx()
@@ -162,11 +160,7 @@ void ivas_mdct_fx(
    len_by_2 = shr( length, 1 );
    ivas_mdct_scaling_gain = ivas_get_mdct_scaling_gain_fx( len_by_2 ); // Q46

#ifdef HARMONIZE_DoRTFTn
    ivas_get_twid_factors_fx( length, &pTwid_re, &pTwid_im );
#else
    ivas_get_twid_factors_fx1( length, &pTwid_re, &pTwid_im );
#endif

    FOR( i = 0; i < len_by_2; i++ )
    {
@@ -311,11 +305,7 @@ void ivas_imdct_fx(
    Word32 im[IVAS_480_PT_LEN];
    len_by_2 = shr( length, 1 );

#ifdef HARMONIZE_DoRTFTn
    ivas_get_twid_factors_fx( length, &pTwid_re, &pTwid_im );
#else
    ivas_get_twid_factors_fx1( length, &pTwid_re, &pTwid_im );
#endif
    FOR( i = 0; i < len_by_2; i++ )
    {
        re[i] = L_add( Mpy_32_16_1( pIn[length - 2 * i - 1], pTwid_re[i] ), Mpy_32_16_1( pIn[2 * i], pTwid_im[i] ) ); /*stl_arr_index  Q24*/
@@ -372,11 +362,7 @@ void ivas_imdct_fx(
 * Sets/Maps the fft twiddle tables based on fft length
 *-----------------------------------------------------------------------------------------*/

#ifdef HARMONIZE_DoRTFTn
static void ivas_get_twid_factors_fx(
#else
void ivas_get_twid_factors_fx1(
#endif
    const Word16 length,      // Q0
    const Word16 **pTwid_re,  // Q15
    const Word16 **pTwid_im ) // Q15
@@ -396,13 +382,6 @@ void ivas_get_twid_factors_fx1(
        *pTwid_re = (const Word16 *) &ivas_cos_twiddle_160_fx[0]; // Q15
        *pTwid_im = (const Word16 *) &ivas_sin_twiddle_160_fx[0]; // Q15
    }
#ifndef HARMONIZE_DoRTFTn
    ELSE IF( EQ_16( length, 80 ) )
    {
        *pTwid_re = (const Word16 *) &ivas_cos_twiddle_80_fx[0]; // Q15
        *pTwid_im = (const Word16 *) &ivas_sin_twiddle_80_fx[0]; // Q15
    }
#endif
    ELSE
    {
        assert( !"Not supported FFT length!" );
+0 −8
Original line number Diff line number Diff line
@@ -216,14 +216,6 @@ void ivas_dct_windowing_fx(
    Word32 *pTemp_lfe 
);

#ifndef HARMONIZE_DoRTFTn
void ivas_get_twid_factors_fx1(
    const Word16 length,     // Q0
    const Word16 **pTwid_re, // Q15
    const Word16 **pTwid_im 
);

#endif
Word32 ivas_get_mdct_scaling_gain_fx(
    const Word16 dct_len_by_2 
);
+0 −4
Original line number Diff line number Diff line
@@ -504,10 +504,6 @@ extern const Word16 ivas_sin_twiddle_320_fx[IVAS_320_PT_LEN >> 1];
extern const Word16 ivas_cos_twiddle_320_fx[IVAS_320_PT_LEN >> 1];
extern const Word16 ivas_sin_twiddle_160_fx[IVAS_160_PT_LEN >> 1];
extern const Word16 ivas_cos_twiddle_160_fx[IVAS_160_PT_LEN >> 1];
#ifndef HARMONIZE_DoRTFTn
extern const Word16 ivas_sin_twiddle_80_fx[IVAS_80_PT_LEN >> 1];
extern const Word16 ivas_cos_twiddle_80_fx[IVAS_80_PT_LEN >> 1];
#endif
extern const Word16 nf_tw_smoothing_coeffs_fx[N_LTP_GAIN_MEMS];
extern const Word32 dft_res_gains_q_fx[][2];
extern const Word16 dft_res_cod_alpha_fx[STEREO_DFT_BAND_MAX];
Loading