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

Add compression level config opt

parent 445076c7
No related branches found
No related tags found
1 merge request!40Implements #89 PNG chunking
Pipeline #11600 passed
......@@ -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 *);
......
......@@ -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";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment