mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-05-27 21:20:27 -04:00
*** empty log message ***
This commit is contained in:
parent
f492f40cb7
commit
18d0ad1604
10
Makefile
10
Makefile
@ -5,11 +5,11 @@ TARBALL=kiss_fft_v$(KFVER).tar.gz
|
||||
ZIPFILE=kiss_fft_v$(KFVER).zip
|
||||
|
||||
testall:
|
||||
# The simd and long types may or may not work on your machine
|
||||
#export DATATYPE=simd && cd test && make test
|
||||
#export DATATYPE=long && cd test && make test
|
||||
|
||||
export DATATYPE=short && cd test && make test
|
||||
# The simd and int32_t types may or may not work on your machine
|
||||
export DATATYPE=simd && cd test && make test
|
||||
export DATATYPE=int32_t && cd test && make test
|
||||
|
||||
export DATATYPE=int16_t && cd test && make test
|
||||
export DATATYPE=float && cd test && make test
|
||||
export DATATYPE=double && cd test && make test
|
||||
|
||||
|
@ -44,16 +44,15 @@ struct kiss_fft_state{
|
||||
#ifdef FIXED_POINT
|
||||
#if (FIXED_POINT==32)
|
||||
# define FRACBITS 31
|
||||
# define SAMPPROD long long
|
||||
#define SAMP_MAX LONG_MAX
|
||||
#define SAMP_MIN LONG_MIN
|
||||
# define SAMPPROD int64_t
|
||||
#define SAMP_MAX 2147483647
|
||||
#else
|
||||
# define FRACBITS 15
|
||||
# define SAMPPROD long
|
||||
#define SAMP_MAX SHRT_MAX
|
||||
#define SAMP_MIN SHRT_MIN
|
||||
# define SAMPPROD int32_t
|
||||
#define SAMP_MAX 32767
|
||||
#endif
|
||||
|
||||
#define SAMP_MIN -SAMP_MAX
|
||||
|
||||
#if defined(CHECK_OVERFLOW)
|
||||
# define CHECK_OVERFLOW_OP(a,op,b) \
|
||||
@ -126,8 +125,8 @@ struct kiss_fft_state{
|
||||
|
||||
|
||||
#ifdef FIXED_POINT
|
||||
# define KISS_FFT_COS(phase) (kiss_fft_scalar) (SAMP_MAX * cos (phase))
|
||||
# define KISS_FFT_SIN(phase) (kiss_fft_scalar) (SAMP_MAX * sin (phase))
|
||||
# define KISS_FFT_COS(phase) floor(.5+SAMP_MAX * cos (phase))
|
||||
# define KISS_FFT_SIN(phase) floor(.5+SAMP_MAX * sin (phase))
|
||||
# define HALF_OF(x) ((x)>>1)
|
||||
#elif defined(USE_SIMD)
|
||||
# define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) )
|
||||
|
@ -34,10 +34,11 @@ extern "C" {
|
||||
|
||||
|
||||
#ifdef FIXED_POINT
|
||||
#include <sys/types.h>
|
||||
# if (FIXED_POINT == 32)
|
||||
# define kiss_fft_scalar long
|
||||
# define kiss_fft_scalar int32_t
|
||||
# else
|
||||
# define kiss_fft_scalar short
|
||||
# define kiss_fft_scalar int16_t
|
||||
# endif
|
||||
#else
|
||||
# ifndef kiss_fft_scalar
|
||||
|
@ -26,11 +26,11 @@ SELFTESTSRC=twotonetest.c
|
||||
|
||||
TYPEFLAGS=-Dkiss_fft_scalar=$(DATATYPE)
|
||||
|
||||
ifeq "$(DATATYPE)" "short"
|
||||
ifeq "$(DATATYPE)" "int16_t"
|
||||
TYPEFLAGS=-DFIXED_POINT=16
|
||||
endif
|
||||
|
||||
ifeq "$(DATATYPE)" "long"
|
||||
ifeq "$(DATATYPE)" "int32_t"
|
||||
TYPEFLAGS=-DFIXED_POINT=32
|
||||
endif
|
||||
|
||||
|
@ -18,17 +18,25 @@ doreal=0
|
||||
|
||||
datatype = os.environ.get('DATATYPE','float')
|
||||
|
||||
util = '../tools/fft'
|
||||
fmt='f'
|
||||
util = '../tools/fft_' + datatype
|
||||
minsnr=90
|
||||
if datatype == 'double':
|
||||
util = '../tools/fft_double'
|
||||
fmt='d'
|
||||
elif datatype=='short':
|
||||
util = '../tools/fft_short'
|
||||
elif datatype=='int16_t':
|
||||
fmt='h'
|
||||
minsnr=10
|
||||
|
||||
elif datatype=='int32_t':
|
||||
fmt='l'
|
||||
elif datatype=='simd':
|
||||
fmt='4f'
|
||||
sys.stderr.write('testkiss.py does not yet test simd')
|
||||
sys.exit(0)
|
||||
elif datatype=='float':
|
||||
fmt='f'
|
||||
else:
|
||||
sys.stderr.write('unrecognized datatype %s\n' % datatype)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def dopack(x,cpx=1):
|
||||
x = Numeric.reshape( x, ( Numeric.size(x),) )
|
||||
@ -73,7 +81,7 @@ def randmat( ndims ):
|
||||
|
||||
def test_fft(ndims):
|
||||
if ndims == 1:
|
||||
nfft = int(random.uniform(50,520))
|
||||
nfft = int(random.uniform(50,100))
|
||||
if doreal:
|
||||
nfft = int(nfft/2)*2
|
||||
|
||||
@ -108,9 +116,12 @@ def dofft(x):
|
||||
iscomp = (type(x[0]) == complex)
|
||||
|
||||
scale=1
|
||||
if datatype=='short':
|
||||
if datatype=='int16_t':
|
||||
x = 32767 * x
|
||||
scale = len(x) / 32767.0
|
||||
elif datatype=='int32_t':
|
||||
x = 2147483647.0 * x
|
||||
scale = len(x) / 2147483647.0
|
||||
|
||||
cmd='%s -n ' % util
|
||||
cmd += ','.join([str(d) for d in dims])
|
||||
|
@ -6,11 +6,11 @@ ifeq "$(DATATYPE)" ""
|
||||
DATATYPE=float
|
||||
endif
|
||||
|
||||
ifeq "$(DATATYPE)" "long"
|
||||
ifeq "$(DATATYPE)" "int32_t"
|
||||
TYPEFLAGS=-DFIXED_POINT=32
|
||||
endif
|
||||
|
||||
ifeq "$(DATATYPE)" "short"
|
||||
ifeq "$(DATATYPE)" "int16_t"
|
||||
TYPEFLAGS=-DFIXED_POINT=16
|
||||
endif
|
||||
|
||||
@ -23,19 +23,11 @@ ifeq "$(TYPEFLAGS)" ""
|
||||
endif
|
||||
|
||||
|
||||
ifeq "$(DATATYPE)" "float"
|
||||
FFTUTIL=fft
|
||||
FASTFILT=fastconv
|
||||
FASTFILTREAL=fastconvr
|
||||
PSDPNG=psdpng
|
||||
DUMPHDR=dumphdr
|
||||
else
|
||||
FFTUTIL=fft_$(DATATYPE)
|
||||
FASTFILT=fastconv_$(DATATYPE)
|
||||
FASTFILTREAL=fastconvr_$(DATATYPE)
|
||||
PSDPNG=psdpng_$(DATATYPE)
|
||||
DUMPHDR=dumphdr_$(DATATYPE)
|
||||
endif
|
||||
FFTUTIL=fft_$(DATATYPE)
|
||||
FASTFILT=fastconv_$(DATATYPE)
|
||||
FASTFILTREAL=fastconvr_$(DATATYPE)
|
||||
PSDPNG=psdpng_$(DATATYPE)
|
||||
DUMPHDR=dumphdr_$(DATATYPE)
|
||||
|
||||
all: $(FFTUTIL) $(FASTFILT) $(FASTFILTREAL)
|
||||
# $(PSDPNG)
|
||||
|
Loading…
Reference in New Issue
Block a user