Commit Graph

11 Commits

Author SHA1 Message Date
8b99642e4c Fix: Luma unpack test
The compressed sample had the wrong value and was unpacking to a non-
zero delta-green value. This threw off the following iterations.
2024-10-14 21:07:29 -05:00
b05daa503e Fix: wrapping, store previous pixel value
The wrapping wasn't working properly, clearly, but I forgot about the
previous pixel entirely.

I'll add some more explicit tests for the previous pixel behavior. I
think it's still broken for RGB and RGBA, because I'm dumb.
2024-10-14 21:07:29 -05:00
62b35b5aba Cargo Format 2024-10-14 21:07:29 -05:00
85ad2fa252 OP_DIFF and OP_LUMA roll over and under test cases
I wasn't explicitly testing the wrapping behavior of the diff and luma
op codes.
2024-10-14 21:07:29 -05:00
ac4d88eb15 Fix OP_RUN test case
My did my numbers wrong. 0b1111 is definitely not 13. Not under normal
encodings, not with the -1 OP_RUN bias. Bro what.
2024-10-14 21:07:29 -05:00
79109cc40b Proper operation decoding
The op codes are now being recognized properly. I just gotta decode them
the right way. I fixed an error where I was bitwise-or -ing the values
instead of bitwise-and -ing them. Small brain up in here.
2024-10-14 21:07:29 -05:00
aa18ba5992 Cargo Format 2024-10-14 21:07:29 -05:00
1ca0394d4a Run length stored and checked during iteration
The run length can simply be extracted and stored as part of the
iterator state. For each iteration, check if the length is > 0, and emit
more pixels until it isn't. Then continue the normal decode process.
2024-10-14 21:07:29 -05:00
ef4b31dab6 Most of the decoders, but the match is broken
I was going to try to match over the op codes, but that isn't possible.

Most of the decoders are done, too, but I'm quite sure that the delta
operations will encounter a wrap around and then panic. The OP_RUN is a
problem, as well. I think I'm going to cheat this problem by holding a
counter. This way I can see if I'm in a run, and then emit another pixel
copy until counter == 0.
2024-10-14 21:07:29 -05:00
4a31b1e20a Change struct to grab input iterator, not slice
I want to iterate over the input elements, and I couldn't figure out how
to get the slice lifetime to be specified properly. I've swapped the
slice for any Iterator that emits u8's.
2024-10-14 21:07:29 -05:00
b77f32b2df Unit tests for unpacking each of the op codes
These tests can be used to verify the fundamentals of the decoder: That
individual instructions are parsed correctly and converted back into
the correct pixel values.
2024-10-14 21:07:29 -05:00