5.5.3 FIRDecimate

Description

FIRDecimate decimates the sequence of the source samples at a rate of R to 1, or equivalently, it downsamples the signal by a factor of R.

Effectively,

y[n] = x[Rn].

To diminish the effect of aliasing, the source samples are first filtered and then downsampled. The decimated results are stored in the sequence of destination samples, and the delay values are updated.

Prototype

fractional* FIRDecimate (int numSamps, fractional* dstSamps, fractional* srcSamps, FIRStruct* filter, int rate);

Arguments

Parameters

Description

numSamps

Number of the output samples to filter (also N; with N being multiple of R)

dstSamps

Pointer to the destination samples (also y)

srcSamps

Pointer to the source samples (also x)

filter

Pointer to the FIRStruct filter structure

rate

Rate of decimation (downsampling factor, also R)

Return

Pointer to the base address of the destination sample.

Remarks

Number of filter coefficients is M, with M being an integer multiple of R.

Coefficients, h[m], defined in 0 ≤ m < M, are not implemented as a circular modulo buffer.

Delay, d[m], defined in 0 ≤ m < M, are not implemented as a circular modulo buffer.

Source samples, x[n], defined in 0 ≤ n < NR.

Destination samples, y[n], defined in 0 ≤ n < N.

(See also FIRStructFIRStructInit and FIRDelayInit.)

Source File

  • firdecim_aa.s

Cycle counts for PIC32A:

Source Vector SizeCycles if coefficients in X-memCycles if coefficients in P-mem

32

2352

4240

64

4660

8432

128

9258

16816

256

18484

33584

512

36916

67120

1024

73780

134192

2048

147508

268336

(*All values with numCoeffs = 32; rate = 2)

System resource usage

  • W0…W7 - used, not restored
  • W8…W11 - saved, used, restored
  • ACCA - used, not restored
  • CORCON - saved, used, restored
  • REPEAT instruction(s) usage – 2