[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Implementation of blocks with no distance codes
From: |
Niels Möller |
Subject: |
Implementation of blocks with no distance codes |
Date: |
Wed, 16 Sep 2009 13:11:29 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (usg-unix-v) |
Section 3.2.7 of RFC 1951, "DEFLATE Compressed Data Format
Specification version 1.3", includes the following comment:
A code length of 0 indicates that the corresponding symbol in
the literal/length or distance alphabet will not occur in the
block, and should not participate in the Huffman code
construction algorithm given earlier. 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. One distance code of zero bits means that there are no
distance codes used at all (the data is all literals).
I'm playing with my own implementation of inflate. I handle the corner
case of one distance code of zero bits (which means that the block is
essentially huffman-coded only).
To test this, I created the following file,
begin 644 foo.gz
D'XL(address@hidden"9M7"-N#^A02L#I[V'Y4````&
`
end
which is intended to inflate to the 6 characters "foobar", using the
huffman code
00 "o"
010 "a"
011 "b"
100 "f"
101 "r"
110 256 (End of block)
My implementation seems to inflate this correctly, however, gzip
complains "invalid compressed data--format violated".
Now I'm wondering if I have misunderstood the specification, or if
this is format feature that is not implemented in gzip?
Regards,
/Niels
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Implementation of blocks with no distance codes,
Niels Möller <=