### Literals section
-Literals are compressed using huffman compression.
+Literals are compressed using Huffman prefix codes.
During sequence phase, literals will be entangled with match copy operations.
All literals are regrouped in the first part of the block.
They can be decoded first, and then copied during sequence operations,
followed by optional Probability tables for each symbol type,
followed by the bitstream.
+| Header | (LitLengthTable) | (OffsetTable) | (MatchLengthTable) | bitStream |
+| ------ | ---------------- | ------------- | ------------------ | --------- |
+
To decode the Sequence section, it's required to know its size.
This size is deducted from `blockSize - literalSectionSize`.
| Code | 0-15 |
| ------ | ---- |
-| value | Code |
+| length | Code |
| nbBits | 0 |
When "compression mode" is "predef"",
a pre-defined distribution is used for FSE compression.
-Here is its definition. It uses an accuracy of 6 bits (64 states).
+Below is its definition. It uses an accuracy of 6 bits (64 states).
```
short literalLengths_defaultDistribution[36] =
{ 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
__Default distribution__
-When "compression mode" is defined as "default distribution",
+When "compression mode" is defined as "predef",
a pre-defined distribution is used for FSE compression.
Here is its definition. It uses an accuracy of 6 bits (64 states).
It means value `0` becomes negative probability `-1`.
`-1` is a special probability, which means `less than 1`.
-Its effect on distribution table is described in next paragraph.
+Its effect on distribution table is described in [next paragraph].
For the purpose of calculating cumulated distribution, it counts as one.
+[next paragraph]:#fse-decoding--from-normalized-distribution-to-decoding-tables
+
When a symbol has a probability of `zero`,
it is followed by a 2-bits repeat flag.
This repeat flag tells how many probabilities of zeroes follow the current one.
It is therefore necessary to know the bitstream size,
which is deducted from compressed block size.
-The bit of the stream is followed by a set-bit-flag.
+The last useful bit of the stream is followed by an end-bit-flag.
Highest bit of last byte is this flag.
It does not belong to the useful part of the bitstream.
Therefore, last byte has 0-7 useful bits.
It then does the same for match length,
and then for literal length.
-Offset / matchLength / litLength define a sequence, which can be applied.
+Offset / matchLength / litLength define a sequence.
+It starts by inserting the number of literals defined by `litLength`,
+then continue by copying `matchLength` bytes from `currentPos - offset`.
The next operation is to update states.
Using rules pre-calculated in the decoding tables,