mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04:00
byuu describes the changes since v067: This release officially introduces the accuracy and performance cores, alongside the previously-existing compatibility core. The accuracy core allows the most accurate SNES emulation ever seen, with every last processor running at the lowest possible clock synchronization level. The performance core allows slower computers the chance to finally use bsnes. It is capable of attaining 60fps in standard games even on an entry-level Intel Atom processor, commonly found in netbooks. The accuracy core is absolutely not meant for casual gaming at all. It is meant solely for getting as close to 100% perfection as possible, no matter the cost to speed. It should only be used for testing, development or debugging. The compatibility core is identical to bsnes v067 and earlier, but is now roughly 10% faster. This is the default and recommended core for casual gaming. The performance core contains an entirely new S-CPU core, with range-tested IRQs; and uses blargg's heavily-optimized S-DSP core directly. Although there are very minor accuracy tradeoffs to increase speed, I am confident that the performance core is still more accurate and compatible than any other SNES emulator. The S-CPU, S-SMP, S-DSP, SuperFX and SA-1 processors are all clock-based, just as in the accuracy and compatibility cores; and as always, there are zero game-specific hacks. Its compatibility is still well above 99%, running even the most challenging games flawlessly. If you have held off from using bsnes in the past due to its system requirements, please give the performance core a try. I think you will be impressed. I'm also not finished: I believe performance can be increased even further. I would also strongly suggest Windows Vista and Windows 7 users to take advantage of the new XAudio2 driver by OV2. Not only does it give you a performance boost, it also lowers latency and provides better sound by way of skipping an API emulation layer. Changelog: - Split core into three profiles: accuracy, compatibility and performance - Accuracy core now takes advantage of variable-bitlength integers (eg uint24_t) - Performance core uses a new S-CPU core, written from scratch for speed - Performance core uses blargg's snes_dsp library for S-DSP emulation - Binaries are now compiled using GCC 4.5 - Added a workaround in the SA-1 core for a bug in GCC 4.5+ - The clock-based S-PPU renderer has greatly improved OAM emulation; fixing Winter Gold and Megalomania rendering issues - Corrected pseudo-hires color math in the clock-based S-PPU renderer; fixing Super Buster Bros backgrounds - Fixed a clamping bug in the Cx4 16-bit triangle operation [Jonas Quinn]; fixing Mega Man X2 "gained weapon" star background effect - Updated video renderer to properly handle mixed-resolution screens with interlace enabled; fixing Air Strike Patrol level briefing screen - Added mightymo's 2010-08-19 cheat code pack - Windows port: added XAudio2 output support [OV2] - Source: major code restructuring; virtual base classes for processor - cores removed, build system heavily modified, etc.
133 lines
3.1 KiB
C++
Executable file
133 lines
3.1 KiB
C++
Executable file
#ifndef _RAR_PPMMODEL_
|
|
#define _RAR_PPMMODEL_
|
|
|
|
#include "coder.hpp"
|
|
#include "suballoc.hpp"
|
|
|
|
const int MAX_O=64; /* maximum allowed model order */
|
|
|
|
const int INT_BITS=7, PERIOD_BITS=7, TOT_BITS=INT_BITS+PERIOD_BITS,
|
|
INTERVAL=1 << INT_BITS, BIN_SCALE=1 << TOT_BITS, MAX_FREQ=124;
|
|
|
|
#ifndef STRICT_ALIGNMENT_REQUIRED
|
|
#pragma pack(1)
|
|
#endif
|
|
|
|
struct SEE2_CONTEXT
|
|
{ // SEE-contexts for PPM-contexts with masked symbols
|
|
ushort Summ;
|
|
byte Shift, Count;
|
|
void init(int InitVal)
|
|
{
|
|
Summ=InitVal << (Shift=PERIOD_BITS-4);
|
|
Count=4;
|
|
}
|
|
uint getMean()
|
|
{
|
|
uint RetVal=SHORT16(Summ) >> Shift;
|
|
Summ -= RetVal;
|
|
return RetVal+(RetVal == 0);
|
|
}
|
|
void update()
|
|
{
|
|
if (Shift < PERIOD_BITS && --Count == 0)
|
|
{
|
|
Summ += Summ;
|
|
Count=3 << Shift++;
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
class ModelPPM;
|
|
struct PPM_CONTEXT;
|
|
|
|
struct STATE
|
|
{
|
|
byte Symbol;
|
|
byte Freq;
|
|
PPM_CONTEXT* Successor;
|
|
};
|
|
|
|
struct FreqData
|
|
{
|
|
ushort SummFreq;
|
|
STATE _PACK_ATTR * Stats;
|
|
};
|
|
|
|
struct PPM_CONTEXT
|
|
{
|
|
ushort NumStats;
|
|
union
|
|
{
|
|
FreqData U;
|
|
STATE OneState;
|
|
};
|
|
|
|
PPM_CONTEXT* Suffix;
|
|
inline void encodeBinSymbol(ModelPPM *Model,int symbol); // MaxOrder:
|
|
inline void encodeSymbol1(ModelPPM *Model,int symbol); // ABCD context
|
|
inline void encodeSymbol2(ModelPPM *Model,int symbol); // BCD suffix
|
|
inline void decodeBinSymbol(ModelPPM *Model); // BCDE successor
|
|
inline bool decodeSymbol1(ModelPPM *Model); // other orders:
|
|
inline bool decodeSymbol2(ModelPPM *Model); // BCD context
|
|
inline void update1(ModelPPM *Model,STATE* p); // CD suffix
|
|
inline void update2(ModelPPM *Model,STATE* p); // BCDE successor
|
|
void rescale(ModelPPM *Model);
|
|
inline PPM_CONTEXT* createChild(ModelPPM *Model,STATE* pStats,STATE& FirstState);
|
|
inline SEE2_CONTEXT* makeEscFreq2(ModelPPM *Model,int Diff);
|
|
};
|
|
|
|
#ifndef STRICT_ALIGNMENT_REQUIRED
|
|
#ifdef _AIX
|
|
#pragma pack(pop)
|
|
#else
|
|
#pragma pack()
|
|
#endif
|
|
#endif
|
|
|
|
const uint UNIT_SIZE=Max(sizeof(PPM_CONTEXT),sizeof(RAR_MEM_BLK));
|
|
const uint FIXED_UNIT_SIZE=12;
|
|
|
|
/*
|
|
inline PPM_CONTEXT::PPM_CONTEXT(STATE* pStats,PPM_CONTEXT* ShorterContext):
|
|
NumStats(1), Suffix(ShorterContext) { pStats->Successor=this; }
|
|
inline PPM_CONTEXT::PPM_CONTEXT(): NumStats(0) {}
|
|
*/
|
|
|
|
template <class T>
|
|
inline void _PPMD_SWAP(T& t1,T& t2) { T tmp=t1; t1=t2; t2=tmp; }
|
|
|
|
|
|
class ModelPPM
|
|
{
|
|
private:
|
|
friend struct PPM_CONTEXT;
|
|
|
|
/*_PACK_ATTR*/ SEE2_CONTEXT SEE2Cont[25][16], DummySEE2Cont;
|
|
|
|
struct PPM_CONTEXT *MinContext, *MedContext, *MaxContext;
|
|
STATE* FoundState; // found next state transition
|
|
int NumMasked, InitEsc, OrderFall, MaxOrder, RunLength, InitRL;
|
|
byte CharMask[256], NS2Indx[256], NS2BSIndx[256], HB2Flag[256];
|
|
byte EscCount, PrevSuccess, HiBitsFlag;
|
|
ushort BinSumm[128][64]; // binary SEE-contexts
|
|
|
|
RangeCoder Coder;
|
|
SubAllocator SubAlloc;
|
|
|
|
void RestartModelRare();
|
|
void StartModelRare(int MaxOrder);
|
|
inline PPM_CONTEXT* CreateSuccessors(bool Skip,STATE* p1);
|
|
|
|
inline void UpdateModel();
|
|
inline void ClearMask();
|
|
friend class Unpack;
|
|
public:
|
|
ModelPPM();
|
|
void CleanUp(); // reset PPM variables after data error
|
|
bool DecodeInit(Unpack *UnpackRead,int &EscChar);
|
|
int DecodeChar();
|
|
};
|
|
|
|
#endif
|