1.4.2.38 DSP_TransformWindow_Cosine32 Function

Perform a Cosine (Sine) window on a vector.

Description

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

Compute a Cosine Window on the first N samples of the input vector, InVector. The output is stored in OutWindow. Operations are performed at higher resolution and rounded for the most accuracy possible. Input and output values are in Q31 fractional format.

The Cosine Window follows the equation:

Window(n) = SIN(Pi*n/(N-1)) 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_Cosine32(OutVector32, InVector32, WindowN);

_// OutWindow = 0x00000000, 0x1BC4C060, 0x32098700, 0x3E653800, 0x3E653800,_

_// 0x32098700, 0x1BC4C060, 0x00000000_

C

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