From a0af6ab74b9d0e91274f7d2539e7fa48b12d36e1 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 6 Jul 2020 09:56:35 +0300 Subject: [PATCH] Remove right channel encode for now --- applications/vision/src/main.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/applications/vision/src/main.cpp b/applications/vision/src/main.cpp index d6c8e3eb0..8f1c3a9cd 100644 --- a/applications/vision/src/main.cpp +++ b/applications/vision/src/main.cpp @@ -165,7 +165,7 @@ static void run(ftl::Configurable *root) { // TODO: Check the channel to see if it should be sent or not switch (c) { case Channel::Colour : - case Channel::Colour2 : + //case Channel::Colour2 : case Channel::Depth : sender->post(fs, c); break; default: break; } @@ -175,6 +175,7 @@ static void run(ftl::Configurable *root) { int stats_count = 0; int frames = 0; float latency = 0.0f; + int64_t stats_time = 0; auto *pipeline = ftl::config::create<ftl::operators::Graph>(root, "pipeline"); pipeline->append<ftl::operators::DetectAndTrack>("facedetection")->value("enabled", false); @@ -183,8 +184,11 @@ static void run(ftl::Configurable *root) { bool busy = false; - auto h = creator->onFrameSet([sender,&stats_count,&latency,&frames,pipeline,&busy](const ftl::data::FrameSetPtr &fs) { - if (busy) return true; + auto h = creator->onFrameSet([sender,&stats_count,&latency,&frames,&stats_time,pipeline,&busy](const ftl::data::FrameSetPtr &fs) { + if (busy) { + LOG(INFO) << "Frame drop due to pipeline: " << fs->timestamp(); + return true; + } busy = true; // TODO: Remove, this is debug code @@ -193,7 +197,7 @@ static void run(ftl::Configurable *root) { } // Do all processing in another thread... - ftl::pool.push([sender,&stats_count,&latency,&frames,pipeline,&busy,fs](int id) { + ftl::pool.push([sender,&stats_count,&latency,&frames,&stats_time,pipeline,&busy,fs](int id) { // Do pipeline here... pipeline->apply(*fs, *fs); @@ -206,10 +210,14 @@ static void run(ftl::Configurable *root) { if (--stats_count <= 0) { latency /= float(frames); - LOG(INFO) << "Frame rate: " << frames << ", Latency: " << latency; + int64_t nowtime = ftl::timer::get_time(); + stats_time = nowtime - stats_time; + float fps = float(frames) / (float(stats_time) / 1000.0f); + LOG(INFO) << "Frame rate: " << fps << ", Latency: " << latency; stats_count = 20; frames = 0; latency = 0.0f; + stats_time = nowtime; } busy = false; -- GitLab