const maxCodeLength … const maxNCodes … const lutSize … type huffman … var errShortHuffmanData … // ensureNBits reads bytes from the byte buffer to ensure that d.bits.n is at // least n. For best performance (avoiding function calls inside hot loops), // the caller is the one responsible for first checking that d.bits.n < n. func (d *decoder) ensureNBits(n int32) error { … } // receiveExtend is the composition of RECEIVE and EXTEND, specified in section // F.2.2.1. func (d *decoder) receiveExtend(t uint8) (int32, error) { … } // processDHT processes a Define Huffman Table marker, and initializes a huffman // struct from its contents. Specified in section B.2.4.2. func (d *decoder) processDHT(n int) error { … } // decodeHuffman returns the next Huffman-coded value from the bit-stream, // decoded according to h. func (d *decoder) decodeHuffman(h *huffman) (uint8, error) { … } func (d *decoder) decodeBit() (bool, error) { … } func (d *decoder) decodeBits(n int32) (uint32, error) { … }