diff --git a/reconstruct/src/main.cpp b/reconstruct/src/main.cpp index 38707af3f2bf682368130856f2556cf384742c39..4fa5cbcd124a0f9f334e38b0237f911bcab34ced 100644 --- a/reconstruct/src/main.cpp +++ b/reconstruct/src/main.cpp @@ -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); }); diff --git a/vision/src/streamer.cpp b/vision/src/streamer.cpp index 8c359ad594a8f50baf34a092ec99d82a4d1b6fe9..8a346d38b55cd5af2b81dfaa947bd678d6afd5ac 100644 --- a/vision/src/streamer.cpp +++ b/vision/src/streamer.cpp @@ -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);