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.
5 // Copyright (C) 2018-2019 Intel Corporation
10 #include <ade/util/zip_range.hpp> // util::indexed
11 #include "opencv2/gapi/gcompoundkernel.hpp"
12 #include "compiler/gobjref.hpp"
14 // FIXME move to backends
16 cv::detail::GCompoundContext::GCompoundContext(const cv::GArgs& in_args)
18 m_args.resize(in_args.size());
19 for (const auto& it : ade::util::indexed(in_args))
21 const auto& i = ade::util::index(it);
22 const auto& in_arg = ade::util::value(it);
24 if (in_arg.kind != cv::detail::ArgKind::GOBJREF)
30 const cv::gimpl::RcDesc &ref = in_arg.get<cv::gimpl::RcDesc>();
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);
40 GAPI_Assert(m_args.size() == in_args.size());
43 cv::detail::GCompoundKernel::GCompoundKernel(const F& f) : m_f(f)
47 void cv::detail::GCompoundKernel::apply(cv::detail::GCompoundContext& ctx) { m_f(ctx); }