Skip to content
Snippets Groups Projects
Commit 19a387b1 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Use thread to do pipeline in vision

parent 4df2e3a6
No related branches found
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
......@@ -179,14 +179,17 @@ static void run(ftl::Configurable *root) {
pipeline->append<ftl::operators::ArUco>("aruco")->value("enabled", false);
pipeline->append<ftl::operators::DepthChannel>("depth"); // Ensure there is a depth channel
auto h = creator.onFrameSet([sender,&stats_count,&latency,&frames,pipeline](const ftl::data::FrameSetPtr &fs) {
// Make a frameset first
//auto fs = ftl::data::FrameSet::fromFrame(f);
bool busy = false;
// Lock and send colour right now to encode in parallel
auto h = creator.onFrameSet([sender,&stats_count,&latency,&frames,pipeline,&busy](const ftl::data::FrameSetPtr &fs) {
if (busy) return true;
busy = true;
// Lock colour right now to encode in parallel
fs->flush(ftl::codecs::Channel::Colour);
sender->post(*fs, ftl::codecs::Channel::Colour);
// Do all processing in another thread...
ftl::pool.push([sender,&stats_count,&latency,&frames,pipeline,&busy,fs](int id) {
// Do pipeline here...
pipeline->apply(*fs, *fs);
if (fs->firstFrame().has(ftl::codecs::Channel::Depth)) sender->post(*fs, ftl::codecs::Channel::Depth);
......@@ -201,6 +204,13 @@ static void run(ftl::Configurable *root) {
frames = 0;
latency = 0.0f;
}
busy = false;
});
// Actually send colour in this original thread
sender->post(*fs, ftl::codecs::Channel::Colour);
return true;
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment