Skip to content

Commit 80c2fef

Browse files
committed
Merge pull request opencv#21318 from alexgiving:atrutnev/move_GKernelPackage
2 parents a559508 + c68fec7 commit 80c2fef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+132
-118
lines changed

doc/tutorials/gapi/anisotropic_segmentation/porting_anisotropic_segmentation.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ and specify it to G-API:
295295

296296
In G-API, kernels (or operation implementations) are objects. Kernels are
297297
organized into collections, or _kernel packages_, represented by class
298-
cv::gapi::GKernelPackage. The main purpose of a kernel package is to
298+
cv::GKernelPackage. The main purpose of a kernel package is to
299299
capture which kernels we would like to use in our graph, and pass it
300300
as a _graph compilation option_:
301301

modules/gapi/include/opencv2/gapi/cpu/core.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace gapi {
1616
namespace core {
1717
namespace cpu {
1818

19-
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
19+
GAPI_EXPORTS_W cv::GKernelPackage kernels();
2020

2121
} // namespace cpu
2222
} // namespace core

modules/gapi/include/opencv2/gapi/fluid/core.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace cv { namespace gapi { namespace core { namespace fluid {
1515

16-
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
16+
GAPI_EXPORTS_W cv::GKernelPackage kernels();
1717

1818
}}}}
1919

modules/gapi/include/opencv2/gapi/gkernel.hpp

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,13 @@ namespace std
410410
};
411411
} // namespace std
412412

413-
414413
namespace cv {
414+
class GAPI_EXPORTS_W_SIMPLE GKernelPackage;
415+
415416
namespace gapi {
417+
GAPI_EXPORTS cv::GKernelPackage combine(const cv::GKernelPackage &lhs,
418+
const cv::GKernelPackage &rhs);
419+
416420
/// @private
417421
class GFunctor
418422
{
@@ -427,6 +431,7 @@ namespace gapi {
427431
private:
428432
const char* m_id;
429433
};
434+
} // namespace gapi
430435

431436
/** \addtogroup gapi_compile_args
432437
* @{
@@ -463,7 +468,7 @@ namespace gapi {
463468
{
464469

465470
/// @private
466-
using M = std::unordered_map<std::string, std::pair<GBackend, GKernelImpl>>;
471+
using M = std::unordered_map<std::string, std::pair<cv::gapi::GBackend, cv::GKernelImpl>>;
467472

468473
/// @private
469474
M m_id_kernels;
@@ -500,10 +505,8 @@ namespace gapi {
500505
}
501506

502507
public:
503-
void include(const GFunctor& functor)
504-
{
505-
m_id_kernels[functor.id()] = std::make_pair(functor.backend(), functor.impl());
506-
}
508+
void include(const cv::gapi::GFunctor& functor);
509+
507510
/**
508511
* @brief Returns total number of kernels
509512
* in the package (across all backends included)
@@ -555,7 +558,7 @@ namespace gapi {
555558
*
556559
* @param backend backend which kernels to remove
557560
*/
558-
void remove(const GBackend& backend);
561+
void remove(const cv::gapi::GBackend& backend);
559562

560563
/**
561564
* @brief Remove all kernels implementing the given API from
@@ -595,7 +598,7 @@ namespace gapi {
595598
*
596599
*/
597600
template<typename KAPI>
598-
GBackend lookup() const
601+
cv::gapi::GBackend lookup() const
599602
{
600603
return lookup(KAPI::id()).first;
601604
}
@@ -621,18 +624,14 @@ namespace gapi {
621624
* @param backend backend associated with the kernel
622625
* @param kernel_id a name/id of the kernel
623626
*/
624-
void include(const cv::gapi::GBackend& backend, const std::string& kernel_id)
625-
{
626-
removeAPI(kernel_id);
627-
m_id_kernels[kernel_id] = std::make_pair(backend, GKernelImpl{{}, {}});
628-
}
627+
void include(const cv::gapi::GBackend& backend, const std::string& kernel_id);
629628

630629
/**
631630
* @brief Lists all backends which are included into package
632631
*
633632
* @return vector of backends
634633
*/
635-
std::vector<GBackend> backends() const;
634+
std::vector<cv::gapi::GBackend> backends() const;
636635

637636
// TODO: Doxygen bug -- it wants me to place this comment
638637
// here, not below.
@@ -643,9 +642,17 @@ namespace gapi {
643642
* @param rhs "Right-hand-side" package in the process
644643
* @return a new kernel package.
645644
*/
646-
friend GAPI_EXPORTS GKernelPackage combine(const GKernelPackage &lhs,
647-
const GKernelPackage &rhs);
645+
friend GAPI_EXPORTS GKernelPackage cv::gapi::combine(const GKernelPackage &lhs,
646+
const GKernelPackage &rhs);
648647
};
648+
/** @} */
649+
650+
namespace gapi {
651+
using GKernelPackage = cv::GKernelPackage; // Keep backward compatibility
652+
653+
/** \addtogroup gapi_compile_args
654+
* @{
655+
*/
649656

650657
/**
651658
* @brief Create a kernel package object containing kernels
@@ -695,10 +702,6 @@ namespace gapi {
695702

696703
/** @} */
697704

698-
// FYI - this function is already commented above
699-
GAPI_EXPORTS GKernelPackage combine(const GKernelPackage &lhs,
700-
const GKernelPackage &rhs);
701-
702705
/**
703706
* @brief Combines multiple G-API kernel packages into one
704707
*
@@ -710,7 +713,7 @@ namespace gapi {
710713
* @return The resulting kernel package
711714
*/
712715
template<typename... Ps>
713-
GKernelPackage combine(const GKernelPackage &a, const GKernelPackage &b, Ps&&... rest)
716+
cv::GKernelPackage combine(const cv::GKernelPackage &a, const cv::GKernelPackage &b, Ps&&... rest)
714717
{
715718
return combine(a, combine(b, rest...));
716719
}
@@ -733,7 +736,7 @@ namespace gapi {
733736

734737
namespace detail
735738
{
736-
template<> struct CompileArgTag<cv::gapi::GKernelPackage>
739+
template<> struct CompileArgTag<cv::GKernelPackage>
737740
{
738741
static const char* tag() { return "gapi.kernel_package"; }
739742
};

modules/gapi/include/opencv2/gapi/ocl/core.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace gapi {
1616
namespace core {
1717
namespace ocl {
1818

19-
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
19+
GAPI_EXPORTS_W cv::GKernelPackage kernels();
2020

2121
} // namespace ocl
2222
} // namespace core

modules/gapi/include/opencv2/gapi/plaidml/core.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace cv { namespace gapi { namespace core { namespace plaidml {
1515

16-
GAPI_EXPORTS cv::gapi::GKernelPackage kernels();
16+
GAPI_EXPORTS cv::GKernelPackage kernels();
1717

1818
}}}}
1919

modules/gapi/include/opencv2/gapi/render/render.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ namespace render
177177
{
178178
namespace ocv
179179
{
180-
GAPI_EXPORTS_W cv::gapi::GKernelPackage kernels();
180+
GAPI_EXPORTS_W cv::GKernelPackage kernels();
181181

182182
} // namespace ocv
183183
} // namespace render

modules/gapi/include/opencv2/gapi/streaming/format.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace cv {
1313
namespace gapi {
1414
namespace streaming {
1515

16-
GAPI_EXPORTS cv::gapi::GKernelPackage kernels();
16+
GAPI_EXPORTS cv::GKernelPackage kernels();
1717

1818
G_API_OP(GBGR, <GMat(GFrame)>, "org.opencv.streaming.BGR")
1919
{

modules/gapi/misc/python/pyopencv_gapi.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <opencv2/gapi/python/python.hpp>
1212

1313
// NB: Python wrapper replaces :: with _ for classes
14-
using gapi_GKernelPackage = cv::gapi::GKernelPackage;
14+
using gapi_GKernelPackage = cv::GKernelPackage;
1515
using gapi_GNetPackage = cv::gapi::GNetPackage;
1616
using gapi_ie_PyParams = cv::gapi::ie::PyParams;
1717
using gapi_wip_IStreamSource_Ptr = cv::Ptr<cv::gapi::wip::IStreamSource>;
@@ -829,7 +829,7 @@ static GMetaArgs run_py_meta(cv::detail::PyObjectHolder out_meta,
829829
static PyObject* pyopencv_cv_gapi_kernels(PyObject* , PyObject* py_args, PyObject*)
830830
{
831831
using namespace cv;
832-
gapi::GKernelPackage pkg;
832+
GKernelPackage pkg;
833833
Py_ssize_t size = PyTuple_Size(py_args);
834834

835835
for (int i = 0; i < size; ++i)

modules/gapi/misc/python/shadow_gapi.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace cv
55
{
66
struct GAPI_EXPORTS_W_SIMPLE GCompileArg
77
{
8-
GAPI_WRAP GCompileArg(gapi::GKernelPackage arg);
8+
GAPI_WRAP GCompileArg(GKernelPackage arg);
99
GAPI_WRAP GCompileArg(gapi::GNetPackage arg);
1010
GAPI_WRAP GCompileArg(gapi::streaming::queue_capacity arg);
1111
};

0 commit comments

Comments
 (0)