1.4.2.41 DSP_TransformWindow_Hann16 Function

Perform a Hanning window on a vector.

Description

void DSP_TransformWindow_Hann16(int16_t *OutVector, int16_t *InVector, int N);

Compute a Hanning 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 Q15 fractional format.

The Hanning Window follows the equation:

Window(n) = 0.5 - 0.5 * COS(2Pin/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 (int16_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

int16_t OutVector16[8]={0};

int WindowN = 8;

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

{

InVector16[i]= 0x4000; _// constant 0.5 for functional testing_

}

DSP_TransformWindow_Hann16(OutVector16, InVector16, WindowN);

_// OutWindow = 0x0000, 0x095F, 0x2000, 0x36A1, 0x4000, 0x36A1, 0x2000, 0x095F_

C

void  DSP_TransformWindow_Hann16 (int16_t * OutVector , int16_t * InVector , int  N );