@@ -16,7 +16,7 @@ Distribution of this document is unlimited.
1616
1717### Version
1818
19- 0.3.8 (2023-02-18 )
19+ 0.3.9 (2023-03-08 )
2020
2121
2222Introduction
@@ -534,15 +534,20 @@ __`Size_Format` for `Compressed_Literals_Block` and `Treeless_Literals_Block`__
534534Both ` Compressed_Size ` and ` Regenerated_Size ` fields follow __ little-endian__ convention.
535535Note: ` Compressed_Size ` __ includes__ the size of the Huffman Tree description
536536_ when_ it is present.
537+ Note 2: ` Compressed_Size ` can never be ` ==0 ` .
538+ Even in single-stream scenario, assuming an empty content, it must be ` >=1 ` ,
539+ since it contains at least the final end bit flag.
540+ In 4-streams scenario, a valid ` Compressed_Size ` is necessarily ` >= 10 `
541+ (6 bytes for the jump table, + 4x1 bytes for the 4 streams).
537542
538- 4 streams is superior to 1 stream in decompression speed,
543+ 4 streams is faster than 1 stream in decompression speed,
539544by exploiting instruction level parallelism.
540545But it's also more expensive,
541546costing on average ~ 7.3 bytes more than the 1 stream mode, mostly from the jump table.
542547
543548In general, use the 4 streams mode when there are more literals to decode,
544549to favor higher decompression speeds.
545- Beyond 1KB, the 4 streams mode is compulsory anyway .
550+ Note that beyond > 1KB of literals , the 4 streams mode is compulsory.
546551
547552Note that a minimum of 6 bytes is required for the 4 streams mode.
548553That's a technical minimum, but it's not recommended to employ the 4 streams mode
@@ -577,10 +582,10 @@ it must be used to determine where streams begin.
577582### Jump Table
578583The Jump Table is only present when there are 4 Huffman-coded streams.
579584
580- Reminder : Huffman compressed data consists of either 1 or 4 Huffman-coded streams.
585+ Reminder : Huffman compressed data consists of either 1 or 4 streams.
581586
582587If only one stream is present, it is a single bitstream occupying the entire
583- remaining portion of the literals block, encoded as described within
588+ remaining portion of the literals block, encoded as described in
584589[ Huffman-Coded Streams] ( #huffman-coded-streams ) .
585590
586591If there are four streams, ` Literals_Section_Header ` only provided
@@ -591,17 +596,18 @@ except for the last stream which may be up to 3 bytes smaller,
591596to reach a total decompressed size as specified in ` Regenerated_Size ` .
592597
593598The compressed size of each stream is provided explicitly in the Jump Table.
594- Jump Table is 6 bytes long, and consist of three 2-byte __ little-endian__ fields,
599+ Jump Table is 6 bytes long, and consists of three 2-byte __ little-endian__ fields,
595600describing the compressed sizes of the first three streams.
596- ` Stream4_Size ` is computed from total ` Total_Streams_Size ` minus sizes of other streams.
601+ ` Stream4_Size ` is computed from ` Total_Streams_Size ` minus sizes of other streams:
597602
598603` Stream4_Size = Total_Streams_Size - 6 - Stream1_Size - Stream2_Size - Stream3_Size ` .
599604
600- Note: if ` Stream1_Size + Stream2_Size + Stream3_Size > Total_Streams_Size ` ,
605+ ` Stream4_Size ` is necessarily ` >= 1 ` . Therefore,
606+ if ` Total_Streams_Size < Stream1_Size + Stream2_Size + Stream3_Size + 6 + 1 ` ,
601607data is considered corrupted.
602608
603609Each of these 4 bitstreams is then decoded independently as a Huffman-Coded stream,
604- as described at [ Huffman-Coded Streams] ( #huffman-coded-streams )
610+ as described in [ Huffman-Coded Streams] ( #huffman-coded-streams )
605611
606612
607613Sequences Section
@@ -1691,6 +1697,7 @@ or at least provide a meaningful error code explaining for which reason it canno
16911697
16921698Version changes
16931699---------------
1700+ - 0.3.9 : clarifications for Huffman-compressed literal sizes.
16941701- 0.3.8 : clarifications for Huffman Blocks and Huffman Tree descriptions.
16951702- 0.3.7 : clarifications for Repeat_Offsets, matching RFC8878
16961703- 0.3.6 : clarifications for Dictionary_ID
0 commit comments