3-channel support in OpenCL kernels for setTo, resize, warpAffine and warpPerspective
This commit is contained in:
@@ -87,9 +87,21 @@ __kernel void copyToMask(__global const uchar * srcptr, int src_step, int src_of
|
||||
|
||||
#else
|
||||
|
||||
#ifndef dstST
|
||||
#define dstST dstT
|
||||
#endif
|
||||
|
||||
#if cn != 3
|
||||
#define value value_
|
||||
#define storedst(val) *(__global dstT*)(dstptr + dst_index) = val
|
||||
#else
|
||||
#define value (dstT)(value_.x, value_.y, value_.z)
|
||||
#define storedst(val) vstore3(val, 0, (__global dstT1*)(dstptr + dst_index))
|
||||
#endif
|
||||
|
||||
__kernel void setMask(__global const uchar* mask, int maskstep, int maskoffset,
|
||||
__global uchar* dstptr, int dststep, int dstoffset,
|
||||
int rows, int cols, dstT value )
|
||||
int rows, int cols, dstST value_ )
|
||||
{
|
||||
int x = get_global_id(0);
|
||||
int y = get_global_id(1);
|
||||
@@ -99,22 +111,22 @@ __kernel void setMask(__global const uchar* mask, int maskstep, int maskoffset,
|
||||
int mask_index = mad24(y, maskstep, x + maskoffset);
|
||||
if( mask[mask_index] )
|
||||
{
|
||||
int dst_index = mad24(y, dststep, x*(int)sizeof(dstT) + dstoffset);
|
||||
*(__global dstT*)(dstptr + dst_index) = value;
|
||||
int dst_index = mad24(y, dststep, x*(int)sizeof(dstT1)*cn + dstoffset);
|
||||
storedst(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__kernel void set(__global uchar* dstptr, int dststep, int dstoffset,
|
||||
int rows, int cols, dstT value )
|
||||
int rows, int cols, dstST value_ )
|
||||
{
|
||||
int x = get_global_id(0);
|
||||
int y = get_global_id(1);
|
||||
|
||||
if (x < cols && y < rows)
|
||||
{
|
||||
int dst_index = mad24(y, dststep, x*(int)sizeof(dstT) + dstoffset);
|
||||
*(__global dstT*)(dstptr + dst_index) = value;
|
||||
int dst_index = mad24(y, dststep, x*(int)sizeof(dstT1)*cn + dstoffset);
|
||||
storedst(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user