mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Add deflate-distance-32768 test case
This commit is contained in:
1 parent
d1399fac19
commit
f11e1f97c6
8 files changed
+574
-37
No files matched your search
@@ -1,33 +1,28 @@
|
||||
Running flate-backref-crosses-blocks.flate through script/print-bits.go and
|
||||
Running deflate-backref-crosses-blocks.deflate through script/print-bits.go and
|
||||
adding commentary:
|
||||
|
||||
offset xoffset ASCII hex binary
|
||||
000000 0x0000 . 0x00 0b_0000_0000 Non-compressed block (BTYPE=00), non-final (BFINAL=0)
|
||||
000001 0x0001 . 0x04 0b_0000_0100 Block length is 0x0004 (parity value is 0xFFFB)
|
||||
000000 0x0000 . 0x00 0b_...._.000 Uncompressed block, non-final
|
||||
000001 0x0001 . 0x04 0b_0000_0100 Literal length: 0x0004
|
||||
000002 0x0002 . 0x00 0b_0000_0000
|
||||
000003 0x0003 . 0xFB 0b_1111_1011
|
||||
000003 0x0003 . 0xFB 0b_1111_1011 Inverse: 0xFFFB
|
||||
000004 0x0004 . 0xFF 0b_1111_1111
|
||||
000005 0x0005 a 0x61 0b_0110_0001 Literal "abcd"
|
||||
000006 0x0006 b 0x62 0b_0110_0010
|
||||
000007 0x0007 c 0x63 0b_0110_0011
|
||||
000008 0x0008 d 0x64 0b_0110_0100
|
||||
000009 0x0009 . 0x03 0b_0000_0011 Fixed Huffman block (BTYPE=01), final (BFINAL=1), see below
|
||||
000010 0x000A B 0x42 0b_0100_0010
|
||||
000011 0x000B . 0x00 0b_0000_0000
|
||||
|
||||
The fixed Huffman block consists of a back-reference that refers to the
|
||||
previous (non-compressed) block, and then an "end of block" code. The length=3,
|
||||
distance=2 back-reference decodes to "cdc", so the overall decoding is
|
||||
"abcdcdc". The breakdown of the fixed Huffman block is:
|
||||
The fixed Huffman block contains a back-reference (into the previous block)
|
||||
then an end of block. The length=3, distance=2 back-reference decodes to "cdc",
|
||||
so the overall decoding is "abcdcdc".
|
||||
|
||||
000009 0x0009 . 0x03 0b_...._.011 Fixed Huffman block (BTYPE=01), final (BFINAL=1)
|
||||
|
||||
000009 0x0009 . 0x03 0b_0000_0... (lcode = 257) length = 3
|
||||
000009 0x0009 . 0x03 0b_...._.011 Fixed Huffman block, final
|
||||
000009 0x0009 . 0x03 0b_0000_0... lcode: 257 length: 3
|
||||
000010 0x000A B 0x42 0b_...._..10
|
||||
|
||||
000010 0x000A B 0x42 0b_.100_00.. (dcode = 1) distance = 2
|
||||
000010 0x000A B 0x42 0b_.100_00.. dcode: 1 distance: 2
|
||||
|
||||
000010 0x000A B 0x42 0b_0..._.... (lcode = 256) end of block
|
||||
000010 0x000A B 0x42 0b_0..._.... lcode: 256 end of block
|
||||
000011 0x000B . 0x00 0b_..00_0000
|
||||
|
||||
This back-reference is valid, even though there is no prior data in that block,
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# Feed this file to script/make-deflate.go
|
||||
|
||||
blockNoCompression (nonFinal) {
|
||||
literal "abcd"
|
||||
}
|
||||
blockFixedHuffman (final) {
|
||||
len 3 dist 2
|
||||
endOfBlock
|
||||
}
|
||||
|
||||
# The decompressed data is 4 + 3 = 7 bytes:
|
||||
# abcdcdc
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
Running deflate-distance-32768.deflate through script/print-bits.go and adding
|
||||
commentary:
|
||||
|
||||
offset xoffset ASCII hex binary
|
||||
000000 0x0000 K 0x4B 0b_...._.011 Fixed Huffman block, final
|
||||
000000 0x0000 K 0x4B 0b_0100_1... lcode: 97 literal 'a'
|
||||
000001 0x0001 L 0x4C 0b_...._.100
|
||||
000001 0x0001 L 0x4C 0b_0100_1... lcode: 98 literal 'b'
|
||||
000002 0x0002 J 0x4A 0b_...._.010
|
||||
etc
|
||||
000015 0x000F 3 0x33 0b_0011_0... lcode: 55 literal '7'
|
||||
000016 0x0010 . 0x1F 0b_...._.111
|
||||
000016 0x0010 . 0x1F 0b_0001_1... lcode: 285 length: 258
|
||||
000017 0x0011 . 0xA5 0b_...._.101
|
||||
000017 0x0011 . 0xA5 0b_1010_0... dcode: 5 base: 7
|
||||
000018 0x0012 G 0x47 0b_...._...1 extra: 1 distance: 8
|
||||
000018 0x0012 G 0x47 0b_0100_011. lcode: 285 length: 258
|
||||
000019 0x0013 . 0xE9 0b_...._...1
|
||||
000019 0x0013 . 0xE9 0b_..10_100. dcode: 5 base: 7
|
||||
000019 0x0013 . 0xE9 0b_.1.._.... extra: 1 distance: 8
|
||||
etc
|
||||
000236 0x00EC . 0xE9 0b_1..._.... lcode: 284 base: 227
|
||||
000237 0x00ED . 0x91 0b_.001_0001
|
||||
000237 0x00ED . 0x91 0b_1..._.... extra: 17 length: 244
|
||||
000238 0x00EE H 0x48 0b_...._1000
|
||||
000238 0x00EE H 0x48 0b_0100_.... dcode: 5 base: 7
|
||||
000239 0x00EF . 0x03 0b_...._...1
|
||||
000239 0x00EF . 0x03 0b_...._..1. extra: 1 distance: 8
|
||||
000239 0x00EF . 0x03 0b_0000_00.. lcode: 257 length: 3
|
||||
000240 0x00F0 . 0xEF 0b_...._...1
|
||||
000240 0x00F0 . 0xEF 0b_..10_111. dcode: 29 base: 24577
|
||||
000240 0x00F0 . 0xEF 0b_11.._.... extra: 8191 distance: 32768
|
||||
000241 0x00F1 . 0xFF 0b_1111_1111
|
||||
000242 0x00F2 . 0x07 0b_...._.111
|
||||
000242 0x00F2 . 0x07 0b_0000_0... lcode: 257 length: 3
|
||||
000243 0x00F3 * 0x2A 0b_...._..10
|
||||
000243 0x00F3 * 0x2A 0b_.010_10.. dcode: 10 base: 33
|
||||
000243 0x00F3 * 0x2A 0b_0..._.... extra: 2 distance: 35
|
||||
000244 0x00F4 . 0x01 0b_...._.001
|
||||
000244 0x00F4 . 0x01 0b_0000_0... lcode: 257 length: 3
|
||||
000245 0x00F5 . 0xDE 0b_...._..10
|
||||
000245 0x00F5 . 0xDE 0b_.101_11.. dcode: 29 base: 24577
|
||||
000245 0x00F5 . 0xDE 0b_1..._.... extra: 8191 distance: 32768
|
||||
000246 0x00F6 . 0xFF 0b_1111_1111
|
||||
000247 0x00F7 . 0x0F 0b_...._1111
|
||||
000247 0x00F7 . 0x0F 0b_0000_.... lcode: 258 length: 4
|
||||
000248 0x00F8 . 0xBA 0b_...._.010
|
||||
000248 0x00F8 . 0xBA 0b_1011_1... dcode: 29 base: 24577
|
||||
000249 0x00F9 . 0xFE 0b_1111_1110 extra: 8190 distance: 32767
|
||||
000250 0x00FA . 0x1F 0b_...1_1111
|
||||
000250 0x00FA . 0x1F 0b_000._.... lcode: 256 end of block
|
||||
000251 0x00FB . 0x00 0b_...._0000
|
||||
@@ -0,0 +1 @@
|
||||
abcdefgh01234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456701234567012345670123456Line truncated
|
||||
@@ -0,0 +1,28 @@
|
||||
# Feed this file to script/make-deflate.go
|
||||
|
||||
blockFixedHuffman (final) {
|
||||
# Make 16 + 126*258 + 244 = 32768 bytes:
|
||||
# abcdefgh0123456701234567...01234567
|
||||
literal "abcdefgh01234567"
|
||||
repeat 126 [
|
||||
len 258 dist 8
|
||||
]
|
||||
len 244 dist 8
|
||||
|
||||
# Copy "abc".
|
||||
len 3 dist 32768
|
||||
|
||||
# Copy "012".
|
||||
len 3 dist 35
|
||||
|
||||
# Copy "gh0".
|
||||
len 3 dist 32768
|
||||
|
||||
# Copy "2345".
|
||||
len 4 dist 32767
|
||||
|
||||
endOfBlock
|
||||
}
|
||||
|
||||
# The decompressed data is 32768 + 3 + 3 + 3 + 4 = 32781 bytes:
|
||||
# abcdefgh0123456701234567...01234567abc012gh02345
|
||||
Reference in new issue
Block a user