|
|
|
@ -43,17 +43,28 @@ |
|
|
|
|
// |
|
|
|
|
//M*/ |
|
|
|
|
|
|
|
|
|
#if cn != 3 |
|
|
|
|
#define loadpix(addr) *(__global const T *)(addr) |
|
|
|
|
#define storepix(val, addr) *(__global T *)(addr) = val |
|
|
|
|
#define TSIZE (int)sizeof(T) |
|
|
|
|
#define scalar scalar_ |
|
|
|
|
#else |
|
|
|
|
#define loadpix(addr) vload3(0, (__global const T1 *)(addr)) |
|
|
|
|
#define storepix(val, addr) vstore3(val, 0, (__global T1 *)(addr)) |
|
|
|
|
#define TSIZE ((int)sizeof(T1)*3) |
|
|
|
|
#define scalar (T)(scalar_.x, scalar_.y, scalar_.z) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
__kernel void setIdentity(__global uchar * srcptr, int src_step, int src_offset, int rows, int cols, |
|
|
|
|
T scalar) |
|
|
|
|
ST scalar_) |
|
|
|
|
{ |
|
|
|
|
int x = get_global_id(0); |
|
|
|
|
int y = get_global_id(1); |
|
|
|
|
|
|
|
|
|
if (x < cols && y < rows) |
|
|
|
|
{ |
|
|
|
|
int src_index = mad24(y, src_step, mad24(x, (int)sizeof(T), src_offset)); |
|
|
|
|
__global T * src = (__global T *)(srcptr + src_index); |
|
|
|
|
int src_index = mad24(y, src_step, mad24(x, TSIZE, src_offset)); |
|
|
|
|
|
|
|
|
|
src[0] = x == y ? scalar : (T)(0); |
|
|
|
|
storepix(x == y ? scalar : (T)(0), srcptr + src_index); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|