__global__ void smooth_kernel(const uchar3* src, uchar3* dst, int width, int height) { int x = threadIdx.x + blockIdx.x * blockDim.x; int y = threadIdx.y + blockIdx.y * blockDim.y;
if(x < width y < height) { int offset = x + y * width; int left = offset - 1; if (x - 1 < 0) { left += 1; } int right = offset + 1; if (x + 1 >= width) { right -= 1; } int top = offset - width; if (y - 1 < 0) { top += width; } int bottom = offset + width; if (y + 1 >= height) { bottom -= width; }
__global__ void swap_rb_kernel(const uchar3* src, uchar3* dst, int width, int height) { int x = threadIdx.x + blockIdx.x * blockDim.x; int y = threadIdx.y + blockIdx.y * blockDim.y;
if(x < width y < height) { int offset = x + y * width; uchar3 v = src[offset]; dst[offset].x = v.z; dst[offset].y = v.y; dst[offset].z = v.x; } }