Skip to content

Commit

Permalink
Finish un-exporting symbols.
Browse files Browse the repository at this point in the history
  • Loading branch information
andybalholm committed Mar 16, 2019
1 parent 4e6528a commit 55e85f3
Show file tree
Hide file tree
Showing 37 changed files with 33,218 additions and 33,257 deletions.
4 changes: 2 additions & 2 deletions backward_references.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func createBackwardReferences(num_bytes uint, position uint, ringbuffer []byte,
} else {
store_end = position
}
var random_heuristics_window_size uint = LiteralSpreeLengthForSparseSearch(params)
var random_heuristics_window_size uint = literalSpreeLengthForSparseSearch(params)
var apply_random_heuristics uint = position + random_heuristics_window_size
var gap uint = 0
/* Set maximum distance, see section 9.1. of the spec. */
Expand Down Expand Up @@ -81,7 +81,7 @@ func createBackwardReferences(num_bytes uint, position uint, ringbuffer []byte,
for ; ; max_length-- {
var cost_diff_lazy uint = 175
var sr2 hasherSearchResult
if params.quality < MIN_QUALITY_FOR_EXTENSIVE_REFERENCE_SEARCH {
if params.quality < minQualityForExtensiveReferenceSearch {
sr2.len = brotli_min_size_t(sr.len-1, max_length)
} else {
sr2.len = 0
Expand Down
22 changes: 12 additions & 10 deletions backward_references_hq.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package brotli

import "math"

type zopfliNode struct {
length uint32
distance uint32
Expand Down Expand Up @@ -387,8 +389,8 @@ func updateNodes(num_bytes uint, block_start uint, pos uint, ringbuffer []byte,
var cur_ix_masked uint = cur_ix & ringbuffer_mask
var max_distance uint = brotli_min_size_t(cur_ix, max_backward_limit)
var max_len uint = num_bytes - pos
var max_zopfli_len uint = MaxZopfliLen(params)
var max_iters uint = MaxZopfliCandidates(params)
var max_zopfli_len uint = maxZopfliLen(params)
var max_iters uint = maxZopfliCandidates(params)
var min_len uint
var result uint = 0
var k uint
Expand Down Expand Up @@ -487,7 +489,7 @@ func updateNodes(num_bytes uint, block_start uint, pos uint, ringbuffer []byte,
var max_match_len uint
/* We already tried all possible last distance matches, so we can use
normal distance code here. */
PrefixEncodeCopyDistance(dist_code, uint(params.dist.num_direct_distance_codes), uint(params.dist.distance_postfix_bits), &dist_symbol, &distextra)
prefixEncodeCopyDistance(dist_code, uint(params.dist.num_direct_distance_codes), uint(params.dist.distance_postfix_bits), &dist_symbol, &distextra)

distnumextra = uint32(dist_symbol) >> 10
dist_cost = base_cost + float32(distnumextra) + zopfliCostModelGetDistanceCost(model, uint(dist_symbol)&0x3FF)
Expand Down Expand Up @@ -529,7 +531,7 @@ func computeShortestPathFromNodes(num_bytes uint, nodes []zopfliNode) uint {
for nodes[index].dcode_insert_length&0x7FFFFFF == 0 && nodes[index].length == 1 {
index--
}
nodes[index].u.next = BROTLI_UINT32_MAX
nodes[index].u.next = math.MaxUint32
for index != 0 {
var len uint = uint(zopfliNodeCommandLength(&nodes[index]))
index -= uint(len)
Expand All @@ -547,7 +549,7 @@ func zopfliCreateCommands(num_bytes uint, block_start uint, nodes []zopfliNode,
var offset uint32 = nodes[0].u.next
var i uint
var gap uint = 0
for i = 0; offset != BROTLI_UINT32_MAX; i++ {
for i = 0; offset != math.MaxUint32; i++ {
var next *zopfliNode = &nodes[uint32(pos)+offset]
var copy_length uint = uint(zopfliNodeCopyLength(next))
var insert_length uint = uint(next.dcode_insert_length & 0x7FFFFFF)
Expand Down Expand Up @@ -582,7 +584,7 @@ func zopfliCreateCommands(num_bytes uint, block_start uint, nodes []zopfliNode,

func zopfliIterate(num_bytes uint, position uint, ringbuffer []byte, ringbuffer_mask uint, params *encoderParams, gap uint, dist_cache []int, model *zopfliCostModel, num_matches []uint32, matches []backwardMatch, nodes []zopfliNode) uint {
var max_backward_limit uint = maxBackwardLimit(params.lgwin)
var max_zopfli_len uint = MaxZopfliLen(params)
var max_zopfli_len uint = maxZopfliLen(params)
var queue startPosQueue
var cur_match_pos uint = 0
var i uint
Expand All @@ -591,7 +593,7 @@ func zopfliIterate(num_bytes uint, position uint, ringbuffer []byte, ringbuffer_
initStartPosQueue(&queue)
for i = 0; i+3 < num_bytes; i++ {
var skip uint = updateNodes(num_bytes, position, i, ringbuffer, ringbuffer_mask, params, max_backward_limit, dist_cache, uint(num_matches[i]), matches[cur_match_pos:], model, &queue, nodes)
if skip < BROTLI_LONG_COPY_QUICK_STEP {
if skip < longCopyQuickStep {
skip = 0
}
cur_match_pos += uint(num_matches[i])
Expand Down Expand Up @@ -619,7 +621,7 @@ func zopfliIterate(num_bytes uint, position uint, ringbuffer []byte, ringbuffer_
/* REQUIRES: nodes != NULL and len(nodes) >= num_bytes + 1 */
func zopfliComputeShortestPath(num_bytes uint, position uint, ringbuffer []byte, ringbuffer_mask uint, params *encoderParams, dist_cache []int, hasher *h10, nodes []zopfliNode) uint {
var max_backward_limit uint = maxBackwardLimit(params.lgwin)
var max_zopfli_len uint = MaxZopfliLen(params)
var max_zopfli_len uint = maxZopfliLen(params)
var model zopfliCostModel
var queue startPosQueue
var matches [2 * (maxNumMatchesH10 + 64)]backwardMatch
Expand Down Expand Up @@ -649,7 +651,7 @@ func zopfliComputeShortestPath(num_bytes uint, position uint, ringbuffer []byte,
}

skip = updateNodes(num_bytes, position, i, ringbuffer, ringbuffer_mask, params, max_backward_limit, dist_cache, num_matches, matches[:], &model, &queue, nodes)
if skip < BROTLI_LONG_COPY_QUICK_STEP {
if skip < longCopyQuickStep {
skip = 0
}
if num_matches == 1 && backwardMatchLength(&matches[0]) > max_zopfli_len {
Expand Down Expand Up @@ -744,7 +746,7 @@ func createHqZopfliBackwardReferences(num_bytes uint, position uint, ringbuffer
num_matches[i] = uint32(num_found_matches)
if num_found_matches > 0 {
var match_len uint = backwardMatchLength(&matches[cur_match_end-1])
if match_len > MAX_ZOPFLI_LEN_QUALITY_11 {
if match_len > maxZopfliLenQuality11 {
var skip uint = match_len - 1
matches[cur_match_pos] = matches[cur_match_end-1]
cur_match_pos++
Expand Down
2 changes: 1 addition & 1 deletion bit_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func get16BitsUnmasked(br *bitReader) uint32 {

/* Returns the specified number of bits from |br| without advancing bit
position. */
func BrotliGetBits(br *bitReader, n_bits uint32) uint32 {
func getBits(br *bitReader, n_bits uint32) uint32 {
fillBitWindow(br, n_bits)
return uint32(getBitsUnmasked(br)) & bitMask(n_bits)
}
Expand Down
6 changes: 4 additions & 2 deletions block_splitter_command.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package brotli

import "math"

/* NOLINT(build/header_guard) */
/* Copyright 2013 Google Inc. All Rights Reserved.
Expand Down Expand Up @@ -184,7 +186,7 @@ func buildBlockHistogramsCommand(data []uint16, length uint, block_ids []byte, n
}
}

var clusterBlocksCommand_kInvalidIndex uint32 = BROTLI_UINT32_MAX
var clusterBlocksCommand_kInvalidIndex uint32 = math.MaxUint32

func clusterBlocksCommand(data []uint16, length uint, num_blocks uint, block_ids []byte, split *blockSplit) {
var histogram_symbols []uint32 = make([]uint32, num_blocks)
Expand Down Expand Up @@ -406,7 +408,7 @@ func splitByteVectorCommand(data []uint16, length uint, literals_per_histogram u
var switch_signal []byte = make([]byte, (length * bitmaplen))
var new_id []uint16 = make([]uint16, num_histograms)
var iters uint
if params.quality < HQ_ZOPFLIFICATION_QUALITY {
if params.quality < hqZopflificationQuality {
iters = 3
} else {
iters = 10
Expand Down
6 changes: 4 additions & 2 deletions block_splitter_distance.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package brotli

import "math"

/* NOLINT(build/header_guard) */
/* Copyright 2013 Google Inc. All Rights Reserved.
Expand Down Expand Up @@ -184,7 +186,7 @@ func buildBlockHistogramsDistance(data []uint16, length uint, block_ids []byte,
}
}

var clusterBlocksDistance_kInvalidIndex uint32 = BROTLI_UINT32_MAX
var clusterBlocksDistance_kInvalidIndex uint32 = math.MaxUint32

func clusterBlocksDistance(data []uint16, length uint, num_blocks uint, block_ids []byte, split *blockSplit) {
var histogram_symbols []uint32 = make([]uint32, num_blocks)
Expand Down Expand Up @@ -406,7 +408,7 @@ func splitByteVectorDistance(data []uint16, length uint, literals_per_histogram
var switch_signal []byte = make([]byte, (length * bitmaplen))
var new_id []uint16 = make([]uint16, num_histograms)
var iters uint
if params.quality < HQ_ZOPFLIFICATION_QUALITY {
if params.quality < hqZopflificationQuality {
iters = 3
} else {
iters = 10
Expand Down
6 changes: 4 additions & 2 deletions block_splitter_literal.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package brotli

import "math"

/* NOLINT(build/header_guard) */
/* Copyright 2013 Google Inc. All Rights Reserved.
Expand Down Expand Up @@ -184,7 +186,7 @@ func buildBlockHistogramsLiteral(data []byte, length uint, block_ids []byte, num
}
}

var clusterBlocksLiteral_kInvalidIndex uint32 = BROTLI_UINT32_MAX
var clusterBlocksLiteral_kInvalidIndex uint32 = math.MaxUint32

func clusterBlocksLiteral(data []byte, length uint, num_blocks uint, block_ids []byte, split *blockSplit) {
var histogram_symbols []uint32 = make([]uint32, num_blocks)
Expand Down Expand Up @@ -406,7 +408,7 @@ func splitByteVectorLiteral(data []byte, length uint, literals_per_histogram uin
var switch_signal []byte = make([]byte, (length * bitmaplen))
var new_id []uint16 = make([]uint16, num_histograms)
var iters uint
if params.quality < HQ_ZOPFLIFICATION_QUALITY {
if params.quality < hqZopflificationQuality {
iters = 3
} else {
iters = 10
Expand Down
Loading

0 comments on commit 55e85f3

Please sign in to comment.