Skip to main content
Skip table of contents

FIRDecimatorFract32

Overview

Decimator combining an FIR filter and a downsampler

Discussion

The FIR decimator module implements an FIR filter followed by a downsampler. An efficient polyphase algorithm is used which reduces the processing load. The module operates on multiple channels with all channels sharing the same set of filter coefficients. The filter coefficients are stored in the array coeffs in normal order. Each channel uses a circular buffer of length N+D-1, where D is the decimation factor.

The block size of the input pin must be divisible by the decimation factor D. This condition is checked in the prebuild function. The output block size equals the input block size divided by D. The output sample rate equals the input sample rate divided by D.

Type Definition

CODE
typedef struct _ModuleFIRDecimatorFract32
{
    ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
    INT32 D;                                      // Downsampling factor
    INT32 N;                                      // Length of the filter
    INT32 stateIndex;                             // Index of the oldest state variable in the array of state variables
    INT32 stateLen;                               // Length of the circular buffer used by each channel
    INT32 postShift;                              // Number of bits to shift
    FLOAT32* coeffs;                              // Filter coefficient array in normal order
    fract32* coeffsFract32;                       // Filter Fract32 coefficient array in normal order
    fract32* state;                               // State variable array. The size of the array equals stateLen * numChannels
} ModuleFIRDecimatorFract32Class;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

D

int

const

0

2

1:1:512

N

int

const

0

32

1:1:5000

samples

stateIndex

int

state

1

0

Unrestricted

stateLen

int

const

1

33

Unrestricted

postShift

int

derived

1

-1

Unrestricted

coeffs

float*

parameter

0

[32 x 1]

Unrestricted

coeffsFract32

fract32*

derived

0

[33 x 1]

Unrestricted

state

fract32*

state

1

[33 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: audio input

Data type: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: fract32

MATLAB Usage

File Name: fir_decimator_fract32_module.m

CODE
 M=fir_decimator_fract32_module(NAME, D, N)
 Implements a Fract32 decimator module which combines an FIR filter and
 a downsampler.  An efficient polyphase algorithm is used to 
 reduce the required computation.  The module has a multichannel
 input and a multichannel output pin.  Arguments:
    NAME - name of the module.
    D - decimation factor.
    N - length of the filter (number of taps).

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.