bitbank2 / SLIC

Simple lossless imaging codec
Apache License 2.0
79 stars 6 forks source link

Make use of free code-word #5

Open DerAlbiG opened 1 year ago

DerAlbiG commented 1 year ago

Hi, i was playing around with your implementation and I love it. I added RGB332 support (8bit) to replace your gray-scale implementation. While doing so i noticed a system: The DIFF8 code is never used with a 0-argument. I dont mean binary 0, but the argument implying a zero-color-change - as a zero-color-difference is already encoded using a run. This leaves this particular code-word for other uses!

In particular, I had success utilizing this code-word to encode an 8bit "color excursion". Meaning a pixel pattern of "aba" where 'b' is encoded instead of using a BADRUN of length 1 and the second 'a' is implied. This is more compact than using the BADRUN instertion.

The "aba" pixel pattern commonly arises on thin image features or in dithered images.

Are you interested?

phoddie commented 1 year ago

The DIFF8 code is never used with a 0-argument. I dont mean binary 0, but the argument implying a zero-color-change - as a zero-color-difference is already encoded using a run. This leaves this particular code-word for other uses!

@DerAlbiG – Very cool observation. For my effort to add alpha support to SLIC at depths other than 32-bit (Issue #4), I needed another opcode too.

Unfortunately, it doesn't look like this repository is very active at the moment.

bitbank2 commented 1 year ago

sorry for holding you up; yes, you can make those changes.