mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16:32:11 +01:00
Add the metablock_builder struct, mirroring BrotliSplitBlock (with its MyRand sampling, InitialEntropyCodes, RefineEntropyCodes, FindBlocks, RemapBlockIds, BuildBlockHistograms and ClusterBlocks), the histogram clustering functions (BrotliCompareAndPushToQueue, BrotliHistogramCombine, BrotliHistogramBitCostDistance, BrotliHistogramRemap, BrotliHistogramReindex, BrotliClusterHistograms), BrotliInitDistanceParams, BrotliBuildMetaBlock (including the distance parameter search) and BrotliOptimizeHistograms (with BrotliOptimizeHuffmanCountsForRle). All memory that the C code allocates lives in a caller-supplied workbuf, carved out by a bump allocator. bit_cost gets an optional 64Ki-entry FastLog2 cache (filled by the same softfloat log2), which makes the clustering several times faster. Extend the metablock_tester and the parity harness to compare SplitBlock, ClusterHistograms*, BuildMetaBlock and OptimizeHistograms results with libbrotlienc v1.2.1.