|
|
| DSP_minerror | |
| Minimum Energy Error Search | |||
DSP_minerror | ||||
Function |
|
|
| |
| int minerror (const short * restrict GSP0_TABLE, const short * restrict | |||
|
| errCoefs, int * restrict max_index) | ||
Arguments |
| GSP0_TABLE[9*256] | GSP0 terms array. Must be | |
|
| errCoefs[9] | Array of error coefficients. | |
|
| max_index | Pointer to GSP0_TABLE[max_index] found. | |
|
| return int | Maximum dot product result. | |
Algorithm |
| This is the C equivalent of the assembly code without restrictions. Note that the | ||
|
| assembly code is hand optimized and restrictions may apply. | ||
|
| int minerr |
|
|
| ( |
|
|
const short *restrict | GSP0_TABLE, | |
const short *restrict | errCoefs, | |
int | *restrict | max_index |
)
{
int val, maxVal = −50; int i, j;
for (i = 0; i < GSP0_NUM; i++)
{
for (val = 0, j = 0; j < GSP0_TERMS; j++)
val += GSP0_TABLE[i*GSP0_TERMS+j] * errCoefs[j];
if (val > maxVal)
{
maxVal = val;
*max_index = i*GSP0_TERMS;
}
}
return (maxVal);
}
C64x+ DSPLIB Reference |