57 const int total_width = BORDER_SIZE_LEFT + width + BORDER_SIZE_RIGHT;
58 const int gid0 = get_global_id(0);
59 const int gidH = gid0 - total_width;
60 const int gidW = gid0 - BORDER_SIZE_LEFT;
65 DATA_TYPE left_val = *(__global DATA_TYPE *)
offset(&buf, 0, gidH);
66 for(
int i = -BORDER_SIZE_LEFT; i < 0; ++i)
68 *(__global DATA_TYPE *)
offset(&buf, i, gidH) = left_val;
71 DATA_TYPE right_val = *(__global DATA_TYPE *)
offset(&buf, width - 1, gidH);
72 for(
int i = 0; i < BORDER_SIZE_RIGHT; ++i)
74 *(__global DATA_TYPE *)
offset(&buf, width + i, gidH) = right_val;
81 if(gidW < 0 || gidW > (width - 1))
83 val_idx = gidW < 0 ? 0 : width - 1;
87 DATA_TYPE top_val = *(__global DATA_TYPE *)
offset(&buf, val_idx, 0);
88 for(
int i = -BORDER_SIZE_TOP; i < 0; ++i)
90 *(__global DATA_TYPE *)
offset(&buf, gidW, i) = top_val;
93 DATA_TYPE bottom_val = *(__global DATA_TYPE *)
offset(&buf, val_idx, height - 1);
94 for(
int i = 0; i < BORDER_SIZE_BOTTOM; ++i)
96 *(__global DATA_TYPE *)
offset(&buf, gidW, height + i) = bottom_val;
127 DATA_TYPE constant_value)
134 const int total_width = BORDER_SIZE_LEFT + width + BORDER_SIZE_RIGHT;
135 const int gid0 = get_global_id(0);
136 const int gidH = gid0 - total_width;
137 const int gidW = gid0 - BORDER_SIZE_LEFT;
142 for(
int i = -BORDER_SIZE_LEFT; i < 0; ++i)
144 *(__global DATA_TYPE *)
offset(&buf, i, gidH) = constant_value;
147 for(
int i = 0; i < BORDER_SIZE_RIGHT; ++i)
149 *(__global DATA_TYPE *)
offset(&buf, width + i, gidH) = constant_value;
155 for(
int i = -BORDER_SIZE_TOP; i < 0; ++i)
157 *(__global DATA_TYPE *)
offset(&buf, gidW, i) = constant_value;
160 for(
int i = 0; i < BORDER_SIZE_BOTTOM; ++i)
162 *(__global DATA_TYPE *)
offset(&buf, gidW, height + i) = constant_value;