{"id":19747418,"url":"https://github.com/sisong/tinyuz","last_synced_at":"2025-04-30T08:32:26.152Z","repository":{"id":40318473,"uuid":"247677695","full_name":"sisong/tinyuz","owner":"sisong","description":"tiny code \u0026 ram requirements  when decompress on embedded systems,MCU,NB-IoT,...","archived":false,"fork":false,"pushed_at":"2023-12-09T03:53:49.000Z","size":232,"stargazers_count":34,"open_issues_count":2,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-06-20T09:28:24.209Z","etag":null,"topics":["compress","decompress","embedded","lossless","mcu","nb-iot","stm32","stm8","tiny"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sisong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-03-16T10:49:49.000Z","updated_at":"2024-06-20T07:56:37.000Z","dependencies_parsed_at":"2023-12-09T04:37:36.148Z","dependency_job_id":null,"html_url":"https://github.com/sisong/tinyuz","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisong%2Ftinyuz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisong%2Ftinyuz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisong%2Ftinyuz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sisong%2Ftinyuz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sisong","download_url":"https://codeload.github.com/sisong/tinyuz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224202803,"owners_count":17272821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compress","decompress","embedded","lossless","mcu","nb-iot","stm32","stm8","tiny"],"created_at":"2024-11-12T02:17:47.420Z","updated_at":"2024-11-12T02:17:48.152Z","avatar_url":"https://github.com/sisong.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [tinyuz](https://github.com/sisong/tinyuz)\n[![release](https://img.shields.io/badge/release-v1.0.0-blue.svg)](https://github.com/sisong/tinyuz/releases) \n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sisong/tinyuz/blob/master/LICENSE) \n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](https://github.com/sisong/tinyuz/pulls)\n[![+issue Welcome](https://img.shields.io/github/issues-raw/sisong/tinyuz?color=green\u0026label=%2Bissue%20welcome)](https://github.com/sisong/tinyuz/issues)   \n[![Build Status](https://github.com/sisong/tinyuz/workflows/ci/badge.svg?branch=master)](https://github.com/sisong/tinyuz/actions?query=workflow%3Aci+branch%3Amaster)   \n english | [中文版](README_cn.md)   \n   \n**tinyuz** is a lossless compression algorithm, designed for embedded systems,MCU, NB-IoT, etc.,  with better compression ratios.   \nWhich is characterized by a very small decompress code(ROM or flash occupancy); \nThe stream decompresser compiled by Mbed Studio is 856 bytes(can define to 758 bytes), \nand the memory decompresser is 424 bytes(can define to unsafe mode 298 bytes).    \nAt the same time, the stream decompress memory(RAM occupancy) can also be very small, \nRAM size = dictionary size(\u003e=1Byte, specified when compress) + cache size(\u003e=2Byte, specified when decompress). \nTip: The smaller the dictionary, the lower the compression ratio; while the smaller cache only affects the decompress speed.   \n( other decompresser compiled by Mbed Studio: zlib v1.2.12 stream decompresser \u003e~10k; lzma v22.01 stream decompresser ~6k; minilzo v2.10 memory decompresser 868 bytes(unsafe mode 628 bytes). )   \n   \nLarge data are supported, both compress and decompress support streaming. \nThe compress and decompress speed is related to the characteristics of the input data and parameter settings; \nOn modern CPUs, compress speed is slower by about 0.4MB/S--2MB/S, and decompress speed is faster by about 180MB/S--300MB/S.   \n\n---\n## Releases/Binaries\n[Download from latest release](https://github.com/sisong/tinyuz/releases) : Command line app for Windows, Linux, MacOS.     \n( release files build by projects in path `tinyuz/builds` )   \n\n## Build it yourself\n### Linux or MacOS X ###\n```\n$ cd \u003cdir\u003e\n$ git clone https://github.com/sisong/tinyuz.git     tinyuz\n$ git clone https://github.com/sisong/HDiffPatch.git HDiffPatch\n$ cd tinyuz\n$ make\n```\n### Windows ###\n```\n$ cd \u003cdir\u003e\n$ git clone https://github.com/sisong/tinyuz.git     tinyuz\n$ git clone https://github.com/sisong/HDiffPatch.git HDiffPatch\n```\nbuild `tinyuz/builds/vc/tinyuz.sln` with [`Visual Studio`](https://visualstudio.microsoft.com)   \n\n---\n## command line usage:  \n```\ncompress   : tinyuz -c[-dictSize]  inputFile outputFile\ndeccompress: tinyuz -d[-cacheSize] inputFile outputFile\noptions:\n  -c[-dictSize]\n      set compress dictSize;\n      dictSize\u003e=1, DEFAULT -c-16m, recommended: 127, 4k, 1m, 512m, etc...\n      requires O(dictSize*18) bytes of memory;\n  -d[-cacheSize]\n      set decompress cacheSize;\n      cacheSize\u003e=2, DEFAULT -d-256k, recommended: 64, 1k, 32k, 4m, etc...\n      requires (dictSize+cacheSize) bytes of memory;\n```\n\n---\n## library API usage:\ncompress:\n```\nhpatch_StreamPos_t tuz_compress(const hpatch_TStreamOutput* out_code,const hpatch_TStreamInput* data,\n                                const tuz_TCompressProps* props);\n```\ndecompress:\n```\ntuz_size_t tuz_TStream_read_dict_size(tuz_TInputStreamHandle inputStream,tuz_TInputStream_read read_code);\ntuz_TResult tuz_TStream_open(tuz_TStream* self,tuz_TInputStreamHandle inputStream,tuz_TInputStream_read read_code,\n                             tuz_byte* dict_and_cache,tuz_size_t dict_size,tuz_size_t cache_size);\ntuz_TResult tuz_TStream_decompress_partial(tuz_TStream* self,tuz_byte* out_data,tuz_size_t* data_size);\n```\ncan also decompress at once in memory:\n```\ntuz_TResult tuz_decompress_mem(const tuz_byte* in_code,tuz_size_t code_size,tuz_byte* out_data,tuz_size_t* data_size);\n```\n\n---\n## test compression ratio:\nratio: compressedSize/uncompressedSize   \nzlib v1.2.11: test with compress level 9, windowBits -15   \ntinyuz v0.9.2: test with multiple different dictSizes 32MB,1MB,32KB,5KB,1KB,255B,79B,24B   \n  ('tuz -32m' means: tinyuz -c-32m)   \n   \n\"aMCU.bin\" is a firmware file of MCU device;   \n\"aMCU.bin.diff\" is a uncompressed differential file between two versions of firmware files (created by [HPatchLite](https://github.com/sisong/HPatchLite));   \n\"A10.jpg\"--\"world95.txt\" download from http://www.maximumcompression.com/data/files/index.html   \n\"enwik8\" download from https://data.deepai.org/enwik8.zip   \n\"silesia.tar\" download from https://sun.aei.polsl.pl//~sdeor/index.php?page=silesia\n   \n||zlib -9|tuz -32m|tuz -1m|tuz -32k|tuz -5k|tuz -1k|tuz -255|tuz -79|tuz -24|\n|:----|----:|----:|----:|----:|----:|----:|----:|----:|----:|\n|aMCU.bin|46.54%|45.80%|45.80%|45.98%|49.16%|54.29%|60.61%|68.03%|77.95%|\n|aMCU.bin.diff|5.29%|5.75%|5.75%|5.75%|5.95%|6.35%|6.89%|7.85%|9.54%|\n|A10.jpg|99.88%|99.99%|99.99%|99.99%|99.99%|99.99%|99.99%|99.99%|99.99%|\n|AcroRd32.exe|44.88%|42.01%|42.12%|43.80%|46.53%|51.48%|58.29%|67.57%|78.81%|\n|english.dic|25.83%|28.62%|28.65%|29.20%|29.98%|31.25%|33.49%|36.53%|39.93%|\n|FlashMX.pdf|84.76%|86.08%|85.34%|85.81%|87.34%|88.31%|89.90%|92.05%|96.83%|\n|FP.LOG|6.46%|4.95%|5.26%|7.36%|9.99%|12.67%|19.27%|99.25%|100.00%|\n|MSO97.DLL|57.94%|53.54%|54.12%|56.96%|59.80%|64.38%|70.62%|78.36%|87.73%|\n|ohs.doc|24.05%|20.65%|21.03%|24.50%|26.85%|31.08%|37.50%|69.31%|82.85%|\n|rafale.bmp|30.23%|30.30%|30.40%|32.66%|35.51%|40.81%|43.52%|47.70%|54.42%|\n|vcfiu.hlp|20.41%|17.71%|17.79%|20.39%|24.24%|27.46%|32.39%|49.01%|69.64%|\n|world95.txt|28.87%|22.88%|23.44%|30.79%|47.15%|54.96%|65.23%|78.53%|97.20%|\n|enwik8|36.45%|30.09%|33.22%|38.36%|43.96%|51.53%|63.38%|79.63%|96.78%|\n|silesia.tar|31.98%|28.41%|29.66%|33.27%|38.21%|44.45%|52.58%|63.62%|78.49%|\n\n---\n## Contact\nhousisong@hotmail.com  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisong%2Ftinyuz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsisong%2Ftinyuz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsisong%2Ftinyuz/lists"}