mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #16964 from rgarnov:rg/opaque_for_streaming_exec
* Added GOpaque support to GStreamingExecutor * Added inter-island GOpaque support to GExecutor
This commit is contained in:
@@ -114,6 +114,7 @@ void cv::gimpl::GExecutor::initResource(const ade::NodeHandle &orig_nh)
|
||||
break;
|
||||
|
||||
case GShape::GARRAY:
|
||||
case GShape::GOPAQUE:
|
||||
// Constructed on Reset, do nothing here
|
||||
break;
|
||||
|
||||
|
||||
@@ -122,6 +122,9 @@ void sync_data(cv::GRunArgs &results, cv::GRunArgsP &outputs)
|
||||
case T::index_of<cv::detail::VectorRef>():
|
||||
cv::util::get<cv::detail::VectorRef>(out_obj).mov(cv::util::get<cv::detail::VectorRef>(res_obj));
|
||||
break;
|
||||
case T::index_of<cv::detail::OpaqueRef>():
|
||||
cv::util::get<cv::detail::OpaqueRef>(out_obj).mov(cv::util::get<cv::detail::OpaqueRef>(res_obj));
|
||||
break;
|
||||
default:
|
||||
GAPI_Assert(false && "This value type is not supported!"); // ...maybe because of STANDALONE mode.
|
||||
break;
|
||||
@@ -475,6 +478,16 @@ void islandActorThread(std::vector<cv::gimpl::RcDesc> in_rcs, //
|
||||
isl_outputs[id] = { r, cv::GRunArgP(rr) };
|
||||
}
|
||||
break;
|
||||
case cv::GShape::GOPAQUE:
|
||||
{
|
||||
cv::detail::OpaqueRef newOpaque;
|
||||
cv::util::get<cv::detail::ConstructOpaque>(r.ctor)(newOpaque);
|
||||
out_data[id] = cv::GRunArg(std::move(newOpaque));
|
||||
// OpaqueRef is implicitly shared so no pointer is taken here
|
||||
const auto &rr = cv::util::get<cv::detail::OpaqueRef>(out_data[id]); // FIXME: that variant MOVE problem again
|
||||
isl_outputs[id] = { r, cv::GRunArgP(rr) };
|
||||
}
|
||||
break;
|
||||
default:
|
||||
cv::util::throw_error(std::logic_error("Unsupported GShape"));
|
||||
break;
|
||||
|
||||
@@ -146,6 +146,26 @@ TEST(GOpaque, TestOpaqueBetween)
|
||||
EXPECT_EQ(painted, 77);
|
||||
}
|
||||
|
||||
TEST(GOpaque, TestOpaqueBetweenIslands)
|
||||
{
|
||||
cv::Size sz = {50, 50};
|
||||
int depth = CV_8U;
|
||||
int chan = 1;
|
||||
cv::Mat mat_in = cv::Mat::zeros(sz, CV_MAKETYPE(depth, chan));
|
||||
cv::Mat mat_out = cv::Mat::zeros(sz, CV_MAKETYPE(depth, chan));
|
||||
|
||||
cv::GMat in, out;
|
||||
auto betw = ThisTest::GeneratePoint::on(in);
|
||||
out = ThisTest::PaintPoint::on(betw, depth, chan, sz);
|
||||
|
||||
cv::gapi::island("test", cv::GIn(in), cv::GOut(betw));
|
||||
cv::GComputation c(cv::GIn(in), cv::GOut(out));
|
||||
c.apply(cv::gin(mat_in), cv::gout(mat_out), cv::compile_args(cv::gapi::kernels<OCVGeneratePoint, OCVPaintPoint>()));
|
||||
|
||||
int painted = mat_out.at<uint8_t>(42, 42);
|
||||
EXPECT_EQ(painted, 77);
|
||||
}
|
||||
|
||||
TEST(GOpaque, TestOpaqueCustomOut2)
|
||||
{
|
||||
cv::Mat input1 = cv::Mat(52, 52, CV_8U);
|
||||
|
||||
Reference in New Issue
Block a user