Document toolboxDocument toolbox

(8.D.1.2) TableInterpRuntime

Overview

Table driven interpolation module with set function. Supports linear and smooth modes

Discussion

This module performs table lookup using unevenly spaced X and Y values.

The module supports linear and DSPC interpolation. Internally the interpolation is performed using a piece wise polynomial approximation. With linear interpolation a first order polynomial is used; for 4th order, a polynomial is used. The 4th order interpolation preserves the shape of the function as opposed as overshoots on a spline. This new interpolation method developed by DSP Concepts Inc. developed uses a reduced set of 3 coefficients.

The input to the module serves as the X value in the lookup and the output equals the Y value derived from doing the interpolation. The module is configured by setting the internal matrix .XY. The first row of .XY represents X values and the second row Y values.

At instantiation time you specify the total number of points (MAXPOINTS) in the table. MAXPOINTS determines the amount of memory allocated to the table. Then at run time, you can change the number of points actively used by the table (.numPoints). .numPoints must be less than or equal to MAXPOINTS.

The variable .order specifes either linear (=2) or cubic (=4) interpolation.

The module also provides a custom inspector for easy configuration from the Audio Weaver Designer GUI. The GUI translates the XY table into a piece wise polynomial segments. The matrix .polyCoeffs contains 4 x (MAXPOINT-1) values. Each column represents the coefficients for each polynomial. Row 4 is the X^3 coefficent, row 3 the X^2 coefficient, row 2 the X coefficient and row 1 the constant term.

If the input x falls outside of the range of values in the XY table then the input is clipped to the allowable range.

Type Definition

typedef struct _ModuleTableInterpRuntime { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 maxPoints; // Maximum number of values in the lookup table. The total table size is [maxPoints 2]. INT32 numPoints; // Current number of interpolation values in use. INT32 order; // Order of the interpolation. This can be either 2 (for linear) or 4 (for pchip). INT32 updateActive; // Specifies whether the poly coefficients are updating (=1) or fixed (=0). FLOAT32* XY; // Samples of the lookup table. The first row is the x values and the second row is the f(x) values FLOAT32* polyCoeffs; // Interpolation coefficients returned by the grid control } ModuleTableInterpRuntimeClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

maxPoints

int

const

0

8

4:1:1000

 

numPoints

int

parameter

0

4

4:1:8

 

order

int

parameter

0

2

2:2:4

 

updateActive

int

parameter

1

1

0:1

 

XY

float*

parameter

0

[2 x 8]

Unrestricted

 

polyCoeffs

float*

state

0

[4 x 7]

Unrestricted

 

Pins

Input Pins

Name: in

Description: audio input

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: float

MATLAB Usage

File Name: table_interp_runtime_module.m

M=table_interp_runtime_module(NAME, MAXPOINTS) This Audio Weaver module performs interpolation using a lookup table together with a configurable interpolation order. The table contains (X,Y) value pairs and can be unevenly spaced. For 4th order, this module uses a new interpolation method developed by Holguin at DSP Concepts Inc.. It corresponds to a variation of the Polynomial Hermit Interpolation or to the Akima Interpolation methods. The interpolation method is different than in table_interp_module. The inspector function is borrowed from such module and the response is slightly different. This module however saves 25% of the memory for coefficients and includes a runtime set function on the target. Arguments: NAME - name of the module. MAXPOINTS - maximum number of points allocated to the lookup table. This is set at design time and has a minimum value of 4. At run time, you can change the number of values in the lookup table from 4 to MAXPOINTS. The module can be configured to perform linear or pchip interpolation.

Â