From dac415e40f311624eb0c84e2d03f2002bdf729e2 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Sun, 16 Jun 2019 20:08:42 +0300 Subject: [PATCH] Add compression level config opt --- components/rgbd-sources/include/ftl/rgbd/streamer.hpp | 1 + components/rgbd-sources/src/streamer.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/rgbd-sources/include/ftl/rgbd/streamer.hpp b/components/rgbd-sources/include/ftl/rgbd/streamer.hpp index e832fb546..665f9af9d 100644 --- a/components/rgbd-sources/include/ftl/rgbd/streamer.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/streamer.hpp @@ -112,6 +112,7 @@ class Streamer : public ftl::Configurable { std::mutex job_mtx_; std::condition_variable job_cv_; std::atomic<int> jobs_; + int compress_level_; void _schedule(); void _swap(detail::StreamSource *); diff --git a/components/rgbd-sources/src/streamer.cpp b/components/rgbd-sources/src/streamer.cpp index ace68b6ee..9e6935338 100644 --- a/components/rgbd-sources/src/streamer.cpp +++ b/components/rgbd-sources/src/streamer.cpp @@ -27,6 +27,8 @@ Streamer::Streamer(nlohmann::json &config, Universe *net) active_ = false; net_ = net; + + compress_level_ = value("compression", 1); net->bind("find_stream", [this](const std::string &uri) -> optional<UUID> { SHARED_LOCK(mutex_,slk); @@ -307,7 +309,7 @@ void Streamer::_schedule() { //if (delta) d3 = (d2 * 2) - chunkDepthPrev; //else d3 = d2; //d2.copyTo(chunkDepthPrev); - vector<int> pngparams = {cv::IMWRITE_PNG_COMPRESSION, 1}; // Default is 1 for fast, 9 = small but slow. + vector<int> pngparams = {cv::IMWRITE_PNG_COMPRESSION, compress_level_}; // Default is 1 for fast, 9 = small but slow. cv::imencode(".png", d2, d_buf, pngparams); //LOG(INFO) << "Sending chunk " << chunk << " : size = " << (d_buf.size()+rgb_buf.size()) / 1024 << "kb"; -- GitLab