*********************************************
** intel Native Signal Processing Library **
** (Version 4) Interface Unit **
**********************************************
Author: Robert Rossmair
Wagelwitz, Rodaer Str. 6
04688 Mutzschen
Germany
e-mail: Robert.Rossmair@t-online.de
Version: 4.0.2, 16-Apr-1998
History:
17-Sep-1997: First release (lib version 3 interface)
11-Feb-1998: Thanks to a hint from Boris Sabanin, a calling
convention incompatibility between Delphi and NSP.DLL
has been detected. Due to that incompatibility, with
version 17-SEP-1997 all functions having SCplx type
results will return wrong values. Work-arounds using
assembler code wrappers have been implemented.
In addition, I corrected some oversights.
23-Feb-1998:
Another hint from Boris Sabanin caused me to replace
all occurences of "Result" in inline assembler code
by "@Result" to make it work with {$X-} ("extended
syntax off" compiler directive).
01-Mar-1998:
Boris Sabanin pointed me to another oversight:
Some constants defined in nspcvrt.h (NSP_Round..
NSP_OvfErr) are in octal notation. This has not
been taken into account in prior versions.
I fixed NSP.pas in this respect.
05-Apr-1998:
Declaration of TNspFourierTrOptions revised;
there was an error in the previous version
affecting all flags >= NSP_InRcPerm.
###################################
### SPL version 4 compatibility ###
###################################
10-Apr-1998: Version 4.0.1
Line #5773 in V4.0.0
function _nspscLms(var State: TNSPLmsState; Samp: Float; Err: TSCplx): TSCplx; external nspl;
has been corrected to
function _nspscLms(var State: TNSPLmsState; Samp: Float; Err: TSCplx): TSCplx; external nspl name 'nspscLms';
16-Apr-98: Version 4.0.2
An error in the declaration of nspzbMag has been corrected
This file imports all of the 918 procedures and functions exported
by NSP.DLL. It is an Object Pascal translation of the NSP library
header files.
Use, modification and distribution is allowed without limitation,
warranty, or liability of any kind.
**********************************************************************) (*==== NSP Library Control Symbols =========================================
nsp_UsesVector: vector/scalar Zero,Set,Copy,Add,Sub,Mpy,Div,Conj
b<,Inv>Tresh<1,2>,bAbs<1,2>,bAdd<2,3>,bExp<1,2>,bLn<1,2>,
bMpy<2,3>, bSqr<1,2>, bSqrt<1,2>, Max, Mean, Min, StDev
bConj<,Extend><1,2>, bConjFlip2
bLawToLin, bLinToLaw
AutoCorr, CrossCorr , Norm, Normalize
nsp_UsesConversion: bImag, bReal, bCplxTo2Real, b2RealToCplx,
b<,r>Mag, b<,rPhase>,
bFloatTo,
bToFloat,
b<,r>CartToPolar, b<,r>PolarToCart
nsp_UsesConvolution:Conv
Conv2D
Filter2D
nsp_UsesDct: Dct
nsp_UsesTransform: Dft
Fft<,Nip>, Fftl<,Nip>, MpyRC<2,3>
<,2>Fft<,Nip>
Goertz
nsp_UsesFir: struct FirState,FirInit<,Mr>,FirFree,Fir
struct FirState, Sample,
FirlInit<,Mr,Dlyl>, Firl, Firl
nsp_UsesFirGen: nspdFirLowpass, nspdFirHighpass, nspdFirBandpass
nspdFirBandstop
nsp_UsesIir: struct IirState, IirlInit<,Bq,Dlyl>, Iirl
struct IirState, IirInit<,Bq>, Iir, IirFree
nsp_UsesLms: struct LmsState, LmslInit<,Mr,Dlyl>,
Lmsl, Lmsl<,Na>
nsp_UsesMisc: BitRevTbl,BitRev,
TwdTbl
nsp_UsesSampleGen: struct ToneState, ToneInit, Tone
struct TrnglState, TrnglInit, Trngl
bRandUni, RandUni, RandUniInit
bRandGauss, RandGauss, RandGausInit
nsp_UsesWin: Win,Kaiser>
nsp_UsesWavelet: WtInit, WtFilterInit, WtSetState, WtGetState,
WtDecompose, WtReconstruct */
=========================================================================nspALawToMuLaw -
nspBitRev - RCS: $Source: nspmisc.
nspcAdd - nsparith, // PVCS: $Workfile: NSPARITH.
nspCalcBitRevTbl -
nspcAutoCorr -
nspcb2RealToCplx - FUNCTION: */ nspb2RealToCplx */ DESCRIPTION: */ Construct complex vector from real and imaginary components */ PARAMETERS: */ srcReal - an input real component.
nspcbAdd1 -
nspcbAdd2 -
nspcbAdd3 -
nspcbBitRev1 -
nspcbBitRev2 -
nspcbCartToPolar - -------------------------------------------------------------------------*/ bCartToPolar, brCartToPolar, bPolarToCart, brPolarToCart */ */ Cartesian to polar and polar to cartesian coordinate conversions.
nspcbConj1 - -------------------------------------------------------------------------*/ Complex conjugates of scalars and vectors */
nspcbConj2 -
nspcbConjExtend1 -
nspcbConjExtend2 -
nspcbConjFlip2 -
nspcbCopy -
nspcbCplxTo2Real - FUNCTION: */ nspbCplxTo2Real */ DESCRIPTION: */ Return the real and imaginary parts of the coplex vector */ PARAMETERS: */ src - an input complex vector */ dstReal - an output vector to store the real part */ dstImag - an output vector to store the imaginary part; */ len - a length of the arrays; */ */
nspcbFir -
nspcbFirl -
nspcbGoertz -
nspcbIir -
nspcbIirl -
nspcbImag - FUNCTION: */ nspbImag */ DESCRIPTION: */ Return the imaginary part of the coplex vector */ PARAMETERS: */ src - an input complex vector */ dst - an output vector to store the imaginary part; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
nspcbInvThresh1 -
nspcbInvThresh2 -
nspcbLms -
nspcbLmsDes -
nspcbLmsl -
nspcbLmslNa -
nspcbMag - -------------------------------------------------------------------------*/ bPowerSpectr, brPowerSpectr, bMag, brMag, bPhase, brPhase */ */ Compute the magnitude and phase of complex vector elements.
nspcbMpy1 -
nspcbMpy2 -
nspcbMpy3 -
nspcbNormalize -
nspcbPhase - FUNCTION: */ nspbPhase */ DESCRIPTION: */ Compute the phase (in radians) of complex vector elements.
nspcbPolarToCart - FUNCTION: */ nspbPolarToCart */ DESCRIPTION: */ Convert polar coordinate to cartesian.
nspcbPowerSpectr - -------------------------------------------------------------------------*/ bPowerSpectr, brPowerSpectr */ */ Compute the power spectrum of complex vector.
nspcbRandGaus -
nspcbRandUni -
nspcbReal - -------------------------------------------------------------------------*/ bReal, bImag, bCplxTo2Real, b2RealToCplx */ */ Return the real and imaginary parts of complex vectors */ or construct complex vectors from real and imaginary components */ -------------------------------------------------------------------------*/ FUNCTION: */ nspbReal */ DESCRIPTION: */ Return the real part of the coplex vector */ PARAMETERS: */ src - an input complex vector */ dst - an output vector to store the real part; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
nspcbSet -
nspcbSqr1 -
nspcbSqr2 -
nspcbSqrt1 -
nspcbSqrt2 -
nspcbSub1 -
nspcbSub2 -
nspcbSub3 -
nspcbThresh1 -
nspcbThresh2 -
nspcbTone -
nspcbTrngl -
nspcbZero -
nspcCalcDftTwdTbl -
nspcCalcFftTwdTbl -
nspcConj - function nspcConj(a: TSCplx): TSCplx; external nspl;
nspcConv -
nspcCrossCorr -
nspcDft -
nspcDiv -
nspcDotProd -
nspcDownSample -
nspcFft -
nspcFftNip -
nspcFir -
nspcFirGetDlyl -
nspcFirGetTaps -
nspcFirInit -
nspcFirInitMr -
nspcFirl -
nspcFirlGetDlyl -
nspcFirlGetTaps -
nspcFirlInit -
nspcFirlInitDlyl -
nspcFirlInitMr -
nspcFirlSetDlyl -
nspcFirlSetTaps -
nspcFirSetDlyl -
nspcFirSetTaps -
nspcFreeTwdTbls -
nspcGetDftTwdTbl -
nspcGetFftTwdTbl -
nspcGoertz -
nspcGoertzInit -
nspcGoertzReset -
nspcIir -
nspcIirInit -
nspcIirInitBq -
nspcIirl -
nspcIirlInit -
nspcIirlInitBq -
nspcIirlInitDlyl -
nspcLms -
nspcLmsDes -
nspcLmsGetDlyl -
nspcLmsGetErrVal -
nspcLmsGetTaps -
nspcLmsInit -
nspcLmsInitMr -
nspcLmsl -
nspcLmslGetDlyl -
nspcLmslGetTaps -
nspcLmslInit -
nspcLmslInitDlyl -
nspcLmslInitMr -
nspcLmslNa -
nspcLmslSetDlyl -
nspcLmslSetTaps -
nspcLmsSetDlyl -
nspcLmsSetErrVal -
nspcLmsSetTaps -
nspcMalloc -
nspcMpy - function nspcMpy(a, b: TSCplx): TSCplx; external nspl;
nspcNorm -
nspcRandGaus -
nspcRandGausInit -
nspcRandUni -
nspcRandUniInit -
nspcrFft -
nspcrFftNip -
nspcsbFir -
nspcsbFirl -
nspcsbIir -
nspcsbIirl -
nspcsbLmslNa -
nspcsConv -
nspcsCrossCorr -
nspcsDotProd -
nspcSet - ---- Additional Functions -----------------------------------------------*/function nspcSet(re, im: Float): TSCplx; external nspl;
nspcsFir -
nspcsFirInit -
nspcsFirInitMr -
nspcsFirl -
nspcsIir -
nspcsIirInit -
nspcsIirInitBq -
nspcsIirl -
nspcsLmslNa -
nspcSub - function nspcSub(a, b: TSCplx): TSCplx; external nspl;
nspcTone -
nspcToneInit -
nspcTrngl -
nspcTrnglInit -
nspcUpSample -
nspcWinBartlett -
nspcWinBlackman -
nspcWinBlackmanOpt -
nspcWinBlackmanStd -
nspcWinHamming -
nspcWinHann -
nspcWinKaiser -
nspdAutoCorr -
nspdbAbs1 -
nspdbAbs2 -
nspdbAdd1 - -------------------------------------------------------------------------*/ Vector Addition and multiplication */ These functions perform element-wise arithmetic on vectors of length n*/ dst[i]=dst[i]+val; */
nspdbAdd2 - dst[i]=dst[i]+src[i]; */
nspdbAdd3 - dst[i]=srcA[i]+srcB[i]; */
nspdbALawToLin -
nspdbBitRev1 -
nspdbBitRev2 -
nspdbCopy -
nspdbExp1 -
nspdbExp2 -
nspdbFir -
nspdbFirl -
nspdbFixToFloat -
nspdbFloatToFix -
nspdbFloatToInt -
nspdbFloatToS1516Fix -
nspdbFloatToS15Fix -
nspdbFloatToS31Fix -
nspdbFloatToS7Fix -
nspdbGoertz -
nspdbIir -
nspdbIirl -
nspdbIntToFloat -
nspdbInvThresh1 -
nspdbInvThresh2 -
nspdbLinToALaw -
nspdbLinToMuLaw -
nspdbLms -
nspdbLmsDes -
nspdbLmsl - mov esp, ebp
nspdbLmslNa -
nspdbLn1 -
nspdbLn2 -
nspdbMpy1 - dst[i]=dst[i]*val; */
nspdbMpy2 - dst[i]=dst[i]*src[i]; */
nspdbMpy3 - dst[i]=srcA[i]*srcB[i]; */
nspdbMuLawToLin -
nspdbNormalize -
nspdbRandGaus -
nspdbRandUni -
nspdbrCartToPolar -
nspdbrMag -
nspdbrPhase -
nspdbrPolarToCart -
nspdbrPowerSpectr -
nspdbS1516FixToFloat -
nspdbS15FixToFloat -
nspdbS31FixToFloat -
nspdbS7FixToFloat -
nspdbSet -
nspdbSqr1 -
nspdbSqr2 -
nspdbSqrt1 -
nspdbSqrt2 -
nspdbSub1 - dst[i]=dst[i]-val; */
nspdbSub2 - dst[i]=dst[i]-val[i]; */
nspdbSub3 - dst[i]=src[i]-val[i]; */
nspdbThresh1 -
nspdbThresh2 -
nspdbTone -
nspdbTrngl -
nspdbZero - -------------------------------------------------------------------------*/ Vector Initialization */ These functions initialize vectors of length n.
nspdCcs2Fft -
nspdCcs2FftNip -
nspdCcsFft -
nspdCcsFftl -
nspdCcsFftlNip -
nspdCcsFftNip -
nspdConv -
nspdConv2D -
nspdCrossCorr -
nspdDct -
NSPdDegToRad - NSPsDegToRad(deg) ((float) ((deg)/180.
nspdDotProd - mov esp, ebp
nspdDownSample -
nspdFilter2D -
nspdFir - mov esp, ebp
nspdFirBandpass -
nspdFirBandstop -
nspdFirGetDlyl -
nspdFirGetTaps -
nspdFirHighpass -
nspdFirInit -
nspdFirInitMr -
nspdFirl - mov esp, ebp
nspdFirlGetDlyl -
nspdFirlGetTaps -
nspdFirlInit -
nspdFirlInitDlyl -
nspdFirlInitMr -
nspdFirLowpass - nspfirg
nspdFirlSetDlyl -
nspdFirlSetTaps -
nspdFirSetDlyl -
nspdFirSetTaps -
nspdGoertz -
nspdGoertzInit -
nspdGoertzReset -
nspdIir - mov esp, ebp
nspdIirInit -
nspdIirInitBq -
nspdIirl - mov esp, ebp
nspdIirlInit -
nspdIirlInitBq -
nspdIirlInitDlyl -
nspdLms -
nspdLmsDes -
nspdLmsGetDlyl -
nspdLmsGetErrVal -
nspdLmsGetTaps -
nspdLmsInit -
nspdLmsInitMr -
nspdLmsl - mov esp, ebp
nspdLmslGetDlyl -
nspdLmslGetTaps -
nspdLmslInit -
nspdLmslInitDlyl -
nspdLmslInitMr -
nspdLmslNa - mov esp, ebp
nspdLmslSetDlyl -
nspdLmslSetTaps -
nspdLmsSetDlyl -
nspdLmsSetErrVal -
nspdLmsSetTaps -
nspdMalloc -
nspdMax -
nspdMean -
nspdMin -
nspdMpyRCPack2 -
nspdMpyRCPack3 -
nspdMpyRCPerm2 -
nspdMpyRCPerm3 -
nspdNorm -
nspdRandGaus - mov esp, ebp
nspdRandGausInit -
nspdRandUni - mov esp, ebp
nspdRandUniInit -
nspdReal2Fft -
nspdReal2FftNip -
nspdRealFft -
nspdRealFftl -
nspdRealFftlNip -
nspdRealFftNip -
nspdStdDev -
nspdTone - mov esp, ebp
nspdToneInit -
nspdTrngl - mov esp, ebp
nspdTrnglInit -
nspdUpSample -
nspdWinBartlett -
nspdWinBlackman -
nspdWinBlackmanOpt -
nspdWinBlackmanStd -
nspdWinHamming -
nspdWinHann -
nspdWinKaiser -
nspdWtDecompose -
nspdWtGetState -
nspdWtInit -
nspdWtReconstruct -
nspdWtSetState -
nspdzbFir -
nspdzbFirl -
nspdzbIir -
nspdzbIirl -
nspdzbLms - mov esp, ebp
nspdzbLmsDes -
nspdzbLmsl - mov esp, ebp
nspdzbLmslNa -
nspdzConv -
nspdzCrossCorr -
nspdzDotProd - mov esp, ebp
nspdzFir -
nspdzFirInit -
nspdzFirInitMr -
nspdzFirl - mov esp, ebp
nspdzIir - mov esp, ebp
nspdzIirInit -
nspdzIirInitBq -
nspdzIirl - mov esp, ebp
nspdzLms - mov esp, ebp
nspdzLmsDes - mov esp, ebp
nspdzLmsInit -
nspdzLmsInitMr -
nspdzLmsl - mov esp, ebp
nspdzLmslNa - mov esp, ebp
nspError -
nspErrorStr -
nspFirFree -
nspFree -
nspFreeBitRevTbls -
nspGetBitRevTbl -
nspGetErrMode -
nspGetErrStatus -
nspGetLibVersion - MAX(a,b) (((a) > (b)) ? (a) : (b)) MIN(a,b) (((a) < (b)) ? (a) : (b)) nsperror.
nspGuiBoxReport -
nspibALawToLin -
nspibLinToALaw -
nspibLinToMuLaw -
nspibMuLawToLin -
nspIirFree - -------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirFree *) (* DESCRIPTION: *) (* This function must be called after all filtering is done to free *) (* dynamic memory associated with statePtr.
nspiMalloc -
nspjMalloc -
nspLmsFree -
nspMalloc - nspalloc.
nspMuLawToALaw -
nspNulDevReport -
nspRedirectError -
nspsAutoCorr - ------------------------------------------------------------------------*/ AutoCorrelation */ */
Normal:
~~~~~~~
dst[n] = S ~src[k] * src[k+n], 0 <= n < nLags
0 <= k < len
Biased:
~~~~~~~
dst[n] = K* S ~src[k] * src[k+n], 0 <= n < nLags
0 <= k < len
K = 1/len
UnBiased:
~~~~~~~~~
dst[n] = K* S ~src[k] * src[k+n], 0 <= n < nLags
0 <= k < len
K = 1/(len-n)
| src[k], 0<=k nspcorr
nspsbAbs1 -
nspsbAbs2 -
nspsbAdd1 - -------------------------------------------------------------------------*/ Vector Addition and multiplication */ These functions perform element-wise arithmetic on vectors of length n*/ dst[i]=dst[i]+val; */
nspsbAdd2 - dst[i]=dst[i]+src[i]; */
nspsbAdd3 - dst[i]=srcA[i]+srcB[i]; */
nspsbALawToLin -
nspsbBitRev1 -
nspsbBitRev2 -
nspsbCopy -
nspsbExp1 -
nspsbExp2 -
nspsbFir -
nspsbFirl -
nspsbFixToFloat - FUNCTION: */ nspbFixToFloat */ DESCRIPTION: */ Converts the fixed-point data in the input array and stores the */ results in the output array */ PARAMETERS: */ src - an input array to be converted; */ dst - an output array to store the result; */ len - a length of the arrays; */ wordSize - specifies the size of an integer in bits, */ and must be 8, 16 or 32; */ fractBits - specifies the number of fractional bits */ flags - specifies that fixed-point values are unsigned or signed */ */
nspsbFloatToFix - -------------------------------------------------------------------------*/ bFloatToFix, bFixToFloat */ */ Vector floating-point to fixed-point and */ fixed-point to floating-point conversion */ -------------------------------------------------------------------------*/ FUNCTION: */ nspbFloatToFix */ DESCRIPTION: */ Converts the floating-point data in the input array and stores */ the results in the output array.
nspsbFloatToInt - -------------------------------------------------------------------------*/ bFloatToInt, bIntToFloat */ */ Vector floating-point to integer and integer to floating-point conversion*/ -------------------------------------------------------------------------*/ FUNCTION: */ nspbFloatToInt */ DESCRIPTION: */ Converts the floating-point data in the input array and stores */ the results in the output array.
nspsbFloatToS1516Fix -
nspsbFloatToS15Fix -
nspsbFloatToS31Fix - -------------------------------------------------------------------------*/ bFloatToS31Fix, bFloatToS15Fix, bFloatToS7Fix, bFloatToS1516Fix, */ bS31FixToFloat, bS15FixToFloat, bS7FixToFloat, bS1516FixToFloat */ Vector floating-point to fixed-point of format S.
nspsbFloatToS7Fix -
nspsbGoertz -
nspsbIir - -------------------------------------------------------------------------*) (* FUNCTION: *) (* nspbIir *) (* nspbIir *) (* DESCRIPTION: *) (* These functions filter a block of numIters samples inSamps through an *) (* IIR filter and return the result in outSamps.
nspsbIirl -
nspsbIntToFloat - FUNCTION: */ nspbIntToFloat */ DESCRIPTION: */ Converts the integer data in the input array and stores the results */ in the output array */ PARAMETERS: */ src - an input array to be converted; */ dst - an output array to store the result; */ len - a length of the arrays; */ wordSize - specifies the size of an integer in bits, */ and must be 8, 16 or 32; */ flags - specifies that integer values are unsigned or signed.
nspsbInvThresh1 -
nspsbInvThresh2 -
nspsbLinToALaw -
nspsbLinToMuLaw -
nspsbLms -
nspsbLmsDes -
nspsbLmsl -
nspsbLmslNa -
nspsbLn1 - PVCS: $Workfile: NSPLNEXP.
nspsbLn2 -
nspsbMpy1 - dst[i]=dst[i]*val; */
nspsbMpy2 - dst[i]=dst[i]*src[i]; */
nspsbMpy3 - dst[i]=srcA[i]*srcB[i]; */
nspsbMuLawToLin -
nspsbNormalize -
nspsbRandGaus -
nspsbRandUni -
nspsbrCartToPolar - FUNCTION: */ nspbrCartToPolar */ DESCRIPTION: */ Convert cartesian coordinate to polar.
nspsbrMag - FUNCTION: */ nspbrMag */ DESCRIPTION: */ Compute the magnitude of complex data formed as two real vectors.
nspsbrPhase - FUNCTION: */ nspbrPhase */ DESCRIPTION: */ Compute the phase of complex data formed as two real vectors.
nspsbrPolarToCart - FUNCTION: */ nspbrPolarToCart */ DESCRIPTION: */ Convert polar coordinate to cartesian.
nspsbrPowerSpectr - FUNCTION: */ nspbrPowerSpectr */ DESCRIPTION: */ Compute the power spectrum of complex data formed as two real vectors */ PARAMETERS: */ srcReal - an input vector containing a real part of complex data */ srcImag - an input vector containing an imag.
nspsbS1516FixToFloat -
nspsbS15FixToFloat -
nspsbS31FixToFloat - FUNCTION: */ nspbS31FixToFloat */ nspbS15FixToFloat */ nspbS7FixToFloat */ nspbS1516FixToFloat */ DESCRIPTION: */ Converts the fixed-point data in the input array and stores the */ results in the output array */ nsp?bS31FixToFloat() from format of S.
nspsbS7FixToFloat -
nspsbSet -
nspsbSqr1 - nspvec
nspsbSqr2 -
nspsbSqrt1 -
nspsbSqrt2 -
nspsbSub1 - dst[i]=dst[i]-val; */
nspsbSub2 - dst[i]=dst[i]-val[i]; */
nspsbSub3 - dst[i]=src[i]-val[i]; */
nspsbThresh1 -
nspsbThresh2 -
nspsbTone -
nspsbTrngl -
nspsbZero - -------------------------------------------------------------------------*/ Vector Initialization */ These functions initialize vectors of length n.
nspscbFir -
nspscbFirl -
nspscbIir -
nspscbIirl -
nspscbLms -
nspscbLmsDes -
nspscbLmsl -
nspscbLmslNa -
nspscConv -
nspscCrossCorr -
nspsCcs2Fft -
nspsCcs2FftNip -
nspsCcsFft -
nspsCcsFftl -
nspsCcsFftlNip -
nspsCcsFftNip -
nspscDotProd -
nspscFir -
nspscFirInit -
nspscFirInitMr -
nspscFirl -
nspscIir -
nspscIirInit -
nspscIirInitBq -
nspscIirl -
nspscLms -
nspscLmsDes -
nspscLmsInit -
nspscLmsInitMr -
nspscLmsl -
nspscLmslNa -
nspsConv - PVCS: $Workfile: NSPCONV.
nspsConv2D - PVCS: $Workfile: NSPCNV2D.
nspsCrossCorr - ------------------------------------------------------------------------*/ CrossCorralation */
dst[n] = S ~srcA[k] * srcB[k+n+loLag], 0 <= n <= hiLag-loLag
0 <= k < lenA
| srcB[k], 0<=knspsDct -
NSPsDegToRad -
nspsDotProd - PVCS: $Workfile: nspdotp.
nspsDownSample - ------------------------------------------------------------------------*/ DownSample */ */ Down-sample a signal, conceptually decreasing its sample rate by an */ integer factor and forming output parameters for next sampling; */
nspSetErrMode -
nspSetErrStatus -
nspsFilter2D - PVCS: $Workfile: Nspfir2.
nspsFir - -------------------------------------------------------------------------*/ nsp?Fir(), nsp?bFir() */ */ Dot and block product FIRH filtering */
nspsFirGetDlyl - -------------------------------------------------------------------------*/ nsp?FirGetDlyl(), nsp?FirSetDlyl() */ */ Utility functions to get and set the FIR delay line contents */
nspsFirGetTaps - -------------------------------------------------------------------------*/ nsp?FirGetTaps(), nsp?FirSetTaps() */ */ Utility functions to get and set the FIR taps coefficients */
nspsFirInit - TNSPFirState -------------------------------------------------------------------------*/ nsp?FirInit(), nsp?FirInitMr() */ nspFirFree() */ */ Initialize a finite impulse response high-level (FIRH) filter */ nspfirh.
nspsFirInitMr -
nspsFirl - * ------------------------------------------------------------------------*/ * Firl, bFirl */ * */ * Filter either a single sample or block of samples through a low-level */ * FIR filter.
nspsFirlGetDlyl - ------------------------------------------------------------------------*/ FirlGetDlyl, FirlSetDlyl */ */ Utility functions to get and set the delay line contents of low-level */ FIR filters.
nspsFirlGetTaps - * ------------------------------------------------------------------------*/ * FirlGetTaps, FirlSetTaps */ * */ * Utility functions to get and set the tap coefficients of low-level FIR */ * filters.
nspsFirlInit - * ------------------------------------------------------------------------*/ * FirlInit, FirlInitMr, FirlInitDlyl */ * */ * Low level functions for cyclic FIR filtering via a tapped delay line.
nspsFirlInitDlyl -
nspsFirlInitMr -
nspsFirlSetDlyl -
nspsFirlSetTaps -
nspsFirSetDlyl -
nspsFirSetTaps -
nspsGoertz - Goertz */ Single Frequency DFT (Goertzel algorithm) */
nspsGoertzInit - GoertzInit */ Initializes the coefficients and zeros the delay line.
nspsGoertzReset - GoertzReset */ Zeros the delay line.
nspsIir - -------------------------------------------------------------------------*) (* Iir, bIir *) (* *) (* Filter a signal through a IIR filter.
nspsIirInit -
nspsIirInitBq -
nspsIirl -
nspsIirlInit -
nspsIirlInitBq -
nspsIirlInitDlyl -
nspsLms -
nspsLmsDes -
nspsLmsGetDlyl -
nspsLmsGetErrVal -
nspsLmsGetLeak -
nspsLmsGetStep -
nspsLmsGetTaps -
nspsLmsInit -
nspsLmsInitMr -
nspsLmsl - -------------------------------------------------------------------------*) (* Lmsl, bLmsl *) (* *) (* Filter samples through a low-level LMS filter.
nspsLmslGetDlyl -
nspsLmslGetLeak -
nspsLmslGetStep - -------------------------------------------------------------------------*) (* LmslGetStep, LmslSetStep, LmslGetLeak, LmslSetLeak *) (* *) (* Utility functions to get and set the leak and step values of a *) (* low-level LMS filter.
nspsLmslGetTaps -
nspsLmslInit - ------------------------------------------------------------------------*) (* LmslInit, LmslInitMr, LmslInitDlyl *) (* *) (* Initialize an adaptive FIR filter that uses the least mean-square *) (* (LMS) algorithm.
nspsLmslInitDlyl - --- Delay line init -----------------------------------------------------
nspsLmslInitMr - --- Multi-rate init -----------------------------------------------------
nspsLmslNa - ------------------------------------------------------------------------*) (* LmslNa, bLmslNa *) (* *) (* Filter a signal using a LMS filter, but without adapting the filter.
nspsLmslSetDlyl -
nspsLmslSetLeak -
nspsLmslSetStep -
nspsLmslSetTaps -
nspsLmsSetDlyl -
nspsLmsSetErrVal -
nspsLmsSetLeak -
nspsLmsSetStep -
nspsLmsSetTaps -
nspsMalloc -
nspsMax -
nspsMean -
nspsMin -
nspsMpyRCPack2 -
nspsMpyRCPack3 -
nspsMpyRCPerm2 -
nspsMpyRCPerm3 -
nspsNorm -
nspsRandGaus -
nspsRandGausInit -
Normal distribution.
nspsRandUni -
nspsRandUniInit - PVCS: $Workfile: NSPRAND.
nspsReal2Fft -
nspsReal2FftNip -
nspsRealFft -
nspsRealFftl -
nspsRealFftlNip -
nspsRealFftNip -
nspsStdDev -
nspStdErrReport -
nspsTone -
nspsToneInit -
nspsTrngl -
nspsTrnglInit -
nspsUpSample - PVCS: $Workfile: NSPSAMPL.
nspsWinBartlett - PVCS: $Workfile: NSPWIN.
nspsWinBlackman -
nspsWinBlackmanOpt -
nspsWinBlackmanStd -
nspsWinHamming -
nspsWinHann -
nspsWinKaiser -
nspsWtDecompose - ------------------------------------------------------------------------ */ */ Wavelet decomposition.
nspsWtGetState - ------------------------------------------------------------------------ */ */ Get all parameters of wavelet.
nspsWtInit - ------------------------------------------------------------------------ */ */ The initialization of the wavelet transform.
nspsWtReconstruct - ------------------------------------------------------------------------ */ */ Wavelet reconstruction.
nspsWtSetState - ------------------------------------------------------------------------ */ */ Set all parameters of wavelet.
nspvAdd - -------------------------------------------------------------------------*/ Miscellaneous Scalar Functions and Vector Functions */ Complex Add, Sub, Mpy, Div, Conj */ These functions perform addition, subtraction, multiplication, */ division, and conjugation on complex numbers a and b.
nspvAutoCorr -
nspvb2RealToCplx -
nspvbAdd1 -
nspvbAdd2 -
nspvbAdd3 -
nspvbBitRev1 -
nspvbBitRev2 -
nspvbConj1 - -------------------------------------------------------------------------*/ Complex conjugates of vectors */
nspvbConj2 -
nspvbConjExtend1 -
nspvbConjExtend2 -
nspvbConjFlip2 -
nspvbCopy -
nspvbCplxTo2Real -
nspvbGoertz -
nspvbImag -
nspvbMag -
nspvbMpy1 -
nspvbMpy2 -
nspvbMpy3 -
nspvbNormalize -
nspvbPhase -
nspvbPowerSpectr -
nspvbRandGaus -
nspvbRandUni -
nspvbReal -
nspvbSet -
nspvbSqr1 -
nspvbSqr2 -
nspvbSqrt1 -
nspvbSqrt2 -
nspvbSub1 -
nspvbSub2 -
nspvbSub3 -
nspvbThresh1 -
nspvbThresh2 -
nspvbTone -
nspvbTrngl -
nspvbZero -
nspvCalcDftTwdTbl - */ GetFftTwdTbl, GetDftTwdTbl, FreeTwdTbls */ */ Compute and store twiddle factors for FFT and DFT computations.
nspvCalcFftTwdTbl -
nspvConj -
nspvCrossCorr -
nspvDft - nspfft.
nspvDiv -
nspvDotProd -
nspvDownSample -
nspvFft -
nspvFftNip -
nspvFreeTwdTbls -
nspvGetDftTwdTbl -
nspvGetFftTwdTbl -
nspvGoertz -
nspvGoertzInit -
nspvGoertzReset -
nspvMalloc -
nspvMpy -
nspvNorm -
nspvRandGaus -
nspvRandGausInit -
nspvRandUni -
nspvRandUniInit -
nspvrFft -
nspvrFftNip -
nspvSet - ---- Additional Functions -----------------------------------------------*/
nspvSub -
nspvTone -
nspvToneInit -
nspvTrngl -
nspvTrnglInit -
nspvUpSample -
nspvwCrossCorr -
nspvwDotProd -
nspvWinBartlett -
nspvWinBlackman -
nspvWinBlackmanOpt -
nspvWinBlackmanStd -
nspvWinHamming -
nspvWinHann -
nspvWinKaiser -
nspwAutoCorr -
nspwbAbs1 -
nspwbAbs2 -
nspwbAdd1 - -------------------------------------------------------------------------*/ Vector Addition and multiplication */ These functions perform element-wise arithmetic on vectors of length n*/
nspwbAdd2 -
nspwbAdd3 -
nspwbALawToLin -
nspwbBitRev1 - */ bBitRev1, bBitRev2 */ */ Permute a vector into binary bit-reversed order.
nspwbBitRev2 -
nspwbCopy -
nspwbExp1 -
nspwbExp2 -
nspwbFir -
nspwbFirl -
nspwbGoertz - mov esp, ebp
nspwbIir -
nspwbIirl - -------------------------------------------------------------------------*) (* FUNCTION: *) (* nspbIirl *) (* nspbIirl *) (* DESCRIPTION: *) (* filters an input block of samples throuth a low-level IIR filter and *) (* returns the result in output block.
nspwbLinToALaw - PVCS: $Workfile: NSPLAW.
nspwbLinToMuLaw -
nspwbLn1 -
nspwbLn2 -
nspwbMpy1 - dst[i]=dst[i]*val; */
nspwbMpy2 - dst[i]=dst[i]*src[i]; */
nspwbMpy3 - dst[i]=srcA[i]*srcB[i]; */
nspwbMuLawToLin -
nspwbNormalize -
nspwbRandGaus -
nspwbRandUni -
nspwbrMag -
nspwbrPhase -
nspwbrPowerSpectr -
nspwbSet -
nspwbSqr1 -
nspwbSqr2 -
nspwbSqrt1 -
nspwbSqrt2 -
nspwbSub1 - dst[i]=dst[i]-val; */
nspwbSub2 - dst[i]=dst[i]-val[i]; */
nspwbSub3 - dst[i]=src[i]-val[i]; */
nspwbThresh1 -
nspwbThresh2 -
nspwbTone - --- Array product tone functions ----------------------------------------*/
nspwbTrngl - --- Block-of-Samples-Generating triangle functions ----------------------*/
nspwbZero - -------------------------------------------------------------------------*/ Vector Initialization */ These functions initialize vectors of length n.
nspwCcs2Fft -
nspwCcs2FftNip -
nspwCcsFft -
nspwCcsFftl -
nspwCcsFftlNip -
nspwCcsFftNip -
nspwConv -
nspwConv2D -
nspwCrossCorr -
nspwDct -
nspwDotProd -
nspwDownSample -
nspwFilter2D -
nspwFir -
nspwFirGetDlyl -
nspwFirGetTaps -
nspwFirInit -
nspwFirInitMr -
nspwFirl -
nspwFirlGetDlyl -
nspwFirlGetTaps -
nspwFirlInit -
nspwFirlInitDlyl -
nspwFirlInitMr -
nspwFirlSetDlyl -
nspwFirlSetTaps -
nspwFirSetDlyl -
nspwFirSetTaps -
nspwGoertz - mov esp, ebp
nspwGoertzInit -
nspwGoertzReset -
nspwIir -
nspwIirInit - nspiirh // PVCS: $Workfile: NSPIIRH.
nspwIirInitBq - -------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirInitBq *) (* nspIirInitBq *) (* DESCRIPTION: *) (* These functions initialize an IIR filter defined by a cascade of *) (* biquads.
nspwIirl - -------------------------------------------------------------------------*) (* Iirl, bIirl *) (* *) (* Filter a signal through a low-level IIR filter.
nspwIirlInit - -------------------------------------------------------------------------*) (* IirlInit, IirlInitBq, IirlInitDlyl *) (* *) (* Perform infinite impulse response filtering.
nspwIirlInitBq - -------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirlInitBq *) (* DESCRIPTION: *) (* Low-level IIR-filter iinitialization taps to reference a cascade of *) (* biquads.
nspwIirlInitDlyl - -------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirlInitDlyl *) (* DESCRIPTION: *) (* Initialization of delay array for low-level IIR-filter.
nspwLmsl -
nspwLmslGetDlyl -
nspwLmslGetStep - Note that step is float
nspwLmslGetTaps -
nspwLmslInit - Note that leak is not used and taps are float
nspwLmslInitDlyl - ////////////////////////////////////////////////////////////
The wLmsl functions for data of short type.
nspwLmslSetDlyl -
nspwLmslSetStep -
nspwLmslSetTaps -
nspwMalloc -
nspwMax -
nspwMean -
nspwMin -
nspwMpyRCPack2 -
nspwMpyRCPack3 -
nspwMpyRCPerm2 -
nspwMpyRCPerm3 -
nspwNorm -
nspwRandGaus -
nspwRandGausInit -
nspwRandUni -
nspwRandUniInit -
nspwReal2Fft -
nspwReal2FftNip -
nspwRealFft -
nspwRealFftl -
nspwRealFftlNip -
nspwRealFftNip -
nspwStdDev -
nspWtFree - par1, par2 - the parameters of wavelet, dependent from the type of wavelet.
nspwTone - --- Dot product tone functions ------------------------------------------*/
nspwToneInit - PVCS: $Workfile: NSPTONE.
nspwTrngl - --- Single-Sample-Generating triangle functions -------------------------*/
nspwTrnglInit - PVCS: $Workfile: NSPTRNGL.
nspwUpSample -
nspwvCrossCorr -
nspwvDotProd -
nspwWinBartlett -
nspwWinBlackman -
nspwWinBlackmanOpt -
nspwWinBlackmanStd -
nspwWinHamming -
nspwWinHann -
nspwWinKaiser -
nspwWtDecompose -
nspwWtGetState -
nspwWtInit -
nspwWtReconstruct -
nspwWtSetState -
nspzAdd - -------------------------------------------------------------------------*/ Miscellaneous Scalar Functions and Vector Functions */ Complex Add, Sub, Mpy, Div, Conj */ These functions perform addition, subtraction, multiplication, */ division, and conjugation on complex numbers a and b.
nspzAutoCorr -
nspzb2RealToCplx -
nspzbAdd1 -
nspzbAdd2 -
nspzbAdd3 -
nspzbBitRev1 -
nspzbBitRev2 -
nspzbCartToPolar -
nspzbConj1 - -------------------------------------------------------------------------*/ */ Complex conjugates of scalars and vectors */ */
nspzbConj2 -
nspzbConjExtend1 -
nspzbConjExtend2 -
nspzbConjFlip2 -
nspzbCopy -
nspzbCplxTo2Real -
nspzbFir -
nspzbFirl -
nspzbGoertz -
nspzbIir -
nspzbIirl -
nspzbImag -
nspzbInvThresh1 -
nspzbInvThresh2 -
nspzbLms - mov esp, ebp
nspzbLmsDes -
nspzbLmsl -
nspzbLmslNa -
nspzbMag -
nspzbMpy1 -
nspzbMpy2 -
nspzbMpy3 -
nspzbNormalize -
nspzbPhase -
nspzbPolarToCart -
nspzbPowerSpectr -
nspzbRandGaus -
nspzbRandUni -
nspzbReal -
nspzbSet -
nspzbSqr1 -
nspzbSqr2 -
nspzbSqrt1 -
nspzbSqrt2 -
nspzbSub1 -
nspzbSub2 -
nspzbSub3 -
nspzbThresh1 -
nspzbThresh2 -
nspzbTone -
nspzbTrngl -
nspzbZero -
nspzCalcDftTwdTbl -
nspzCalcFftTwdTbl -
nspzConj -
nspzConv -
nspzCrossCorr -
nspzdbFir -
nspzdbFirl -
nspzdbIir -
nspzdbIirl -
nspzdbLmslNa -
nspzdConv -
nspzdCrossCorr -
nspzdDotProd -
nspzdFir -
nspzdFirInit -
nspzdFirInitMr -
nspzdFirl -
nspzDft -
nspzdIir -
nspzdIirInit -
nspzdIirInitBq -
nspzdIirl -
nspzDiv -
nspzdLmslNa -
nspzDotProd -
nspzDownSample -
nspzFft -
nspzFftNip -
nspzFir -
nspzFirGetDlyl -
nspzFirGetTaps -
nspzFirInit -
nspzFirInitMr -
nspzFirl -
nspzFirlGetDlyl -
nspzFirlGetTaps -
nspzFirlInit -
nspzFirlInitDlyl -
nspzFirlInitMr -
nspzFirlSetDlyl -
nspzFirlSetTaps -
nspzFirSetDlyl -
nspzFirSetTaps -
nspzFreeTwdTbls -
nspzGetDftTwdTbl -
nspzGetFftTwdTbl -
nspzGoertz -
nspzGoertzInit -
nspzGoertzReset -
nspzIir -
nspzIirInit -
nspzIirInitBq -
nspzIirl -
nspzIirlInit -
nspzIirlInitBq -
nspzIirlInitDlyl -
nspzLms - mov esp, ebp
nspzLmsDes - mov esp, ebp
nspzLmsGetDlyl -
nspzLmsGetErrVal - mov esp, ebp
nspzLmsGetTaps -
nspzLmsInit -
nspzLmsInitMr -
nspzLmsl -
nspzLmslGetDlyl -
nspzLmslGetTaps -
nspzLmslInit -
nspzLmslInitDlyl -
nspzLmslInitMr -
nspzLmslNa -
nspzLmslSetDlyl -
nspzLmslSetTaps -
nspzLmsSetDlyl -
nspzLmsSetErrVal -
nspzLmsSetTaps -
nspzMalloc -
nspzMpy -
nspzNorm -
nspzRandGaus -
nspzRandGausInit -
nspzRandUni -
nspzRandUniInit -
nspzrFft -
nspzrFftNip -
nspzSet - ---- Additional Functions -----------------------------------------------*/
nspzSub -
nspzTone -
nspzToneInit -
nspzTrngl -
nspzTrnglInit -
nspzUpSample -
nspzWinBartlett -
nspzWinBlackman -
nspzWinBlackmanOpt -
nspzWinBlackmanStd -
nspzWinHamming -
nspzWinHann -
nspzWinKaiser -
NSP_DegToRad - ======================================================================== */
ArrayIndex
FixedPoint
Float
Long
NSPStatus
PByteArray
PDCplx
PDCplxArray
PDoubleArray
PFloatArray
PICplx
PICplxArray
PIntArray
PLongArray
PNSPLibVersion
PSCplx
PSCplxArray
PShortArray
PWCplx
PWCplxArray
Short
TByteArray
TDCplx
TDCplxArray
TDoubleArray
TFirLmsDlyState
TFirLmsTapState
TFirSect
TFirSections
TFloatArray
TICplx
TICplxArray
TIntArray
TLongArray
TNSPAutoCorrType
TNspCGoertzState
TNSPCRandGausState
TNSPCRandUniState
TNSPCToneState
TNSPCTrnglState
TNspDGoertzState
TNSPDRandGausState
TNSPDRandUniState
TNSPDToneState
TNSPDTrnglState
TNSPErrMode
TNspErrorCallBack
TNSPFirDlyState
TNSPFirState
TNSPFirTapState
TNspFourierTrOptions
TNSPIirDlyState
TNSPIirInit
TNSPIirState
TNSPIirTapState
TNSPIirType
TNSPITrnglState
TNSPJTrnglState
TNspLibVersion
TNSPLmsDlyState
TNSPLmsState
TNSPLmsTapState
TNSPLmsType
TNspSGoertzState
TNSPSRandGausState
TNSPSRandUniState
TNSPSToneState
TNSPSTrnglState
TNspVGoertzState
TNSPVRandGausState
TNSPVRandUniState
TNSPVToneState
TNSPVTrnglState
TNspWGoertzState
TNspWindowType
TNSPWLmsDlyState
TNSPWLmsTapState
TNSPWRandGausState
TNSPWRandUniState
TNSPWToneState
TNSPWTrnglState
TNSPWtState
TNspZGoertzState
TNSPZRandGausState
TNSPZRandUniState
TNSPZToneState
TNSPZTrnglState
TSCplx
TSCplxArray
TShortArray
TWCplx
TWCplxArray
HUGE_VAL_D
HUGE_VAL_S
NSP_2PI
NSP_AUTO_SCALE
NSP_BSpline
NSP_BSplineDual
NSP_C
NSP_Clip
NSP_Coiflet
NSP_CVRT_MAXPHASE
NSP_Daublet
NSP_DCT_Forward
NSP_DCT_Free
NSP_DCT_Inverse
NSP_EPS
NSP_FIXED_SCALE
NSP_Gt
NSP_Haar
NSP_L1
NSP_L2
NSP_LinSpline
NSP_Lt
NSP_Noflags
NSP_NO_SCALE
NSP_OVERFLOW
NSP_OvfErr
NSP_PI
NSP_PI_2
NSP_PI_4
NSP_QuadSpline
NSP_RELATIVE
NSP_Round
NSP_SATURATE
NSP_StsAutoTrace
NSP_StsBackTrace
NSP_StsBadArg
NSP_StsBadFreq
NSP_StsBadFunc
NSP_StsBadLen
NSP_StsBadPointer
NSP_StsBadRel
NSP_StsError
NSP_StsInternal
NSP_StsNoConv
NSP_StsNoMem
NSP_StsOk
NSP_Symmlet
NSP_TruncNeg
NSP_TruncPos
NSP_TruncZero
NSP_Unsigned
NSP_Vaidyanathan
NSP_WtBiOrtType
NSP_WtByFilter
NSP_WtCoreDouble
NSP_WtCoreFloat
NSP_WtCoreShort
NSP_WtOrtType
NSP_WtOrtUnknown
XBUFLEN
procedure nspALawToMuLaw(src, dst: PByteArray; len: Integer);
function nspBitRev(A, Order: Integer): Integer;
RCS: $Source: nspmisc.h $ $Revision: 1.0 $ $Date: 1997/10/22 09:00:00 $ // Purpose: NSP Miscellaneous Signal Processing Functions ------------------------------------------------------------------------ */ */ BitRev, CalcBitRevTbl, GetBitRevTbl, FreeBitRevTbls */ */ Obtain bit-reversed numbers, indices, and indexing tables. */ */ ------------------------------------------------------------------------ */
function nspcAdd(a, b: TSCplx): TSCplx;
nsparith, // PVCS: $Workfile: NSPARITH.H $ $Revision: 1.0 $ $ModTime: Dec 16 1996 18:31:20 $ // Purpose: NSP Scalar and Vector Arithmetics -------------------------------------------------------------------------*/ Miscellaneous Scalar Functions and Vector Functions */ Complex Add, Sub, Mpy, Div, Conj */ */ These functions perform addition, subtraction, multiplication, */ division, and conjugation on complex numbers a and b. */ nsparith function nspcAdd(a, b: TSCplx): TSCplx; external nspl;
procedure nspCalcBitRevTbl(Tbl: PIntArray; Order: Integer);
procedure nspcAutoCorr(Src: PSCplxArray; Len: Integer; Dst: PSCplxArray; nLags: Integer;
corrType: TNSPAutoCorrType);
procedure nspcb2RealToCplx(srcReal, srcImag: PFloatArray; Dst: PSCplxArray; Length: Integer);
FUNCTION: */ nspb2RealToCplx */ DESCRIPTION: */ Construct complex vector from real and imaginary components */ PARAMETERS: */ srcReal - an input real component. May be NULL - a real part of the */ output will be zero; */ srcImag - an input imaginary component. May be NULL - an imaginary */ part of the output will be zero; */ dst - an output complex vector; */ len - a length of the arrays; */ */
procedure nspcbAdd1(Val: TSCplx; Dst: PSCplxArray; n: Integer);
procedure nspcbAdd2(Src: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbAdd3(SrcA, SrcB: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbBitRev1(Vector: PSCplxArray; Order: Integer);
procedure nspcbBitRev2(Src: PSCplxArray; Dst: PSCplxArray; Order: Integer);
procedure nspcbCartToPolar(Src: PSCplxArray; Mag, Phase: PFloatArray; Len: Integer);
-------------------------------------------------------------------------*/ bCartToPolar, brCartToPolar, bPolarToCart, brPolarToCart */ */ Cartesian to polar and polar to cartesian coordinate conversions. */ -------------------------------------------------------------------------*/ FUNCTION: */ nspbCartToPolar */ DESCRIPTION: */ Convert cartesian coordinate to polar. Input data are formed as */ a complex vector. */ PARAMETERS: */ src - an input complex vector; */ mag - an output vector to store the magnitude components; */ phase - an output vector to store the phase components (in rad)); */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspcbConj1(Vec: PSCplxArray; n: Integer);
-------------------------------------------------------------------------*/ Complex conjugates of scalars and vectors */
procedure nspcbConj2(Src: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbConjExtend1(Vec: PSCplxArray; n: Integer);
procedure nspcbConjExtend2(Src: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbConjFlip2(Src: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbCopy(Src: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbCplxTo2Real(Src: PSCplxArray; DstReal, DstImag: PFloatArray; Length: Integer);
FUNCTION: */ nspbCplxTo2Real */ DESCRIPTION: */ Return the real and imaginary parts of the coplex vector */ PARAMETERS: */ src - an input complex vector */ dstReal - an output vector to store the real part */ dstImag - an output vector to store the imaginary part; */ len - a length of the arrays; */ */
procedure nspcbFir(var State: TNSPFirState; inSamps: PSCplxArray;
outSamps: PSCplxArray; numIters: Integer);
procedure nspcbFirl(const tapState: TNSPFirTapState; var dlyState: TNSPFirDlyState;
inSamps: PSCplxArray; outSamps: PSCplxArray; numIters: Integer);
function nspcbGoertz(var State: TNspCGoertzState; inSamps: PSCplxArray; Len: Integer): TSCplx;
procedure nspcbIir(var State: TNSPIirState; inSamps: PSCplxArray; outSamps: PSCplxArray; NumIters: Integer);
procedure nspcbIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState;
inSamps: PSCplxArray; outSamps: PSCplxArray;
NumIters: Integer);
procedure nspcbImag(Src: PSCplxArray; Dst: PFloatArray; Length: Integer);
FUNCTION: */ nspbImag */ DESCRIPTION: */ Return the imaginary part of the coplex vector */ PARAMETERS: */ src - an input complex vector */ dst - an output vector to store the imaginary part; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspcbInvThresh1(Vec: PSCplxArray; Len: Integer; Thresh: Float);
procedure nspcbInvThresh2(Src: PSCplxArray; Dst: PSCplxArray; Len: Integer; Thresh: Float);
function nspcbLms(var State: TNSPLmsState; inSamps: PSCplxArray; Err: TSCplx): TSCplx;
procedure nspcbLmsDes(var State: TNSPLmsState; const InSamps, DesSamps: TSCplxArray;
outSamps: PSCplxArray; NumIters: Integer);
function nspcbLmsl(var TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PSCplxArray; Err: TSCplx): TSCplx;
procedure nspcbLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PSCplxArray; outSamps: PSCplxArray; NumIters: Integer);
procedure nspcbMag(Src: PSCplxArray; Mag: PFloatArray; Length: Integer);
-------------------------------------------------------------------------*/ bPowerSpectr, brPowerSpectr, bMag, brMag, bPhase, brPhase */ */ Compute the magnitude and phase of complex vector elements. */ -------------------------------------------------------------------------*/ FUNCTION: */ nspbMag */ DESCRIPTION: */ Compute the magnitude of complex vector elements. */ PARAMETERS: */ src - an input complex vector */ mag - an output vector to store the magnitude components; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspcbMpy1(Val: TSCplx; Dst: PSCplxArray; n: Integer);
procedure nspcbMpy2(Src: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbMpy3(SrcA, SrcB: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbNormalize(Src, Dst: PSCplxArray; n: Integer;
Offset: TSCplx; Factor: Float);
procedure nspcbPhase(Src: PSCplxArray; Phase: PFloatArray; Length: Integer);
FUNCTION: */ nspbPhase */ DESCRIPTION: */ Compute the phase (in radians) of complex vector elements. */ PARAMETERS: */ src - an input complex vector */ phase - an output vector to store the phase components; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspcbPolarToCart(Mag, Phase: PFloatArray; Dst: PSCplxArray; Len: Integer);
FUNCTION: */ nspbPolarToCart */ DESCRIPTION: */ Convert polar coordinate to cartesian. Output data are formed as */ a complex vector. */ PARAMETERS: */ mag - an input vector containing the magnitude components; */ phase - an input vector containing the phase components(in rad)); */ dst - an output complex vector to store the cartesian coords; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspcbPowerSpectr(Src: PSCplxArray; Spectr: PFloatArray; Length: Integer);
-------------------------------------------------------------------------*/ bPowerSpectr, brPowerSpectr */ */ Compute the power spectrum of complex vector. */ -------------------------------------------------------------------------*/ FUNCTION: */ nspbPowerSpectr */ DESCRIPTION: */ Compute the power spectrum of complex vector. */ PARAMETERS: */ src - an input complex vector */ mag - an output vector to store the power spectrum components; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspcbRandGaus(var State: TNSPCRandGausState; Samps: PSCplxArray; SampsLen: Integer);
procedure nspcbRandUni(var State: TNSPCRandUniState; Samps: PSCplxArray; SampsLen: Integer);
procedure nspcbReal(Src: PSCplxArray; Dst: PFloatArray; Length: Integer);
-------------------------------------------------------------------------*/ bReal, bImag, bCplxTo2Real, b2RealToCplx */ */ Return the real and imaginary parts of complex vectors */ or construct complex vectors from real and imaginary components */ -------------------------------------------------------------------------*/ FUNCTION: */ nspbReal */ DESCRIPTION: */ Return the real part of the coplex vector */ PARAMETERS: */ src - an input complex vector */ dst - an output vector to store the real part; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspcbSet(re, im: Float; Dst: PSCplxArray; n: Integer);
procedure nspcbSqr1(Vec: PSCplxArray; Len: Integer);
procedure nspcbSqr2(Src: PSCplxArray; Dst: PSCplxArray; Len: Integer);
procedure nspcbSqrt1(Vec: PSCplxArray; Len: Integer);
procedure nspcbSqrt2(Src: PSCplxArray; Dst: PSCplxArray; Len: Integer);
procedure nspcbSub1(Val: TSCplx; Dst: PSCplxArray; n: Integer);
procedure nspcbSub2(Val: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbSub3(Src, Val: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspcbThresh1(Vec: PSCplxArray; Len: Integer; thresh: Float; relOp: Integer);
procedure nspcbThresh2(Src: PSCplxArray; Dst: PSCplxArray; Len: Integer;
thresh: Float; relOp: Integer);
procedure nspcbTone(var State: TNSPCToneState; Samps: PSCplxArray; SampsLen: Integer);
procedure nspcbTrngl(var State: TNSPCTrnglState; Samps: PSCplxArray; SampsLen: Integer);
procedure nspcbZero(Dst: PSCplxArray; n: Integer);
procedure nspcCalcDftTwdTbl(var Tbl: TSCplx; Length: Integer);
procedure nspcCalcFftTwdTbl(var Tbl: TSCplx; Order: Integer);
function nspcConj(a: TSCplx): TSCplx;
function nspcConj(a: TSCplx): TSCplx; external nspl;
procedure nspcConv(x: PSCplxArray; xLen: Integer; h: PSCplxArray; hLen: Integer; y: PSCplxArray);
procedure nspcCrossCorr(SrcA: PSCplxArray; lenA: Integer;
SrcB: PSCplxArray; lenB: Integer; Dst: PSCplxArray;
loLag, hiLag: Integer);
procedure nspcDft(
inSamps: PSCplxArray;
outSamps: PSCplxArray;
Length: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
function nspcDiv(a, b: TSCplx): TSCplx;
function nspcDotProd(SrcA, SrcB: PSCplxArray; Len: Integer): TSCplx;
procedure nspcDownSample(Src: PSCplxArray; SrcLen: Integer;
Dst: PSCplxArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspcFft(
Samps: PSCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspcFftNip(
inSamps: PSCplxArray;
outSamps: PSCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions);
function nspcFir(var State: TNSPFirState; samp: TSCplx): TSCplx;
procedure nspcFirGetDlyl(const State: TNSPFirState; OutDlyl: PSCplxArray);
procedure nspcFirGetTaps(const State: TNSPFirState; OutTaps: PSCplxArray);
procedure nspcFirInit(TapVals: PSCplxArray; TapsLen: Integer;
DlyVals: PSCplxArray; var State: TNSPFirState);
procedure nspcFirInitMr(TapVals: PSCplxArray; TapsLen: Integer;
DlyVals: PSCplxArray; upFactor, upPhase: Integer;
downFactor, downPhase: Integer;
var State: TNSPFirState);
function nspcFirl(const tapState: TNSPFirTapState;
var dlyState: TNSPFirDlyState; samp: TSCplx): TSCplx;
procedure nspcFirlGetDlyl(const tapState: TNSPFirTapState;
const dlyState: TNSPFirDlyState; OutDlyl: PSCplxArray);
procedure nspcFirlGetTaps(const tapState: TNSPFirTapState; OutTaps: PSCplxArray);
procedure nspcFirlInit(Taps: PSCplxArray; TapsLen: Integer; var tapState: TNSPFirTapState);
procedure nspcFirlInitDlyl(const tapState: TNSPFirTapState; Dlyl: PSCplxArray;
var dlyState: TNSPFirDlyState);
procedure nspcFirlInitMr(Taps: PSCplxArray; TapsLen, upFactor, upPhase: Integer;
downFactor, downPhase: Integer; var tapState: TNSPFirTapState);
procedure nspcFirlSetDlyl(const tapState: TNSPFirTapState; inDlyl: PSCplxArray;
var dlyState: TNSPFirDlyState);
procedure nspcFirlSetTaps(InTaps: PSCplxArray; var tapState: TNSPFirTapState);
procedure nspcFirSetDlyl(inDlyl: PSCplxArray; var State: TNSPFirState);
procedure nspcFirSetTaps(InTaps: PSCplxArray; var State: TNSPFirState);
procedure nspcFreeTwdTbls;
function nspcGetDftTwdTbl(Length: Integer): PSCplxArray;
function nspcGetFftTwdTbl(Order: Integer): PSCplxArray;
function nspcGoertz(var State: TNspCGoertzState; Sample: TSCplx): TSCplx;
procedure nspcGoertzInit(Freq: Float; var State: TNspCGoertzState);
procedure nspcGoertzReset(var State: TNspCGoertzState);
function nspcIir(var State: TNSPIirState; Samp: TSCplx): TSCplx;
procedure nspcIirInit(IirType: TNSPIirType; TapVals: PSCplxArray; Order: Integer; var State: TNSPIirState);
procedure nspcIirInitBq(IirType: TNSPIirType; TapVals: PSCplxArray; NumQuads: Integer; var State: TNSPIirState);
function nspcIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState; Samp: TSCplx): TSCplx;
procedure nspcIirlInit(IirType: TNSPIirType; Taps: PSCplxArray; Order: Integer; var TapState: TNSPIirTapState);
procedure nspcIirlInitBq(IirType: TNSPIirType; Taps: PSCplxArray; NumQuads: Integer; var TapState: TNSPIirTapState);
procedure nspcIirlInitDlyl(const TapState: TNSPIirTapState; Dlyl: PSCplxArray; var DlyState: TNSPIirDlyState);
function nspcLms(var State: TNSPLmsState; Samp, Err: TSCplx): TSCplx;
function nspcLmsDes(var State: TNSPLmsState; Samp: TSCplx; Des: TSCplx): TSCplx;
procedure nspcLmsGetDlyl(const State: TNSPLmsState; OutDlyl: PSCplxArray);
function nspcLmsGetErrVal(const State: TNSPLmsState): TSCplx;
procedure nspcLmsGetTaps(const State: TNSPLmsState; OutTaps: PSCplxArray);
procedure nspcLmsInit(LmsType: TNSPLmsType;
TapVals: PSCplxArray; TapsLen: Integer;
DlyVals: PSCplxArray; Step, Leak: Float;
ErrDly: Integer; var State: TNSPLmsState);
procedure nspcLmsInitMr(LmsType: TNSPLmsType;
TapVals: PSCplxArray; TapsLen: Integer;
DlyVals: PSCplxArray; Step, Leak: Float;
ErrDly, DownFactor, DownPhase: Integer; var State: TNSPLmsState);
function nspcLmsl(var TapState: TNSPLmsTapState; var DlySTate: TNSPLmsDlyState; Samp, Err: TSCplx): TSCplx;
procedure nspcLmslGetDlyl(const TapState: TNSPLmsTapState; const DlyState: TNSPLmsDlyState; OutDlyl: PSCplxArray);
procedure nspcLmslGetTaps(const TapState: TNSPLmsTapState; OutTaps: PSCplxArray);
procedure nspcLmslInit(LmsType: TNSPLmsType; Taps: PSCplxArray; TapsLen: Integer;
Step, Leak: Float; ErrDly: Integer; var TapState: TNSPLmsTapState);
procedure nspcLmslInitDlyl(var TapState: TNSPLmsTapState; Dlyl: PSCplxArray; AdaptB: Integer; var DlyState: TNSPLmsDlyState);
procedure nspcLmslInitMr(LmsType: TNSPLmsType; Taps: PSCplxArray; TapsLen: Integer;
Step, Leak: Float; ErrDly, DownFactor, DownPhase: Integer; var TapState: TNSPLmsTapState);
function nspcLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState; Samp: TSCplx): TSCplx;
procedure nspcLmslSetDlyl(const TapState: TNSPLmsTapState; inDlyl: PSCplxArray; var DlyState: TNSPLmsDlyState);
procedure nspcLmslSetTaps(InTaps: PSCplxArray; var TapState: TNSPLmsTapState);
procedure nspcLmsSetDlyl(inDlyl: PSCplxArray; var State: TNSPLmsState);
procedure nspcLmsSetErrVal(Err: TSCplx; var State: TNSPLmsState);
procedure nspcLmsSetTaps(InTaps: PSCplxArray; var State: TNSPLmsState);
function nspcMalloc(Length: Integer): PSCplxArray;
function nspcMpy(a, b: TSCplx): TSCplx;
function nspcMpy(a, b: TSCplx): TSCplx; external nspl;
function nspcNorm(SrcA, SrcB: PSCplxArray; n: Integer; Flag: Integer): Float;
function nspcRandGaus(var State: TNSPCRandGausState): TSCplx;
procedure nspcRandGausInit(Seed, Mean, StDev: Float; var State: TNSPCRandGausState);
function nspcRandUni(var State: TNSPCRandUniState): TSCplx;
procedure nspcRandUniInit(Seed, Low, High: Float; var State: TNSPCRandUniState);
procedure nspcrFft(
reSamps: PFloatArray;
imSamps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspcrFftNip(
reInSamps: PFloatArray;
imInSamps: PFloatArray;
reOutSamps: PFloatArray;
imOutSamps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspcsbFir(var State: TNSPFirState; inSamps: PSCplxArray;
outSamps: PSCplxArray; numIters: Integer);
procedure nspcsbFirl(const tapState: TNSPFirTapState; var dlyState: TNSPFirDlyState;
inSamps: PSCplxArray; outSamps: PSCplxArray; numIters: Integer);
procedure nspcsbIir(var State: TNSPIirState; inSamps: PSCplxArray; outSamps: PSCplxArray; NumIters: Integer);
procedure nspcsbIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState;
inSamps: PSCplxArray; outSamps: PSCplxArray;
NumIters: Integer);
procedure nspcsbLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PSCplxArray; outSamps: PSCplxArray; NumIters: Integer);
procedure nspcsConv(x: PSCplxArray; xLen: Integer; h: PFloatArray; hLen: Integer; y: PSCplxArray);
procedure nspcsCrossCorr(SrcA: PSCplxArray; lenA: Integer;
SrcB: PFloatArray; lenB: Integer; Dst: PSCplxArray;
loLag, hiLag: Integer);
function nspcsDotProd(SrcA: PSCplxArray; SrcB: PFloatArray; Len: Integer): TSCplx;
function nspcSet(re, im: Float): TSCplx;
---- Additional Functions -----------------------------------------------*/function nspcSet(re, im: Float): TSCplx; external nspl;
function nspcsFir(var State: TNSPFirState; samp: TSCplx): TSCplx;
procedure nspcsFirInit(TapVals: PFloatArray; TapsLen: Integer;
DlyVals: PSCplxArray; var State: TNSPFirState);
procedure nspcsFirInitMr(TapVals: PFloatArray; TapsLen: Integer;
DlyVals: PSCplxArray; upFactor, upPhase: Integer;
downFactor, downPhase: Integer;
var State: TNSPFirState);
function nspcsFirl(const tapState: TNSPFirTapState;
var dlyState: TNSPFirDlyState; samp: TSCplx): TSCplx;
function nspcsIir(var State: TNSPIirState; Samp: TSCplx): TSCplx;
procedure nspcsIirInit(IirType: TNSPIirType; TapVals: PFloatArray; Order: Integer; var State: TNSPIirState);
procedure nspcsIirInitBq(IirType: TNSPIirType; TapVals: PFloatArray; NumQuads: Integer; var State: TNSPIirState);
function nspcsIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState; Samp: TSCplx): TSCplx;
function nspcsLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState; Samp: TSCplx): TSCplx;
function nspcSub(a, b: TSCplx): TSCplx;
function nspcSub(a, b: TSCplx): TSCplx; external nspl;
function nspcTone(var State: TNSPCToneState): TSCplx;
procedure nspcToneInit(rfreq, phase, mag: Float; var State: TNSPCToneState);
function nspcTrngl(var State: TNSPCTrnglState): TSCplx;
procedure nspcTrnglInit(rfrq, phase, Mag, Asym: Float; var State: TNSPCTrnglState);
procedure nspcUpSample(Src: PSCplxArray; SrcLen: Integer;
Dst: PSCplxArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspcWinBartlett(Vector: PSCplxArray; N: Integer);
procedure nspcWinBlackman(Vector: PSCplxArray; N: Integer; Alpha: Float);
procedure nspcWinBlackmanOpt(Vector: PSCplxArray; N: Integer);
procedure nspcWinBlackmanStd(Vector: PSCplxArray; N: Integer);
procedure nspcWinHamming(Vector: PSCplxArray; N: Integer);
procedure nspcWinHann(Vector: PSCplxArray; N: Integer);
procedure nspcWinKaiser(Vector: PSCplxArray; N: Integer; Beta: Float);
procedure nspdAutoCorr(Src: PDoubleArray; Len: Integer; Dst: PDoubleArray; nLags: Integer;
corrType: TNSPAutoCorrType);
procedure nspdbAbs1(Vec: PDoubleArray; Len: Integer);
procedure nspdbAbs2(Src: PDoubleArray; Dst: PDoubleArray; Len: Integer);
procedure nspdbAdd1(Val: Double; Dst: PDoubleArray; n: Integer);
-------------------------------------------------------------------------*/ Vector Addition and multiplication */ These functions perform element-wise arithmetic on vectors of length n*/ dst[i]=dst[i]+val; */
procedure nspdbAdd2(Src: PDoubleArray; Dst: PDoubleArray; n: Integer);
dst[i]=dst[i]+src[i]; */
procedure nspdbAdd3(SrcA, SrcB: PDoubleArray; Dst: PDoubleArray; n: Integer);
dst[i]=srcA[i]+srcB[i]; */
procedure nspdbALawToLin(src: PByteArray; dst: PDoubleArray; len: Integer);
procedure nspdbBitRev1(Vector: PDoubleArray; Order: Integer);
procedure nspdbBitRev2(Src: PDoubleArray; Dst: PDoubleArray; Order: Integer);
procedure nspdbCopy(Src: PDoubleArray; Dst: PDoubleArray; n: Integer);
procedure nspdbExp1(vec: PDoubleArray; len: Integer);
procedure nspdbExp2(src, dst: PDoubleArray; len: Integer);
procedure nspdbFir(var State: TNSPFirState; inSamps: PDoubleArray;
outSamps: PDoubleArray; numIters: Integer);
procedure nspdbFirl(const tapState: TNSPFirTapState; var dlyState: TNSPFirDlyState;
inSamps: PDoubleArray; outSamps: PDoubleArray; numIters: Integer);
procedure nspdbFixToFloat(const src; Dst: PDoubleArray; len, wordSize, fractBits, flags: Integer);
procedure nspdbFloatToFix(Src: PDoubleArray; var dst; len, wordSize, fractBits, flags: Integer);
procedure nspdbFloatToInt(Src: PDoubleArray; var dst; len, wordSize, Flags: Integer);
procedure nspdbFloatToS1516Fix(Src: PDoubleArray; Dst: PLongArray; Len, Flags: Integer);
procedure nspdbFloatToS15Fix(Src: PDoubleArray; Dst: PShortArray; Len, Flags: Integer);
procedure nspdbFloatToS31Fix(Src: PDoubleArray; Dst: PLongArray; Len, Flags: Integer);
procedure nspdbFloatToS7Fix(Src: PDoubleArray; Dst: PByteArray; Len, Flags: Integer);
function nspdbGoertz(var State: TNspDGoertzState; inSamps: PDoubleArray; Len: Integer): TDCplx;
procedure nspdbIir(var State: TNSPIirState; inSamps: PDoubleArray; outSamps: PDoubleArray; NumIters: Integer);
procedure nspdbIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState;
inSamps: PDoubleArray; outSamps: PDoubleArray;
NumIters: Integer);
procedure nspdbIntToFloat(const src; Dst: PDoubleArray; len, wordSize, flags: Integer);
procedure nspdbInvThresh1(Vec: PDoubleArray; Len: Integer; Thresh: Double);
procedure nspdbInvThresh2(Src: PDoubleArray; Dst: PDoubleArray; Len: Integer; Thresh: Double);
procedure nspdbLinToALaw(src: PDoubleArray; dst: PByteArray; len: Integer);
procedure nspdbLinToMuLaw(src: PDoubleArray; dst: PByteArray; len: Integer);
function nspdbLms(var State: TNSPLmsState; inSamps: PDoubleArray; Err: Double): Double;
procedure nspdbLmsDes(var State: TNSPLmsState; const InSamps, DesSamps: TDoubleArray;
outSamps: PDoubleArray; NumIters: Integer);
function nspdbLmsl(var TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PDoubleArray; Err: Double): Double;
mov esp, ebp
procedure nspdbLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PDoubleArray; outSamps: PDoubleArray; NumIters: Integer);
procedure nspdbLn1 (vec: PDoubleArray; len: Integer);
procedure nspdbLn2 (src, dst: PDoubleArray; len: Integer);
procedure nspdbMpy1(Val: Double; Dst: PDoubleArray; n: Integer);
dst[i]=dst[i]*val; */
procedure nspdbMpy2(Src: PDoubleArray; Dst: PDoubleArray; n: Integer);
dst[i]=dst[i]*src[i]; */
procedure nspdbMpy3(SrcA, SrcB: PFloatArray; Dst: PFloatArray; n: Integer);
dst[i]=srcA[i]*srcB[i]; */
procedure nspdbMuLawToLin(src: PByteArray; dst: PDoubleArray; len: Integer);
procedure nspdbNormalize(Src, Dst: PDoubleArray; n: Integer;
Offset, Factor: Double);
procedure nspdbRandGaus(var State: TNSPDRandGausState; Samps: PDoubleArray; SampsLen: Integer);
procedure nspdbRandUni(var State: TNSPDRandUniState; Samps: PDoubleArray; SampsLen: Integer);
procedure nspdbrCartToPolar(srcReal, srcImag: PDoubleArray; Mag, Phase: PDoubleArray; Len: Integer);
procedure nspdbrMag(srcReal, srcImag: PDoubleArray; Mag: PDoubleArray; Length: Integer);
procedure nspdbrPhase(srcReal, srcImag: PDoubleArray; Phase: PDoubleArray; Length: Integer);
procedure nspdbrPolarToCart(Mag, Phase: PDoubleArray; DstReal, DstImag: PDoubleArray; Len: Integer);
procedure nspdbrPowerSpectr(SrcReal, SrcImag, Spectr: PDoubleArray; Length: Integer);
procedure nspdbS1516FixToFloat(Src: PLongArray; Dst: PDoubleArray; Len: Integer);
procedure nspdbS15FixToFloat(Src: PShortArray; Dst: PDoubleArray; Len: Integer);
procedure nspdbS31FixToFloat(Src: PLongArray; Dst: PDoubleArray; Len: Integer);
procedure nspdbS7FixToFloat(Src: PByteArray; Dst: PDoubleArray; Len: Integer);
procedure nspdbSet(Val: Double; Dst: PDoubleArray; n: Integer);
procedure nspdbSqr1(Vec: PDoubleArray; Len: Integer);
procedure nspdbSqr2(Src: PDoubleArray; Dst: PDoubleArray; Len: Integer);
procedure nspdbSqrt1(Vec: PDoubleArray; Len: Integer);
procedure nspdbSqrt2(Src: PDoubleArray; Dst: PDoubleArray; Len: Integer);
procedure nspdbSub1(Val: Double; Dst: PDoubleArray; n: Integer);
dst[i]=dst[i]-val; */
procedure nspdbSub2(Val: PDoubleArray; Dst: PDoubleArray; n: Integer);
dst[i]=dst[i]-val[i]; */
procedure nspdbSub3(Src, Val: PFloatArray; Dst: PFloatArray; n: Integer);
dst[i]=src[i]-val[i]; */
procedure nspdbThresh1(Vec: PDoubleArray; Len: Integer; thresh: Double; relOp: Integer);
procedure nspdbThresh2(Src: PDoubleArray; Dst: PDoubleArray; Len: Integer;
thresh: Double; relOp: Integer);
procedure nspdbTone(var State: TNSPDToneState; Samps: PDoubleArray; SampsLen: Integer);
procedure nspdbTrngl(var State: TNSPDTrnglState; Samps: PDoubleArray; SampsLen: Integer);
procedure nspdbZero(Dst: PDoubleArray; n: Integer);
-------------------------------------------------------------------------*/ Vector Initialization */ These functions initialize vectors of length n. */
procedure nspdCcs2Fft(
xSamps: PDoubleArray;
ySamps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdCcs2FftNip(
xInSamps: PDCplxArray; xOutSamps: PDoubleArray;
yInSamps: PDCplxArray; yOutSamps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdCcsFft(
Samps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdCcsFftl(
Samps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdCcsFftlNip(
inSamps: PDoubleArray;
outSamps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdCcsFftNip(
inSamps: PDCplxArray;
outSamps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdConv(x: PDoubleArray; xLen: Integer; h: PDoubleArray; hLen: Integer; y: PDoubleArray);
procedure nspdConv2D(x: PDoubleArray; xCols, xRows: Integer; h: PDoubleArray; hCols, hRows: Integer; y: PDoubleArray);
procedure nspdCrossCorr(SrcA: PDoubleArray; lenA: Integer;
SrcB: PDoubleArray; lenB: Integer; Dst: PDoubleArray;
loLag, hiLag: Integer);
procedure nspdDct(Src, Dst: PDoubleArray; Len, Flags: Integer);
function NSPdDegToRad(deg: Double): Double;
NSPsDegToRad(deg) ((float) ((deg)/180.0 * NSP_PI
function nspdDotProd(SrcA, SrcB: PDoubleArray; Len: Integer): Double;
mov esp, ebp
procedure nspdDownSample(Src: PDoubleArray; SrcLen: Integer;
Dst: PDoubleArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspdFilter2D(x: PDoubleArray; xCols, xRows: Integer; h: PDoubleArray; hCols, hRows: Integer; y: PDoubleArray);
function nspdFir(var State: TNSPFirState; samp: Double): Double;
mov esp, ebp
function nspdFirBandpass(rLowFreq, rHighFreq: Double;
Taps: PDoubleArray;
TapsLen: Integer;
WinType: TNSPWindowType;
doNormal: LongBool): Integer;
function nspdFirBandstop(rLowFreq, rHighFreq: Double;
Taps: PDoubleArray;
TapsLen: Integer;
WinType: TNSPWindowType;
doNormal: LongBool): Integer;
procedure nspdFirGetDlyl(const State: TNSPFirState; OutDlyl: PDoubleArray);
procedure nspdFirGetTaps(const State: TNSPFirState; OutTaps: PDoubleArray);
function nspdFirHighpass(rfreq: Double;
Taps: PDoubleArray;
TapsLen: Integer;
WinType: TNSPWindowType;
doNormal: LongBool): Integer;
procedure nspdFirInit(TapVals: PDoubleArray; TapsLen: Integer;
DlyVals: PDoubleArray; var State: TNSPFirState);
procedure nspdFirInitMr(TapVals: PDoubleArray; TapsLen: Integer;
DlyVals: PDoubleArray; upFactor, upPhase: Integer;
downFactor, downPhase: Integer;
var State: TNSPFirState);
function nspdFirl(const tapState: TNSPFirTapState;
var dlyState: TNSPFirDlyState; samp: Double): Double;
mov esp, ebp
procedure nspdFirlGetDlyl(const tapState: TNSPFirTapState;
const dlyState: TNSPFirDlyState; OutDlyl: PDoubleArray);
procedure nspdFirlGetTaps(const tapState: TNSPFirTapState; OutTaps: PDoubleArray);
procedure nspdFirlInit(Taps: PDoubleArray; TapsLen: Integer; var tapState: TNSPFirTapState);
procedure nspdFirlInitDlyl(const tapState: TNSPFirTapState; Dlyl: PDoubleArray;
var dlyState: TNSPFirDlyState);
procedure nspdFirlInitMr(Taps: PDoubleArray; TapsLen, upFactor, upPhase: Integer;
downFactor, downPhase: Integer; var tapState: TNSPFirTapState);
function nspdFirLowpass(rfreq: Double;
Taps: PDoubleArray;
TapsLen: Integer;
WinType: TNSPWindowType;
doNormal: LongBool): Integer;
nspfirg
procedure nspdFirlSetDlyl(const tapState: TNSPFirTapState; inDlyl: PDoubleArray;
var dlyState: TNSPFirDlyState);
procedure nspdFirlSetTaps(InTaps: PDoubleArray; var tapState: TNSPFirTapState);
procedure nspdFirSetDlyl(inDlyl: PDoubleArray; var State: TNSPFirState);
procedure nspdFirSetTaps(InTaps: PDoubleArray; var State: TNSPFirState);
function nspdGoertz(var State: TNspDGoertzState; Sample: Double): TDCplx;
procedure nspdGoertzInit(Freq: Double; var State: TNspDGoertzState);
procedure nspdGoertzReset(var State: TNspDGoertzState);
function nspdIir(var State: TNSPIirState; Samp: Double): Double;
mov esp, ebp
procedure nspdIirInit(IirType: TNSPIirType; TapVals: PDoubleArray; Order: Integer; var State: TNSPIirState);
procedure nspdIirInitBq(IirType: TNSPIirType; TapVals: PDoubleArray; NumQuads: Integer; var State: TNSPIirState);
function nspdIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState; Samp: Double): Double;
mov esp, ebp
procedure nspdIirlInit(IirType: TNSPIirType; Taps: PDoubleArray; Order: Integer; var TapState: TNSPIirTapState);
procedure nspdIirlInitBq(IirType: TNSPIirType; Taps: PDoubleArray; NumQuads: Integer; var TapState: TNSPIirTapState);
procedure nspdIirlInitDlyl(const TapState: TNSPIirTapState; Dlyl: PDoubleArray; var DlyState: TNSPIirDlyState);
function nspdLms(var State: TNSPLmsState; Samp, Err: Double): Double;
function nspdLmsDes(var State: TNSPLmsState; Samp: Double; Des: Double): Double;
procedure nspdLmsGetDlyl(const State: TNSPLmsState; OutDlyl: PDoubleArray);
function nspdLmsGetErrVal(const State: TNSPLmsState): Double;
procedure nspdLmsGetTaps(const State: TNSPLmsState; OutTaps: PDoubleArray);
procedure nspdLmsInit(LmsType: TNSPLmsType;
TapVals: PDoubleArray; TapsLen: Integer;
DlyVals: PDoubleArray; Step, Leak: Float;
ErrDly: Integer; var State: TNSPLmsState);
procedure nspdLmsInitMr(LmsType: TNSPLmsType;
TapVals: PDoubleArray; TapsLen: Integer;
DlyVals: PDoubleArray; Step, Leak: Float;
ErrDly, DownFactor, DownPhase: Integer; var State: TNSPLmsState);
function nspdLmsl(var TapState: TNSPLmsTapState; var DlySTate: TNSPLmsDlyState; Samp, Err: Double): Double;
mov esp, ebp
procedure nspdLmslGetDlyl(const TapState: TNSPLmsTapState; const DlyState: TNSPLmsDlyState; OutDlyl: PDoubleArray);
procedure nspdLmslGetTaps(const TapState: TNSPLmsTapState; OutTaps: PDoubleArray);
procedure nspdLmslInit(LmsType: TNSPLmsType; Taps: PDoubleArray; TapsLen: Integer;
Step, Leak: Float; ErrDly: Integer; var TapState: TNSPLmsTapState);
procedure nspdLmslInitDlyl(var TapState: TNSPLmsTapState; Dlyl: PDoubleArray; AdaptB: Integer; var DlyState: TNSPLmsDlyState);
procedure nspdLmslInitMr(LmsType: TNSPLmsType; Taps: PDoubleArray; TapsLen: Integer;
Step, Leak: Float; ErrDly, DownFactor, DownPhase: Integer; var TapState: TNSPLmsTapState);
function nspdLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState; Samp: Double): Double;
mov esp, ebp
procedure nspdLmslSetDlyl(const TapState: TNSPLmsTapState; inDlyl: PDoubleArray; var DlyState: TNSPLmsDlyState);
procedure nspdLmslSetTaps(InTaps: PDoubleArray; var TapState: TNSPLmsTapState);
procedure nspdLmsSetDlyl(inDlyl: PDoubleArray; var State: TNSPLmsState);
procedure nspdLmsSetErrVal(Err: Double; var State: TNSPLmsState);
procedure nspdLmsSetTaps(InTaps: PDoubleArray; var State: TNSPLmsState);
function nspdMalloc(Length: Integer): PDoubleArray;
function nspdMax(Vec: PDoubleArray; Len: Integer): Double;
function nspdMean(Vec: PDoubleArray; Len: Integer): Double;
function nspdMin(Vec: PDoubleArray; Len: Integer): Double;
procedure nspdMpyRCPack2(
Src: PDoubleArray;
Dst: PDoubleArray;
Order: Integer);
procedure nspdMpyRCPack3(
SrcA: PDoubleArray;
SrcB: PDoubleArray;
Dst: PDoubleArray;
Order: Integer);
procedure nspdMpyRCPerm2(
Src: PDoubleArray;
Dst: PDoubleArray;
Order: Integer);
procedure nspdMpyRCPerm3(
SrcA: PDoubleArray;
SrcB: PDoubleArray;
Dst: PDoubleArray;
Order: Integer);
function nspdNorm(SrcA, SrcB: PDoubleArray; n: Integer; Flag: Integer): Double;
function nspdRandGaus(var State: TNSPDRandGausState): Double;
mov esp, ebp
procedure nspdRandGausInit(Seed, Mean, StDev: Double; var State: TNSPDRandGausState);
function nspdRandUni(var State: TNSPDRandUniState): Double;
mov esp, ebp
procedure nspdRandUniInit(Seed, Low, High: Double; var State: TNSPDRandUniState);
procedure nspdReal2Fft(
xSamps: PDoubleArray;
ySamps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdReal2FftNip(
xInSamps: PDoubleArray; xOutSamps: PDCplxArray;
yInSamps: PDoubleArray; yOutSamps: PDCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdRealFft(
Samps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdRealFftl(
Samps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdRealFftlNip(
inSamps: PDoubleArray;
outSamps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspdRealFftNip(
inSamps: PDoubleArray;
outSamps: PDCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions);
function nspdStdDev(Vec: PDoubleArray; Len: Integer): Double;
function nspdTone(var State: TNSPDToneState): Double;
mov esp, ebp
procedure nspdToneInit(rfreq, phase, mag: Double; var State: TNSPDToneState);
function nspdTrngl(var State: TNSPDTrnglState): Double;
mov esp, ebp
procedure nspdTrnglInit(rfrq, phase, Mag, Asym: Double; var State: TNSPDTrnglState);
procedure nspdUpSample(Src: PDoubleArray; SrcLen: Integer;
Dst: PDoubleArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspdWinBartlett(Vector: PDoubleArray; N: Integer);
procedure nspdWinBlackman(Vector: PDoubleArray; N: Integer; Alpha: Double);
procedure nspdWinBlackmanOpt(Vector: PDoubleArray; N: Integer);
procedure nspdWinBlackmanStd(Vector: PDoubleArray; N: Integer);
procedure nspdWinHamming(Vector: PDoubleArray; N: Integer);
procedure nspdWinHann(Vector: PDoubleArray; N: Integer);
procedure nspdWinKaiser(Vector: PDoubleArray; N: Integer; Beta: Double);
procedure nspdWtDecompose(var wtState: TNSPWtState; Src, Dst: PDoubleArray);
procedure nspdWtGetState(var wtState: TNSPWtState; var wtType: Integer;
var Par1, Par2, DataOrder, Level: Integer;
var fTaps: PDoubleArray; var fLen, Offset: Integer);
procedure nspdWtInit(Par1, Par2, DataOrder, Level: Integer;
var wtState: TNSPWtState; wtType: Integer);
procedure nspdWtReconstruct(var wtState: TNSPWtState; Src, Dst: PDoubleArray);
procedure nspdWtSetState(var wtState: TNSPWtState; wtType: Integer;
Par1, Par2, DataOrder, Level: Integer;
const fTaps: PDouble; const fLen, Offset: Integer);
procedure nspdzbFir(var State: TNSPFirState; inSamps: PDoubleArray;
outSamps: PDCplxArray; numIters: Integer);
procedure nspdzbFirl(const tapState: TNSPFirTapState; var dlyState: TNSPFirDlyState;
inSamps: PDoubleArray; outSamps: PDCplxArray; numIters: Integer);
procedure nspdzbIir(var State: TNSPIirState; inSamps: PDoubleArray; outSamps: PDCplxArray; NumIters: Integer);
procedure nspdzbIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState;
inSamps: PDoubleArray; outSamps: PDCplxArray;
NumIters: Integer);
function nspdzbLms(var State: TNSPLmsState; inSamps: PDoubleArray; Err: TDCplx): TDCplx;
mov esp, ebp
procedure nspdzbLmsDes(var State: TNSPLmsState;
inSamps: PDoubleArray;
DesSamps: PDCplxArray;
outSamps: PDCplxArray; NumIters: Integer);
function nspdzbLmsl(var TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PDoubleArray; Err: TDCplx): TDCplx;
mov esp, ebp
procedure nspdzbLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PDoubleArray; outSamps: PDCplxArray; NumIters: Integer);
procedure nspdzConv(x: PDoubleArray; xLen: Integer; h: PDCplxArray; hLen: Integer; y: PDCplxArray);
procedure nspdzCrossCorr(SrcA: PDoubleArray; lenA: Integer;
SrcB: PDCplxArray; lenB: Integer; Dst: PDCplxArray;
loLag, hiLag: Integer);
function nspdzDotProd(SrcA: PDoubleArray; SrcB: PDCplxArray; Len: Integer): TDCplx;
mov esp, ebp
function nspdzFir(var State: TNSPFirState; samp: double): TDCplx;
procedure nspdzFirInit(TapVals: PDCplxArray; TapsLen: Integer;
DlyVals: PDoubleArray; var State: TNSPFirState);
procedure nspdzFirInitMr(TapVals: PDCplxArray; TapsLen: Integer;
DlyVals: PDoubleArray; upFactor, upPhase: Integer;
downFactor, downPhase: Integer;
var State: TNSPFirState);
function nspdzFirl(const tapState: TNSPFirTapState;
var dlyState: TNSPFirDlyState; samp: Double): TDCplx;
mov esp, ebp
function nspdzIir(var State: TNSPIirState; Samp: Double): TDCplx;
mov esp, ebp
procedure nspdzIirInit(IirType: TNSPIirType; TapVals: PDCplxArray; Order: Integer; var State: TNSPIirState);
procedure nspdzIirInitBq(IirType: TNSPIirType; TapVals: PDCplxArray; NumQuads: Integer; var State: TNSPIirState);
function nspdzIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState; Samp: Double): TDCplx;
mov esp, ebp
function nspdzLms(var State: TNSPLmsState; Samp: Double; Err: TDCplx): TDCplx;
mov esp, ebp
function nspdzLmsDes(var State: TNSPLmsState; Samp: Double; Des: TDCplx): TDCplx;
mov esp, ebp
procedure nspdzLmsInit(LmsType: TNSPLmsType;
TapVals: PDCplxArray; TapsLen: Integer;
DlyVals: PDoubleArray; Step, Leak: Float;
ErrDly: Integer; var State: TNSPLmsState);
procedure nspdzLmsInitMr(LmsType: TNSPLmsType;
TapVals: PDCplxArray; TapsLen: Integer;
DlyVals: PDoubleArray; Step, Leak: Float;
ErrDly, DownFactor, DownPhase: Integer; var State: TNSPLmsState);
function nspdzLmsl(var TapState: TNSPLmsTapState; var DlySTate: TNSPLmsDlyState; Samp: Double; Err: TDCplx): TDCplx;
mov esp, ebp
function nspdzLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState; Samp: Double): TDCplx;
mov esp, ebp
function nspError(
Status: NSPStatus;
Func: PChar;
Context: PChar;
FileName: PChar;
Line: Integer): NSPStatus;
function nspErrorStr(Status: NSPStatus): PChar;
procedure nspFirFree(var State: TNSPFirState);
procedure nspFree(P: Pointer);
procedure nspFreeBitRevTbls;
function nspGetBitRevTbl(Order: Integer): PIntArray;
function nspGetErrMode: TNSPErrMode;
function nspGetErrStatus: NSPStatus;
function nspGetLibVersion: PNSPLibVersion;
MAX(a,b) (((a) > (b)) ? (a) : (b)) MIN(a,b) (((a) < (b)) ? (a) : (b)) nsperror.h nsperror.h (*--- Macros --------------------------------------------------------------*
#define NSP_ERROR(status,func,context)\
nspError((status),(func),(context),__FILE__,__LINE__)
#define NSP_ERRCHK(func,context)\
((nspGetErrStatus() >= 0) ? NSP_StsOk \
: NSP_ERROR(NSP_StsBackTrace,(func),(context)))
#define NSP_ASSERT(expr,func,context)\
((expr) ? NSP_StsOk \
: NSP_ERROR(NSP_StsInternal,(func),(context)))
procedure NSP_RSTERR;
begin
nspSetErrStatus(NSP_StsOk);
end;
function nspGuiBoxReport(
Status: NSPStatus;
FuncName: PChar;
Context: PChar;
FileName: PChar;
Line: Integer): NSPStatus;
procedure nspibALawToLin(src: PByteArray; dst: PLongArray; len: Integer);
procedure nspibLinToALaw(src: PLongArray; dst: PByteArray; len: Integer);
procedure nspibLinToMuLaw(src: PLongArray; dst: PByteArray; len: Integer);
procedure nspibMuLawToLin(src: PByteArray; dst: PLongArray; len: Integer);
procedure nspIirFree(var State: TNSPIirState);
-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirFree *) (* DESCRIPTION: *) (* This function must be called after all filtering is done to free *) (* dynamic memory associated with statePtr. After calling this function, *) (* statePtr should not be referenced again. *) (* PARAMETERS: *) (* statePtr - pointer to the IIR filter state structure. *) (*
function nspiMalloc(Length: Integer): PLongArray;
function nspjMalloc(Length: Integer): PICplxArray;
procedure nspLmsFree(var State: TNSPLmsState);
function nspMalloc(Length: Integer): Pointer;
nspalloc.h nspalloc.h
procedure nspMuLawToALaw(src, dst: PByteArray; len: Integer);
function nspNulDevReport(
Status: NSPStatus;
FuncName: PChar;
Context: PChar;
FileName: PChar;
Line: Integer): NSPStatus;
function nspRedirectError(nspErrorFunc: TNspErrorCallBack): TNspErrorCallBack;
procedure nspsAutoCorr(Src: PFloatArray; Len: Integer; Dst: PFloatArray; nLags: Integer;
corrType: TNSPAutoCorrType);
------------------------------------------------------------------------*/ AutoCorrelation */ */
Normal:
~~~~~~~
dst[n] = S ~src[k] * src[k+n], 0 <= n < nLags
0 <= k < len
Biased:
~~~~~~~
dst[n] = K* S ~src[k] * src[k+n], 0 <= n < nLags
0 <= k < len
K = 1/len
UnBiased:
~~~~~~~~~
dst[n] = K* S ~src[k] * src[k+n], 0 <= n < nLags
0 <= k < len
K = 1/(len-n)
| src[k], 0<=k nspcorr
procedure nspsbAbs1(Vec: PFloatArray; Len: Integer);
procedure nspsbAbs2(Src: PFloatArray; Dst: PFloatArray; Len: Integer);
procedure nspsbAdd1(Val: Float; Dst: PFloatArray; n: Integer);
-------------------------------------------------------------------------*/ Vector Addition and multiplication */ These functions perform element-wise arithmetic on vectors of length n*/ dst[i]=dst[i]+val; */
procedure nspsbAdd2(Src: PFloatArray; Dst: PFloatArray; n: Integer);
dst[i]=dst[i]+src[i]; */
procedure nspsbAdd3(SrcA, SrcB: PFloatArray; Dst: PFloatArray; n: Integer);
dst[i]=srcA[i]+srcB[i]; */
procedure nspsbALawToLin(src: PByteArray; dst: PFloatArray; len: Integer);
procedure nspsbBitRev1(Vector: PFloatArray; Order: Integer);
procedure nspsbBitRev2(Src: PFloatArray; Dst: PFloatArray; Order: Integer);
procedure nspsbCopy(Src: PFloatArray; Dst: PFloatArray; n: Integer);
procedure nspsbExp1(vec: PFloatArray; len: Integer);
procedure nspsbExp2(src, dst: PFloatArray; len: Integer);
procedure nspsbFir(var State: TNSPFirState; inSamps: PFloatArray;
outSamps: PFloatArray; numIters: Integer);
procedure nspsbFirl(const tapState: TNSPFirTapState; var dlyState: TNSPFirDlyState;
inSamps: PFloatArray; outSamps: PFloatArray; numIters: Integer);
procedure nspsbFixToFloat(const src; Dst: PFloatArray; len, wordSize, fractBits, flags: Integer);
FUNCTION: */ nspbFixToFloat */ DESCRIPTION: */ Converts the fixed-point data in the input array and stores the */ results in the output array */ PARAMETERS: */ src - an input array to be converted; */ dst - an output array to store the result; */ len - a length of the arrays; */ wordSize - specifies the size of an integer in bits, */ and must be 8, 16 or 32; */ fractBits - specifies the number of fractional bits */ flags - specifies that fixed-point values are unsigned or signed */ */
procedure nspsbFloatToFix(Src: PFloatArray; var dst; len, wordSize, fractBits, flags: Integer);
-------------------------------------------------------------------------*/ bFloatToFix, bFixToFloat */ */ Vector floating-point to fixed-point and */ fixed-point to floating-point conversion */ -------------------------------------------------------------------------*/ FUNCTION: */ nspbFloatToFix */ DESCRIPTION: */ Converts the floating-point data in the input array and stores */ the results in the output array. */ PARAMETERS: */ src - an input array to be converted; */ dst - an output array to store the result; */ len - a length of the arrays; */ wordSize - specifies the size of an fix-point in bits, */ and must be 8, 16 or 32; */ fractBits - specifies the number of fractional bits */ flags - specifies the sort of the conversion and consists of the */ bitwise-OR of flags, defined in the beginnig of this file */ */
procedure nspsbFloatToInt(Src: PFloatArray; var dst; len, wordSize, Flags: Integer);
-------------------------------------------------------------------------*/ bFloatToInt, bIntToFloat */ */ Vector floating-point to integer and integer to floating-point conversion*/ -------------------------------------------------------------------------*/ FUNCTION: */ nspbFloatToInt */ DESCRIPTION: */ Converts the floating-point data in the input array and stores */ the results in the output array. */ PARAMETERS: */ src - an input array to be converted; */ dst - an output array to store the result; */ len - a length of the arrays; */ wordSize - specifies the size of an integer in bits, */ and must be 8, 16 or 32; */ flags - specifies the sort of the conversion and consists of the */ bitwise-OR of flags, defined in the beginnig of this file */ */
procedure nspsbFloatToS1516Fix(Src: PFloatArray; Dst: PLongArray; Len, Flags: Integer);
procedure nspsbFloatToS15Fix(Src: PFloatArray; Dst: PShortArray; Len, Flags: Integer);
procedure nspsbFloatToS31Fix(Src: PFloatArray; Dst: PLongArray; Len, Flags: Integer);
-------------------------------------------------------------------------*/ bFloatToS31Fix, bFloatToS15Fix, bFloatToS7Fix, bFloatToS1516Fix, */ bS31FixToFloat, bS15FixToFloat, bS7FixToFloat, bS1516FixToFloat */ Vector floating-point to fixed-point of format S.31, S.15, S.7, S15.16 */ and fixed-point of format S.31, S.15, S.7, S15.16 */ to floating-point conversion */ -------------------------------------------------------------------------*/ FUNCTION: */ nspbFloatToS31Fix */ nspbFloatToS15Fix */ nspbFloatToS7Fix */ nspbFloatToS1516Fix */ DESCRIPTION: */ Converts the floating-point data in the input array and stores */ the results in the output array. */ nsp?bFloatToS31Fix() to format of S.31 (a sign bit,31 fractional bits)*/ nsp?bFloatToS15Fix() to format of S.15 (a sign bit,15 fractional bits)*/ nsp?bFloatToS7Fix() to format of S.7 (a sign bit,7 fractional bits)*/ nsp?bFloatToS1516Fix() to format of S15.16 */ (a sign bit, 15 integer bits, 16 fractional bits) */ PARAMETERS: */ src - an input array to be converted; */ dst - an output array to store the result; */ len - a length of the arrays; */ flags - specifies the sort of the conversion and consists of the */ bitwise-OR of flags, defined in the beginnig of this file */
procedure nspsbFloatToS7Fix(Src: PFloatArray; Dst: PByteArray; Len, Flags: Integer);
function nspsbGoertz(var State: TNspSGoertzState; inSamps: PFloatArray; Len: Integer): TSCplx;
procedure nspsbIir(var State: TNSPIirState; inSamps: PFloatArray; outSamps: PFloatArray; NumIters: Integer);
-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspbIir *) (* nspbIir *) (* DESCRIPTION: *) (* These functions filter a block of numIters samples inSamps through an *) (* IIR filter and return the result in outSamps. *) (* PARAMETERS: *) (* statePtr - input, pointer to the IIR state structure; *) (* inSamps - input, the pointer to block of numIters samples; *) (* outSamps - output, the pointer to block of numIters filtered samples; *) (* numIters - input, the size of samples' block. *) (*
procedure nspsbIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState;
inSamps: PFloatArray; outSamps: PFloatArray;
NumIters: Integer);
procedure nspsbIntToFloat(const src; Dst: PFloatArray; len, wordSize, flags: Integer);
FUNCTION: */ nspbIntToFloat */ DESCRIPTION: */ Converts the integer data in the input array and stores the results */ in the output array */ PARAMETERS: */ src - an input array to be converted; */ dst - an output array to store the result; */ len - a length of the arrays; */ wordSize - specifies the size of an integer in bits, */ and must be 8, 16 or 32; */ flags - specifies that integer values are unsigned or signed. */ */
procedure nspsbInvThresh1(Vec: PFloatArray; Len: Integer; Thresh: Float);
procedure nspsbInvThresh2(Src: PFloatArray; Dst: PFloatArray; Len: Integer; Thresh: Float);
procedure nspsbLinToALaw(src: PFloatArray; dst: PByteArray; len: Integer);
procedure nspsbLinToMuLaw(src: PFloatArray; dst: PByteArray; len: Integer);
function nspsbLms(var State: TNSPLmsState; inSamps: PFloatArray; Err: Float): Float;
procedure nspsbLmsDes(var State: TNSPLmsState; const InSamps, DesSamps: TFloatArray;
outSamps: PFloatArray; NumIters: Integer);
function nspsbLmsl(var TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PFloatArray; Err: Float): Float;
procedure nspsbLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PFloatArray; outSamps: PFloatArray; NumIters: Integer);
procedure nspsbLn1 (vec: PFloatArray; len: Integer);
PVCS: $Workfile: NSPLNEXP.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:28 $ $Archive: X:/nsp40_arc/INCLUDE/NSPLNEXP.H_v $ // Purpose : Compute the natural log of vector elements Compute e to the power of vector elements // Contents: nsp?bLn1 - Computes the natural log of each element in the array in-place nsp?bLn2 - Computes the natural log of each element in the array and stores the results in the another array nsp?bExp1 - Computes e to the power of each element in the array in-place nsp?bExp2 - Computes e to the power of each element in the array and stores the results in the another array // nsplnexp.h
procedure nspsbLn2 (src, dst: PFloatArray; len: Integer);
procedure nspsbMpy1(Val: Float; Dst: PFloatArray; n: Integer);
dst[i]=dst[i]*val; */
procedure nspsbMpy2(Src: PFloatArray; Dst: PFloatArray; n: Integer);
dst[i]=dst[i]*src[i]; */
procedure nspsbMpy3(SrcA, SrcB: PFloatArray; Dst: PFloatArray; n: Integer);
dst[i]=srcA[i]*srcB[i]; */
procedure nspsbMuLawToLin(src: PByteArray; dst: PFloatArray; len: Integer);
procedure nspsbNormalize(Src, Dst: PFloatArray; n: Integer;
Offset, Factor: Float);
procedure nspsbRandGaus(var State: TNSPSRandGausState; Samps: PFloatArray; SampsLen: Integer);
procedure nspsbRandUni(var State: TNSPSRandUniState; Samps: PFloatArray; SampsLen: Integer);
procedure nspsbrCartToPolar(srcReal, srcImag: PFloatArray; Mag, Phase: PFloatArray; Len: Integer);
FUNCTION: */ nspbrCartToPolar */ DESCRIPTION: */ Convert cartesian coordinate to polar. Input data are formed as */ two different real vectors. */ PARAMETERS: */ srcReal - an input vector containing the coordinates X; */ srcImag - an input vector containing the coordinates Y; */ mag - an output vector to store the magnitude components; */ phase - an output vector to store the phase components (in rad)); */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspsbrMag(srcReal, srcImag: PFloatArray; Mag: PFloatArray; Length: Integer);
FUNCTION: */ nspbrMag */ DESCRIPTION: */ Compute the magnitude of complex data formed as two real vectors. */ PARAMETERS: */ srcReal - an input vector containing a real part of complex data */ srcImag - an input vector containing an imag. part of complex data */ mag - an output vector to store the magnitude components; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspsbrPhase(srcReal, srcImag: PFloatArray; Phase: PFloatArray; Length: Integer);
FUNCTION: */ nspbrPhase */ DESCRIPTION: */ Compute the phase of complex data formed as two real vectors. */ PARAMETERS: */ srcReal - an input vector containing a real part of complex data */ srcImag - an input vector containing an imag. part of complex data */ phase - an output vector to store the magnitude components; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspsbrPolarToCart(Mag, Phase: PFloatArray; DstReal, DstImag: PFloatArray; Len: Integer);
FUNCTION: */ nspbrPolarToCart */ DESCRIPTION: */ Convert polar coordinate to cartesian. Output data are formed as */ two real vectors. */ PARAMETERS: */ mag - an input vector containing the magnitude components; */ phase - an input vector containing the phase components(in rad)); */ dstReal - an output complex vector to store the coordinates X; */ dstImag - an output complex vector to store the coordinates Y; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspsbrPowerSpectr(SrcReal, SrcImag, Spectr: PFloatArray; Length: Integer);
FUNCTION: */ nspbrPowerSpectr */ DESCRIPTION: */ Compute the power spectrum of complex data formed as two real vectors */ PARAMETERS: */ srcReal - an input vector containing a real part of complex data */ srcImag - an input vector containing an imag. part of complex data */ mag - an output vector to store the power spectrum components; */ len - a length of the arrays; */ ERRORS: */ 1) Some of pointers to input or output data are NULL */ 2) The length of the arrays is less or equal zero */ These errors are registered only if NSP_DEBUG is defined */ */
procedure nspsbS1516FixToFloat(Src: PLongArray ; Dst: PFloatArray; Len: Integer);
procedure nspsbS15FixToFloat(Src: PShortArray; Dst: PFloatArray; Len: Integer);
procedure nspsbS31FixToFloat(Src: PLongArray ; Dst: PFloatArray; Len: Integer);
FUNCTION: */ nspbS31FixToFloat */ nspbS15FixToFloat */ nspbS7FixToFloat */ nspbS1516FixToFloat */ DESCRIPTION: */ Converts the fixed-point data in the input array and stores the */ results in the output array */ nsp?bS31FixToFloat() from format of S.31(a sign bit,31 fractional bits)*/ nsp?bS15FixToFloat() from format of S.15(a sign bit,15 fractional bits)*/ nsp?bS7FixToFloat() from format of S.7 (a sign bit,7 fractional bits)*/ nsp?bS1516FixToFloat() from format of S15.16 */ (a sign bit, 15 integer bits, 16 fractional bits) */ PARAMETERS: */ src - an input array to be converted; */ dst - an output array to store the result; */ len - a length of the arrays; */ */
procedure nspsbS7FixToFloat(Src: PByteArray ; Dst: PFloatArray; Len: Integer);
procedure nspsbSet(Val: Float; Dst: PFloatArray; n: Integer);
procedure nspsbSqr1(Vec: PFloatArray; Len: Integer);
nspvec
procedure nspsbSqr2(Src: PFloatArray; Dst: PFloatArray; Len: Integer);
procedure nspsbSqrt1(Vec: PFloatArray; Len: Integer);
procedure nspsbSqrt2(Src: PFloatArray; Dst: PFloatArray; Len: Integer);
procedure nspsbSub1(Val: Float; Dst: PFloatArray; n: Integer);
dst[i]=dst[i]-val; */
procedure nspsbSub2(Val: PFloatArray; Dst: PFloatArray; n: Integer);
dst[i]=dst[i]-val[i]; */
procedure nspsbSub3(Src, Val: PFloatArray; Dst: PFloatArray; n: Integer);
dst[i]=src[i]-val[i]; */
procedure nspsbThresh1(Vec: PFloatArray; Len: Integer; thresh: Float; relOp: Integer);
procedure nspsbThresh2(Src: PFloatArray; Dst: PFloatArray; Len: Integer;
thresh: Float; relOp: Integer);
procedure nspsbTone(var State: TNSPSToneState; Samps: PFloatArray; SampsLen: Integer);
procedure nspsbTrngl(var State: TNSPSTrnglState; Samps: PFloatArray; SampsLen: Integer);
procedure nspsbZero(Dst: PFloatArray; n: Integer);
-------------------------------------------------------------------------*/ Vector Initialization */ These functions initialize vectors of length n. */
procedure nspscbFir(var State: TNSPFirState; inSamps: PFloatArray;
outSamps: PSCplxArray; numIters: Integer);
procedure nspscbFirl(const tapState: TNSPFirTapState; var dlyState: TNSPFirDlyState;
inSamps: PFloatArray; outSamps: PSCplxArray; numIters: Integer);
procedure nspscbIir(var State: TNSPIirState; inSamps: PFloatArray; outSamps: PSCplxArray; NumIters: Integer);
procedure nspscbIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState;
inSamps: PFloatArray; outSamps: PSCplxArray;
NumIters: Integer);
function nspscbLms(var State: TNSPLmsState; inSamps: PFloatArray; Err: TSCplx): TSCplx;
procedure nspscbLmsDes(var State: TNSPLmsState;
inSamps: PFloatArray;
DesSamps: PSCplxArray;
outSamps: PSCplxArray; NumIters: Integer);
function nspscbLmsl(var TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PFloatArray; Err: TSCplx): TSCplx;
procedure nspscbLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PFloatArray; outSamps: PSCplxArray; NumIters: Integer);
procedure nspscConv(x: PFloatArray; xLen: Integer; h: PSCplxArray; hLen: Integer; y: PSCplxArray);
procedure nspscCrossCorr(SrcA: PFloatArray; lenA: Integer;
SrcB: PSCplxArray; lenB: Integer; Dst: PSCplxArray;
loLag, hiLag: Integer);
procedure nspsCcs2Fft(
xSamps: PFloatArray;
ySamps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsCcs2FftNip(
xInSamps: PSCplxArray; xOutSamps: PFloatArray;
yInSamps: PSCplxArray; yOutSamps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsCcsFft(
Samps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsCcsFftl(
Samps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsCcsFftlNip(
inSamps: PFloatArray;
outSamps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsCcsFftNip(
inSamps: PSCplxArray;
outSamps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
function nspscDotProd(SrcA: PFloatArray; SrcB: PSCplxArray; Len: Integer): TSCplx;
function nspscFir(var State: TNSPFirState; samp: float): TSCplx;
procedure nspscFirInit(TapVals: PSCplxArray; TapsLen: Integer;
DlyVals: PFloatArray; var State: TNSPFirState);
procedure nspscFirInitMr(TapVals: PSCplxArray; TapsLen: Integer;
DlyVals: PfloatArray; upFactor, upPhase: Integer;
downFactor, downPhase: Integer;
var State: TNSPFirState);
function nspscFirl(const tapState: TNSPFirTapState;
var dlyState: TNSPFirDlyState; samp: Float): TSCplx;
function nspscIir(var State: TNSPIirState; Samp: Float): TSCplx;
procedure nspscIirInit(IirType: TNSPIirType; TapVals: PSCplxArray; Order: Integer; var State: TNSPIirState);
procedure nspscIirInitBq(IirType: TNSPIirType; TapVals: PSCplxArray; NumQuads: Integer; var State: TNSPIirState);
function nspscIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState; Samp: Float): TSCplx;
function nspscLms(var State: TNSPLmsState; Samp: Float; Err: TSCplx): TSCplx;
function nspscLmsDes(var State: TNSPLmsState; Samp: Float; Des: TSCplx): TSCplx;
procedure nspscLmsInit(LmsType: TNSPLmsType;
TapVals: PSCplxArray; TapsLen: Integer;
DlyVals: PFloatArray; Step, Leak: Float;
ErrDly: Integer; var State: TNSPLmsState);
procedure nspscLmsInitMr(LmsType: TNSPLmsType;
TapVals: PSCplxArray; TapsLen: Integer;
DlyVals: PFloatArray; Step, Leak: Float;
ErrDly, DownFactor, DownPhase: Integer; var State: TNSPLmsState);
function nspscLmsl(var TapState: TNSPLmsTapState; var DlySTate: TNSPLmsDlyState; Samp: Float; Err: TSCplx): TSCplx;
function nspscLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState; Samp: Float): TSCplx;
procedure nspsConv(x: PFloatArray; xLen: Integer; h: PFloatArray; hLen: Integer; y: PFloatArray);
PVCS: $Workfile: NSPCONV.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:20 $ $Archive: X:/nsp40_arc/INCLUDE/NSPCONV.H_v $ // Purpose: NSP Convolution (*-------------------------------------------------------------------------*) (* Conv *) (* *) (* Performs finite, linear convolution of two sequences. nspconv
procedure nspsConv2D(x: PFloatArray; xCols, xRows: Integer; h: PFloatArray; hCols, hRows: Integer; y: PFloatArray);
PVCS: $Workfile: NSPCNV2D.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:20 $ $Archive: X:/nsp40_arc/INCLUDE/NSPCNV2D.H_v $ // Purpose: NSP 2D Filtering Functions (*
* Conv2D
*
* Perform finite, linear convolution of two two-dimensional signals.
nspcnv2d
procedure nspsCrossCorr(SrcA: PFloatArray; lenA: Integer;
SrcB: PFloatArray; lenB: Integer; Dst: PFloatArray;
loLag, hiLag: Integer);
------------------------------------------------------------------------*/ CrossCorralation */
dst[n] = S ~srcA[k] * srcB[k+n+loLag], 0 <= n <= hiLag-loLag
0 <= k < lenA
| srcB[k], 0<=k
procedure nspsDct(Src, Dst: PFloatArray; Len, Flags: Integer);
function NSPsDegToRad(deg: Float): Float;
function nspsDotProd(SrcA, SrcB: PFloatArray; Len: Integer): Float;
PVCS: $Workfile: nspdotp.h $ $Revision: 1 $ $Date: 28/04/97 12:15 $ $Archive: /gres/project/nsp/dotp/nspdotp.h $ // Purpose: NSP Vector Product Functions nspdotp
procedure nspsDownSample(Src: PFloatArray; SrcLen: Integer;
Dst: PFloatArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
------------------------------------------------------------------------*/ DownSample */ */ Down-sample a signal, conceptually decreasing its sample rate by an */ integer factor and forming output parameters for next sampling; */
procedure nspSetErrMode(Mode: TNSPErrMode);
procedure nspSetErrStatus(Status: NSPStatus);
procedure nspsFilter2D(x: PFloatArray; xCols, xRows: Integer; h: PFloatArray; hCols, hRows: Integer; y: PFloatArray);
PVCS: $Workfile: Nspfir2.h $ $Revision: 1 $ $Date: 22/04/97 9:13 $ $Archive: /gres/project/nsp/filter2/Nspfir2.h $ // Purpose: NSP20 Filter2D nspfir2
function nspsFir(var State: TNSPFirState; samp: Float): Float;
-------------------------------------------------------------------------*/ nsp?Fir(), nsp?bFir() */ */ Dot and block product FIRH filtering */
procedure nspsFirGetDlyl(const State: TNSPFirState; OutDlyl: PFloatArray);
-------------------------------------------------------------------------*/ nsp?FirGetDlyl(), nsp?FirSetDlyl() */ */ Utility functions to get and set the FIR delay line contents */
procedure nspsFirGetTaps(const State: TNSPFirState; OutTaps: PFloatArray);
-------------------------------------------------------------------------*/ nsp?FirGetTaps(), nsp?FirSetTaps() */ */ Utility functions to get and set the FIR taps coefficients */
procedure nspsFirInit(TapVals: PFloatArray; TapsLen: Integer;
DlyVals: PFloatArray; var State: TNSPFirState);
TNSPFirState -------------------------------------------------------------------------*/ nsp?FirInit(), nsp?FirInitMr() */ nspFirFree() */ */ Initialize a finite impulse response high-level (FIRH) filter */ nspfirh.h
procedure nspsFirInitMr(TapVals: PFloatArray; TapsLen: Integer;
DlyVals: PFloatArray; upFactor, upPhase: Integer;
downFactor, downPhase: Integer;
var State: TNSPFirState);
function nspsFirl(const tapState: TNSPFirTapState;
var dlyState: TNSPFirDlyState; samp: float): float;
* ------------------------------------------------------------------------*/ * Firl, bFirl */ * */ * Filter either a single sample or block of samples through a low-level */ * FIR filter. */
procedure nspsFirlGetDlyl(const tapState: TNSPFirTapState;
const dlyState: TNSPFirDlyState; OutDlyl: PFloatArray);
------------------------------------------------------------------------*/ FirlGetDlyl, FirlSetDlyl */ */ Utility functions to get and set the delay line contents of low-level */ FIR filters. */
procedure nspsFirlGetTaps(const tapState: TNSPFirTapState; OutTaps: PFloatArray);
* ------------------------------------------------------------------------*/ * FirlGetTaps, FirlSetTaps */ * */ * Utility functions to get and set the tap coefficients of low-level FIR */ * filters. */
procedure nspsFirlInit(Taps: PFloatArray; TapsLen: Integer; var tapState: TNSPFirTapState);
* ------------------------------------------------------------------------*/ * FirlInit, FirlInitMr, FirlInitDlyl */ * */ * Low level functions for cyclic FIR filtering via a tapped delay line. */
procedure nspsFirlInitDlyl(const tapState: TNSPFirTapState; Dlyl: PFloatArray;
var dlyState: TNSPFirDlyState);
procedure nspsFirlInitMr(Taps: PFloatArray; TapsLen, upFactor, upPhase: Integer;
downFactor, downPhase: Integer; var tapState: TNSPFirTapState);
procedure nspsFirlSetDlyl(const tapState: TNSPFirTapState; inDlyl: PFloatArray;
var dlyState: TNSPFirDlyState);
procedure nspsFirlSetTaps(InTaps: PFloatArray; var tapState: TNSPFirTapState);
procedure nspsFirSetDlyl(inDlyl: PFloatArray; var State: TNSPFirState);
procedure nspsFirSetTaps(InTaps: PFloatArray; var State: TNSPFirState);
function nspsGoertz(var State: TNspSGoertzState; Sample: Float): TSCplx;
Goertz */ Single Frequency DFT (Goertzel algorithm) */
procedure nspsGoertzInit(Freq: Float; var State: TNspSGoertzState);
GoertzInit */ Initializes the coefficients and zeros the delay line. */
procedure nspsGoertzReset(var State: TNspSGoertzState);
GoertzReset */ Zeros the delay line. */
function nspsIir(var State: TNSPIirState; Samp: Float): Float;
-------------------------------------------------------------------------*) (* Iir, bIir *) (* *) (* Filter a signal through a IIR filter. *) (* *) (*-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIir *) (* nspIir *) (* DESCRIPTION: *) (* These functions filter a single sample samp through an IIR filter and *) (* return the result. *) (* PARAMETERS: *) (* statePtr - input, pointer to the IIR state structure; *) (* samp - input, the sample value. *) (* RETURNS: *) (* the filtering result. *) (*
procedure nspsIirInit(IirType: TNSPIirType; TapVals: PFloatArray; Order: Integer; var State: TNSPIirState);
procedure nspsIirInitBq(IirType: TNSPIirType; TapVals: PFloatArray; NumQuads: Integer; var State: TNSPIirState);
function nspsIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState; Samp: Float): Float;
procedure nspsIirlInit(IirType: TNSPIirType; Taps: PFloatArray; Order: Integer; var TapState: TNSPIirTapState);
procedure nspsIirlInitBq(IirType: TNSPIirType; Taps: PFloatArray; NumQuads: Integer; var TapState: TNSPIirTapState);
procedure nspsIirlInitDlyl(const TapState: TNSPIirTapState; Dlyl: PFloatArray; var DlyState: TNSPIirDlyState);
function nspsLms(var State: TNSPLmsState; Samp, Err: Float): Float;
function nspsLmsDes(var State: TNSPLmsState; Samp: Float; Des: Float): Float;
procedure nspsLmsGetDlyl(const State: TNSPLmsState; OutDlyl: PFloatArray);
function nspsLmsGetErrVal(const State: TNSPLmsState): Float;
function nspsLmsGetLeak(const State: TNSPLmsState): Float;
function nspsLmsGetStep(const State: TNSPLmsState): Float;
procedure nspsLmsGetTaps(const State: TNSPLmsState; OutTaps: PFloatArray);
procedure nspsLmsInit(LmsType: TNSPLmsType;
TapVals: PFloatArray; TapsLen: Integer;
DlyVals: PFLoatArray; Step, Leak: Float;
ErrDly: Integer; var State: TNSPLmsState);
procedure nspsLmsInitMr(LmsType: TNSPLmsType;
TapVals: PFloatArray; TapsLen: Integer;
DlyVals: PFLoatArray; Step, Leak: Float;
ErrDly, DownFactor, DownPhase: Integer; var State: TNSPLmsState);
function nspsLmsl(var TapState: TNSPLmsTapState; var DlySTate: TNSPLmsDlyState; Samp, Err: Float): Float;
-------------------------------------------------------------------------*) (* Lmsl, bLmsl *) (* *) (* Filter samples through a low-level LMS filter.
procedure nspsLmslGetDlyl(const TapState: TNSPLmsTapState; const DlyState: TNSPLmsDlyState; OutDlyl: PFloatArray);
function nspsLmslGetLeak(const State: TNSPLmsTapState): Float;
function nspsLmslGetStep(const State: TNSPLmsTapState): Float;
-------------------------------------------------------------------------*) (* LmslGetStep, LmslSetStep, LmslGetLeak, LmslSetLeak *) (* *) (* Utility functions to get and set the leak and step values of a *) (* low-level LMS filter.
procedure nspsLmslGetTaps(const TapState: TNSPLmsTapState; OutTaps: PFloatArray);
procedure nspsLmslInit(LmsType: TNSPLmsType; Taps: PFloatArray; TapsLen: Integer;
Step, Leak: Float; ErrDly: Integer; var TapState: TNSPLmsTapState);
------------------------------------------------------------------------*) (* LmslInit, LmslInitMr, LmslInitDlyl *) (* *) (* Initialize an adaptive FIR filter that uses the least mean-square *) (* (LMS) algorithm. *) (*--- Single-rate init ----------------------------------------------------
procedure nspsLmslInitDlyl(var TapState: TNSPLmsTapState; Dlyl: PFloatArray; AdaptB: Integer; var DlyState: TNSPLmsDlyState);
--- Delay line init -----------------------------------------------------
procedure nspsLmslInitMr(LmsType: TNSPLmsType; Taps: PFloatArray; TapsLen: Integer;
Step, Leak: Float; ErrDly, DownFactor, DownPhase: Integer; var TapState: TNSPLmsTapState);
--- Multi-rate init -----------------------------------------------------
function nspsLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState; Samp: Float): Float;
------------------------------------------------------------------------*) (* LmslNa, bLmslNa *) (* *) (* Filter a signal using a LMS filter, but without adapting the filter.
procedure nspsLmslSetDlyl(const TapState: TNSPLmsTapState; inDlyl: PFloatArray; var DlyState: TNSPLmsDlyState);
procedure nspsLmslSetLeak(Leak: Float; var State: TNSPLmsTapState);
procedure nspsLmslSetStep(Step: Float; var State: TNSPLmsTapState);
procedure nspsLmslSetTaps(InTaps: PFloatArray; var TapState: TNSPLmsTapState);
procedure nspsLmsSetDlyl(inDlyl: PFloatArray; var State: TNSPLmsState);
procedure nspsLmsSetErrVal(Err: Float; var State: TNSPLmsState);
procedure nspsLmsSetLeak(Leak: Float; var State: TNSPLmsState);
procedure nspsLmsSetStep(Step: Float; var State: TNSPLmsState);
procedure nspsLmsSetTaps(InTaps: PFloatArray; var State: TNSPLmsState);
function nspsMalloc(Length: Integer): PFloatArray;
function nspsMax(Vec: PFloatArray; Len: Integer): Float;
function nspsMean(Vec: PFloatArray; Len: Integer): Float;
function nspsMin(Vec: PFloatArray; Len: Integer): Float;
procedure nspsMpyRCPack2(
Src: PFloatArray;
Dst: PFloatArray;
Order: Integer);
procedure nspsMpyRCPack3(
SrcA: PFloatArray;
SrcB: PFloatArray;
Dst: PFloatArray;
Order: Integer);
procedure nspsMpyRCPerm2(
Src: PFloatArray;
Dst: PFloatArray;
Order: Integer);
procedure nspsMpyRCPerm3(
SrcA: PFloatArray;
SrcB: PFloatArray;
Dst: PFloatArray;
Order: Integer);
function nspsNorm(SrcA, SrcB: PFloatArray; n: Integer; Flag: Integer): Float;
function nspsRandGaus(var State: TNSPSRandGausState): Float;
procedure nspsRandGausInit(Seed, Mean, StDev: Float; var State: TNSPSRandGausState);
Normal distribution.
Algorithm by G.Box and M.Muller and by G.Marsaglia (Reference:
D.Knuth. The Art of Computer Programming. vol.2, 1969) are used
to build generator of normally distributed random numbers.
function nspsRandUni(var State: TNSPSRandUniState): Float;
procedure nspsRandUniInit(Seed, Low, High: Float; var State: TNSPSRandUniState);
PVCS: $Workfile: NSPRAND.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:30 $ $Archive: X:/nsp40_arc/INCLUDE/NSPRAND.H_v $ (*
Uniform distribution.
Algorithm by G.Marsaglia and A.Zaman (Computers in Physics, vol.8,
#1, 1994, 117) are used to build generator of uniformly distributed
random numbers.
procedure nspsReal2Fft(
xSamps: PFloatArray;
ySamps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsReal2FftNip(
xInSamps: PFloatArray; xOutSamps: PSCplxArray;
yInSamps: PFloatArray; yOutSamps: PSCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsRealFft(
Samps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsRealFftl(
Samps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsRealFftlNip(
inSamps: PFloatArray;
outSamps: PFloatArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspsRealFftNip(
inSamps: PFloatArray;
outSamps: PSCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions);
function nspsStdDev(Vec: PFloatArray; Len: Integer): Float;
function nspStdErrReport(
Status: NSPStatus;
FuncName: PChar;
Context: PChar;
FileName: PChar;
Line: Integer): NSPStatus;
function nspsTone(var State: TNSPSToneState): Float;
procedure nspsToneInit(rfreq, phase, mag: Float; var State: TNSPSToneState);
function nspsTrngl(var State: TNSPSTrnglState): Float;
procedure nspsTrnglInit(rfrq, phase, Mag, Asym: Float; var State: TNSPSTrnglState);
procedure nspsUpSample(Src: PFloatArray; SrcLen: Integer;
Dst: PFloatArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
PVCS: $Workfile: NSPSAMPL.H $ $Revision: 1.0 $ $Modtime: Dec 16 1996 17:47:12 $ // Purpose: NSP sample ------------------------------------------------------------------------*/ UpSample */ */ Up-sample a signal, conceptually increasing its sampling rate by an */ integer factor and forming output parameters for next sampling; */ nspsampl
procedure nspsWinBartlett(Vector: PFloatArray; N: Integer);
PVCS: $Workfile: NSPWIN.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:32 $ $Archive: X:/nsp40_arc/INCLUDE/NSPWIN.H_v $ // Purpose: NSP Windowing Functions. Declaration // Win */ Multiply a vector by a windowing function. */
procedure nspsWinBlackman(Vector: PFloatArray; N: Integer; Alpha: Float);
procedure nspsWinBlackmanOpt(Vector: PFloatArray; N: Integer);
procedure nspsWinBlackmanStd(Vector: PFloatArray; N: Integer);
procedure nspsWinHamming(Vector: PFloatArray; N: Integer);
procedure nspsWinHann(Vector: PFloatArray; N: Integer);
procedure nspsWinKaiser(Vector: PFloatArray; N: Integer; Beta: Float);
procedure nspsWtDecompose(var wtState: TNSPWtState; Src, Dst: PFloatArray);
------------------------------------------------------------------------ */ */ Wavelet decomposition. */ */ ------------------------------------------------------------------------ */
procedure nspsWtGetState(var wtState: TNSPWtState; var wtType: Integer;
var Par1, Par2, DataOrder, Level: Integer;
var fTaps: PFloatArray; var fLen, Offset: Integer);
------------------------------------------------------------------------ */ */ Get all parameters of wavelet. */ */ ------------------------------------------------------------------------ */
procedure nspsWtInit(Par1, Par2, DataOrder, Level: Integer;
var wtState: TNSPWtState; wtType: Integer);
------------------------------------------------------------------------ */ */ The initialization of the wavelet transform. */ */ ------------------------------------------------------------------------ */
procedure nspsWtReconstruct(var wtState: TNSPWtState; Src, Dst: PFloatArray);
------------------------------------------------------------------------ */ */ Wavelet reconstruction. */ */ ------------------------------------------------------------------------ */
procedure nspsWtSetState(var wtState: TNSPWtState; wtType: Integer;
Par1, Par2, DataOrder, Level: Integer;
const fTaps: PFloatArray; const fLen, Offset: Integer);
------------------------------------------------------------------------ */ */ Set all parameters of wavelet. */ */ ------------------------------------------------------------------------ */
function nspvAdd(a, b: TWCplx; scaleMode: Integer; var scaleFactor: Integer): TWCplx;
-------------------------------------------------------------------------*/ Miscellaneous Scalar Functions and Vector Functions */ Complex Add, Sub, Mpy, Div, Conj */ These functions perform addition, subtraction, multiplication, */ division, and conjugation on complex numbers a and b. */ */
procedure nspvAutoCorr(Src: PWCplxArray; Len: Integer; Dst: PWCplxArray; nLags: Integer;
corrType: TNSPAutoCorrType;
scaleMode: Integer; var Scale: Integer);
procedure nspvb2RealToCplx(srcReal, srcImag: PShortArray; Dst: PWCplxArray; Length: Integer);
procedure nspvbAdd1(Val: TWCplx; Dst: PWCplxArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbAdd2(Src: PWCplxArray; Dst: PWCplxArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbAdd3(SrcA, SrcB: PWCplxArray; Dst: PWCplxArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbBitRev1(Vector: PWCplxArray; Order: Integer);
procedure nspvbBitRev2(Src: PWCplxArray; Dst: PWCplxArray; Order: Integer);
procedure nspvbConj1(Vec: PWCplxArray; n: Integer);
-------------------------------------------------------------------------*/ Complex conjugates of vectors */
procedure nspvbConj2(Src: PWCplxArray; Dst: PWCplxArray; n: Integer);
procedure nspvbConjExtend1(Vec: PWCplxArray; n: Integer);
procedure nspvbConjExtend2(Src: PWCplxArray; Dst: PWCplxArray; n: Integer);
procedure nspvbConjFlip2(Src: PWCplxArray; Dst: PWCplxArray; n: Integer);
procedure nspvbCopy(Src: PWCplxArray; Dst: PWCplxArray; n: Integer);
procedure nspvbCplxTo2Real(Src: PWCplxArray; DstReal, DstImag: PShortArray; Length: Integer);
function nspvbGoertz(var State: TNspVGoertzState; inSamps: PWCplxArray; Len, ScaleMode: Integer; var ScaleFactor: Integer): TWCplx;
procedure nspvbImag(Src: PWCplxArray; Dst: PShortArray; Length: Integer);
procedure nspvbMag(Src: PWCplxArray; Mag: PShortArray; Length: Integer;
ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbMpy1(Val: TWCplx; Dst: PWCplxArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbMpy2(Src: PWCplxArray; Dst: PWCplxArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbMpy3(SrcA, SrcB: PWCplxArray; Dst: PWCplxArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbNormalize(Src, Dst: PWCplxArray; n: Integer;
Offset: TWCplx; Factor: Float);
procedure nspvbPhase(Src: PWCplxArray; Phase: PShortArray; Length: Integer);
procedure nspvbPowerSpectr(Src: PWCplxArray; Spectr: PShortArray; Length: Integer;
ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbRandGaus(var State: TNSPVRandGausState; Samps: PWCplxArray; SampsLen: Integer);
procedure nspvbRandUni(var State: TNSPVRandUniState; Samps: PWCplxArray; SampsLen: Integer);
procedure nspvbReal(Src: PWCplxArray; Dst: PShortArray; Length: Integer);
procedure nspvbSet(re, im: Short; Dst: PWCplxArray; n: Integer);
procedure nspvbSqr1(Vec: PWCplxArray; Len, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbSqr2(Src: PWCplxArray; Dst: PWCplxArray; Len, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbSqrt1(Vec: PWCplxArray; Len: Integer);
procedure nspvbSqrt2(Src: PWCplxArray; Dst: PWCplxArray; Len: Integer);
procedure nspvbSub1(Val: TWCplx; Dst: PWCplxArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbSub2(Val: PWCplxArray; Dst: PWCplxArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbSub3(Src, Val: PWCplxArray; Dst: PWCplxArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspvbThresh1(Vec: PWCplxArray; Len: Integer; thresh: Short; relOp: Integer);
procedure nspvbThresh2(Src: PWCplxArray; Dst: PWCplxArray; Len: Integer;
thresh: Short; relOp: Integer);
procedure nspvbTone(var State: TNSPVToneState; Samps: PWCplxArray; SampsLen: Integer);
procedure nspvbTrngl(var State: TNSPVTrnglState; Samps: PWCplxArray; SampsLen: Integer);
procedure nspvbZero(Dst: PWCplxArray; n: Integer);
procedure nspvCalcDftTwdTbl(var Tbl: TWCplx; Length: Integer);
*/ GetFftTwdTbl, GetDftTwdTbl, FreeTwdTbls */ */ Compute and store twiddle factors for FFT and DFT computations. */
procedure nspvCalcFftTwdTbl(var Tbl: TWCplx; Order: Integer);
function nspvConj(a: TWCplx): TWCplx;
procedure nspvCrossCorr(SrcA: PWCplxArray; lenA: Integer;
SrcB: PWCplxArray; lenB: Integer; Dst: PWCplxArray;
loLag, hiLag, ScaleMode: Integer; var Scale: Integer);
procedure nspvDft(
inSamps: PWCplxArray;
outSamps: PWCplxArray;
Length: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
nspfft.h
function nspvDiv(a, b: TWCplx): TWCplx;
function nspvDotProd(SrcA, SrcB: PWCplxArray; Len, ScaleMode: Integer; var ScaleFactor: Integer): TWCplx;
procedure nspvDownSample(Src: PWCplxArray; SrcLen: Integer;
Dst: PWCplxArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspvFft(
Samps: PWCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspvFftNip(
inSamps: PWCplxArray;
outSamps: PWCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspvFreeTwdTbls;
function nspvGetDftTwdTbl(Length: Integer): PWCplxArray;
function nspvGetFftTwdTbl(Order: Integer): PWCplxArray;
function nspvGoertz(var State: TNspVGoertzState; Sample: TWCplx; ScaleMode: Integer; var ScaleFactor: Integer): TWCplx;
procedure nspvGoertzInit(Freq: Float; var State: TNspVGoertzState);
procedure nspvGoertzReset(var State: TNspVGoertzState);
function nspvMalloc(Length: Integer): PWCplxArray;
function nspvMpy(a, b: TWCplx; scaleMode: Integer; var scaleFactor: Integer): TWCplx;
function nspvNorm(SrcA, SrcB: PWCplxArray; n: Integer; Flag: Integer): Float;
function nspvRandGaus(var State: TNSPVRandGausState): TWCplx;
procedure nspvRandGausInit(Seed, Mean, StDev: Short; var State: TNSPVRandGausState);
function nspvRandUni(var State: TNSPVRandUniState): TWCplx;
procedure nspvRandUniInit(Seed: UInt; Low, High: Short; var State: TNSPVRandUniState);
procedure nspvrFft(
reSamps: PShortArray;
imSamps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspvrFftNip(
reInSamps: PShortArray;
imInSamps: PShortArray;
reOutSamps: PShortArray;
imOutSamps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
function nspvSet(re, im: Short): TWCplx;
---- Additional Functions -----------------------------------------------*/
function nspvSub(a, b: TWCplx; scaleMode: Integer; var scaleFactor: Integer): TWCplx;
function nspvTone(var State: TNSPVToneState): TWCplx;
procedure nspvToneInit(rfreq, phase: Float; mag: Short; var State: TNSPVToneState);
function nspvTrngl(var State: TNSPVTrnglState): TWCplx;
procedure nspvTrnglInit(rfrq, phase: Float; Mag: Short; Asym: Float; var State: TNSPVTrnglState);
procedure nspvUpSample(Src: PWCplxArray; SrcLen: Integer;
Dst: PWCplxArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspvwCrossCorr(SrcA: PWCplxArray; lenA: Integer;
SrcB: PShortArray; lenB: Integer; Dst: PWCplxArray;
loLag, hiLag, ScaleMode: Integer; var Scale: Integer);
function nspvwDotProd(SrcA: PWCplxArray; SrcB: PShortArray; Len, ScaleMode: Integer; var ScaleFactor: Integer): TWCplx;
procedure nspvWinBartlett(Vector: PWCplxArray; N: Integer);
procedure nspvWinBlackman(Vector: PWCplxArray; N: Integer; Alpha: Float);
procedure nspvWinBlackmanOpt(Vector: PWCplxArray; N: Integer);
procedure nspvWinBlackmanStd(Vector: PWCplxArray; N: Integer);
procedure nspvWinHamming(Vector: PWCplxArray; N: Integer);
procedure nspvWinHann(Vector: PWCplxArray; N: Integer);
procedure nspvWinKaiser(Vector: PWCplxArray; N: Integer; Beta: Float);
procedure nspwAutoCorr(Src: PShortArray; Len: Integer; Dst: PShortArray; nLags: Integer;
corrType: TNSPAutoCorrType;
scaleMode: Integer; var Scale: Integer);
procedure nspwbAbs1(Vec: PShortArray; Len: Integer);
procedure nspwbAbs2(Src: PShortArray; Dst: PShortArray; Len: Integer);
procedure nspwbAdd1(Val: Short; Dst: PShortArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
-------------------------------------------------------------------------*/ Vector Addition and multiplication */ These functions perform element-wise arithmetic on vectors of length n*/
procedure nspwbAdd2(Src: PShortArray; Dst: PShortArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspwbAdd3(SrcA, SrcB: PShortArray; Dst: PShortArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspwbALawToLin(src: PByteArray; dst: PShortArray; len: Integer);
procedure nspwbBitRev1(Vector: PShortArray; Order: Integer);
*/ bBitRev1, bBitRev2 */ */ Permute a vector into binary bit-reversed order. */ */
procedure nspwbBitRev2(Src: PShortArray; Dst: PShortArray; Order: Integer);
procedure nspwbCopy(Src: PShortArray; Dst: PShortArray; n: Integer);
procedure nspwbExp1(vec: PShortArray; len: Integer;
scaleMode: Integer; var scaleFactor: Integer);
procedure nspwbExp2(src, dst: PShortArray; len: Integer;
scaleMode: Integer; var scaleFactor: Integer);
procedure nspwbFir(var State: TNSPFirState; inSamps: PShortArray;
outSamps: PShortArray; numIters, sMode: Integer;
var sFct: Integer);
procedure nspwbFirl(const tapState: TNSPFirTapState; var dlyState: TNSPFirDlyState;
inSamps: PShortArray; outSamps: PShortArray; numIters: Integer;
scaleMode: Integer; var scaleFactor: Integer);
function nspwbGoertz(var State: TNspWGoertzState; inSamps: PShortArray; Len, ScaleMode: Integer; var ScaleFactor: Integer): TWCplx;
mov esp, ebp
procedure nspwbIir(var State: TNSPIirState; inSamps: PShortArray; outSamps: PShortArray; NumIters, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspwbIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState;
inSamps: PShortArray; outSamps: PShortArray;
NumIters, ScaleMode: Integer; var ScaleFactor: Integer);
-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspbIirl *) (* nspbIirl *) (* DESCRIPTION: *) (* filters an input block of samples throuth a low-level IIR filter and *) (* returns the result in output block. *) (* PARAMETERS: *) (* tapStPtr - input, the pointer to the tap state structure; *) (* dlyStPtr - input, the pointer to the delay line state structure; *) (* inSamps - input, the block of samples; *) (* outSamps - output, the block of filtered samples; *) (* numIters - input, the size of samples' block. *) (*
procedure nspwbLinToALaw(src: PShortArray; dst: PByteArray; len: Integer);
PVCS: $Workfile: NSPLAW.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:26 $ $Archive: X:/nsp40_arc/INCLUDE/NSPLAW.H_v $ // Purpose : Convert samples from 8-bit A-law and Mu-law encoded format to linear, or vice-versa. Contents: nsp?bLinToALaw - Convert linear PCM samples to 8-bit A-law format. nsp?bALawToLin - Convert samples from 8-bit A-law encoded format to linear PCM. nsp?bLinToMuLaw - Convert linear PCM samples to 8-bit Mu-law format. nsp?bMuLawToLin - Convert samples from 8-bit Mu-law encoded format to linear PCM. nspMuLawToALaw - Converts samples from Mu-law encoded format to A-law encoded format. nspALawToMuLaw - Converts samples from A-law encoded format to Mu-law encoded format. nsplaw.h
procedure nspwbLinToMuLaw(src: PShortArray; dst: PByteArray; len: Integer);
procedure nspwbLn1 (vec: PShortArray; len: Integer);
procedure nspwbLn2 (src, dst: PShortArray; len: Integer);
procedure nspwbMpy1(Val: Short; Dst: PShortArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
dst[i]=dst[i]*val; */
procedure nspwbMpy2(Src: PShortArray; Dst: PShortArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
dst[i]=dst[i]*src[i]; */
procedure nspwbMpy3(SrcA, SrcB: PShortArray; Dst: PShortArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
dst[i]=srcA[i]*srcB[i]; */
procedure nspwbMuLawToLin(src: PByteArray; dst: PShortArray; len: Integer);
procedure nspwbNormalize(Src, Dst: PShortArray; n: Integer;
Offset: Short; Factor: Float);
procedure nspwbRandGaus(var State: TNSPWRandGausState; Samps: PShortArray; SampsLen: Integer);
procedure nspwbRandUni(var State: TNSPWRandUniState; Samps: PShortArray; SampsLen: Integer);
procedure nspwbrMag(srcReal, srcImag: PShortArray; Mag: PShortArray; Length: Integer;
ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspwbrPhase(srcReal, srcImag: PShortArray; Phase: PShortArray; Length: Integer);
procedure nspwbrPowerSpectr(SrcReal, SrcImag, Spectr: PShortArray; Length: Integer;
ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspwbSet(Val: Short; Dst: PShortArray; n: Integer);
procedure nspwbSqr1(Vec: PShortArray; Len, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspwbSqr2(Src: PShortArray; Dst: PShortArray; Len, ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspwbSqrt1(Vec: PShortArray; Len: Integer);
procedure nspwbSqrt2(Src: PShortArray; Dst: PShortArray; Len: Integer);
procedure nspwbSub1(Val: Short; Dst: PShortArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
dst[i]=dst[i]-val; */
procedure nspwbSub2(Val: PShortArray; Dst: PShortArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
dst[i]=dst[i]-val[i]; */
procedure nspwbSub3(Src, Val: PShortArray; Dst: PShortArray; n, ScaleMode: Integer; var ScaleFactor: Integer);
dst[i]=src[i]-val[i]; */
procedure nspwbThresh1(Vec: PShortArray; Len: Integer; thresh: Short; relOp: Integer);
procedure nspwbThresh2(Src: PShortArray; Dst: PShortArray; Len: Integer;
thresh: Short; relOp: Integer);
procedure nspwbTone(var State: TNSPWToneState; Samps: PShortArray; SampsLen: Integer);
--- Array product tone functions ----------------------------------------*/
procedure nspwbTrngl(var State: TNSPWTrnglState; Samps: PShortArray; SampsLen: Integer);
--- Block-of-Samples-Generating triangle functions ----------------------*/
procedure nspwbZero(Dst: PShortArray; n: Integer);
-------------------------------------------------------------------------*/ Vector Initialization */ These functions initialize vectors of length n. */
procedure nspwCcs2Fft(
xSamps: PShortArray;
ySamps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwCcs2FftNip(
xInSamps: PWCplxArray; xOutSamps: PShortArray;
yInSamps: PWCplxArray; yOutSamps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwCcsFft(
Samps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwCcsFftl(
Samps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwCcsFftlNip(
inSamps: PShortArray;
outSamps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwCcsFftNip(
inSamps: PWCplxArray;
outSamps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwConv(x: PShortArray; xLen: Integer; h: PShortArray; hLen: Integer; y: PShortArray;
ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspwConv2D(x: PShortArray; xCols, xRows: Integer; h: PShortArray; hCols, hRows: Integer; y: PShortArray;
ScaleMode: Integer; var ScaleFactor: Integer);
procedure nspwCrossCorr(SrcA: PShortArray; lenA: Integer;
SrcB: PShortArray; lenB: Integer; Dst: PShortArray;
loLag, hiLag, ScaleMode: Integer; var Scale: Integer);
procedure nspwDct(Src, Dst: PShortArray; Len, Flags: Integer);
function nspwDotProd(SrcA, SrcB: PShortArray; Len, ScaleMode: Integer; var ScaleFactor: Integer): Short;
procedure nspwDownSample(Src: PShortArray; SrcLen: Integer;
Dst: PShortArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspwFilter2D(x: PShortArray; xCols, xRows: Integer; h: PFloatArray; hCols, hRows: Integer; y: PShortArray;
ScaleMode: Integer; var ScaleFactor: Integer);
function nspwFir(var State: TNSPFirState; samp: Short;
sMode: Integer; var sFct: Integer): Short;
procedure nspwFirGetDlyl(const State: TNSPFirState; OutDlyl: PShortArray);
procedure nspwFirGetTaps(const State: TNSPFirState; OutTaps: PFloatArray);
procedure nspwFirInit(TapVals: PFloatArray; TapsLen: Integer;
DlyVals: PShortArray; var State: TNSPFirState);
procedure nspwFirInitMr(TapVals: PFloatArray; TapsLen: Integer;
DlyVals: PShortArray;
upFactor, upPhase,
downFactor, downPhase: Integer;
var State: TNSPFirState);
function nspwFirl(const tapState: TNSPFirTapState;
var dlyState: TNSPFirDlyState; samp: Short;
scaleMode: Integer; var scaleFactor: Integer): Short;
procedure nspwFirlGetDlyl(const tapState: TNSPFirTapState;
const dlyState: TNSPFirDlyState; OutDlyl: PShortArray);
procedure nspwFirlGetTaps(const tapState: TNSPFirTapState; OutTaps: PFloatArray);
procedure nspwFirlInit(Taps: PFloatArray; TapsLen: Integer; var tapState: TNSPFirTapState);
procedure nspwFirlInitDlyl(const tapState: TNSPFirTapState; Dlyl: PShortArray;
var dlyState: TNSPFirDlyState);
procedure nspwFirlInitMr(Taps: PFloatArray; TapsLen, upFactor, upPhase: Integer;
downFactor, downPhase: Integer; var tapState: TNSPFirTapState);
procedure nspwFirlSetDlyl(const tapState: TNSPFirTapState; inDlyl: PShortArray;
var dlyState: TNSPFirDlyState);
procedure nspwFirlSetTaps(InTaps: PFloatArray; var tapState: TNSPFirTapState);
procedure nspwFirSetDlyl(inDlyl: PShortArray; var State: TNSPFirState);
procedure nspwFirSetTaps(InTaps: PFloatArray; var State: TNSPFirState);
function nspwGoertz(var State: TNspWGoertzState; Sample: Short; ScaleMode: Integer; var ScaleFactor: Integer): TWCplx;
mov esp, ebp
procedure nspwGoertzInit(Freq: Float; var State: TNspWGoertzState);
procedure nspwGoertzReset(var State: TNspWGoertzState);
function nspwIir(var State: TNSPIirState; Samp: Short; ScaleMode: Integer; var ScaleFactor: Integer): Short;
procedure nspwIirInit(IirType: TNSPIirType; TapVals: PFloatArray; Order: Integer; var State: TNSPIirState);
nspiirh // PVCS: $Workfile: NSPIIRH.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:26 $ $Archive: X:/nsp40_arc/INCLUDE/NSPIIRH.H_v $ // Purpose: NSP Infinite Impulse Response Filtering. (*-------------------------------------------------------------------------*) (* IirInit, IirInitBq, IirFree *) (* *) (* These functions initialize an IIR filter and provide a higher-level *) (* interface than the corresponding low-level IIR functions. *) (* *) (*-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirInit *) (* nspIirInit *) (* DESCRIPTION: *) (* These functions initialize an arbitrary order IIR filter. *) (* PARAMETERS: *) (* iirType - input, describes the filter structure to use, and currently*) (* must be NSP_IirDefault; *) (* TapVals - input, the 2*(order+1) length array specifies the filter *) (* coefficients as discussed for the low-level IIR function *) (* nsp?IirlInit()); *) (* order - input, sets polinomial order; *) (* statePtr - output, the pointer to the IIR filter state structure. *) (* nspiirh
procedure nspwIirInitBq(IirType: TNSPIirType; TapVals: PFloatArray; NumQuads: Integer; var State: TNSPIirState);
-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirInitBq *) (* nspIirInitBq *) (* DESCRIPTION: *) (* These functions initialize an IIR filter defined by a cascade of *) (* biquads. *) (* PARAMETERS: *) (* iirType - input, describes the filter structure to use, and currently*) (* must be NSP_IirDefault; *) (* TapVals - input, the 6*numQuads length array specifies the filter *) (* coefficients as discussed for the low-level IIR function *) (* nsp?IirlInitBq()); *) (* numQuads - input, sets the number of biduads; *) (* tapStPtr - output, pointer to the IIR state structure. *) (*
function nspwIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState; Samp: Short;
ScaleMode: Integer; var ScaleFactor: Integer): Short;
-------------------------------------------------------------------------*) (* Iirl, bIirl *) (* *) (* Filter a signal through a low-level IIR filter. *) (*-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirl *) (* nspIirl *) (* DESCRIPTION: *) (* filters a single sample throuth a low-level IIR filter and returns *) (* the result. *) (* PARAMETERS: *) (* tapStPtr - input, pointer to the tap state structure; *) (* dlyStPtr - input, pointer to the delay line state structure; *) (* smp - input, the sample value. *) (* RETURNS: *) (* the filtering result. *) (*
procedure nspwIirlInit(IirType: TNSPIirType; Taps: PFloatArray; Order: Integer; var TapState: TNSPIirTapState);
-------------------------------------------------------------------------*) (* IirlInit, IirlInitBq, IirlInitDlyl *) (* *) (* Perform infinite impulse response filtering. *) (*-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirlInit *) (* DESCRIPTION: *) (* Taps initialization of low-level arbitrary order IIR-filter with *) (* transfer function expressed as the ratio of two polinomials of order *) (* "order". *) (* PARAMETERS: *) (* iirType - input, determines the filter structure to use, currently *) (* must be NSP_IirDefault; *) (* taps - input/output, sets the array taps of filter with transfer *) (* function *) (* B0+B1/z+B2/z/z ... +Border/z**order *) (* H(z)=------------------------------------ *) (* A0+A1/z+A2/z/z ... +Aorder/z**order *) (* in following order: *) (* B0, B1, ... Border,A0, A1, ... Aorder. *) (* A0 must not be zero; *) (* order - input, sets polinomial order; *) (* tapStPtr - output, the pointer to the tap state structure. *) (* nspiirl
procedure nspwIirlInitBq(IirType: TNSPIirType; Taps: PFloatArray; NumQuads: Integer; var TapState: TNSPIirTapState);
-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirlInitBq *) (* DESCRIPTION: *) (* Low-level IIR-filter iinitialization taps to reference a cascade of *) (* biquads. Transfer function is a product of numQuads biquads. *) (* PARAMETERS: *) (* iirType - input, determines the filter structure to use, currently *) (* must be NSP_IirDefault; *) (* taps - input/output, sets the array taps of filter *) (* with the transfer function *) (* (B10+B11/z+B12/z**2)* ... *(BnQ0+BnQ1/z+BnQ2/z**2) *) (* H(z)=-------------------------------------------------- *) (* (A10+A11/z+A12/z**2)* ... *(AnQ0+AnQ1/z+AnQ2/z**2) *) (* in following order: *) (* B10, B11, B12, A10, A11, A12, ... , *) (* BnQ0, BnQ1, BnQ2, AnQ0, AnQ1, AnQ2. *) (* All Bi0 and Ai0 must not be zero; *) (* numQuads - input, sets the number of biduads; *) (* tapStPtr - output, pointer to the tap state structure. *) (*
procedure nspwIirlInitDlyl(const TapState: TNSPIirTapState; Dlyl: PLongArray; var DlyState: TNSPIirDlyState);
-------------------------------------------------------------------------*) (* FUNCTION: *) (* nspIirlInitDlyl *) (* DESCRIPTION: *) (* Initialization of delay array for low-level IIR-filter. *) (* PARAMETERS: *) (* tapStPtr - input, the pointer to the tap state structure, *) (* initializated previously by the function nsp?IirInit or *) (* nsp?IirInitBq; *) (* dlyl - input/output, the delay line array. In this implementation *) (* the input array element values are ignored. *) (* dlyStPtr - output, the pointer to the delay line state structure. *) (*
function nspwLmsl(var TapState: TNSPWLmsTapState;
var DlyState: TNSPWLmsDlyState; Samp, Err: Short): Short;
procedure nspwLmslGetDlyl(const TapState: TNSPWLmsTapState;
const DlyState: TNSPWLmsDlyState; outDlyl: PShortArray);
function nspwLmslGetStep(const State: TNSPWLmsTapState): Float;
Note that step is float
procedure nspwLmslGetTaps(const TapState: TNSPWLmsTapState; OutTaps: PFloatArray);
procedure nspwLmslInit(LmsType: TNSPLmsType; Taps: PFloatArray; TapsLen: Integer;
Step: Float; ErrDly: Integer; var TapState: TNSPWLmsTapState);
Note that leak is not used and taps are float
procedure nspwLmslInitDlyl( var TapState: TNSPWLmsTapState; Dlyl: PShortArray;
var DlyState: TNSPWLmsDlyState);
////////////////////////////////////////////////////////////
The wLmsl functions for data of short type.
31-mar-97. New interface and new functions
o leak is not used,
o adaptB is not used,
o filter taps are float in the function call,
o step is float in the function call,
o calculation are done with fixed point data.
//////////////////////////////////////////////////////////// *) (* Note that adaptB is not used
procedure nspwLmslSetDlyl(const TapState: TNSPWLmsTapState; inDlyl: PShortArray;
var DlyState: TNSPWLmsDlyState);
procedure nspwLmslSetStep(Step: Float; var State: TNSPWLmsTapState);
procedure nspwLmslSetTaps(InTaps: PShortArray; var TapState: TNSPWLmsTapState);
function nspwMalloc(Length: Integer): PShortArray;
function nspwMax(Vec: PShortArray; Len: Integer): Short;
function nspwMean(Vec: PShortArray; Len: Integer): Short;
function nspwMin(Vec: PShortArray; Len: Integer): Short;
procedure nspwMpyRCPack2(
Src: PShortArray;
Dst: PShortArray;
Order: Integer;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwMpyRCPack3(
SrcA: PShortArray;
SrcB: PShortArray;
Dst: PShortArray;
Order: Integer;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwMpyRCPerm2(
Src: PShortArray;
Dst: PShortArray;
Order: Integer;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwMpyRCPerm3(
SrcA: PShortArray;
SrcB: PShortArray;
Dst: PShortArray;
Order: Integer;
ScaleMode: Integer;
var ScaleFactor: Integer);
function nspwNorm(SrcA, SrcB: PShortArray; n: Integer; Flag: Integer): Float;
function nspwRandGaus(var State: TNSPWRandGausState): Short;
procedure nspwRandGausInit(Seed, Mean, StDev: Short; var State: TNSPWRandGausState);
function nspwRandUni(var State: TNSPWRandUniState): Short;
procedure nspwRandUniInit(Seed: UInt; Low, High: Short; var State: TNSPWRandUniState);
procedure nspwReal2Fft(
xSamps: PShortArray;
ySamps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwReal2FftNip(
xInSamps: PShortArray; xOutSamps: PWCplxArray;
yInSamps: PShortArray; yOutSamps: PWCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwRealFft(
Samps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwRealFftl(
Samps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwRealFftlNip(
inSamps: PShortArray;
outSamps: PShortArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
procedure nspwRealFftNip(
inSamps: PShortArray;
outSamps: PWCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
function nspwStdDev(Vec: PShortArray; Len, ScaleMode: Integer; var ScaleFactor: Integer): Short;
procedure nspWtFree(var wtState: TNSPWtState);
par1, par2 - the parameters of wavelet, dependent from the type of wavelet. NSP_Haar par1 - dummy par2 - dummy NSP_Daublet par1 = 1,2,3,4,5,6,7,8,9,10. par2 - dummy NSP_Symmlet par1 = 1,2,3,4,5,6,7. par2 - dummy NSP_Coiflet par1 = 1,2,3,4,5,6. par2 - dummy NSP_Vaidyanathan par1 - dummy par2 - dummy // NSP_BSpline B - spline, NSP_BSplineDual (par1, par2) must be: box - ( 1, 1 ), ( 1, 3 ), ( 1, 5 ); lin. spline - ( 2, 2 ), ( 2, 4 ), ( 2, 6 ), ( 2, 8 ); quad. spline - ( 3, 1 ), ( 3, 3 ), ( 3, 5 ), ( 3, 7 ), ( 3, 9 ). // NSP_LinSpline (eq. case NSP_BSpline with par1=2, par2=2.) par1 - dummy par2 - dummy NSP_QuadSpline (eq. case NSP_BSpline with par1=3, par2=3.) par1 - dummy par2 - dummy // dataOrder - the length of data L = pow(2,dataOrder) */ level - determines the number of levels of decompositions we need. */ // Filters len_filt[] - length ofs_filt[] - offset tap_filt[] - taps [ 0 ] - low pass analysis filter [ 1 ] - high pass analysis filter [ 2 ] - low pass synthesis filter [ 3 ] - high pass synthesis filter Must be 2 <= len_filt[ i ] , 0 <= ofs_filt[ i ] < len_filt[ i ] , i = 0, 1, 2, 3; len_filt[ 0 ] = len_filt[ 3 ] , len_filt[ 1 ] = len_filt[ 2 ] . // src_pad - working array with length = ( pow(2,dataOrder) + 2*max(len_filt[ i ]) ) * sizeof( sample ) // ======================================================================== */ Free own wavelet memory */
function nspwTone(var State: TNSPWToneState): Short;
--- Dot product tone functions ------------------------------------------*/
procedure nspwToneInit(rfreq, phase: Float; mag: Short; var State: TNSPWToneState);
PVCS: $Workfile: NSPTONE.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:30 $ $Archive: X:/nsp40_arc/INCLUDE/NSPTONE.H_v $ // Purpose: NSP Tone Generator. Declarator // --- Initialization ------------------------------------------------------*/
function nspwTrngl(var State: TNSPWTrnglState): Short;
--- Single-Sample-Generating triangle functions -------------------------*/
procedure nspwTrnglInit(rfrq, phase: Float; Mag: Short; Asym: Float; var State: TNSPWTrnglState);
PVCS: $Workfile: NSPTRNGL.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:32 $ $Archive: X:/nsp40_arc/INCLUDE/NSPTRNGL.H_v $ // Purpose: Generating of signals with triangle wave form. Provides samples of a triangle of arbitrary frequency, phase, magnitude, and asymmetry. // 0 =< phase < 2PI, -PI < asym < PI, mag > 0, 0 =< rfrec < 0.5 // asym = 0 => Triangle is symmetric (old version) asym = -PI+eps => Triangle with sheer back (0 Triangle with sheer front-fore // Like (cos) tone functions the triangle has period equal 2PI Triangle phase is given in radians. // --- Triangle initialization ---------------------------------------------*/
procedure nspwUpSample(Src: PShortArray; SrcLen: Integer;
Dst: PShortArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspwvCrossCorr(SrcA: PShortArray; lenA: Integer;
SrcB: PWCplxArray; lenB: Integer; Dst: PWCplxArray;
loLag, hiLag, ScaleMode: Integer; var Scale: Integer);
function nspwvDotProd(SrcA: PShortArray; SrcB: PWCplxArray; Len, ScaleMode: Integer; var ScaleFactor: Integer): TWCplx;
procedure nspwWinBartlett(Vector: PShortArray; N: Integer);
procedure nspwWinBlackman(Vector: PShortArray; N: Integer; Alpha: Float);
procedure nspwWinBlackmanOpt(Vector: PShortArray; N: Integer);
procedure nspwWinBlackmanStd(Vector: PShortArray; N: Integer);
procedure nspwWinHamming(Vector: PShortArray; N: Integer);
procedure nspwWinHann(Vector: PShortArray; N: Integer);
procedure nspwWinKaiser(Vector: PShortArray; N: Integer; Beta: Float);
procedure nspwWtDecompose(var wtState: TNSPWtState; Src, Dst: PShortArray);
procedure nspwWtGetState(var wtState: TNSPWtState; var wtType: Integer;
var Par1, Par2, DataOrder, Level: Integer;
var fTaps: PFloatArray; var fLen, Offset: Integer);
procedure nspwWtInit(Par1, Par2, DataOrder, Level: Integer;
var wtState: TNSPWtState; wtType: Integer);
procedure nspwWtReconstruct(var wtState: TNSPWtState; Src, Dst: PShortArray);
procedure nspwWtSetState(var wtState: TNSPWtState; wtType: Integer;
Par1, Par2, DataOrder, Level: Integer;
const fTaps: PFloatArray; const fLen, Offset: Integer);
function nspzAdd(a, b: TDCplx): TDCplx;
-------------------------------------------------------------------------*/ Miscellaneous Scalar Functions and Vector Functions */ Complex Add, Sub, Mpy, Div, Conj */ These functions perform addition, subtraction, multiplication, */ division, and conjugation on complex numbers a and b. */ */
procedure nspzAutoCorr(Src: PDCplxArray; Len: Integer; Dst: PDCplxArray; nLags: Integer;
corrType: TNSPAutoCorrType);
procedure nspzb2RealToCplx(srcReal, srcImag: PDoubleArray; Dst: PDCplxArray; Length: Integer);
procedure nspzbAdd1(Val: TDCplx; Dst: PDCplxArray; n: Integer);
procedure nspzbAdd2(Src: PDCplxArray; Dst: PDCplxArray; n: Integer);
procedure nspzbAdd3(SrcA, SrcB: PDCplxArray; Dst: PDCplxArray; n: Integer);
procedure nspzbBitRev1(Vector: PDCplxArray; Order: Integer);
procedure nspzbBitRev2(Src: PDCplxArray; Dst: PDCplxArray; Order: Integer);
procedure nspzbCartToPolar(Src: PDCplxArray; Mag, Phase: PDoubleArray; Len: Integer);
procedure nspzbConj1(Vec: PDCplxArray; n: Integer);
-------------------------------------------------------------------------*/ */ Complex conjugates of scalars and vectors */ */
procedure nspzbConj2(Src: PDCplxArray; Dst: PDCplxArray; n: Integer);
procedure nspzbConjExtend1(Vec: PDCplxArray; n: Integer);
procedure nspzbConjExtend2(Src: PDCplxArray; Dst: PDCplxArray; n: Integer);
procedure nspzbConjFlip2(Src: PDCplxArray; Dst: PDCplxArray; n: Integer);
procedure nspzbCopy(Src: PDCplxArray; Dst: PDCplxArray; n: Integer);
procedure nspzbCplxTo2Real(Src: PDCplxArray; DstReal, DstImag: PDoubleArray; Length: Integer);
procedure nspzbFir(var State: TNSPFirState; inSamps: PDCplxArray;
outSamps: PDCplxArray; numIters: Integer);
procedure nspzbFirl(const tapState: TNSPFirTapState; var dlyState: TNSPFirDlyState;
inSamps: PDCplxArray; outSamps: PDCplxArray; numIters: Integer);
function nspzbGoertz(var State: TNspZGoertzState; inSamps: PDCplxArray; Len: Integer): TDCplx;
procedure nspzbIir(var State: TNSPIirState; inSamps: PDCplxArray; outSamps: PDCplxArray; NumIters: Integer);
procedure nspzbIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState;
inSamps: PDCplxArray; outSamps: PDCplxArray;
NumIters: Integer);
procedure nspzbImag(Src: PDCplxArray; Dst: PDoubleArray; Length: Integer);
procedure nspzbInvThresh1(Vec: PDCplxArray; Len: Integer; Thresh: Double);
procedure nspzbInvThresh2(Src: PDCplxArray; Dst: PDCplxArray; Len: Integer; Thresh: Double);
function nspzbLms(var State: TNSPLmsState; inSamps: PDCplxArray; Err: TDCplx): TDCplx;
mov esp, ebp
procedure nspzbLmsDes(var State: TNSPLmsState; const InSamps, DesSamps: TDCplxArray;
outSamps: PDCplxArray; NumIters: Integer);
function nspzbLmsl(var TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PDCplxArray; Err: TDCplx): TDCplx;
procedure nspzbLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PDCplxArray; outSamps: PDCplxArray; NumIters: Integer);
procedure nspzbMag(Src: PDCplxArray; Mag: PDoubleArray; Length: Integer);
procedure nspzbMpy1(Val: TDCplx; Dst: PDCplxArray; n: Integer);
procedure nspzbMpy2(Src: PDCplxArray; Dst: PDCplxArray; n: Integer);
procedure nspzbMpy3(SrcA, SrcB: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspzbNormalize(Src, Dst: PDCplxArray; n: Integer;
Offset: TDCplx; Factor: Double);
procedure nspzbPhase(Src: PDCplxArray; Phase: PDoubleArray; Length: Integer);
procedure nspzbPolarToCart(Mag, Phase: PDoubleArray; Dst: PDCplxArray; Len: Integer);
procedure nspzbPowerSpectr(Src: PDCplxArray; Spectr: PDoubleArray; Length: Integer);
procedure nspzbRandGaus(var State: TNSPZRandGausState; Samps: PDCplxArray; SampsLen: Integer);
procedure nspzbRandUni(var State: TNSPZRandUniState; Samps: PDCplxArray; SampsLen: Integer);
procedure nspzbReal(Src: PDCplxArray; Dst: PDoubleArray; Length: Integer);
procedure nspzbSet(re, im: Double; Dst: PDCplxArray; n: Integer);
procedure nspzbSqr1(Vec: PDCplxArray; Len: Integer);
procedure nspzbSqr2(Src: PDCplxArray; Dst: PDCplxArray; Len: Integer);
procedure nspzbSqrt1(Vec: PDCplxArray; Len: Integer);
procedure nspzbSqrt2(Src: PDCplxArray; Dst: PDCplxArray; Len: Integer);
procedure nspzbSub1(Val: TDCplx; Dst: PDCplxArray; n: Integer);
procedure nspzbSub2(Val: PDCplxArray; Dst: PDCplxArray; n: Integer);
procedure nspzbSub3(Src, Val: PSCplxArray; Dst: PSCplxArray; n: Integer);
procedure nspzbThresh1(Vec: PDCplxArray; Len: Integer; thresh: Double; relOp: Integer);
procedure nspzbThresh2(Src: PDCplxArray; Dst: PDCplxArray; Len: Integer;
thresh: Double; relOp: Integer);
procedure nspzbTone(var State: TNSPZToneState; Samps: PDCplxArray; SampsLen: Integer);
procedure nspzbTrngl(var State: TNSPZTrnglState; Samps: PDCplxArray; SampsLen: Integer);
procedure nspzbZero(Dst: PDCplxArray; n: Integer);
procedure nspzCalcDftTwdTbl(var Tbl: TDCplx; Length: Integer);
procedure nspzCalcFftTwdTbl(var Tbl: TDCplx; Order: Integer);
function nspzConj(a: TDCplx): TDCplx;
procedure nspzConv(x: PDCplxArray; xLen: Integer; h: PDCplxArray; hLen: Integer; y: PDCplxArray);
procedure nspzCrossCorr(SrcA: PDCplxArray; lenA: Integer;
SrcB: PDCplxArray; lenB: Integer; Dst: PDCplxArray;
loLag, hiLag: Integer);
procedure nspzdbFir(var State: TNSPFirState; inSamps: PDCplxArray;
outSamps: PDCplxArray; numIters: Integer);
procedure nspzdbFirl(const tapState: TNSPFirTapState; var dlyState: TNSPFirDlyState;
inSamps: PDCplxArray; outSamps: PDCplxArray; numIters: Integer);
procedure nspzdbIir(var State: TNSPIirState; inSamps: PDCplxArray; outSamps: PDCplxArray; NumIters: Integer);
procedure nspzdbIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState;
inSamps: PDCplxArray; outSamps: PDCplxArray;
NumIters: Integer);
procedure nspzdbLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState;
inSamps: PDCplxArray; outSamps: PDCplxArray; NumIters: Integer);
procedure nspzdConv(x: PDCplxArray; xLen: Integer; h: PDoubleArray; hLen: Integer; y: PDCplxArray);
procedure nspzdCrossCorr(SrcA: PDCplxArray; lenA: Integer;
SrcB: PDoubleArray; lenB: Integer; Dst: PDCplxArray;
loLag, hiLag: Integer);
function nspzdDotProd(SrcA: PDCplxArray; SrcB: PDoubleArray; Len: Integer): TDCplx;
function nspzdFir(var State: TNSPFirState; samp: TDCplx): TDCplx;
procedure nspzdFirInit(TapVals: PDoubleArray; TapsLen: Integer;
DlyVals: PDCplxArray; var State: TNSPFirState);
procedure nspzdFirInitMr(TapVals: PDoubleArray; TapsLen: Integer;
DlyVals: PDCplxArray; upFactor, upPhase: Integer;
downFactor, downPhase: Integer;
var State: TNSPFirState);
function nspzdFirl(const tapState: TNSPFirTapState;
var dlyState: TNSPFirDlyState; samp: TDCplx): TDCplx;
procedure nspzDft(
inSamps: PDCplxArray;
outSamps: PDCplxArray;
Length: Integer;
Flags: TNspFourierTrOptions;
ScaleMode: Integer;
var ScaleFactor: Integer);
function nspzdIir(var State: TNSPIirState; Samp: TDCplx): TDCplx;
procedure nspzdIirInit(IirType: TNSPIirType; TapVals: PDoubleArray; Order: Integer; var State: TNSPIirState);
procedure nspzdIirInitBq(IirType: TNSPIirType; TapVals: PDoubleArray; NumQuads: Integer; var State: TNSPIirState);
function nspzdIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState; Samp: TDCplx): TDCplx;
function nspzDiv(a, b: TDCplx): TDCplx;
function nspzdLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState; Samp: TDCplx): TDCplx;
function nspzDotProd(SrcA, SrcB: PDCplxArray; Len: Integer): TDCplx;
procedure nspzDownSample(Src: PDCplxArray; SrcLen: Integer;
Dst: PDCplxArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspzFft(
Samps: PDCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspzFftNip(
inSamps: PDCplxArray;
outSamps: PDCplxArray;
Order: Integer;
Flags: TNspFourierTrOptions);
function nspzFir(var State: TNSPFirState; samp: TDCplx): TDCplx;
procedure nspzFirGetDlyl(const State: TNSPFirState; OutDlyl: PDCplxArray);
procedure nspzFirGetTaps(const State: TNSPFirState; OutTaps: PDCplxArray);
procedure nspzFirInit(TapVals: PDCplxArray; TapsLen: Integer;
DlyVals: PDCplxArray; var State: TNSPFirState);
procedure nspzFirInitMr(TapVals: PDCplxArray; TapsLen: Integer;
DlyVals: PDCplxArray; upFactor, upPhase: Integer;
downFactor, downPhase: Integer;
var State: TNSPFirState);
function nspzFirl(const tapState: TNSPFirTapState;
var dlyState: TNSPFirDlyState; samp: TDCplx): TDCplx;
procedure nspzFirlGetDlyl(const tapState: TNSPFirTapState;
const dlyState: TNSPFirDlyState; OutDlyl: PDCplxArray);
procedure nspzFirlGetTaps(const tapState: TNSPFirTapState; OutTaps: PDCplxArray);
procedure nspzFirlInit(Taps: PDCplxArray; TapsLen: Integer; var tapState: TNSPFirTapState);
procedure nspzFirlInitDlyl(const tapState: TNSPFirTapState; Dlyl: PDCplxArray;
var dlyState: TNSPFirDlyState);
procedure nspzFirlInitMr(Taps: PDCplxArray; TapsLen, upFactor, upPhase: Integer;
downFactor, downPhase: Integer; var tapState: TNSPFirTapState);
procedure nspzFirlSetDlyl(const tapState: TNSPFirTapState; inDlyl: PDCplxArray;
var dlyState: TNSPFirDlyState);
procedure nspzFirlSetTaps(InTaps: PDCplxArray; var tapState: TNSPFirTapState);
procedure nspzFirSetDlyl(inDlyl: PDCplxArray; var State: TNSPFirState);
procedure nspzFirSetTaps(InTaps: PDCplxArray; var State: TNSPFirState);
procedure nspzFreeTwdTbls;
function nspzGetDftTwdTbl(Length: Integer): PDCplxArray;
function nspzGetFftTwdTbl(Order: Integer): PDCplxArray;
function nspzGoertz(var State: TNspZGoertzState; Sample: TDCplx): TDCplx;
procedure nspzGoertzInit(Freq: Double; var State: TNspZGoertzState);
procedure nspzGoertzReset(var State: TNspZGoertzState);
function nspzIir(var State: TNSPIirState; Samp: TDCplx): TDCplx;
procedure nspzIirInit(IirType: TNSPIirType; TapVals: PDCplxArray; Order: Integer; var State: TNSPIirState);
procedure nspzIirInitBq(IirType: TNSPIirType; TapVals: PDCplxArray; NumQuads: Integer; var State: TNSPIirState);
function nspzIirl(const TapState: TNSPIirTapState; var DlyState: TNSPIirDlyState; Samp: TDCplx): TDCplx;
procedure nspzIirlInit(IirType: TNSPIirType; Taps: PDCplxArray; Order: Integer; var TapState: TNSPIirTapState);
procedure nspzIirlInitBq(IirType: TNSPIirType; Taps: PDCplxArray; NumQuads: Integer; var TapState: TNSPIirTapState);
procedure nspzIirlInitDlyl(const TapState: TNSPIirTapState; Dlyl: PDCplxArray; var DlyState: TNSPIirDlyState);
function nspzLms(var State: TNSPLmsState; Samp, Err: TDCplx): TDCplx;
mov esp, ebp
function nspzLmsDes(var State: TNSPLmsState; Samp: TDCplx; Des: TDCplx): TDCplx;
mov esp, ebp
procedure nspzLmsGetDlyl(const State: TNSPLmsState; OutDlyl: PDCplxArray);
function nspzLmsGetErrVal(const State: TNSPLmsState): TDCplx;
mov esp, ebp
procedure nspzLmsGetTaps(const State: TNSPLmsState; OutTaps: PDCplxArray);
procedure nspzLmsInit(LmsType: TNSPLmsType;
TapVals: PDCplxArray; TapsLen: Integer;
DlyVals: PDCplxArray; Step, Leak: Float;
ErrDly: Integer; var State: TNSPLmsState);
procedure nspzLmsInitMr(LmsType: TNSPLmsType;
TapVals: PDCplxArray; TapsLen: Integer;
DlyVals: PDCplxArray; Step, Leak: Float;
ErrDly, DownFactor, DownPhase: Integer; var State: TNSPLmsState);
function nspzLmsl(var TapState: TNSPLmsTapState; var DlySTate: TNSPLmsDlyState; Samp, Err: TDCplx): TDCplx;
procedure nspzLmslGetDlyl(const TapState: TNSPLmsTapState; const DlyState: TNSPLmsDlyState; OutDlyl: PDCplxArray);
procedure nspzLmslGetTaps(const TapState: TNSPLmsTapState; OutTaps: PDCplxArray);
procedure nspzLmslInit(LmsType: TNSPLmsType; Taps: PDCplxArray; TapsLen: Integer;
Step, Leak: Float; ErrDly: Integer; var TapState: TNSPLmsTapState);
procedure nspzLmslInitDlyl(var TapState: TNSPLmsTapState; Dlyl: PDCplxArray; AdaptB: Integer; var DlyState: TNSPLmsDlyState);
procedure nspzLmslInitMr(LmsType: TNSPLmsType; Taps: PDCplxArray; TapsLen: Integer;
Step, Leak: Float; ErrDly, DownFactor, DownPhase: Integer; var TapState: TNSPLmsTapState);
function nspzLmslNa(const TapState: TNSPLmsTapState; var DlyState: TNSPLmsDlyState; Samp: TDCplx): TDCplx;
procedure nspzLmslSetDlyl(const TapState: TNSPLmsTapState; inDlyl: PDCplxArray; var DlyState: TNSPLmsDlyState);
procedure nspzLmslSetTaps(InTaps: PDCplxArray; var TapState: TNSPLmsTapState);
procedure nspzLmsSetDlyl(inDlyl: PDCplxArray; var State: TNSPLmsState);
procedure nspzLmsSetErrVal(Err: TDCplx; var State: TNSPLmsState);
procedure nspzLmsSetTaps(InTaps: PDCplxArray; var State: TNSPLmsState);
function nspzMalloc(Length: Integer): PDCplxArray;
function nspzMpy(a, b: TDCplx): TDCplx;
function nspzNorm(SrcA, SrcB: PDCplxArray; n: Integer; Flag: Integer): Double;
function nspzRandGaus(var State: TNSPZRandGausState): TDCplx;
procedure nspzRandGausInit(Seed, Mean, StDev: Double; var State: TNSPZRandGausState);
function nspzRandUni(var State: TNSPZRandUniState): TDCplx;
procedure nspzRandUniInit(Seed, Low, High: Double; var State: TNSPZRandUniState);
procedure nspzrFft(
reSamps: PDoubleArray;
imSamps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
procedure nspzrFftNip(
reInSamps: PDoubleArray;
imInSamps: PDoubleArray;
reOutSamps: PDoubleArray;
imOutSamps: PDoubleArray;
Order: Integer;
Flags: TNspFourierTrOptions);
function nspzSet(re, im: Double): TDCplx;
---- Additional Functions -----------------------------------------------*/
function nspzSub(a, b: TDCplx): TDCplx;
function nspzTone(var State: TNSPZToneState): TDCplx;
procedure nspzToneInit(rfreq, phase, mag: Double; var State: TNSPZToneState);
function nspzTrngl(var State: TNSPZTrnglState): TDCplx;
procedure nspzTrnglInit(rfrq, phase, Mag, Asym: Double; var State: TNSPZTrnglState);
procedure nspzUpSample(Src: PDCplxArray; SrcLen: Integer;
Dst: PDCplxArray; var DstLen: Integer;
Factor: Integer; var Phase: Integer);
procedure nspzWinBartlett(Vector: PDCplxArray; N: Integer);
procedure nspzWinBlackman(Vector: PDCplxArray ; N: Integer; Alpha: Double);
procedure nspzWinBlackmanOpt(Vector: PDCplxArray; N: Integer);
procedure nspzWinBlackmanStd(Vector: PDCplxArray; N: Integer);
procedure nspzWinHamming(Vector: PDCplxArray; N: Integer);
procedure nspzWinHann(Vector: PDCplxArray; N: Integer);
procedure nspzWinKaiser(Vector: PDCplxArray ; N: Integer; Beta: Double);
function NSP_DegToRad(deg: Extended): Extended;
======================================================================== */
ArrayIndex = 0..99999999
FixedPoint = Integer
////////////////////////////////////////////////////////////
LMSL of "integer" type uses Fixed Point representation of taps
////////////////////////////////////////////////////////////
Float = Single
Long = Longint
NSPStatus = Integer
e.g. "DLL","Microsoft","Borland"*/
PByteArray = ^TByteArray
PDCplx = ^TDCplx
PDCplxArray = ^TDCplxArray
PDoubleArray = ^TDoubleArray
PFloatArray = ^TFloatArray
PICplx = ^TICplx
PICplxArray = ^TICplxArray
PIntArray = ^TIntArray
PLongArray = ^TLongArray
PNSPLibVersion = ^TNspLibVersion
PSCplx = ^TSCplx
PSCplxArray = ^TSCplxArray
PShortArray = ^TShortArray
PWCplx = ^TWCplx
PWCplxArray = ^TWCplxArray
Short = Smallint
TByteArray = array[ArrayIndex] of Byte;
0..10**8-1
TDCplx = record
re : Double;
im : Double;
end;
TDCplxArray = array[ArrayIndex] of TDCplx;
TDoubleArray = array[ArrayIndex] of Double;
TFirLmsDlyState = record
Dlyl : Pointer;
Len : Integer;
IsFilterMode : Integer;
end;
TFirLmsTapState = record
Taps : Pointer;
Len : Integer;
UpFactor : Integer;
UpPhase : Integer;
DownFactor : Integer;
DownPhase : Integer;
IsMultiRate : Integer;
IsFilterMode : Integer;
end;
PVCS: $Workfile: Nspfirl.h $ $Revision: 2 $ $Date: 19/05/97 9:12 $ $Archive: /gres/project/nsp/firl/Nspfirl.h $ // Purpose: NSP Finite Impulse Response low level filter // History: 04-May-97, change w-flavor interface (use float taps now) // * --- FIR low level filter structure -------------------------------------*/
TFirSect = record
num : Integer;
len : Integer;
xId : Integer;
tId : Integer;
end;
PVCS: $Workfile: Nspfirh.h $ $Revision: 1 $ $Date: 21/04/97 16:32 $ $Archive: /gres/project/nsp/firh/Nspfirh.h $ // Purpose: NSP Finite Impulse Response high-level filter. // === FIR high-level ======================================================*/
TFirSections = array[ArrayIndex] of TFirSect;
firSect
TFloatArray = array[ArrayIndex] of Float;
TICplx = record
re : Integer;
im : Integer;
end;
TICplxArray = array[ArrayIndex] of TICplx;
TIntArray = array[ArrayIndex] of Integer;
TLongArray = array[ArrayIndex] of Long;
TNSPAutoCorrType = (NSP_Normal, NSP_Biased, NSP_UnBiased);
PVCS: $Workfile: Nspcorr.h $ $Revision: 1 $ $Date: 17/07/97 12:37 $ $Archive: /corr/Nspcorr.h $ // Purpose: NSP Correlation
TNspCGoertzState = TNspSGoertzState
TNSPCRandGausState = TNSPSRandGausState
TNSPCRandUniState = TNSPSRandUniState
TNSPCToneState = record
cosBase : Double;
cosCurr : TDCplx;
cosPrev : TDCplx;
mag : Float;
rfreq : Float;
phase : Float;
isInit : array[0..3] of Char;
end;
TNSPCTrnglState = record
mag : Float;
step : TSCplx;
step1 : Float;
step2 : Float;
st12 : Float;
st21 : Float;
shft1 : Float;
shft2 : Float;
delta1 : Float;
delta2 : Float;
last : TSCplx;
end;
TNspDGoertzState = record
freq : Double;
cosV : Double;
sinV : Double;
cpcV : Double;
prev2re : Double;
prev2im : Double;
prev1re : Double;
prev1im : Double;
end;
TNSPDRandGausState = record
Mean : Double;
StDev : Double;
ExtraValue : Double;
UseExtra : Integer;
Seed2 : UInt;
Carry : UInt;
Seed1 : array[0..2] of UInt;
QuickSeed : UInt;
end;
TNSPDRandUniState = record
Low : Double;
Muler : Double;
Seed2 : UInt;
Carry : UInt;
seed1 : array[0..2] of UInt;
QuickSeed : Integer;
end;
TNSPDToneState = record
cosBase : Double;
cosCurr : Double;
cosPrev : Double;
mag : Double;
rfreq : Double;
phase : Double;
isInit : array[0..3] of Char;
end;
TNSPDTrnglState = record
mag : Double;
step : Double;
step1 : Double;
step2 : Double;
st12 : Double;
st21 : Double;
shft1 : Double;
shft2 : Double;
delta1 : Double;
delta2 : Double;
last : Double;
end;
TNSPErrMode = (
NSP_ErrModeLeaf, // Print error and exit program
NSP_ErrModeParent, // Print error and continue
NSP_ErrModeSilent);
TNspErrorCallBack = function(
Status: NSPStatus;
FuncName: PChar;
Context: PChar;
FileName: PChar;
Line: Integer): Integer stdcall
TNSPFirDlyState = TFirLmsDlyState
* --- Delay line of FIR low level filter ---------------------------------*/
TNSPFirState = record
upFactor : Integer;
upPhase : Integer;
downFactor : Integer;
downPhase : Integer;
isMultiRate : Integer;
isInit : Pointer;
TapsLen : Integer;
tapsBlk : Integer;
taps : Pointer;
dlylLen : Integer;
inpLen : Integer;
useInp : Integer;
dlyl : Pointer;
dlylLimit : Pointer;
useDlyl : Pointer;
sect : ^TFirSections;
tapsFactor : Integer;
utapsLen : Integer;
end;
TNSPFirTapState = record
Taps : Pointer;
Len : Integer;
UpFactor : Integer;
UpPhase : Integer;
DownFactor : Integer;
DownPhase : Integer;
IsMultiRate : Integer;
IsFilterMode : Integer;
TapsFactor : Integer;
end;
* --- Finite impulse response filter -------------------------------------*/
TNspFourierTrOptions = set of (
NSP_Forw,
NSP_Inv,
NSP_Init,
NSP_Free,
NSP_NoScale,
NSP_NoBitRev,
NSP_InBitRev,
NSP_OutBitRev,
NSP_OutRCPack,
NSP_OutRCPerm,
NSP_InRCPack,
NSP_Bit11, // reserved
NSP_InRCPerm,
NSP_DoIntCore,
NSP_DoFloatCore,
NSP_DoFastMMX)
Don't print and continue
TNSPIirDlyState = record
dlyl : Pointer;
end;
---- IIR filter delay line state structure ------------------------------
TNSPIirInit = (NSP_IirInit, NSP_IirInitBq);
---- Implementation tap type of initialization --------------------------
TNSPIirState = record
tapSt : TNSPIirTapState;
dlySt : TNSPIirDlyState;
init : Integer;
end;
---- IIR filter state structure -----------------------------------------
TNSPIirTapState = record
order : Integer;
taps : Pointer;
iirtype : TNSPIirType;
initype : TNSPIirInit;
end;
---- IIR filter tap state structure -------------------------------------
TNSPIirType = (NSP_IirNull, NSP_IirDefault);
PVCS: $Workfile: NSPIIRL.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:26 $ $Archive: X:/nsp40_arc/INCLUDE/NSPIIRL.H_v $ // (*---- User tap type ------------------------------------------------------
TNSPITrnglState = TNSPDTrnglState
TNSPJTrnglState = TNSPZTrnglState
TNspLibVersion = record
major : Integer;
minor : Integer;
build : Integer;
Name : PChar;
Version : PChar;
InternalVersion : PChar;
BuildDate : PChar;
CallConv : PChar;
end;
TNSPLmsDlyState = record
Dlyl : Pointer;
Len : Integer;
IsFilterMode : Integer;
AdaptB : Integer;
end;
NSPLmsTapState; (* --- LMS low-level filter delay line ------------------------------------
TNSPLmsState = record
TapState : TNSPLmsTapState;
DlyState : TNSPLmsDlyState;
end;
PVCS: $Workfile: NSPLMSH.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:28 $ $Archive: X:/nsp40_arc/INCLUDE/NSPLMSH.H_v $ // Purpose: NSP Adaptive FIR filter that uses the LMS algorithm
TNSPLmsTapState = record
Taps : Pointer;
Len : Integer;
UpFactor : Integer;
UpPhase : Integer;
DownFactor : Integer;
DownPhase : Integer;
IsMultiRate : Integer;
IsFilterMode : Integer;
Leak : Float;
Step : Float;
ErrDly : Integer;
LmsType : TNSPLmsType;
end;
--- LMS low-level filter state structure -------------------------------
TNSPLmsType = (NSP_LmsNull, NSP_LmsDefault);
vss & PVCS: $Workfile: nsplmsl.h $ $Created: 1994 $ $Revision: 3 $ $Modtime: 24.04.97 14:27 $ Purpose: NSP Adaptive FIR filter that uses the LMS algorithm. (* --- LMS filter (method) type -------------------------------------------
TNspSGoertzState = record
freq : Float;
cosV : Float;
sinV : Float;
cpcV : Float;
prev2re : Float;
prev2im : Float;
prev1re : Float;
prev1im : Float;
end;
Single Frequency DFT structures. */
TNSPSRandGausState = record
Mean : Float;
StDev : Float;
ExtraValue : Float;
UseExtra : Integer;
Seed2 : UInt;
Carry : UInt;
Seed1 : array[0..2] of UInt;
QuickSeed : UInt;
end;
TNSPSRandUniState = record
Low : Float;
Muler : Float;
Seed2 : UInt;
Carry : UInt;
seed1 : array[0..2] of UInt;
QuickSeed : Integer;
end;
TNSPSToneState = record
cosBase : Double;
cosCurr : Double;
cosPrev : Double;
mag : Float;
rfreq : Float;
phase : Float;
isInit : array[0..3] of Char;
end;
--- Tone structures -----------------------------------------------------*/
TNSPSTrnglState = record
mag : Float;
step : Float;
step1 : Float;
step2 : Float;
st12 : Float;
st21 : Float;
shft1 : Float;
shft2 : Float;
delta1 : Float;
delta2 : Float;
last : Float;
end;
--- Triangle structures -------------------------------------------------*/
TNspVGoertzState = TNspSGoertzState
TNSPVRandGausState = TNSPWRandGausState
TNSPVRandUniState = TNSPWRandUniState
TNSPVToneState = record
dummy : array[0..31] of Double;
end;
TNSPVTrnglState = TNSPCTrnglState
TNspWGoertzState = TNspSGoertzState
TNspWindowType = (
NSP_WinRect,
NSP_WinBartlett,
NSP_WinBlackmanOpt,
NSP_WinHamming,
NSP_WinHann);
bad relation between frequency */
TNSPWLmsDlyState = TNSPLmsDlyState
TNSPWLmsTapState = record
Taps : Pointer;
Len : Integer;
UpFactor : Integer;
UpPhase : Integer;
DownFactor : Integer;
DownPhase : Integer;
IsMultiRate : Integer;
IsFilterMode : Integer;
Leak : Float;
ErrDly : Integer;
LmsType : TNSPLmsType;
end;
TNSPWRandGausState = record
UseExtra : Integer;
Seed2 : UInt;
Carry : UInt;
Seed1 : array[0..2] of UInt;
Mean : Short;
StDev : Short;
ExtraValue : Short;
QuickSeed : UInt;
end;
TNSPWRandUniState = record
Low : Float;
Muler : Float;
Center : Integer;
Pwr2 : Integer;
M_seed : array[0..1] of UInt;
D_seed : array[0..2] of UInt;
Carry : UInt;
QuickSeed : Integer;
Current : Integer;
XBuf : array[0..XBUFLEN-1] of Short;
end;
A new state structure of the pseudo random numbers
generator has two seed values (m_seed) now. Generator
based on multiplication uses m_seed values. Generator
based on subtraction uses d_seed and carry.
TNSPWToneState = record
dummy : array[0..31] of Double;
end;
TNSPWTrnglState = TNSPSTrnglState
TNSPWtState = record
wtCore : Integer;
wtType : Integer;
wtOrtType : Integer;
Par1 : Integer;
Par2 : Integer;
DataOrder : Integer;
Level : Integer;
LenFilt : array[0..3] of Integer;
OfsFilt : array[0..3] of Integer;
TapFilt : array[0..3] of Pointer;
SrcPad : Pointer;
end;
PVCS: $Workfile: nsp30/include/nspwlt.h $ $Revision: 0.2 $ $Modtime: 1996/10/17 21:16:22 $ // Purpose: NSP wavelet transform. // Authors: Valery Kuryakin, Pramila Srinivasan, Boris Shamraev. // ======================================================================== */ ------------------------------------------------------------------------ */ Structure for store all information needed to decompose and reconstruct */ of wavelet transform: */ ------------------------------------------------------------------------ */
TNspZGoertzState = TNspDGoertzState
TNSPZRandGausState = TNSPDRandGausState
TNSPZRandUniState = TNSPDRandUniState
TNSPZToneState = record
cosBase : Double;
cosCurr : TDCplx;
cosPrev : TDCplx;
mag : Double;
rfreq : Double;
phase : Double;
isInit : array[0..3] of Char;
end;
TNSPZTrnglState = record
mag : Double;
step : TDCplx;
step1 : Double;
step2 : Double;
st12 : Double;
st21 : Double;
shft1 : Double;
shft2 : Double;
delta1 : Double;
delta2 : Double;
last : TDCplx;
end;
TSCplx = record
re : float;
im : float;
end;
TSCplxArray = array[ArrayIndex] of TSCplx;
TShortArray = array[ArrayIndex] of Short;
TWCplx = record
re : Short;
im : Short;
end;
TWCplxArray = array[ArrayIndex] of TWCplx;
HUGE_VAL_D = 1.7976931348623158e+308
HUGE_VAL_S = 3.402823466e+38
NSP_2PI = 6.28318530717958648
Standard C not support M_PI
NSP_AUTO_SCALE = $0004
fixed factor value
NSP_BSpline = 6
NSP_BSplineDual = 7
NSP_C = $01
nspnorm.h
NSP_Clip = $1000
Specifies that integer values are */ unsigned */
NSP_Coiflet = 4
NSP_CVRT_MAXPHASE = 16383
Specifies that an overflow error should */ be signaled with a call to nspError() */ -------------------------------------------------------------------------*/ Maximum possible phase value for short function, corresponds to NSP_PI */
NSP_Daublet = 2
NSP_DCT_Forward = 1
nspdct.h // PVCS: $Workfile: NSPDCT.H $ Created: 1996/08/12 13:17:16 $Revision: 1.0 $ Author: Chan $Modtime: Dec 16 1996 17:47:04 $ // Purpose : e-mail : Boris_Sabanin@rstl.rfnc.nnov.su //
NSP_DCT_Free = 8
NSP_DCT_Inverse = 2
NSP_EPS = 1.0E-12
NSP_FIXED_SCALE = $0002
ignore factor
NSP_Gt = 1
PVCS: $Workfile: NSPVEC.H $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:32 $ $Archive: X:/nsp40_arc/INCLUDE/NSPVEC.H_v $ // Purpose: NSP Vector Arithmetic and Algebraic Functions
NSP_Haar = 1
wtType - the type of wavelet */
NSP_L1 = $02
NSP_L2 = $04
NSP_LinSpline = 8
NSP_Lt = 0
NSP_Noflags = $0000
PVCS: $Workfile: Nspcvrt.h $ $Revision: 1.0 $ $Date: Dec 16 1996 18:31:22 $ $Archive: X:/nsp40_arc/INCLUDE/Nspcvrt.h_v $ // Purpose: Data Convertion Functions. -------Flags to determine the transformation-----------------------------*/
NSP_NO_SCALE = $0000
Tracing through nsptrace.h (*
NSP_ErrModeLeaf = 0; // Print error and exit program
NSP_ErrModeParent = 1; // Print error and continue
NSP_ErrModeSilent = 2; // Don't print and continue
*) Flags for scaleMode parameter of nsp?Func(...,scaleMode,scaleFactor
NSP_OVERFLOW = $0000
detect factor value
NSP_OvfErr = $2000
Specifies that floating-point values */ outside the allowable integer range */ are saturated to maximum(minimum) */ integer value */
NSP_PI = 3.14159265358979324
NSP_PI_2 = 1.57079632679489662
NSP_PI_4 = 0.785398163397448310
NSP_QuadSpline = 9
NSP_RELATIVE = $08
NSP_Round = $0080
Specifies an absence of all flags */
NSP_SATURATE = $0001
wrapround
NSP_StsAutoTrace = -8
iter. didn't converge
NSP_StsBackTrace = -1
everything is ok
NSP_StsBadArg = -5
out of memory
NSP_StsBadFreq = -11
bad length of vector was passed */
NSP_StsBadFunc = -6
function arg/param is bad
NSP_StsBadLen = -10
null pointer was passed */
NSP_StsBadPointer = -9
PVCS: $Workfile: NSPFIRG.H $ $Revision: 1.0 $ $ModTime: Nov 23 1997 17:06:34 $ // AUTHOR: Michael S. Kulikov. // PURPOSE: Declaration of FIR filters design functions and structures. // FUNCTIONS: nspdFirLowpass - computes the lowpass FIR filter coefficients; // nspdFirHighpass - computes the highpass FIR filter coefficients; // nspdFirBandpass - computes the bandpass FIR filter coefficients; // nspdFirBandstop - computes the bandstop FIR filter coefficients. // ARGUMENTS: rLowFreq - low frequency (0 < rLowFreq < 0.5); // rHighFreq - high frequency (0 < rHighFreq < 0.5) (the condition rLowFreq < rHighFreq must be true!); // taps - pointer to the array which specifies the filter coefficients; // tapsLen - the number of taps in taps[] array (tapsLen>=5); // winType - the NSP_WindowType switch variable, which specifies the smoothing window type; // doNormal - if doNormal=0 the functions calculates non-normalized sequence of filter coefficients, in other cases the sequence of coefficients will be normalized. // ENUMS: NSP_WindowType - NSP_WinRect no smoothing (smoothing by rectangular window); NSP_WinBartlett smoothing by Bartlett window; NSP_WinBlackmanOpt smoothing by optimal Blackman window; NSP_WinHamming smoothing by Hamming window; NSP_WinHann smoothing by Hann window. // RETURN: integer value from following: NSP_StsOk no error; NSP_StsBadPointer the null pointer to taps[] array pass to function; NSP_StsBadLen the length of coefficient is less five; NSP_StsBadFreq the low or high frequency isn’t satisfy the condition 0 < rLowFreq < 0.5; NSP_StsBadRel the high frequency is less low.
NSP_StsBadRel = -12
bad frequency value was passed */
NSP_StsError = -2
pseudo error for back trace
NSP_StsInternal = -3
unknown /unspecified error
NSP_StsNoConv = -7
unsupported function
NSP_StsNoMem = -4
internal error (bad state
NSP_StsOk = 0
Fourier Transformation Constants -> TNspFourierTrOptions
NSP_Forw = 1;
NSP_Inv = 2;
NSP_Init = 4;
NSP_Free = 8;
NSP_NoScale = 16;
NSP_NoBitRev = 32;
NSP_InBitRev = 64;
NSP_OutBitRev = 128;
NSP_OutRCPack = 256;
NSP_OutRCPerm = 512;
NSP_InRCPack = 1024;
// 2^11 reserved
NSP_InRCPerm = 4096;
NSP_DoIntCore = 8192;
NSP_DoFloatCore = 16384;
NSP_DoFastMMX = 32768;
*) // NSPErrStatus,NSPErrMode Values Definition
NSP_Symmlet = 3
NSP_TruncNeg = $0200
Specifies that floating-point values */ should be truncated toward zero */
NSP_TruncPos = $0400
Specifies that floating-point values */ should be truncated toward negative */ infinity */
NSP_TruncZero = $0100
Specifies that floating-point values */ should be rounded to the nearest integer*/
NSP_Unsigned = $0800
Specifies that floating-point values */ should be truncated toward positive */ infinity */
NSP_Vaidyanathan = 5
NSP_WtBiOrtType = 2
NSP_WtByFilter = 10
NSP_WtCoreDouble = 2
NSP_WtCoreFloat = 1
wtCore - for calculation core (float, double or short) control */
NSP_WtCoreShort = 4
NSP_WtOrtType = 1
wtOrtType - the orthogonality type of wavelet for add. control */
NSP_WtOrtUnknown = 3
XBUFLEN = 32
saturate