"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/util/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/cpu/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/gpu/*.hpp"
+ "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/ocl/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/fluid/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/own/*.hpp"
)
src/backends/fluid/gfluidimgproc_func.dispatch.cpp
src/backends/fluid/gfluidcore.cpp
- # GPU Backend (currently built-in)
- src/backends/gpu/ggpubackend.cpp
- src/backends/gpu/ggpukernel.cpp
- src/backends/gpu/ggpuimgproc.cpp
- src/backends/gpu/ggpucore.cpp
+ # OCL Backend (currently built-in)
+ src/backends/ocl/goclbackend.cpp
+ src/backends/ocl/goclkernel.cpp
+ src/backends/ocl/goclimgproc.cpp
+ src/backends/ocl/goclcore.cpp
# Compound
src/backends/common/gcompoundbackend.cpp
#ifndef OPENCV_GAPI_GPU_CORE_API_HPP
#define OPENCV_GAPI_GPU_CORE_API_HPP
+/** @file
+* @deprecated Use "opencv2/gapi/ocl/core.hpp" instead.
+*/
-#include <opencv2/core/cvdef.h> // GAPI_EXPORTS
-#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
+#include "opencv2/gapi/ocl/core.hpp"
namespace cv {
namespace gapi {
namespace core {
namespace gpu {
-
-GAPI_EXPORTS GKernelPackage kernels();
-
+ using namespace ocl;
} // namespace gpu
} // namespace core
} // namespace gapi
#ifndef OPENCV_GAPI_GGPUKERNEL_HPP
#define OPENCV_GAPI_GGPUKERNEL_HPP
+/** @file
+* @deprecated Use "opencv2/gapi/ocl/goclkernel.hpp" instead.
+*/
-#include <vector>
-#include <functional>
-#include <map>
-#include <unordered_map>
+#include "opencv2/gapi/ocl/goclkernel.hpp"
+#define GAPI_GPU_KERNEL GAPI_OCL_KERNEL
-#include <opencv2/core/mat.hpp>
-#include <opencv2/gapi/gcommon.hpp>
-#include <opencv2/gapi/gkernel.hpp>
-#include <opencv2/gapi/garg.hpp>
-
-// FIXME: namespace scheme for backends?
namespace cv {
-
-namespace gimpl
-{
- // Forward-declare an internal class
- class GGPUExecutable;
-} // namespace gimpl
-
-namespace gapi
-{
-namespace gpu
-{
- /**
- * \addtogroup gapi_std_backends G-API Standard backends
- * @{
- */
- /**
- * @brief Get a reference to GPU backend.
- *
- * At the moment, the GPU backend is built atop of OpenCV
- * "Transparent API" (T-API), see cv::UMat for details.
- *
- * @sa gapi_std_backends
- */
- GAPI_EXPORTS cv::gapi::GBackend backend();
- /** @} */
+namespace gapi {
+namespace core {
+namespace gpu {
+ using namespace ocl;
} // namespace gpu
+} // namespace core
} // namespace gapi
-
-
-// Represents arguments which are passed to a wrapped GPU function
-// FIXME: put into detail?
-class GAPI_EXPORTS GGPUContext
-{
-public:
- // Generic accessor API
- template<typename T>
- const T& inArg(int input) { return m_args.at(input).get<T>(); }
-
- // Syntax sugar
- const cv::UMat& inMat(int input);
- cv::UMat& outMatR(int output); // FIXME: Avoid cv::Mat m = ctx.outMatR()
-
- const cv::gapi::own::Scalar& inVal(int input);
- cv::gapi::own::Scalar& outValR(int output); // FIXME: Avoid cv::gapi::own::Scalar s = ctx.outValR()
- template<typename T> std::vector<T>& outVecR(int output) // FIXME: the same issue
- {
- return outVecRef(output).wref<T>();
- }
-
-protected:
- detail::VectorRef& outVecRef(int output);
-
- std::vector<GArg> m_args;
- std::unordered_map<std::size_t, GRunArgP> m_results;
-
-
- friend class gimpl::GGPUExecutable;
-};
-
-class GAPI_EXPORTS GGPUKernel
-{
-public:
- // This function is kernel's execution entry point (does the processing work)
- using F = std::function<void(GGPUContext &)>;
-
- GGPUKernel();
- explicit GGPUKernel(const F& f);
-
- void apply(GGPUContext &ctx);
-
-protected:
- F m_f;
-};
-
-// FIXME: This is an ugly ad-hoc imlpementation. TODO: refactor
-
-namespace detail
-{
-template<class T> struct gpu_get_in;
-template<> struct gpu_get_in<cv::GMat>
-{
- static cv::UMat get(GGPUContext &ctx, int idx) { return ctx.inMat(idx); }
-};
-template<> struct gpu_get_in<cv::GScalar>
-{
- static cv::Scalar get(GGPUContext &ctx, int idx) { return to_ocv(ctx.inVal(idx)); }
-};
-template<typename U> struct gpu_get_in<cv::GArray<U> >
-{
- static const std::vector<U>& get(GGPUContext &ctx, int idx) { return ctx.inArg<VectorRef>(idx).rref<U>(); }
-};
-template<class T> struct gpu_get_in
-{
- static T get(GGPUContext &ctx, int idx) { return ctx.inArg<T>(idx); }
-};
-
-struct tracked_cv_umat{
- //TODO Think if T - API could reallocate UMat to a proper size - how do we handle this ?
- //tracked_cv_umat(cv::UMat& m) : r{(m)}, original_data{m.getMat(ACCESS_RW).data} {}
- tracked_cv_umat(cv::UMat& m) : r{ (m) }, original_data{ nullptr } {}
- cv::UMat r;
- uchar* original_data;
-
- operator cv::UMat& (){ return r;}
- void validate() const{
- //if (r.getMat(ACCESS_RW).data != original_data)
- //{
- // util::throw_error
- // (std::logic_error
- // ("OpenCV kernel output parameter was reallocated. \n"
- // "Incorrect meta data was provided ?"));
- //}
-
- }
-};
-
-struct scalar_wrapper_gpu
-{
- //FIXME reuse CPU (OpenCV) plugin code
- scalar_wrapper_gpu(cv::gapi::own::Scalar& s) : m_s{cv::gapi::own::to_ocv(s)}, m_org_s(s) {};
- operator cv::Scalar& () { return m_s; }
- void writeBack() const { m_org_s = to_own(m_s); }
-
- cv::Scalar m_s;
- cv::gapi::own::Scalar& m_org_s;
-};
-
-template<typename... Outputs>
-void postprocess_gpu(Outputs&... outs)
-{
- struct
- {
- void operator()(tracked_cv_umat* bm) { bm->validate(); }
- void operator()(scalar_wrapper_gpu* sw) { sw->writeBack(); }
- void operator()(...) { }
-
- } validate;
- //dummy array to unfold parameter pack
- int dummy[] = { 0, (validate(&outs), 0)... };
- cv::util::suppress_unused_warning(dummy);
-}
-
-template<class T> struct gpu_get_out;
-template<> struct gpu_get_out<cv::GMat>
-{
- static tracked_cv_umat get(GGPUContext &ctx, int idx)
- {
- auto& r = ctx.outMatR(idx);
- return{ r };
- }
-};
-template<> struct gpu_get_out<cv::GScalar>
-{
- static scalar_wrapper_gpu get(GGPUContext &ctx, int idx)
- {
- auto& s = ctx.outValR(idx);
- return{ s };
- }
-};
-template<typename U> struct gpu_get_out<cv::GArray<U> >
-{
- static std::vector<U>& get(GGPUContext &ctx, int idx) { return ctx.outVecR<U>(idx); }
-};
-
-template<typename, typename, typename>
-struct GPUCallHelper;
-
-// FIXME: probably can be simplified with std::apply or analogue.
-template<typename Impl, typename... Ins, typename... Outs>
-struct GPUCallHelper<Impl, std::tuple<Ins...>, std::tuple<Outs...> >
-{
- template<typename... Inputs>
- struct call_and_postprocess
- {
- template<typename... Outputs>
- static void call(Inputs&&... ins, Outputs&&... outs)
- {
- //not using a std::forward on outs is deliberate in order to
- //cause compilation error, by tring to bind rvalue references to lvalue references
- Impl::run(std::forward<Inputs>(ins)..., outs...);
-
- postprocess_gpu(outs...);
- }
- };
-
- template<int... IIs, int... OIs>
- static void call_impl(GGPUContext &ctx, detail::Seq<IIs...>, detail::Seq<OIs...>)
- {
- //TODO: Make sure that OpenCV kernels do not reallocate memory for output parameters
- //by comparing it's state (data ptr) before and after the call.
- //Convert own::Scalar to cv::Scalar before call kernel and run kernel
- //convert cv::Scalar to own::Scalar after call kernel and write back results
- call_and_postprocess<decltype(gpu_get_in<Ins>::get(ctx, IIs))...>::call(gpu_get_in<Ins>::get(ctx, IIs)..., gpu_get_out<Outs>::get(ctx, OIs)...);
- }
-
- static void call(GGPUContext &ctx)
- {
- call_impl(ctx,
- typename detail::MkSeq<sizeof...(Ins)>::type(),
- typename detail::MkSeq<sizeof...(Outs)>::type());
- }
-};
-
-} // namespace detail
-
-template<class Impl, class K>
-class GGPUKernelImpl: public detail::GPUCallHelper<Impl, typename K::InArgs, typename K::OutArgs>
-{
- using P = detail::GPUCallHelper<Impl, typename K::InArgs, typename K::OutArgs>;
-
-public:
- using API = K;
-
- static cv::gapi::GBackend backend() { return cv::gapi::gpu::backend(); }
- static cv::GGPUKernel kernel() { return GGPUKernel(&P::call); }
-};
-
-#define GAPI_GPU_KERNEL(Name, API) struct Name: public cv::GGPUKernelImpl<Name, API>
-
} // namespace cv
+
#endif // OPENCV_GAPI_GGPUKERNEL_HPP
#ifndef OPENCV_GAPI_GPU_IMGPROC_API_HPP
#define OPENCV_GAPI_GPU_IMGPROC_API_HPP
+/** @file
+* @deprecated Use "opencv2/gapi/ocl/imgproc.hpp" instead.
+*/
+
+#include "opencv2/gapi/ocl/imgproc.hpp"
-#include <opencv2/core/cvdef.h> // GAPI_EXPORTS
-#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
namespace cv {
namespace gapi {
namespace imgproc {
namespace gpu {
-
-GAPI_EXPORTS GKernelPackage kernels();
-
+ using namespace ocl;
} // namespace gpu
} // namespace imgproc
} // namespace gapi
--- /dev/null
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2018 Intel Corporation
+
+
+#ifndef OPENCV_GAPI_OCL_CORE_API_HPP
+#define OPENCV_GAPI_OCL_CORE_API_HPP
+
+#include <opencv2/core/cvdef.h> // GAPI_EXPORTS
+#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
+
+namespace cv {
+namespace gapi {
+namespace core {
+inline namespace ocl {
+
+ GAPI_EXPORTS GKernelPackage kernels();
+
+} // inline namespace ocl
+namespace gpu {
+ using namespace ocl;
+} // namespace gpu
+} // namespace core
+} // namespace gapi
+} // namespace cv
+
+
+#endif // OPENCV_GAPI_OCL_CORE_API_HPP
--- /dev/null
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2018 Intel Corporation
+
+
+#ifndef OPENCV_GAPI_GOCLKERNEL_HPP
+#define OPENCV_GAPI_GOCLKERNEL_HPP
+
+#include <vector>
+#include <functional>
+#include <map>
+#include <unordered_map>
+
+#include <opencv2/core/mat.hpp>
+#include <opencv2/gapi/gcommon.hpp>
+#include <opencv2/gapi/gkernel.hpp>
+#include <opencv2/gapi/garg.hpp>
+
+// FIXME: namespace scheme for backends?
+namespace cv {
+
+namespace gimpl
+{
+ // Forward-declare an internal class
+ class GOCLExecutable;
+} // namespace gimpl
+
+namespace gapi
+{
+namespace ocl
+{
+ /**
+ * \addtogroup gapi_std_backends G-API Standard backends
+ * @{
+ */
+ /**
+ * @brief Get a reference to OCL backend.
+ *
+ * At the moment, the OCL backend is built atop of OpenCV
+ * "Transparent API" (T-API), see cv::UMat for details.
+ *
+ * @sa gapi_std_backends
+ */
+ GAPI_EXPORTS cv::gapi::GBackend backend();
+ /** @} */
+} // namespace ocl
+} // namespace gapi
+
+
+// Represents arguments which are passed to a wrapped OCL function
+// FIXME: put into detail?
+class GAPI_EXPORTS GOCLContext
+{
+public:
+ // Generic accessor API
+ template<typename T>
+ const T& inArg(int input) { return m_args.at(input).get<T>(); }
+
+ // Syntax sugar
+ const cv::UMat& inMat(int input);
+ cv::UMat& outMatR(int output); // FIXME: Avoid cv::Mat m = ctx.outMatR()
+
+ const cv::gapi::own::Scalar& inVal(int input);
+ cv::gapi::own::Scalar& outValR(int output); // FIXME: Avoid cv::gapi::own::Scalar s = ctx.outValR()
+ template<typename T> std::vector<T>& outVecR(int output) // FIXME: the same issue
+ {
+ return outVecRef(output).wref<T>();
+ }
+
+protected:
+ detail::VectorRef& outVecRef(int output);
+
+ std::vector<GArg> m_args;
+ std::unordered_map<std::size_t, GRunArgP> m_results;
+
+
+ friend class gimpl::GOCLExecutable;
+};
+
+class GAPI_EXPORTS GOCLKernel
+{
+public:
+ // This function is kernel's execution entry point (does the processing work)
+ using F = std::function<void(GOCLContext &)>;
+
+ GOCLKernel();
+ explicit GOCLKernel(const F& f);
+
+ void apply(GOCLContext &ctx);
+
+protected:
+ F m_f;
+};
+
+// FIXME: This is an ugly ad-hoc imlpementation. TODO: refactor
+
+namespace detail
+{
+template<class T> struct ocl_get_in;
+template<> struct ocl_get_in<cv::GMat>
+{
+ static cv::UMat get(GOCLContext &ctx, int idx) { return ctx.inMat(idx); }
+};
+template<> struct ocl_get_in<cv::GScalar>
+{
+ static cv::Scalar get(GOCLContext &ctx, int idx) { return to_ocv(ctx.inVal(idx)); }
+};
+template<typename U> struct ocl_get_in<cv::GArray<U> >
+{
+ static const std::vector<U>& get(GOCLContext &ctx, int idx) { return ctx.inArg<VectorRef>(idx).rref<U>(); }
+};
+template<class T> struct ocl_get_in
+{
+ static T get(GOCLContext &ctx, int idx) { return ctx.inArg<T>(idx); }
+};
+
+struct tracked_cv_umat{
+ //TODO Think if T - API could reallocate UMat to a proper size - how do we handle this ?
+ //tracked_cv_umat(cv::UMat& m) : r{(m)}, original_data{m.getMat(ACCESS_RW).data} {}
+ tracked_cv_umat(cv::UMat& m) : r{ (m) }, original_data{ nullptr } {}
+ cv::UMat r;
+ uchar* original_data;
+
+ operator cv::UMat& (){ return r;}
+ void validate() const{
+ //if (r.getMat(ACCESS_RW).data != original_data)
+ //{
+ // util::throw_error
+ // (std::logic_error
+ // ("OpenCV kernel output parameter was reallocated. \n"
+ // "Incorrect meta data was provided ?"));
+ //}
+
+ }
+};
+
+struct scalar_wrapper_ocl
+{
+ //FIXME reuse CPU (OpenCV) plugin code
+ scalar_wrapper_ocl(cv::gapi::own::Scalar& s) : m_s{cv::gapi::own::to_ocv(s)}, m_org_s(s) {};
+ operator cv::Scalar& () { return m_s; }
+ void writeBack() const { m_org_s = to_own(m_s); }
+
+ cv::Scalar m_s;
+ cv::gapi::own::Scalar& m_org_s;
+};
+
+template<typename... Outputs>
+void postprocess_ocl(Outputs&... outs)
+{
+ struct
+ {
+ void operator()(tracked_cv_umat* bm) { bm->validate(); }
+ void operator()(scalar_wrapper_ocl* sw) { sw->writeBack(); }
+ void operator()(...) { }
+
+ } validate;
+ //dummy array to unfold parameter pack
+ int dummy[] = { 0, (validate(&outs), 0)... };
+ cv::util::suppress_unused_warning(dummy);
+}
+
+template<class T> struct ocl_get_out;
+template<> struct ocl_get_out<cv::GMat>
+{
+ static tracked_cv_umat get(GOCLContext &ctx, int idx)
+ {
+ auto& r = ctx.outMatR(idx);
+ return{ r };
+ }
+};
+template<> struct ocl_get_out<cv::GScalar>
+{
+ static scalar_wrapper_ocl get(GOCLContext &ctx, int idx)
+ {
+ auto& s = ctx.outValR(idx);
+ return{ s };
+ }
+};
+template<typename U> struct ocl_get_out<cv::GArray<U> >
+{
+ static std::vector<U>& get(GOCLContext &ctx, int idx) { return ctx.outVecR<U>(idx); }
+};
+
+template<typename, typename, typename>
+struct OCLCallHelper;
+
+// FIXME: probably can be simplified with std::apply or analogue.
+template<typename Impl, typename... Ins, typename... Outs>
+struct OCLCallHelper<Impl, std::tuple<Ins...>, std::tuple<Outs...> >
+{
+ template<typename... Inputs>
+ struct call_and_postprocess
+ {
+ template<typename... Outputs>
+ static void call(Inputs&&... ins, Outputs&&... outs)
+ {
+ //not using a std::forward on outs is deliberate in order to
+ //cause compilation error, by tring to bind rvalue references to lvalue references
+ Impl::run(std::forward<Inputs>(ins)..., outs...);
+
+ postprocess_ocl(outs...);
+ }
+ };
+
+ template<int... IIs, int... OIs>
+ static void call_impl(GOCLContext &ctx, detail::Seq<IIs...>, detail::Seq<OIs...>)
+ {
+ //TODO: Make sure that OpenCV kernels do not reallocate memory for output parameters
+ //by comparing it's state (data ptr) before and after the call.
+ //Convert own::Scalar to cv::Scalar before call kernel and run kernel
+ //convert cv::Scalar to own::Scalar after call kernel and write back results
+ call_and_postprocess<decltype(ocl_get_in<Ins>::get(ctx, IIs))...>::call(ocl_get_in<Ins>::get(ctx, IIs)..., ocl_get_out<Outs>::get(ctx, OIs)...);
+ }
+
+ static void call(GOCLContext &ctx)
+ {
+ call_impl(ctx,
+ typename detail::MkSeq<sizeof...(Ins)>::type(),
+ typename detail::MkSeq<sizeof...(Outs)>::type());
+ }
+};
+
+} // namespace detail
+
+template<class Impl, class K>
+class GOCLKernelImpl: public detail::OCLCallHelper<Impl, typename K::InArgs, typename K::OutArgs>
+{
+ using P = detail::OCLCallHelper<Impl, typename K::InArgs, typename K::OutArgs>;
+
+public:
+ using API = K;
+
+ static cv::gapi::GBackend backend() { return cv::gapi::ocl::backend(); }
+ static cv::GOCLKernel kernel() { return GOCLKernel(&P::call); }
+};
+
+#define GAPI_OCL_KERNEL(Name, API) struct Name: public cv::GOCLKernelImpl<Name, API>
+
+} // namespace cv
+
+#endif // OPENCV_GAPI_GOCLKERNEL_HPP
--- /dev/null
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+//
+// Copyright (C) 2018 Intel Corporation
+
+
+#ifndef OPENCV_GAPI_OCL_IMGPROC_API_HPP
+#define OPENCV_GAPI_OCL_IMGPROC_API_HPP
+
+#include <opencv2/core/cvdef.h> // GAPI_EXPORTS
+#include <opencv2/gapi/gkernel.hpp> // GKernelPackage
+
+namespace cv {
+namespace gapi {
+namespace imgproc {
+inline namespace ocl {
+
+ GAPI_EXPORTS GKernelPackage kernels();
+
+} // inline namespace ocl
+namespace gpu {
+ using namespace ocl;
+} // namespace gpu
+} // namespace imgproc
+} // namespace gapi
+} // namespace cv
+
+
+#endif // OPENCV_GAPI_OCL_IMGPROC_API_HPP
#include "../perf_precomp.hpp"
#include "../common/gapi_core_perf_tests.hpp"
-#include "opencv2/gapi/gpu/core.hpp"
#define CORE_GPU cv::gapi::core::gpu::kernels()
#include "../perf_precomp.hpp"
#include "../common/gapi_imgproc_perf_tests.hpp"
-#include "opencv2/gapi/gpu/imgproc.hpp"
#define IMGPROC_GPU cv::gapi::imgproc::gpu::kernels()
#include "opencv2/gapi/core.hpp"
#include "opencv2/gapi/cpu/gcpukernel.hpp"
#include "opencv2/gapi/gpu/ggpukernel.hpp"
+#include "opencv2/gapi/gpu/imgproc.hpp"
+#include "opencv2/gapi/gpu/core.hpp"
#include "opencv2/gapi/operators.hpp"
#include "opencv2/gapi/fluid/core.hpp"
#include "compiler/gobjref.hpp"
#include "compiler/gmodel.hpp"
-#include "backends/gpu/ggpubackend.hpp"
-#include "backends/gpu/ggpuimgproc.hpp"
-#include "backends/gpu/ggpucore.hpp"
+#include "backends/ocl/goclbackend.hpp"
+#include "backends/ocl/goclimgproc.hpp"
+#include "backends/ocl/goclcore.hpp"
#include "api/gbackend_priv.hpp" // FIXME: Make it part of Backend SDK!
// Alternatively, is there a way to compose types graphs?
//
// If not, we need to introduce that!
-using GGPUModel = ade::TypedGraph
+using GOCLModel = ade::TypedGraph
< cv::gimpl::Unit
, cv::gimpl::Protocol
>;
// FIXME: Same issue with Typed and ConstTyped
-using GConstGGPUModel = ade::ConstTypedGraph
+using GConstGOCLModel = ade::ConstTypedGraph
< cv::gimpl::Unit
, cv::gimpl::Protocol
>;
namespace
{
- class GGPUBackendImpl final: public cv::gapi::GBackend::Priv
+ class GOCLBackendImpl final: public cv::gapi::GBackend::Priv
{
virtual void unpackKernel(ade::Graph &graph,
const ade::NodeHandle &op_node,
const cv::GKernelImpl &impl) override
{
- GGPUModel gm(graph);
- auto gpu_impl = cv::util::any_cast<cv::GGPUKernel>(impl.opaque);
- gm.metadata(op_node).set(cv::gimpl::Unit{gpu_impl});
+ GOCLModel gm(graph);
+ auto ocl_impl = cv::util::any_cast<cv::GOCLKernel>(impl.opaque);
+ gm.metadata(op_node).set(cv::gimpl::Unit{ocl_impl});
}
virtual EPtr compile(const ade::Graph &graph,
const cv::GCompileArgs &,
const std::vector<ade::NodeHandle> &nodes) const override
{
- return EPtr{new cv::gimpl::GGPUExecutable(graph, nodes)};
+ return EPtr{new cv::gimpl::GOCLExecutable(graph, nodes)};
}
};
}
-cv::gapi::GBackend cv::gapi::gpu::backend()
+cv::gapi::GBackend cv::gapi::ocl::backend()
{
- static cv::gapi::GBackend this_backend(std::make_shared<GGPUBackendImpl>());
+ static cv::gapi::GBackend this_backend(std::make_shared<GOCLBackendImpl>());
return this_backend;
}
-// GGPUExcecutable implementation //////////////////////////////////////////////
-cv::gimpl::GGPUExecutable::GGPUExecutable(const ade::Graph &g,
+// GOCLExcecutable implementation //////////////////////////////////////////////
+cv::gimpl::GOCLExecutable::GOCLExecutable(const ade::Graph &g,
const std::vector<ade::NodeHandle> &nodes)
: m_g(g), m_gm(m_g)
{
}
// FIXME: Document what it does
-cv::GArg cv::gimpl::GGPUExecutable::packArg(const GArg &arg)
+cv::GArg cv::gimpl::GOCLExecutable::packArg(const GArg &arg)
{
// No API placeholders allowed at this point
// FIXME: this check has to be done somewhere in compilation stage.
}
}
-void cv::gimpl::GGPUExecutable::run(std::vector<InObj> &&input_objs,
+void cv::gimpl::GOCLExecutable::run(std::vector<InObj> &&input_objs,
std::vector<OutObj> &&output_objs)
{
// Update resources with run-time information - what this Island
// OpenCV backend execution is not a rocket science at all.
// Simply invoke our kernels in the proper order.
- GConstGGPUModel gcm(m_g);
+ GConstGOCLModel gcm(m_g);
for (auto &op_info : m_script)
{
const auto &op = m_gm.metadata(op_info.nh).get<Op>();
// Obtain our real execution unit
// TODO: Should kernels be copyable?
- GGPUKernel k = gcm.metadata(op_info.nh).get<Unit>().k;
+ GOCLKernel k = gcm.metadata(op_info.nh).get<Unit>().k;
// Initialize kernel's execution context:
// - Input parameters
- GGPUContext context;
+ GOCLContext context;
context.m_args.reserve(op.args.size());
using namespace std::placeholders;
ade::util::transform(op.args,
std::back_inserter(context.m_args),
- std::bind(&GGPUExecutable::packArg, this, _1));
+ std::bind(&GOCLExecutable::packArg, this, _1));
// - Output parameters.
// FIXME: pre-allocate internal Mats, etc, according to the known meta
// Copyright (C) 2018 Intel Corporation
-#ifndef OPENCV_GAPI_GGPUBACKEND_HPP
-#define OPENCV_GAPI_GGPUBACKEND_HPP
+#ifndef OPENCV_GAPI_GOCLBACKEND_HPP
+#define OPENCV_GAPI_GOCLBACKEND_HPP
#include <map> // map
#include <unordered_map> // unordered_map
#include "opencv2/gapi/garg.hpp"
#include "opencv2/gapi/gproto.hpp"
-#include "opencv2/gapi/gpu/ggpukernel.hpp"
+#include "opencv2/gapi/ocl/goclkernel.hpp"
#include "api/gapi_priv.hpp"
struct Unit
{
- static const char *name() { return "GPUKernel"; }
- GGPUKernel k;
+ static const char *name() { return "OCLKernel"; }
+ GOCLKernel k;
};
-class GGPUExecutable final: public GIslandExecutable
+class GOCLExecutable final: public GIslandExecutable
{
const ade::Graph &m_g;
GModel::ConstGraph m_gm;
GArg packArg(const GArg &arg);
public:
- GGPUExecutable(const ade::Graph &graph,
+ GOCLExecutable(const ade::Graph &graph,
const std::vector<ade::NodeHandle> &nodes);
virtual inline bool canReshape() const override { return false; }
virtual inline void reshape(ade::Graph&, const GCompileArgs&) override
{
- // FIXME: GPU plugin is in fact reshapeable (as it was initially,
+ // FIXME: OCL plugin is in fact reshapeable (as it was initially,
// even before outMeta() has been introduced), so this limitation
// should be dropped.
- util::throw_error(std::logic_error("GGPUExecutable::reshape() should never be called"));
+ util::throw_error(std::logic_error("GOCLExecutable::reshape() should never be called"));
}
virtual void run(std::vector<InObj> &&input_objs,
}}
-#endif // OPENCV_GAPI_GGPUBACKEND_HPP
+#endif // OPENCV_GAPI_GOCLBACKEND_HPP
#include "precomp.hpp"
#include "opencv2/gapi/core.hpp"
-#include "opencv2/gapi/gpu/core.hpp"
-#include "backends/gpu/ggpucore.hpp"
+#include "opencv2/gapi/ocl/core.hpp"
+#include "backends/ocl/goclcore.hpp"
-GAPI_GPU_KERNEL(GGPUAdd, cv::gapi::core::GAdd)
+GAPI_OCL_KERNEL(GOCLAdd, cv::gapi::core::GAdd)
{
static void run(const cv::UMat& a, const cv::UMat& b, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUAddC, cv::gapi::core::GAddC)
+GAPI_OCL_KERNEL(GOCLAddC, cv::gapi::core::GAddC)
{
static void run(const cv::UMat& a, const cv::Scalar& b, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUSub, cv::gapi::core::GSub)
+GAPI_OCL_KERNEL(GOCLSub, cv::gapi::core::GSub)
{
static void run(const cv::UMat& a, const cv::UMat& b, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUSubC, cv::gapi::core::GSubC)
+GAPI_OCL_KERNEL(GOCLSubC, cv::gapi::core::GSubC)
{
static void run(const cv::UMat& a, const cv::Scalar& b, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUSubRC, cv::gapi::core::GSubRC)
+GAPI_OCL_KERNEL(GOCLSubRC, cv::gapi::core::GSubRC)
{
static void run(const cv::Scalar& a, const cv::UMat& b, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUMul, cv::gapi::core::GMul)
+GAPI_OCL_KERNEL(GOCLMul, cv::gapi::core::GMul)
{
static void run(const cv::UMat& a, const cv::UMat& b, double scale, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUMulCOld, cv::gapi::core::GMulCOld)
+GAPI_OCL_KERNEL(GOCLMulCOld, cv::gapi::core::GMulCOld)
{
static void run(const cv::UMat& a, double b, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUMulC, cv::gapi::core::GMulC)
+GAPI_OCL_KERNEL(GOCLMulC, cv::gapi::core::GMulC)
{
static void run(const cv::UMat& a, const cv::Scalar& b, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUDiv, cv::gapi::core::GDiv)
+GAPI_OCL_KERNEL(GOCLDiv, cv::gapi::core::GDiv)
{
static void run(const cv::UMat& a, const cv::UMat& b, double scale, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUDivC, cv::gapi::core::GDivC)
+GAPI_OCL_KERNEL(GOCLDivC, cv::gapi::core::GDivC)
{
static void run(const cv::UMat& a, const cv::Scalar& b, double scale, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUDivRC, cv::gapi::core::GDivRC)
+GAPI_OCL_KERNEL(GOCLDivRC, cv::gapi::core::GDivRC)
{
static void run(const cv::Scalar& a, const cv::UMat& b, double scale, int dtype, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUMask, cv::gapi::core::GMask)
+GAPI_OCL_KERNEL(GOCLMask, cv::gapi::core::GMask)
{
static void run(const cv::UMat& in, const cv::UMat& mask, cv::UMat& out)
{
};
-GAPI_GPU_KERNEL(GGPUMean, cv::gapi::core::GMean)
+GAPI_OCL_KERNEL(GOCLMean, cv::gapi::core::GMean)
{
static void run(const cv::UMat& in, cv::Scalar& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUPolarToCart, cv::gapi::core::GPolarToCart)
+GAPI_OCL_KERNEL(GOCLPolarToCart, cv::gapi::core::GPolarToCart)
{
static void run(const cv::UMat& magn, const cv::UMat& angle, bool angleInDegrees, cv::UMat& outx, cv::UMat& outy)
{
}
};
-GAPI_GPU_KERNEL(GGPUCartToPolar, cv::gapi::core::GCartToPolar)
+GAPI_OCL_KERNEL(GOCLCartToPolar, cv::gapi::core::GCartToPolar)
{
static void run(const cv::UMat& x, const cv::UMat& y, bool angleInDegrees, cv::UMat& outmagn, cv::UMat& outangle)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpGT, cv::gapi::core::GCmpGT)
+GAPI_OCL_KERNEL(GOCLCmpGT, cv::gapi::core::GCmpGT)
{
static void run(const cv::UMat& a, const cv::UMat& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpGE, cv::gapi::core::GCmpGE)
+GAPI_OCL_KERNEL(GOCLCmpGE, cv::gapi::core::GCmpGE)
{
static void run(const cv::UMat& a, const cv::UMat& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpLE, cv::gapi::core::GCmpLE)
+GAPI_OCL_KERNEL(GOCLCmpLE, cv::gapi::core::GCmpLE)
{
static void run(const cv::UMat& a, const cv::UMat& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpLT, cv::gapi::core::GCmpLT)
+GAPI_OCL_KERNEL(GOCLCmpLT, cv::gapi::core::GCmpLT)
{
static void run(const cv::UMat& a, const cv::UMat& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpEQ, cv::gapi::core::GCmpEQ)
+GAPI_OCL_KERNEL(GOCLCmpEQ, cv::gapi::core::GCmpEQ)
{
static void run(const cv::UMat& a, const cv::UMat& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpNE, cv::gapi::core::GCmpNE)
+GAPI_OCL_KERNEL(GOCLCmpNE, cv::gapi::core::GCmpNE)
{
static void run(const cv::UMat& a, const cv::UMat& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpGTScalar, cv::gapi::core::GCmpGTScalar)
+GAPI_OCL_KERNEL(GOCLCmpGTScalar, cv::gapi::core::GCmpGTScalar)
{
static void run(const cv::UMat& a, const cv::Scalar& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpGEScalar, cv::gapi::core::GCmpGEScalar)
+GAPI_OCL_KERNEL(GOCLCmpGEScalar, cv::gapi::core::GCmpGEScalar)
{
static void run(const cv::UMat& a, const cv::Scalar& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpLEScalar, cv::gapi::core::GCmpLEScalar)
+GAPI_OCL_KERNEL(GOCLCmpLEScalar, cv::gapi::core::GCmpLEScalar)
{
static void run(const cv::UMat& a, const cv::Scalar& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpLTScalar, cv::gapi::core::GCmpLTScalar)
+GAPI_OCL_KERNEL(GOCLCmpLTScalar, cv::gapi::core::GCmpLTScalar)
{
static void run(const cv::UMat& a, const cv::Scalar& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpEQScalar, cv::gapi::core::GCmpEQScalar)
+GAPI_OCL_KERNEL(GOCLCmpEQScalar, cv::gapi::core::GCmpEQScalar)
{
static void run(const cv::UMat& a, const cv::Scalar& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCmpNEScalar, cv::gapi::core::GCmpNEScalar)
+GAPI_OCL_KERNEL(GOCLCmpNEScalar, cv::gapi::core::GCmpNEScalar)
{
static void run(const cv::UMat& a, const cv::Scalar& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUAnd, cv::gapi::core::GAnd)
+GAPI_OCL_KERNEL(GOCLAnd, cv::gapi::core::GAnd)
{
static void run(const cv::UMat& a, const cv::UMat& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUAndS, cv::gapi::core::GAndS)
+GAPI_OCL_KERNEL(GOCLAndS, cv::gapi::core::GAndS)
{
static void run(const cv::UMat& a, const cv::Scalar& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUOr, cv::gapi::core::GOr)
+GAPI_OCL_KERNEL(GOCLOr, cv::gapi::core::GOr)
{
static void run(const cv::UMat& a, const cv::UMat& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUOrS, cv::gapi::core::GOrS)
+GAPI_OCL_KERNEL(GOCLOrS, cv::gapi::core::GOrS)
{
static void run(const cv::UMat& a, const cv::Scalar& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUXor, cv::gapi::core::GXor)
+GAPI_OCL_KERNEL(GOCLXor, cv::gapi::core::GXor)
{
static void run(const cv::UMat& a, const cv::UMat& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUXorS, cv::gapi::core::GXorS)
+GAPI_OCL_KERNEL(GOCLXorS, cv::gapi::core::GXorS)
{
static void run(const cv::UMat& a, const cv::Scalar& b, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUNot, cv::gapi::core::GNot)
+GAPI_OCL_KERNEL(GOCLNot, cv::gapi::core::GNot)
{
static void run(const cv::UMat& a, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUSelect, cv::gapi::core::GSelect)
+GAPI_OCL_KERNEL(GOCLSelect, cv::gapi::core::GSelect)
{
static void run(const cv::UMat& src1, const cv::UMat& src2, const cv::UMat& mask, cv::UMat& out)
{
};
////TODO: doesn't compiled with UMat
-//GAPI_GPU_KERNEL(GGPUMin, cv::gapi::core::GMin)
+//GAPI_OCL_KERNEL(GOCLMin, cv::gapi::core::GMin)
//{
// static void run(const cv::UMat& in1, const cv::UMat& in2, cv::UMat& out)
// {
//};
//
////TODO: doesn't compiled with UMat
-//GAPI_GPU_KERNEL(GGPUMax, cv::gapi::core::GMax)
+//GAPI_OCL_KERNEL(GOCLMax, cv::gapi::core::GMax)
//{
// static void run(const cv::UMat& in1, const cv::UMat& in2, cv::UMat& out)
// {
//};
-GAPI_GPU_KERNEL(GGPUAbsDiff, cv::gapi::core::GAbsDiff)
+GAPI_OCL_KERNEL(GOCLAbsDiff, cv::gapi::core::GAbsDiff)
{
static void run(const cv::UMat& in1, const cv::UMat& in2, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUAbsDiffC, cv::gapi::core::GAbsDiffC)
+GAPI_OCL_KERNEL(GOCLAbsDiffC, cv::gapi::core::GAbsDiffC)
{
static void run(const cv::UMat& in1, const cv::Scalar& in2, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUSum, cv::gapi::core::GSum)
+GAPI_OCL_KERNEL(GOCLSum, cv::gapi::core::GSum)
{
static void run(const cv::UMat& in, cv::Scalar& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUAddW, cv::gapi::core::GAddW)
+GAPI_OCL_KERNEL(GOCLAddW, cv::gapi::core::GAddW)
{
static void run(const cv::UMat& in1, double alpha, const cv::UMat& in2, double beta, double gamma, int dtype, cv::UMat& out)
{
};
-GAPI_GPU_KERNEL(GGPUNormL1, cv::gapi::core::GNormL1)
+GAPI_OCL_KERNEL(GOCLNormL1, cv::gapi::core::GNormL1)
{
static void run(const cv::UMat& in, cv::Scalar& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUNormL2, cv::gapi::core::GNormL2)
+GAPI_OCL_KERNEL(GOCLNormL2, cv::gapi::core::GNormL2)
{
static void run(const cv::UMat& in, cv::Scalar& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUNormInf, cv::gapi::core::GNormInf)
+GAPI_OCL_KERNEL(GOCLNormInf, cv::gapi::core::GNormInf)
{
static void run(const cv::UMat& in, cv::Scalar& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUIntegral, cv::gapi::core::GIntegral)
+GAPI_OCL_KERNEL(GOCLIntegral, cv::gapi::core::GIntegral)
{
static void run(const cv::UMat& in, int sdepth, int sqdepth, cv::UMat& out, cv::UMat& outSq)
{
}
};
-GAPI_GPU_KERNEL(GGPUThreshold, cv::gapi::core::GThreshold)
+GAPI_OCL_KERNEL(GOCLThreshold, cv::gapi::core::GThreshold)
{
static void run(const cv::UMat& in, const cv::Scalar& a, const cv::Scalar& b, int type, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUThresholdOT, cv::gapi::core::GThresholdOT)
+GAPI_OCL_KERNEL(GOCLThresholdOT, cv::gapi::core::GThresholdOT)
{
static void run(const cv::UMat& in, const cv::Scalar& b, int type, cv::UMat& out, cv::Scalar& outScalar)
{
};
-GAPI_GPU_KERNEL(GGPUInRange, cv::gapi::core::GInRange)
+GAPI_OCL_KERNEL(GOCLInRange, cv::gapi::core::GInRange)
{
static void run(const cv::UMat& in, const cv::Scalar& low, const cv::Scalar& up, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUSplit3, cv::gapi::core::GSplit3)
+GAPI_OCL_KERNEL(GOCLSplit3, cv::gapi::core::GSplit3)
{
static void run(const cv::UMat& in, cv::UMat &m1, cv::UMat &m2, cv::UMat &m3)
{
}
};
-GAPI_GPU_KERNEL(GGPUSplit4, cv::gapi::core::GSplit4)
+GAPI_OCL_KERNEL(GOCLSplit4, cv::gapi::core::GSplit4)
{
static void run(const cv::UMat& in, cv::UMat &m1, cv::UMat &m2, cv::UMat &m3, cv::UMat &m4)
{
}
};
-GAPI_GPU_KERNEL(GGPUMerge3, cv::gapi::core::GMerge3)
+GAPI_OCL_KERNEL(GOCLMerge3, cv::gapi::core::GMerge3)
{
static void run(const cv::UMat& in1, const cv::UMat& in2, const cv::UMat& in3, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUMerge4, cv::gapi::core::GMerge4)
+GAPI_OCL_KERNEL(GOCLMerge4, cv::gapi::core::GMerge4)
{
static void run(const cv::UMat& in1, const cv::UMat& in2, const cv::UMat& in3, const cv::UMat& in4, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUResize, cv::gapi::core::GResize)
+GAPI_OCL_KERNEL(GOCLResize, cv::gapi::core::GResize)
{
static void run(const cv::UMat& in, cv::Size sz, double fx, double fy, int interp, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPURemap, cv::gapi::core::GRemap)
+GAPI_OCL_KERNEL(GOCLRemap, cv::gapi::core::GRemap)
{
static void run(const cv::UMat& in, const cv::Mat& x, const cv::Mat& y, int a, int b, cv::Scalar s, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUFlip, cv::gapi::core::GFlip)
+GAPI_OCL_KERNEL(GOCLFlip, cv::gapi::core::GFlip)
{
static void run(const cv::UMat& in, int code, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCrop, cv::gapi::core::GCrop)
+GAPI_OCL_KERNEL(GOCLCrop, cv::gapi::core::GCrop)
{
static void run(const cv::UMat& in, cv::Rect rect, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUConcatHor, cv::gapi::core::GConcatHor)
+GAPI_OCL_KERNEL(GOCLConcatHor, cv::gapi::core::GConcatHor)
{
static void run(const cv::UMat& in1, const cv::UMat& in2, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUConcatVert, cv::gapi::core::GConcatVert)
+GAPI_OCL_KERNEL(GOCLConcatVert, cv::gapi::core::GConcatVert)
{
static void run(const cv::UMat& in1, const cv::UMat& in2, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPULUT, cv::gapi::core::GLUT)
+GAPI_OCL_KERNEL(GOCLLUT, cv::gapi::core::GLUT)
{
static void run(const cv::UMat& in, const cv::Mat& lut, cv::UMat& out)
{
}
};
-GAPI_GPU_KERNEL(GGPUConvertTo, cv::gapi::core::GConvertTo)
+GAPI_OCL_KERNEL(GOCLConvertTo, cv::gapi::core::GConvertTo)
{
static void run(const cv::UMat& in, int rtype, double alpha, double beta, cv::UMat& out)
{
}
};
-cv::gapi::GKernelPackage cv::gapi::core::gpu::kernels()
+cv::gapi::GKernelPackage cv::gapi::core::ocl::kernels()
{
static auto pkg = cv::gapi::kernels
- < GGPUAdd
- , GGPUAddC
- , GGPUSub
- , GGPUSubC
- , GGPUSubRC
- , GGPUMul
- , GGPUMulC
- , GGPUMulCOld
- , GGPUDiv
- , GGPUDivC
- , GGPUDivRC
- , GGPUMean
- , GGPUMask
- , GGPUPolarToCart
- , GGPUCartToPolar
- , GGPUCmpGT
- , GGPUCmpGE
- , GGPUCmpLE
- , GGPUCmpLT
- , GGPUCmpEQ
- , GGPUCmpNE
- , GGPUCmpGTScalar
- , GGPUCmpGEScalar
- , GGPUCmpLEScalar
- , GGPUCmpLTScalar
- , GGPUCmpEQScalar
- , GGPUCmpNEScalar
- , GGPUAnd
- , GGPUAndS
- , GGPUOr
- , GGPUOrS
- , GGPUXor
- , GGPUXorS
- , GGPUNot
- , GGPUSelect
- //, GGPUMin
- //, GGPUMax
- , GGPUAbsDiff
- , GGPUAbsDiffC
- , GGPUSum
- , GGPUAddW
- , GGPUNormL1
- , GGPUNormL2
- , GGPUNormInf
- , GGPUIntegral
- , GGPUThreshold
- , GGPUThresholdOT
- , GGPUInRange
- , GGPUSplit3
- , GGPUSplit4
- , GGPUResize
- , GGPUMerge3
- , GGPUMerge4
- , GGPURemap
- , GGPUFlip
- , GGPUCrop
- , GGPUConcatHor
- , GGPUConcatVert
- , GGPULUT
- , GGPUConvertTo
+ < GOCLAdd
+ , GOCLAddC
+ , GOCLSub
+ , GOCLSubC
+ , GOCLSubRC
+ , GOCLMul
+ , GOCLMulC
+ , GOCLMulCOld
+ , GOCLDiv
+ , GOCLDivC
+ , GOCLDivRC
+ , GOCLMean
+ , GOCLMask
+ , GOCLPolarToCart
+ , GOCLCartToPolar
+ , GOCLCmpGT
+ , GOCLCmpGE
+ , GOCLCmpLE
+ , GOCLCmpLT
+ , GOCLCmpEQ
+ , GOCLCmpNE
+ , GOCLCmpGTScalar
+ , GOCLCmpGEScalar
+ , GOCLCmpLEScalar
+ , GOCLCmpLTScalar
+ , GOCLCmpEQScalar
+ , GOCLCmpNEScalar
+ , GOCLAnd
+ , GOCLAndS
+ , GOCLOr
+ , GOCLOrS
+ , GOCLXor
+ , GOCLXorS
+ , GOCLNot
+ , GOCLSelect
+ //, GOCLMin
+ //, GOCLMax
+ , GOCLAbsDiff
+ , GOCLAbsDiffC
+ , GOCLSum
+ , GOCLAddW
+ , GOCLNormL1
+ , GOCLNormL2
+ , GOCLNormInf
+ , GOCLIntegral
+ , GOCLThreshold
+ , GOCLThresholdOT
+ , GOCLInRange
+ , GOCLSplit3
+ , GOCLSplit4
+ , GOCLResize
+ , GOCLMerge3
+ , GOCLMerge4
+ , GOCLRemap
+ , GOCLFlip
+ , GOCLCrop
+ , GOCLConcatHor
+ , GOCLConcatVert
+ , GOCLLUT
+ , GOCLConvertTo
>();
return pkg;
}
// Copyright (C) 2018 Intel Corporation
-#ifndef OPENCV_GAPI_GGPUCORE_HPP
-#define OPENCV_GAPI_GGPUCORE_HPP
+#ifndef OPENCV_GAPI_GOCLCORE_HPP
+#define OPENCV_GAPI_GOCLCORE_HPP
#include <map>
#include <string>
-#include "opencv2/gapi/gpu/ggpukernel.hpp"
+#include "opencv2/gapi/ocl/goclkernel.hpp"
namespace cv { namespace gimpl {
// NB: This is what a "Kernel Package" from the original Wiki doc should be.
-void loadGPUCore(std::map<std::string, cv::GGPUKernel> &kmap);
+void loadOCLCore(std::map<std::string, cv::GOCLKernel> &kmap);
}
}
-#endif // OPENCV_GAPI_GGPUCORE_HPP
+#endif // OPENCV_GAPI_GOCLCORE_HPP
#include "precomp.hpp"
#include "opencv2/gapi/imgproc.hpp"
-#include "opencv2/gapi/gpu/imgproc.hpp"
-#include "backends/gpu/ggpuimgproc.hpp"
+#include "opencv2/gapi/ocl/imgproc.hpp"
+#include "backends/ocl/goclimgproc.hpp"
-GAPI_GPU_KERNEL(GGPUSepFilter, cv::gapi::imgproc::GSepFilter)
+GAPI_OCL_KERNEL(GOCLSepFilter, cv::gapi::imgproc::GSepFilter)
{
static void run(const cv::UMat& in, int ddepth, const cv::Mat& kernX, const cv::Mat& kernY, const cv::Point& anchor, const cv::Scalar& delta,
int border, const cv::Scalar& bordVal, cv::UMat &out)
}
};
-GAPI_GPU_KERNEL(GGPUBoxFilter, cv::gapi::imgproc::GBoxFilter)
+GAPI_OCL_KERNEL(GOCLBoxFilter, cv::gapi::imgproc::GBoxFilter)
{
static void run(const cv::UMat& in, int ddepth, const cv::Size& ksize, const cv::Point& anchor, bool normalize, int borderType, const cv::Scalar& bordVal, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUBlur, cv::gapi::imgproc::GBlur)
+GAPI_OCL_KERNEL(GOCLBlur, cv::gapi::imgproc::GBlur)
{
static void run(const cv::UMat& in, const cv::Size& ksize, const cv::Point& anchor, int borderType, const cv::Scalar& bordVal, cv::UMat &out)
{
};
-GAPI_GPU_KERNEL(GGPUFilter2D, cv::gapi::imgproc::GFilter2D)
+GAPI_OCL_KERNEL(GOCLFilter2D, cv::gapi::imgproc::GFilter2D)
{
static void run(const cv::UMat& in, int ddepth, const cv::Mat& k, const cv::Point& anchor, const cv::Scalar& delta, int border,
const cv::Scalar& bordVal, cv::UMat &out)
}
};
-GAPI_GPU_KERNEL(GGPUGaussBlur, cv::gapi::imgproc::GGaussBlur)
+GAPI_OCL_KERNEL(GOCLGaussBlur, cv::gapi::imgproc::GGaussBlur)
{
static void run(const cv::UMat& in, const cv::Size& ksize, double sigmaX, double sigmaY, int borderType, const cv::Scalar& bordVal, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUMedianBlur, cv::gapi::imgproc::GMedianBlur)
+GAPI_OCL_KERNEL(GOCLMedianBlur, cv::gapi::imgproc::GMedianBlur)
{
static void run(const cv::UMat& in, int ksize, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUErode, cv::gapi::imgproc::GErode)
+GAPI_OCL_KERNEL(GOCLErode, cv::gapi::imgproc::GErode)
{
static void run(const cv::UMat& in, const cv::Mat& kernel, const cv::Point& anchor, int iterations, int borderType, const cv::Scalar& borderValue, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUDilate, cv::gapi::imgproc::GDilate)
+GAPI_OCL_KERNEL(GOCLDilate, cv::gapi::imgproc::GDilate)
{
static void run(const cv::UMat& in, const cv::Mat& kernel, const cv::Point& anchor, int iterations, int borderType, const cv::Scalar& borderValue, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUSobel, cv::gapi::imgproc::GSobel)
+GAPI_OCL_KERNEL(GOCLSobel, cv::gapi::imgproc::GSobel)
{
static void run(const cv::UMat& in, int ddepth, int dx, int dy, int ksize, double scale, double delta, int borderType,
const cv::Scalar& bordVal, cv::UMat &out)
}
};
-GAPI_GPU_KERNEL(GGPUEqualizeHist, cv::gapi::imgproc::GEqHist)
+GAPI_OCL_KERNEL(GOCLEqualizeHist, cv::gapi::imgproc::GEqHist)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUCanny, cv::gapi::imgproc::GCanny)
+GAPI_OCL_KERNEL(GOCLCanny, cv::gapi::imgproc::GCanny)
{
static void run(const cv::UMat& in, double thr1, double thr2, int apSize, bool l2gradient, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPURGB2YUV, cv::gapi::imgproc::GRGB2YUV)
+GAPI_OCL_KERNEL(GOCLRGB2YUV, cv::gapi::imgproc::GRGB2YUV)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUYUV2RGB, cv::gapi::imgproc::GYUV2RGB)
+GAPI_OCL_KERNEL(GOCLYUV2RGB, cv::gapi::imgproc::GYUV2RGB)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPURGB2Lab, cv::gapi::imgproc::GRGB2Lab)
+GAPI_OCL_KERNEL(GOCLRGB2Lab, cv::gapi::imgproc::GRGB2Lab)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUBGR2LUV, cv::gapi::imgproc::GBGR2LUV)
+GAPI_OCL_KERNEL(GOCLBGR2LUV, cv::gapi::imgproc::GBGR2LUV)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUBGR2YUV, cv::gapi::imgproc::GBGR2YUV)
+GAPI_OCL_KERNEL(GOCLBGR2YUV, cv::gapi::imgproc::GBGR2YUV)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPULUV2BGR, cv::gapi::imgproc::GLUV2BGR)
+GAPI_OCL_KERNEL(GOCLLUV2BGR, cv::gapi::imgproc::GLUV2BGR)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUYUV2BGR, cv::gapi::imgproc::GYUV2BGR)
+GAPI_OCL_KERNEL(GOCLYUV2BGR, cv::gapi::imgproc::GYUV2BGR)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPURGB2Gray, cv::gapi::imgproc::GRGB2Gray)
+GAPI_OCL_KERNEL(GOCLRGB2Gray, cv::gapi::imgproc::GRGB2Gray)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPUBGR2Gray, cv::gapi::imgproc::GBGR2Gray)
+GAPI_OCL_KERNEL(GOCLBGR2Gray, cv::gapi::imgproc::GBGR2Gray)
{
static void run(const cv::UMat& in, cv::UMat &out)
{
}
};
-GAPI_GPU_KERNEL(GGPURGB2GrayCustom, cv::gapi::imgproc::GRGB2GrayCustom)
+GAPI_OCL_KERNEL(GOCLRGB2GrayCustom, cv::gapi::imgproc::GRGB2GrayCustom)
{
//TODO: avoid copy
static void run(const cv::UMat& in, float rY, float bY, float gY, cv::UMat &out)
};
-cv::gapi::GKernelPackage cv::gapi::imgproc::gpu::kernels()
+cv::gapi::GKernelPackage cv::gapi::imgproc::ocl::kernels()
{
static auto pkg = cv::gapi::kernels
- < GGPUFilter2D
- , GGPUSepFilter
- , GGPUBoxFilter
- , GGPUBlur
- , GGPUGaussBlur
- , GGPUMedianBlur
- , GGPUErode
- , GGPUDilate
- , GGPUSobel
- , GGPUCanny
- , GGPUEqualizeHist
- , GGPURGB2YUV
- , GGPUYUV2RGB
- , GGPURGB2Lab
- , GGPUBGR2LUV
- , GGPUBGR2YUV
- , GGPUYUV2BGR
- , GGPULUV2BGR
- , GGPUBGR2Gray
- , GGPURGB2Gray
- , GGPURGB2GrayCustom
+ < GOCLFilter2D
+ , GOCLSepFilter
+ , GOCLBoxFilter
+ , GOCLBlur
+ , GOCLGaussBlur
+ , GOCLMedianBlur
+ , GOCLErode
+ , GOCLDilate
+ , GOCLSobel
+ , GOCLCanny
+ , GOCLEqualizeHist
+ , GOCLRGB2YUV
+ , GOCLYUV2RGB
+ , GOCLRGB2Lab
+ , GOCLBGR2LUV
+ , GOCLBGR2YUV
+ , GOCLYUV2BGR
+ , GOCLLUV2BGR
+ , GOCLBGR2Gray
+ , GOCLRGB2Gray
+ , GOCLRGB2GrayCustom
>();
return pkg;
}
// Copyright (C) 2018 Intel Corporation
-#ifndef OPENCV_GAPI_GGPUIMGPROC_HPP
-#define OPENCV_GAPI_GGPUIMGPROC_HPP
+#ifndef OPENCV_GAPI_GOCLIMGPROC_HPP
+#define OPENCV_GAPI_GOCLIMGPROC_HPP
#include <map>
#include <string>
-#include "opencv2/gapi/gpu/ggpukernel.hpp"
+#include "opencv2/gapi/ocl/goclkernel.hpp"
namespace cv { namespace gimpl {
// NB: This is what a "Kernel Package" from the origianl Wiki doc should be.
-void loadGPUImgProc(std::map<std::string, cv::GGPUKernel> &kmap);
+void loadOCLImgProc(std::map<std::string, cv::GOCLKernel> &kmap);
}}
-#endif // OPENCV_GAPI_GGPUIMGPROC_HPP
+#endif // OPENCV_GAPI_GOCLIMGPROC_HPP
#include <cassert>
-#include "opencv2/gapi/gpu/ggpukernel.hpp"
+#include "opencv2/gapi/ocl/goclkernel.hpp"
-const cv::UMat& cv::GGPUContext::inMat(int input)
+const cv::UMat& cv::GOCLContext::inMat(int input)
{
return (inArg<cv::UMat>(input));
}
-cv::UMat& cv::GGPUContext::outMatR(int output)
+cv::UMat& cv::GOCLContext::outMatR(int output)
{
return (*(util::get<cv::UMat*>(m_results.at(output))));
}
-const cv::gapi::own::Scalar& cv::GGPUContext::inVal(int input)
+const cv::gapi::own::Scalar& cv::GOCLContext::inVal(int input)
{
return inArg<cv::gapi::own::Scalar>(input);
}
-cv::gapi::own::Scalar& cv::GGPUContext::outValR(int output)
+cv::gapi::own::Scalar& cv::GOCLContext::outValR(int output)
{
return *util::get<cv::gapi::own::Scalar*>(m_results.at(output));
}
-cv::detail::VectorRef& cv::GGPUContext::outVecRef(int output)
+cv::detail::VectorRef& cv::GOCLContext::outVecRef(int output)
{
return util::get<cv::detail::VectorRef>(m_results.at(output));
}
-cv::GGPUKernel::GGPUKernel()
+cv::GOCLKernel::GOCLKernel()
{
}
-cv::GGPUKernel::GGPUKernel(const GGPUKernel::F &f)
+cv::GOCLKernel::GOCLKernel(const GOCLKernel::F &f)
: m_f(f)
{
}
-void cv::GGPUKernel::apply(GGPUContext &ctx)
+void cv::GOCLKernel::apply(GOCLContext &ctx)
{
CV_Assert(m_f);
m_f(ctx);
#include "../test_precomp.hpp"
#include "../common/gapi_core_tests.hpp"
-#include "opencv2/gapi/gpu/core.hpp"
#define CORE_GPU cv::gapi::core::gpu::kernels()
#include "../test_precomp.hpp"
#include "../common/gapi_imgproc_tests.hpp"
-#include "opencv2/gapi/gpu/imgproc.hpp"
#define IMGPROC_GPU cv::gapi::imgproc::gpu::kernels()
#include "../test_precomp.hpp"
#include "../common/gapi_operators_tests.hpp"
-#include "opencv2/gapi/gpu/core.hpp"
#define CORE_GPU cv::gapi::core::gpu::kernels()
#include "opencv2/gapi/core.hpp"
#include "opencv2/gapi/cpu/gcpukernel.hpp"
#include "opencv2/gapi/gpu/ggpukernel.hpp"
+#include "opencv2/gapi/gpu/imgproc.hpp"
+#include "opencv2/gapi/gpu/core.hpp"
#include "opencv2/gapi/gcompoundkernel.hpp"
#include "opencv2/gapi/operators.hpp"
#include "opencv2/gapi/fluid/imgproc.hpp"