public static void BuildBlockSplit(uint[] block_ids, global::encode.metablock.BlockSplit split) { unchecked { int cur_id = ((int)(((uint)(((uint[])(block_ids))[0])))); int cur_length = 1; split.num_types = -1; { int _g1 = 1; int _g = (((uint[])(block_ids)) as global::System.Array).Length; while ((_g1 < _g)) { int i = _g1++; if (((bool)((((uint)(((uint[])(block_ids))[i])) != cur_id)))) { split.types.push(cur_id); split.lengths.push(cur_length); split.num_types = ((int)(global::System.Math.Max(((double)(split.num_types)), ((double)(cur_id))))); cur_id = ((int)(((uint)(((uint[])(block_ids))[i])))); cur_length = 0; } ++cur_length; } } split.types.push(cur_id); split.lengths.push(cur_length); split.num_types = ((int)(global::System.Math.Max(((double)(split.num_types)), ((double)(cur_id))))); ++split.num_types; } }
public override object __hx_setField(string field, int hash, object @value, bool handleProperties) { unchecked { switch (hash) { case 127579321: { this.length_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 449540197: { this.type_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1169404290: { this.idx_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1067357253: { this.split_ = ((global::encode.metablock.BlockSplit)(@value)); return(@value); } default: { return(base.__hx_setField(field, hash, @value, handleProperties)); } } } }
public static void SplitBlock(global::Array <object> cmds, int num_commands, uint[] data, int data_off, global::encode.metablock.BlockSplit literal_split, global::encode.metablock.BlockSplit insert_and_copy_split, global::encode.metablock.BlockSplit dist_split) { unchecked { global::Array <uint> literals = new global::Array <uint>(); global::encode.Block_splitter.CopyLiteralsToByteArray(cmds, num_commands, data, data_off, literals); global::Array <uint> insert_and_copy_codes = new global::Array <uint>(); global::Array <uint> distance_prefixes = new global::Array <uint>(); global::encode.Block_splitter.CopyCommandsToByteArray(cmds, num_commands, insert_and_copy_codes, distance_prefixes); global::encode.Block_splitter.SplitByteVector(global::encode.Histogram_functions.HistogramLiteralInt, literals, 544, 100, 70, 28.1, literal_split); global::encode.Block_splitter.SplitByteVector(global::encode.Histogram_functions.HistogramCommandInt, insert_and_copy_codes, 530, 50, 40, 13.5, insert_and_copy_split); global::encode.Block_splitter.SplitByteVector(global::encode.Histogram_functions.HistogramDistanceInt, distance_prefixes, 544, 50, 40, 14.6, dist_split); } }
public static void SplitByteVector(int HistogramTypeInt, global::Array <uint> data, int literals_per_histogram, int max_histograms, int sampling_stride_length, double block_switch_cost, global::encode.metablock.BlockSplit split) { unchecked { if ((data.length == 0)) { split.num_types = 1; return; } else if ((data.length < 128)) { split.num_types = 1; split.types.push(0); split.lengths.push(data.length); return; } global::Array <object> histograms = new global::Array <object>(); global::encode.Block_splitter.InitialEntropyCodes(HistogramTypeInt, data, data.length, literals_per_histogram, max_histograms, sampling_stride_length, histograms); global::encode.Block_splitter.RefineEntropyCodes(HistogramTypeInt, data, data.length, sampling_stride_length, histograms); uint[] block_ids = global::FunctionMalloc.mallocUInt(data.length); { int _g = 0; while ((_g < 10)) { ++_g; global::encode.Block_splitter.FindBlocks(HistogramTypeInt, data, data.length, block_switch_cost, histograms, block_ids, 0); global::encode.Block_splitter.BuildBlockHistograms(HistogramTypeInt, data, data.length, block_ids, 0, histograms); } } global::encode.Block_splitter.ClusterBlocks(HistogramTypeInt, data, data.length, block_ids); global::encode.Block_splitter.BuildBlockSplit(block_ids, split); } }
public BlockSplitIterator(global::encode.metablock.BlockSplit split) { global::encode.block_splitter.BlockSplitIterator.__hx_ctor_encode_block_splitter_BlockSplitIterator(this, split); }
public static void __hx_ctor_encode_block_splitter_BlockSplitIterator(global::encode.block_splitter.BlockSplitIterator __hx_this, global::encode.metablock.BlockSplit split) { __hx_this.split_ = split; __hx_this.idx_ = 0; __hx_this.type_ = 0; __hx_this.length_ = 0; if ((split.lengths.length != 0)) { __hx_this.length_ = split.lengths[0]; } }
public override object __hx_setField(string field, int hash, object @value, bool handleProperties) { unchecked { switch (hash) { case 283120498: { this.merge_last_count_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1642336535: { this.last_entropy_ = ((global::Array <double>)(global::Array <object> .__hx_cast <double>(((global::Array)(@value))))); return(@value); } case 936476748: { this.last_histogram_ix_ = ((global::Array <int>)(global::Array <object> .__hx_cast <int>(((global::Array)(@value))))); return(@value); } case 1546852840: { this.curr_histogram_ix_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1677147340: { this.block_size_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1274418078: { this.target_block_size_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 14955568: { this.histograms_ = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)(@value))))); return(@value); } case 1067357253: { this.split_ = ((global::encode.metablock.BlockSplit)(@value)); return(@value); } case 287012064: { this.num_blocks_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1572466393: { this.split_threshold_ = ((double)(global::haxe.lang.Runtime.toDouble(@value))); return(@value); } case 183570271: { this.min_block_size_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 1291834546: { this.alphabet_size_ = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } case 981779505: { this.HistogramTypeInt = ((int)(global::haxe.lang.Runtime.toInt(@value))); return(@value); } default: { return(base.__hx_setField(field, hash, @value, handleProperties)); } } } }
public override object __hx_setField(string field, int hash, object @value, bool handleProperties) { unchecked { switch (hash) { case 401849689: { this.distance_histograms = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)(@value))))); return(@value); } case 149162755: { this.command_histograms = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)(@value))))); return(@value); } case 1474051423: { this.literal_histograms = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)(@value))))); return(@value); } case 230081986: { this.distance_context_map = ((int[])(@value)); return(@value); } case 960383740: { this.literal_context_map = ((int[])(@value)); return(@value); } case 422681360: { this.distance_split = ((global::encode.metablock.BlockSplit)(@value)); return(@value); } case 1991781798: { this.command_split = ((global::encode.metablock.BlockSplit)(@value)); return(@value); } case 1256528074: { this.literal_split = ((global::encode.metablock.BlockSplit)(@value)); return(@value); } default: { return(base.__hx_setField(field, hash, @value, handleProperties)); } } } }
public static void __hx_ctor_encode_metablock_BlockSplitter(global::encode.metablock.BlockSplitter __hx_this, int HistogramTypeInt, int alphabet_size, int min_block_size, double split_threshold, int num_symbols, global::encode.metablock.BlockSplit split, global::Array <object> histograms) { unchecked { __hx_this.last_entropy_ = new global::Array <double>(); __hx_this.last_histogram_ix_ = new global::Array <int>(); __hx_this.HistogramTypeInt = HistogramTypeInt; __hx_this.alphabet_size_ = alphabet_size; __hx_this.min_block_size_ = min_block_size; __hx_this.split_threshold_ = split_threshold; __hx_this.num_blocks_ = 0; __hx_this.split_ = split; __hx_this.histograms_ = histograms; __hx_this.target_block_size_ = min_block_size; __hx_this.block_size_ = 0; __hx_this.curr_histogram_ix_ = 0; __hx_this.merge_last_count_ = 0; int max_num_types = ((int)(global::System.Math.Min(((double)(((num_symbols / min_block_size) + 1))), ((double)((global::encode.metablock.BlockSplitter.kMaxBlockTypes + 1)))))); __hx_this.split_.lengths = new global::Array <int>(); __hx_this.split_.types = new global::Array <int>(); { int _g1 = 0; while ((_g1 < max_num_types)) { ++_g1; __hx_this.histograms_.push(new global::encode.histogram.Histogram(((int)(HistogramTypeInt)))); } } __hx_this.last_histogram_ix_[1] = 0; __hx_this.last_histogram_ix_[0] = 0; } }
public BlockSplitter(int HistogramTypeInt, int alphabet_size, int min_block_size, double split_threshold, int num_symbols, global::encode.metablock.BlockSplit split, global::Array <object> histograms) { global::encode.metablock.BlockSplitter.__hx_ctor_encode_metablock_BlockSplitter(this, HistogramTypeInt, alphabet_size, min_block_size, split_threshold, num_symbols, split, histograms); }
public static void BuildHistograms(global::Array <object> cmds, int num_commands, global::encode.metablock.BlockSplit literal_split, global::encode.metablock.BlockSplit insert_and_copy_split, global::encode.metablock.BlockSplit dist_split, uint[] ringbuffer, int start_pos, int mask, uint prev_byte, uint prev_byte2, global::Array <int> context_modes, global::Array <object> literal_histograms, global::Array <object> insert_and_copy_histograms, global::Array <object> copy_dist_histograms) { unchecked { int pos = start_pos; global::encode.block_splitter.BlockSplitIterator literal_it = new global::encode.block_splitter.BlockSplitIterator(((global::encode.metablock.BlockSplit)(literal_split))); global::encode.block_splitter.BlockSplitIterator insert_and_copy_it = new global::encode.block_splitter.BlockSplitIterator(((global::encode.metablock.BlockSplit)(insert_and_copy_split))); global::encode.block_splitter.BlockSplitIterator dist_it = new global::encode.block_splitter.BlockSplitIterator(((global::encode.metablock.BlockSplit)(dist_split))); { int _g1 = 0; while ((_g1 < num_commands)) { global::encode.command.Command cmd = ((global::encode.command.Command)(cmds[_g1++])); insert_and_copy_it.Next(); ((global::encode.histogram.Histogram)(insert_and_copy_histograms[insert_and_copy_it.type_])).Add1(((int)(cmd.cmd_prefix_[0]))); { int _g3 = 0; int _g2 = cmd.insert_len_; while ((_g3 < _g2)) { ++_g3; literal_it.Next(); ((global::encode.histogram.Histogram)(literal_histograms[((int)(((uint)((global::encode.Context.ContextFunction(prev_byte, prev_byte2, context_modes[literal_it.type_]) + ((literal_it.type_ << 6)))))))])).Add1(((int)(((uint)(((uint[])(ringbuffer))[(pos & mask)]))))); prev_byte2 = prev_byte; prev_byte = ((uint)(((uint[])(ringbuffer))[(pos & mask)])); ++pos; } } pos += cmd.copy_len_; if ((cmd.copy_len_ > 0)) { prev_byte2 = ((uint)(((uint[])(ringbuffer))[((pos - 2) & mask)])); prev_byte = ((uint)(((uint[])(ringbuffer))[((pos - 1) & mask)])); if (((bool)((cmd.cmd_prefix_[0] >= 128)))) { dist_it.Next(); ((global::encode.histogram.Histogram)(copy_dist_histograms[(((dist_it.type_ << 2)) + cmd.DistanceContext())])).Add1(((int)(cmd.dist_prefix_[0]))); } } } } } }
public static void __hx_ctor_encode_metablock_ContextBlockSplitter(global::encode.metablock.ContextBlockSplitter __hx_this, int HistogramTypeInt, int alphabet_size, int num_contexts, int min_block_size, double split_threshold, int num_symbols, global::encode.metablock.BlockSplit split, global::Array <object> histograms) { unchecked { { int[] this1 = null; this1 = new int[2]; __hx_this.last_histogram_ix_ = ((int[])(this1)); } __hx_this.HistogramTypeInt = HistogramTypeInt; __hx_this.alphabet_size_ = alphabet_size; __hx_this.num_contexts_ = num_contexts; __hx_this.max_block_types_ = (global::encode.metablock.ContextBlockSplitter.kMaxBlockTypes / num_contexts); __hx_this.min_block_size_ = min_block_size; __hx_this.split_threshold_ = split_threshold; __hx_this.num_blocks_ = 0; __hx_this.split_ = split; __hx_this.histograms_ = histograms; __hx_this.target_block_size_ = min_block_size; __hx_this.block_size_ = 0; __hx_this.curr_histogram_ix_ = 0; __hx_this.last_entropy_ = global::FunctionMalloc.mallocFloat((2 * num_contexts)); __hx_this.merge_last_count_ = 0; int max_num_types = ((int)(global::System.Math.Min(((double)(((num_symbols / min_block_size) + 1))), ((double)((__hx_this.max_block_types_ + 1)))))); __hx_this.split_.lengths = new global::Array <int>(); __hx_this.split_.types = new global::Array <int>(); { int _g1 = 0; int _g = (max_num_types * num_contexts); while ((_g1 < _g)) { ++_g1; __hx_this.histograms_.push(new global::encode.histogram.Histogram(((int)(HistogramTypeInt)))); } } { ((int[])(__hx_this.last_histogram_ix_))[1] = 0; ((int[])(__hx_this.last_histogram_ix_))[0] = 0; } } }
public static void __hx_ctor_encode_metablock_BlockSplit(global::encode.metablock.BlockSplit __hx_this) { __hx_this.lengths = new global::Array <int>(); __hx_this.types = new global::Array <int>(); __hx_this.num_types = 0; }