phoboslab / qoi

The “Quite OK Image Format” for fast, lossless image compression
MIT License
6.92k stars 330 forks source link

Question about improvement of compression: "A run of the previous pixel" - let you choose which is the previous pixel #183

Closed AndroidDeveloperLB closed 2 years ago

AndroidDeveloperLB commented 2 years ago

For each pixel in the input bitmap (except the top-left corner), a single bit would tell what to compare to.

This could improve compression performance for the case that "previous pixel" is the one on the left, yet it's too different and therefore would require to have 2 bytes instead of 1, and yet if it's compared to the one above, the difference is small enough.

For the left&top edges, you could decide what the bit would mean (compared to top-left pixel? Compared to something else?).

The downside would be longer encoding, though.

Is it possible?