Page 1 of 1

QOI

Posted: Sun May 22, 2022 9:01 pm
by Kjell
8)

Attached is a QOI decoder including a simple demo that loads a external QOI image containing a single frame of the selected fighter into a texture. Obviously this makes more sense when the images you're loading are a lot bigger than in this example, but the approach would remain the exact same.

Image

Use the arrow keys to select a fighter.

K

Re: QOI

Posted: Mon May 23, 2022 7:15 am
by VilleK
That is very neat! I've been keeping an eye on this format and your implementation looks solid. With a cool demo as usual :)

What kind of compression ratio do you get for the included images?

Re: QOI

Posted: Mon May 23, 2022 7:37 am
by Kjell
Hej Ville,
VilleK wrote: Mon May 23, 2022 7:15 amWhat kind of compression ratio do you get for the included images?
It varies from situation to situation, but in this case the original PNG images were 59228 bytes total, while the QOI images are only 36970 bytes. Due to the limited color palette & large number of masked pixels most of the data-chunks are either RLE or indexed which explains the impressive compression ratio.

K

Re: QOI

Posted: Tue May 24, 2022 7:55 am
by VilleK
Kjell wrote: Mon May 23, 2022 7:37 am original PNG images were 59228 bytes total, while the QOI images are only 36970 bytes.
That is impressive indeed. When I read the QOI spec I thought well this looks nice and simple but it will surely be much worse compression than PNG for most pictures. But it turns out it is really quite ok as a general image format. The simplicity makes it super fast and the implementation very compact.

A bold move by the author to ignore the complexity of modern formats and just go back to basics.