{"id":22316489,"url":"https://github.com/lorandil/ucompression","last_synced_at":"2025-10-29T03:42:12.119Z","repository":{"id":264501876,"uuid":"889626993","full_name":"Lorandil/uCompression","owner":"Lorandil","description":"Simple and fast compression/decompression library especially for small microcontrollers","archived":false,"fork":false,"pushed_at":"2024-11-24T19:38:26.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T01:53:04.475Z","etag":null,"topics":["arduino","attiny","avr","bitmap","compression","decompression","esp","oled","optimized","pico","small"],"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/Lorandil.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-16T20:04:27.000Z","updated_at":"2024-11-24T19:38:29.000Z","dependencies_parsed_at":"2024-11-24T23:47:09.904Z","dependency_job_id":null,"html_url":"https://github.com/Lorandil/uCompression","commit_stats":null,"previous_names":["lorandil/ucompression"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lorandil%2FuCompression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lorandil%2FuCompression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lorandil%2FuCompression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lorandil%2FuCompression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lorandil","download_url":"https://codeload.github.com/Lorandil/uCompression/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245581628,"owners_count":20639010,"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":["arduino","attiny","avr","bitmap","compression","decompression","esp","oled","optimized","pico","small"],"created_at":"2024-12-03T23:06:44.166Z","updated_at":"2025-10-29T03:42:12.036Z","avatar_url":"https://github.com/Lorandil.png","language":"C++","readme":"# uCompression\nFlash memory is valuable resource, especially when using graphical displays on small micro controllers like an ATTiny85 or the ATMega328PB (Arduino UNO). This is where data compression might save the day!\n\n**uCompression** provides fast RLE compression and decompression functions for micro controllers.\nIt's easy to use, as it is implemented as static member functions, so no instance of the class is required.\n\n*The main design goals were code size and speed.*\n\n## Compressing data\n\n```javascript\nuint16_t uCompression::RLEcompress( const uint8_t* uncompressedData,\n                                    uint8_t*       compressedData,\n                                    uint16_t       chunkSize );\n```\nor when compressing data already stored in the program memory:\n\n```javascript\nuint16_t uCompression::pgm_RLEcompress( const uint8_t* uncompressedData,\n                                        uint8_t*       compressedData,\n                                        uint16_t       chunkSize );\n```\n\n## Uncompressing data\nIf the compressed data is stored in RAM, it can be uncompressed by\n\n```javascript\nconst uint8_t* uCompression::RLEdecompress( const uint8_t* compressedData,\n                                            uint8_t*       uncompressedData,\n                                            uint16_t       chunkSize );\n```\n\nIf the compressed data is stored in the program memory, the data can be decompressed with\n\n```javascript\nconst uint8_t* uCompression::pgm_RLEdecompress( const uint8_t* compressedData,\n                                                uint8_t*       uncompressedData,\n                                                uint16_t       chunkSize );\n```\n\nIn the common case that the chunk size doesn't exceed 256 bytes, a slightly smaller and faster version can be used:\n\n```javascript\nconst uint8_t* uCompression::pgm_RLEdecompress256( const uint8_t* compressedData,\n                                                   uint8_t*       uncompressedData,\n                                                   uint8_t chunkSize );\n```\n\n\n## Performance\n As with most compression algorithms, the decompression rate depends on the original data.\u003cbr\u003e \nFor some AVR chips (**ATmega328, ATmega32U4, ATTiny85**) assembly code\n is automatically used, resulting in approximately the double decompression speed.\n \nHere is a small table showing decompression speeds for a selection of test files on some MCUs.\n \n| MCU              | Clock Speed   | Data Source   | Decompression Speed | Code Used |\n| ---------------- |:-------------:|:-------------:|:-------------------: |:--------:|\n| Arduino UNO R3   | 16 MHz        | RAM      \t   | 0.7M B/s .. 1.0 MB/s | C++      | \n|                  | 16 MHz        | FLASH(PROGMEM)| 1.4 MB/s .. 2.0 MB/s | Assembly |\n| Arduino Leonardo | 16 MHz        | RAM      \t   | 0.7M B/s .. 1.0 MB/s | C++      | \n|                  | 16 MHz        | FLASH(PROGMEM)| 1.4 MB/s .. 2.0 MB/s | Assembly |\n| Arduino Mega2560 | 16 MHz        | RAM/FLASH \t   | 0.7M B/s .. 1.0 MB/s | C++      | \n| Arduino UNO R4   | 48 MHz        | RAM/FLASH     | 3.0 MB/s .. 3.8 MB/s | C++      |\n| Raspberry Pi pico| 133 MHz       | RAM/FLASH     | 7.9 MB/s .. 10.2 MB/s| C++      |\n\n\n## Limitiations\nThe first and most important limitation is, that there is **NO error checking**!\nIf a target buffer is too small or the chunk sizes for encoding is larger than for decoding, the behaviour is undefined, most likely the MCU will crash or reboot.\n\nRLE algorithms are specialized on efficiently compressing constant data areas. Random data cannot be compressed and will result in the compressed data being slightly larger than the original data.\u003cbr\u003e\nUnder worst case conditions the resulting size will exceed the original data size (by 1 byte for every 63 bytes of source data in a chunk).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florandil%2Fucompression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Florandil%2Fucompression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florandil%2Fucompression/lists"}