Path: blob/master/libsnes/bsnes/snes/chip/spc7110/decomp.hpp
2 views
class Decomp {1public:2uint8 read();3void init(unsigned mode, unsigned offset, unsigned index);4void reset();56void serialize(serializer&);7Decomp();8~Decomp();910private:11unsigned decomp_mode;12unsigned decomp_offset;1314//read() will spool chunks half the size of decomp_buffer_size15enum { decomp_buffer_size = 64 }; //must be >= 64, and must be a power of two16uint8 *decomp_buffer;17unsigned decomp_buffer_rdoffset;18unsigned decomp_buffer_wroffset;19unsigned decomp_buffer_length;2021void write(uint8 data);22uint8 dataread();2324void mode0(bool init);25void mode1(bool init);26void mode2(bool init);2728static const uint8 evolution_table[53][4];29static const uint8 mode2_context_table[32][2];3031struct ContextState {32uint8 index;33uint8 invert;34} context[32];3536uint8 probability(unsigned n);37uint8 next_lps(unsigned n);38uint8 next_mps(unsigned n);39bool toggle_invert(unsigned n);4041unsigned deinterleave_2x8(unsigned data);42unsigned deinterleave_4x8(unsigned data);43};444546