class

Brotli::Enc::BinaryTreeHasher

Inherits Reference < Object

Port of hash_to_binary_tree_inc.h (H10 instantiation: BUCKET_BITS 17, MAX_TREE_COMP_LENGTH 128, MAX_TREE_SEARCH_DEPTH 64). Each hash bucket holds a binary tree of sequences sharing the 4-byte hash, lexicographically sorted and max-heap by start position.

Constants

MAX_NUM_MATCHES_H10 = MAX_TREE_SEARCH_DEPTH + 64
MAX_TREE_COMP_LENGTH = 128
MAX_TREE_SEARCH_DEPTH = 64

Constructors

new(lgwin : Int32, num_nodes : Int32)
Source

Instance methods

common
Source
find_all_matches(dict : EncoderDictionary, data : Bytes, ring_buffer_mask : Int32, cur_ix : Int32, max_length : Int32, max_backward : Int32, dictionary_distance : Int32, params : Params, matches : Slice(BackwardMatch)) : Int32

hash_to_binary_tree_inc.h:202 — all matches at cur_ix, sorted by strictly increasing length and non-strictly increasing distance.

Source
hash_type_length
Source
left_child_index(pos : Int32) : Int32
Source
prepare(data : Bytes, one_shot : Bool, input_size : Int32) : Nil

hash_to_binary_tree_inc.h:67

Source
right_child_index(pos : Int32) : Int32
Source
stitch_to_previous_block(num_bytes : Int32, position : Int32, ringbuffer : Bytes, ringbuffer_mask : Int32) : Nil

hash_to_binary_tree_inc.h:298

Source
store(data : Bytes, mask : Int32, ix : Int32) : Nil

hash_to_binary_tree_inc.h:271

Source
store_and_find_matches(data : Bytes, cur_ix : Int32, ring_buffer_mask : Int32, max_length : Int32, max_backward : Int32, best_len_in : Int32, matches : Slice(BackwardMatch) | Nil, mpos_in : Int32) : Tuple(Int32, Int32)

hash_to_binary_tree_inc.h:114 — stores the hash of the next 4 bytes and, in a single tree traversal, searches the bucket's tree for matches and re-roots it at the current position. Returns {best_len, match_count}; matches/mpos are unused when matches is nil.

Source
store_lookahead
Source
store_range(data : Bytes, mask : Int32, ix_start : Int32, ix_end : Int32) : Nil

hash_to_binary_tree_inc.h:280

Source