bsnes/sfc/chip/sdd1/decomp.hpp
Tim Allen 4e2eb23835 Update to v093 release.
byuu says:

Changelog:
- added Cocoa target: higan can now be compiled for OS X Lion
  [Cydrak, byuu]
- SNES/accuracy profile hires color blending improvements - fixes
  Marvelous text [AWJ]
- fixed a slight bug in SNES/SA-1 VBR support caused by a typo
- added support for multi-pass shaders that can load external textures
  (requires OpenGL 3.2+)
- added game library path (used by ananke->Import Game) to
  Settings->Advanced
- system profiles, shaders and cheats database can be stored in "all
  users" shared folders now (eg /usr/share on Linux)
- all configuration files are in BML format now, instead of XML (much
  easier to read and edit this way)
- main window supports drag-and-drop of game folders (but not game files
  / ZIP archives)
- audio buffer clears when entering a modal loop on Windows (prevents
  audio repetition with DirectSound driver)
- a substantial amount of code clean-up (probably the biggest
  refactoring to date)

One highly desired target for this release was to default to the optimal
drivers instead of the safest drivers, but because AMD drivers don't
seem to like my OpenGL 3.2 driver, I've decided to postpone that. AMD
has too big a market share. Hopefully with v093 officially released, we
can get some public input on what AMD doesn't like.
2013-08-18 13:21:14 +10:00

82 lines
1.8 KiB
C++

struct Decomp {
struct IM { //input manager
Decomp& self;
void init(unsigned offset);
uint8 get_codeword(uint8 code_length);
IM(SDD1::Decomp& self) : self(self) {}
private:
unsigned offset;
unsigned bit_count;
};
struct GCD { //golomb-code decoder
Decomp& self;
static const uint8 run_count[256];
void get_run_count(uint8 code_number, uint8& mps_count, bool& lps_index);
GCD(SDD1::Decomp& self) : self(self) {}
};
struct BG { //bits generator
Decomp& self;
void init();
uint8 get_bit(bool& end_of_run);
BG(SDD1::Decomp& self, uint8 code_number) : self(self), code_number(code_number) {}
private:
const uint8 code_number;
uint8 mps_count;
bool lps_index;
};
struct PEM { //probability estimation module
Decomp& self;
void init();
uint8 get_bit(uint8 context);
PEM(SDD1::Decomp& self) : self(self) {}
private:
struct State {
uint8 code_number;
uint8 next_if_mps;
uint8 next_if_lps;
};
static const State evolution_table[33];
struct ContextInfo {
uint8 status;
uint8 mps;
} context_info[32];
};
struct CM { //context model
Decomp& self;
void init(unsigned offset);
uint8 get_bit();
CM(SDD1::Decomp& self) : self(self) {}
private:
uint8 bitplanes_info;
uint8 context_bits_info;
uint8 bit_number;
uint8 current_bitplane;
uint16 previous_bitplane_bits[8];
};
struct OL { //output logic
Decomp& self;
void init(unsigned offset);
uint8 decompress();
OL(SDD1::Decomp& self) : self(self) {}
private:
uint8 bitplanes_info;
uint8 r0, r1, r2;
};
void init(unsigned offset);
uint8 read();
Decomp();
IM im;
GCD gcd;
BG bg0, bg1, bg2, bg3, bg4, bg5, bg6, bg7;
PEM pem;
CM cm;
OL ol;
};