1 __kernel void vignette_cl
(__global const float4
*in
,
17 int gidx
= get_global_id
(0);
18 int gidy
= get_global_id
(1);
19 int gid
= gidx
+ gidy
* get_global_size
(0);
20 float strength
= 0.0f
;
21 float u
,v
,costy
,sinty
;
25 sinty
= sint
* (y-midy) - midx
;
26 costy
= cost
* (y-midy) + midy
;
28 u
= cost
* (x-midx) - sinty
;
29 v
= sint
* (x-midx) + costy
;
38 strength
= hypot
((u-midx) / scale
, v-midy
);
42 strength
= fmax
(fabs(u-midx)/scale
, fabs
(v-midy));
46 strength
= fabs
(u-midx) / scale
+ fabs
(v-midy);
50 strength
= fabs
(v-midy);
54 strength
= fabs
(u-midx) / scale
;
58 strength
= (strength-radius0) / rdiff
;
61 if
(strength < 0.0f
) strength
= 0.0f
;
62 if
(strength > 1.0f
) strength
= 1.0f
;
64 if
(gamma > 1.9999f
&& gamma
< 2.0001f
)
66 else if
(gamma != 1.0f
)
67 strength
= pow
(strength, gamma
);
69 out
[gid] = in[gid]*(1.0f-strength
) + color
* strength
;