Open abhaychirania2411 opened 1 year ago
For decoding, I have a small header only decoder that accepts caller allocated memory: qoi-dec.c.
It also does a couple small optimization around redundant table insertion and bounds checking so it's a bit faster (especially with clang) than the official decoder:
decode ms decode mpps
qoi: 2.1 148.65
qoi-dec: 1.6 199.59
Maybe that interests you. The code is public domain so you can do whatever you want with it.
I don't have any encoder though. But @skeeto has one here: qoi.c. It's a streaming encoder and the caller is in control of the buffer where the encoder writes into.
Hi,
I have been working on a project that needs qoi encoding and decoding, but the final results should be put in a pre allocated memory. Although we can provide our own allocator, but i want to provide a pre allocated memory to the encoded function.
Something like this: void qoi_encode(const void data, const qoi_desc desc, int out_len, void *dest);
This dest adress can be optional, i.e if NULL then go ahead and allocate the memory using QOI_MALLOC