files were useful, after all
This commit is contained in:
parent
eed74f1980
commit
22443443ce
14
VBA.vcproj
14
VBA.vcproj
|
@ -786,6 +786,10 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\hq_shared32.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\macros.mac"
|
||||
>
|
||||
|
@ -1490,12 +1494,20 @@
|
|||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="HQ2x"
|
||||
Name="HQ"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\hq2x.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\hq3x32.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\hq_shared32.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\interp.h"
|
||||
>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,101 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2005 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "hq_shared32.h"
|
||||
#define __STDC_CONSTANT_MACROS
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
const uint64_t reg_blank = UINT64_C(0x0000000000000000);
|
||||
const uint64_t const7 = UINT64_C(0x0000000700070007);
|
||||
const uint64_t treshold = UINT64_C(0x0000000000300706);
|
||||
|
||||
void Interp1(unsigned char * pc, unsigned int c1, unsigned int c2)
|
||||
{
|
||||
*((int*)pc) = (c1*3+c2)/4;
|
||||
}
|
||||
|
||||
void Interp2(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3)
|
||||
{
|
||||
*((int*)pc) = (c1*2+c2+c3)/4;
|
||||
}
|
||||
|
||||
void Interp3(unsigned char * pc, unsigned int c1, unsigned int c2)
|
||||
{
|
||||
*((int*)pc) = (c1*7+c2)/8;
|
||||
*((int*)pc) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00) ) & 0x0007F800) +
|
||||
(((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
|
||||
}
|
||||
|
||||
void Interp4(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3)
|
||||
{
|
||||
*((int*)pc) = (c1*2+(c2+c3)*7)/16;
|
||||
*((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7 ) & 0x000FF000) +
|
||||
(((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7 ) & 0x0FF00FF0)) >> 4;
|
||||
}
|
||||
|
||||
void Interp5(unsigned char * pc, unsigned int c1, unsigned int c2)
|
||||
{
|
||||
*((int*)pc) = (c1+c2)/2;
|
||||
}
|
||||
|
||||
void Interp6(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3)
|
||||
{
|
||||
*((int*)pc) = (c1*5+c2*2+c3)/8;
|
||||
}
|
||||
|
||||
void Interp7(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3)
|
||||
{
|
||||
*((int*)pc) = (c1*6+c2+c3)/8;
|
||||
}
|
||||
|
||||
void Interp8(unsigned char * pc, unsigned int c1, unsigned int c2)
|
||||
{
|
||||
*((int*)pc) = (c1*5+c2*3)/8;
|
||||
}
|
||||
|
||||
|
||||
bool Diff(unsigned int c1, unsigned int c2)
|
||||
{
|
||||
unsigned int
|
||||
YUV1 = RGBtoYUV(c1),
|
||||
YUV2 = RGBtoYUV(c2);
|
||||
|
||||
if (YUV1 == YUV2) return false; // Save some processing power
|
||||
|
||||
return
|
||||
( abs32((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
|
||||
( abs32((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
|
||||
( abs32((YUV1 & Vmask) - (YUV2 & Vmask)) > trV );
|
||||
}
|
||||
|
||||
|
||||
unsigned int RGBtoYUV(unsigned int c)
|
||||
{
|
||||
// Division through 3 slows down the emulation about 10% !!!
|
||||
unsigned char r, g, b, Y, u, v;
|
||||
r = (c & 0x000000FF);
|
||||
g = (c & 0x0000FF00) >> 8;
|
||||
b = (c & 0x00FF0000) >> 16;
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((-r + 2*g -b)>>3);
|
||||
return (Y<<16) + (u<<8) + v;
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2005 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#define SIZE_PIXEL 4 // 32bit = 4 bytes
|
||||
|
||||
#define abs32(value) (value & 0x7FFFFFFF)
|
||||
|
||||
#define PIXEL00_1M Interp1( pOut, c[5], c[1] );
|
||||
#define PIXEL00_1U Interp1( pOut, c[5], c[2] );
|
||||
#define PIXEL00_1L Interp1( pOut, c[5], c[4] );
|
||||
#define PIXEL00_2 Interp2( pOut, c[5], c[4], c[2] );
|
||||
#define PIXEL00_4 Interp4( pOut, c[5], c[4], c[2] );
|
||||
#define PIXEL00_5 Interp5( pOut, c[4], c[2] );
|
||||
#define PIXEL00_C *((unsigned int*)(pOut)) = c[5];
|
||||
|
||||
#define PIXEL01_1 Interp1( pOut+SIZE_PIXEL, c[5], c[2] );
|
||||
#define PIXEL01_3 Interp3( pOut+SIZE_PIXEL, c[5], c[2] );
|
||||
#define PIXEL01_6 Interp1( pOut+SIZE_PIXEL, c[2], c[5] );
|
||||
#define PIXEL01_C *((unsigned int*)(pOut+4)) = c[5];
|
||||
|
||||
#define PIXEL02_1M Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3] );
|
||||
#define PIXEL02_1U Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2] );
|
||||
#define PIXEL02_1R Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
||||
#define PIXEL02_2 Interp2( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] );
|
||||
#define PIXEL02_4 Interp4( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] );
|
||||
#define PIXEL02_5 Interp5( pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6] );
|
||||
#define PIXEL02_C *((unsigned int*)(pOut+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||
|
||||
#define PIXEL10_1 Interp1( pOut+dstPitch, c[5], c[4] );
|
||||
#define PIXEL10_3 Interp3( pOut+dstPitch, c[5], c[4] );
|
||||
#define PIXEL10_6 Interp1( pOut+dstPitch, c[4], c[5] );
|
||||
#define PIXEL10_C *((unsigned int*)(pOut+dstPitch)) = c[5];
|
||||
|
||||
#define PIXEL11 *((unsigned int*)(pOut+dstPitch+SIZE_PIXEL)) = c[5];
|
||||
|
||||
#define PIXEL12_1 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
||||
#define PIXEL12_3 Interp3( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
||||
#define PIXEL12_6 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5] );
|
||||
#define PIXEL12_C *((unsigned int*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||
|
||||
#define PIXEL20_1M Interp1( pOut+dstPitch+dstPitch, c[5], c[7] );
|
||||
#define PIXEL20_1D Interp1( pOut+dstPitch+dstPitch, c[5], c[8] );
|
||||
#define PIXEL20_1L Interp1( pOut+dstPitch+dstPitch, c[5], c[4] );
|
||||
#define PIXEL20_2 Interp2( pOut+dstPitch+dstPitch, c[5], c[8], c[4] );
|
||||
#define PIXEL20_4 Interp4( pOut+dstPitch+dstPitch, c[5], c[8], c[4] );
|
||||
#define PIXEL20_5 Interp5( pOut+dstPitch+dstPitch, c[8], c[4] );
|
||||
#define PIXEL20_C *((unsigned int*)(pOut+dstPitch+dstPitch)) = c[5];
|
||||
|
||||
#define PIXEL21_1 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] );
|
||||
#define PIXEL21_3 Interp3( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] );
|
||||
#define PIXEL21_6 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5] );
|
||||
#define PIXEL21_C *((unsigned int*)(pOut+dstPitch+dstPitch+SIZE_PIXEL)) = c[5];
|
||||
|
||||
#define PIXEL22_1M Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9] );
|
||||
#define PIXEL22_1D Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8] );
|
||||
#define PIXEL22_1R Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] );
|
||||
#define PIXEL22_2 Interp2( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] );
|
||||
#define PIXEL22_4 Interp4( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] );
|
||||
#define PIXEL22_5 Interp5( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[8] );
|
||||
#define PIXEL22_C *((unsigned int*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
|
||||
|
||||
const int Ymask = 0x00FF0000;
|
||||
const int Umask = 0x0000FF00;
|
||||
const int Vmask = 0x000000FF;
|
||||
const int trY = 0x00300000;
|
||||
const int trU = 0x00000700;
|
||||
const int trV = 0x00000006;
|
||||
|
||||
void Interp1(unsigned char * pc, unsigned int c1, unsigned int c2);
|
||||
void Interp2(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3);
|
||||
void Interp3(unsigned char * pc, unsigned int c1, unsigned int c2);
|
||||
void Interp4(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3);
|
||||
void Interp5(unsigned char * pc, unsigned int c1, unsigned int c2);
|
||||
bool Diff(unsigned int c1, unsigned int c2);
|
||||
unsigned int RGBtoYUV(unsigned int c);
|
Loading…
Reference in New Issue