3

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?

1 Answers1

2

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.

Mark Adler
  • 101,978
  • 13
  • 118
  • 158