# What is "4 supported data types" below?

• posted

Hi,

I am learning to use NE10 ARM library. On its FIR function, see below pleas e, there are 2 places made me puzzled. The first one is:

There are separate instance structure declarations for each of the 4 suppor ted data types.

It is under "Instance Structure" section. I cannot get an idea about what 4 supported data types it means.

The second question is again "4 different data type filter instance structu res", see below please:

The code below statically initializes each of the 4 different data type fil ter instance structures

ne10_fir_instance_f32_t S = {numTaps, pState, pCoeffs};

The filter prototype is shown in the end.

Could you explain it to me?

Here is the link of the original source:

f3753774d12c1

Thanks a lot.

............................................... Functions void ne10_fir_float_c (const ne10_fir_instance_f32_t *S, ne10_float32_t *p Src, ne10_float32_t *pDst, ne10_uint32_t blockSize) Detailed Description

This set of functions implements Finite Impulse Response (FIR) filters for floating-point data types. The functions operate on blocks of input and output data and each call to the function processes blockSize samples thro ugh the filter. pSrc and pDst points to input and output arrays containing blockSize values.

Algorithm: The FIR filter algorithm is based upon a sequence of multiply-accumulat e (MAC) operations. Each filter coefficient b[n] is multiplied by a state v ariable which equals a previous input sample x[n].

y[n] = b[0] * x[n] + b[1] * x[n-1] + b[2] * x[n-2] + ...+ b[numTa ps-1] * x[n-numTaps+1]

FIR.gif Finite Impulse Response filter

pCoeffs points to a coefficient array of size numTaps. Coefficients are stored in time reversed order.

{b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}

pState points to a state array of size numTaps + blockSize - 1. Samples in the state buffer are stored in the following order.

{x[n-numTaps+1], x[n-numTaps], x[n-numTaps-1], x[n-numTaps-2]....x[

0], x[1], ..., x[blockSize-1]}

Note that the length of the state buffer exceeds the length of the coef ficient array by blockSize-1. The increased state buffer length allows circ ular addressing, which is traditionally used in the FIR filters, to be avoi ded and yields a significant speed improvement. The state variables are upd ated after each block of data is processed; the coefficients are untouched.

Instance Structure The coefficients and state variables for a filter are stored together i n an instance data structure. A separate instance structure must be defined for each filter. Coefficient arrays may be shared among several instances while state variable arrays cannot be shared. There are separate instance s tructure declarations for each of the 4 supported data types.

Initialization Functions There is also an associated initialization function for each data type. The initialization function performs the following operations:

Sets the values of the internal structure fields. Zeros out the values in the state buffer.

Use of the initialization function is optional. However, if the initial ization function is used, then the instance structure cannot be placed into a const data section. To place an instance structure into a const data sec tion, the instance structure must be manually initialized. Set the values i n the state buffer to zeros before static initialization. The code below st atically initializes each of the 4 different data type filter instance stru ctures

ne10_fir_instance_f32_t S = {numTaps, pState, pCoeffs};

where numTaps is the number of filter coefficients in the filter; pState is the address of the state buffer; pCoeffs is the address of the coefficient buffer.

Function Documentation void ne10_fir_float_c ( const ne10_fir_instance_f32_t * S, ne10_float32_t *The code below statically initializes each of the 4 diffe rent data type filter instance structures

ne10_fir_instance_f32_t S = {numTaps, pState, pCoeffs}; pSrc, ne10_float32_t * pDst, ne10_uint32_t blockSize )

Parameters: [in] *S points to an instance of the floating-point FIR filter structur e. [in] *pSrc points to the block of input data. [out] *pDst points to the block of output data. [in] blockSize number of samples to process per call.

Returns: none.

• posted

ase, there are 2 places made me puzzled. The first one is:

orted data types.

4 supported data types it means.

ilter instance structures

62f3753774d12c1
*pSrc, ne10_float32_t *pDst, ne10_uint32_t blockSize)

s for floating-point data types. The functions operate on blocks of input a nd output data and each call to the function processes blockSize samples th rough the filter. pSrc and pDst points to input and output arrays containin g blockSize values.

ate (MAC) operations. Each filter coefficient b[n] is multiplied by a state variable which equals a previous input sample x[n].

Taps-1] * x[n-numTaps+1]

re stored in time reversed order.

es in the state buffer are stored in the following order.

x[0], x[1], ..., x[blockSize-1]}

efficient array by blockSize-1. The increased state buffer length allows ci rcular addressing, which is traditionally used in the FIR filters, to be av oided and yields a significant speed improvement. The state variables are u pdated after each block of data is processed; the coefficients are untouche d.

in an instance data structure. A separate instance structure must be defin ed for each filter. Coefficient arrays may be shared among several instance s while state variable arrays cannot be shared. There are separate instance structure declarations for each of the 4 supported data types.

e. The initialization function performs the following operations:

alization function is used, then the instance structure cannot be placed in to a const data section. To place an instance structure into a const data s ection, the instance structure must be manually initialized. Set the values in the state buffer to zeros before static initialization. The code below statically initializes each of the 4 different data type filter instance st ructures

is the address of the state buffer; pCoeffs is the address of the coefficie nt buffer.

ferent data type filter instance structures

ure.

Here is the filter initial function. Does it mean the 4 fields of structure ne10_fir_instance_f32_t * S?

I am still very uncertain about it.

Thanks,

ne10_result_t ne10_fir_init_float0 (ne10_fir_instance_f32_t * S, ne10_uint16_t numTaps, ne10_float32_t * pCoeffs, ne10_float32_t * pState, ne10_uint32_t blockSize) { /* Assign filter taps */ S->numTaps = numTaps;

/* Assign coefficient pointer */ S->pCoeffs = pCoeffs;

/* Clear state buffer and the size of state buffer is (blockSize + numT aps - 1) */ memset (pState, 0, (numTaps + (blockSize - 1u)) * sizeof (ne10_float32_ t));

/* Assign state pointer */ S->pState = pState; return NE10_OK; }

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.