mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 06:26:29 +08:00
Changed sharev_ptr for Priv to unique_ptr for fluid::Buffer
This commit is contained in:
parent
b3a07166ba
commit
6c93e42d94
@ -115,6 +115,8 @@ public:
|
|||||||
BorderOpt border);
|
BorderOpt border);
|
||||||
// Constructor for in/out buffers (for tests)
|
// Constructor for in/out buffers (for tests)
|
||||||
Buffer(const cv::gapi::own::Mat &data, bool is_input);
|
Buffer(const cv::gapi::own::Mat &data, bool is_input);
|
||||||
|
~Buffer();
|
||||||
|
Buffer& operator=(Buffer&&);
|
||||||
|
|
||||||
inline uint8_t* OutLineB(int index = 0)
|
inline uint8_t* OutLineB(int index = 0)
|
||||||
{
|
{
|
||||||
@ -143,7 +145,7 @@ public:
|
|||||||
const Priv& priv() const; // internal use only
|
const Priv& priv() const; // internal use only
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Priv> m_priv;
|
std::unique_ptr<Priv> m_priv;
|
||||||
const Cache* m_cache;
|
const Cache* m_cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -833,7 +833,8 @@ cv::gimpl::GFluidExecutable::GFluidExecutable(const ade::Graph
|
|||||||
m_num_int_buffers (traverse_res.m_mat_count),
|
m_num_int_buffers (traverse_res.m_mat_count),
|
||||||
m_scratch_users (traverse_res.m_scratch_users),
|
m_scratch_users (traverse_res.m_scratch_users),
|
||||||
m_id_map (traverse_res.m_id_map),
|
m_id_map (traverse_res.m_id_map),
|
||||||
m_all_gmat_ids (traverse_res.m_all_gmat_ids)
|
m_all_gmat_ids (traverse_res.m_all_gmat_ids),
|
||||||
|
m_buffers(m_num_int_buffers + m_scratch_users.size())
|
||||||
{
|
{
|
||||||
GConstFluidModel fg(m_g);
|
GConstFluidModel fg(m_g);
|
||||||
|
|
||||||
@ -857,9 +858,6 @@ cv::gimpl::GFluidExecutable::GFluidExecutable(const ade::Graph
|
|||||||
// Actually initialize Fluid buffers
|
// Actually initialize Fluid buffers
|
||||||
GAPI_LOG_INFO(NULL, "Initializing " << m_num_int_buffers << " fluid buffer(s)" << std::endl);
|
GAPI_LOG_INFO(NULL, "Initializing " << m_num_int_buffers << " fluid buffer(s)" << std::endl);
|
||||||
|
|
||||||
const std::size_t num_scratch = m_scratch_users.size();
|
|
||||||
m_buffers.resize(m_num_int_buffers + num_scratch);
|
|
||||||
|
|
||||||
// After buffers are allocated, repack: ...
|
// After buffers are allocated, repack: ...
|
||||||
for (auto &agent : m_agents)
|
for (auto &agent : m_agents)
|
||||||
{
|
{
|
||||||
@ -905,6 +903,7 @@ cv::gimpl::GFluidExecutable::GFluidExecutable(const ade::Graph
|
|||||||
}
|
}
|
||||||
|
|
||||||
// After parameters are there, initialize scratch buffers
|
// After parameters are there, initialize scratch buffers
|
||||||
|
const std::size_t num_scratch = m_scratch_users.size();
|
||||||
if (num_scratch)
|
if (num_scratch)
|
||||||
{
|
{
|
||||||
GAPI_LOG_INFO(NULL, "Initializing " << num_scratch << " scratch buffer(s)" << std::endl);
|
GAPI_LOG_INFO(NULL, "Initializing " << num_scratch << " scratch buffer(s)" << std::endl);
|
||||||
@ -932,8 +931,8 @@ std::size_t cv::gimpl::GFluidExecutable::total_buffers_size() const
|
|||||||
for (const auto &i : ade::util::indexed(m_buffers))
|
for (const auto &i : ade::util::indexed(m_buffers))
|
||||||
{
|
{
|
||||||
// Check that all internal and scratch buffers are allocated
|
// Check that all internal and scratch buffers are allocated
|
||||||
const auto idx = ade::util::index(i);
|
const auto idx = ade::util::index(i);
|
||||||
const auto b = ade::util::value(i);
|
const auto& b = ade::util::value(i);
|
||||||
if (idx >= m_num_int_buffers ||
|
if (idx >= m_num_int_buffers ||
|
||||||
fg.metadata(m_all_gmat_ids.at(idx)).get<FluidData>().internal == true)
|
fg.metadata(m_all_gmat_ids.at(idx)).get<FluidData>().internal == true)
|
||||||
{
|
{
|
||||||
|
@ -125,7 +125,6 @@ class GFluidExecutable final: public GIslandExecutable
|
|||||||
GModel::ConstGraph m_gm;
|
GModel::ConstGraph m_gm;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<FluidAgent>> m_agents;
|
std::vector<std::unique_ptr<FluidAgent>> m_agents;
|
||||||
std::vector<cv::gapi::fluid::Buffer> m_buffers;
|
|
||||||
|
|
||||||
std::vector<FluidAgent*> m_script;
|
std::vector<FluidAgent*> m_script;
|
||||||
|
|
||||||
@ -138,6 +137,8 @@ class GFluidExecutable final: public GIslandExecutable
|
|||||||
std::unordered_map<int, std::size_t> m_id_map; // GMat id -> buffer idx map
|
std::unordered_map<int, std::size_t> m_id_map; // GMat id -> buffer idx map
|
||||||
std::map<std::size_t, ade::NodeHandle> m_all_gmat_ids;
|
std::map<std::size_t, ade::NodeHandle> m_all_gmat_ids;
|
||||||
|
|
||||||
|
std::vector<cv::gapi::fluid::Buffer> m_buffers;
|
||||||
|
|
||||||
void bindInArg (const RcDesc &rc, const GRunArg &arg);
|
void bindInArg (const RcDesc &rc, const GRunArg &arg);
|
||||||
void bindOutArg(const RcDesc &rc, const GRunArgP &arg);
|
void bindOutArg(const RcDesc &rc, const GRunArgP &arg);
|
||||||
void packArg (GArg &in_arg, const GArg &op_arg);
|
void packArg (GArg &in_arg, const GArg &op_arg);
|
||||||
|
@ -680,6 +680,9 @@ fluid::Buffer::Buffer(const cv::gapi::own::Mat &data, bool is_input)
|
|||||||
m_priv->bindTo(data, is_input);
|
m_priv->bindTo(data, is_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fluid::Buffer::~Buffer() = default;
|
||||||
|
fluid::Buffer& fluid::Buffer::operator=(fluid::Buffer&&) = default;
|
||||||
|
|
||||||
int fluid::Buffer::linesReady() const
|
int fluid::Buffer::linesReady() const
|
||||||
{
|
{
|
||||||
return m_priv->linesReady();
|
return m_priv->linesReady();
|
||||||
|
Loading…
Reference in New Issue
Block a user