Capsim Block Documentation
Compute signal to distortion ratio
Num | Type | Name | Description |
---|---|---|---|
0 | float | BlockName_sdr | The Signal to Distortion(Noise) Ratio |
int samples; int i,j; float tmp; float wind; char title1[80]; float sdr,sdrdB; float norm; char theName[100]; #ifdef TCL_SUPPORT Tcl_Obj *varNameObj_P; Tcl_Obj *objVar_P; #endif |
---|
/* * allocate arrays */ xpts = (float* )calloc(npts,sizeof(float)); ypts = (float* )calloc(npts,sizeof(float)); if(ibufs > 1) { fprintf(stderr,"plot: only one input allowed \n"); return(5); } /* store as state the number of input/output buffers */ if((ibufs = NO_INPUT_BUFFERS()) <= 0) { fprintf(stderr,"plot: no inputs connected\n"); return(2); } if((obufs = NO_OUTPUT_BUFFERS()) > ibufs) { fprintf(stderr,"plot: too many outputs connected\n"); return(3); } /* * 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; } spect = (float* )calloc(2*fftl,sizeof(float)); cfg=cap_fft_alloc(fftl,0,NULL,NULL); if ((cxinBuff = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL) { fprintf(stderr,"cmxfft: can't allocate work space \n"); return(6); } if ((cxoutBuff = (cap_fft_cpx*)calloc(fftl,sizeof(cap_fft_cpx))) == NULL) { fprintf(stderr,"cmxfft: can't allocate work space \n"); return(7); } |
---|
for(samples = MIN_AVAIL(); samples > 0; --samples) { for(i=0; i |
---|
free((cap_fft_cpx*)cxinBuff); free((cap_fft_cpx*)cxoutBuff); free((char*)spect); |
---|
/* 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 */ |
---|
/* sdr.s */ /********************************************************************** sdr() *********************************************************************** inputs: (One channel) outputs: (optional feed-through of input channels) parameters: int npts, the number of points to use int skip, number of points to skip before calculation window flag (0=Rect 1= Hamming) ************************************************************************* Programmer: Sasan Ardalan Date: 2/16/89 Modified: L.J. Faber 1/3/89. Add flow through; general cleanup. */ |
---|