shithub: aacenc

Download patch

ref: 15da6ef6d3db1c0ac7e0324e113c68c72e05e5cc
parent: daefb182cc05a8f0dd27620d3a4d1492282a1e7e
author: knik <knik@users.sourceforge.net>
date: Mon Jul 31 06:45:01 EDT 2017

fft.c: cleanup

--- a/libfaac/fft.c
+++ b/libfaac/fft.c
@@ -68,40 +68,6 @@
 
 void rfft( FFT_Tables *fft_tables, double *x, int logm )
 {
-#if 0
-/* sur: do not use real-only optimized FFT */
-    double xi[1 << MAXLOGR];
-
-    int nfft;
-
-    if ( logm > MAXLOGR )
-	{
-		fprintf(stderr, "rfft size too big\n");
-		exit(1);
-	}
-
-    nfft = logm_to_nfft[logm];
-
-    if ( nfft )
-    {
-        //unsigned int i;
-        //for ( i = 0; i < nfft; i++ )
-        //{
-        //    xi[i] = 0.0;
-        //}
-	    memset( xi, 0, nfft * sizeof( xi[0] ) );
-
-	    fft( fft_tables, x, xi, logm );
-
-	    memcpy( x + nfft / 2, xi, ( nfft / 2 ) * sizeof(x[0]) );
-    }
-    else
-    {
-        fprintf( stderr, "bad config for logm = %d\n", logm);
-        exit( 1 );
-    }
-
-#else
 /* sur: use real-only optimized FFT */
 
     int nfft = 0;
@@ -152,7 +118,6 @@
         fprintf( stderr, "bad config for logm = %d\n", logm);
         exit( 1 );
     }
-#endif
 }
 
 void fft( FFT_Tables *fft_tables, double *xr, double *xi, int logm )
@@ -262,211 +227,6 @@
     }
 }
 
-/* sur: Trying to use cfft from libfaad2 -- it does not work 'from scratch' */
-//
-//#include "cfft/common.h"
-//
-//void fft_initialize( FFT_Tables *fft_tables )
-//{
-//    memset( fft_tables->cfft, 0, sizeof( fft_tables->cfft ) );
-//}
-//void fft_terminate( FFT_Tables *fft_tables )
-//{
-//    unsigned int i;
-//    for ( i = 0; i < sizeof( fft_tables->cfft ) / sizeof( fft_tables->cfft[0] ); i++ )
-//    {
-//        if ( fft_tables->cfft[i] )
-//        {
-//            cfftu( fft_tables->cfft[i] );
-//            fft_tables->cfft[i] = NULL;
-//        }
-//    }
-//}
-//
-//void rfft( FFT_Tables *fft_tables, double *x, int logm )
-//{
-//	double xi[1 << MAXLOGR];
-//
-//    int nfft;
-//
-//    if ( logm > MAXLOGR )
-//	{
-//		fprintf(stderr, "rfft size too big\n");
-//		exit(1);
-//	}
-//
-//    nfft = logm_to_nfft[logm];
-//
-//    if ( nfft )
-//    {
-//        unsigned int i;
-//
-//        for ( i = 0; i < nfft; i++ )
-//        {
-//            xi[i] = 0.0;
-//        }
-//	    //memset( xi, 0, nfft * sizeof( xi[0] ) );
-//
-//	    fft( fft_tables, x, xi, logm );
-//
-//	    memcpy( x + nfft / 2, xi, ( nfft / 2 ) * sizeof(x[0]) );
-//
-//#ifdef SUR_DEBUG_FFT
-//        {
-//            FILE* f = fopen( "fft.log", "at" );
-//            
-//            fprintf( f, "RFFT(%d)\n", nfft );
-//            
-//            for ( i = 0; i < nfft; i++ )
-//            {
-//                fprintf( f, ";%d;%g;%g\n", i, x[i], xi[i] );
-//            }
-//
-//            fclose( f );
-//        }
-//#endif
-//    }
-//    else
-//    {
-//        fprintf( stderr, "bad config for logm = %d\n", logm);
-//        exit( 1 );
-//    }
-//}
-//
-//void fft( FFT_Tables *fft_tables, double *xr, double *xi, int logm )
-//{
-//    int nfft;
-//
-//    complex_t c[1 << MAXLOGM];
-//
-//    if ( logm > MAXLOGM )
-//	{
-//		fprintf(stderr, "fft size too big\n");
-//		exit(1);
-//	}
-//
-//    nfft = logm_to_nfft[logm];
-//
-//    if ( fft_tables->cfft[logm] == NULL )
-//    {
-//        if ( nfft )
-//        {
-//            fft_tables->cfft[logm] = cffti( nfft );
-//        }
-//        else
-//        {
-//	    	fprintf(stderr, "bad logm = %d\n", logm);
-//            exit( 1 );
-//        }
-//    }
-//
-//    if ( fft_tables->cfft[logm] )
-//    {
-//        unsigned int i;
-//        
-//        for ( i = 0; i < nfft; i++ )
-//        {
-//            RE( c[i] ) = xr[i];    
-//            IM( c[i] ) = xi[i];
-//        }
-//        
-//        cfftf( fft_tables->cfft[logm], c );
-//
-//        for ( i = 0; i < nfft; i++ )
-//        {
-//            xr[i]   = RE( c[i] );
-//            xi[i]   = IM( c[i] );
-//        }
-//
-//#ifdef SUR_DEBUG_FFT
-//        {
-//            FILE* f = fopen( "fft.log", "at" );
-//            
-//            fprintf( f, "FFT(%d)\n", nfft );
-//            
-//            for ( i = 0; i < nfft; i++ )
-//            {
-//                fprintf( f, ";%d;%g;%g\n", i, xr[i], xi[i] );
-//            }
-//
-//            fclose( f );
-//        }
-//#endif
-//    }
-//    else
-//    {
-//        fprintf( stderr, "bad config for logm = %d\n", logm);
-//        exit( 1 );
-//    }
-//}
-//
-//void ffti( FFT_Tables *fft_tables, double *xr, double *xi, int logm )
-//{
-//    int nfft;
-//
-//    complex_t c[1 << MAXLOGM];
-//
-//    if ( logm > MAXLOGM )
-//	{
-//		fprintf(stderr, "fft size too big\n");
-//		exit(1);
-//	}
-//
-//    nfft = logm_to_nfft[logm];
-//
-//    if ( fft_tables->cfft[logm] == NULL )
-//    {
-//        if ( nfft )
-//        {
-//            fft_tables->cfft[logm] = cffti( nfft );
-//        }
-//        else
-//        {
-//	    	fprintf(stderr, "bad logm = %d\n", logm);
-//            exit( 1 );
-//        }
-//    }
-//    
-//    if ( fft_tables->cfft[logm] )
-//    {
-//        unsigned int i;
-//        
-//        for ( i = 0; i < nfft; i++ )
-//        {
-//            RE( c[i] )  = xr[i];    
-//            IM( c[i] )  = xi[i];
-//        }
-//        
-//        cfftb( fft_tables->cfft[logm], c );
-//
-//        for ( i = 0; i < nfft; i++ )
-//        {
-//            xr[i]   = RE( c[i] );
-//            xi[i]   = IM( c[i] );
-//        }
-//
-//#ifdef SUR_DEBUG_FFT
-//        {
-//            FILE* f = fopen( "fft.log", "at" );
-//            
-//            fprintf( f, "FFTI(%d)\n", nfft );
-//            
-//            for ( i = 0; i < nfft; i++ )
-//            {
-//                fprintf( f, ";%d;%g;%g\n", i, xr[i], xi[i] );
-//            }
-//
-//            fclose( f );
-//        }
-//#endif
-//    }
-//    else
-//    {
-//        fprintf( stderr, "bad config for logm = %d\n", logm);
-//        exit( 1 );
-//    }
-//}
-
 #else /* !defined DRM || defined DRM_1024 */
 
 void fft_initialize( FFT_Tables *fft_tables )
@@ -677,28 +437,3 @@
 }
 
 #endif /* defined DRM && !defined DRM_1024 */
-
-/*
-$Log: fft.c,v $
-Revision 1.12  2005/02/02 07:49:55  sur
-Added interface to kiss_fft library to implement FFT for 960 transform length.
-
-Revision 1.11  2004/04/02 14:56:17  danchr
-fix name clash w/ libavcodec: fft_init -> fft_initialize
-bump version number to 1.24 beta
-
-Revision 1.10  2003/11/16 05:02:51  stux
-moved global tables from fft.c into hEncoder FFT_Tables. Add fft_init and fft_terminate, flowed through all necessary changes. This should remove at least one instance of a memory leak, and fix some thread-safety problems. Version update to 1.23.3
-
-Revision 1.9  2003/09/07 16:48:01  knik
-reduced arrays size
-
-Revision 1.8  2002/11/23 17:32:54  knik
-rfft: made xi a local variable
-
-Revision 1.7  2002/08/21 16:52:25  knik
-new simplier and faster fft routine and correct real fft
-new real fft is just a complex fft wrapper so it is slower than optimal but
-by surprise it seems to be at least as fast as the old buggy function
-
-*/