Texas Instruments TMS320C64X Security Camera User Manual


 
DSP_bexp
4-76
4.7 Miscellaneous
Block Exponent Implementation
DSP_bexp
Function short DSP_bexp(const int *x, short nx)
Arguments x[nx] Pointer to input vector of size nx. Must be double-word
aligned.
nx Number of elements in input vector. Must be multiple of 8.
return short Return value is the maximum exponent that may be used in
scaling.
Description Computes the exponents (number of extra sign bits) of all values in the input
vector x[ ] and returns the minimum exponent. This will be useful in
determining the maximum shift value that may be used in scaling a block of
data.
Algorithm This is the C equivalent of the assembly code without restrictions. Note that
the assembly code is hand optimized and restrictions may apply.
short DSP_bexp(const int *x, short nx)
{
int min_val =_norm(x[0]);
short n;
int i;
for(i=1;i<nx;i++)
{
n =_norm(x[i]); /* _norm(x) = number of */
/* redundant sign bits */
if(n<min_val) min_val=n;
}
return min_val;
}
Special Requirements
- nx must be a multiple of 8.
- The input vector x[ ] must be double-word aligned.