mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
A_SN's curve
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@220 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
29a951879b
commit
82bc9cdd10
4 changed files with 39 additions and 18 deletions
|
@ -255,11 +255,10 @@ void set_RAM_Timings(int tRC, int tRAS, int tWR, int tMRD, int tRFC, int tRP, in
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_gamma(int g100)
|
void set_gamma(int g100, int A_SNs_curve)
|
||||||
{
|
{
|
||||||
float gamma = (float) g100 / 100;
|
float gamma = (float) g100 / 100;
|
||||||
int i;
|
int i;
|
||||||
//printf ("set gamma = %f\r\n",gamma);
|
|
||||||
gamma = 1/gamma;
|
gamma = 1/gamma;
|
||||||
|
|
||||||
//enable gamma
|
//enable gamma
|
||||||
|
@ -270,7 +269,29 @@ void set_gamma(int g100)
|
||||||
{
|
{
|
||||||
unsigned char g;
|
unsigned char g;
|
||||||
unsigned short s;
|
unsigned short s;
|
||||||
g =(unsigned char)(255.0*pow(i/255.0,gamma));
|
const unsigned short grey50=143, grey75=177, grey25=97;
|
||||||
|
float blah;
|
||||||
|
|
||||||
|
if (A_SNs_curve)
|
||||||
|
{
|
||||||
|
// The next formula is all about gaussian interpolation
|
||||||
|
blah = (( -128 * exp(-powf((float) i/64.0f + 2.0f , 2.0f))) +
|
||||||
|
( -64 * exp(-powf((float) i/64.0f + 1.0f , 2.0f))) +
|
||||||
|
(grey25 * exp(-powf((float) i/64.0f - 1.0f , 2.0f))) +
|
||||||
|
(grey50 * exp(-powf((float) i/64.0f - 2.0f , 2.0f))) +
|
||||||
|
(grey75 * exp(-powf((float) i/64.0f - 3.0f , 2.0f))) +
|
||||||
|
( 256 * exp(-powf((float) i/64.0f - 4.0f , 2.0f))) +
|
||||||
|
( 320 * exp(-powf((float) i/64.0f - 5.0f , 2.0f))) +
|
||||||
|
( 384 * exp(-powf((float) i/64.0f - 6.0f , 2.0f)))) / (1.772637f);
|
||||||
|
blah += 0.5f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
blah = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
g = (unsigned char)(255.0*pow(blah/255.0,gamma));
|
||||||
|
//printf("%d : %d\n", i, g);
|
||||||
s = (g<<8) | g;
|
s = (g<<8) | g;
|
||||||
MEM_REG[0x295E>>1]= s;
|
MEM_REG[0x295E>>1]= s;
|
||||||
MEM_REG[0x295E>>1]= g;
|
MEM_REG[0x295E>>1]= g;
|
||||||
|
|
|
@ -11,7 +11,7 @@ extern void set_DCLK_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+di
|
||||||
//extern void Disable_940(void); /* 940t down */
|
//extern void Disable_940(void); /* 940t down */
|
||||||
|
|
||||||
extern void set_RAM_Timings(int tRC, int tRAS, int tWR, int tMRD, int tRFC, int tRP, int tRCD);
|
extern void set_RAM_Timings(int tRC, int tRAS, int tWR, int tMRD, int tRFC, int tRP, int tRCD);
|
||||||
extern void set_gamma(int g100);
|
extern void set_gamma(int g100, int A_SNs_curve);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -613,7 +613,7 @@ void emu_Deinit(void)
|
||||||
|
|
||||||
// restore gamma
|
// restore gamma
|
||||||
if (gp2x_old_gamma != 100)
|
if (gp2x_old_gamma != 100)
|
||||||
set_gamma(100);
|
set_gamma(100, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1079,10 +1079,10 @@ void emu_Loop(void)
|
||||||
printf(" done\n");
|
printf(" done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gp2x_old_gamma != currentConfig.gamma) {
|
if (gp2x_old_gamma != currentConfig.gamma || (EmuOpt_old&0x1000) != (currentConfig.EmuOpt&0x1000)) {
|
||||||
set_gamma(currentConfig.gamma);
|
set_gamma(currentConfig.gamma, !!(currentConfig.EmuOpt&0x1000));
|
||||||
gp2x_old_gamma = currentConfig.gamma;
|
gp2x_old_gamma = currentConfig.gamma;
|
||||||
printf("updated gamma to %i\n", currentConfig.gamma);
|
printf("updated gamma to %i, A_SN's curve: %i\n", currentConfig.gamma, !!(currentConfig.EmuOpt&0x1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((EmuOpt_old&0x2000) != (currentConfig.EmuOpt&0x2000)) {
|
if ((EmuOpt_old&0x2000) != (currentConfig.EmuOpt&0x2000)) {
|
||||||
|
|
|
@ -381,7 +381,7 @@ void set_RAM_Timings(int tRC, int tRAS, int tWR, int tMRD, int tRFC, int tRP, in
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_gamma(int g100)
|
void set_gamma(int g100, int A_SNs_curve)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue