From 624f8edfd3ce60908439078f9958c8a62bf29cdf Mon Sep 17 00:00:00 2001 From: Mark Borgerding Date: Thu, 26 Feb 2004 02:58:10 +0000 Subject: [PATCH] piddly little changes to fastfir stuff --- test/fastfir.py | 4 ++-- tools/kiss_fastfir.c | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/test/fastfir.py b/test/fastfir.py index bbe029a..ad9ce40 100755 --- a/test/fastfir.py +++ b/test/fastfir.py @@ -89,9 +89,9 @@ def utilfastfilter(sig,h,nfft,usereal): open( 'sig.dat','w').write( compfft.dopack(sig,'f',not usereal) ) open( 'h.dat','w').write( compfft.dopack(h,'f',not usereal) ) if usereal: - util = './ffr_float' + util = './fastconvr' else: - util = './ff_float' + util = './fastconv' cmd = 'time %s -n %d -i sig.dat -h h.dat -o out.dat' % (util, nfft) print cmd ec = os.system(cmd) diff --git a/tools/kiss_fastfir.c b/tools/kiss_fastfir.c index ec1fbc8..08d3215 100644 --- a/tools/kiss_fastfir.c +++ b/tools/kiss_fastfir.c @@ -320,6 +320,7 @@ void direct_file_filter( free (circbuf); } + void do_file_filter( FILE * fin, FILE * fout, @@ -327,6 +328,7 @@ void do_file_filter( size_t n_imp_resp, size_t nfft ) { + int fdin,fdout; size_t n_samps_buf; void * cfg; @@ -334,10 +336,15 @@ void do_file_filter( size_t nread,nwrite; size_t idx_inbuf; + fdout = fileno(fout); + cfg=kiss_fastfir_alloc(imp_resp,n_imp_resp,&nfft,0,0); /* use length to minimize buffer shift*/ - n_samps_buf = nfft + 5*(nfft-n_imp_resp+1); + n_samps_buf = 8*4096/sizeof(kffsamp_t); + n_samps_buf = nfft + 4*(nfft-n_imp_resp+1); + + fprintf(stderr,"bufsize=%d\n",sizeof(kffsamp_t)*n_samps_buf ); /*allocate space and initialize pointers */ inbuf = (kffsamp_t*)malloc(sizeof(kffsamp_t)*n_samps_buf); @@ -346,14 +353,14 @@ void do_file_filter( idx_inbuf=0; do{ /* start reading at inbuf[idx_inbuf] */ - nread = fread( inbuf + idx_inbuf, sizeof(kffsamp_t), n_samps_buf - idx_inbuf , fin ); + nread = fread( inbuf + idx_inbuf, sizeof(kffsamp_t), n_samps_buf - idx_inbuf,fin ); /* If nread==0, then this is a flush. The total number of samples in input is idx_inbuf + nread . */ - nwrite = kiss_fastfir(cfg, inbuf, outbuf,nread,&idx_inbuf); + nwrite = kiss_fastfir(cfg, inbuf, outbuf,nread,&idx_inbuf) * sizeof(kffsamp_t); /* kiss_fastfir moved any unused samples to the front of inbuf and updated idx_inbuf */ - if ( fwrite( outbuf, sizeof(outbuf[0]), nwrite, fout) != nwrite ) { + if ( write(fdout, outbuf, nwrite) != nwrite ) { perror("short write"); exit(1); }