in reply to Data compression by 50% + : is it possible?
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.
2:5:8: 13:17: 22:25:27: 33:39: 45: 55:58: 67: 77: + 83:86: 2: 12:15:18: 25:29: 34:39: 44:48: 58: 62:66:68: 7 +2:75: 83:87: 3:6: 17: 26: 33:36: 45:47: 57: 65:69: 73:76:79: + 84:88: 8: 15: 23: 36: 43:49: 55: 75: 84:89:
0ab 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
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Data compression by 50% + : is it possible?
by LanX (Saint) on May 12, 2019 at 00:34 UTC | |
by LanX (Saint) on May 12, 2019 at 02:26 UTC |