Skip to content

TableInterp2dV2

Overview

Table driven 2D module using bilinear interpolation

Discussion

This module performs an interpolated 2-dimensional table lookup using a grid of values. The module currently supports only bilinear interpolation. The input pins specify the X and Y values at which to perform the interpolation. Input values are prescaled based on max/min arguments. 4 points in the table are used and bilinear interpolation is applied. The X values interpolate along a row and Y values interpolate along a column.

The module contains a table of values which are assumed to be linearly spaced. The first value in the table corresponds to the function value at .minX. / .minY. The last value in the table corresponds to the function value at .maxX. / .maxY. Values outside of this range are clipped.

At instantiation, specify the total number of points in each dimension of the table (x and y). The amount of memory allocated to the table equals (NPOINTS_X * NPOINTS_Y).

Compared to V1 this version does not restrict the table points to be evenly squared (x=y). Furthermore, prescaling of input values is now handled within the module.

Module Pack

Advanced

ClassID

classID = 1448

Type Definition

typedef struct _ModuleTableInterp2dV2
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
FLOAT32 minX;                                 // X value corresponding to the first table entry.
FLOAT32 maxX;                                 // X value corresponding to the last table entry.
FLOAT32 minY;                                 // Y value corresponding to the first table entry.
FLOAT32 maxY;                                 // Y value corresponding to the last table entry.
FLOAT32 divisorX;                             // Precomputed constant = (NUMPOINTS_X-1) / (maxX-minX) to eliminate division on the target.
FLOAT32 divisorY;                             // Precomputed constant = (NUMPOINTS_Y-1) / (maxY-minY) to eliminate division on the target.
INT32 nPointsX;                               // Number of points in x-dimension of the active interpolation table.
INT32 nPointsY;                               // Number of points in y-dimension of the active interpolation table.
INT32 tableHeap;                              // Heap in which to allocate memory.
FLOAT32* table;                               // 2D Interpolation Lookup table (num rows = nPointsY, num columns = nPointsX)
} ModuleTableInterp2dV2Class;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
minX float parameter 0 -1 -1000:1000
maxX float parameter 0 1 -1000:1000
minY float parameter 0 -1 -1000:1000
maxY float parameter 0 1 -1000:1000
divisorX float derived 0 2 Unrestricted
divisorY float derived 0 2 Unrestricted
nPointsX int const 0 5 Unrestricted
nPointsY int const 0 5 Unrestricted
tableHeap int const 1 2 Unrestricted
table float* parameter 0 [5 x 5] Unrestricted

Pins

Input Pins

Name inx
Description index x
Data type float
Channel range Unrestricted
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real
Name iny
Description index y
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_interp2d_v2_module.m 
 M = table_interp2d_v2_module(NAME, NPOINTS_X, NPOINTS_Y, MEMHEAP) 
 This Audio Weaver module process performs bilinear interpolation between  
 values defined on a lattice with NPTS. For input coordinates between the  
 lattice points, interpolate linearly for x and then for y. 

 Arguments: 
    NAME - name of the module. 
    NPOINTS_X - number of points in x-dimension. This is set at design 
       time and has a minimum value of 2. 
    NPOINTS_Y - number of points in y-dimension. This is set at design 
       time and has a minimum value of 2. 
    MEMHEAP - specifies the memory heap to use to allocate the table 
         buffer. This is a string and follows the memory allocation 
         enumeration in Framework.h. Allowable values are: 
            'AWE_HEAP_FAST' - always use internal DM memory. 
            'AWE_HEAP_FASTB' - always use internal PM memory. 
            'AWE_HEAP_SLOW' - always use external memory (the default). 
            'AWE_HEAP_FAST2SLOW' - use internal memory. If this fails 
               then use external memory (the default). 

 The internal variable .table holds the underlying table of values. 
 .table has a size of NPOINTS_X x NPOINTS_Y. 

Copyright (c) 2026 DSP Concepts, Inc.