Texas Instruments TMS320C64X Security Camera User Manual


 
DSP_minval
4-65 C64x+ DSPLIB Reference
Minimum Value of Vector
DSP_minval
Function short DSP_minval (const short *x, int nx)
Arguments x [nx] Pointer to input vector of size nx.
nx Length of input data vector. Must be multiple of 4 and 20.
return short Maximum value of a vector.
Description This routine finds the minimum value of a vector and returns the value.
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_minval(short x[ ], int nx)
{
int i, min;
min = 32767;
for (i = 0; i < nx; i++)
if (x[i] < min)
min = x[i];
return min;
}
Special Requirements nx is a multiple of 4 and greater than or equal to 20.
Implementation Notes
- Bank Conflicts: No bank conflicts occur.
- Interruptibility: The code is interrupt-tolerant but not interruptible.
- The input data is loaded using double word wide loads, and the MIN2
instruction is used to get to the minimum.
Benchmarks Cycles nx / 4 +10
Codesize 116 bytes