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

Switch to zlib level 4 compression to balance speed on my laptop

parent 70fe9d41
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
#include <glog/logging.h>
#include <ftl/config.h>
#include <zlib.h>
// #include <lz4.h>
#include <string>
#include <map>
......@@ -147,6 +148,9 @@ static void run(const string &file) {
inflateInit(&infstream);
inflate(&infstream, Z_NO_FLUSH);
inflateEnd(&infstream);
//LZ4_decompress_safe((char*)d.data(), (char*)depth.data, d.size(), depth.step*depth.rows);
//cv::imdecode(d, cv::IMREAD_GRAYSCALE, &depth);
//depth.convertTo(depth, CV_32FC1); //, 1.0f/16.0f); //, 1.0f/256.0f);
});
......
......@@ -2,6 +2,7 @@
#include <ftl/streamer.hpp>
#include <vector>
#include <zlib.h>
// #include <lz4.h>
using ftl::Streamer;
using ftl::net::Universe;
......@@ -35,11 +36,17 @@ void Streamer::send(const Mat &rgb, const Mat &depth) {
defstream.avail_out = (uInt)depth.step*depth.rows; // size of output
defstream.next_out = (Bytef *)d_buf.data(); // output char array
deflateInit(&defstream, Z_DEFAULT_COMPRESSION);
deflateInit(&defstream, 4); // Z_DEFAULT_COMPRESSION
deflate(&defstream, Z_FINISH);
deflateEnd(&defstream);
d_buf.resize(defstream.total_out);
// LZ4 Version
// d_buf.resize(LZ4_compressBound(depth.step*depth.rows));
// int s = LZ4_compress_default((char*)depth.data, (char*)d_buf.data(), depth.step*depth.rows, d_buf.size());
// d_buf.resize(s);
//Mat d2;
//depth.convertTo(d2, CV_16UC1, 256);
//cv::imencode(".png", depth, d_buf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment