std/brotli: use metablock_builder's distance and RLE helpers in the encoder

This removes the encoder's copies of PrefixEncodeCopyDistance,
CommandRestoreDistanceCode, BrotliInitDistanceParams and
BrotliOptimizeHuffmanCountsForRle. The shared BrotliInitDistanceParams
also handles large-window distance params (used at quality 2).
This commit is contained in:
Claude committed 2026-10-27 01:15:03 +00:00
1 parent abecc768e5
commit 314b20e832
5 files changed
+179 -674

No files matched your search

+4 -3
View File
@@ -200,6 +200,10 @@ pub struct encoder? implements base.io_transformer(
) + (
bc : bit_cost,
// mb provides some metablock.c, command.h and prefix.h functions
// (see encode_metablock.wuffs).
mb : metablock_builder,
// tiny_buf is the C code's tiny_buf_ (plus slack for the 8-byte
// stores of write_bits).
tiny_buf : array[32] base.u8,
@@ -269,9 +273,6 @@ pub struct encoder? implements base.io_transformer(
gbs_entropy_tmp : array[16] base.u64,
gbs_comb_entropy : array[32] base.u64,
// BrotliOptimizeHistograms' good_for_rle.
good_for_rle : array[1024] base.u8,
// The BrotliStoreMetaBlock block encoders' state (the C code's
// BlockEncoder and BlockSplitCode), indexed by block category (with
// index 3 for a local BlockTypeCodeCalculator).