1.4.2.34 DSP_TransformWindow_Bart32 Function

Perform a Bartlett window on a vector.

Description

void DSP_TransformWindow_Bart32(int32_t *OutVector, int32_t *InVector, int N);

Compute a Bartlett (Triangle) Window on the first N samples of the input vector, InVector. The output is stored in OutVector.

Operations are performed at higher resolution and rounded for the most accuracy possible. Input and output values are in Q31 fractional format. The Bartlett Window follows the equation:

Window(n) = 1 - (abs(2*n - N)/N) where n is the window sample number, N is the total number of samples The functional output computes WinVector(n) = Window(n) * InVector(n)

Preconditions

N must be a positive number.

OutWindow must be declared with N elements or larger.

Parameters

OutWindow pointer to output array of elements (int32_t)

N number of samples (int)

Returns

None.

Remarks

This function is performed in C.

The function may be optimized for the library. It is dependent on the floating point math library.

Example

int32_t OutVector32[8]={0};

int WindowN = 8;

for (i=0;i<WindowN;i++)

{

InVector32[i]= 0x40000000; _// constant 0.5 for functional testing_

}

DSP_TransformWindow_Bart32(OutVector32, InVector32, WindowN);

_// OutWindow = 0x0, 0x10000000, 0x20000000, 0x30000000, 0x40000000,_

_// 0x30000000, 0x20000000, 0x10000000_

C

void  DSP_TransformWindow_Bart32 (int32_t * OutVector , int32_t * InVector , int  N );