def encode_huffman_value(value, next_node, next_context): if (value is not None): return ("{0x%X, %d}" % ((next_node << Byte_Bank.size()) | next_context, value)) else: return ("{0x%X, 0}" % ((next_node << Byte_Bank.size()) | next_context))
def populate_jump_table(self, little_endian=False): if (self.value is None): self.jump_table = ([(0, 0, None), #input context 0 (0, 0, None)] + #input context 1 [next_read_huffman_state(context.bitbuffer(), self, little_endian) for context in Byte_Bank.contexts() if (context.size > 0)]) self.bit_0.populate_jump_table() self.bit_1.populate_jump_table()
def populate_jump_table(self, little_endian=False): if (self.value is None): self.jump_table = ( [ (0, 0, None), #input context 0 (0, 0, None) ] + #input context 1 [ next_read_huffman_state(context.bitbuffer(), self, little_endian) for context in Byte_Bank.contexts() if (context.size > 0) ]) self.bit_0.populate_jump_table() self.bit_1.populate_jump_table()