{"id":26218435,"url":"https://github.com/aftersol/simplified-qoi-codec","last_synced_at":"2025-04-15T23:48:58.234Z","repository":{"id":48463832,"uuid":"514424484","full_name":"Aftersol/Simplified-QOI-Codec","owner":"Aftersol","description":"An QOI codec that doesn't requires any other dependencies","archived":false,"fork":false,"pushed_at":"2025-04-06T09:13:51.000Z","size":53,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-06T09:23:55.435Z","etag":null,"topics":["c","compression","compression-implementations","cpp","decoder","embedded","embedded-c","embedded-systems","encoder","header-only","qoi","single-header","single-header-file","single-header-lib","single-header-library","singleheader","stb","stb-style"],"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/Aftersol.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":"2022-07-15T22:52:59.000Z","updated_at":"2025-04-06T09:13:54.000Z","dependencies_parsed_at":"2024-01-11T08:07:20.616Z","dependency_job_id":"cb3c600f-a994-4205-8f0f-6e62a6069159","html_url":"https://github.com/Aftersol/Simplified-QOI-Codec","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aftersol%2FSimplified-QOI-Codec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aftersol%2FSimplified-QOI-Codec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aftersol%2FSimplified-QOI-Codec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aftersol%2FSimplified-QOI-Codec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aftersol","download_url":"https://codeload.github.com/Aftersol/Simplified-QOI-Codec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249173060,"owners_count":21224481,"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":["c","compression","compression-implementations","cpp","decoder","embedded","embedded-c","embedded-systems","encoder","header-only","qoi","single-header","single-header-file","single-header-lib","single-header-library","singleheader","stb","stb-style"],"created_at":"2025-03-12T13:16:58.672Z","updated_at":"2025-04-15T23:48:58.206Z","avatar_url":"https://github.com/Aftersol.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simplified QOI Codec Library\nA one header file library for encoding and decoding QOI files.\n\n# Features\n- A much simpler and abstracted code\n- No 400MB limit found in reference QOI implementation\n- No extra memory allocation while running this codec[^1]\n- [Programmed in freestanding C useful in embedded systems](https://en.cppreference.com/w/c/language/conformance)\n\n[^1]: You must provide a pointer to an existing array to run this codec\n\n## How To Install Library\nPlace the *qoi.h* file into your project folder preferably in your project's include folder\n\nDefine the following below before you include *qoi.h* library in **one** of your source code file\n\n\t#define  SIMPLIFIED_QOI_IMPLEMENTATION\n\t#include \"sQOI.h\"\n\t\n## Minimal Implementation\n### Encoder\n\t/* \t\n\t\tAssume you opened the file and\n\t\tallocated enough memory for the encoder\n\t\tbefore this code\n\t*/\n\t\n\tqoi_desc_t desc;\n\tqoi_enc_t enc;\n\tuint8_t* pixel_seek;\n\t\n\tqoi_desc_init(\u0026desc);\n\tqoi_set_dimensions(\u0026desc, width, height);\n\tqoi_set_channels(\u0026desc, channels);\n\tqoi_set_colorspace(\u0026desc, colorspace);\n\n\twrite_qoi_header(\u0026desc, qoi_file);  \n\n\tpixel_seek = file_buffer;\n\tqoi_enc_init(\u0026desc, \u0026enc, qoi_file);\n\n\twhile (!qoi_enc_done(\u0026enc))\n\t{\n\t\tqoi_encode_chunk(\u0026desc, \u0026enc, pixel_seek);\n\t\tpixel_seek += desc.channels;\n\t}\n\n\t/* \n\t\tWrite the QOI file after encoding\n\t\tor do something else after encoding\n\t*/\n### Decoder\n\t/* After reading a QOI file and placed in buffer */\n\t\n\tqoi_desc_t desc;\n\tqoi_dec_t dec;\n\tqoi_pixel_t px;\n\t\n\tuint8_t *bytes;\n\tsize_t rawImageLength, seek;\n\t\n\tqoi_desc_init(\u0026desc);\n\t\n\tif (!read_qoi_header(\u0026desc, qoi_bytes))\n\t{\n\t\tprintf(\"The file you opened is not a QOIF file\\n\");\n\t\treturn;\n\t}\n\t\n\traw_image_length = (size_t)desc.width * (size_t)desc.height * (size_t)desc.channels;\n\n\tseek = 0;\n\tif (raw_image_length == 0)\n\t\treturn;\n\n\tqoi_dec_init(\u0026desc, \u0026dec, qoi_bytes, buffer_size);\n\t/* Creates a blank image for the decoder to work on */\n\tbytes = (unsigned char*)malloc(raw_image_length * sizeof(unsigned char) + 4);\n\n\tif (!bytes)\n\t\treturn;\n\n\t/* Keep decoding the pixels until\n\tall pixels are done decompressing */\n\twhile (!qoi_dec_done(\u0026dec))\n\t{\n\t\tpx = qoi_decode_chunk(\u0026dec);\n\t\t/* Do something with the pixel values below */\n\t\tbytes[seek] = px.red;\n\t\tbytes[seek + 1] = px.green;\n\t\tbytes[seek + 2] = px.blue;\n\t\t\n\t\tif (desc.channels \u003e 3) \n\t\t\tbytes[seek + 3] = px.alpha;\n\t\t\n\t\tseek += desc.channels;\n\t}\n\t\n\t/* Use the pixels however you want after this code */\n\n## How To Run Example Programs\n### Encoder\n\n    qoi_enc \u003cinput file\u003e \u003cwidth\u003e \u003cheight\u003e \u003cchannels\u003e \u003ccolorspace\u003e \u003coutput file\u003e\nInput file must be raw RGB or RGBA file\n\n### Decoder\nThis program only outputs raw RGB or RGBA files depending on the amount of channels in a QOI file\n\n\tqoi_dec \u003cinput file\u003e \u003coutput file\u003e\n## Software Requirements\n - C99 compiler or C++ compiler\n - [CMake 3.1](https://cmake.org/)\n\n## References\nThank you to the authors of the source code being used for inspiration for this source code\n### Official QOI References\n- [QOI Reference Implementation (phoboslab)](https://github.com/phoboslab/qoi)\n- [QOI Specification](https://qoiformat.org/qoi-specification.pdf)\n\n### Example Project That Use This Library\n- [N64 QOI Viewer](https://github.com/Aftersol/n64_qoi_demo)\n\n### Other QOI Programs\n- [Mini-QOI (sharaiwi) (decoder only)](https://github.com/shraiwi/mini-qoi)\n- [QOI Explained (YouTube: Reducible)](https://youtu.be/EFUYNoFRHQI?t=1411)\n- [floooh's QOI Viewer](https://floooh.github.io/qoiview/qoiview.html)\n- [FFmpeg](https://github.com/FFmpeg/FFmpeg)\n\t- [Encoder](https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/qoienc.c)\n\t- [Decoder](https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/qoidec.c)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faftersol%2Fsimplified-qoi-codec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faftersol%2Fsimplified-qoi-codec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faftersol%2Fsimplified-qoi-codec/lists"}