Motorola DSP Developer's Kit | ![]() ![]() |
Y = mot###_decimate( X, r, nfilt, 'fir' )
Description
This function decimate
resamples data at a lower rate after lowpass FIR filtering. Input vector X is a real vector
Input/Output
Input Parameters: Real vector X, int r
, int nfilt
Output Parameters: Real vector Y
Algorithm
The MEX function decimate_fir.m
calculates vector b, vector list, int
nout
, and int nbeg
. The CMEX function loads these parameters into dsp
memory for asm
function use.
nd = length(idata); m = size(idata,1); nout = ceil(nd/r); b = fir1(nfilt,1/r); gd = grpdelay(b,1,8); list = round(gd(1)+1.25):r:nd; lod = length(list); nlen = nout-lod; nbeg = r-(nd-list(length(list))); Assembly function decimate-fir-r.asm then follows these steps to calculate decimated vector Y: nfilt = nfilt+1 itemp = 2*idata(1)-idata((nfilt+1):-1:2) [odata,zf] = filter(b,1,idata,zi) odata = odata(list)
Memory & Register
r
is loaded in register N3nfilt
is loaded in register N5idata
b
nout
list
list
itemp
The length of itemp
is 2*(nfilt+1)
Length of idata
is n
Length of odata
is n -> n/r
Length of tb
is nfilt+1
Length of zi,zf
is nfilt+1
Length of list
is = n/r
Length of itemp
is 2*(nfilt+1)
idata
(n
)r
nfilt
b
(nfilt+
1) Status Register
No status registers or bits are set explicitly during function execution.
Data Size Limit
Input vector X length must longer than r*(nfilt+1)
. The length of vector X can't be larger than the continuous available data memory size.
Data Range Limit
The value range of input vector X is [-1.0, +1.0].
Precision
In the case of DSP563, precision is 21 bits.
In the case of DSP566, precision is 12 bits.
![]() | conv-c.asm | decimate-fir-c.asm | ![]() |