Update Portuguese translation
[gegl.git] / opencl / gblur-1d.cl
blobd4948946a57d583b0521f3fb22c0273cf6ec1dbd
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 Victor Oliveira <victormatheus@gmail.com>
17 * Copyright 2013 Téo Mazars <teomazars@gmail.com>
20 __kernel void fir_ver_blur(const global float4 *src_buf,
21 global float4 *dst_buf,
22 const global float *cmatrix,
23 const int clen)
25 const int gidx = get_global_id (0);
26 const int gidy = get_global_id (1);
27 const int src_rowstride = get_global_size (0);
28 const int dst_rowstride = get_global_size (0);
30 const int half_clen = clen / 2;
32 const int src_offset = gidx + (gidy + half_clen) * src_rowstride;
33 const int dst_offset = gidx + gidy * dst_rowstride;
35 const int src_start_ind = src_offset - half_clen * src_rowstride;
37 float4 v = 0.0f;
39 for (int i = 0; i < clen; i++)
41 v += src_buf[src_start_ind + i * src_rowstride] * cmatrix[i];
44 dst_buf[dst_offset] = v;
48 __kernel void fir_hor_blur(const global float4 *src_buf,
49 global float4 *dst_buf,
50 const global float *cmatrix,
51 const int clen)
53 const int gidx = get_global_id (0);
54 const int gidy = get_global_id (1);
55 const int src_rowstride = get_global_size (0) + clen - 1; /*== 2*(clen/2) */
56 const int dst_rowstride = get_global_size (0);
58 const int half_clen = clen / 2;
60 const int src_offset = gidx + gidy * src_rowstride + half_clen;
61 const int dst_offset = gidx + gidy * dst_rowstride;
63 const int src_start_ind = src_offset - half_clen;
65 float4 v = 0.0f;
67 for (int i = 0; i < clen; i++)
69 v += src_buf[src_start_ind + i] * cmatrix[i];
72 dst_buf[dst_offset] = v;