slidefft

Capsim Block Documentation

Short Description

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

Top
Input Connections
Port Type Name
0 complex x
Top
Output Connections
Port Type Name
0 complex y
Top
Parameters
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
Top
States
Num Type Name Initial Value Description
0 int fftexp
1 int fftl
2 cap_fft_cpx* fftBuffer
3 complex* dataBuffer
4 complex* tempBuffer
5 cap_fft_cpx* cxoutBuff
6 cap_fft_cfg cfg
7 float norm
8 int pointCount 0
9 int checkFlag 0
Top

Declarations


 

	int no_samples;
	complex calc;
	int i,j;
	float w;



Top

Initialization Code



 

/*
 * 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));




Top

Main Code



 

	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= M)
			{
				for (i=0; i
    
Top

Wrapup Code



 

	/* 
	 * free up allocated space	
	 */
	free((cap_fft_cpx*)fftBuffer);
	free((cap_fft_cpx*)cxoutBuff);
        free((char*)tempBuffer);
        free((char*)dataBuffer);




Top

License



/*  Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks)
    Copyright (C) 1989-2017  Silicon DSP 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://www.silicondsp.com
    Silicon DSP  Corporation
    Las Vegas, Nevada
*/


Top

Description



 

/* 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
*/