Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btile: alternative XOR storage of tile data for better compression ratio #109

Open
jorgegv opened this issue Oct 10, 2022 · 1 comment
Open
Assignees
Labels
enhancement New feature or request size optimization
Milestone

Comments

@jorgegv
Copy link
Owner

jorgegv commented Oct 10, 2022

Bedazzle user in SC forum raised the following issue:

I heard from other people (but didn't tried myself), that xoring data with previous byte is producing more similar bytes, and later compression gets better result.

Analysis:

I found something about this, it looks like for bytes that do not change very much (one from the next) it would work: https://stackoverflow.com/questions/133 ... -technique

If we do this we can't address the data directly, but only in a sequential manner, since I need to read each byte and then xor it with the previous one to get the good data.

I'm not really sure if this would be applicable to tile compression BUT if the 8-byte tile is stored top to bottom (which it normally is) it may work: normally there tends to be graphical continuity from top to down, which translates in byte similarities between one byte and the next and thus XORing may be useful as indicated in the link above.

It sounds very reasonable, and even usable for individual tiles: if the 8 bytes of a tile are always accessed one after another (they would unless using some non-common interleaving of graphic data), the overhead of a XOR to get each byte may be small and acceptable if the compression ratio gets better.

We should try storing the tiles with this schema, and then using ZX0 to compress the resulting DATASET, then compare results.

@jorgegv jorgegv added the enhancement New feature or request label Oct 10, 2022
@jorgegv jorgegv added this to the Release 0.6.0 milestone Oct 10, 2022
@jorgegv jorgegv self-assigned this Oct 10, 2022
@jorgegv jorgegv changed the title btile: investigate alternative XOR storage of tile data for better compression ratio btile: alternative XOR storage of tile data for better compression ratio Oct 10, 2022
@TheStruggleForAntiSpaghetti
Copy link

@jorgegv jorgegv modified the milestones: Release 0.6.0, Release 0.7.0 Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size optimization
Projects
None yet
Development

No branches or pull requests

2 participants