mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
Fix ambiguity about whether final bit padding must be zero
* Currently, the wording makes it clear that fill bits must be zero if ISLASTEMPTY is true. However, it says nothing about whether the fill bits must be zero if the meta-block is the last, but is also non-empty. The behavior of the reference implementation is that it must be zero. Thus, move the requirement of fill bits being zero to the ISLAST description since that covers ISLASTEMPTY. * Also, make the description of ISUNCOMPRESSED consistent with the way meta data are described.
This commit is contained in:
@@ -1441,14 +1441,14 @@ meta-block is the last one. The format of the meta-block header is
|
||||
the following:
|
||||
|
||||
.nf
|
||||
1 bit: ISLAST, set to 1 if this is the last meta-block
|
||||
1 bit: ISLAST, set to 1 if this is the last meta-block;
|
||||
at the end of this meta-block, any remaining bits in
|
||||
the last byte of the compressed stream are filled with
|
||||
zeros (if the fill bits are not zero, then the stream
|
||||
should be rejected as invalid)
|
||||
1 bit: ISLASTEMPTY, if set to 1, the meta-block is empty;
|
||||
this field is only present if ISLAST bit is set -- if
|
||||
it is 1, then the meta-block and the brotli stream ends
|
||||
at that bit, with any remaining bits in the last byte
|
||||
of the compressed stream filled with zeros (if the
|
||||
fill bits are not zero, then the stream should be
|
||||
rejected as invalid)
|
||||
it is 1, then the meta-block ends at that bit
|
||||
2 bits: MNIBBLES, # of nibbles to represent the uncompressed
|
||||
length, encoded with the following fixed-length code:
|
||||
|
||||
@@ -1488,12 +1488,15 @@ the following:
|
||||
nibble is all zeros, then the stream should be
|
||||
rejected as invalid)
|
||||
|
||||
1 bit: ISUNCOMPRESSED, if set to 1, any bits of compressed
|
||||
data up to the next byte boundary are ignored, and
|
||||
the rest of the meta-block contains MLEN bytes of
|
||||
literal data; this field is only present if the
|
||||
ISLAST bit is not set (if the ignored bits are not
|
||||
all zeros, the stream should be rejected as invalid)
|
||||
1 bit: ISUNCOMPRESSED, if set to 1, the meta-block contains
|
||||
uncompressed data; this field is only present if ISLAST
|
||||
bit is set -- if it is 1, then the rest of the
|
||||
meta-block has the following format:
|
||||
|
||||
0 - 7 bits: fill bits until the next byte boundary,
|
||||
must be all zeros
|
||||
|
||||
MLEN bytes of uncompressed data
|
||||
|
||||
1-11 bits: NBLTYPESL, # of literal block types, encoded with
|
||||
the following variable length code (as it appears in
|
||||
|
||||
Reference in New Issue
Block a user