Quick Update - 16 Aug 2023

QOI-R has been joined by QUAIL, a new from-scratch nibble-oriented single-pass lossless image codec that produces files considerably smaller than QOI-R, albeit with a moderate performance penalty. There will be a writeup here soon - but until then, find it in the quail branch.

QOI Remix

QOI-Remix is an incompatible variant of Dominic Szablewski's excellent Quite OK Image Format with the aim of providing a measurable density improvement with a moderate compute penalty.

The code can be found on sourcehut.

Compared to PNG, QOI-R is generally...

  • Much faster, especially on encode. Depending on platform, it's typical to see QOI-R do 25-35x libpng encode throughput and 2-5x libpng decode throughput.
  • Competitive on size to libpng, though there are exceptions on particularly dictionary-friendly images. QOI-R images range from moderately smaller than PNGs to significantly larger, with an average of very slightly larger. Semi-frequently, QOI is larger than PNG and QOI-R is smaller than PNG.

Compared to QOI, QOI-R is generally...

  • A little slower (~10-25% lower encode throughput, ~10% lower decode throughput - though with a significant exception on one platform, where QOI-R encode throughput exceeds QOI but QOI-R decode throughput is drastically lower.)
  • Smaller, though there are exceptions. Many images are effectively the same size between QOI and QOI-R, while on others, QOI-R achieves substantial reductions. A full set of image size comparisons is included in the source repository.

What did QOI-R change?

QOI-Remix incorporates three major changes from QOI.

  • Changes to the run length encoding that allow for slightly more efficient encoding of long runs, equivalent encoding of short runs, and less efficient encoding of medium runs; this opens up encoding space for other changes
  • A new dense pixel format, allowing a substantial percentage of RGB pixels to be encoded in three bytes rather than four
  • A new second-level recent-pixel index, with 1024 entries, that can encode a reference to a recent pixel in two bytes

What is QOI-R for?

I had a couple of days to kill and thought QOI was really cool. That's it. Most of QOI-R was designed and implemented while spending several hours in a waiting room. There's not a grand plan or use case here. It's not intended to replace PNG, and it's not intended to replace QOI - but to provide an alternative on a different part of the lossless image compression Pareto curve. It's very fast, embeddable, fairly portable, and produces dense files.

What is the future of QOI-R?

The QOI-R bitstream format is essentially done. There are a few things I'm working on for QOI and/or QOI-R - KImageFormats support, optimized assembly backends, and some helpful utilities. These will be released over time.

I have ideas for a lossless image format that would be a larger departure from QOI, and will probably end up being named QUAIL. This may inherit concepts from QOI and QOI-R but will be a distinct format with its own magic number, and not a new QOI-R version.

Where's the spec?

It's coming. Until then, the code is there. Feel free to email me at sunset@arcanesciences.com with questions.