mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #15236 from dbudniko:dbudniko/g_api_copy_kernels
This commit is contained in:
@@ -323,6 +323,11 @@ GMat crop(const GMat& src, const Rect& rect)
|
||||
return core::GCrop::on(src, rect);
|
||||
}
|
||||
|
||||
GMat copy(const GMat& src)
|
||||
{
|
||||
return core::GCopy::on(src);
|
||||
}
|
||||
|
||||
GMat concatHor(const GMat& src1, const GMat& src2)
|
||||
{
|
||||
return core::GConcatHor::on(src1, src2);
|
||||
|
||||
@@ -501,6 +501,14 @@ GAPI_OCV_KERNEL(GCPUCrop, cv::gapi::core::GCrop)
|
||||
}
|
||||
};
|
||||
|
||||
GAPI_OCV_KERNEL(GCPUCopy, cv::gapi::core::GCopy)
|
||||
{
|
||||
static void run(const cv::Mat& in, cv::Mat& out)
|
||||
{
|
||||
cv::Mat(in).copyTo(out);
|
||||
}
|
||||
};
|
||||
|
||||
GAPI_OCV_KERNEL(GCPUConcatHor, cv::gapi::core::GConcatHor)
|
||||
{
|
||||
static void run(const cv::Mat& in1, const cv::Mat& in2, cv::Mat& out)
|
||||
@@ -611,6 +619,7 @@ cv::gapi::GKernelPackage cv::gapi::core::cpu::kernels()
|
||||
, GCPURemap
|
||||
, GCPUFlip
|
||||
, GCPUCrop
|
||||
, GCPUCopy
|
||||
, GCPUConcatHor
|
||||
, GCPUConcatVert
|
||||
, GCPULUT
|
||||
|
||||
@@ -2118,6 +2118,40 @@ GAPI_FLUID_KERNEL(GFluidSqrt, cv::gapi::core::GSqrt, false)
|
||||
}
|
||||
};
|
||||
|
||||
GAPI_FLUID_KERNEL(GFluidCopy, cv::gapi::core::GCopy, false)
|
||||
{
|
||||
static const int Window = 1;
|
||||
|
||||
static void run(const View &src, Buffer &dst)
|
||||
{
|
||||
const auto *in = src.InLine<uchar>(0);
|
||||
auto *out = dst.OutLine<uchar>();
|
||||
|
||||
GAPI_DbgAssert(dst.length() == src.length());
|
||||
GAPI_DbgAssert(dst.meta().chan == src.meta().chan);
|
||||
GAPI_DbgAssert(dst.meta().depth == src.meta().depth);
|
||||
|
||||
int width = src.length();
|
||||
int elem_size = CV_ELEM_SIZE(CV_MAKETYPE(src.meta().depth, src.meta().chan));
|
||||
|
||||
int w = 0; // cycle counter
|
||||
|
||||
#if CV_SIMD128
|
||||
for (; w <= width*elem_size-16; w+=16)
|
||||
{
|
||||
v_uint8x16 a;
|
||||
a = v_load(&in[w]);
|
||||
v_store(&out[w], a);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (; w < width*elem_size; w++)
|
||||
{
|
||||
out[w] = in[w];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace fliud
|
||||
} // namespace gapi
|
||||
} // namespace cv
|
||||
@@ -2173,6 +2207,7 @@ cv::gapi::GKernelPackage cv::gapi::core::fluid::kernels()
|
||||
,GFluidInRange
|
||||
,GFluidResize
|
||||
,GFluidSqrt
|
||||
,GFluidCopy
|
||||
#if 0
|
||||
,GFluidMean -- not fluid
|
||||
,GFluidSum -- not fluid
|
||||
|
||||
@@ -482,6 +482,14 @@ GAPI_OCL_KERNEL(GOCLCrop, cv::gapi::core::GCrop)
|
||||
}
|
||||
};
|
||||
|
||||
GAPI_OCL_KERNEL(GOCLCopy, cv::gapi::core::GCopy)
|
||||
{
|
||||
static void run(const cv::UMat& in, cv::UMat& out)
|
||||
{
|
||||
cv::UMat(in).copyTo(out);
|
||||
}
|
||||
};
|
||||
|
||||
GAPI_OCL_KERNEL(GOCLConcatHor, cv::gapi::core::GConcatHor)
|
||||
{
|
||||
static void run(const cv::UMat& in1, const cv::UMat& in2, cv::UMat& out)
|
||||
@@ -573,6 +581,7 @@ cv::gapi::GKernelPackage cv::gapi::core::ocl::kernels()
|
||||
, GOCLRemap
|
||||
, GOCLFlip
|
||||
, GOCLCrop
|
||||
, GOCLCopy
|
||||
, GOCLConcatHor
|
||||
, GOCLConcatVert
|
||||
, GOCLLUT
|
||||
|
||||
Reference in New Issue
Block a user