Path: blob/master/modules/gapi/src/backends/common/gcompoundkernel.cpp
16344 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.3//4// Copyright (C) 2018 Intel Corporation567#include "precomp.hpp"89#include <ade/util/zip_range.hpp> // util::indexed10#include "opencv2/gapi/gcompoundkernel.hpp"11#include "compiler/gobjref.hpp"1213// FIXME move to backends1415cv::detail::GCompoundContext::GCompoundContext(const cv::GArgs& in_args)16{17m_args.resize(in_args.size());18for (const auto& it : ade::util::indexed(in_args))19{20const auto& i = ade::util::index(it);21const auto& in_arg = ade::util::value(it);2223if (in_arg.kind != cv::detail::ArgKind::GOBJREF)24{25m_args[i] = in_arg;26}27else28{29const cv::gimpl::RcDesc &ref = in_arg.get<cv::gimpl::RcDesc>();30switch (ref.shape)31{32case GShape::GMAT : m_args[i] = GArg(GMat()); break;33case GShape::GSCALAR: m_args[i] = GArg(GScalar()); break;34case GShape::GARRAY :/* do nothing - as handled in a special way, see gcompoundkernel.hpp for details */; break;35default: GAPI_Assert(false);36}37}38}39GAPI_Assert(m_args.size() == in_args.size());40}4142cv::detail::GCompoundKernel::GCompoundKernel(const F& f) : m_f(f)43{44}4546void cv::detail::GCompoundKernel::apply(cv::detail::GCompoundContext& ctx) { m_f(ctx); }474849