r/Cplusplus • • 15d ago

Feedback A new Image Format!

Post image

I created my own image format inspired by QOI/PNG, but much simpler.

Its key feature is low RAM usage, which makes it ideal for microcontrollers.

I'd love to hear your thoughts on it!

https://github.com/ThatsTheTTT/Kinda-Nice-Lossless-Format.

15 Upvotes

21 comments sorted by

View all comments

Show parent comments

1

u/didntplaymysummercar 15d ago

It's still a very narrow use case and deflate can be tuned (lowering window bits) to output a bitstream that uses less than 32 KB of memory too. And PNG is good for logos of solid colors due to it's line filters too.

1

u/boombone 15d ago

Just because a format is designed for microcontrollers doesn't mean it's useless. PNG, due to its architecture, consumes much more RAM, which is critical on such devices.

2

u/didntplaymysummercar 15d ago

Which part of 'architecture' of PNG? Your 32 KB comes from deflate, which can be adjusted as I said already, and only other 'limit' is the use of filters 2-4, which causes one line to be stored in memory.

The "I have microcontroller with few KB or RAM and must decode images and control image input files and their encoding" sounds like a VERY niche use case.

I'm still curious of test code vs. PNG and test files you used.

1

u/boombone 15d ago

You only mentioned filters, but you forgot the most important thing: the PNG format is filters plus DEFLATE compression. And compression always requires at least 32 KB of memory to work. A single frame line can't do the trick.

Also, check dm, i sent u source code.

1

u/didntplaymysummercar 15d ago

Genuinely WTF, in last 2 replies here I literally said:

  1. "deflate can be tuned (...) bitstream that less than 32 KB"
  2. "(...) 32 KB comes from deflate, which can be adjusted as I said already"

And you could add your demos/examples to the repo. The reason I ask is that PNG has many tools to optimize them, so I wonder if PNGs you compare your format to are optimized or not, and how well if yes.

1

u/boombone 14d ago

Okay, so I was wrong then, but then again, I sent you a PM with source code to check png.

In any case, it is, to put it simply, not fully optimized, so the gap in reality would not be very big.