Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/gapi/src/backends/common/gcompoundkernel.cpp
16344 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html.
4
//
5
// Copyright (C) 2018 Intel Corporation
6
7
8
#include "precomp.hpp"
9
10
#include <ade/util/zip_range.hpp> // util::indexed
11
#include "opencv2/gapi/gcompoundkernel.hpp"
12
#include "compiler/gobjref.hpp"
13
14
// FIXME move to backends
15
16
cv::detail::GCompoundContext::GCompoundContext(const cv::GArgs& in_args)
17
{
18
m_args.resize(in_args.size());
19
for (const auto& it : ade::util::indexed(in_args))
20
{
21
const auto& i = ade::util::index(it);
22
const auto& in_arg = ade::util::value(it);
23
24
if (in_arg.kind != cv::detail::ArgKind::GOBJREF)
25
{
26
m_args[i] = in_arg;
27
}
28
else
29
{
30
const cv::gimpl::RcDesc &ref = in_arg.get<cv::gimpl::RcDesc>();
31
switch (ref.shape)
32
{
33
case GShape::GMAT : m_args[i] = GArg(GMat()); break;
34
case GShape::GSCALAR: m_args[i] = GArg(GScalar()); break;
35
case GShape::GARRAY :/* do nothing - as handled in a special way, see gcompoundkernel.hpp for details */; break;
36
default: GAPI_Assert(false);
37
}
38
}
39
}
40
GAPI_Assert(m_args.size() == in_args.size());
41
}
42
43
cv::detail::GCompoundKernel::GCompoundKernel(const F& f) : m_f(f)
44
{
45
}
46
47
void cv::detail::GCompoundKernel::apply(cv::detail::GCompoundContext& ctx) { m_f(ctx); }
48
49