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

Detect which channels are in FTL file

parent 10ce7dec
Branches
No related tags found
2 merge requests!212Major refactor of frame streaming,!204Implements #272 Disparity pipeline in reconstruct
...@@ -101,6 +101,8 @@ static void run(ftl::Configurable *root) { ...@@ -101,6 +101,8 @@ static void run(ftl::Configurable *root) {
sourcecounts.push_back(configuration_size); sourcecounts.push_back(configuration_size);
} }
ftl::codecs::Channels channels;
// Check paths for FTL files to load. // Check paths for FTL files to load.
auto paths = (*root->get<nlohmann::json>("paths")); auto paths = (*root->get<nlohmann::json>("paths"));
for (auto &x : paths.items()) { for (auto &x : paths.items()) {
...@@ -117,8 +119,9 @@ static void run(ftl::Configurable *root) { ...@@ -117,8 +119,9 @@ static void run(ftl::Configurable *root) {
reader.begin(); reader.begin();
int max_stream = 0; int max_stream = 0;
reader.read(reader.getStartTime()+100, [&max_stream](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) { reader.read(reader.getStartTime()+100, [&max_stream,&channels](const ftl::codecs::StreamPacket &spkt, const ftl::codecs::Packet &pkt) {
max_stream = max(max_stream, spkt.streamID); max_stream = max(max_stream, spkt.streamID);
if ((int)spkt.channel < 32) channels |= spkt.channel;
}); });
reader.end(); reader.end();
...@@ -135,6 +138,8 @@ static void run(ftl::Configurable *root) { ...@@ -135,6 +138,8 @@ static void run(ftl::Configurable *root) {
} }
} }
if (channels.empty()) channels |= Channel::Depth;
// Create a vector of all input RGB-Depth sources // Create a vector of all input RGB-Depth sources
auto sources = ftl::createArray<Source>(root, "sources", net); auto sources = ftl::createArray<Source>(root, "sources", net);
...@@ -191,6 +196,11 @@ static void run(ftl::Configurable *root) { ...@@ -191,6 +196,11 @@ static void run(ftl::Configurable *root) {
std::string id = std::to_string(cumulative); std::string id = std::to_string(cumulative);
auto reconstr = ftl::create<ftl::Reconstruction>(root, id, id); auto reconstr = ftl::create<ftl::Reconstruction>(root, id, id);
for (size_t i=cumulative; i<cumulative+c; i++) { for (size_t i=cumulative; i<cumulative+c; i++) {
if (channels.has(Channel::Depth)) {
sources[i]->setChannel(Channel::Depth);
} else if (channels.has(Channel::Right)) {
sources[i]->setChannel(Channel::Right);
}
reconstr->addSource(sources[i]); reconstr->addSource(sources[i]);
} }
groups.push_back(reconstr); groups.push_back(reconstr);
......
...@@ -102,7 +102,7 @@ Reconstruction::~Reconstruction() { ...@@ -102,7 +102,7 @@ Reconstruction::~Reconstruction() {
} }
void Reconstruction::addSource(ftl::rgbd::Source *src) { void Reconstruction::addSource(ftl::rgbd::Source *src) {
src->setChannel(Channel::Depth); //src->setChannel(Channel::Depth);
group_->addSource(src); // TODO: check if source is already in group? group_->addSource(src); // TODO: check if source is already in group?
} }
......
...@@ -102,6 +102,7 @@ class Channels { ...@@ -102,6 +102,7 @@ class Channels {
} }
inline size_t count() { return std::bitset<32>(mask).count(); } inline size_t count() { return std::bitset<32>(mask).count(); }
inline bool empty() { return mask == 0; }
inline void clear() { mask = 0; } inline void clear() { mask = 0; }
static const size_t kMax = 32; static const size_t kMax = 32;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment