1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Move GKernelPackage to cv namespace

This commit is contained in:
Aleksei Trutnev
2021-12-24 18:04:11 +03:00
parent be110d0464
commit c68fec7e97
48 changed files with 133 additions and 119 deletions
@@ -16,7 +16,7 @@ namespace gapi {
namespace core {
namespace cpu {
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
GAPI_EXPORTS_W cv::GKernelPackage kernels();
} // namespace cpu
} // namespace core
@@ -13,7 +13,7 @@
namespace cv { namespace gapi { namespace core { namespace fluid {
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
GAPI_EXPORTS_W cv::GKernelPackage kernels();
}}}}
+25 -22
View File
@@ -410,9 +410,13 @@ namespace std
};
} // namespace std
namespace cv {
class GAPI_EXPORTS_W_SIMPLE GKernelPackage;
namespace gapi {
GAPI_EXPORTS cv::GKernelPackage combine(const cv::GKernelPackage &lhs,
const cv::GKernelPackage &rhs);
/// @private
class GFunctor
{
@@ -427,6 +431,7 @@ namespace gapi {
private:
const char* m_id;
};
} // namespace gapi
/** \addtogroup gapi_compile_args
* @{
@@ -463,7 +468,7 @@ namespace gapi {
{
/// @private
using M = std::unordered_map<std::string, std::pair<GBackend, GKernelImpl>>;
using M = std::unordered_map<std::string, std::pair<cv::gapi::GBackend, cv::GKernelImpl>>;
/// @private
M m_id_kernels;
@@ -500,10 +505,8 @@ namespace gapi {
}
public:
void include(const GFunctor& functor)
{
m_id_kernels[functor.id()] = std::make_pair(functor.backend(), functor.impl());
}
void include(const cv::gapi::GFunctor& functor);
/**
* @brief Returns total number of kernels
* in the package (across all backends included)
@@ -555,7 +558,7 @@ namespace gapi {
*
* @param backend backend which kernels to remove
*/
void remove(const GBackend& backend);
void remove(const cv::gapi::GBackend& backend);
/**
* @brief Remove all kernels implementing the given API from
@@ -595,7 +598,7 @@ namespace gapi {
*
*/
template<typename KAPI>
GBackend lookup() const
cv::gapi::GBackend lookup() const
{
return lookup(KAPI::id()).first;
}
@@ -621,18 +624,14 @@ namespace gapi {
* @param backend backend associated with the kernel
* @param kernel_id a name/id of the kernel
*/
void include(const cv::gapi::GBackend& backend, const std::string& kernel_id)
{
removeAPI(kernel_id);
m_id_kernels[kernel_id] = std::make_pair(backend, GKernelImpl{{}, {}});
}
void include(const cv::gapi::GBackend& backend, const std::string& kernel_id);
/**
* @brief Lists all backends which are included into package
*
* @return vector of backends
*/
std::vector<GBackend> backends() const;
std::vector<cv::gapi::GBackend> backends() const;
// TODO: Doxygen bug -- it wants me to place this comment
// here, not below.
@@ -643,9 +642,17 @@ namespace gapi {
* @param rhs "Right-hand-side" package in the process
* @return a new kernel package.
*/
friend GAPI_EXPORTS GKernelPackage combine(const GKernelPackage &lhs,
const GKernelPackage &rhs);
friend GAPI_EXPORTS GKernelPackage cv::gapi::combine(const GKernelPackage &lhs,
const GKernelPackage &rhs);
};
/** @} */
namespace gapi {
using GKernelPackage = cv::GKernelPackage; // Keep backward compatibility
/** \addtogroup gapi_compile_args
* @{
*/
/**
* @brief Create a kernel package object containing kernels
@@ -695,10 +702,6 @@ namespace gapi {
/** @} */
// FYI - this function is already commented above
GAPI_EXPORTS GKernelPackage combine(const GKernelPackage &lhs,
const GKernelPackage &rhs);
/**
* @brief Combines multiple G-API kernel packages into one
*
@@ -710,7 +713,7 @@ namespace gapi {
* @return The resulting kernel package
*/
template<typename... Ps>
GKernelPackage combine(const GKernelPackage &a, const GKernelPackage &b, Ps&&... rest)
cv::GKernelPackage combine(const cv::GKernelPackage &a, const cv::GKernelPackage &b, Ps&&... rest)
{
return combine(a, combine(b, rest...));
}
@@ -733,7 +736,7 @@ namespace gapi {
namespace detail
{
template<> struct CompileArgTag<cv::gapi::GKernelPackage>
template<> struct CompileArgTag<cv::GKernelPackage>
{
static const char* tag() { return "gapi.kernel_package"; }
};
@@ -16,7 +16,7 @@ namespace gapi {
namespace core {
namespace ocl {
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
GAPI_EXPORTS_W cv::GKernelPackage kernels();
} // namespace ocl
} // namespace core
@@ -13,7 +13,7 @@
namespace cv { namespace gapi { namespace core { namespace plaidml {
GAPI_EXPORTS cv::gapi::GKernelPackage kernels();
GAPI_EXPORTS cv::GKernelPackage kernels();
}}}}
@@ -177,7 +177,7 @@ namespace render
{
namespace ocv
{
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
GAPI_EXPORTS_W cv::GKernelPackage kernels();
} // namespace ocv
} // namespace render
@@ -13,7 +13,7 @@ namespace cv {
namespace gapi {
namespace streaming {
GAPI_EXPORTS cv::gapi::GKernelPackage kernels();
GAPI_EXPORTS cv::GKernelPackage kernels();
G_API_OP(GBGR, <GMat(GFrame)>, "org.opencv.streaming.BGR")
{