blob: b780ecea4c8c5cd91703e2968630ff5bec33e17e (
plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
|
__kernel void kernel_max_hor (__global const float4 *in,
__global float4 *aux,
int width, int radius)
{
const int in_index = get_global_id(0) * (width + 2 * radius)
+ (radius + get_global_id (1));
const int aux_index = get_global_id(0) * width + get_global_id (1);
int i;
float4 max;
float4 in_v;
max = (float4)(-1000000000.0f);
if (get_global_id(1) < width)
{
for (i=-radius; i <= radius; i++)
{
in_v = in[in_index + i];
max = max < in_v ? in_v : max;
}
aux[aux_index] = max;
}
}
__kernel void kernel_max_ver (__global const float4 *aux,
__global float4 *out,
int width, int radius)
{
const int out_index = get_global_id(0) * width + get_global_id (1);
int aux_index = out_index;
int i;
float4 max;
float4 aux_v;
max = (float4)(-1000000000.0f);
if(get_global_id(1) < width)
{
for (i=-radius; i <= radius; i++)
{
aux_v = aux[aux_index];
max = max < aux_v ? aux_v : max;
aux_index += width;
}
out[out_index] = max;
}
}
|