Files
wuffs/test/data/artificial-deflate/degenerate-huffman-unused.deflate.make-artificial.txt
T
Nigel Tao f86c80e425 Fix std/deflate degenerate H-D Huffman table
RFC 1951 section 3.2.7. "Compression with dynamic Huffman codes
(BTYPE=10)" says, "If only one distance code is used, it is encoded
using one bit, not zero bits; in this case there is a single code length
of one, with one unused code."

I had previously mis-read that excerpt to also require that the sole
distance code was the shortest distance (code 0, a distance of 1).

Fixes #66
2022-01-08 13:57:34 +11:00

65 lines
1.0 KiB
Plaintext

# Feed this file to script/make-artificial.go
make deflate
blockDynamicHuffman (nonFinal) {
huffman CodeLength {
1 00
2 01
17 10
18 11
}
huffman Literal/Length {
# 102='f', 111='o', 256=EOB
111 0
102 10
256 11
}
huffman Distance {
# Incomplete. There is no key/value pair whose value starts with "1".
#
# The sole key/value pair is also unused. (The one below is used.)
0 0
}
literal "foo"
endOfBlock
}
blockDynamicHuffman (final) {
huffman CodeLength {
0 00
1 01
2 100
3 101
17 110
18 111
}
huffman Literal/Length {
# 65='A', 66='B', 67='C', 68='D', 256=EOB, 257=Length3
65 100
66 101
67 110
68 111
256 00
257 01
}
huffman Distance {
# Incomplete. There is no key/value pair whose value starts with "1".
#
# The sole key/value pair is also used. (The one above is unused.)
#
# Per the second table in RFC 1951 section 3.2.5. "Compressed blocks
# (length and distance codes)", code 3 means a distance of 4.
3 0
}
literal "ABCD"
len 3 dist 4
endOfBlock
}