std/brotli: support compound dictionaries at qualities 10 and 11

Mirror the Zopfli path's compound dictionary code in
backward_references_hq.c and hash.h: LookupAllCompoundDictionaryMatches,
FindAllCompoundDictionaryMatches, MergeMatches, the lz_matches_offset
and shadow_matches scratch space, the gap in ComputeDistanceShortcut,
UpdateNodes (including its compound dictionary last distance branch)
and BrotliZopfliCreateCommands, and the dictionary distance passed to
FindAllMatchesH10.

Remove the quality 10 and 11 dictionary gate (and its now unused
status), size the quality 11 variable region for the shadow matches
and turn the gate's test into a byte-exact check. The mimic dictionary
grid, big and rejections tests now also cover qualities 10 and 11.
This commit is contained in:
Claude committed 2026-10-27 09:02:50 +00:00
1 parent d72d46ea97
commit ec99ba2a01
8 files changed
+854 -120

No files matched your search

-7
View File
@@ -31,8 +31,6 @@
use "std/softfloat"
pub status "#unsupported encoder quality"
pri status "#internal error: inconsistent encoder state"
pub const ENCODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
@@ -916,11 +914,6 @@ pri func encoder.do_transform_io?(dst: base.io_writer, src: base.io_reader, work
var total : base.u64
this.ensure_initialized!()
if (this.quality >= 10) and (this.dict_num_chunks > 0) {
// TODO: compound dictionaries at qualities 10 and 11 (the Zopfli
// path's dictionary lookups).
return "#unsupported encoder quality"
}
this.hq_extend_var_region!(wb_len: args.workbuf.length())
if (this.quality >= 2) and (args.workbuf.length() < this.workbuf_end) {
// A workbuf shorter than workbuf_len works if it is long enough for