packagebrotli/* Copyright 2013 Google Inc. All Rights Reserved. Distributed under MIT license. See file LICENSE for detail or copy at https://opensource.org/licenses/MIT*//* Functions for clustering similar histograms together. */typehistogramPairstruct{idx1uint32idx2uint32cost_combofloat64cost_difffloat64}funchistogramPairIsLess(p1*histogramPair,p2*histogramPair)bool{ifp1.cost_diff!=p2.cost_diff{returnp1.cost_diff>p2.cost_diff}return(p1.idx2-p1.idx1)>(p2.idx2-p2.idx1)}/* Returns entropy reduction of the context map when we combine two clusters. */funcclusterCostDiff(size_auint,size_buint)float64{varsize_cuint=size_a+size_breturnfloat64(size_a)*fastLog2(size_a)+float64(size_b)*fastLog2(size_b)-float64(size_c)*fastLog2(size_c)}