{"id":26207564,"url":"https://github.com/recp/huff","last_synced_at":"2025-12-27T02:19:10.265Z","repository":{"id":275850038,"uuid":"909805876","full_name":"recp/huff","owner":"recp","description":"canonical huffman coding","archived":false,"fork":false,"pushed_at":"2025-07-09T22:59:54.000Z","size":59,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-14T05:48:45.504Z","etag":null,"topics":["c","canonical-huffman","compression","deflate","huffman","huffman-coding","inflate","jpeg","png","zip","zlib"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/recp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-12-29T20:35:14.000Z","updated_at":"2025-07-17T22:32:50.000Z","dependencies_parsed_at":"2025-02-04T23:04:39.448Z","dependency_job_id":"717f7f4c-b3da-4daa-a553-e431c0440b76","html_url":"https://github.com/recp/huff","commit_stats":null,"previous_names":["recp/huff"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/recp/huff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fhuff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fhuff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fhuff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fhuff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/recp","download_url":"https://codeload.github.com/recp/huff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recp%2Fhuff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28069367,"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","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c","canonical-huffman","compression","deflate","huffman","huffman-coding","inflate","jpeg","png","zip","zlib"],"created_at":"2025-03-12T05:36:20.375Z","updated_at":"2025-12-27T02:19:10.243Z","avatar_url":"https://github.com/recp.png","language":"C","readme":"# 🗜️ Huffman Coding (In Progress)\n\nThis library is designed to make **Huffman coding** easy to use, while providing \noptimized and reusable utilities. It aims to simplify the integration of Huffman \ncoding into projects, improve maintainability, and ensure robust testing.\n\nHuffman coding is a cornerstone of many compression algorithms and formats, widely used in:\n  - 🖼️ Images: JPEG, PNG, WebP, GIF.\n  - 🎥 Video: MPEG, H.264, HEVC (H.265).\n  - 🎵 Audio: MP3, AAC, Opus.\n  - 📦 Compression: ZIP, DEFLATE, Brotli.\n  - 🔗 Networking: HTTP/2, HTTP/3 (QUIC) header compression.\n\nThis library seeks to serve as a shared foundation for these and other \napplications, offering standardized, high-performance tools for encoding and \ndecoding Huffman streams.\n\n🚨 Don't use this in production until tests are ready\n\n## 🔧 Usage\n\n### Initializing a Huffman Table\nThe library provides two initialization functions:\n- `huff_init_lsb()` for LSB-first bitstreams.\n- `huff_init_msb()` for MSB-first bitstreams.\n\n```c\n// Example: Initializing a Huffman table for LSB-first bitstreams (e.g., DEFLATE)\nhuff_table_t table;\nuint8_t      lengths[] = {3, 3, 3, 3}; // Bit lengths for each symbol\nuint16_t     symbols[] = {0, 1, 2, 3}; // Corresponding symbols\nhuff_init_lsb(\u0026table, lengths, symbols, 4);\n```\n\n## Decoding a Symbol\n\n```c\n// LSB-first decoding\nbitstream_t   bitstream = 0b10110010; // Example LSB-first bitstream\nuint8_t       bit_length = 8; // Number of valid bits\nuint8_t       used_bits;\nuint_fast16_t symbol = huff_decode_lsb(\u0026table, bitstream, bit_length, \u0026used_bits);\n```\n\n## TODO\n\n- [x] lsb\n- [ ] sub tables?\n- [ ] msb\n- [ ] tests\n- [ ] build\n- [ ] documentation\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecp%2Fhuff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecp%2Fhuff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecp%2Fhuff/lists"}