Fix GExecutor WriteBackExec

This commit is contained in:
Anatoliy Talamanov 2021-08-23 16:52:49 +03:00
parent bb5f33d13c
commit aa5c4945d6

View File

@ -157,10 +157,14 @@ void writeBackExec(const Mag& mag, const RcDesc &rc, GRunArgP &g_arg)
// FIXME:
// Rework, find a better way to check if there should be
// a real copy (add a pass to StreamingBackend?)
// NB: In case RMat adapter not equal to "RMatAdapter" need to
// copy data back to the host as well.
// FIXME: Rename "RMatAdapter" to "OpenCVAdapter".
auto& out_mat = *util::get<cv::Mat*>(g_arg);
const auto& rmat = mag.template slot<cv::RMat>().at(rc.id);
auto* adapter = rmat.get<RMatAdapter>();
if (adapter != nullptr && out_mat.data != adapter->data()) {
if ((adapter != nullptr && out_mat.data != adapter->data()) ||
(adapter == nullptr)) {
auto view = rmat.access(RMat::Access::R);
asMat(view).copyTo(out_mat);
}