|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef OPENCV_GAPI_GKERNEL_HPP |
|
|
#define OPENCV_GAPI_GKERNEL_HPP |
|
|
|
|
|
#include <functional> |
|
|
#include <iostream> |
|
|
#include <string> |
|
|
#include <type_traits> |
|
|
#include <unordered_map> |
|
|
#include <utility> |
|
|
|
|
|
#include <opencv2/gapi/gcommon.hpp> |
|
|
#include <opencv2/gapi/util/util.hpp> |
|
|
#include <opencv2/gapi/gcall.hpp> |
|
|
#include <opencv2/gapi/garg.hpp> |
|
|
#include <opencv2/gapi/gmetaarg.hpp> |
|
|
#include <opencv2/gapi/gtype_traits.hpp> |
|
|
#include <opencv2/gapi/util/compiler_hints.hpp> |
|
|
#include <opencv2/gapi/gtransform.hpp> |
|
|
|
|
|
namespace cv { |
|
|
|
|
|
struct GTypeInfo |
|
|
{ |
|
|
GShape shape; |
|
|
cv::detail::OpaqueKind kind; |
|
|
detail::HostCtor ctor; |
|
|
}; |
|
|
|
|
|
using GShapes = std::vector<GShape>; |
|
|
using GKinds = std::vector<cv::detail::OpaqueKind>; |
|
|
using GCtors = std::vector<detail::HostCtor>; |
|
|
using GTypesInfo = std::vector<GTypeInfo>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct GAPI_EXPORTS GKernel |
|
|
{ |
|
|
using M = std::function<GMetaArgs(const GMetaArgs &, const GArgs &)>; |
|
|
|
|
|
std::string name; |
|
|
std::string tag; |
|
|
M outMeta; |
|
|
GShapes outShapes; |
|
|
GKinds inKinds; |
|
|
GCtors outCtors; |
|
|
GKinds outKinds; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct GAPI_EXPORTS GKernelImpl |
|
|
{ |
|
|
util::any opaque; |
|
|
GKernel::M outMeta; |
|
|
}; |
|
|
|
|
|
template<typename, typename> class GKernelTypeM; |
|
|
|
|
|
namespace detail |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T> struct Yield; |
|
|
template<> struct Yield<cv::GMat> |
|
|
{ |
|
|
static inline cv::GMat yield(cv::GCall &call, int i) { return call.yield(i); } |
|
|
}; |
|
|
template<> struct Yield<cv::GMatP> |
|
|
{ |
|
|
static inline cv::GMatP yield(cv::GCall &call, int i) { return call.yieldP(i); } |
|
|
}; |
|
|
template<> struct Yield<cv::GScalar> |
|
|
{ |
|
|
static inline cv::GScalar yield(cv::GCall &call, int i) { return call.yieldScalar(i); } |
|
|
}; |
|
|
template<typename U> struct Yield<cv::GArray<U> > |
|
|
{ |
|
|
static inline cv::GArray<U> yield(cv::GCall &call, int i) { return call.yieldArray<U>(i); } |
|
|
}; |
|
|
template<typename U> struct Yield<cv::GOpaque<U> > |
|
|
{ |
|
|
static inline cv::GOpaque<U> yield(cv::GCall &call, int i) { return call.yieldOpaque<U>(i); } |
|
|
}; |
|
|
template<> struct Yield<GFrame> |
|
|
{ |
|
|
static inline cv::GFrame yield(cv::GCall &call, int i) { return call.yieldFrame(i); } |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T> struct MetaType; |
|
|
template<> struct MetaType<cv::GMat> { using type = GMatDesc; }; |
|
|
template<> struct MetaType<cv::GMatP> { using type = GMatDesc; }; |
|
|
template<> struct MetaType<cv::GFrame> { using type = GFrameDesc; }; |
|
|
template<> struct MetaType<cv::GScalar> { using type = GScalarDesc; }; |
|
|
template<typename U> struct MetaType<cv::GArray<U> > { using type = GArrayDesc; }; |
|
|
template<typename U> struct MetaType<cv::GOpaque<U> > { using type = GOpaqueDesc; }; |
|
|
template<typename T> struct MetaType { using type = T; }; |
|
|
|
|
|
|
|
|
|
|
|
template<typename T> using is_nongapi_type = std::is_same<T, typename MetaType<T>::type>; |
|
|
|
|
|
|
|
|
template<typename T> |
|
|
typename std::enable_if<!is_nongapi_type<T>::value, typename MetaType<T>::type> |
|
|
::type get_in_meta(const GMetaArgs &in_meta, const GArgs &, int idx) |
|
|
{ |
|
|
return util::get<typename MetaType<T>::type>(in_meta.at(idx)); |
|
|
} |
|
|
|
|
|
template<typename T> |
|
|
typename std::enable_if<is_nongapi_type<T>::value, T> |
|
|
::type get_in_meta(const GMetaArgs &, const GArgs &in_args, int idx) |
|
|
{ |
|
|
return in_args.at(idx).template get<T>(); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename, typename, typename> |
|
|
struct MetaHelper; |
|
|
|
|
|
template<typename K, typename... Ins, typename... Outs> |
|
|
struct MetaHelper<K, std::tuple<Ins...>, std::tuple<Outs...> > |
|
|
{ |
|
|
template<int... IIs, int... OIs> |
|
|
static GMetaArgs getOutMeta_impl(const GMetaArgs &in_meta, |
|
|
const GArgs &in_args, |
|
|
detail::Seq<IIs...>, |
|
|
detail::Seq<OIs...>) |
|
|
{ |
|
|
|
|
|
using R = std::tuple<typename MetaType<Outs>::type...>; |
|
|
const R r = K::outMeta( get_in_meta<Ins>(in_meta, in_args, IIs)... ); |
|
|
return GMetaArgs{ GMetaArg(std::get<OIs>(r))... }; |
|
|
} |
|
|
|
|
|
|
|
|
static GMetaArgs getOutMeta(const GMetaArgs &in_meta, |
|
|
const GArgs &in_args) |
|
|
{ |
|
|
return getOutMeta_impl(in_meta, |
|
|
in_args, |
|
|
typename detail::MkSeq<sizeof...(Ins)>::type(), |
|
|
typename detail::MkSeq<sizeof...(Outs)>::type()); |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
template<typename K, typename... Ins, typename Out> |
|
|
struct MetaHelper<K, std::tuple<Ins...>, Out > |
|
|
{ |
|
|
template<int... IIs> |
|
|
static GMetaArgs getOutMeta_impl(const GMetaArgs &in_meta, |
|
|
const GArgs &in_args, |
|
|
detail::Seq<IIs...>) |
|
|
{ |
|
|
|
|
|
using R = typename MetaType<Out>::type; |
|
|
const R r = K::outMeta( get_in_meta<Ins>(in_meta, in_args, IIs)... ); |
|
|
return GMetaArgs{ GMetaArg(r) }; |
|
|
} |
|
|
|
|
|
|
|
|
static GMetaArgs getOutMeta(const GMetaArgs &in_meta, |
|
|
const GArgs &in_args) |
|
|
{ |
|
|
return getOutMeta_impl(in_meta, |
|
|
in_args, |
|
|
typename detail::MkSeq<sizeof...(Ins)>::type()); |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct NoTag { |
|
|
static constexpr const char *tag() { return ""; } |
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename K, typename... R, typename... Args> |
|
|
class GKernelTypeM<K, std::function<std::tuple<R...>(Args...)> > |
|
|
: public detail::MetaHelper<K, std::tuple<Args...>, std::tuple<R...>> |
|
|
, public detail::NoTag |
|
|
{ |
|
|
template<int... IIs> |
|
|
static std::tuple<R...> yield(cv::GCall &call, detail::Seq<IIs...>) |
|
|
{ |
|
|
return std::make_tuple(detail::Yield<R>::yield(call, IIs)...); |
|
|
} |
|
|
|
|
|
public: |
|
|
using InArgs = std::tuple<Args...>; |
|
|
using OutArgs = std::tuple<R...>; |
|
|
|
|
|
|
|
|
static std::tuple<R...> on(Args... args) |
|
|
{ |
|
|
cv::GCall call(GKernel{ K::id() |
|
|
, K::tag() |
|
|
, &K::getOutMeta |
|
|
, {detail::GTypeTraits<R>::shape...} |
|
|
, {detail::GTypeTraits<Args>::op_kind...} |
|
|
, {detail::GObtainCtor<R>::get()...} |
|
|
, {detail::GTypeTraits<R>::op_kind...}}); |
|
|
call.pass(args...); |
|
|
return yield(call, typename detail::MkSeq<sizeof...(R)>::type()); |
|
|
} |
|
|
}; |
|
|
|
|
|
template<typename, typename> class GKernelType; |
|
|
|
|
|
template<typename K, typename R, typename... Args> |
|
|
class GKernelType<K, std::function<R(Args...)> > |
|
|
: public detail::MetaHelper<K, std::tuple<Args...>, R> |
|
|
, public detail::NoTag |
|
|
{ |
|
|
public: |
|
|
using InArgs = std::tuple<Args...>; |
|
|
using OutArgs = std::tuple<R>; |
|
|
|
|
|
static R on(Args... args) |
|
|
{ |
|
|
cv::GCall call(GKernel{ K::id() |
|
|
, K::tag() |
|
|
, &K::getOutMeta |
|
|
, {detail::GTypeTraits<R>::shape} |
|
|
, {detail::GTypeTraits<Args>::op_kind...} |
|
|
, {detail::GObtainCtor<R>::get()} |
|
|
, {detail::GTypeTraits<R>::op_kind}}); |
|
|
call.pass(args...); |
|
|
return detail::Yield<R>::yield(call, 0); |
|
|
} |
|
|
}; |
|
|
|
|
|
namespace detail { |
|
|
|
|
|
|
|
|
template<typename, typename> class KernelTypeMedium; |
|
|
|
|
|
template<typename K, typename... R, typename... Args> |
|
|
class KernelTypeMedium<K, std::function<std::tuple<R...>(Args...)>> : |
|
|
public cv::GKernelTypeM<K, std::function<std::tuple<R...>(Args...)>> {}; |
|
|
|
|
|
template<typename K, typename R, typename... Args> |
|
|
class KernelTypeMedium<K, std::function<R(Args...)>> : |
|
|
public cv::GKernelType<K, std::function<R(Args...)>> {}; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define G_ID_HELPER_CLASS(Class) Class##IdHelper |
|
|
|
|
|
#define G_ID_HELPER_BODY(Class, Id) \ |
|
|
struct G_ID_HELPER_CLASS(Class) \ |
|
|
{ \ |
|
|
static constexpr const char * id() {return Id;} \ |
|
|
}; \ |
|
|
|
|
|
|
|
|
#define GET_G_TYPED_KERNEL(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, NAME, ...) NAME |
|
|
#define COMBINE_SIGNATURE(...) __VA_ARGS__ |
|
|
|
|
|
#define __WRAP_VAARGS(x) x |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER(Class, API, Id) \ |
|
|
G_ID_HELPER_BODY(Class, Id) \ |
|
|
struct Class final: public cv::detail::KernelTypeMedium<Class, std::function API >, \ |
|
|
public G_ID_HELPER_CLASS(Class) |
|
|
|
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER_2(Class, _1, _2, Id) \ |
|
|
G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2), Id) |
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER_3(Class, _1, _2, _3, Id) \ |
|
|
G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3), Id) |
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER_4(Class, _1, _2, _3, _4, Id) \ |
|
|
G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3, _4), Id) |
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER_5(Class, _1, _2, _3, _4, _5, Id) \ |
|
|
G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3, _4, _5), Id) |
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER_6(Class, _1, _2, _3, _4, _5, _6, Id) \ |
|
|
G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3, _4, _5, _6), Id) |
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER_7(Class, _1, _2, _3, _4, _5, _6, _7, Id) \ |
|
|
G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3, _4, _5, _6, _7), Id) |
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER_8(Class, _1, _2, _3, _4, _5, _6, _7, _8, Id) \ |
|
|
G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3, _4, _5, _6, _7, _8), Id) |
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER_9(Class, _1, _2, _3, _4, _5, _6, _7, _8, _9, Id) \ |
|
|
G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3, _4, _5, _6, _7, _8, _9), Id) |
|
|
|
|
|
#define G_TYPED_KERNEL_HELPER_10(Class, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, Id) \ |
|
|
G_TYPED_KERNEL_HELPER(Class, COMBINE_SIGNATURE(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10), Id) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define G_TYPED_KERNEL(Class, ...) __WRAP_VAARGS(GET_G_TYPED_KERNEL(__VA_ARGS__, \ |
|
|
G_TYPED_KERNEL_HELPER_10, \ |
|
|
G_TYPED_KERNEL_HELPER_9, \ |
|
|
G_TYPED_KERNEL_HELPER_8, \ |
|
|
G_TYPED_KERNEL_HELPER_7, \ |
|
|
G_TYPED_KERNEL_HELPER_6, \ |
|
|
G_TYPED_KERNEL_HELPER_5, \ |
|
|
G_TYPED_KERNEL_HELPER_4, \ |
|
|
G_TYPED_KERNEL_HELPER_3, \ |
|
|
G_TYPED_KERNEL_HELPER_2, \ |
|
|
G_TYPED_KERNEL_HELPER)(Class, __VA_ARGS__)) \ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define G_TYPED_KERNEL_M G_TYPED_KERNEL |
|
|
|
|
|
#define G_API_OP G_TYPED_KERNEL |
|
|
#define G_API_OP_M G_API_OP |
|
|
|
|
|
namespace cv |
|
|
{ |
|
|
namespace gapi |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
class GAPI_EXPORTS GBackend |
|
|
{ |
|
|
public: |
|
|
class Priv; |
|
|
|
|
|
|
|
|
GBackend(); |
|
|
explicit GBackend(std::shared_ptr<Priv> &&p); |
|
|
|
|
|
Priv& priv(); |
|
|
const Priv& priv() const; |
|
|
std::size_t hash() const; |
|
|
|
|
|
bool operator== (const GBackend &rhs) const; |
|
|
|
|
|
private: |
|
|
std::shared_ptr<Priv> m_priv; |
|
|
}; |
|
|
|
|
|
inline bool operator != (const GBackend &lhs, const GBackend &rhs) |
|
|
{ |
|
|
return !(lhs == rhs); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
namespace std |
|
|
{ |
|
|
template<> struct hash<cv::gapi::GBackend> |
|
|
{ |
|
|
std::size_t operator() (const cv::gapi::GBackend &b) const |
|
|
{ |
|
|
return b.hash(); |
|
|
} |
|
|
}; |
|
|
} |
|
|
|
|
|
namespace cv { |
|
|
class GAPI_EXPORTS_W_SIMPLE GKernelPackage; |
|
|
|
|
|
namespace gapi { |
|
|
GAPI_EXPORTS_W cv::GKernelPackage combine(const cv::GKernelPackage &lhs, |
|
|
const cv::GKernelPackage &rhs); |
|
|
|
|
|
|
|
|
class GFunctor |
|
|
{ |
|
|
public: |
|
|
virtual cv::GKernelImpl impl() const = 0; |
|
|
virtual cv::gapi::GBackend backend() const = 0; |
|
|
const char* id() const { return m_id; } |
|
|
|
|
|
virtual ~GFunctor() = default; |
|
|
protected: |
|
|
GFunctor(const char* id) : m_id(id) { } |
|
|
private: |
|
|
const char* m_id; |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GAPI_EXPORTS_W_SIMPLE GKernelPackage |
|
|
{ |
|
|
|
|
|
|
|
|
using M = std::unordered_map<std::string, std::pair<cv::gapi::GBackend, cv::GKernelImpl>>; |
|
|
|
|
|
|
|
|
M m_id_kernels; |
|
|
|
|
|
|
|
|
std::vector<GTransform> m_transformations; |
|
|
|
|
|
protected: |
|
|
|
|
|
|
|
|
void removeAPI(const std::string &id); |
|
|
|
|
|
|
|
|
|
|
|
template <typename KImpl> |
|
|
typename std::enable_if<(std::is_base_of<cv::detail::KernelTag, KImpl>::value), void>::type |
|
|
includeHelper() |
|
|
{ |
|
|
auto backend = KImpl::backend(); |
|
|
auto kernel_id = KImpl::API::id(); |
|
|
auto kernel_impl = GKernelImpl{KImpl::kernel(), &KImpl::API::getOutMeta}; |
|
|
removeAPI(kernel_id); |
|
|
|
|
|
m_id_kernels[kernel_id] = std::make_pair(backend, kernel_impl); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename TImpl> |
|
|
typename std::enable_if<(std::is_base_of<cv::detail::TransformTag, TImpl>::value), void>::type |
|
|
includeHelper() |
|
|
{ |
|
|
m_transformations.emplace_back(TImpl::transformation()); |
|
|
} |
|
|
|
|
|
public: |
|
|
void include(const cv::gapi::GFunctor& functor); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GAPI_WRAP std::size_t size() const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const std::vector<GTransform>& get_transformations() const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> get_kernel_ids() const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename KImpl> |
|
|
bool includes() const |
|
|
{ |
|
|
static_assert(std::is_base_of<cv::detail::KernelTag, KImpl>::value, |
|
|
"includes() can be applied to kernels only"); |
|
|
|
|
|
auto kernel_it = m_id_kernels.find(KImpl::API::id()); |
|
|
return kernel_it != m_id_kernels.end() && |
|
|
kernel_it->second.first == KImpl::backend(); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void remove(const cv::gapi::GBackend& backend); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename KAPI> |
|
|
void remove() |
|
|
{ |
|
|
removeAPI(KAPI::id()); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename KAPI> |
|
|
bool includesAPI() const |
|
|
{ |
|
|
return includesAPI(KAPI::id()); |
|
|
} |
|
|
|
|
|
|
|
|
bool includesAPI(const std::string &id) const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename KAPI> |
|
|
cv::gapi::GBackend lookup() const |
|
|
{ |
|
|
return lookup(KAPI::id()).first; |
|
|
} |
|
|
|
|
|
|
|
|
std::pair<cv::gapi::GBackend, cv::GKernelImpl> |
|
|
lookup(const std::string &id) const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename KImpl> |
|
|
void include() |
|
|
{ |
|
|
includeHelper<KImpl>(); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void include(const cv::gapi::GBackend& backend, const std::string& kernel_id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<cv::gapi::GBackend> backends() const; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friend GAPI_EXPORTS GKernelPackage cv::gapi::combine(const GKernelPackage &lhs, |
|
|
const GKernelPackage &rhs); |
|
|
}; |
|
|
|
|
|
|
|
|
namespace gapi { |
|
|
using GKernelPackage = cv::GKernelPackage; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename... KK> GKernelPackage kernels() |
|
|
{ |
|
|
|
|
|
|
|
|
static_assert(cv::detail::all_unique<typename KK::API...>::value, "Kernels API must be unique"); |
|
|
|
|
|
GKernelPackage pkg; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int unused[] = { 0, (pkg.include<KK>(), 0)... }; |
|
|
cv::util::suppress_unused_warning(unused); |
|
|
return pkg; |
|
|
} |
|
|
|
|
|
template<typename... FF> |
|
|
GKernelPackage kernels(FF&... functors) |
|
|
{ |
|
|
GKernelPackage pkg; |
|
|
int unused[] = { 0, (pkg.include(functors), 0)... }; |
|
|
cv::util::suppress_unused_warning(unused); |
|
|
return pkg; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<typename... Ps> |
|
|
cv::GKernelPackage combine(const cv::GKernelPackage &a, const cv::GKernelPackage &b, Ps&&... rest) |
|
|
{ |
|
|
return combine(a, combine(b, rest...)); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct GAPI_EXPORTS use_only |
|
|
{ |
|
|
GKernelPackage pkg; |
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
namespace detail |
|
|
{ |
|
|
template<> struct CompileArgTag<cv::GKernelPackage> |
|
|
{ |
|
|
static const char* tag() { return "gapi.kernel_package"; } |
|
|
}; |
|
|
|
|
|
template<> struct CompileArgTag<cv::gapi::use_only> |
|
|
{ |
|
|
static const char* tag() { return "gapi.use_only"; } |
|
|
}; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|