Brotli format change: improved encoding of Huffman codes

This change removes the redundant HCLEN, HLENINC and HLEN
fields from the encoding of the complex Huffman codes and
derives these from an invariant of the code length sequence.
Based on a patch by Robert Obryk.
This commit is contained in:
Zoltan Szabadka
2013-12-17 17:17:57 +01:00
parent 30625ba238
commit b89f3be40b
6 changed files with 109 additions and 145 deletions
+6
View File
@@ -352,6 +352,12 @@ void WriteHuffmanTree(const uint8_t* depth, const int length,
}
i += reps;
}
// Throw away trailing zeros.
for (; *huffman_tree_size > 0; --(*huffman_tree_size)) {
if (tree[*huffman_tree_size - 1] > 0 && tree[*huffman_tree_size - 1] < 17) {
break;
}
}
}
namespace {