nl

Capsim Block Documentation

Short Description

Normalized Lattice Filter

Top
Input Connections
Port Type Name
0 float x
Top
Output Connections
Port Type Name
0 float y
Top
Parameters
Num Description Type Name Default Value
0 File with normalized lattice filter parameters file file_name tmp.lat
Top
States
Num Type Name Initial Value Description
0 FILE* fp
1 float* k
2 float* c
3 float* nu
4 float* xb
5 int n
6 float wsc
7 float wnorm
8 float fs
Top

Declarations


 

	int buffer_no;
	FILE *fopen();
        float xf,ysum,sum,tmp;
        int n1,n2,i,j,m;
	int	noSamples;



Top

Initialization Code



 

		if(strcmp(file_name,"stdin") == 0)
			fp = stdin;
		else if((fp = fopen(file_name,"r")) == NULL)
			return(1); /* nl() file cannot be opened */
	     /*****************************************************
		   read lattice filter parameters from file
	      ****************************************************/
	     fscanf(fp,"%d",&n);
	     n1=n+1;
	     /*   allocate work space      */
	     if(((k=(float*)calloc(n,sizeof(float))) == NULL) ||
		((c=(float*)calloc(n,sizeof(float))) == NULL) ||
		((nu=(float*)calloc(n1,sizeof(float))) == NULL) ||
		((xb=(float*)calloc(n1,sizeof(float))) == NULL )) {
		fprintf(stderr,"nl(): can't allocate work space \n");
		return(1);
    	     }
 	     for (i=0; i
    
Top

Main Code



 


     for(noSamples=MIN_AVAIL();noSamples >0; --noSamples) {
     	  IT_IN(0);
	  xf=x(0);
          for (m=0; m
    
Top

Wrapup Code



 

	free(k);
	free(nu);
	free(c);
	free(xb);




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



 

/*************************************************************
			Normalized Lattice Filter
				nl()
***************************************************************

nl


Normalized Lattice Filter


Programmer: Sasan H Ardalan
Date: August 22,1987

*/