{"id":22123093,"url":"https://github.com/bcrist/zig-rom-compress","last_synced_at":"2025-03-24T07:28:00.599Z","repository":{"id":207984201,"uuid":"711232257","full_name":"bcrist/Zig-ROM-Compress","owner":"bcrist","description":"Simple compression scheme for sparse ROM data","archived":false,"fork":false,"pushed_at":"2024-01-13T03:20:45.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-29T12:48:11.544Z","etag":null,"topics":["compression","compression-algorithm","embedded","encoding","rom","zig","zig-library","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/bcrist.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":"2023-10-28T15:56:51.000Z","updated_at":"2024-06-22T15:18:22.000Z","dependencies_parsed_at":"2023-11-18T22:30:20.693Z","dependency_job_id":"c6b5a7a4-884a-4297-b6d7-d3899c0e1b86","html_url":"https://github.com/bcrist/Zig-ROM-Compress","commit_stats":null,"previous_names":["bcrist/zig-rom-compress"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcrist%2FZig-ROM-Compress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcrist%2FZig-ROM-Compress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcrist%2FZig-ROM-Compress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bcrist%2FZig-ROM-Compress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bcrist","download_url":"https://codeload.github.com/bcrist/Zig-ROM-Compress/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245226719,"owners_count":20580736,"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":["compression","compression-algorithm","embedded","encoding","rom","zig","zig-library","zig-package","ziglang"],"created_at":"2024-12-01T15:29:21.492Z","updated_at":"2025-03-24T07:28:00.574Z","avatar_url":"https://github.com/bcrist.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zig-Rom-Compress\n\nA simple algorithm for in-storage compression of potentially sparse data where the data will be fully uncompressed before usage.\n\nThe motivating use case is when using a microcontroller to bootstrap an SRAM at reset, which will thereafter function as a lookup table/ROM.\nOften times such lookup tables may contain several megabytes of highly patterned data, but you'd like to initialize it with just a small/cheap microcontroller, and typically these will have much less than 1MB of flash memory.\n\nNote for most data, an LZ-based compressor like DEFLATE will achieve a better compression ratio, but doesn't support sparse data without adding additional metadata.\nThe decompressor for this scheme is also very simple and requires only a few bytes of working RAM.\n\n## Algorithm\n\nThe key insight that we make use of is that many data words are likely to be repeated many times,\nand there may be many \"don't care\" addresses that we need not initialize at all.\nFurthermore, the data need not be reconstructed in linear order.\n\nThe compressor begins by partitioning the data into lists of addresses which point to the same data value.\nThen it sorts the addresses within those lists, and sorts the partitions based on the data value.\nIt can then use delta compression and RLE on the transformed data.\n\nThe algorithm works well in most real-world cases where there are many addresses with the same data value,\nand even better if those addresses appear in contiguous blocks.\nIt is possible, however, (particularly with encrypted or random-like data) that the compressed version may actually be larger.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcrist%2Fzig-rom-compress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbcrist%2Fzig-rom-compress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbcrist%2Fzig-rom-compress/lists"}