HQXx now all working nicely in SDL. Can use assembly optimized in SDL port if compiled with USEASM=yes.
This commit is contained in:
parent
874d37653a
commit
5a191f0896
10
Makefile
10
Makefile
|
@ -28,7 +28,6 @@ ifeq ($(PLATFORM),win-cross)
|
||||||
OUT=vba.exe
|
OUT=vba.exe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
MAINDIR=src
|
MAINDIR=src
|
||||||
SDLDIR=src/sdl
|
SDLDIR=src/sdl
|
||||||
DMGDIR=src/gb
|
DMGDIR=src/gb
|
||||||
|
@ -59,9 +58,16 @@ ${DMGDIR}/gbSound${OE}
|
||||||
|
|
||||||
SDLOBJ=${SDLDIR}/debugger${OE} ${SDLDIR}/SDL${OE} ${SDLDIR}/dummy${OE}
|
SDLOBJ=${SDLDIR}/debugger${OE} ${SDLDIR}/SDL${OE} ${SDLDIR}/dummy${OE}
|
||||||
|
|
||||||
OBJECTS=${MAINOBJ} ${DMGOBJ} ${SDLOBJ} ${CALTERNOBJ}
|
OBJECTS=${MAINOBJ} ${DMGOBJ} ${SDLOBJ}
|
||||||
LIB=${RESAMPLEDIR}/filterkit${OE} ${RESAMPLEDIR}/resample${OE} ${RESAMPLEDIR}/resamplesubs${OE}
|
LIB=${RESAMPLEDIR}/filterkit${OE} ${RESAMPLEDIR}/resample${OE} ${RESAMPLEDIR}/resamplesubs${OE}
|
||||||
|
|
||||||
|
ifeq ($(USEASM),yes)
|
||||||
|
OBJECTS+=${ASMOBJ}
|
||||||
|
else
|
||||||
|
OBJECTS+=${CALTERNOBJ}
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
.SUFFIXES: .c .cpp .asm
|
.SUFFIXES: .c .cpp .asm
|
||||||
|
|
||||||
%${OE}: %.c
|
%${OE}: %.c
|
||||||
|
|
|
@ -55,13 +55,12 @@ void InitLUTs(void)
|
||||||
int hq3xinited=0;
|
int hq3xinited=0;
|
||||||
extern int realsystemRedShift, realsystemBlueShift;
|
extern int realsystemRedShift, realsystemBlueShift;
|
||||||
|
|
||||||
|
//16 bit input, see below for 32 bit input
|
||||||
void hq3x32(unsigned char * pIn, unsigned int srcPitch,
|
void hq3x32(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
{
|
{
|
||||||
// NOTICE! This driver wants 16 bit, not 32 bit input!
|
|
||||||
|
|
||||||
if (!hq3xinited)
|
if (!hq3xinited)
|
||||||
{
|
{
|
||||||
InitLUTs();
|
InitLUTs();
|
||||||
|
@ -114,13 +113,12 @@ void hq4x16(unsigned char * pIn, unsigned int srcPitch,
|
||||||
hq4x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2));
|
hq4x_16( pIn, pOut, Xres, Yres, dstPitch, srcPitch - (Xres *2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//16 bit input, see below for 32 bit input
|
||||||
void hq4x32(unsigned char * pIn, unsigned int srcPitch,
|
void hq4x32(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
{
|
{
|
||||||
// NOTICE! This driver wants 16 bit, not 32 bit input!
|
|
||||||
|
|
||||||
if (!hq3xinited)
|
if (!hq3xinited)
|
||||||
{
|
{
|
||||||
InitLUTs();
|
InitLUTs();
|
||||||
|
@ -145,3 +143,26 @@ void hq4x32(unsigned char * pIn, unsigned int srcPitch,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void convert32bpp_16bpp(unsigned char *pIn, unsigned int width)
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < width; i+=4)
|
||||||
|
{
|
||||||
|
unsigned int p4 = ((unsigned int)pIn[i+2] << 16) | (unsigned int) (pIn[i+1] << 8) | pIn[i+0];
|
||||||
|
unsigned short p2 = ((p4 >> 8)&0xF800) | ((p4 >> 5)&0x07E0) | ((p4 >> 3)&0x001F);
|
||||||
|
pIn[i/2] = (p2 >> 0);
|
||||||
|
pIn[i/2+1] = (p2 >> 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void hq3x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
||||||
|
{
|
||||||
|
convert32bpp_16bpp(pIn, srcPitch*Yres);
|
||||||
|
hq3x32(pIn, srcPitch/2, 0, pOut, dstPitch, Xres, Yres);
|
||||||
|
}
|
||||||
|
|
||||||
|
void hq4x32_32(unsigned char *pIn, unsigned int srcPitch, unsigned char *, unsigned char *pOut, unsigned int dstPitch, int Xres, int Yres)
|
||||||
|
{
|
||||||
|
convert32bpp_16bpp(pIn, srcPitch*Yres);
|
||||||
|
hq4x32(pIn, srcPitch/2, 0, pOut, dstPitch, Xres, Yres);
|
||||||
|
}
|
||||||
|
|
|
@ -271,7 +271,7 @@ void hq3x16(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
#elif defined(_32BIT)
|
#elif defined(_32BIT)
|
||||||
void hq3x32(unsigned char * pIn, unsigned int srcPitch,
|
void hq3x32_32(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
|
@ -283,7 +283,7 @@ void hq4x16(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
#elif defined(_32BIT)
|
#elif defined(_32BIT)
|
||||||
void hq4x32(unsigned char * pIn, unsigned int srcPitch,
|
void hq4x32_32(unsigned char * pIn, unsigned int srcPitch,
|
||||||
unsigned char *,
|
unsigned char *,
|
||||||
unsigned char * pOut, unsigned int dstPitch,
|
unsigned char * pOut, unsigned int dstPitch,
|
||||||
int Xres, int Yres)
|
int Xres, int Yres)
|
||||||
|
|
|
@ -90,9 +90,9 @@ extern void hq2x32(u8*,u32,u8*,u8*,u32,int,int);
|
||||||
extern void lq2x(u8*,u32,u8*,u8*,u32,int,int);
|
extern void lq2x(u8*,u32,u8*,u8*,u32,int,int);
|
||||||
extern void lq2x32(u8*,u32,u8*,u8*,u32,int,int);
|
extern void lq2x32(u8*,u32,u8*,u8*,u32,int,int);
|
||||||
extern void hq3x16(u8*,u32,u8*,u8*,u32,int,int);
|
extern void hq3x16(u8*,u32,u8*,u8*,u32,int,int);
|
||||||
extern void hq3x32(u8*,u32,u8*,u8*,u32,int,int);
|
extern void hq3x32_32(u8*,u32,u8*,u8*,u32,int,int);
|
||||||
extern void hq4x16(u8*,u32,u8*,u8*,u32,int,int);
|
extern void hq4x16(u8*,u32,u8*,u8*,u32,int,int);
|
||||||
extern void hq4x32(u8*,u32,u8*,u8*,u32,int,int);
|
extern void hq4x32_32(u8*,u32,u8*,u8*,u32,int,int);
|
||||||
|
|
||||||
extern void SmartIB(u8*,u32,int,int);
|
extern void SmartIB(u8*,u32,int,int);
|
||||||
extern void SmartIB32(u8*,u32,int,int);
|
extern void SmartIB32(u8*,u32,int,int);
|
||||||
|
@ -2538,10 +2538,10 @@ int main(int argc, char **argv)
|
||||||
filterFunction = lq2x32;
|
filterFunction = lq2x32;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
filterFunction = hq3x32;
|
filterFunction = hq3x32_32;
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
filterFunction = hq4x32;
|
filterFunction = hq4x32_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
filterFunction = NULL;
|
filterFunction = NULL;
|
||||||
|
|
Loading…
Reference in New Issue