Capsim Block Documentation
Normalized Lattice Filter
| Port | Type | Name | |
|---|---|---|---|
| 0 | float | x |
| Port | Type | Name | |
|---|---|---|---|
| 0 | float | y |
| Num | Description | Type | Name | Default Value | |
|---|---|---|---|---|---|
| 0 | File with normalized lattice filter parameters | file | file_name | tmp.lat |
| 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 |
int buffer_no;
FILE *fopen();
float xf,ysum,sum,tmp;
int n1,n2,i,j,m;
int noSamples;
|
|---|
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 |
|---|
for(noSamples=MIN_AVAIL();noSamples >0; --noSamples) {
IT_IN(0);
xf=x(0);
for (m=0; m |
|---|
free(k); free(nu); free(c); free(xb); |
|---|
/* 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 */
|
|---|
/************************************************************* Normalized Lattice Filter nl() *************************************************************** |
|---|