Merge pull request #231 from dsnet/master

Use consistent bit ordering and variable names
This commit is contained in:
szabadka 2015-10-26 12:02:36 +01:00
commit 816153cc79

View File

@ -424,8 +424,8 @@ the leaf labeled with that symbol. For example:
.KS
/\\ Symbol Code
0 1 ------ ----
/ \\ A 00
/\\ B B 1
/ \\ A 00
/\\ B B 1
0 1 C 011
/ \\ D 010
A /\\
@ -559,12 +559,12 @@ Step 3 produces the following code values:
.KS
Symbol Length Code
------ ------ ----
A 3 010
B 3 011
C 3 100
D 3 101
E 3 110
F 2 00
A 3 010
B 3 011
C 3 100
D 3 101
E 3 110
F 2 00
G 4 1110
H 4 1111
.KE
@ -708,18 +708,18 @@ earlier. A complex prefix code must have at least two non-zero
code lengths.
The bit lengths of the prefix code over the code length alphabet
are compressed with the following static prefix code (where the
bits shown are reversed in the actual compressed stream):
are compressed with the following variable length code (as it appears
in the compressed data, where the bits are parsed from right to left):
.nf
.KS
Symbol Code
------ ----
0 00
1 1110
2 110
3 01
4 10
1 0111
2 011
3 10
4 01
5 1111
.KE
.fi
@ -743,7 +743,7 @@ follows:
The code lengths of code length symbols are between 0 and
5 and they are represented with 2 - 4 bits according to
the static prefix code above. A code length of 0 means
the variable length code above. A code length of 0 means
the corresponding code length symbol is not used.
If HSKIP is 2 or 3, a respective number of leading code
@ -1184,11 +1184,11 @@ The context map is encoded as a one-dimensional array,
CMAPL[0..(64 * NBLTYPESL - 1)] and CMAPD[0..(4 * NBLTYPESD - 1)].
The index of the prefix code for encoding a literal or distance
code with context ID "cid" and block type "bltype" is
code with context ID, CIDx, and block type, BTYPE_x, is:
index of literal prefix code = CMAPL[bltype * 64 + cid]
index of literal prefix code = CMAPL[64 * BTYPE_L + CIDL]
index of distance prefix code = CMAPD[bltype * 4 + cid]
index of distance prefix code = CMAPD[4 * BTYPE_D + CIDD]
The values of the context map are encoded with the combination
of run length encoding for zero values and prefix coding. Let
@ -1443,8 +1443,15 @@ the following:
fill bits are not zero, then the stream should be
rejected as invalid)
2 bits: MNIBBLES, # of nibbles to represent the uncompressed
length, encoded as follows: if set to 3, MNIBBLES is 0,
otherwise MNIBBLES is the value of this field plus 4.
length, encoded with the following fixed length code:
Value Bit Pattern
----- -----------
0 11
4 00
5 01
6 10
If MNIBBLES is 0, the meta-block is empty, i.e. it does
not generate any uncompressed data. In this case, the
rest of the meta-block has the following format:
@ -1463,14 +1470,14 @@ the following:
as invalid)
0 - 7 bits: fill bits until the next byte boundary,
must be all zeros
must be all zeros
MSKIPLEN bytes of metadata, not part of the
uncompressed data or the sliding window
MNIBBLES x 4 bits: MLEN - 1, where MLEN is the length
of the meta-block uncompressed data in bytes (if the
number of nibbles is greater than 4, and the last
of the meta-block uncompressed data in bytes (if
MNIBBLES is greater than 4, and the last
nibble is all zeros, then the stream should be
rejected as invalid)