Log in

View Full Version : QOI formats family


AuburnSounds
12th November 2022, 15:28
QOI

Perhaps you heard about QOI last year: https://qoiformat.org/
https://en.wikipedia.org/wiki/QOI_(image_format)

Introduced as a "Quite OK" image format, QOI was declared final with a very simple specification (https://qoiformat.org/qoi-specification.pdf). So while it enjoyed online instant success due to small C implementation (even going to hardware (https://www.xilinx.com/products/intellectual-property/1-1o2l4ko.html)), there are inevitably derivatives that ended up appearing, some of us were lured by the efficiency gains over an inspiring format.

tl;dr So a class of small DIY image codecs appear with focus on lossless, fast decode/encode, and simplicity, and yeah I've made one too.

Most of that effort is indexed in:
- https://github.com/nigeltao/qoi2-bikeshed, the place that bred the most improvements

The base QOI is a lossless image codec for sRGB images with 3 or 4 8-bit channels. It encodes and decodes faster than PNG, is generally less efficient though except on synthetic images. No chroma subsampling or YUV conversion, no entropy coding, syntax is encoded using whole bytes boundaries.

Most derivatives adds LZ4 or zstd compression scheme on top of the bitstream.
All QOI derivatives improves upon the coding efficiency AFAIK.

https://qoiformat.org/

QOIP

In QOIP:
* opcodes themselves are stored in the format:
* LZ4 or zstd compression
https://github.com/chocolate42/qoipond


QOIR

QOIR adds:
* Color profile, EXIF
* premultiplied alpha
* lossy mode
* tile support
* LZ4 compression
* AFAIK it does this while beating the original QOI in terms of speed AND efficiency

Lots of benchmarks in: https://github.com/nigeltao/qoir


QOIX

QOIX is my very own version that adds:
* Greyscale [+alpha] 8-bit image support
* lossy 10-bit support (16-bit encoded as 10-bit, intended for elevation maps), so it's really 3 codecs
* optional LZ4

Home: https://github.com/AuburnSounds/gamut

tl;dr Such codecs are interesting for video games or software that use large synthetic images with not too much high frequency details. It can be used to improve application load times, and that's we use for large overlays. I guess it could also been used to cache decoded images, as an alternative to just LZ4 the pixels. It often looses vs PNG or JPEG but you can balance load times this way with fast decoding for parts of images.

Jamaika
12th November 2022, 20:24
qoipbench.c:107: warning: "ERROR" redefined
107 | #define ERROR(...) printf("abort at line " TOSTRING(__LINE__) ": " __VA_ARGS__); printf("\n"); exit(1)
|
In file included from c:\gcc1300\x86_64-w64-mingw32\include\windows.h:71,
from qoipbench.c:66:
c:\gcc1300\x86_64-w64-mingw32\include\wingdi.h:75: note: this is the location of the previous definition
75 | #define ERROR 0
|
qoipbench.c: In function 'benchmark_directory':
qoipbench.c:517:37: error: 'struct dirent' has no member named 'd_type'
517 | file->d_type & DT_DIR &&
| ^~
qoipbench.c:517:48: error: 'DT_DIR' undeclared (first use in this function); did you mean 'CB_DIR'?
517 | file->d_type & DT_DIR &&
| ^~~~~~
| CB_DIR
qoipbench.c:517:48: note: each undeclared identifier is reported only once for each function it appears in