Last change
on this file since 145 was 145, checked in by Izuru Yakumo, 22 months ago |
Updated the Makefile and vendored depedencies
Signed-off-by: Izuru Yakumo <yakumo.izuru@…>
|
File size:
839 bytes
|
Rev | Line | |
---|
[145] | 1 | package brotli
|
---|
| 2 |
|
---|
| 3 | /* Copyright 2013 Google Inc. All Rights Reserved.
|
---|
| 4 |
|
---|
| 5 | Distributed under MIT license.
|
---|
| 6 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | /* Functions for clustering similar histograms together. */
|
---|
| 10 |
|
---|
| 11 | type histogramPair struct {
|
---|
| 12 | idx1 uint32
|
---|
| 13 | idx2 uint32
|
---|
| 14 | cost_combo float64
|
---|
| 15 | cost_diff float64
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | func histogramPairIsLess(p1 *histogramPair, p2 *histogramPair) bool {
|
---|
| 19 | if p1.cost_diff != p2.cost_diff {
|
---|
| 20 | return p1.cost_diff > p2.cost_diff
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | return (p1.idx2 - p1.idx1) > (p2.idx2 - p2.idx1)
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | /* Returns entropy reduction of the context map when we combine two clusters. */
|
---|
| 27 | func clusterCostDiff(size_a uint, size_b uint) float64 {
|
---|
| 28 | var size_c uint = size_a + size_b
|
---|
| 29 | return float64(size_a)*fastLog2(size_a) + float64(size_b)*fastLog2(size_b) - float64(size_c)*fastLog2(size_c)
|
---|
| 30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.