LIBDSP Version 4.1.9
LIBDSP Software Library
Loading...
Searching...
No Matches
Collaboration diagram for Mean:

Functions

void tpt_mean_q15 (q15_t *aResult, const q15_t *aInData, uint32_t aCount)
 Mean value of a Q15 vector.
void tpt_mean_q7 (q7_t *aResult, const q7_t *aInData, uint32_t aCount)
 Mean value of a Q7 vector.
void tpt_mean_f32 (f32_t *aResult, const f32_t *aInData, uint32_t aCount)
 Mean value of a floating-point vector.
void tpt_mean_f64 (f64_t *aResult, const f64_t *aInData, uint32_t aCount)
 Mean value of a floating-point vector.
void tpt_mean_q31 (q31_t *aResult, const q31_t *aInData, uint32_t aCount)
 Mean value of a Q31 vector.

Detailed Description

Calculates the mean of the input vector. Mean is defined as the average of the elements in the vector. The underlying algorithm is used:

   aResult = (aInData[0] + aInData[1] + aInData[2] + ... + aInData[aCount-1])
             / aCount;
 

There are separate functions for floating-point, Q31, Q15, and Q7 data types.

Function Documentation

◆ tpt_mean_f32()

void tpt_mean_f32 ( f32_t * aResult,
const f32_t * aInData,
uint32_t aCount )

Mean value of a floating-point vector.

Parameters
[out]aResultmean value returned here.
[in]aInDatapoints to the input vector.
[in]aCountnumber of samples in input vector.
Returns
none

◆ tpt_mean_f64()

void tpt_mean_f64 ( f64_t * aResult,
const f64_t * aInData,
uint32_t aCount )

Mean value of a floating-point vector.

Parameters
[out]aResultmean value returned here.
[in]aInDatapoints to the input vector.
[in]aCountnumber of samples in input vector.
Returns
none

◆ tpt_mean_q15()

void tpt_mean_q15 ( q15_t * aResult,
const q15_t * aInData,
uint32_t aCount )

Mean value of a Q15 vector.

Parameters
[out]aResultmean value returned here.
[in]aInDatapoints to the input vector.
[in]aCountnumber of samples in input vector.
Returns
none
Scaling and Overflow Behavior
The function is implemented using a 32-bit internal accumulator. The input is represented in 1.15 format and is accumulated in a 32-bit accumulator in 17.15 format. There is no risk of internal overflow with this approach, and the full precision of intermediate result is preserved. Finally, the accumulator is truncated to yield a result of 1.15 format.

◆ tpt_mean_q31()

void tpt_mean_q31 ( q31_t * aResult,
const q31_t * aInData,
uint32_t aCount )

Mean value of a Q31 vector.

Parameters
[out]aResultmean value returned here.
[in]aInDatapoints to the input vector.
[in]aCountnumber of samples in input vector.
Returns
none
Scaling and Overflow Behavior
The function is implemented using a 64-bit internal accumulator. The input is represented in 1.31 format and is accumulated in a 64-bit accumulator in 33.31 format. There is no risk of internal overflow with this approach, and the full precision of intermediate result is preserved. Finally, the accumulator is truncated to yield a result of 1.31 format.

◆ tpt_mean_q7()

void tpt_mean_q7 ( q7_t * aResult,
const q7_t * aInData,
uint32_t aCount )

Mean value of a Q7 vector.

Parameters
[out]aResultmean value returned here.
[in]aInDatapoints to the input vector.
[in]aCountnumber of samples in input vector.
Returns
none
Scaling and Overflow Behavior
The function is implemented using a 32-bit internal accumulator. The input is represented in 1.7 format and is accumulated in a 32-bit accumulator in 25.7 format. There is no risk of internal overflow with this approach, and the full precision of intermediate result is preserved. Finally, the accumulator is truncated to yield a result of 1.7 format.