Update Portuguese translation
[gegl.git] / opencl / alien-map.cl
blob16de58133b806bf5a153ddb048977b34563bc661
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_alien_map(__global const float4 *in,
20 __global float4 *out,
21 float3 freq,
22 float3 phaseshift,
23 int3 keep)
25 int gid = get_global_id(0);
26 float4 in_v = in[gid];
27 float3 unit = (float3) (1.0f, 1.0f, 1.0f);
28 float3 tmp = 0.5f * (unit
29 + sin((2.0f * in_v.xyz - unit) * freq.xyz + phaseshift.xyz));
30 float4 out_v;
32 out_v.x = keep.x ? in_v.x : tmp.x;
33 out_v.y = keep.y ? in_v.y : tmp.y;
34 out_v.z = keep.z ? in_v.z : tmp.z;
35 out_v.w = in_v.w;
36 out[gid] = out_v;