1.4.2.79 DSP_VectorMean32 Function

Calculates the mean average of an input vector.

Description

int32_t DSP_VectorMean32(int32_t *indata, int N);

Calculates the mean average of the first N elements of the vector indata. The values of indata1 are in Q31 fractional format. The value N must be greater than or equal to four and a multiple of four, or it will be truncated to the nearest multiple of four.

Preconditions

The pointers outdata and indata must be aligned on 4-byte boundaries. N must be greater than or equal to four and a multiple of four.

Parameters

indata pointer to source array of elements (int32_t)

N number of samples (int)

Returns

int32_t - mean average value of the vector

Remarks

None.

Example

int32_t returnValue;

int Num = 4;

int32_t inBufTestA[8]={0x7FFFFFFF, 0x80000000, 0x73333333, 0x66666666,

0x19999999, 0x40000000, 0x7FFFFFFF, 0xB3333334};

_// 1, -1, 0.9, 0.8, 0.2, 0.5, 1, -0.6_

returnValue = DSP_VectorMean32(inBufTestA, Num);

_// returnValue = 0x36666666 = (1-1+0.9+0.8)/4 = 0.425_

C

int32_t DSP_VectorMean32 (int32_t * indata1 , int  N );