1.4.2.65 DSP_VectorBexp32 Function

Computes the maximum binary exponent of a vector.

Description

int DSP_VectorBexp32(int32_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 Q31 fractional data format.

Preconditions

None.

Parameters

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

N number of samples (int)

Returns

Binary exponent (int)

Remarks

None.

Example

int valN=4;

int32_t datInput32[4]={0xFF000000, 0x07000000,0x000CCCCC, 0x08000000};

_// -0.007183, 0.054688, 0.0003906, 0.0625_

int answer32;

answer32 = DSP_VectorBexp32(datInput32, valN);

_// answer = 3, maximum binary gain is 8._

C

int  DSP_VectorBexp32 (int32_t * DataIn , int  N );