No Game Engine Game Dev: Word Sleuth 103: Debug QOI decoding, then coding QOI encoding

9 days ago
14

Streamed on 2024-12-19 (https://www.twitch.tv/thediscouragerofhesitancy)

Game Engines are for sissies!

Yesterday we got a good start on QOI decoding. There were some issues so that's where we started today. With a bit of debugging we learned that most of our issues were copy/paste errors in the BMP output code we stole from somewhere else in a different context. It wasn't too long before we could read a QOI file and output a BMP that was correct.

The next step was to reverse the process: read in a PNG and output a QOI. The QOI documentation is pretty straightforward so it wasn't too difficult to get that working as well. One of the nice things about the QOI implementation is that the encoder doesn't have to support every operation to get started. I implemented a few of the simple ones first (RGB, RGBA, Index and Run) before turning attention to Diff and Luma. The only tricky part is to test the distances with wrapping, but even without the wrapping detection the encoder gets the image almost as compressed as the example files.

Lastly I plumbed the new QOI encoder into out PNG embedding asset pipeline. With only a few minutes of work there it was compressing all of our art assets to 14% of their original size.

Due to our four days of effort on sound and image compression, the size of our executable shrunk to 24% of the size it was at the start of this week. Not too shabby, if I do say so myself.

Loading 1 comment...