1 /* This file is an image processing operation for GEGL
3 * GEGL is free software
; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation
; either
6 * version
3 of the License
, or
(at your option
) any later version.
8 * GEGL is distributed in the hope that it will be useful
,
9 * but WITHOUT ANY WARRANTY
; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with GEGL
; if not, see <https://www.gnu.org/licenses/>.
16 * Copyright
2013 Carlos Zubieta
<czubieta.dev
@gmail.com
>
19 __kernel void cl_noise_hurl
(__global float4
*src
,
20 __global const int
*random_data
,
24 int whole_region_width
,
30 int gid
= get_global_id
(0);
31 int gidy
= gid
/ roi_width
;
32 int gidx
= gid - gidy
*roi_width
;
34 int x
= gidx
+ x_offset
;
35 int y
= gidy
+ y_offset
;
36 int n
= 4 * (x + whole_region_width
* y
+ offset
);
38 float4 src_v
= src
[gid];
40 float pc = gegl_cl_random_float_range (random_data,
41 rand, x, y, 0, n, 0, 100);
45 float red_noise = gegl_cl_random_float (random_data,
51 float green_noise = gegl_cl_random_float (random_data,
53 float blue_noise = gegl_cl_random_float (random_data,
55 src_v.y = green_noise;