From 1b9528344df6c0046826b2758a07d6c68bb0b575 Mon Sep 17 00:00:00 2001 From: torset Date: Wed, 3 Dec 2008 16:06:44 +0000 Subject: Changes in ifft directory --- src/signalProcessing/ifft/Makefile.am | 2 +- src/signalProcessing/ifft/Makefile.in | 16 +-- src/signalProcessing/ifft/fft842.c | 165 ------------------------------- src/signalProcessing/ifft/fft_internal.h | 2 +- src/signalProcessing/ifft/ifft842.c | 164 ++++++++++++++++++++++++++++++ src/signalProcessing/ifft/zfftma.c | 164 ------------------------------ src/signalProcessing/ifft/zifftma.c | 18 ++-- 7 files changed, 183 insertions(+), 348 deletions(-) delete mode 100644 src/signalProcessing/ifft/fft842.c create mode 100644 src/signalProcessing/ifft/ifft842.c delete mode 100644 src/signalProcessing/ifft/zfftma.c diff --git a/src/signalProcessing/ifft/Makefile.am b/src/signalProcessing/ifft/Makefile.am index b7dfcbdb..c70f6cd9 100644 --- a/src/signalProcessing/ifft/Makefile.am +++ b/src/signalProcessing/ifft/Makefile.am @@ -32,7 +32,7 @@ SRC = zifftma.c \ dfft2.c \ dfftbi.c \ dfftmx.c \ - fft842.c \ + ifft842.c \ r2tx.c \ r4tx.c \ r8tx.c diff --git a/src/signalProcessing/ifft/Makefile.in b/src/signalProcessing/ifft/Makefile.in index ec2602ab..79b80e66 100644 --- a/src/signalProcessing/ifft/Makefile.in +++ b/src/signalProcessing/ifft/Makefile.in @@ -56,7 +56,7 @@ libIfft_la_LIBADD = am__objects_1 = am__objects_2 = libIfft_la-zifftma.lo libIfft_la-cifftma.lo \ libIfft_la-dfft2.lo libIfft_la-dfftbi.lo libIfft_la-dfftmx.lo \ - libIfft_la-fft842.lo libIfft_la-r2tx.lo libIfft_la-r4tx.lo \ + libIfft_la-ifft842.lo libIfft_la-r2tx.lo libIfft_la-r4tx.lo \ libIfft_la-r8tx.lo am_libIfft_la_OBJECTS = $(am__objects_1) $(am__objects_2) libIfft_la_OBJECTS = $(am_libIfft_la_OBJECTS) @@ -228,7 +228,7 @@ SRC = zifftma.c \ dfft2.c \ dfftbi.c \ dfftmx.c \ - fft842.c \ + ifft842.c \ r2tx.c \ r4tx.c \ r8tx.c @@ -348,7 +348,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIfft_la-dfft2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIfft_la-dfftbi.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIfft_la-dfftmx.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIfft_la-fft842.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIfft_la-ifft842.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIfft_la-r2tx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIfft_la-r4tx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIfft_la-r8tx.Plo@am__quote@ @@ -412,12 +412,12 @@ libIfft_la-dfftmx.lo: dfftmx.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libIfft_la_CFLAGS) $(CFLAGS) -c -o libIfft_la-dfftmx.lo `test -f 'dfftmx.c' || echo '$(srcdir)/'`dfftmx.c -libIfft_la-fft842.lo: fft842.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libIfft_la_CFLAGS) $(CFLAGS) -MT libIfft_la-fft842.lo -MD -MP -MF $(DEPDIR)/libIfft_la-fft842.Tpo -c -o libIfft_la-fft842.lo `test -f 'fft842.c' || echo '$(srcdir)/'`fft842.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libIfft_la-fft842.Tpo $(DEPDIR)/libIfft_la-fft842.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fft842.c' object='libIfft_la-fft842.lo' libtool=yes @AMDEPBACKSLASH@ +libIfft_la-ifft842.lo: ifft842.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libIfft_la_CFLAGS) $(CFLAGS) -MT libIfft_la-ifft842.lo -MD -MP -MF $(DEPDIR)/libIfft_la-ifft842.Tpo -c -o libIfft_la-ifft842.lo `test -f 'ifft842.c' || echo '$(srcdir)/'`ifft842.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libIfft_la-ifft842.Tpo $(DEPDIR)/libIfft_la-ifft842.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ifft842.c' object='libIfft_la-ifft842.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libIfft_la_CFLAGS) $(CFLAGS) -c -o libIfft_la-fft842.lo `test -f 'fft842.c' || echo '$(srcdir)/'`fft842.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libIfft_la_CFLAGS) $(CFLAGS) -c -o libIfft_la-ifft842.lo `test -f 'ifft842.c' || echo '$(srcdir)/'`ifft842.c libIfft_la-r2tx.lo: r2tx.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libIfft_la_CFLAGS) $(CFLAGS) -MT libIfft_la-r2tx.lo -MD -MP -MF $(DEPDIR)/libIfft_la-r2tx.Tpo -c -o libIfft_la-r2tx.lo `test -f 'r2tx.c' || echo '$(srcdir)/'`r2tx.c diff --git a/src/signalProcessing/ifft/fft842.c b/src/signalProcessing/ifft/fft842.c deleted file mode 100644 index 2742463f..00000000 --- a/src/signalProcessing/ifft/fft842.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab - * Copyright (C) 2008 - INRIA - Allan SIMON - * - * This file must be used under the terms of the CeCILL. - * This source file is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at - * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt - * - */ - -#include "fft_internal.h" -#include - - - -/* get binary log of integer argument; exact if n a power of 2 */ -static int fastlog2( int n) -{ - int log = -1; - while(n) { - log++; - n >>= 1; - } - return(log); -} - -/* - int in; FORWARD or INVERSE - int n; length of vector - DPCOMPLEX *b; input vector -*/ -void fft842 (doubleComplex* b, int size , int in) -{ - double fn; - doubleComplex temp ; - - int L[16],L1,L2,L3,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13,L14,L15; - int j1,j2,j3,j4,j5,j6,j7,j8,j9,j10,j11,j12,j13,j14; - int i = 0, j, ij, ji, ij1, ji1; - int n2pow, n8pow, nthpo, ipass, nxtlt, lengt; - - n2pow = fastlog2( size ); - nthpo = size ; - fn = nthpo; - - - if(in==INVERSE) - /*scramble inputs*/ - - for(i=0,j=size/2;j + + + +/* get binary log of integer argument; exact if n a power of 2 */ +static int fastlog2( int n) +{ + int log = -1; + while(n) { + log++; + n >>= 1; + } + return(log); +} + +/* + int in; FORWARD or INVERSE + int n; length of vector + DPCOMPLEX *b; input vector +*/ +void ifft842 (doubleComplex* b, int size , int in) +{ + double fn; + doubleComplex temp ; + + int L[16],L1,L2,L3,L4,L5,L6,L7,L8,L9,L10,L11,L12,L13,L14,L15; + int j1,j2,j3,j4,j5,j6,j7,j8,j9,j10,j11,j12,j13,j14; + int i = 0, j, ij, ji, ij1, ji1; + int n2pow, n8pow, nthpo, ipass, nxtlt, lengt; + + n2pow = fastlog2( size ); + nthpo = size ; + fn = nthpo; + + + if(in==INVERSE) + /*scramble inputs*/ + + for(i=0,j=size/2;j - -void zfftma ( doubleComplex* in , int rows, int cols, doubleComplex* out) -{ - -int choosenAlgo = DFFT2 ; - -int size = rows*cols ; -int sizeTemp = 0; -/* -int sizeWorkSpace = size *2; -*/ -int rowsTemp = 0 ; -int colsTemp = 0 ; - -int ierr = 0 ; -int isn = -1; -int i = 0; - - -double* realIn = (double*) malloc ( sizeof (double) * (unsigned int) size ); -double* imagIn = (double*) malloc ( sizeof (double) * (unsigned int) size ); - - -doubleComplex* inTemp = (doubleComplex*) malloc ( sizeof (doubleComplex) * (unsigned int) size ); - -/* -double* workSpace = (double*) malloc ( sizeof (double) * (unsigned int) sizeWorkSpace ); -*/ - - -zimaga ( in , size , imagIn) ; -zreala ( in , size , realIn) ; - -if ( rows == 1 || cols == 1 ) -{ - - /* vector case */ - sizeTemp = (int) pow ( 2 , (int ) (log( size + 0.5 ) /log ( 2 ))) ; - - - - if ( size == sizeTemp ) - { - if ( size <= pow ( 2 , 15 )) - { - /* if the size is a power of 2 and inferior to 2^15 */ - fft842 ( in , size , 0 ); - choosenAlgo = FFT842 ; - } - else - { - /* if the size is a power of 2 and superior to 2^15 */ - dfft2 ( realIn , imagIn , 1 , size , 1 , isn , ierr /*, workSpace , sizeWorkSpace*/ ); - } - - - } - else - { - /* all other case of vector */ - dfft2 ( realIn , imagIn , 1 , size , 1 , isn , ierr /*, workSpace , sizeWorkSpace */); - } - -} - -/* matrix case */ -else -{ - - rowsTemp = (int) pow ( 2 , log( rows + 0.5) /log ( 2 )) ; - colsTemp = (int) pow ( 2 , log( cols + 0.5) /log ( 2 )) ; - - if ( cols == colsTemp) - { - if ( cols <= pow ( 2 , 15 )) - { - for ( i = 0 ; i < rows ; i++ ) - { - fft842 ( &in[ cols*i] , cols , 0); - choosenAlgo = FFT842 ; - } - } - else - { - dfft2 ( realIn, imagIn ,rows , cols , 1 , isn , ierr/* ,workSpace , sizeWorkSpace */); - } - } - else - { - dfft2 ( realIn, imagIn ,rows , cols , 1 , isn , ierr/* ,workSpace , sizeWorkSpace*/ ); - } - - /*second call*/ - - if ( 2*rows <= 0 /* sizeWorkSpace*/ ) - { - if ( rowsTemp == rows ) - { - if ( rows <= pow ( 2 ,15) ) - { - /*compute the fft on each line of the matrix */ - for (i = 0 ; i < cols ; i++ ) - { - C2F(zcopy) ( rows, in + i, cols, inTemp , 1 ); - - fft842( inTemp , rows , 0); - choosenAlgo = FFT842 ; - C2F(zcopy) ( rows, inTemp , cols, in + i, 1 ); - - } - } - else - { - dfft2 ( realIn, imagIn, 1, rows, cols, isn, ierr/*, workSpace, sizeWorkSpace*/); - } - } - else - { - dfft2 ( realIn, imagIn, 1, rows, cols, isn, ierr/*, workSpace, sizeWorkSpace*/); - } - } - else - { - dfft2 ( realIn, imagIn, 1, rows, cols, isn, ierr/*, workSpace, sizeWorkSpace*/); - } -} - -/* here we copy the result into the output , there are two cases because fft842 take a the complex matrix in one block - and dfft2 separate real and imaginary part */ - -if ( choosenAlgo == FFT842 ) - { - for ( i = 0 ; i < size ; i++) - { - out[i] = DoubleComplex ( zreals(in[i]) , zimags(in[i]) ); - } - } -else - { - for ( i = 0 ; i < size ; i++) - { - out[i] = DoubleComplex ( realIn[i] , imagIn[i] ); - } - - } - - -} diff --git a/src/signalProcessing/ifft/zifftma.c b/src/signalProcessing/ifft/zifftma.c index 4ddac539..7af615a7 100644 --- a/src/signalProcessing/ifft/zifftma.c +++ b/src/signalProcessing/ifft/zifftma.c @@ -9,7 +9,7 @@ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt * */ -#define FFT842 1 +#define IFFT842 1 #define DFFT2 0 #include "ifft.h" @@ -58,9 +58,9 @@ if ( rows == 1 || cols == 1 ) { if ( size <= pow ( 2 , 15 )) { - printf ( "we call fft842 \n" ) ; - fft842 ( in , size , 1 ); - choosenAlgo = FFT842 ; + printf ( "we call ifft842 \n" ) ; + ifft842 ( in , size , 1 ); + choosenAlgo = IFFT842 ; } else { @@ -90,8 +90,8 @@ else { for ( i = 0 ; i < rows ; i++ ) { - fft842 ( &in[ cols*i] , cols , 1); - choosenAlgo = FFT842 ; + ifft842 ( &in[ cols*i] , cols , 1); + choosenAlgo = IFFT842 ; } } else @@ -117,8 +117,8 @@ else { C2F(zcopy) ( rows, in + i, cols, inTemp , 1 ); - fft842( inTemp , rows , 1); - choosenAlgo = FFT842 ; + ifft842( inTemp , rows , 1); + choosenAlgo = IFFT842 ; C2F(zcopy) ( rows, inTemp , cols, in + i, 1 ); } @@ -141,7 +141,7 @@ else -if ( choosenAlgo == FFT842 ) +if ( choosenAlgo == IFFT842 ) { for ( i = 0 ; i < size ; i++) { -- cgit