Fix Huffman encoding and raw literals for reliable compression
Three critical fixes for compression reliability:
1. Huffman tree algorithm: Replace heuristic bit-length assignment with
proper Huffman tree that includes implied symbol. This ensures the
leftover is always a power of 2, satisfying Kraft equality.
2. Symbol count overflow: Fall back to raw literals when >128 unique
symbols, since direct representation header can only encode up to
128 weights (header byte = 127 + num_weights would overflow 255).
3. Raw literals size_format: Use size_format=3 (0b1100) instead of
size_format=2 (0b1000) for 3-byte header. Per RFC 8878, size_format
0 and 2 both mean 5-bit size; size_format 3 means 20-bit size.
Add comprehensive test suite (1083 tests across 19 compression levels
and various data patterns). All tests now pass.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>