opencv/modules/gapi/test/gapi_mock_kernels.hpp
Dmitry Matveev 29e88e50ff Merge pull request #12608 from dmatveev:gapi
* G-API Initial code upload

* Update G-API code base to Sep-24-2018

* The majority of OpenCV buildbot problems was addressed

* Update G-API code base to 24-Sep-18 EOD

* G-API code base update 25-Sep-2018

* Linux warnings should be resolved
* Documentation build should become green
* Number of Windows warnings should be reduced

* Update G-API code base to 25-Sep-18 EOD

* ARMv7 build issue should be resolved
* ADE is bumped to latest version and should fix Clang builds for macOS/iOS
* Remaining Windows warnings should be resolved
* New Linux32 / ARMv7 warnings should be resolved

* G-API code base update 25-Sep-2018-EOD2

* Final Windows warnings should be resolved now

* G-API code base update 26-Sep-2018

* Fixed issues with precompiled headers in module and its tests
2018-09-26 21:50:39 +03:00

124 lines
4.3 KiB
C++

// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
#include "opencv2/gapi/cpu/gcpukernel.hpp"
#include "api/gbackend_priv.hpp" // directly instantiate GBackend::Priv
namespace opencv_test
{
namespace {
// FIXME: Currently every Kernel implementation in this test file has
// its own backend() method and it is incorrect! API classes should
// provide it out of the box.
namespace I
{
G_TYPED_KERNEL(Foo, <cv::GMat(cv::GMat)>, "test.kernels.foo")
{
static cv::GMatDesc outMeta(const cv::GMatDesc &in) { return in; }
};
G_TYPED_KERNEL(Bar, <cv::GMat(cv::GMat,cv::GMat)>, "test.kernels.bar")
{
static cv::GMatDesc outMeta(const cv::GMatDesc &in, const cv::GMatDesc &) { return in; }
};
G_TYPED_KERNEL(Baz, <cv::GScalar(cv::GMat)>, "test.kernels.baz")
{
static cv::GScalarDesc outMeta(const cv::GMatDesc &) { return cv::empty_scalar_desc(); }
};
G_TYPED_KERNEL(Qux, <cv::GMat(cv::GMat, cv::GScalar)>, "test.kernels.qux")
{
static cv::GMatDesc outMeta(const cv::GMatDesc &in, const cv::GScalarDesc &) { return in; }
};
G_TYPED_KERNEL(Quux, <cv::GMat(cv::GScalar, cv::GMat)>, "test.kernels.quux")
{
static cv::GMatDesc outMeta(const cv::GScalarDesc &, const cv::GMatDesc& in) { return in; }
};
}
// Kernel implementations for imaginary Jupiter device
namespace Jupiter
{
namespace detail
{
static cv::gapi::GBackend backend(std::make_shared<cv::gapi::GBackend::Priv>());
}
inline cv::gapi::GBackend backend() { return detail::backend; }
GAPI_OCV_KERNEL(Foo, I::Foo)
{
static void run(const cv::Mat &, cv::Mat &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
GAPI_OCV_KERNEL(Bar, I::Bar)
{
static void run(const cv::Mat &, const cv::Mat &, cv::Mat &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
GAPI_OCV_KERNEL(Baz, I::Baz)
{
static void run(const cv::Mat &, cv::Scalar &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
GAPI_OCV_KERNEL(Qux, I::Qux)
{
static void run(const cv::Mat &, const cv::Scalar&, cv::Mat &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
GAPI_OCV_KERNEL(Quux, I::Quux)
{
static void run(const cv::Scalar&, const cv::Mat&, cv::Mat &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
} // namespace Jupiter
// Kernel implementations for imaginary Saturn device
namespace Saturn
{
namespace detail
{
static cv::gapi::GBackend backend(std::make_shared<cv::gapi::GBackend::Priv>());
}
inline cv::gapi::GBackend backend() { return detail::backend; }
GAPI_OCV_KERNEL(Foo, I::Foo)
{
static void run(const cv::Mat &, cv::Mat &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
GAPI_OCV_KERNEL(Bar, I::Bar)
{
static void run(const cv::Mat &, const cv::Mat &, cv::Mat &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
GAPI_OCV_KERNEL(Baz, I::Baz)
{
static void run(const cv::Mat &, cv::Scalar &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
GAPI_OCV_KERNEL(Qux, I::Qux)
{
static void run(const cv::Mat &, const cv::Scalar&, cv::Mat &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
GAPI_OCV_KERNEL(Quux, I::Quux)
{
static void run(const cv::Scalar&, const cv::Mat&, cv::Mat &) { /*Do nothing*/ }
static cv::gapi::GBackend backend() { return detail::backend; } // FIXME: Must be removed
};
} // namespace Saturn
} // anonymous namespace
} // namespace opencv_test