Nice writeup! FSE, one of the parts of Zstandard, is a very elegant entropy coder. If you're following this section of the article, you might be wondering how it's encoded, since the encoding process is somewhat less obvious than for Huffman coding.<p>What causes trouble is simply, "Once you've emitted a symbol, how do you know that the next symbol is in the range [BL, BL+2^NB)?" The answer is that the encoding is performed backwards, starting from the end of the input, and the table is constructed so that for any symbol emitted, you can find a <i>previous</i> symbol so that the <i>current</i> symbol is in the previous symbol's [BL, BL+2^NB) range.<p>There's another writeup about FSE here, which goes into more depth about FSE (rather than talking about Zstandard in general):<p><a href="http://fastcompression.blogspot.com/2013/12/finite-state-entropy-new-breed-of.html" rel="nofollow">http://fastcompression.blogspot.com/2013/12/finite-state-ent...</a><p>My intuition tells me that there's probably a homomorphism from Huffman coding to FSE that preserves the encoded size exactly, but I haven't done the math to check.