_Convolve (Windows Embedded CE 6.0)
1/5/2010
Computes the summation of two vectors.
Syntax
Float _Convolve(
int nelement,
float* pstart,
float* pend,
float* pdata,
float* pfilter
);
Parameters
- nelement
[in] Number of elements to be processed.
- pstart
[in] Pointer to the beginning of data buffer.
- pend
[in] Pointer to the end of data buffer.
- pdata
[in] Pointer to the current data buffer.
- pfilter
[in] Pointer to the filter buffer.
Return Values
The summation of two vectors.
Remarks
The pdata parameter can point to any position in the data buffer. The pfilter parameter can point to any position in the filter buffer. The nelement parameter must not exceed pfilter+nelement buffer size.
To implement this function, use the -Qsh4 -Oi flag when compiling.
The following code example shows how to use _Convolve.
/*****************************************************************
_Convolve: summation of two vector
pstart | A0 | pfilter | X0 |
| A1 | | X1 |
| .. | | .. |
pdata | Ai | | .. |
| .. | | .. |
pend | An | | Xn |
For example:
nelement = 4;
result = (Ai * X3) + (Ai+1 * X2) + (Ai+2 * x1) + (Ai+3 * x0)
nelement = n+i;
result = (Ai * Xn) + (Ai+1 * Xn-1) + .. + (Ai-1 * X0)
*****************************************************************/
#include <stdio.h>
#include <shintr.h>
#include <stdio.h>
void main()
{
float pdata[5] = {1.0,2.0,3.0,4.0,5.0};
float filter[5] = {1.0,2.0,3.0,4.0,5.0};
float output;
float *pstart = pdata;
float *pend = pdata+4;
output = _Convolve(5, pstart, pend, pdata, filter);
printf("output = %f\n", output);
output = _Convolve(5, pstart, pend, pdata+1, filter);
printf("output = %f\n", output);
output = _Convolve(5, pstart, pend, pdata+2, filter);
printf("output = %f\n", output);
output = _Convolve(5, pstart, pend, pdata+3, filter);
printf("output = %f\n", output);
output = _Convolve(5, pstart, pend, pdata+4, filter);
printf("output = %f\n", output);
}
Output
output = 35.000000
output = 45.000000
output = 50.000000
output = 50.000000
output = 45.000000
Requirements
Architecture | SH-4 |
Header | shintr.h |
Routine | _Convolve |