Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
qoi
Discontinued A rust implementation of the “Quite OK Image” format for fast, lossless image compression (by steven-joruk)
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
> The lookup table is small enough to fit into 8 AVX2 registers
Indeed.
> so instead of hashing, you could use direct lookup
However, I don’t think that part gonna work. See the code using that table: https://github.com/phoboslab/qoi/blob/master/qoi.h#L324-L328
SIMD registers aren’t indexable (at least not on AMD64), the register needs to be known to the compiler.
Lanes within each register aren’t indexable either. The insert and extract instructions are encoding lane index in the code. There’re workarounds for this one, like abusing vpshufb or vpermd, but with that amount of overhead I doubt SIMD will deliver any profit at all.
The simplest form is just to pack 10 or 12 bit values. There's all kinds of variations of that:
https://github.com/pedrocr/rawloader/blob/a59bb78d156277781a...
There are a few formats that use a curve and less bits. They do become lossy and doing dithering on decompress is useful to avoid banding.
The Nikon one you mention was only used very early and is decoded by decode_8bit_wtable() in that file. It's just looking up the 8 bit value in the table and then adding some randomness to prevent the banding.
- I feel like the benchmark suite is lacking. For better overview you probably should include libpng results with max compression level and lowest compression level. Lossless modes of AVIF and WEBP would be nice. (also could throw similar project to yours like https://github.com/catid/Zpng) Not saying the benchmark is bad, but IMHO doesn't paint the full picture. From quick test I got significantly better compression on libpng, ofc in expense of time, but you didn't optimize it for speed either. So we have some results, but they are not really representative imho.
I really like the format, good job. I've been working on a rust implementation: https://github.com/steven-joruk/qoi
Related posts
- Announcing: ImageSieve, a tool to assist in sorting and archiving images and videos
- Show HN: Lipupini, an OSS PHP Media Platform, has reached release cycle v5.x
- GoCV 0.36 has just been released, no fooling
- Kroki: A unified API to create any kind of diagram from text
- Optimizing Images for Developer Blogs