From 94e36d8c8df232decdbfd92a5dd6dd5b0ab8466a Mon Sep 17 00:00:00 2001 From: Maxim Pashchenkov Date: Tue, 21 Apr 2020 23:22:01 +0300 Subject: [PATCH] Merge pull request #16995 from mpashchenkov:mp/ocv-gapi-standalone-mat G-API: Mat's "deownification" * deowned Mat * boner * Removed canDescribe test for own::Mat * Removed STANDALONE flag for apply() and operator() * Removed: desc_tests for own::Mat, descr_of for own::Mat. * Returned: tests, cv::gapi::own::descr_of; fixed alignment; Removed own::Mat's headers * Removed unused header own/mat.hpp from gbackend.hpp --- .../gapi/include/opencv2/gapi/cpu/gcpukernel.hpp | 9 ++- .../include/opencv2/gapi/fluid/gfluidbuffer.hpp | 4 +- modules/gapi/include/opencv2/gapi/garg.hpp | 6 +- modules/gapi/include/opencv2/gapi/gcomputation.hpp | 4 +- modules/gapi/include/opencv2/gapi/gmat.hpp | 13 +--- modules/gapi/include/opencv2/gapi/gmetaarg.hpp | 2 - modules/gapi/include/opencv2/gapi/gtype_traits.hpp | 4 +- modules/gapi/include/opencv2/gapi/own/cvdefs.hpp | 4 ++ modules/gapi/src/api/gbackend.cpp | 75 ++++------------------ modules/gapi/src/api/gcomputation.cpp | 8 +-- modules/gapi/src/api/gmat.cpp | 38 ++++++----- modules/gapi/src/api/gproto.cpp | 48 +++++--------- modules/gapi/src/api/gscalar.cpp | 1 - modules/gapi/src/backends/common/gbackend.hpp | 8 +-- modules/gapi/src/backends/cpu/gcpubackend.cpp | 4 +- modules/gapi/src/backends/cpu/gcpukernel.cpp | 8 +-- modules/gapi/src/backends/fluid/gfluidbackend.cpp | 15 +---- modules/gapi/src/backends/fluid/gfluidbuffer.cpp | 20 +++--- .../gapi/src/backends/fluid/gfluidbuffer_priv.hpp | 12 ++-- modules/gapi/src/backends/ie/giebackend.cpp | 12 ++-- modules/gapi/src/backends/ocl/goclbackend.cpp | 2 +- .../gapi/src/backends/plaidml/gplaidmlbackend.cpp | 16 ----- .../gapi/src/backends/render/grenderocvbackend.cpp | 2 +- modules/gapi/src/compiler/gislandmodel.cpp | 2 +- modules/gapi/src/executor/gexecutor.cpp | 4 +- modules/gapi/src/executor/gstreamingexecutor.cpp | 12 ---- modules/gapi/test/gapi_async_test.cpp | 8 +-- modules/gapi/test/gapi_desc_tests.cpp | 17 ----- modules/gapi/test/gapi_fluid_test.cpp | 4 +- modules/gapi/test/gapi_sample_pipelines.cpp | 15 ----- modules/gapi/test/own/mat_tests.cpp | 1 + 31 files changed, 108 insertions(+), 270 deletions(-) diff --git a/modules/gapi/include/opencv2/gapi/cpu/gcpukernel.hpp b/modules/gapi/include/opencv2/gapi/cpu/gcpukernel.hpp index 764e085..d9dd7c7 100644 --- a/modules/gapi/include/opencv2/gapi/cpu/gcpukernel.hpp +++ b/modules/gapi/include/opencv2/gapi/cpu/gcpukernel.hpp @@ -17,7 +17,6 @@ #include #include #include -#include //to_ocv #include //suppress_unused_warning #include @@ -96,8 +95,8 @@ public: const T& inArg(int input) { return m_args.at(input).get(); } // Syntax sugar - const cv::gapi::own::Mat& inMat(int input); - cv::gapi::own::Mat& outMatR(int output); // FIXME: Avoid cv::gapi::own::Mat m = ctx.outMatR() + const cv::Mat& inMat(int input); + cv::Mat& outMatR(int output); // FIXME: Avoid cv::Mat m = ctx.outMatR() const cv::Scalar& inVal(int input); cv::Scalar& outValR(int output); // FIXME: Avoid cv::Scalar s = ctx.outValR() @@ -147,7 +146,7 @@ namespace detail template struct get_in; template<> struct get_in { - static cv::Mat get(GCPUContext &ctx, int idx) { return to_ocv(ctx.inMat(idx)); } + static cv::Mat get(GCPUContext &ctx, int idx) { return ctx.inMat(idx); } }; template<> struct get_in { @@ -196,7 +195,7 @@ template struct get_in }; struct tracked_cv_mat{ - tracked_cv_mat(cv::gapi::own::Mat& m) : r{to_ocv(m)}, original_data{m.data} {} + tracked_cv_mat(cv::Mat& m) : r{m}, original_data{m.data} {} cv::Mat r; uchar* original_data; diff --git a/modules/gapi/include/opencv2/gapi/fluid/gfluidbuffer.hpp b/modules/gapi/include/opencv2/gapi/fluid/gfluidbuffer.hpp index 02e74f2..de16eb0 100644 --- a/modules/gapi/include/opencv2/gapi/fluid/gfluidbuffer.hpp +++ b/modules/gapi/include/opencv2/gapi/fluid/gfluidbuffer.hpp @@ -14,11 +14,9 @@ #include // uint8_t #include -#include #include #include -#include namespace cv { namespace gapi { @@ -114,7 +112,7 @@ public: int wlpi, BorderOpt border); // Constructor for in/out buffers (for tests) - Buffer(const cv::gapi::own::Mat &data, bool is_input); + Buffer(const cv::Mat &data, bool is_input); ~Buffer(); Buffer& operator=(Buffer&&); diff --git a/modules/gapi/include/opencv2/gapi/garg.hpp b/modules/gapi/include/opencv2/gapi/garg.hpp index 5aaea55..ef460c1 100644 --- a/modules/gapi/include/opencv2/gapi/garg.hpp +++ b/modules/gapi/include/opencv2/gapi/garg.hpp @@ -89,11 +89,10 @@ using GArgs = std::vector; // FIXME: Move to a separate file! using GRunArg = util::variant< #if !defined(GAPI_STANDALONE) - cv::Mat, cv::UMat, #endif // !defined(GAPI_STANDALONE) cv::gapi::wip::IStreamSource::Ptr, - cv::gapi::own::Mat, + cv::Mat, cv::Scalar, cv::detail::VectorRef, cv::detail::OpaqueRef @@ -122,10 +121,9 @@ struct Data: public GRunArg using GRunArgP = util::variant< #if !defined(GAPI_STANDALONE) - cv::Mat*, cv::UMat*, #endif // !defined(GAPI_STANDALONE) - cv::gapi::own::Mat*, + cv::Mat*, cv::Scalar*, cv::detail::VectorRef, cv::detail::OpaqueRef diff --git a/modules/gapi/include/opencv2/gapi/gcomputation.hpp b/modules/gapi/include/opencv2/gapi/gcomputation.hpp index 1ff874a..20789cc 100644 --- a/modules/gapi/include/opencv2/gapi/gcomputation.hpp +++ b/modules/gapi/include/opencv2/gapi/gcomputation.hpp @@ -250,8 +250,8 @@ public: void apply(GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&args = {}); // Arg-to-arg overload /// @private -- Exclude this function from OpenCV documentation - void apply(const std::vector& ins, // Compatibility overload - const std::vector& outs, + void apply(const std::vector& ins, // Compatibility overload + const std::vector& outs, GCompileArgs &&args = {}); // 2. Syntax sugar and compatibility overloads diff --git a/modules/gapi/include/opencv2/gapi/gmat.hpp b/modules/gapi/include/opencv2/gapi/gmat.hpp index eed9364..91f6332 100644 --- a/modules/gapi/include/opencv2/gapi/gmat.hpp +++ b/modules/gapi/include/opencv2/gapi/gmat.hpp @@ -71,10 +71,6 @@ public: using GMat::GMat; }; -namespace gapi { namespace own { - class Mat; -}}//gapi::own - /** @} */ /** @@ -121,7 +117,7 @@ struct GAPI_EXPORTS GMatDesc // (it handles the case when // 1-channel mat can be reinterpreted as is (1-channel mat) // and as a 3-channel planar mat with height divided by 3) - bool canDescribe(const cv::gapi::own::Mat& mat) const; + bool canDescribe(const cv::Mat& mat) const; // Meta combinator: return a new GMatDesc which differs in size by delta // (all other fields are taken unchanged from this GMatDesc) @@ -132,9 +128,6 @@ struct GAPI_EXPORTS GMatDesc desc.size += delta; return desc; } -#if !defined(GAPI_STANDALONE) - bool canDescribe(const cv::Mat& mat) const; -#endif // !defined(GAPI_STANDALONE) // Meta combinator: return a new GMatDesc which differs in size by delta // (all other fields are taken unchanged from this GMatDesc) // @@ -213,15 +206,15 @@ struct GAPI_EXPORTS GMatDesc static inline GMatDesc empty_gmat_desc() { return GMatDesc{-1,-1,{-1,-1}}; } #if !defined(GAPI_STANDALONE) -class Mat; -GAPI_EXPORTS GMatDesc descr_of(const cv::Mat &mat); GAPI_EXPORTS GMatDesc descr_of(const cv::UMat &mat); #endif // !defined(GAPI_STANDALONE) +GAPI_EXPORTS GMatDesc descr_of(const cv::Mat &mat); /** @} */ // FIXME: WHY??? WHY it is under different namespace? namespace gapi { namespace own { + class Mat; GAPI_EXPORTS GMatDesc descr_of(const Mat &mat); }}//gapi::own diff --git a/modules/gapi/include/opencv2/gapi/gmetaarg.hpp b/modules/gapi/include/opencv2/gapi/gmetaarg.hpp index 39f087f..499de45 100644 --- a/modules/gapi/include/opencv2/gapi/gmetaarg.hpp +++ b/modules/gapi/include/opencv2/gapi/gmetaarg.hpp @@ -66,12 +66,10 @@ namespace detail // Note: descr_of(std::vector<..>) returns a GArrayDesc, while // descrs_of(std::vector<..>) returns an array of Meta args! -class Mat; class UMat; GAPI_EXPORTS cv::GMetaArgs descrs_of(const std::vector &vec); GAPI_EXPORTS cv::GMetaArgs descrs_of(const std::vector &vec); namespace gapi { namespace own { - class Mat; GAPI_EXPORTS cv::GMetaArgs descrs_of(const std::vector &vec); }} // namespace gapi::own diff --git a/modules/gapi/include/opencv2/gapi/gtype_traits.hpp b/modules/gapi/include/opencv2/gapi/gtype_traits.hpp index fbdac15..c0acef0 100644 --- a/modules/gapi/include/opencv2/gapi/gtype_traits.hpp +++ b/modules/gapi/include/opencv2/gapi/gtype_traits.hpp @@ -17,7 +17,6 @@ #include #include #include -#include namespace cv { @@ -111,10 +110,9 @@ namespace detail // and GMat behavior is correct for GMatP) template struct GTypeOf; #if !defined(GAPI_STANDALONE) - template<> struct GTypeOf { using type = cv::GMat; }; template<> struct GTypeOf { using type = cv::GMat; }; #endif // !defined(GAPI_STANDALONE) - template<> struct GTypeOf { using type = cv::GMat; }; + template<> struct GTypeOf { using type = cv::GMat; }; template<> struct GTypeOf { using type = cv::GScalar; }; template struct GTypeOf > { using type = cv::GArray; }; template struct GTypeOf { using type = cv::GOpaque;}; diff --git a/modules/gapi/include/opencv2/gapi/own/cvdefs.hpp b/modules/gapi/include/opencv2/gapi/own/cvdefs.hpp index 354609b..008cdd6 100644 --- a/modules/gapi/include/opencv2/gapi/own/cvdefs.hpp +++ b/modules/gapi/include/opencv2/gapi/own/cvdefs.hpp @@ -140,10 +140,14 @@ enum InterpolationFlags{ INTER_MAX = 7, }; // replacement of cv's structures: +namespace gapi { namespace own { +class Mat; +}} // namespace gapi::own using Rect = gapi::own::Rect; using Size = gapi::own::Size; using Point = gapi::own::Point; using Scalar = gapi::own::Scalar; +using Mat = gapi::own::Mat; } // namespace cv static inline int cvFloor( double value ) diff --git a/modules/gapi/src/api/gbackend.cpp b/modules/gapi/src/api/gbackend.cpp index 24281ba..cc0b1a9 100644 --- a/modules/gapi/src/api/gbackend.cpp +++ b/modules/gapi/src/api/gbackend.cpp @@ -10,7 +10,6 @@ #include // multiplies #include -#include #include "api/gbackend_priv.hpp" #include "backends/common/gbackend.hpp" @@ -114,36 +113,22 @@ void bindInArg(Mag& mag, const RcDesc &rc, const GRunArg &arg, bool is_umat) { switch (arg.index()) { - case GRunArg::index_of() : + case GRunArg::index_of() : if (is_umat) { #if !defined(GAPI_STANDALONE) auto& mag_umat = mag.template slot()[rc.id]; - mag_umat = to_ocv(util::get(arg)).getUMat(ACCESS_READ); + mag_umat = util::get(arg).getUMat(ACCESS_READ); #else util::throw_error(std::logic_error("UMat is not supported in standalone build")); #endif // !defined(GAPI_STANDALONE) } else { - auto& mag_mat = mag.template slot()[rc.id]; - mag_mat = util::get(arg); + auto& mag_mat = mag.template slot()[rc.id]; + mag_mat = util::get(arg); } break; -#if !defined(GAPI_STANDALONE) - case GRunArg::index_of() : - if (is_umat) - { - auto& mag_umat = mag.template slot()[rc.id]; - mag_umat = util::get(arg).getUMat(ACCESS_READ); - } - else - { - auto& mag_mat = mag.template slot()[rc.id]; - mag_mat = to_own(util::get(arg)); - } - break; -#endif // !defined(GAPI_STANDALONE) default: util::throw_error(std::logic_error("content type of the runtime argument does not match to resource description ?")); } break; @@ -182,36 +167,22 @@ void bindOutArg(Mag& mag, const RcDesc &rc, const GRunArgP &arg, bool is_umat) { switch (arg.index()) { - case GRunArgP::index_of() : + case GRunArgP::index_of() : if (is_umat) { #if !defined(GAPI_STANDALONE) auto& mag_umat = mag.template slot()[rc.id]; - mag_umat = to_ocv(*(util::get(arg))).getUMat(ACCESS_RW); + mag_umat = util::get(arg)->getUMat(ACCESS_RW); #else util::throw_error(std::logic_error("UMat is not supported in standalone build")); #endif // !defined(GAPI_STANDALONE) } else { - auto& mag_mat = mag.template slot()[rc.id]; - mag_mat = *util::get(arg); + auto& mag_mat = mag.template slot()[rc.id]; + mag_mat = *util::get(arg); } break; -#if !defined(GAPI_STANDALONE) - case GRunArgP::index_of() : - if (is_umat) - { - auto& mag_umat = mag.template slot()[rc.id]; - mag_umat = util::get(arg)->getUMat(ACCESS_RW); - } - else - { - auto& mag_mat = mag.template slot()[rc.id]; - mag_mat = to_own(*util::get(arg)); - } - break; -#endif // !defined(GAPI_STANDALONE) default: util::throw_error(std::logic_error("content type of the runtime argument does not match to resource description ?")); } break; @@ -277,7 +248,7 @@ cv::GRunArg getArg(const Mag& mag, const RcDesc &ref) // Wrap associated CPU object (either host or an internal one) switch (ref.shape) { - case GShape::GMAT: return GRunArg(mag.template slot().at(ref.id)); + case GShape::GMAT: return GRunArg(mag.template slot().at(ref.id)); case GShape::GSCALAR: return GRunArg(mag.template slot().at(ref.id)); // Note: .at() is intentional for GArray and GOpaque as objects MUST be already there // (and constructed by either bindIn/Out or resetInternal) @@ -303,7 +274,7 @@ cv::GRunArgP getObjPtr(Mag& mag, const RcDesc &rc, bool is_umat) #endif // !defined(GAPI_STANDALONE) } else - return GRunArgP(&mag.template slot()[rc.id]); + return GRunArgP(&mag.template slot()[rc.id]); case GShape::GSCALAR: return GRunArgP(&mag.template slot()[rc.id]); // Note: .at() is intentional for GArray and GOpaque as objects MUST be already there // (and constructor by either bindIn/Out or resetInternal) @@ -347,10 +318,9 @@ void writeBack(const Mag& mag, const RcDesc &rc, GRunArgP &g_arg, bool is_umat) uchar* out_arg_data = nullptr; switch (g_arg.index()) { - case GRunArgP::index_of() : out_arg_data = util::get(g_arg)->data; break; + case GRunArgP::index_of() : out_arg_data = util::get(g_arg)->data; break; #if !defined(GAPI_STANDALONE) - case GRunArgP::index_of() : out_arg_data = util::get(g_arg)->data; break; - case GRunArgP::index_of() : out_arg_data = (util::get(g_arg))->getMat(ACCESS_RW).data; break; + case GRunArgP::index_of() : out_arg_data = (util::get(g_arg))->getMat(ACCESS_RW).data; break; #endif // !defined(GAPI_STANDALONE) default: util::throw_error(std::logic_error("content type of the runtime argument does not match to resource description ?")); } @@ -365,7 +335,7 @@ void writeBack(const Mag& mag, const RcDesc &rc, GRunArgP &g_arg, bool is_umat) } else { - auto& in_mag = mag.template slot().at(rc.id); + auto& in_mag = mag.template slot().at(rc.id); GAPI_Assert((out_arg_data == in_mag.data) && " data for output parameters was reallocated ?"); } break; @@ -389,24 +359,6 @@ void writeBack(const Mag& mag, const RcDesc &rc, GRunArgP &g_arg, bool is_umat) } // namespace magazine -void createMat(const cv::GMatDesc &desc, cv::gapi::own::Mat& mat) -{ - // FIXME: Refactor (probably start supporting N-Dimensional blobs natively - if (desc.dims.empty()) - { - const auto type = desc.planar ? desc.depth : CV_MAKETYPE(desc.depth, desc.chan); - const auto size = desc.planar ? cv::Size{desc.size.width, desc.size.height*desc.chan} - : desc.size; - mat.create(size, type); - } - else - { - GAPI_Assert(!desc.planar); - mat.create(desc.dims, desc.depth); - } -} - -#if !defined(GAPI_STANDALONE) void createMat(const cv::GMatDesc &desc, cv::Mat& mat) { // FIXME: Refactor (probably start supporting N-Dimensional blobs natively @@ -423,7 +375,6 @@ void createMat(const cv::GMatDesc &desc, cv::Mat& mat) mat.create(desc.dims, desc.depth); } } -#endif } // namespace gimpl } // namespace cv diff --git a/modules/gapi/src/api/gcomputation.cpp b/modules/gapi/src/api/gcomputation.cpp index 18ca53b..5dac47b 100644 --- a/modules/gapi/src/api/gcomputation.cpp +++ b/modules/gapi/src/api/gcomputation.cpp @@ -132,16 +132,16 @@ void cv::GComputation::apply(GRunArgs &&ins, GRunArgsP &&outs, GCompileArgs &&ar m_priv->m_lastCompiled(std::move(ins), std::move(outs)); } -void cv::GComputation::apply(const std::vector &ins, - const std::vector &outs, +void cv::GComputation::apply(const std::vector &ins, + const std::vector &outs, GCompileArgs &&args) { GRunArgs call_ins; GRunArgsP call_outs; auto tmp = outs; - for (const cv::gapi::own::Mat &m : ins) { call_ins.emplace_back(m); } - for ( cv::gapi::own::Mat &m : tmp) { call_outs.emplace_back(&m); } + for (const cv::Mat &m : ins) { call_ins.emplace_back(m); } + for ( cv::Mat &m : tmp) { call_outs.emplace_back(&m); } apply(std::move(call_ins), std::move(call_outs), std::move(args)); } diff --git a/modules/gapi/src/api/gmat.cpp b/modules/gapi/src/api/gmat.cpp index a108c51..527dbb3 100644 --- a/modules/gapi/src/api/gmat.cpp +++ b/modules/gapi/src/api/gmat.cpp @@ -48,10 +48,9 @@ namespace{ } } - -#if !defined(GAPI_STANDALONE) cv::GMatDesc cv::descr_of(const cv::Mat &mat) { +#if !defined(GAPI_STANDALONE) const auto mat_dims = mat.size.dims(); if (mat_dims == 2) @@ -63,17 +62,25 @@ cv::GMatDesc cv::descr_of(const cv::Mat &mat) dims[i] = mat.size[i]; } return GMatDesc{mat.depth(), std::move(dims)}; +#else + return (mat.dims.empty()) + ? GMatDesc{mat.depth(), mat.channels(), {mat.cols, mat.rows}} + : GMatDesc{mat.depth(), mat.dims}; +#endif } -cv::GMatDesc cv::descr_of(const cv::UMat &mat) +cv::GMatDesc cv::gapi::own::descr_of(const Mat &mat) { - GAPI_Assert(mat.size.dims() == 2); - return GMatDesc{ mat.depth(), mat.channels(),{ mat.cols, mat.rows } }; + return (mat.dims.empty()) + ? GMatDesc{mat.depth(), mat.channels(), {mat.cols, mat.rows}} + : GMatDesc{mat.depth(), mat.dims}; } -cv::GMetaArgs cv::descrs_of(const std::vector &vec) +#if !defined(GAPI_STANDALONE) +cv::GMatDesc cv::descr_of(const cv::UMat &mat) { - return vec_descr_of(vec); + GAPI_Assert(mat.size.dims() == 2); + return GMatDesc{ mat.depth(), mat.channels(),{ mat.cols, mat.rows } }; } cv::GMetaArgs cv::descrs_of(const std::vector &vec) @@ -82,14 +89,12 @@ cv::GMetaArgs cv::descrs_of(const std::vector &vec) } #endif -cv::GMatDesc cv::gapi::own::descr_of(const cv::gapi::own::Mat &mat) +cv::GMetaArgs cv::descrs_of(const std::vector &vec) { - return (mat.dims.empty()) - ? GMatDesc{mat.depth(), mat.channels(), {mat.cols, mat.rows}} - : GMatDesc{mat.depth(), mat.dims}; + return vec_descr_of(vec); } -cv::GMetaArgs cv::gapi::own::descrs_of(const std::vector &vec) +cv::GMetaArgs cv::gapi::own::descrs_of(const std::vector &vec) { return vec_descr_of(vec); } @@ -126,21 +131,14 @@ std::ostream& operator<<(std::ostream& os, const cv::GMatDesc &desc) namespace { template inline bool canDescribeHelper(const GMatDesc& desc, const M& mat) { - const auto mat_desc = desc.planar ? descr_of(mat).asPlanar(desc.chan) : descr_of(mat); + const auto mat_desc = desc.planar ? cv::descr_of(mat).asPlanar(desc.chan) : cv::descr_of(mat); return desc == mat_desc; } } // anonymous namespace -bool GMatDesc::canDescribe(const cv::gapi::own::Mat& mat) const -{ - return canDescribeHelper(*this, mat); -} - -#if !defined(GAPI_STANDALONE) bool GMatDesc::canDescribe(const cv::Mat& mat) const { return canDescribeHelper(*this, mat); } -#endif }// namespace cv diff --git a/modules/gapi/src/api/gproto.cpp b/modules/gapi/src/api/gproto.cpp index 83df837..1bac18a 100644 --- a/modules/gapi/src/api/gproto.cpp +++ b/modules/gapi/src/api/gproto.cpp @@ -103,14 +103,8 @@ cv::GMetaArg cv::descr_of(const cv::GRunArg &arg) { switch (arg.index()) { -#if !defined(GAPI_STANDALONE) case GRunArg::index_of(): - return cv::GMetaArg(descr_of(util::get(arg))); - -#endif // !defined(GAPI_STANDALONE) - - case GRunArg::index_of(): - return cv::GMetaArg(descr_of(util::get(arg))); + return cv::GMetaArg(cv::descr_of(util::get(arg))); case GRunArg::index_of(): return cv::GMetaArg(descr_of(util::get(arg))); @@ -140,10 +134,9 @@ cv::GMetaArg cv::descr_of(const cv::GRunArgP &argp) switch (argp.index()) { #if !defined(GAPI_STANDALONE) - case GRunArgP::index_of(): return GMetaArg(descr_of(*util::get(argp))); - case GRunArgP::index_of(): return GMetaArg(descr_of(*util::get(argp))); + case GRunArgP::index_of(): return GMetaArg(cv::descr_of(*util::get(argp))); #endif // !defined(GAPI_STANDALONE) - case GRunArgP::index_of(): return GMetaArg(descr_of(*util::get(argp))); + case GRunArgP::index_of(): return GMetaArg(cv::descr_of(*util::get(argp))); case GRunArgP::index_of(): return GMetaArg(descr_of(*util::get(argp))); case GRunArgP::index_of(): return GMetaArg(util::get(argp).descr_of()); case GRunArgP::index_of(): return GMetaArg(util::get(argp).descr_of()); @@ -156,13 +149,11 @@ bool cv::can_describe(const GMetaArg& meta, const GRunArgP& argp) switch (argp.index()) { #if !defined(GAPI_STANDALONE) + case GRunArgP::index_of(): return meta == GMetaArg(cv::descr_of(*util::get(argp))); +#endif // !defined(GAPI_STANDALONE) case GRunArgP::index_of(): return util::holds_alternative(meta) && util::get(meta).canDescribe(*util::get(argp)); - case GRunArgP::index_of(): return meta == GMetaArg(descr_of(*util::get(argp))); -#endif // !defined(GAPI_STANDALONE) - case GRunArgP::index_of(): return util::holds_alternative(meta) && - util::get(meta).canDescribe(*util::get(argp)); - case GRunArgP::index_of(): return meta == GMetaArg(descr_of(*util::get(argp))); + case GRunArgP::index_of(): return meta == GMetaArg(cv::descr_of(*util::get(argp))); case GRunArgP::index_of(): return meta == GMetaArg(util::get(argp).descr_of()); case GRunArgP::index_of(): return meta == GMetaArg(util::get(argp).descr_of()); default: util::throw_error(std::logic_error("Unsupported GRunArgP type")); @@ -174,12 +165,10 @@ bool cv::can_describe(const GMetaArg& meta, const GRunArg& arg) switch (arg.index()) { #if !defined(GAPI_STANDALONE) - case GRunArg::index_of(): return util::holds_alternative(meta) && - util::get(meta).canDescribe(util::get(arg)); case GRunArg::index_of(): return meta == cv::GMetaArg(descr_of(util::get(arg))); #endif // !defined(GAPI_STANDALONE) - case GRunArg::index_of(): return util::holds_alternative(meta) && - util::get(meta).canDescribe(util::get(arg)); + case GRunArg::index_of(): return util::holds_alternative(meta) && + util::get(meta).canDescribe(util::get(arg)); case GRunArg::index_of(): return meta == cv::GMetaArg(descr_of(util::get(arg))); case GRunArg::index_of(): return meta == cv::GMetaArg(util::get(arg).descr_of()); case GRunArg::index_of(): return meta == cv::GMetaArg(util::get(arg).descr_of()); @@ -203,21 +192,16 @@ void cv::validate_input_arg(const GRunArg& arg) switch (arg.index()) { #if !defined(GAPI_STANDALONE) - case GRunArg::index_of(): - { - const auto desc = descr_of(util::get(arg)); - GAPI_Assert(desc.size.height != 0 && desc.size.width != 0 && "incorrect dimensions of cv::Mat!"); break; - } case GRunArg::index_of(): { - const auto desc = descr_of(util::get(arg)); + const auto desc = cv::descr_of(util::get(arg)); GAPI_Assert(desc.size.height != 0 && desc.size.width != 0 && "incorrect dimensions of cv::UMat!"); break; } #endif // !defined(GAPI_STANDALONE) - case GRunArg::index_of(): + case GRunArg::index_of(): { - const auto desc = descr_of(util::get(arg)); - GAPI_Assert(desc.size.height != 0 && desc.size.width != 0 && "incorrect dimensions of own::Mat!"); break; + const auto desc = cv::descr_of(util::get(arg)); + GAPI_Assert(desc.size.height != 0 && desc.size.width != 0 && "incorrect dimensions of Mat!"); break; } default: // No extra handling @@ -271,15 +255,13 @@ const void* cv::gimpl::proto::ptr(const GRunArgP &arg) switch (arg.index()) { #if !defined(GAPI_STANDALONE) + case GRunArgP::index_of(): + return static_cast(cv::util::get(arg)); +#endif case GRunArgP::index_of(): return static_cast(cv::util::get(arg)); case GRunArgP::index_of(): return static_cast(cv::util::get(arg)); - case GRunArgP::index_of(): - return static_cast(cv::util::get(arg)); -#endif - case GRunArgP::index_of(): - return static_cast(cv::util::get(arg)); case GRunArgP::index_of(): return cv::util::get(arg).ptr(); case GRunArgP::index_of(): diff --git a/modules/gapi/src/api/gscalar.cpp b/modules/gapi/src/api/gscalar.cpp index 492d016..accc242 100644 --- a/modules/gapi/src/api/gscalar.cpp +++ b/modules/gapi/src/api/gscalar.cpp @@ -8,7 +8,6 @@ #include "precomp.hpp" #include -#include #include "api/gorigin.hpp" // cv::GScalar public implementation /////////////////////////////////////////// diff --git a/modules/gapi/src/backends/common/gbackend.hpp b/modules/gapi/src/backends/common/gbackend.hpp index ee3bfa2..f49d117 100644 --- a/modules/gapi/src/backends/common/gbackend.hpp +++ b/modules/gapi/src/backends/common/gbackend.hpp @@ -14,7 +14,6 @@ #include #include "opencv2/gapi/garg.hpp" -#include "opencv2/gapi/own/mat.hpp" #include "opencv2/gapi/util/optional.hpp" @@ -45,9 +44,9 @@ namespace magazine { } // namespace magazine #if !defined(GAPI_STANDALONE) -using Mag = magazine::Class; +using Mag = magazine::Class; #else -using Mag = magazine::Class; +using Mag = magazine::Class; #endif namespace magazine @@ -98,10 +97,7 @@ inline cv::util::optional getCompileArg(const cv::GCompileArgs &args) return cv::util::optional(); } -void createMat(const cv::GMatDesc& desc, cv::gapi::own::Mat& mat); -#if !defined(GAPI_STANDALONE) void createMat(const cv::GMatDesc& desc, cv::Mat& mat); -#endif }} // cv::gimpl diff --git a/modules/gapi/src/backends/cpu/gcpubackend.cpp b/modules/gapi/src/backends/cpu/gcpubackend.cpp index 29310ee..c9fe3ca 100644 --- a/modules/gapi/src/backends/cpu/gcpubackend.cpp +++ b/modules/gapi/src/backends/cpu/gcpubackend.cpp @@ -96,7 +96,7 @@ cv::gimpl::GCPUExecutable::GCPUExecutable(const ade::Graph &g, if (desc.storage == Data::Storage::INTERNAL && desc.shape == GShape::GMAT) { const auto mat_desc = util::get(desc.meta); - auto& mat = m_res.slot()[desc.rc]; + auto& mat = m_res.slot()[desc.rc]; createMat(mat_desc, mat); } break; @@ -128,7 +128,7 @@ cv::GArg cv::gimpl::GCPUExecutable::packArg(const GArg &arg) const cv::gimpl::RcDesc &ref = arg.get(); switch (ref.shape) { - case GShape::GMAT: return GArg(m_res.slot() [ref.id]); + case GShape::GMAT: return GArg(m_res.slot() [ref.id]); case GShape::GSCALAR: return GArg(m_res.slot()[ref.id]); // Note: .at() is intentional for GArray and GOpaque as objects MUST be already there // (and constructed by either bindIn/Out or resetInternal) diff --git a/modules/gapi/src/backends/cpu/gcpukernel.cpp b/modules/gapi/src/backends/cpu/gcpukernel.cpp index 238ced2..423e29f 100644 --- a/modules/gapi/src/backends/cpu/gcpukernel.cpp +++ b/modules/gapi/src/backends/cpu/gcpukernel.cpp @@ -11,14 +11,14 @@ #include -const cv::gapi::own::Mat& cv::GCPUContext::inMat(int input) +const cv::Mat& cv::GCPUContext::inMat(int input) { - return inArg(input); + return inArg(input); } -cv::gapi::own::Mat& cv::GCPUContext::outMatR(int output) +cv::Mat& cv::GCPUContext::outMatR(int output) { - return *util::get(m_results.at(output)); + return *util::get(m_results.at(output)); } const cv::Scalar& cv::GCPUContext::inVal(int input) diff --git a/modules/gapi/src/backends/fluid/gfluidbackend.cpp b/modules/gapi/src/backends/fluid/gfluidbackend.cpp index 665afab..97f086f 100644 --- a/modules/gapi/src/backends/fluid/gfluidbackend.cpp +++ b/modules/gapi/src/backends/fluid/gfluidbackend.cpp @@ -26,7 +26,6 @@ #include #include "logger.hpp" -#include #include //for version of descr_of // PRIVATE STUFF! #include "compiler/gobjref.hpp" @@ -1246,7 +1245,7 @@ void cv::gimpl::GFluidExecutable::bindInArg(const cv::gimpl::RcDesc &rc, const G { switch (rc.shape) { - case GShape::GMAT: m_buffers[m_id_map.at(rc.id)].priv().bindTo(util::get(arg), true); break; + case GShape::GMAT: m_buffers[m_id_map.at(rc.id)].priv().bindTo(util::get(arg), true); break; case GShape::GSCALAR: m_res.slot()[rc.id] = util::get(arg); break; case GShape::GARRAY: m_res.slot()[rc.id] = util::get(arg); break; case GShape::GOPAQUE: m_res.slot()[rc.id] = util::get(arg); break; @@ -1266,20 +1265,12 @@ void cv::gimpl::GFluidExecutable::bindOutArg(const cv::gimpl::RcDesc &rc, const switch (arg.index()) { // FIXME: See the bindInArg comment on Streaming-related changes - case T::index_of(): { - auto &outMat = *util::get(arg); - GAPI_Assert(outMat.data != nullptr); - GAPI_Assert(descr_of(outMat) == desc && "Output argument was not preallocated as it should be ?"); - bref.bindTo(outMat, false); - } break; -#if !defined(GAPI_STANDALONE) case T::index_of(): { auto &outMat = *util::get(arg); GAPI_Assert(outMat.data != nullptr); - GAPI_Assert(descr_of(outMat) == desc && "Output argument was not preallocated as it should be ?"); - bref.bindTo(cv::to_own(outMat), false); + GAPI_Assert(cv::descr_of(outMat) == desc && "Output argument was not preallocated as it should be ?"); + bref.bindTo(outMat, false); } break; -#endif // GAPI_STANDALONE default: GAPI_Assert(false); } // switch(arg.index()) break; diff --git a/modules/gapi/src/backends/fluid/gfluidbuffer.cpp b/modules/gapi/src/backends/fluid/gfluidbuffer.cpp index 2958008..aea51d5 100644 --- a/modules/gapi/src/backends/fluid/gfluidbuffer.cpp +++ b/modules/gapi/src/backends/fluid/gfluidbuffer.cpp @@ -78,7 +78,7 @@ void fillConstBorderRow(uint8_t* row, int length, int chan, int borderSize, cv:: } // Fills const border pixels in the whole mat -void fillBorderConstant(int borderSize, cv::Scalar borderValue, cv::gapi::own::Mat& mat) +void fillBorderConstant(int borderSize, cv::Scalar borderValue, cv::Mat& mat) { // cv::Scalar can contain maximum 4 chan GAPI_Assert(mat.channels() > 0 && mat.channels() <= 4); @@ -178,9 +178,7 @@ const uint8_t* fluid::BorderHandlerT::inLineB(int /*log_idx void fluid::BorderHandlerT::fillCompileTimeBorder(BufferStorageWithBorder& data) { m_const_border.create(1, data.cols(), data.data().type()); - // FIXME: remove this crutch in deowned Mat - m_const_border = {m_border_value[0], m_border_value[1], - m_border_value[2], m_border_value[3]}; + m_const_border = m_border_value; cv::gapi::fillBorderConstant(m_border_size, m_border_value, data.data()); } @@ -266,7 +264,7 @@ const uint8_t* fluid::BufferStorageWithBorder::inLineB(int log_idx, int desc_hei } } -static void copyWithoutBorder(const cv::gapi::own::Mat& src, int src_border_size, cv::gapi::own::Mat& dst, int dst_border_size, int startSrcLine, int startDstLine, int lpi) +static void copyWithoutBorder(const cv::Mat& src, int src_border_size, cv::Mat& dst, int dst_border_size, int startSrcLine, int startDstLine, int lpi) { auto subSrc = src(cv::Rect{src_border_size, startSrcLine, src.cols - 2*src_border_size, lpi}); auto subDst = dst(cv::Rect{dst_border_size, startDstLine, dst.cols - 2*dst_border_size, lpi}); @@ -362,8 +360,8 @@ std::unique_ptr createStorage(int capacity, int desc_width #endif } -std::unique_ptr createStorage(const cv::gapi::own::Mat& data, cv::Rect roi); -std::unique_ptr createStorage(const cv::gapi::own::Mat& data, cv::Rect roi) +std::unique_ptr createStorage(const cv::Mat& data, cv::Rect roi); +std::unique_ptr createStorage(const cv::Mat& data, cv::Rect roi) { std::unique_ptr storage(new BufferStorageWithoutBorder); storage->attach(data, roi); @@ -547,10 +545,10 @@ void fluid::Buffer::Priv::allocate(BorderOpt border, m_storage->updateOutCache(m_cache, m_write_caret, m_writer_lpi); } -void fluid::Buffer::Priv::bindTo(const cv::gapi::own::Mat &data, bool is_input) +void fluid::Buffer::Priv::bindTo(const cv::Mat &data, bool is_input) { // FIXME: move all these fields into a separate structure - GAPI_Assert(m_desc == descr_of(data)); + GAPI_Assert(m_desc == cv::descr_of(data)); // Currently m_writer_lpi is obtained from metadata which is shared between islands // and this assert can trigger for slot which connects two fluid islands. @@ -669,13 +667,13 @@ fluid::Buffer::Buffer(const cv::GMatDesc &desc, m_priv->allocate(border, border_size, max_line_consumption, skew); } -fluid::Buffer::Buffer(const cv::gapi::own::Mat &data, bool is_input) +fluid::Buffer::Buffer(const cv::Mat &data, bool is_input) : m_priv(new Priv()) , m_cache(&m_priv->cache()) { int wlpi = 1, readStart = 0; cv::Rect roi{0, 0, data.cols, data.rows}; - m_priv->init(descr_of(data), wlpi, readStart, roi); + m_priv->init(cv::descr_of(data), wlpi, readStart, roi); m_priv->bindTo(data, is_input); } diff --git a/modules/gapi/src/backends/fluid/gfluidbuffer_priv.hpp b/modules/gapi/src/backends/fluid/gfluidbuffer_priv.hpp index 019fa45..d20d280 100644 --- a/modules/gapi/src/backends/fluid/gfluidbuffer_priv.hpp +++ b/modules/gapi/src/backends/fluid/gfluidbuffer_priv.hpp @@ -53,7 +53,7 @@ template<> class BorderHandlerT : public BorderHandler { cv::Scalar m_border_value; - cv::gapi::own::Mat m_const_border; + cv::Mat m_const_border; public: BorderHandlerT(int border_size, cv::Scalar border_value); @@ -65,7 +65,7 @@ public: class BufferStorage { protected: - cv::gapi::own::Mat m_data; + cv::Mat m_data; public: void updateInCache(View::Cache& cache, int start_log_idx, int nLines) const; @@ -80,8 +80,8 @@ public: inline bool empty() const { return m_data.empty(); } - inline const cv::gapi::own::Mat& data() const { return m_data; } - inline cv::gapi::own::Mat& data() { return m_data; } + inline const cv::Mat& data() const { return m_data; } + inline cv::Mat& data() { return m_data; } inline int rows() const { return m_data.rows; } inline int cols() const { return m_data.cols; } @@ -117,7 +117,7 @@ public: return m_data.ptr(physIdx(idx), 0); } - inline void attach(const cv::gapi::own::Mat& _data, cv::Rect _roi) + inline void attach(const cv::Mat& _data, cv::Rect _roi) { m_data = _data(_roi); m_roi = _roi; @@ -263,7 +263,7 @@ public: cv::Rect roi); void allocate(BorderOpt border, int border_size, int line_consumption, int skew); - void bindTo(const cv::gapi::own::Mat &data, bool is_input); + void bindTo(const cv::Mat &data, bool is_input); inline void addView(const View* view) { m_views.emplace_back(view); } diff --git a/modules/gapi/src/backends/ie/giebackend.cpp b/modules/gapi/src/backends/ie/giebackend.cpp index 3941642..f690a34 100644 --- a/modules/gapi/src/backends/ie/giebackend.cpp +++ b/modules/gapi/src/backends/ie/giebackend.cpp @@ -285,11 +285,11 @@ struct IECallContext const T& inArg(std::size_t input) { return args.at(input).get(); } // Syntax sugar - const cv::gapi::own::Mat& inMat(std::size_t input) { - return inArg(input); + const cv::Mat& inMat(std::size_t input) { + return inArg(input); } - cv::gapi::own::Mat& outMatR(std::size_t output) { - return *cv::util::get(results.at(output)); + cv::Mat& outMatR(std::size_t output) { + return *cv::util::get(results.at(output)); } template std::vector& outVecR(std::size_t output) { // FIXME: the same issue @@ -391,7 +391,7 @@ cv::GArg cv::gimpl::ie::GIEExecutable::packArg(const cv::GArg &arg) { const cv::gimpl::RcDesc &ref = arg.get(); switch (ref.shape) { - case GShape::GMAT: return GArg(m_res.slot()[ref.id]); + case GShape::GMAT: return GArg(m_res.slot()[ref.id]); // Note: .at() is intentional for GArray as object MUST be already there // (and constructed by either bindIn/Out or resetInternal) @@ -528,7 +528,7 @@ struct Infer: public cv::detail::KernelTag { // Not a big deal for classifiers and detectors, // but may be critical to segmentation. - cv::gapi::own::Mat& out_mat = ctx.outMatR(i); + cv::Mat& out_mat = ctx.outMatR(i); IE::Blob::Ptr this_blob = iec.this_request.GetBlob(uu.params.output_names[i]); copyFromIE(this_blob, out_mat); } diff --git a/modules/gapi/src/backends/ocl/goclbackend.cpp b/modules/gapi/src/backends/ocl/goclbackend.cpp index 718cd31..1eeafdb 100644 --- a/modules/gapi/src/backends/ocl/goclbackend.cpp +++ b/modules/gapi/src/backends/ocl/goclbackend.cpp @@ -96,7 +96,7 @@ cv::gimpl::GOCLExecutable::GOCLExecutable(const ade::Graph &g, if (desc.storage == Data::Storage::INTERNAL && desc.shape == GShape::GMAT) { const auto mat_desc = util::get(desc.meta); - auto& mat = m_res.slot()[desc.rc]; + auto& mat = m_res.slot()[desc.rc]; createMat(mat_desc, mat); } break; diff --git a/modules/gapi/src/backends/plaidml/gplaidmlbackend.cpp b/modules/gapi/src/backends/plaidml/gplaidmlbackend.cpp index fcd52c9..b9d365f 100644 --- a/modules/gapi/src/backends/plaidml/gplaidmlbackend.cpp +++ b/modules/gapi/src/backends/plaidml/gplaidmlbackend.cpp @@ -212,20 +212,12 @@ void cv::gimpl::GPlaidMLExecutable::bindInArg(const RcDesc &rc, const GRunArg & switch (arg.index()) { - case GRunArg::index_of(): - { - auto& arg_mat = util::get(arg); - binder_->input(it->second).copy_from(arg_mat.data); - } - break; -#if !defined(GAPI_STANDALONE) case GRunArg::index_of() : { auto& arg_mat = util::get(arg); binder_->input(it->second).copy_from(arg_mat.data); } break; -#endif // !defined(GAPI_STANDALONE) default: util::throw_error(std::logic_error("content type of the runtime argument does not match to resource description ?")); } } @@ -248,20 +240,12 @@ void cv::gimpl::GPlaidMLExecutable::bindOutArg(const RcDesc &rc, const GRunArgP switch (arg.index()) { - case GRunArgP::index_of(): - { - auto& arg_mat = *util::get(arg); - binder_->output(it->second).copy_into(arg_mat.data); - } - break; -#if !defined(GAPI_STANDALONE) case GRunArgP::index_of() : { auto& arg_mat = *util::get(arg); binder_->output(it->second).copy_into(arg_mat.data); } break; -#endif // !defined(GAPI_STANDALONE) default: util::throw_error(std::logic_error("content type of the runtime argument does not match to resource description ?")); } } diff --git a/modules/gapi/src/backends/render/grenderocvbackend.cpp b/modules/gapi/src/backends/render/grenderocvbackend.cpp index 4fde80b..05b0285 100644 --- a/modules/gapi/src/backends/render/grenderocvbackend.cpp +++ b/modules/gapi/src/backends/render/grenderocvbackend.cpp @@ -113,7 +113,7 @@ cv::GArg cv::gimpl::render::ocv::GRenderExecutable::packArg(const cv::GArg &arg) const cv::gimpl::RcDesc &ref = arg.get(); switch (ref.shape) { - case GShape::GMAT: return GArg(m_res.slot()[ref.id]); + case GShape::GMAT: return GArg(m_res.slot()[ref.id]); case GShape::GARRAY: return GArg(m_res.slot().at(ref.id)); default: util::throw_error(std::logic_error("Unsupported GShape type")); diff --git a/modules/gapi/src/compiler/gislandmodel.cpp b/modules/gapi/src/compiler/gislandmodel.cpp index 7406ea0..a135123 100644 --- a/modules/gapi/src/compiler/gislandmodel.cpp +++ b/modules/gapi/src/compiler/gislandmodel.cpp @@ -348,7 +348,7 @@ void GIslandExecutable::run(GIslandExecutable::IInput &in, GIslandExecutable::IO switch (in_data_orig.index()) { case cv::GRunArg::index_of(): - in_data = cv::GRunArg{cv::to_own(cv::util::get(in_data_orig))}; + in_data = cv::GRunArg{cv::util::get(in_data_orig)}; break; case cv::GRunArg::index_of(): in_data = cv::GRunArg{(cv::util::get(in_data_orig))}; diff --git a/modules/gapi/src/executor/gexecutor.cpp b/modules/gapi/src/executor/gexecutor.cpp index 053a8d2..a5351c6 100644 --- a/modules/gapi/src/executor/gexecutor.cpp +++ b/modules/gapi/src/executor/gexecutor.cpp @@ -100,7 +100,7 @@ void cv::gimpl::GExecutor::initResource(const ade::NodeHandle &orig_nh) case GShape::GMAT: { const auto desc = util::get(d.meta); - auto& mat = m_res.slot()[d.rc]; + auto& mat = m_res.slot()[d.rc]; createMat(desc, mat); } break; @@ -182,7 +182,7 @@ void cv::gimpl::GExecutor::run(cv::gimpl::GRuntimeArgs &&args) auto check_own_mat = [&desc, &args, &index]() { - auto& out_mat = *get(args.outObjs.at(index)); + auto& out_mat = *get(args.outObjs.at(index)); GAPI_Assert(out_mat.data != nullptr && desc.canDescribe(out_mat)); }; diff --git a/modules/gapi/src/executor/gstreamingexecutor.cpp b/modules/gapi/src/executor/gstreamingexecutor.cpp index 52433b5..92733b0 100644 --- a/modules/gapi/src/executor/gstreamingexecutor.cpp +++ b/modules/gapi/src/executor/gstreamingexecutor.cpp @@ -98,8 +98,6 @@ std::vector input_queues( ade::Graph &g, void sync_data(cv::GRunArgs &results, cv::GRunArgsP &outputs) { - namespace own = cv::gapi::own; - for (auto && it : ade::util::zip(ade::util::toRange(outputs), ade::util::toRange(results))) { @@ -110,14 +108,9 @@ void sync_data(cv::GRunArgs &results, cv::GRunArgsP &outputs) using T = cv::GRunArgP; switch (out_obj.index()) { -#if !defined(GAPI_STANDALONE) case T::index_of(): *cv::util::get(out_obj) = std::move(cv::util::get(res_obj)); break; -#endif // !GAPI_STANDALONE - case T::index_of(): - *cv::util::get(out_obj) = std::move(cv::util::get(res_obj)); - break; case T::index_of(): *cv::util::get(out_obj) = std::move(cv::util::get(res_obj)); break; @@ -420,13 +413,8 @@ class StreamingOutput final: public cv::gimpl::GIslandExecutable::IOutput // Prepare this object for posting virtual cv::GRunArgP get(int idx) override { -#if !defined(GAPI_STANDALONE) using MatType = cv::Mat; using SclType = cv::Scalar; -#else - using MatType = cv::gapi::own::Mat; - using SclType = cv::gapi::own::Scalar; -#endif // GAPI_STANDALONE // Allocate a new posting first, then bind this GRunArgP to this item auto iter = m_postings[idx].insert(m_postings[idx].end(), Posting{}); diff --git a/modules/gapi/test/gapi_async_test.cpp b/modules/gapi/test/gapi_async_test.cpp index 3e5bec9..66b8be4 100644 --- a/modules/gapi/test/gapi_async_test.cpp +++ b/modules/gapi/test/gapi_async_test.cpp @@ -386,11 +386,8 @@ namespace { for (auto&& arg : args){ //FIXME: replace this switch with use of visit() on variant, when it will be available switch (arg.index()){ - #if !defined(GAPI_STANDALONE) - case GRunArgP::index_of() : result.emplace_back(*util::get(arg)); break; case GRunArgP::index_of() : result.emplace_back(*util::get(arg)); break; - #endif // !defined(GAPI_STANDALONE) - case GRunArgP::index_of() : result.emplace_back(*util::get (arg)); break; + case GRunArgP::index_of() : result.emplace_back(*util::get(arg)); break; case GRunArgP::index_of() : result.emplace_back(*util::get (arg)); break; case GRunArgP::index_of() : result.emplace_back(util::get (arg)); break; default : ; @@ -403,11 +400,8 @@ namespace { GRunArgsP result; result.reserve(args.size()); for (auto&& arg : args){ switch (arg.index()){ - #if !defined(GAPI_STANDALONE) case GRunArg::index_of() : result.emplace_back(&util::get(arg)); break; case GRunArg::index_of() : result.emplace_back(&util::get(arg)); break; - #endif // !defined(GAPI_STANDALONE) - case GRunArg::index_of() : result.emplace_back(&util::get (arg)); break; case GRunArg::index_of() : result.emplace_back(&util::get (arg)); break; case GRunArg::index_of() : result.emplace_back(util::get (arg)); break; default : ; diff --git a/modules/gapi/test/gapi_desc_tests.cpp b/modules/gapi/test/gapi_desc_tests.cpp index 86000d9..1eae722 100644 --- a/modules/gapi/test/gapi_desc_tests.cpp +++ b/modules/gapi/test/gapi_desc_tests.cpp @@ -137,23 +137,6 @@ TEST(GAPI_MetaDesc, OwnMatDescND) EXPECT_TRUE(desc.isND()); } -TEST(GAPI_MetaDesc, CanDescribeOwnMat) -{ - constexpr int w = 15; - constexpr int h = 7; - cv::gapi::own::Mat m0(h, w, CV_8UC3, nullptr); - cv::GMatDesc md0{CV_8U,3,{w,h},false}; - - cv::gapi::own::Mat m1(h*3, w, CV_8UC1, nullptr); - cv::GMatDesc md10{CV_8U,3,{w,h},true}; - cv::GMatDesc md11{CV_8U,1,{w,h*3},false}; - - EXPECT_TRUE (md0 .canDescribe(m0)); - EXPECT_FALSE(md0 .canDescribe(m1)); - EXPECT_TRUE (md10.canDescribe(m1)); - EXPECT_TRUE (md11.canDescribe(m1)); -} - TEST(GAPI_MetaDesc, VecOwnMatDesc) { std::vector vec = { diff --git a/modules/gapi/test/gapi_fluid_test.cpp b/modules/gapi/test/gapi_fluid_test.cpp index 07646e0..1178223 100644 --- a/modules/gapi/test/gapi_fluid_test.cpp +++ b/modules/gapi/test/gapi_fluid_test.cpp @@ -50,7 +50,7 @@ TEST(FluidBuffer, InputTest) const cv::Size buffer_size = {8,8}; cv::Mat in_mat = cv::Mat::eye(buffer_size, CV_8U); - cv::gapi::fluid::Buffer buffer(to_own(in_mat), true); + cv::gapi::fluid::Buffer buffer(in_mat, true); cv::gapi::fluid::View view = buffer.mkView(0, false); view.priv().allocate(1, {}); view.priv().reset(1); @@ -155,7 +155,7 @@ TEST(FluidBuffer, OutputTest) const cv::Size buffer_size = {8,16}; cv::Mat out_mat = cv::Mat(buffer_size, CV_8U); - cv::gapi::fluid::Buffer buffer(to_own(out_mat), false); + cv::gapi::fluid::Buffer buffer(out_mat, false); int num_writes = 0; while (num_writes < buffer_size.height) { diff --git a/modules/gapi/test/gapi_sample_pipelines.cpp b/modules/gapi/test/gapi_sample_pipelines.cpp index c530a01..b4d9f3e 100644 --- a/modules/gapi/test/gapi_sample_pipelines.cpp +++ b/modules/gapi/test/gapi_sample_pipelines.cpp @@ -327,21 +327,6 @@ TEST(GAPI_Pipeline, PipelineAllocatingKernel) EXPECT_THROW(comp.apply(in_mat, out_mat, cv::compile_args(pkg)), std::logic_error); } -TEST(GAPI_Pipeline, CanUseOwnMatAsOutput) -{ - cv::GMat in; - cv::GComputation comp(in, cv::gapi::bitwise_not(in)); - - cv::Mat in_mat(3, 3, CV_8UC1); - cv::Mat out_mat(3, 3, CV_8UC1); - - cv::gapi::own::Mat in_own_mat(in_mat.rows, in_mat.cols, CV_8UC1, in_mat.data); - cv::gapi::own::Mat out_own_mat(out_mat.rows, out_mat.cols, CV_8UC1, out_mat.data); - - // FIXME add overload for apply(cv::gapi::own::Mat in, cv::gapi::own::Mat& out) - EXPECT_NO_THROW(comp.apply({in_own_mat}, {out_own_mat})); -} - TEST(GAPI_Pipeline, CreateKernelImplFromLambda) { cv::Size size(300, 300); diff --git a/modules/gapi/test/own/mat_tests.cpp b/modules/gapi/test/own/mat_tests.cpp index b063c45..0ddc201 100644 --- a/modules/gapi/test/own/mat_tests.cpp +++ b/modules/gapi/test/own/mat_tests.cpp @@ -7,6 +7,7 @@ #include "../test_precomp.hpp" #include +#include #include //suppress_unused_warning namespace opencv_test -- 2.7.4