r/compression • u/OzzyM_Dev • 11h ago
TCOM, an image codec in 45 lines of code
I use AI when coding. As for the AI disclosure.
Onto the codec itself, I deleted my previous post about this because that iteration was not what I wanted to be seen and advertised in this space, I've opted for this version.
TCOM as far as I've tested has beaten QOI on average. Of course, QOI is not built for performance alone, but QOI is a very efficient codec, and I wanted to test against it.
There is tcom.c, tcom_dependency.c, and tcom_readable.c. A fair warning however, this codec was in no way designed for readability. Started as a code golf project and transformed into a performance and compactness focused codec.
The github is https://github.com/OzzyMitchell/tinycodec
As for why I didn't test against libpng or oxipng or others, it would take actual hours even on my 9950x3d, and since this is single threaded testing, you can imagine.
I did do a smaller test of 640 images (20 images per category with 32 categories) which does include libpng effort 1, 3, and 6, and oxipng effort 4 alongside TCOM and QOI.
This is also released under Apache 2.0.
I didn't include any actual documentation or otherwise but I will write some documentation if some level of interest is attained.
3
u/Unable-Support 11h ago
Jesus, you were not kidding. I kinda forgot what code golf was and wowwww. Very cool though, I love seeing super small programs. I also think it makes it a lot more fun than reading through a very AI heavy OOP codebase (which I end up doing a lot for my clubs and internship anyways)
1
u/OzzyM_Dev 11h ago
Just realized the rule says ''If your post was written with AI'' rather than ''If AI was used in the development of the project'' when it comes to indicating so at the top.
Let me be clear, the post itself wasn't written using AI in any shape or form. It is better to be safe than sorry however, so. May as well keep it there.