cmxifft

Capsim Block Documentation

Short Description

This star produces the inverse fft of the input signal. The points are output as complex numbers.

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
Top
States
Num Type Name Initial Value Description
0 int fftexp
1 int fftl
2 float norm
3 cap_fft_cpx* cxinBuff
4 cap_fft_cpx* cxoutBuff
5 cap_fft_cfg cfg
6 int pointCount 0
Top

Declarations


 

	int no_samples;
	complex calc;
	int i,j;



Top

Initialization Code



 

fftl=npts;
norm=1.0/(float)fftl;

if (fftl < 2)
{
		fprintf(stderr,"cmxifft: fft length is too short \n");
		return(1);
}
cfg=cap_fft_alloc(fftl,1,NULL,NULL);
if ((cxinBuff = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL)
{
	fprintf(stderr,"cmxifft: can't allocate work space \n");
	return(2);
}
if ((cxoutBuff = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL)
{
	fprintf(stderr,"cmxifft: can't allocate work space \n");
	return(3);
}
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);
		cxinBuff[j].r=x(0).re;
		cxinBuff[j].i=x(0).im;
		pointCount++;

			

		/* 
		 * Get enough points				
		 */
		if(pointCount >= fftl )
		{
			/* 
			 * perform fft calculation		
			 */
                        cap_fft(cfg, cxinBuff, cxoutBuff);

			
			/* 
			 * now, output complex pairs		
			 */
			for (i=0; i
    
Top

Wrapup Code



 

	/* 
	 * free up allocated space	
	 */
	free((char*)cxinBuff);
	free((char*)cxoutBuff);




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



 

/* cmxifft.s */
/***********************************************************************
                             cmxifft()
************************************************************************
	Inputs:		x complex
	Outputs:	y, the fft of the signal complex
	Parameters:	int inpts  the fft length
************************************************************************
This star produces the inverse fft of the input signal.  The points are output
as complex numbers.  The number of points input is npts and the number
of points generated is npts;
Programmer: 	Prayson Pate
Date: 		April 15, 1988
Modified:	April 18, 1988
Modified:	Sasan Ardalan to use cxfft() routine, use complex buffers.
*/