Conversation
|
CI failure is not related to the pr, avif decoder was not touched: error: there is no need to manually implement bit rotation
--> src/codecs/avif/decoder.rs:652:21
|
652 | *item = (*item << target_expand_bits) | (*item >> (16 - target_expand_bits));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: this expression can be rewritten as: `(*item).rotate_left(target_expand_bits)` |
|
What is the motivation for this change? Paletted mode mostly provides size savings, but BMP is an awful format if you want a small image size, so I'm not sure it's worth supporting in 2025. |
|
I don't know any better image format for 4bpp images that is fast to decompress too |
|
But at the end of the day I just vendored that encoder inside, if anyone would want that stuff they may dig out that pr and use it. I did pr just to share work. |
|
Oh, you needed to write a paletted image with 16 colors for embedded use where it's cheap to decode? That explains the motivation, thank you. |
Even though I think we won't merge this (interop with We had previously debated to spin |
|
I'm been wanting to add support to |
This PR adds support for 4 bit images for BMP encoder. I tested it with different images (with even/odd number of rows etc) with
tinybmpand images look exactly right.As far as I understand the API, if user passes
L4then we expect bytes user gives to already be packed. In my own code I used this helper to create those bufs (this is not a part of PR):