forked from parallella/pal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp_conv.c
37 lines (35 loc) · 864 Bytes
/
p_conv.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <pal.h>
/**
* Computes the convolution of two vectors 'x' and 'h', and places the
* results in vector 'r'.
*
* @param x Pointer to input vector of size 'nr' elements
*
* @param h Pointer to 'nh' filter coefficients
*
* @param r Output vector of size 'nr+nh-1'
*
* @param nx The number of input samples
*
* @param nh The number of coefficients of the filter
*
* @param p Number of processor to use (task parallelism)
*
* @param team Team to work with
*
* @return None
*
*/
void p_conv_f32(const float *x, const float *h, float *r,
int nx, int nh, int p, p_team_t team)
{
const float *xc = x;
float *rx = r;
for ( int i = 0; i < nx; i++) {
float xv = *xc++;
rx++;
for (int j = 0; j < nh; j++) {
*(rx + j) += xv * *(h + j);
}
}
}