Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gzip compression on non byte aligned data

Is bit packing detrimental to the performance of gzip? Assume that I have 7 bit values and pack in the following way:

Byte1     Byte2     Byte3     Byte4
[aaaaaaab][bbbbbbcc][cccccddd][dddd...

As far as I understand LZ compression works on a byte basis. Any repeating pattern in the 7 bits will be obscured.

Is it advisable to stuff with an extra bit for byte alignment to help LZ?

Byte1     Byte2     Byte3     Byte4
[aaaaaaa0][bbbbbbb0][ccccccc0][ddddddd0][...

Are there any results on that in literature?

like image 515
Homo Erectus Avatar asked Oct 19 '25 20:10

Homo Erectus


1 Answers

Likely, yes. If your a, b, c, d's have repeating patterns or statistical bias in their frequency, then it should be better to stuff the zero bits.

The way to know is to simply test it.

like image 146
Mark Adler Avatar answered Oct 22 '25 06:10

Mark Adler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!