CLK_FILTER_NEAREST;
const int2 coord = (int2)(get_global_id(0), get_global_id(1));
int2 offset;
- float4 sum = 0;
+ uint4 sum = 0;
for (offset.y = -1; offset.y <= 1; offset.y++) {
for (offset.x = -1; offset.x <= 1; offset.x++) {
- sum += read_imagef(src, sampler, coord + offset);
+ sum += read_imageui(src, sampler, coord + offset);
}
}
- write_imagef(dst, coord, (1.0f/9.0f)*sum);
+ uint4 result = sum / 9;
+
+ write_imageui(dst, coord, result);
}
src = cl_read_bmp("lenna128x128.bmp", &w, &h);
format.image_channel_order = CL_RGBA;
- format.image_channel_data_type = CL_UNORM_INT8;
+ format.image_channel_data_type = CL_UNSIGNED_INT8;
desc.image_type = CL_MEM_OBJECT_IMAGE2D;
desc.image_width = w;
desc.image_height = h;