Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I suppose zipping is no option?
So what's wrong with storing only the differences for a line? Consecutive entries are normally less than 10 apart. You only need 4 bits for 0-15. I'd probably use 0 as escape code to enter bigger differences a bit like utf 8 does its compression. I had to download and run your code on my mobile, some sample output would have been nice. Did it as a proof of concept to run Emacs and Perl inside termux there, which is uber mega cool!!! xD Here my tweaked insights for others (I deleted the ord and the 33+ and added delimiters for each number and group.
UpdateSo any code d with 0<d<16 is a difference0ab is the code for a difference with 0<0xab<256 You'll also need to denote the line's end. Either by a counter at the beginning or with 000 or 0000 for newline. Since this code works with 4 bit nibbles you'll get a binary format. If you need an ASCII representation use base64 then. If you need better compression look up Huffman coding on WP.
Cheers Rolf
In reply to Re: Data compression by 50% + : is it possible?
by LanX
|
|