From 277f0d270fd77ffc3e22c9f08025207b4f384ef3 Mon Sep 17 00:00:00 2001 From: Maxim Pashchenkov Date: Thu, 2 Apr 2020 21:19:45 +0300 Subject: [PATCH] Merge pull request #16745 from Volskig:mp/ocv-gapi-standalone-size G-API: Unification of own:: structures with cv:: (Size, Point, Rect) * deowned Size Rect Point * Deownded Size Rect Point * With Scalar --- .../opencv2/gapi/fluid/gfluidkernel.hpp | 3 +- modules/gapi/include/opencv2/gapi/gmat.hpp | 22 +++--------- .../gapi/include/opencv2/gapi/own/convert.hpp | 11 ------ .../gapi/include/opencv2/gapi/own/cvdefs.hpp | 4 +++ modules/gapi/src/api/gbackend.cpp | 4 +-- modules/gapi/src/api/gmat.cpp | 1 - modules/gapi/src/backends/cpu/gcpuimgproc.cpp | 4 +-- .../gapi/src/backends/fluid/gfluidbackend.cpp | 36 +++++++++---------- .../gapi/src/backends/fluid/gfluidbackend.hpp | 6 ++-- .../gapi/src/backends/fluid/gfluidbuffer.cpp | 23 ++++++------ .../src/backends/fluid/gfluidbuffer_priv.hpp | 14 ++++---- .../gapi/src/backends/fluid/gfluidcore.cpp | 2 +- .../gapi/src/backends/fluid/gfluidimgproc.cpp | 22 ++++++------ .../test/gapi_fluid_parallel_rois_test.cpp | 2 +- modules/gapi/test/gapi_fluid_resize_test.cpp | 4 +-- modules/gapi/test/gapi_fluid_roi_test.cpp | 6 ++-- modules/gapi/test/gapi_fluid_test.cpp | 4 +-- modules/gapi/test/gapi_gcompiled_tests.cpp | 6 ++-- modules/gapi/test/gapi_gcomputation_tests.cpp | 4 +-- .../internal/gapi_int_island_fusion_tests.cpp | 22 ++++++------ .../internal/gapi_int_recompilation_test.cpp | 2 +- 21 files changed, 88 insertions(+), 114 deletions(-) diff --git a/modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp b/modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp index 437bea6b1a..0f1164004b 100644 --- a/modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp +++ b/modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include @@ -109,7 +108,7 @@ public: */ struct GFluidOutputRois { - std::vector rois; + std::vector rois; }; /** diff --git a/modules/gapi/include/opencv2/gapi/gmat.hpp b/modules/gapi/include/opencv2/gapi/gmat.hpp index d05d151698..ffe1c07206 100644 --- a/modules/gapi/include/opencv2/gapi/gmat.hpp +++ b/modules/gapi/include/opencv2/gapi/gmat.hpp @@ -14,8 +14,6 @@ #include #include // GShape -#include // cv::gapi::own::Size -#include // to_own #include // TODO GAPI_EXPORTS or so @@ -82,11 +80,11 @@ struct GAPI_EXPORTS GMatDesc // FIXME: Default initializers in C++14 int depth; int chan; - cv::gapi::own::Size size; // NB.: no multi-dimensional cases covered yet + cv::Size size; // NB.: no multi-dimensional cases covered yet bool planar; std::vector dims; // FIXME: Maybe it's real questionable to have it here - GMatDesc(int d, int c, cv::gapi::own::Size s, bool p = false) + GMatDesc(int d, int c, cv::Size s, bool p = false) : depth(d), chan(c), size(s), planar(p) {} GMatDesc(int d, const std::vector &dd) @@ -122,23 +120,13 @@ struct GAPI_EXPORTS GMatDesc // Meta combinator: return a new GMatDesc which differs in size by delta // (all other fields are taken unchanged from this GMatDesc) // FIXME: a better name? - GMatDesc withSizeDelta(cv::gapi::own::Size delta) const + GMatDesc withSizeDelta(cv::Size delta) const { GMatDesc desc(*this); desc.size += delta; return desc; } #if !defined(GAPI_STANDALONE) - GMatDesc withSizeDelta(cv::Size delta) const - { - return withSizeDelta(to_own(delta)); - } - - GMatDesc withSize(cv::Size sz) const - { - return withSize(to_own(sz)); - } - bool canDescribe(const cv::Mat& mat) const; #endif // !defined(GAPI_STANDALONE) // Meta combinator: return a new GMatDesc which differs in size by delta @@ -147,10 +135,10 @@ struct GAPI_EXPORTS GMatDesc // This is an overload. GMatDesc withSizeDelta(int dx, int dy) const { - return withSizeDelta(cv::gapi::own::Size{dx,dy}); + return withSizeDelta(cv::Size{dx,dy}); } - GMatDesc withSize(cv::gapi::own::Size sz) const + GMatDesc withSize(cv::Size sz) const { GMatDesc desc(*this); desc.size = sz; diff --git a/modules/gapi/include/opencv2/gapi/own/convert.hpp b/modules/gapi/include/opencv2/gapi/own/convert.hpp index 52a58eb72b..58f291c245 100644 --- a/modules/gapi/include/opencv2/gapi/own/convert.hpp +++ b/modules/gapi/include/opencv2/gapi/own/convert.hpp @@ -11,7 +11,6 @@ #if !defined(GAPI_STANDALONE) #include -#include #include namespace cv @@ -33,12 +32,6 @@ namespace cv ? cv::gapi::own::Mat{m.rows, m.cols, m.type(), m.data, m.step} : cv::gapi::own::Mat{to_own(m.size), m.type(), m.data}; }; - - inline cv::gapi::own::Size to_own (const Size& s) { return {s.width, s.height}; }; - - inline cv::gapi::own::Rect to_own (const Rect& r) { return {r.x, r.y, r.width, r.height}; }; - - namespace gapi { namespace own @@ -49,10 +42,6 @@ namespace own : cv::Mat{m.dims, m.type(), m.data}; } cv::Mat to_ocv(Mat&&) = delete; - inline cv::Size to_ocv (const Size& s) { return cv::Size(s.width, s.height); }; - - inline cv::Rect to_ocv (const Rect& r) { return cv::Rect(r.x, r.y, r.width, r.height); }; - } // namespace own } // namespace gapi } // namespace cv diff --git a/modules/gapi/include/opencv2/gapi/own/cvdefs.hpp b/modules/gapi/include/opencv2/gapi/own/cvdefs.hpp index 1a2ea7787e..354609bbc8 100644 --- a/modules/gapi/include/opencv2/gapi/own/cvdefs.hpp +++ b/modules/gapi/include/opencv2/gapi/own/cvdefs.hpp @@ -9,6 +9,7 @@ #define OPENCV_GAPI_CV_DEFS_HPP #if defined(GAPI_STANDALONE) +#include // cv::gapi::own::Rect/Size/Point #include // cv::gapi::own::Scalar // Simulate OpenCV definitions taken from various @@ -139,6 +140,9 @@ enum InterpolationFlags{ INTER_MAX = 7, }; // replacement of cv's structures: +using Rect = gapi::own::Rect; +using Size = gapi::own::Size; +using Point = gapi::own::Point; using Scalar = gapi::own::Scalar; } // namespace cv diff --git a/modules/gapi/src/api/gbackend.cpp b/modules/gapi/src/api/gbackend.cpp index 284719e4ea..24281ba326 100644 --- a/modules/gapi/src/api/gbackend.cpp +++ b/modules/gapi/src/api/gbackend.cpp @@ -395,7 +395,7 @@ void createMat(const cv::GMatDesc &desc, cv::gapi::own::Mat& mat) if (desc.dims.empty()) { const auto type = desc.planar ? desc.depth : CV_MAKETYPE(desc.depth, desc.chan); - const auto size = desc.planar ? cv::gapi::own::Size{desc.size.width, desc.size.height*desc.chan} + const auto size = desc.planar ? cv::Size{desc.size.width, desc.size.height*desc.chan} : desc.size; mat.create(size, type); } @@ -414,7 +414,7 @@ void createMat(const cv::GMatDesc &desc, cv::Mat& mat) { 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} - : cv::gapi::own::to_ocv(desc.size); + : desc.size; mat.create(size, type); } else diff --git a/modules/gapi/src/api/gmat.cpp b/modules/gapi/src/api/gmat.cpp index 006e99fab4..a108c514c3 100644 --- a/modules/gapi/src/api/gmat.cpp +++ b/modules/gapi/src/api/gmat.cpp @@ -10,7 +10,6 @@ #include #include -#include #include //gapi::own::Mat #include diff --git a/modules/gapi/src/backends/cpu/gcpuimgproc.cpp b/modules/gapi/src/backends/cpu/gcpuimgproc.cpp index b1078c5a03..29328c4969 100644 --- a/modules/gapi/src/backends/cpu/gcpuimgproc.cpp +++ b/modules/gapi/src/backends/cpu/gcpuimgproc.cpp @@ -353,7 +353,7 @@ G_TYPED_KERNEL(GYUV2Gray, , "yuvtogray") { * U V U V U V U V */ - return {CV_8U, 1, cv::gapi::own::Size{in.size.width, in.size.height - (in.size.height / 3)}, false}; + return {CV_8U, 1, cv::Size{in.size.width, in.size.height - (in.size.height / 3)}, false}; } }; @@ -367,7 +367,7 @@ GAPI_OCV_KERNEL(GCPUYUV2Gray, GYUV2Gray) G_TYPED_KERNEL(GConcatYUVPlanes, , "concatyuvplanes") { static cv::GMatDesc outMeta(cv::GMatDesc y, cv::GMatDesc uv) { - return {CV_8U, 1, cv::gapi::own::Size{y.size.width, y.size.height + uv.size.height}, false}; + return {CV_8U, 1, cv::Size{y.size.width, y.size.height + uv.size.height}, false}; } }; diff --git a/modules/gapi/src/backends/fluid/gfluidbackend.cpp b/modules/gapi/src/backends/fluid/gfluidbackend.cpp index 98a696c337..735e98953c 100644 --- a/modules/gapi/src/backends/fluid/gfluidbackend.cpp +++ b/modules/gapi/src/backends/fluid/gfluidbackend.cpp @@ -554,8 +554,8 @@ void cv::gimpl::FluidAgent::debug(std::ostream &os) // GCPUExcecutable implementation ////////////////////////////////////////////// void cv::gimpl::GFluidExecutable::initBufferRois(std::vector& readStarts, - std::vector& rois, - const std::vector& out_rois) + std::vector& rois, + const std::vector& out_rois) { GConstFluidModel fg(m_g); auto proto = m_gm.metadata().get(); @@ -592,9 +592,9 @@ void cv::gimpl::GFluidExecutable::initBufferRois(std::vector& readStarts, readStarts[id] = 0; const auto& out_roi = out_rois[idx]; - if (out_roi == gapi::own::Rect{}) + if (out_roi == cv::Rect{}) { - rois[id] = gapi::own::Rect{ 0, 0, desc.size.width, desc.size.height }; + rois[id] = cv::Rect{ 0, 0, desc.size.width, desc.size.height }; } else { @@ -639,14 +639,14 @@ void cv::gimpl::GFluidExecutable::initBufferRois(std::vector& readStarts, const auto& in_meta = util::get(in_data.meta); const auto& fd = fg.metadata(in_node).get(); - auto adjFilterRoi = [](cv::gapi::own::Rect produced, int b, int max_height) { + auto adjFilterRoi = [](cv::Rect produced, int b, int max_height) { // Extend with border roi which should be produced, crop to logical image size - cv::gapi::own::Rect roi = {produced.x, produced.y - b, produced.width, produced.height + 2*b}; - cv::gapi::own::Rect fullImg{ 0, 0, produced.width, max_height }; + cv::Rect roi = {produced.x, produced.y - b, produced.width, produced.height + 2*b}; + cv::Rect fullImg{ 0, 0, produced.width, max_height }; return roi & fullImg; }; - auto adjResizeRoi = [](cv::gapi::own::Rect produced, cv::gapi::own::Size inSz, cv::gapi::own::Size outSz) { + auto adjResizeRoi = [](cv::Rect produced, cv::Size inSz, cv::Size outSz) { auto map = [](int outCoord, int producedSz, int inSize, int outSize) { double ratio = (double)inSize / outSize; int w0 = 0, w1 = 0; @@ -671,30 +671,30 @@ void cv::gimpl::GFluidExecutable::initBufferRois(std::vector& readStarts, auto x0 = mapX.first; auto x1 = mapX.second; - cv::gapi::own::Rect roi = {x0, y0, x1 - x0, y1 - y0}; + cv::Rect roi = {x0, y0, x1 - x0, y1 - y0}; return roi; }; - auto adj420Roi = [&](cv::gapi::own::Rect produced, std::size_t port) { + auto adj420Roi = [&](cv::Rect produced, std::size_t port) { GAPI_Assert(produced.x % 2 == 0); GAPI_Assert(produced.y % 2 == 0); GAPI_Assert(produced.width % 2 == 0); GAPI_Assert(produced.height % 2 == 0); - cv::gapi::own::Rect roi; + cv::Rect roi; switch (port) { case 0: roi = produced; break; case 1: - case 2: roi = cv::gapi::own::Rect{ produced.x/2, produced.y/2, produced.width/2, produced.height/2 }; break; + case 2: roi = cv::Rect{ produced.x/2, produced.y/2, produced.width/2, produced.height/2 }; break; default: GAPI_Assert(false); } return roi; }; - cv::gapi::own::Rect produced = rois[m_id_map.at(data.rc)]; + cv::Rect produced = rois[m_id_map.at(data.rc)]; // Apply resize-specific roi transformations - cv::gapi::own::Rect resized; + cv::Rect resized; switch (fg.metadata(oh).get().k.m_kind) { case GFluidKernel::Kind::Filter: resized = produced; break; @@ -727,7 +727,7 @@ void cv::gimpl::GFluidExecutable::initBufferRois(std::vector& readStarts, auto roi = adjFilterRoi(resized, fd.border_size, in_meta.size.height); auto in_id = m_id_map.at(in_data.rc); - if (rois[in_id] == cv::gapi::own::Rect{}) + if (rois[in_id] == cv::Rect{}) { readStarts[in_id] = readStart; rois[in_id] = roi; @@ -828,7 +828,7 @@ cv::gimpl::FluidGraphInputData cv::gimpl::fluidExtractInputDataFromGraph(const a cv::gimpl::GFluidExecutable::GFluidExecutable(const ade::Graph &g, const cv::gimpl::FluidGraphInputData &traverse_res, - const std::vector &outputRois) + const std::vector &outputRois) : m_g(g), m_gm(m_g), m_num_int_buffers (traverse_res.m_mat_count), m_scratch_users (traverse_res.m_scratch_users), @@ -1146,13 +1146,13 @@ namespace } } -void cv::gimpl::GFluidExecutable::makeReshape(const std::vector &out_rois) +void cv::gimpl::GFluidExecutable::makeReshape(const std::vector &out_rois) { GConstFluidModel fg(m_g); // Calculate rois for each fluid buffer std::vector readStarts(m_num_int_buffers); - std::vector rois(m_num_int_buffers); + std::vector rois(m_num_int_buffers); initBufferRois(readStarts, rois, out_rois); // NB: Allocate ALL buffer object at once, and avoid any further reallocations diff --git a/modules/gapi/src/backends/fluid/gfluidbackend.hpp b/modules/gapi/src/backends/fluid/gfluidbackend.hpp index d100ca5d9e..74336f20a3 100644 --- a/modules/gapi/src/backends/fluid/gfluidbackend.hpp +++ b/modules/gapi/src/backends/fluid/gfluidbackend.hpp @@ -142,8 +142,8 @@ class GFluidExecutable final: public GIslandExecutable void bindOutArg(const RcDesc &rc, const GRunArgP &arg); void packArg (GArg &in_arg, const GArg &op_arg); - void initBufferRois(std::vector& readStarts, std::vector& rois, const std::vector &out_rois); - void makeReshape(const std::vector& out_rois); + void initBufferRois(std::vector& readStarts, std::vector& rois, const std::vector &out_rois); + void makeReshape(const std::vector& out_rois); std::size_t total_buffers_size() const; public: @@ -159,7 +159,7 @@ public: GFluidExecutable(const ade::Graph &g, const FluidGraphInputData &graph_data, - const std::vector &outputRois); + const std::vector &outputRois); }; diff --git a/modules/gapi/src/backends/fluid/gfluidbuffer.cpp b/modules/gapi/src/backends/fluid/gfluidbuffer.cpp index b262260987..22a9d9e0b3 100644 --- a/modules/gapi/src/backends/fluid/gfluidbuffer.cpp +++ b/modules/gapi/src/backends/fluid/gfluidbuffer.cpp @@ -9,9 +9,6 @@ #include // hex, dec (debug) -#include -#include - #include #include "backends/fluid/gfluidbuffer_priv.hpp" #include @@ -271,8 +268,8 @@ 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) { - auto subSrc = src(cv::gapi::own::Rect{src_border_size, startSrcLine, src.cols - 2*src_border_size, lpi}); - auto subDst = dst(cv::gapi::own::Rect{dst_border_size, startDstLine, dst.cols - 2*dst_border_size, 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}); subSrc.copyTo(subDst); } @@ -365,8 +362,8 @@ std::unique_ptr createStorage(int capacity, int desc_width #endif } -std::unique_ptr createStorage(const cv::gapi::own::Mat& data, cv::gapi::own::Rect roi); -std::unique_ptr createStorage(const cv::gapi::own::Mat& data, cv::gapi::own::Rect roi) +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 storage(new BufferStorageWithoutBorder); storage->attach(data, roi); @@ -504,7 +501,7 @@ void fluid::View::Priv::initCache(int lineConsumption) // Fluid Buffer implementation ///////////////////////////////////////////////// -fluid::Buffer::Priv::Priv(int read_start, cv::gapi::own::Rect roi) +fluid::Buffer::Priv::Priv(int read_start, cv::Rect roi) : m_readStart(read_start) , m_roi(roi) {} @@ -512,12 +509,12 @@ fluid::Buffer::Priv::Priv(int read_start, cv::gapi::own::Rect roi) void fluid::Buffer::Priv::init(const cv::GMatDesc &desc, int writer_lpi, int readStartPos, - cv::gapi::own::Rect roi) + cv::Rect roi) { m_writer_lpi = writer_lpi; m_desc = desc; m_readStart = readStartPos; - m_roi = roi == own::Rect{} ? own::Rect{ 0, 0, desc.size.width, desc.size.height } + m_roi = roi == cv::Rect{} ? cv::Rect{ 0, 0, desc.size.width, desc.size.height } : roi; m_cache.m_linePtrs.resize(writer_lpi); m_cache.m_desc = desc; @@ -652,7 +649,7 @@ fluid::Buffer::Buffer(const cv::GMatDesc &desc) { int lineConsumption = 1; int border = 0, skew = 0, wlpi = 1, readStart = 0; - cv::gapi::own::Rect roi = {0, 0, desc.size.width, desc.size.height}; + cv::Rect roi = {0, 0, desc.size.width, desc.size.height}; m_priv->init(desc, wlpi, readStart, roi); m_priv->allocate({}, border, lineConsumption, skew); } @@ -667,7 +664,7 @@ fluid::Buffer::Buffer(const cv::GMatDesc &desc, , m_cache(&m_priv->cache()) { int readStart = 0; - cv::gapi::own::Rect roi = {0, 0, desc.size.width, desc.size.height}; + cv::Rect roi = {0, 0, desc.size.width, desc.size.height}; m_priv->init(desc, wlpi, readStart, roi); m_priv->allocate(border, border_size, max_line_consumption, skew); } @@ -677,7 +674,7 @@ fluid::Buffer::Buffer(const cv::gapi::own::Mat &data, bool is_input) , m_cache(&m_priv->cache()) { int wlpi = 1, readStart = 0; - cv::gapi::own::Rect roi{0, 0, data.cols, data.rows}; + cv::Rect roi{0, 0, data.cols, data.rows}; m_priv->init(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 e62cf4f277..65fa9d40cd 100644 --- a/modules/gapi/src/backends/fluid/gfluidbuffer_priv.hpp +++ b/modules/gapi/src/backends/fluid/gfluidbuffer_priv.hpp @@ -101,23 +101,23 @@ public: class BufferStorageWithoutBorder final : public BufferStorage { bool m_is_virtual = true; - cv::gapi::own::Rect m_roi; + cv::Rect m_roi; public: virtual void copyTo(BufferStorageWithBorder &dst, int startLine, int nLines) const override; inline virtual const uint8_t* ptr(int idx) const override { - GAPI_DbgAssert((m_is_virtual && m_roi == cv::gapi::own::Rect{}) || (!m_is_virtual && m_roi != cv::gapi::own::Rect{})); + GAPI_DbgAssert((m_is_virtual && m_roi == cv::Rect{}) || (!m_is_virtual && m_roi != cv::Rect{})); return m_data.ptr(physIdx(idx), 0); } inline virtual uint8_t* ptr(int idx) override { - GAPI_DbgAssert((m_is_virtual && m_roi == cv::gapi::own::Rect{}) || (!m_is_virtual && m_roi != cv::gapi::own::Rect{})); + GAPI_DbgAssert((m_is_virtual && m_roi == cv::Rect{}) || (!m_is_virtual && m_roi != cv::Rect{})); return m_data.ptr(physIdx(idx), 0); } - inline void attach(const cv::gapi::own::Mat& _data, cv::gapi::own::Rect _roi) + inline void attach(const cv::gapi::own::Mat& _data, cv::Rect _roi) { m_data = _data(_roi); m_roi = _roi; @@ -246,13 +246,13 @@ class GAPI_EXPORTS Buffer::Priv // Coordinate starting from which this buffer is assumed // to be read (with border not being taken into account) int m_readStart; - cv::gapi::own::Rect m_roi; + cv::Rect m_roi; friend void debugBufferPriv(const Buffer& p, std::ostream &os); public: Priv() = default; - Priv(int read_start, cv::gapi::own::Rect roi); + Priv(int read_start, cv::Rect roi); inline const BufferStorage& storage() const { return *m_storage.get(); } @@ -260,7 +260,7 @@ public: void init(const cv::GMatDesc &desc, int writer_lpi, int readStart, - cv::gapi::own::Rect roi); + 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); diff --git a/modules/gapi/src/backends/fluid/gfluidcore.cpp b/modules/gapi/src/backends/fluid/gfluidcore.cpp index 1a3d66f891..01b9be8447 100644 --- a/modules/gapi/src/backends/fluid/gfluidcore.cpp +++ b/modules/gapi/src/backends/fluid/gfluidcore.cpp @@ -2040,7 +2040,7 @@ GAPI_FLUID_KERNEL(GFluidResize, cv::gapi::core::GResize, true) cv::GMatDesc desc; desc.chan = 1; desc.depth = CV_8UC1; - desc.size = to_own(scratch_size); + desc.size = scratch_size; cv::gapi::fluid::Buffer buffer(desc); scratch = std::move(buffer); diff --git a/modules/gapi/src/backends/fluid/gfluidimgproc.cpp b/modules/gapi/src/backends/fluid/gfluidimgproc.cpp index d7993c5c5c..7ddf91e122 100644 --- a/modules/gapi/src/backends/fluid/gfluidimgproc.cpp +++ b/modules/gapi/src/backends/fluid/gfluidimgproc.cpp @@ -15,8 +15,6 @@ #include #include -#include - #include #include #include @@ -451,7 +449,7 @@ GAPI_FLUID_KERNEL(GFluidBlur, cv::gapi::imgproc::GBlur, true) int buflen = width * chan * Window; // work buffers - cv::gapi::own::Size bufsize(buflen, 1); + cv::Size bufsize(buflen, 1); GMatDesc bufdesc = {CV_32F, 1, bufsize}; Buffer buffer(bufdesc); scratch = std::move(buffer); @@ -526,7 +524,7 @@ GAPI_FLUID_KERNEL(GFluidBoxFilter, cv::gapi::imgproc::GBoxFilter, true) int buflen = width * chan * Window; // work buffers - cv::gapi::own::Size bufsize(buflen, 1); + cv::Size bufsize(buflen, 1); GMatDesc bufdesc = {CV_32F, 1, bufsize}; Buffer buffer(bufdesc); scratch = std::move(buffer); @@ -748,7 +746,7 @@ GAPI_FLUID_KERNEL(GFluidSepFilter, cv::gapi::imgproc::GSepFilter, true) int buflen = kxLen + kyLen + // x, y kernels width * chan * Window; // work buffers - cv::gapi::own::Size bufsize(buflen, 1); + cv::Size bufsize(buflen, 1); GMatDesc bufdesc = {CV_32F, 1, bufsize}; Buffer buffer(bufdesc); scratch = std::move(buffer); @@ -851,7 +849,7 @@ GAPI_FLUID_KERNEL(GFluidGaussBlur, cv::gapi::imgproc::GGaussBlur, true) int buflen = kxsize + kysize + // x, y kernels width * chan * ksize.height; // work buffers - cv::gapi::own::Size bufsize(buflen, 1); + cv::Size bufsize(buflen, 1); GMatDesc bufdesc = {CV_32F, 1, bufsize}; Buffer buffer(bufdesc); scratch = std::move(buffer); @@ -1016,7 +1014,7 @@ GAPI_FLUID_KERNEL(GFluidSobel, cv::gapi::imgproc::GSobel, true) int buflen = ksz + ksz // kernels: kx, ky + ksz * width * chan; // working buffers - cv::gapi::own::Size bufsize(buflen, 1); + cv::Size bufsize(buflen, 1); GMatDesc bufdesc = {CV_32F, 1, bufsize}; Buffer buffer(bufdesc); scratch = std::move(buffer); @@ -1171,7 +1169,7 @@ GAPI_FLUID_KERNEL(GFluidSobelXY, cv::gapi::imgproc::GSobelXY, true) int chan = in.chan; int buflen = BufHelper::length(ksz, width, chan); - cv::gapi::own::Size bufsize(buflen, 1); + cv::Size bufsize(buflen, 1); GMatDesc bufdesc = {CV_32F, 1, bufsize}; Buffer buffer(bufdesc); scratch = std::move(buffer); @@ -1319,7 +1317,7 @@ GAPI_FLUID_KERNEL(GFluidFilter2D, cv::gapi::imgproc::GFilter2D, true) int buflen = krows * kcols; // kernel size - cv::gapi::own::Size bufsize(buflen, 1); + cv::Size bufsize(buflen, 1); GMatDesc bufdesc = {CV_32F, 1, bufsize}; Buffer buffer(bufdesc); scratch = std::move(buffer); @@ -1496,7 +1494,7 @@ GAPI_FLUID_KERNEL(GFluidErode, cv::gapi::imgproc::GErode, true) int k_cols = kernel.cols; int k_size = k_rows * k_cols; - cv::gapi::own::Size bufsize(k_size + 1, 1); + cv::Size bufsize(k_size + 1, 1); GMatDesc bufdesc = {CV_8U, 1, bufsize}; Buffer buffer(bufdesc); scratch = std::move(buffer); @@ -1582,7 +1580,7 @@ GAPI_FLUID_KERNEL(GFluidDilate, cv::gapi::imgproc::GDilate, true) int k_cols = kernel.cols; int k_size = k_rows * k_cols; - cv::gapi::own::Size bufsize(k_size + 1, 1); + cv::Size bufsize(k_size + 1, 1); GMatDesc bufdesc = {CV_8U, 1, bufsize}; Buffer buffer(bufdesc); scratch = std::move(buffer); @@ -1749,7 +1747,7 @@ GAPI_FLUID_KERNEL(GFluidRGB2HSV, cv::gapi::imgproc::GRGB2HSV, true) cv::GMatDesc desc; desc.chan = 1; desc.depth = CV_32S; - desc.size = cv::gapi::own::Size(512, 1); + desc.size = cv::Size(512, 1); cv::gapi::fluid::Buffer buffer(desc); scratch = std::move(buffer); diff --git a/modules/gapi/test/gapi_fluid_parallel_rois_test.cpp b/modules/gapi/test/gapi_fluid_parallel_rois_test.cpp index 47a5f22696..3167637830 100644 --- a/modules/gapi/test/gapi_fluid_parallel_rois_test.cpp +++ b/modules/gapi/test/gapi_fluid_parallel_rois_test.cpp @@ -22,7 +22,7 @@ namespace { cv::GFluidParallelOutputRois asGFluidParallelOutputRois(const std::vector& rois){ cv::GFluidParallelOutputRois parallel_rois; for (auto const& roi : rois) { - parallel_rois.parallel_rois.emplace_back(GFluidOutputRois{{to_own(roi)}}); + parallel_rois.parallel_rois.emplace_back(GFluidOutputRois{{roi}}); } return parallel_rois; } diff --git a/modules/gapi/test/gapi_fluid_resize_test.cpp b/modules/gapi/test/gapi_fluid_resize_test.cpp index ab41ad6a6c..a0d30c634b 100644 --- a/modules/gapi/test/gapi_fluid_resize_test.cpp +++ b/modules/gapi/test/gapi_fluid_resize_test.cpp @@ -744,7 +744,7 @@ TEST_P(NV12PlusResizeTest, Test) auto pkg = cv::gapi::combine(fluidTestPackage, cv::gapi::core::fluid::kernels()); c.apply(cv::gin(y_mat, uv_mat), cv::gout(out_mat) - ,cv::compile_args(pkg, cv::GFluidOutputRois{{to_own(roi)}})); + ,cv::compile_args(pkg, cv::GFluidOutputRois{{roi}})); cv::Mat rgb_mat; cv::cvtColor(in_mat, rgb_mat, cv::COLOR_YUV2RGB_NV12); @@ -823,7 +823,7 @@ TEST_P(Preproc4lpiTest, Test) fluidResizeTestPackage(interp, in_sz, out_sz, 4)); c.apply(cv::gin(y_mat, uv_mat), cv::gout(out_mat) - ,cv::compile_args(pkg, cv::GFluidOutputRois{{to_own(roi)}})); + ,cv::compile_args(pkg, cv::GFluidOutputRois{{roi}})); cv::Mat rgb_mat; cv::cvtColor(in_mat, rgb_mat, cv::COLOR_YUV2RGB_NV12); diff --git a/modules/gapi/test/gapi_fluid_roi_test.cpp b/modules/gapi/test/gapi_fluid_roi_test.cpp index 8db7798b1a..b3297b77f5 100644 --- a/modules/gapi/test/gapi_fluid_roi_test.cpp +++ b/modules/gapi/test/gapi_fluid_roi_test.cpp @@ -38,7 +38,7 @@ TEST_P(PartialComputation, Test) cv::Mat out_mat_ocv = cv::Mat::zeros(sz, CV_8UC1); // Run G-API - auto cc = c.compile(cv::descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{to_own(roi)}})); + auto cc = c.compile(cv::descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{roi}})); cc(cv::gin(in_mat), cv::gout(out_mat_gapi)); // Check with OpenCV @@ -72,7 +72,7 @@ TEST_P(PartialComputationAddC, Test) cv::Mat out_mat_ocv = cv::Mat::zeros(sz, CV_8UC1); // Run G-API - auto cc = c.compile(cv::descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{to_own(roi)}})); + auto cc = c.compile(cv::descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{roi}})); cc(cv::gin(in_mat), cv::gout(out_mat_gapi)); // Check with OpenCV @@ -110,7 +110,7 @@ TEST_P(SequenceOfBlursRoiTest, Test) Mat out_mat_gapi = Mat::zeros(sz_in, CV_8UC1); GComputation c(GIn(in), GOut(out)); - auto cc = c.compile(descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{to_own(roi)}})); + auto cc = c.compile(descr_of(in_mat), cv::compile_args(fluidTestPackage, GFluidOutputRois{{roi}})); cc(gin(in_mat), gout(out_mat_gapi)); cv::Mat mid_mat_ocv = Mat::zeros(sz_in, CV_8UC1); diff --git a/modules/gapi/test/gapi_fluid_test.cpp b/modules/gapi/test/gapi_fluid_test.cpp index eeb87897b2..07646e0f89 100644 --- a/modules/gapi/test/gapi_fluid_test.cpp +++ b/modules/gapi/test/gapi_fluid_test.cpp @@ -754,7 +754,7 @@ TEST_P(NV12RoiTest, Test) auto rgb = cv::gapi::NV12toRGB(y, uv); cv::GComputation c(cv::GIn(y, uv), cv::GOut(rgb)); - c.apply(cv::gin(y_mat, uv_mat), cv::gout(out_mat), cv::compile_args(fluidTestPackage, cv::GFluidOutputRois{{to_own(roi)}})); + c.apply(cv::gin(y_mat, uv_mat), cv::gout(out_mat), cv::compile_args(fluidTestPackage, cv::GFluidOutputRois{{roi}})); cv::cvtColor(in_mat, out_mat_ocv, cv::COLOR_YUV2RGB_NV12); @@ -835,7 +835,7 @@ TEST(Fluid, InvalidROIs) }; const auto compile_args = [] (cv::Rect roi) { - return cv::compile_args(cv::gapi::core::fluid::kernels(), GFluidOutputRois{{to_own(roi)}}); + return cv::compile_args(cv::gapi::core::fluid::kernels(), GFluidOutputRois{{roi}}); }; for (const auto& roi : invalid_rois) diff --git a/modules/gapi/test/gapi_gcompiled_tests.cpp b/modules/gapi/test/gapi_gcompiled_tests.cpp index 3550b3d73e..7951a4c2ff 100644 --- a/modules/gapi/test/gapi_gcompiled_tests.cpp +++ b/modules/gapi/test/gapi_gcompiled_tests.cpp @@ -61,7 +61,7 @@ TEST_F(GCompiledValidateMetaTyped, ValidMeta) TEST_F(GCompiledValidateMetaTyped, InvalidMeta) { - auto f = m_cc.compile(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(64,32)}, + auto f = m_cc.compile(cv::GMatDesc{CV_8U,1,cv::Size(64,32)}, cv::empty_scalar_desc()); cv::Scalar sc(33); @@ -106,7 +106,7 @@ TEST_F(GCompiledValidateMetaUntyped, ValidMeta) TEST_F(GCompiledValidateMetaUntyped, InvalidMetaValues) { - auto f = m_ucc.compile(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(64,32)}, + auto f = m_ucc.compile(cv::GMatDesc{CV_8U,1,cv::Size(64,32)}, cv::empty_scalar_desc()); cv::Scalar sc(33); @@ -131,7 +131,7 @@ TEST_F(GCompiledValidateMetaUntyped, InvalidMetaValues) TEST_F(GCompiledValidateMetaUntyped, InvalidMetaShape) { - auto f = m_ucc.compile(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(64,32)}, + auto f = m_ucc.compile(cv::GMatDesc{CV_8U,1,cv::Size(64,32)}, cv::empty_scalar_desc()); cv::Mat in1 = cv::Mat::eye(cv::Size(64,32), CV_8UC1); diff --git a/modules/gapi/test/gapi_gcomputation_tests.cpp b/modules/gapi/test/gapi_gcomputation_tests.cpp index d9e94cdb32..a7ec2afaa5 100644 --- a/modules/gapi/test/gapi_gcomputation_tests.cpp +++ b/modules/gapi/test/gapi_gcomputation_tests.cpp @@ -19,13 +19,13 @@ namespace opencv_test static cv::GMatDesc outMeta(cv::GMatDesc in, cv::Size sz, double fx, double fy, int) { if (sz.width != 0 && sz.height != 0) { - return in.withSize(to_own(sz)); + return in.withSize(sz); } else { GAPI_Assert(fx != 0. && fy != 0.); return in.withSize - (cv::gapi::own::Size(static_cast(std::round(in.size.width * fx)), + (cv::Size(static_cast(std::round(in.size.width * fx)), static_cast(std::round(in.size.height * fy)))); } } diff --git a/modules/gapi/test/internal/gapi_int_island_fusion_tests.cpp b/modules/gapi/test/internal/gapi_int_island_fusion_tests.cpp index 6cfd5d3bd1..c247cc7b79 100644 --- a/modules/gapi/test/internal/gapi_int_island_fusion_tests.cpp +++ b/modules/gapi/test/internal/gapi_int_island_fusion_tests.cpp @@ -34,7 +34,7 @@ TEST(IslandFusion, TwoOps_OneIsland) cv::GComputation cc(in, out); // Prepare compilation parameters manually - const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}); + const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}); const auto pkg = cv::gapi::kernels(); // Directly instantiate G-API graph compiler and run partial compilation @@ -77,7 +77,7 @@ TEST(IslandFusion, TwoOps_TwoIslands) cv::GComputation cc(in, out); // Prepare compilation parameters manually - const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}); + const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}); const auto pkg = cv::gapi::kernels(); // Directly instantiate G-API graph compiler and run partial compilation @@ -142,8 +142,8 @@ TEST(IslandFusion, ConsumerHasTwoInputs) cv::GComputation cc(cv::GIn(in[0], in[1]), cv::GOut(out)); // Prepare compilation parameters manually - cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}), - GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)})}; + cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}), + GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)})}; const auto pkg = cv::gapi::kernels(); // Directly instantiate G-API graph compiler and run partial compilation @@ -211,7 +211,7 @@ TEST(IslandFusion, DataNodeUsedDifferentBackend) cv::GComputation cc(cv::GIn(in), cv::GOut(out0, out1)); // Prepare compilation parameters manually - const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}); + const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}); const auto pkg = cv::gapi::kernels(); // Directly instantiate G-API graph compiler and run partial compilation @@ -272,7 +272,7 @@ TEST(IslandFusion, LoopBetweenDifferentBackends) cv::GComputation cc(cv::GIn(in), cv::GOut(out1, out0)); // Prepare compilation parameters manually - const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}); + const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}); const auto pkg = cv::gapi::kernels(); // Directly instantiate G-API graph compiler and run partial compilation @@ -334,8 +334,8 @@ TEST(IslandsFusion, PartionOverlapUserIsland) cv::GComputation cc(cv::GIn(in[0], in[1]), cv::GOut(out)); // Prepare compilation parameters manually - cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}), - GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)})}; + cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}), + GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)})}; const auto pkg = cv::gapi::kernels(); // Directly instantiate G-API graph compiler and run partial compilation @@ -391,8 +391,8 @@ TEST(IslandsFusion, DISABLED_IslandContainsDifferentBackends) cv::GComputation cc(cv::GIn(in[0], in[1]), cv::GOut(out)); // Prepare compilation parameters manually - cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}), - GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)})}; + cv::GMetaArgs in_metas = {GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}), + GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)})}; const auto pkg = cv::gapi::kernels(); // Directly instantiate G-API graph compiler and run partial compilation @@ -424,7 +424,7 @@ TEST(IslandFusion, WithLoop) cv::GComputation cc(in, out); // Prepare compilation parameters manually - const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::gapi::own::Size(32,32)}); + const auto in_meta = cv::GMetaArg(cv::GMatDesc{CV_8U,1,cv::Size(32,32)}); const auto pkg = cv::gapi::kernels(); // Directly instantiate G-API graph compiler and run partial compilation diff --git a/modules/gapi/test/internal/gapi_int_recompilation_test.cpp b/modules/gapi/test/internal/gapi_int_recompilation_test.cpp index 3fcb0ec1f3..49cedad173 100644 --- a/modules/gapi/test/internal/gapi_int_recompilation_test.cpp +++ b/modules/gapi/test/internal/gapi_int_recompilation_test.cpp @@ -216,7 +216,7 @@ TEST(GComputationCompile, ReshapeRois) int roiH = szOut.height / niter; cv::Rect roi{x, y, roiW, roiH}; - cc.apply(in_mat, out_mat, cv::compile_args(cv::GFluidOutputRois{{to_own(roi)}})); + cc.apply(in_mat, out_mat, cv::compile_args(cv::GFluidOutputRois{{roi}})); auto comp = cc.priv().m_lastCompiled; EXPECT_EQ(&first_comp.priv(), &comp.priv());