Merge pull request #13240 from dbudniko:dbudniko/gapi_gpu_to_ocl_renaming

G-API rename GPU backend to OCL backend (#13240)

* renaming draft

* inline namespace instead non-safe define

* more back compatibility

* Updates after review from Dmitry
pull/13331/head
Dmitry Budnikov 6 years ago committed by Alexander Alekhin
parent 4fb9bce79f
commit 6374b99a1a
  1. 11
      modules/gapi/CMakeLists.txt
  2. 10
      modules/gapi/include/opencv2/gapi/gpu/core.hpp
  3. 238
      modules/gapi/include/opencv2/gapi/gpu/ggpukernel.hpp
  4. 11
      modules/gapi/include/opencv2/gapi/gpu/imgproc.hpp
  5. 30
      modules/gapi/include/opencv2/gapi/ocl/core.hpp
  6. 244
      modules/gapi/include/opencv2/gapi/ocl/goclkernel.hpp
  7. 30
      modules/gapi/include/opencv2/gapi/ocl/imgproc.hpp
  8. 1
      modules/gapi/perf/gpu/gapi_core_perf_tests_gpu.cpp
  9. 1
      modules/gapi/perf/gpu/gapi_imgproc_perf_tests_gpu.cpp
  10. 2
      modules/gapi/perf/perf_precomp.hpp
  11. 40
      modules/gapi/src/backends/ocl/goclbackend.cpp
  12. 20
      modules/gapi/src/backends/ocl/goclbackend.hpp
  13. 246
      modules/gapi/src/backends/ocl/goclcore.cpp
  14. 10
      modules/gapi/src/backends/ocl/goclcore.hpp
  15. 90
      modules/gapi/src/backends/ocl/goclimgproc.cpp
  16. 10
      modules/gapi/src/backends/ocl/goclimgproc.hpp
  17. 18
      modules/gapi/src/backends/ocl/goclkernel.cpp
  18. 1
      modules/gapi/test/gpu/gapi_core_tests_gpu.cpp
  19. 1
      modules/gapi/test/gpu/gapi_imgproc_tests_gpu.cpp
  20. 1
      modules/gapi/test/gpu/gapi_operators_tests_gpu.cpp
  21. 2
      modules/gapi/test/test_precomp.hpp

@ -23,6 +23,7 @@ file(GLOB gapi_ext_hdrs
"${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"
)
@ -72,11 +73,11 @@ set(gapi_srcs
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

@ -7,17 +7,17 @@
#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

@ -7,238 +7,22 @@
#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

@ -7,17 +7,18 @@
#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

@ -0,0 +1,30 @@
// 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

@ -0,0 +1,244 @@
// 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

@ -0,0 +1,30 @@
// 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

@ -7,7 +7,6 @@
#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()

@ -7,7 +7,6 @@
#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()

@ -17,6 +17,8 @@
#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"

@ -25,9 +25,9 @@
#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!
@ -37,47 +37,47 @@
// 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)
{
@ -112,7 +112,7 @@ cv::gimpl::GGPUExecutable::GGPUExecutable(const ade::Graph &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.
@ -143,7 +143,7 @@ cv::GArg cv::gimpl::GGPUExecutable::packArg(const GArg &arg)
}
}
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
@ -172,24 +172,24 @@ void cv::gimpl::GGPUExecutable::run(std::vector<InObj> &&input_objs,
// 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

@ -5,8 +5,8 @@
// 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
@ -15,7 +15,7 @@
#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"
@ -26,11 +26,11 @@ namespace cv { namespace gimpl {
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;
@ -51,16 +51,16 @@ class GGPUExecutable final: public GIslandExecutable
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,
@ -69,4 +69,4 @@ public:
}}
#endif // OPENCV_GAPI_GGPUBACKEND_HPP
#endif // OPENCV_GAPI_GOCLBACKEND_HPP

@ -8,10 +8,10 @@
#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)
{
@ -19,7 +19,7 @@ GAPI_GPU_KERNEL(GGPUAdd, cv::gapi::core::GAdd)
}
};
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)
{
@ -27,7 +27,7 @@ GAPI_GPU_KERNEL(GGPUAddC, cv::gapi::core::GAddC)
}
};
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)
{
@ -35,7 +35,7 @@ GAPI_GPU_KERNEL(GGPUSub, cv::gapi::core::GSub)
}
};
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)
{
@ -43,7 +43,7 @@ GAPI_GPU_KERNEL(GGPUSubC, cv::gapi::core::GSubC)
}
};
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)
{
@ -51,7 +51,7 @@ GAPI_GPU_KERNEL(GGPUSubRC, cv::gapi::core::GSubRC)
}
};
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)
{
@ -59,7 +59,7 @@ GAPI_GPU_KERNEL(GGPUMul, cv::gapi::core::GMul)
}
};
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)
{
@ -67,7 +67,7 @@ GAPI_GPU_KERNEL(GGPUMulCOld, cv::gapi::core::GMulCOld)
}
};
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)
{
@ -75,7 +75,7 @@ GAPI_GPU_KERNEL(GGPUMulC, cv::gapi::core::GMulC)
}
};
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)
{
@ -83,7 +83,7 @@ GAPI_GPU_KERNEL(GGPUDiv, cv::gapi::core::GDiv)
}
};
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)
{
@ -91,7 +91,7 @@ GAPI_GPU_KERNEL(GGPUDivC, cv::gapi::core::GDivC)
}
};
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)
{
@ -99,7 +99,7 @@ GAPI_GPU_KERNEL(GGPUDivRC, cv::gapi::core::GDivRC)
}
};
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)
{
@ -109,7 +109,7 @@ GAPI_GPU_KERNEL(GGPUMask, cv::gapi::core::GMask)
};
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)
{
@ -117,7 +117,7 @@ GAPI_GPU_KERNEL(GGPUMean, cv::gapi::core::GMean)
}
};
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)
{
@ -125,7 +125,7 @@ GAPI_GPU_KERNEL(GGPUPolarToCart, cv::gapi::core::GPolarToCart)
}
};
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)
{
@ -133,7 +133,7 @@ GAPI_GPU_KERNEL(GGPUCartToPolar, cv::gapi::core::GCartToPolar)
}
};
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)
{
@ -141,7 +141,7 @@ GAPI_GPU_KERNEL(GGPUCmpGT, cv::gapi::core::GCmpGT)
}
};
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)
{
@ -149,7 +149,7 @@ GAPI_GPU_KERNEL(GGPUCmpGE, cv::gapi::core::GCmpGE)
}
};
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)
{
@ -157,7 +157,7 @@ GAPI_GPU_KERNEL(GGPUCmpLE, cv::gapi::core::GCmpLE)
}
};
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)
{
@ -165,7 +165,7 @@ GAPI_GPU_KERNEL(GGPUCmpLT, cv::gapi::core::GCmpLT)
}
};
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)
{
@ -173,7 +173,7 @@ GAPI_GPU_KERNEL(GGPUCmpEQ, cv::gapi::core::GCmpEQ)
}
};
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)
{
@ -181,7 +181,7 @@ GAPI_GPU_KERNEL(GGPUCmpNE, cv::gapi::core::GCmpNE)
}
};
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)
{
@ -189,7 +189,7 @@ GAPI_GPU_KERNEL(GGPUCmpGTScalar, cv::gapi::core::GCmpGTScalar)
}
};
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)
{
@ -197,7 +197,7 @@ GAPI_GPU_KERNEL(GGPUCmpGEScalar, cv::gapi::core::GCmpGEScalar)
}
};
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)
{
@ -205,7 +205,7 @@ GAPI_GPU_KERNEL(GGPUCmpLEScalar, cv::gapi::core::GCmpLEScalar)
}
};
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)
{
@ -213,7 +213,7 @@ GAPI_GPU_KERNEL(GGPUCmpLTScalar, cv::gapi::core::GCmpLTScalar)
}
};
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)
{
@ -221,7 +221,7 @@ GAPI_GPU_KERNEL(GGPUCmpEQScalar, cv::gapi::core::GCmpEQScalar)
}
};
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)
{
@ -229,7 +229,7 @@ GAPI_GPU_KERNEL(GGPUCmpNEScalar, cv::gapi::core::GCmpNEScalar)
}
};
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)
{
@ -237,7 +237,7 @@ GAPI_GPU_KERNEL(GGPUAnd, cv::gapi::core::GAnd)
}
};
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)
{
@ -245,7 +245,7 @@ GAPI_GPU_KERNEL(GGPUAndS, cv::gapi::core::GAndS)
}
};
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)
{
@ -253,7 +253,7 @@ GAPI_GPU_KERNEL(GGPUOr, cv::gapi::core::GOr)
}
};
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)
{
@ -261,7 +261,7 @@ GAPI_GPU_KERNEL(GGPUOrS, cv::gapi::core::GOrS)
}
};
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)
{
@ -269,7 +269,7 @@ GAPI_GPU_KERNEL(GGPUXor, cv::gapi::core::GXor)
}
};
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)
{
@ -277,7 +277,7 @@ GAPI_GPU_KERNEL(GGPUXorS, cv::gapi::core::GXorS)
}
};
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)
{
@ -285,7 +285,7 @@ GAPI_GPU_KERNEL(GGPUNot, cv::gapi::core::GNot)
}
};
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)
{
@ -295,7 +295,7 @@ GAPI_GPU_KERNEL(GGPUSelect, cv::gapi::core::GSelect)
};
////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)
// {
@ -304,7 +304,7 @@ GAPI_GPU_KERNEL(GGPUSelect, cv::gapi::core::GSelect)
//};
//
////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)
// {
@ -313,7 +313,7 @@ GAPI_GPU_KERNEL(GGPUSelect, cv::gapi::core::GSelect)
//};
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)
{
@ -321,7 +321,7 @@ GAPI_GPU_KERNEL(GGPUAbsDiff, cv::gapi::core::GAbsDiff)
}
};
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)
{
@ -329,7 +329,7 @@ GAPI_GPU_KERNEL(GGPUAbsDiffC, cv::gapi::core::GAbsDiffC)
}
};
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)
{
@ -337,7 +337,7 @@ GAPI_GPU_KERNEL(GGPUSum, cv::gapi::core::GSum)
}
};
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)
{
@ -346,7 +346,7 @@ GAPI_GPU_KERNEL(GGPUAddW, cv::gapi::core::GAddW)
};
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)
{
@ -354,7 +354,7 @@ GAPI_GPU_KERNEL(GGPUNormL1, cv::gapi::core::GNormL1)
}
};
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)
{
@ -362,7 +362,7 @@ GAPI_GPU_KERNEL(GGPUNormL2, cv::gapi::core::GNormL2)
}
};
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)
{
@ -370,7 +370,7 @@ GAPI_GPU_KERNEL(GGPUNormInf, cv::gapi::core::GNormInf)
}
};
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)
{
@ -378,7 +378,7 @@ GAPI_GPU_KERNEL(GGPUIntegral, cv::gapi::core::GIntegral)
}
};
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)
{
@ -386,7 +386,7 @@ GAPI_GPU_KERNEL(GGPUThreshold, cv::gapi::core::GThreshold)
}
};
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)
{
@ -395,7 +395,7 @@ GAPI_GPU_KERNEL(GGPUThresholdOT, cv::gapi::core::GThresholdOT)
};
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)
{
@ -403,7 +403,7 @@ GAPI_GPU_KERNEL(GGPUInRange, cv::gapi::core::GInRange)
}
};
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)
{
@ -417,7 +417,7 @@ GAPI_GPU_KERNEL(GGPUSplit3, cv::gapi::core::GSplit3)
}
};
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)
{
@ -432,7 +432,7 @@ GAPI_GPU_KERNEL(GGPUSplit4, cv::gapi::core::GSplit4)
}
};
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)
{
@ -441,7 +441,7 @@ GAPI_GPU_KERNEL(GGPUMerge3, cv::gapi::core::GMerge3)
}
};
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)
{
@ -450,7 +450,7 @@ GAPI_GPU_KERNEL(GGPUMerge4, cv::gapi::core::GMerge4)
}
};
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)
{
@ -458,7 +458,7 @@ GAPI_GPU_KERNEL(GGPUResize, cv::gapi::core::GResize)
}
};
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)
{
@ -466,7 +466,7 @@ GAPI_GPU_KERNEL(GGPURemap, cv::gapi::core::GRemap)
}
};
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)
{
@ -474,7 +474,7 @@ GAPI_GPU_KERNEL(GGPUFlip, cv::gapi::core::GFlip)
}
};
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)
{
@ -482,7 +482,7 @@ GAPI_GPU_KERNEL(GGPUCrop, cv::gapi::core::GCrop)
}
};
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)
{
@ -490,7 +490,7 @@ GAPI_GPU_KERNEL(GGPUConcatHor, cv::gapi::core::GConcatHor)
}
};
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)
{
@ -498,7 +498,7 @@ GAPI_GPU_KERNEL(GGPUConcatVert, cv::gapi::core::GConcatVert)
}
};
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)
{
@ -506,7 +506,7 @@ GAPI_GPU_KERNEL(GGPULUT, cv::gapi::core::GLUT)
}
};
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)
{
@ -514,69 +514,69 @@ GAPI_GPU_KERNEL(GGPUConvertTo, cv::gapi::core::GConvertTo)
}
};
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;
}

@ -5,20 +5,20 @@
// 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

@ -8,11 +8,11 @@
#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)
@ -31,7 +31,7 @@ GAPI_GPU_KERNEL(GGPUSepFilter, cv::gapi::imgproc::GSepFilter)
}
};
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)
{
@ -49,7 +49,7 @@ GAPI_GPU_KERNEL(GGPUBoxFilter, cv::gapi::imgproc::GBoxFilter)
}
};
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)
{
@ -68,7 +68,7 @@ GAPI_GPU_KERNEL(GGPUBlur, cv::gapi::imgproc::GBlur)
};
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)
@ -87,7 +87,7 @@ GAPI_GPU_KERNEL(GGPUFilter2D, cv::gapi::imgproc::GFilter2D)
}
};
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)
{
@ -105,7 +105,7 @@ GAPI_GPU_KERNEL(GGPUGaussBlur, cv::gapi::imgproc::GGaussBlur)
}
};
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)
{
@ -113,7 +113,7 @@ GAPI_GPU_KERNEL(GGPUMedianBlur, cv::gapi::imgproc::GMedianBlur)
}
};
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)
{
@ -121,7 +121,7 @@ GAPI_GPU_KERNEL(GGPUErode, cv::gapi::imgproc::GErode)
}
};
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)
{
@ -129,7 +129,7 @@ GAPI_GPU_KERNEL(GGPUDilate, cv::gapi::imgproc::GDilate)
}
};
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)
@ -147,7 +147,7 @@ GAPI_GPU_KERNEL(GGPUSobel, cv::gapi::imgproc::GSobel)
}
};
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)
{
@ -155,7 +155,7 @@ GAPI_GPU_KERNEL(GGPUEqualizeHist, cv::gapi::imgproc::GEqHist)
}
};
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)
{
@ -163,7 +163,7 @@ GAPI_GPU_KERNEL(GGPUCanny, cv::gapi::imgproc::GCanny)
}
};
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)
{
@ -171,7 +171,7 @@ GAPI_GPU_KERNEL(GGPURGB2YUV, cv::gapi::imgproc::GRGB2YUV)
}
};
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)
{
@ -179,7 +179,7 @@ GAPI_GPU_KERNEL(GGPUYUV2RGB, cv::gapi::imgproc::GYUV2RGB)
}
};
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)
{
@ -187,7 +187,7 @@ GAPI_GPU_KERNEL(GGPURGB2Lab, cv::gapi::imgproc::GRGB2Lab)
}
};
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)
{
@ -195,7 +195,7 @@ GAPI_GPU_KERNEL(GGPUBGR2LUV, cv::gapi::imgproc::GBGR2LUV)
}
};
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)
{
@ -203,7 +203,7 @@ GAPI_GPU_KERNEL(GGPUBGR2YUV, cv::gapi::imgproc::GBGR2YUV)
}
};
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)
{
@ -211,7 +211,7 @@ GAPI_GPU_KERNEL(GGPULUV2BGR, cv::gapi::imgproc::GLUV2BGR)
}
};
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)
{
@ -219,7 +219,7 @@ GAPI_GPU_KERNEL(GGPUYUV2BGR, cv::gapi::imgproc::GYUV2BGR)
}
};
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)
{
@ -227,7 +227,7 @@ GAPI_GPU_KERNEL(GGPURGB2Gray, cv::gapi::imgproc::GRGB2Gray)
}
};
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)
{
@ -235,7 +235,7 @@ GAPI_GPU_KERNEL(GGPUBGR2Gray, cv::gapi::imgproc::GBGR2Gray)
}
};
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)
@ -248,30 +248,30 @@ GAPI_GPU_KERNEL(GGPURGB2GrayCustom, cv::gapi::imgproc::GRGB2GrayCustom)
};
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;
}

@ -5,19 +5,19 @@
// 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

@ -7,43 +7,43 @@
#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);

@ -7,7 +7,6 @@
#include "../test_precomp.hpp"
#include "../common/gapi_core_tests.hpp"
#include "opencv2/gapi/gpu/core.hpp"
#define CORE_GPU cv::gapi::core::gpu::kernels()

@ -8,7 +8,6 @@
#include "../test_precomp.hpp"
#include "../common/gapi_imgproc_tests.hpp"
#include "opencv2/gapi/gpu/imgproc.hpp"
#define IMGPROC_GPU cv::gapi::imgproc::gpu::kernels()

@ -7,7 +7,6 @@
#include "../test_precomp.hpp"
#include "../common/gapi_operators_tests.hpp"
#include "opencv2/gapi/gpu/core.hpp"
#define CORE_GPU cv::gapi::core::gpu::kernels()

@ -19,6 +19,8 @@
#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"

Loading…
Cancel
Save