Class: RBzip2::OutputData

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/rbzip2/output_data.rb

Overview

This code is free software; you can redistribute it and/or modify it under the terms of the new BSD License.

Copyright © 2011, Sebastian Staudt

Constant Summary

Constants included from Constants

Constants::BASEBLOCKSIZE, Constants::CLEARMASK, Constants::DEPTH_THRESH, Constants::EOF, Constants::GREATER_ICOST, Constants::G_SIZE, Constants::INCS, Constants::LESSER_ICOST, Constants::MAX_ALPHA_SIZE, Constants::MAX_BLOCK_SIZE, Constants::MAX_CODE_LEN, Constants::MAX_SELECTORS, Constants::MIN_BLOCK_SIZE, Constants::NO_RAND_PART_A_STATE, Constants::NO_RAND_PART_B_STATE, Constants::NO_RAND_PART_C_STATE, Constants::NUM_OVERSHOOT_BYTES, Constants::N_GROUPS, Constants::N_ITERS, Constants::QSORT_STACK_SIZE, Constants::RAND_PART_A_STATE, Constants::RAND_PART_B_STATE, Constants::RAND_PART_C_STATE, Constants::RNUMS, Constants::RUNA, Constants::RUNB, Constants::SETMASK, Constants::SMALL_THRESH, Constants::START_BLOCK_STATE, Constants::WORK_FACTOR

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block_size) ⇒ OutputData

Returns a new instance of OutputData.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rbzip2/output_data.rb', line 19

def initialize(block_size)
  n = block_size * BASEBLOCKSIZE
  @block        = Array.new n + 1 + NUM_OVERSHOOT_BYTES, 0
  @fmap         = Array.new n, 0
  @selector     = Array.new MAX_SELECTORS
  @selector_mtf = Array.new MAX_SELECTORS
  @sfmap        = Array.new 2 * n
  @quadrant     = @sfmap

  @in_use       = Array.new 256
  @mtf_freq     = Array.new MAX_ALPHA_SIZE, 0
  @unseq_to_seq = Array.new 256

  @generate_mtf_values_yy = Array.new 256
  @send_mtf_values_code   = Array.new N_GROUPS
  N_GROUPS.times { |i| @send_mtf_values_code[i] = Array.new MAX_ALPHA_SIZE }
  @send_mtf_values_cost   = Array.new N_GROUPS
  @send_mtf_values_fave   = Array.new N_GROUPS
  @send_mtf_values_len    = Array.new N_GROUPS
  N_GROUPS.times { |i| @send_mtf_values_len[i] = Array.new MAX_ALPHA_SIZE }
  @send_mtf_values_rfreq  = Array.new N_GROUPS
  N_GROUPS.times { |i| @send_mtf_values_rfreq[i] = Array.new MAX_ALPHA_SIZE, 0 }
  @send_mtf_values2_pos   = Array.new N_GROUPS
  @send_mtf_values4_in_use_16 = Array.new 16

  @stack_dd = Array.new QSORT_STACK_SIZE
  @stack_hh = Array.new QSORT_STACK_SIZE
  @stack_ll = Array.new QSORT_STACK_SIZE

  @main_sort_big_done      = Array.new 256
  @main_sort_copy          = Array.new 256
  @main_sort_running_order = Array.new 256

  @heap   = Array.new MAX_ALPHA_SIZE + 2
  @parent = Array.new MAX_ALPHA_SIZE + 2
  @weight = Array.new MAX_ALPHA_SIZE + 2

  @ftab = Array.new 65537
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def block
  @block
end

#fmapObject (readonly)

Returns the value of attribute fmap.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def fmap
  @fmap
end

#ftabObject (readonly)

Returns the value of attribute ftab.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def ftab
  @ftab
end

#generate_mtf_values_yyObject (readonly)

Returns the value of attribute generate_mtf_values_yy.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def generate_mtf_values_yy
  @generate_mtf_values_yy
end

#heapObject (readonly)

Returns the value of attribute heap.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def heap
  @heap
end

#in_useObject (readonly)

Returns the value of attribute in_use.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def in_use
  @in_use
end

#main_sort_big_doneObject (readonly)

Returns the value of attribute main_sort_big_done.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def main_sort_big_done
  @main_sort_big_done
end

#main_sort_copyObject (readonly)

Returns the value of attribute main_sort_copy.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def main_sort_copy
  @main_sort_copy
end

#main_sort_running_orderObject (readonly)

Returns the value of attribute main_sort_running_order.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def main_sort_running_order
  @main_sort_running_order
end

#mtf_freqObject (readonly)

Returns the value of attribute mtf_freq.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def mtf_freq
  @mtf_freq
end

#parentObject (readonly)

Returns the value of attribute parent.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def parent
  @parent
end

#quadrantObject (readonly)

Returns the value of attribute quadrant.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def quadrant
  @quadrant
end

#selectorObject (readonly)

Returns the value of attribute selector.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def selector
  @selector
end

#selector_mtfObject (readonly)

Returns the value of attribute selector_mtf.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def selector_mtf
  @selector_mtf
end

#send_mtf_values2_posObject (readonly)

Returns the value of attribute send_mtf_values2_pos.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def send_mtf_values2_pos
  @send_mtf_values2_pos
end

#send_mtf_values4_in_use_16Object (readonly)

Returns the value of attribute send_mtf_values4_in_use_16.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def send_mtf_values4_in_use_16
  @send_mtf_values4_in_use_16
end

#send_mtf_values_codeObject (readonly)

Returns the value of attribute send_mtf_values_code.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def send_mtf_values_code
  @send_mtf_values_code
end

#send_mtf_values_costObject (readonly)

Returns the value of attribute send_mtf_values_cost.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def send_mtf_values_cost
  @send_mtf_values_cost
end

#send_mtf_values_faveObject (readonly)

Returns the value of attribute send_mtf_values_fave.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def send_mtf_values_fave
  @send_mtf_values_fave
end

#send_mtf_values_lenObject (readonly)

Returns the value of attribute send_mtf_values_len.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def send_mtf_values_len
  @send_mtf_values_len
end

#send_mtf_values_rfreqObject (readonly)

Returns the value of attribute send_mtf_values_rfreq.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def send_mtf_values_rfreq
  @send_mtf_values_rfreq
end

#sfmapObject (readonly)

Returns the value of attribute sfmap.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def sfmap
  @sfmap
end

#stack_ddObject (readonly)

Returns the value of attribute stack_dd.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def stack_dd
  @stack_dd
end

#stack_hhObject (readonly)

Returns the value of attribute stack_hh.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def stack_hh
  @stack_hh
end

#stack_llObject (readonly)

Returns the value of attribute stack_ll.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def stack_ll
  @stack_ll
end

#unseq_to_seqObject (readonly)

Returns the value of attribute unseq_to_seq.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def unseq_to_seq
  @unseq_to_seq
end

#weightObject (readonly)

Returns the value of attribute weight.



10
11
12
# File 'lib/rbzip2/output_data.rb', line 10

def weight
  @weight
end