Merge pull request #18196 from mpashchenkov:mp/garray-initialization
[G-API]: Add GArray initialization support * Added GArray initialization (CONST_VALUE, GScalar analog) and test for this * Whitespaces * And one more space * Trailing whitespace * Test name changed. Build with magic commands. * GArray works with rvalue initialization * Code cleanup * Ternary operator in the initialization list.
This commit is contained in:
committed by
GitHub
parent
a07f064e50
commit
830d8d6b75
@@ -20,6 +20,11 @@ cv::detail::GArrayU::GArrayU(const GNode &n, std::size_t out)
|
||||
{
|
||||
}
|
||||
|
||||
cv::detail::GArrayU::GArrayU(const detail::VectorRef& vref)
|
||||
: m_priv(new GOrigin(GShape::GARRAY, cv::gimpl::ConstVal(vref)))
|
||||
{
|
||||
}
|
||||
|
||||
cv::GOrigin& cv::detail::GArrayU::priv()
|
||||
{
|
||||
return *m_priv;
|
||||
|
||||
@@ -21,7 +21,10 @@ cv::GOrigin::GOrigin(GShape s,
|
||||
}
|
||||
|
||||
cv::GOrigin::GOrigin(GShape s, cv::gimpl::ConstVal v)
|
||||
: shape(s), node(cv::GNode::Const()), value(v), port(INVALID_PORT), kind(cv::detail::OpaqueKind::CV_UNKNOWN)
|
||||
: shape(s), node(cv::GNode::Const()), value(v), port(INVALID_PORT),
|
||||
kind(util::holds_alternative<detail::VectorRef>(v)
|
||||
? util::get<detail::VectorRef>(v).getKind()
|
||||
: cv::detail::OpaqueKind::CV_UNKNOWN)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ cv::GRunArg cv::value_of(const cv::GOrigin &origin)
|
||||
switch (origin.shape)
|
||||
{
|
||||
case GShape::GSCALAR: return GRunArg(util::get<cv::Scalar>(origin.value));
|
||||
case GShape::GARRAY: return GRunArg(util::get<cv::detail::VectorRef>(origin.value));
|
||||
default: util::throw_error(std::logic_error("Unsupported shape for constant"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace gimpl
|
||||
using ConstVal = util::variant
|
||||
< util::monostate
|
||||
, cv::Scalar
|
||||
, cv::detail::VectorRef
|
||||
>;
|
||||
|
||||
struct RcDesc
|
||||
|
||||
@@ -114,6 +114,12 @@ void cv::gimpl::GExecutor::initResource(const ade::NodeHandle &orig_nh)
|
||||
break;
|
||||
|
||||
case GShape::GARRAY:
|
||||
if (d.storage == Data::Storage::CONST_VAL)
|
||||
{
|
||||
auto rc = RcDesc{d.rc, d.shape, d.ctor};
|
||||
magazine::bindInArg(m_res, rc, m_gm.metadata(orig_nh).get<ConstValue>().arg);
|
||||
}
|
||||
break;
|
||||
case GShape::GOPAQUE:
|
||||
// Constructed on Reset, do nothing here
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user