1.4.2.64 DSP_VectorBexp16 Function

Computes the maximum binary exponent of a vector.

Description

int DSP_VectorBexp16(int16_t *DataIn, int N);

Calculates the maximum binary exponent on the first N elements of the input vector DataIn, and stores the integer result. The returned value represents the potential binary scaling of the vector, and may be used with other functions that auto scale their output without saturation. Inputs are given in Q15 fractional data format.

Preconditions

N must be a multiple of 2 and greater or equal to 2.

Parameters

DataIn pointer to input array of 16-bit elements (int16_t)

N number of samples (int)

Returns

Binary exponent (int)

Remarks

None.

Example

int valN = 4;

int16_t dummy16[valN]={0x3004, 0x00CC, 0xFC04, 0xFFF0};

_// 0.375, 0.0062, -0.0311, -0.00049_

int answer;

answer = DSP_VectorBexp16(dummy16, valN);

_// answer = 1, maximum binary gain is 2._

C

int  DSP_VectorBexp16 (int16_t * DataIn , int  N );