doc: correct lossless prefix coding table & code

extra bit counts and literal distance return value

Change-Id: I290e3ee8900469503a323f87e9dbb8ca5cb4afc7
This commit is contained in:
James Zern 2012-07-01 14:10:32 -07:00
parent 4c3975792b
commit 61c9d161d5

View File

@ -662,14 +662,14 @@ instead of a million (distance) or several thousands (length).
| 6 | 9..12 | 2 | | 6 | 9..12 | 2 |
| 7 | 13..16 | 2 | | 7 | 13..16 | 2 |
| ... | ... | ... | | ... | ... | ... |
| 38 | 262145..524288 | 17 | | 38 | 262145..524288 | 18 |
| 39 | 524289..1048576 | 17 | | 39 | 524289..1048576 | 18 |
The code to obtain a value from the prefix code is as follows: The code to obtain a value from the prefix code is as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (prefix_code < 4) { if (prefix_code < 4) {
return prefix_code; return prefix_code + 1;
} }
int extra_bits = (prefix_code - 2) >> 1; int extra_bits = (prefix_code - 2) >> 1;
int offset = (2 + (prefix_code & 1)) << extra_bits; int offset = (2 + (prefix_code & 1)) << extra_bits;