Capsim Block Documentation
This star computes the ONE-SIDED FFT of a complex stream which is overlapped by an amount of (fftl-M) samples for each FFT computation. It outputs ((int)((totalNumberofPoints - fftl)/M)+1)*fftl/2 points. The totalNumberofPoints denotes the number of points in the complex input
| Port | Type | Name | |
|---|---|---|---|
| 0 | complex | x |
| Port | Type | Name | |
|---|---|---|---|
| 0 | complex | y |
| Num | Description | Type | Name | Default Value | |
|---|---|---|---|---|---|
| 0 | Size of FFT | int | npts | 128 | |
| 1 | Delay between Windows | int | M | 10 | |
| 2 | Window Type: 0 = Rectangular, 1 = Hanning | int | windowType | 0 |
int no_samples; complex calc; int i,j; float w; |
|---|
/*
* compute the power of 2 number of fft points
*/
fftexp = (int) (log((float)npts)/log(2.0)+0.5);
fftl = 1 << fftexp;
if (fftl > npts ) {
fftl = fftl/2;
fftexp -= 1;
}
if (fftl < 2)
{
fprintf(stderr,"fft: fft length is too short \n");
return(1);
}
norm=1.0/(float)fftl;
if ((fftBuffer = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL)
{
fprintf(stderr,"slidefft: can't allocate work space \n");
return(2);
}
if ((cxoutBuff = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL)
{
fprintf(stderr,"slidefft: can't allocate work space \n");
return(3);
}
cfg=cap_fft_alloc(fftl,0,NULL,NULL);
if ((dataBuffer = (complex*)calloc(fftl,sizeof(complex))) == NULL)
{
fprintf(stderr,"fft: can't allocate work space \n");
return(4);
}
if ((tempBuffer = (complex*)calloc(fftl,sizeof(complex))) == NULL)
{
fprintf(stderr,"fft: can't allocate work space \n");
return(5);
}
SET_CELL_SIZE_IN(0,sizeof(complex));
SET_CELL_SIZE_OUT(0,sizeof(complex));
|
|---|
for (no_samples = MIN_AVAIL(); no_samples > 0; --no_samples)
{
/*
* real input buffer
*/
j=pointCount;
IT_IN(0);
dataBuffer[j]=x(0);
pointCount++;
if(checkFlag == 0)
{
/*
* Get enough points
*/
if(pointCount >= fftl)
{
for (i=0; i |
|---|
/*
* free up allocated space
*/
free((cap_fft_cpx*)fftBuffer);
free((cap_fft_cpx*)cxoutBuff);
free((char*)tempBuffer);
free((char*)dataBuffer);
|
|---|
/* Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks)
Copyright (C) 1989-2002 XCAD Corporation
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
http://capsimtmk.sourceforge.net
XCAD Corporation
Raleigh, North Carolina */
|
|---|
/* slidefft.s */
/***********************************************************************
slidefft()
************************************************************************
Inputs: x complex
Outputs: y, the fft of the signal complex
Parameters: int inpts the fft length
int M delay between windows
int windowType window type before fft
************************************************************************
This star computes the ONE-SIDED FFT of a complex stream which is
overlapped by an amount of (fftl-M) samples for each FFT computation.
It outputs ((int)((totalNumberofPoints - fftl)/M)+1)*fftl/2 points. The
totalNumberofPoints denotes the number of points in the complex input
data stream.
Programmer: Jeyhan Karaoguz
Date: June 5, 1992
*/
|
|---|