{"id":21725680,"url":"https://github.com/jakubtomsu/odxt","last_synced_at":"2025-09-10T20:44:22.202Z","repository":{"id":240227302,"uuid":"788469500","full_name":"jakubtomsu/odxt","owner":"jakubtomsu","description":"A small library for S3 texture compression (DXT1-5/BC1-5). Port of stb_dxt.h","archived":false,"fork":false,"pushed_at":"2024-05-17T12:15:59.000Z","size":20952,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T22:54:29.130Z","etag":null,"topics":["bcn","dxt","odin-lang","stb","texture-compression"],"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/jakubtomsu.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}},"created_at":"2024-04-18T13:29:44.000Z","updated_at":"2024-12-27T02:02:57.000Z","dependencies_parsed_at":"2024-05-17T12:55:18.919Z","dependency_job_id":"6e616e52-5867-43b0-8497-f243489d910a","html_url":"https://github.com/jakubtomsu/odxt","commit_stats":null,"previous_names":["jakubtomsu/odxt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakubtomsu%2Fodxt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakubtomsu%2Fodxt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakubtomsu%2Fodxt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakubtomsu%2Fodxt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakubtomsu","download_url":"https://codeload.github.com/jakubtomsu/odxt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643047,"owners_count":21138353,"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":["bcn","dxt","odin-lang","stb","texture-compression"],"created_at":"2024-11-26T03:19:55.669Z","updated_at":"2025-04-12T22:54:37.601Z","avatar_url":"https://github.com/jakubtomsu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Small S3 Texture Compression Library for Odin\n(The original implementation is a port of stb_dxt.h)\n\nSupports **BC1-5** and **DXT1-5**\n\n\u003e S3TC is a technique for compressing images for use as textures. Standard image compression techniques like JPEG and PNG can achieve greater compression ratios than S3TC. However, S3TC is designed to be implemented in high-performance hardware. JPEG and PNG decompress images all-at-once, while S3TC allows specific sections of the image to be decompressed independently.\n\n\u003e S3TC is a block-based format. The image is broken up into 4x4 blocks. For non-power-of-two images that aren't a multiple of 4 in size, the other colors of the 4x4 block are taken to be black. Each 4x4 block is independent of any other, so it can be decompressed independently.\n\u003e (from [opengl wiki](https://www.khronos.org/opengl/wiki/S3_Texture_Compression))\n\n### Supported Formats\nName       | Description               | Premul Alpha  | Compression      | Texture type\n-----------|---------------------------|---------------|------------------|---------------\nBC1/DXT1   | 1-bit alpha / opaque      | Yes           | 6:1 (24bit src)  | Simple non-alpha\nBC2/DXT2   | Explicit alpha            | Yes           | 4:1              | Sharp alpha\nBC2/DXT3   | Explicit alpha            | No            | 4:1              | Sharp alpha\nBC3/DXT4   | Interpolated alpha        | Yes           | 4:1              | Gradient alpha\nBC3/DXT5   | Interpolated alpha        | No            | 4:1              | Gradient alpha\nBC4        | Interpolated greyscale    | --            | 2:1              | Gradient\nBC5        | Interpolated two-channel  | --            | 2:1              | Gradient\n\n## Usage\n\n```odin\nimport dxt \"odxt\"\n\nmain :: proc() {\n    image = load_image(\"foo.png\")\n    \n    for bx := 0; bx \u003c image.width; bx += 4 {\n        for by := 0; by \u003c image.height; by += 4 {\n            block: [16][4]u8\n            for sx in 0..\u003c4 {\n                for sy in 0..\u003c4 {\n                    x = bx + sx\n                    y = by + sy\n                    if x \u003e= image.width || y \u003e image.width {\n                        continue\n                    }\n                    \n                    index = x + y * image.width\n                    block[sx + sy * 4] = {\n                        image.data[index + 0],\n                        image.data[index + 1],\n                        image.data[index + 2],\n                        image.data[index + 3],\n                    }\n                }\n            }\n            \n            compressed := dxt.compress_bc1_block(block)\n            \n            // ...\n        }\n    }\n}\n```\n\n## Contributing\nBug fixes and other contributions are welcome, please submit a PR!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakubtomsu%2Fodxt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakubtomsu%2Fodxt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakubtomsu%2Fodxt/lists"}