mirror of
https://github.com/golang/go
synced 2024-11-15 00:20:30 -07:00
image/jpeg: add more theHuffmanSpec comments
Change-Id: I2c68dde6e968e0643109161e52a76189e48b4d19 Reviewed-on: https://go-review.googlesource.com/c/go/+/624715 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Nigel Tao <nigeltao@golang.org> Reviewed-by: Nigel Tao <nigeltao@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
989eed2849
commit
9c93d99c61
@ -50,8 +50,8 @@ const (
|
|||||||
|
|
||||||
// unscaledQuant are the unscaled quantization tables in zig-zag order. Each
|
// unscaledQuant are the unscaled quantization tables in zig-zag order. Each
|
||||||
// encoder copies and scales the tables according to its quality parameter.
|
// encoder copies and scales the tables according to its quality parameter.
|
||||||
// The values are derived from section K.1 after converting from natural to
|
// The values are derived from section K.1 of the spec, after converting from
|
||||||
// zig-zag order.
|
// natural to zig-zag order.
|
||||||
var unscaledQuant = [nQuantIndex][blockSize]byte{
|
var unscaledQuant = [nQuantIndex][blockSize]byte{
|
||||||
// Luminance.
|
// Luminance.
|
||||||
{
|
{
|
||||||
@ -89,14 +89,22 @@ const (
|
|||||||
|
|
||||||
// huffmanSpec specifies a Huffman encoding.
|
// huffmanSpec specifies a Huffman encoding.
|
||||||
type huffmanSpec struct {
|
type huffmanSpec struct {
|
||||||
// count[i] is the number of codes of length i bits.
|
// count[i] is the number of codes of length i+1 bits.
|
||||||
count [16]byte
|
count [16]byte
|
||||||
// value[i] is the decoded value of the i'th codeword.
|
// value[i] is the decoded value of the i'th codeword.
|
||||||
value []byte
|
value []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// theHuffmanSpec is the Huffman encoding specifications.
|
// theHuffmanSpec is the Huffman encoding specifications.
|
||||||
// This encoder uses the same Huffman encoding for all images.
|
//
|
||||||
|
// This encoder uses the same Huffman encoding for all images. It is also the
|
||||||
|
// same Huffman encoding used by section K.3 of the spec.
|
||||||
|
//
|
||||||
|
// The DC tables have 12 decoded values, called categories.
|
||||||
|
//
|
||||||
|
// The AC tables have 162 decoded values: bytes that pack a 4-bit Run and a
|
||||||
|
// 4-bit Size. There are 16 valid Runs and 10 valid Sizes, plus two special R|S
|
||||||
|
// cases: 0|0 (meaning EOB) and F|0 (meaning ZRL).
|
||||||
var theHuffmanSpec = [nHuffIndex]huffmanSpec{
|
var theHuffmanSpec = [nHuffIndex]huffmanSpec{
|
||||||
// Luminance DC.
|
// Luminance DC.
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user