HQ3x and 4x is now integrated into SDL, and has a C port. However 3x crashes.

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@105 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
Nach 2007-11-20 13:04:31 +00:00
parent 75a0f1b035
commit ba6cdac2fa
23 changed files with 9903 additions and 1025 deletions

View File

@ -34,14 +34,18 @@ SDLDIR=src/sdl
DMGDIR=src/gb DMGDIR=src/gb
RESAMPLEDIR=src/libresample-0.1.3/src RESAMPLEDIR=src/libresample-0.1.3/src
ASMOBJ=${MAINDIR}/hq3x_16${OE} ${MAINDIR}/hq3x_32${OE} ${MAINDIR}/hq4x_16${OE} ${MAINDIR}/hq4x_32${OE}
CALTERNOBJ= ASMOBJ=${MAINDIR}/hq3x_16${OE} ${MAINDIR}/hq3x_32${OE} ${MAINDIR}/hq4x_16${OE} ${MAINDIR}/hq4x_32${OE} \
${MAINDIR}/hq3x32${OE}
CALTERNOBJ=${MAINDIR}/hq3x16c${OE} ${MAINDIR}/hq3x32c${OE} ${MAINDIR}/hq4x16c${OE} ${MAINDIR}/hq4x32c${OE} \
${MAINDIR}/hq_shared32${OE}
MAINOBJ=${MAINDIR}/2xSaI${OE} ${MAINDIR}/admame${OE} ${MAINDIR}/agbprint${OE} ${MAINDIR}/armdis${OE} \ MAINOBJ=${MAINDIR}/2xSaI${OE} ${MAINDIR}/admame${OE} ${MAINDIR}/agbprint${OE} ${MAINDIR}/armdis${OE} \
${MAINDIR}/bilinear${OE} ${MAINDIR}/bios${OE} ${MAINDIR}/Cheats${OE} ${MAINDIR}/CheatSearch${OE} \ ${MAINDIR}/bilinear${OE} ${MAINDIR}/bios${OE} ${MAINDIR}/Cheats${OE} ${MAINDIR}/CheatSearch${OE} \
${MAINDIR}/EEprom${OE} ${MAINDIR}/elf${OE} ${MAINDIR}/Flash${OE} ${MAINDIR}/GBA${OE} \ ${MAINDIR}/EEprom${OE} ${MAINDIR}/elf${OE} ${MAINDIR}/Flash${OE} ${MAINDIR}/GBA${OE} \
${MAINDIR}/gbafilter${OE} ${MAINDIR}/Gfx${OE} ${MAINDIR}/Globals${OE} ${MAINDIR}/interframe${OE} \ ${MAINDIR}/gbafilter${OE} ${MAINDIR}/Gfx${OE} ${MAINDIR}/Globals${OE} ${MAINDIR}/interframe${OE} \
${MAINDIR}/hq2x${OE} ${MAINDIR}/Mode0${OE} \ ${MAINDIR}/hq2x${OE} ${MAINDIR}/Mode0${OE} \
${MAINDIR}/Mode1${OE} ${MAINDIR}/Mode2${OE} ${MAINDIR}/Mode3${OE} ${MAINDIR}/Mode4${OE} \ ${MAINDIR}/Mode1${OE} ${MAINDIR}/Mode2${OE} ${MAINDIR}/Mode3${OE} ${MAINDIR}/Mode4${OE} \
${MAINDIR}/Mode5${OE} ${MAINDIR}/motionblur${OE} ${MAINDIR}/pixel${OE} ${MAINDIR}/portable${OE} \ ${MAINDIR}/Mode5${OE} ${MAINDIR}/motionblur${OE} ${MAINDIR}/pixel${OE} ${MAINDIR}/portable${OE} \
${MAINDIR}/remote${OE} ${MAINDIR}/RTC${OE} ${MAINDIR}/scanline${OE} ${MAINDIR}/simpleFilter${OE} \ ${MAINDIR}/remote${OE} ${MAINDIR}/RTC${OE} ${MAINDIR}/scanline${OE} ${MAINDIR}/simpleFilter${OE} \
@ -55,7 +59,7 @@ ${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} OBJECTS=${MAINOBJ} ${DMGOBJ} ${SDLOBJ} ${CALTERNOBJ}
LIB=${RESAMPLEDIR}/filterkit${OE} ${RESAMPLEDIR}/resample${OE} ${RESAMPLEDIR}/resamplesubs${OE} LIB=${RESAMPLEDIR}/filterkit${OE} ${RESAMPLEDIR}/resample${OE} ${RESAMPLEDIR}/resamplesubs${OE}
.SUFFIXES: .c .cpp .asm .SUFFIXES: .c .cpp .asm

28
src/hq3x16c.cpp Normal file
View File

@ -0,0 +1,28 @@
/*
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
Copyright (C) 1999 - 2003 Forgotten
Copyright (C) 2003 - 2004 Forgotten and the VBA development team
Copyright (C) 2005 - 2006 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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _HQ3X
#define _16BIT
#include "hqxx.h"
#undef _16BIT
#undef _HQ3X

28
src/hq3x32c.cpp Normal file
View File

@ -0,0 +1,28 @@
/*
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
Copyright (C) 1999 - 2003 Forgotten
Copyright (C) 2003 - 2004 Forgotten and the VBA development team
Copyright (C) 2005 - 2006 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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _HQ3X
#define _32BIT
#include "hqxx.h"
#undef _32BIT
#undef _HQ3X

3639
src/hq3x_pattern.h Normal file

File diff suppressed because it is too large Load Diff

28
src/hq4x16c.cpp Normal file
View File

@ -0,0 +1,28 @@
/*
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
Copyright (C) 1999 - 2003 Forgotten
Copyright (C) 2003 - 2004 Forgotten and the VBA development team
Copyright (C) 2005 - 2006 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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _HQ4X
#define _16BIT
#include "hqxx.h"
#undef _16BIT
#undef _HQ4X

28
src/hq4x32c.cpp Normal file
View File

@ -0,0 +1,28 @@
/*
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
Copyright (C) 1999 - 2003 Forgotten
Copyright (C) 2003 - 2004 Forgotten and the VBA development team
Copyright (C) 2005 - 2006 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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _HQ4X
#define _32BIT
#include "hqxx.h"
#undef _32BIT
#undef _HQ4X

4997
src/hq4x_pattern.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -29,201 +29,46 @@ const uint64_t treshold = UINT64_C(0x0000000000300706);
void Interp1(unsigned char * pc, unsigned int c1, unsigned int c2) void Interp1(unsigned char * pc, unsigned int c1, unsigned int c2)
{ {
#if (defined(_MSC_VER) && !defined(C_CORE))
#ifdef MMX
__asm
{
mov eax, pc
movd mm1, c1
movd mm2, c2
movq mm0, mm1
pslld mm0, 2
psubd mm0, mm1
paddd mm0, mm2
psrld mm0, 2
movd [eax], mm0
EMMS
}
#else
__asm
{
mov eax, pc
mov edx, c1
shl edx, 2
add edx, c2
sub edx, c1
shr edx, 2
mov [eax], edx
}
#endif
#else
*((int*)pc) = (c1*3+c2)/4; *((int*)pc) = (c1*3+c2)/4;
#endif
} }
void Interp2(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3) void Interp2(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3)
{ {
#if (defined(_MSC_VER) && !defined(C_CORE))
#ifdef MMX
__asm
{
mov eax, pc
movd mm0, c1
movd mm1, c2
movd mm2, c3
pslld mm0, 1
paddd mm0, mm1
paddd mm0, mm2
psrad mm0, 2
movd [eax], mm0
EMMS
}
#else
__asm
{
mov eax, pc
mov edx, c1
shl edx, 1
add edx, c2
add edx, c3
shr edx, 2
mov [eax], edx
}
#endif
#else
*((int*)pc) = (c1*2+c2+c3)/4; *((int*)pc) = (c1*2+c2+c3)/4;
#endif
} }
void Interp3(unsigned char * pc, unsigned int c1, unsigned int c2) void Interp3(unsigned char * pc, unsigned int c1, unsigned int c2)
{ {
#if (defined(_MSC_VER) && !defined(C_CORE))
#ifdef MMX
__asm
{
mov eax, pc
movd mm1, c1
movd mm2, c2
punpcklbw mm1, reg_blank
punpcklbw mm2, reg_blank
pmullw mm1, const7
paddw mm1, mm2
psrlw mm1, 3
packuswb mm1, reg_blank
movd [eax], mm1
EMMS
}
#else
__asm
{
mov eax, c1
mov ebx, c2
mov ecx, eax
shl ecx, 3
sub ecx, eax
add ecx, ebx
shr ecx, 3
mov eax, pc
mov [eax], ecx
}
#endif
#else
*((int*)pc) = (c1*7+c2)/8; *((int*)pc) = (c1*7+c2)/8;
*((int*)pc) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00) ) & 0x0007F800) + *((int*)pc) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00) ) & 0x0007F800) +
(((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF) ) & 0x07F807F8)) >> 3; (((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF) ) & 0x07F807F8)) >> 3;
#endif
} }
void Interp4(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3) void Interp4(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3)
{ {
#if (defined(_MSC_VER) && !defined(C_CORE))
#ifdef MMX
__asm
{
mov eax, pc
movd mm1, c1
movd mm2, c2
movd mm3, c3
punpcklbw mm1, reg_blank
punpcklbw mm2, reg_blank
punpcklbw mm3, reg_blank
psllw mm1, 1
paddw mm2, mm3
pmullw mm2, const7
paddw mm1, mm2
psrlw mm1, 4
packuswb mm1, reg_blank
movd [eax], mm1
EMMS
}
#else
__asm
{
mov eax, [c1]
and eax, 0FF00h
shl eax, 1
mov ecx, [c2]
and ecx, 0FF00h
mov edx, [c3]
and edx, 0FF00h
add ecx, edx
imul ecx, ecx,7
add eax, ecx
and eax, 0FF000h
mov ebx, [c1]
and ebx, 0FF00FFh
shl ebx, 1
mov ecx, [c2]
and ecx, 0FF00FFh
mov edx, [c3]
and edx, 0FF00FFh
add ecx, edx
imul ecx, ecx,7
add ebx, ecx
and ebx, 0FF00FF0h
add eax, ebx
shr eax, 4
mov ebx, pc
mov [ebx], eax
}
#endif
#else
*((int*)pc) = (c1*2+(c2+c3)*7)/16; *((int*)pc) = (c1*2+(c2+c3)*7)/16;
*((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7 ) & 0x000FF000) + *((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7 ) & 0x000FF000) +
(((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7 ) & 0x0FF00FF0)) >> 4; (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7 ) & 0x0FF00FF0)) >> 4;
#endif
} }
void Interp5(unsigned char * pc, unsigned int c1, unsigned int c2) void Interp5(unsigned char * pc, unsigned int c1, unsigned int c2)
{ {
#if (defined(_MSC_VER) && !defined(C_CORE))
#ifdef MMX
__asm
{
mov eax, pc
movd mm0, c1
movd mm1, c2
paddd mm0, mm1
psrad mm0, 1
movd [eax], mm0
EMMS
}
#else
__asm
{
mov eax, pc
mov edx, c1
add edx, c2
shr edx, 1
mov [eax], edx
}
#endif
#else
*((int*)pc) = (c1+c2)/2; *((int*)pc) = (c1+c2)/2;
#endif }
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;
} }
@ -235,137 +80,16 @@ bool Diff(unsigned int c1, unsigned int c2)
if (YUV1 == YUV2) return false; // Save some processing power if (YUV1 == YUV2) return false; // Save some processing power
#ifdef MMX
unsigned int retval;
__asm
{
mov eax, 0x7FFFFFFF
movd mm7, eax ;mm7 = ABS_MASK = 0x7FFFFFFF
; Copy source colors in first reg
movd mm0, YUV1
movd mm1, YUV2
mov eax, 0x00FF0000
movd mm6, eax ;mm6 = Ymask = 0x00FF0000
; Calculate color Y difference
movq mm2, mm0
movq mm3, mm1
pand mm2, mm6
pand mm3, mm6
psubd mm2, mm3
pand mm2, mm7
mov eax, 0x0000FF00
movd mm6, eax ;mm6 = Umask = 0x0000FF00
; Calculate color U difference
movq mm3, mm0
movq mm4, mm1
pand mm3, mm6
pand mm4, mm6
psubd mm3, mm4
pand mm3, mm7
mov eax, 0x000000FF
movd mm6, eax ;mm6 = Vmask = 0x000000FF
; Calculate color V difference
movq mm4, mm0
movq mm5, mm1
pand mm4, mm6
pand mm5, mm6
psubd mm4, mm5
pand mm4, mm7
mov eax, 0x00300000
movd mm5, eax ;mm5 = trY = 0x00300000
mov eax, 0x00000700
movd mm6, eax ;mm6 = trU = 0x00000700
mov eax, 0x00000006
movd mm7, eax ;mm7 = trV = 0x00000006
; Compare the results
pcmpgtd mm2, trY
pcmpgtd mm3, trU
pcmpgtd mm4, trV
por mm2, mm3
por mm2, mm4
movd retval, mm2
EMMS
}
return (retval != 0);
#else
return return
( abs32((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) || ( abs32((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
( abs32((YUV1 & Umask) - (YUV2 & Umask)) > trU ) || ( abs32((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
( abs32((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ); ( abs32((YUV1 & Vmask) - (YUV2 & Vmask)) > trV );
#endif
} }
unsigned int RGBtoYUV(unsigned int c) unsigned int RGBtoYUV(unsigned int c)
{ // Division through 3 slows down the emulation about 10% !!! {
#ifdef MMX // Division through 3 slows down the emulation about 10% !!!
unsigned int retval;
__asm
{
movd mm0, c
movq mm1, mm0
movq mm2, mm0 ;mm0=mm1=mm2=c
mov eax, 0x000000FF
movd mm5, eax ;mm5 = REDMASK = 0x000000FF
mov eax, 0x0000FF00
movd mm6, eax ;mm6 = GREENMASK = 0x0000FF00
mov eax, 0x00FF0000
movd mm7, eax ;mm7 = BLUEMASK = 0x00FF0000
pand mm0, mm5
pand mm1, mm6
pand mm2, mm7 ;mm0=R mm1=G mm2=B
movq mm3, mm0
paddd mm3, mm1
paddd mm3, mm2
; psrld mm3, 2 ;mm3=Y
; pslld mm3, 16
pslld mm3, 14 ;mm3=Y<<16
mov eax, 512
movd mm7, eax ;mm7 = 128 << 2 = 512
movq mm4, mm0
psubd mm4, mm2
; psrld mm4, 2
; paddd mm4, mm7 ;mm4=U
; pslld mm4, 8 ;mm4=U<<8
paddd mm4, mm7
pslld mm4, 6
mov eax, 128
movd mm7, eax ;mm7 = 128
movq mm5, mm1
pslld mm5, 1
psubd mm5, mm0
psubd mm5, mm2
psrld mm5, 3
paddd mm5, mm7 ;mm5=V
paddd mm5, mm4
paddd mm5, mm3
movd retval, mm5
EMMS
}
return retval;
#else
unsigned char r, g, b, Y, u, v; unsigned char r, g, b, Y, u, v;
r = (c & 0x000000FF); r = (c & 0x000000FF);
g = (c & 0x0000FF00) >> 8; g = (c & 0x0000FF00) >> 8;
@ -374,16 +98,4 @@ unsigned int RGBtoYUV(unsigned int c)
u = 128 + ((r - b) >> 2); u = 128 + ((r - b) >> 2);
v = 128 + ((-r + 2*g -b)>>3); v = 128 + ((-r + 2*g -b)>>3);
return (Y<<16) + (u<<8) + v; return (Y<<16) + (u<<8) + v;
// Extremely High Quality Code
//unsigned char r, g, b;
//r = c & 0xFF;
//g = (c >> 8) & 0xFF;
//b = (c >> 16) & 0xFF;
//unsigned char y, u, v;
//y = (0.256788 * r + 0.504129 * g + 0.097906 * b) + 16;
//u = (-0.148223 * r - 0.290993 * g + 0.439216 * b) + 128;
//v = (0.439216 * r - 0.367788 * g - 0.071427 * b) + 128;
//return (y << 16) + (u << 8) + v;
#endif
} }

384
src/hqxx.h Normal file
View File

@ -0,0 +1,384 @@
/*
VisualBoyAdvance - a Game Boy & Game Boy Advance emulator
Copyright (C) 1999 - 2003 Forgotten
Copyright (C) 2003 - 2004 Forgotten and the VBA development team
Copyright (C) 2005 - 2006 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 of the License, 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "System.h"
#if defined(_16BIT)
#define SIZE_PIXEL 2
#define COLORTYPE uint32_t
#elif defined(_32BIT)
#define SIZE_PIXEL 4 // 32bit = 4 bytes
#define COLORTYPE unsigned int
#endif
#define abs32(value) (value & 0x7FFFFFFF)
void Interp1(unsigned char * pc, COLORTYPE c1, COLORTYPE c2);
void Interp2(unsigned char * pc, COLORTYPE c1, COLORTYPE c2, COLORTYPE c3);
void Interp3(unsigned char * pc, COLORTYPE c1, COLORTYPE c2);
void Interp4(unsigned char * pc, COLORTYPE c1, COLORTYPE c2, COLORTYPE c3);
void Interp5(unsigned char * pc, COLORTYPE c1, COLORTYPE c2);
void Interp6(unsigned char * pc, COLORTYPE c1, COLORTYPE c2, COLORTYPE c3);
void Interp7(unsigned char * pc, COLORTYPE c1, COLORTYPE c2, COLORTYPE c3);
void Interp8(unsigned char * pc, COLORTYPE c1, COLORTYPE c2);
unsigned int RGBtoYUV(COLORTYPE c);
bool Diff(COLORTYPE c1, COLORTYPE c2);
#if defined(_HQ3X)
#define _MAGNIFICATION 3
#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 *((COLORTYPE*)(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 *((COLORTYPE*)(pOut+SIZE_PIXEL)) = 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 *((COLORTYPE*)(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 *((COLORTYPE*)(pOut+dstPitch)) = c[5];
#define PIXEL11 *((COLORTYPE*)(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 *((COLORTYPE*)(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 *((COLORTYPE*)(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 *((COLORTYPE*)(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 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
#elif defined(_HQ4X)
#define _MAGNIFICATION 4
#define PIXEL00_0 *((COLORTYPE*)(pOut)) = c[5];
#define PIXEL00_11 Interp1(pOut, c[5], c[4]);
#define PIXEL00_12 Interp1(pOut, c[5], c[2]);
#define PIXEL00_20 Interp2(pOut, c[5], c[2], c[4]);
#define PIXEL00_50 Interp5(pOut, c[2], c[4]);
#define PIXEL00_80 Interp8(pOut, c[5], c[1]);
#define PIXEL00_81 Interp8(pOut, c[5], c[4]);
#define PIXEL00_82 Interp8(pOut, c[5], c[2]);
#define PIXEL01_0 *((COLORTYPE*)(pOut+SIZE_PIXEL)) = c[5];
#define PIXEL01_10 Interp1(pOut+SIZE_PIXEL, c[5], c[1]);
#define PIXEL01_12 Interp1(pOut+SIZE_PIXEL, c[5], c[2]);
#define PIXEL01_14 Interp1(pOut+SIZE_PIXEL, c[2], c[5]);
#define PIXEL01_21 Interp2(pOut+SIZE_PIXEL, c[2], c[5], c[4]);
#define PIXEL01_31 Interp3(pOut+SIZE_PIXEL, c[5], c[4]);
#define PIXEL01_50 Interp5(pOut+SIZE_PIXEL, c[2], c[5]);
#define PIXEL01_60 Interp6(pOut+SIZE_PIXEL, c[5], c[2], c[4]);
#define PIXEL01_61 Interp6(pOut+SIZE_PIXEL, c[5], c[2], c[1]);
#define PIXEL01_82 Interp8(pOut+SIZE_PIXEL, c[5], c[2]);
#define PIXEL01_83 Interp8(pOut+SIZE_PIXEL, c[2], c[4]);
#define PIXEL02_0 *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
#define PIXEL02_10 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
#define PIXEL02_11 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
#define PIXEL02_13 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5]);
#define PIXEL02_21 Interp2(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5], c[6]);
#define PIXEL02_32 Interp3(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL02_50 Interp5(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5]);
#define PIXEL02_60 Interp6(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6]);
#define PIXEL02_61 Interp6(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[3]);
#define PIXEL02_81 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
#define PIXEL02_83 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6]);
#define PIXEL03_0 *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
#define PIXEL03_11 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
#define PIXEL03_12 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL03_20 Interp2(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6]);
#define PIXEL03_50 Interp5(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6]);
#define PIXEL03_80 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
#define PIXEL03_81 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
#define PIXEL03_82 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL10_0 *((COLORTYPE*)(pOut+dstPitch)) = c[5];
#define PIXEL10_10 Interp1(pOut+dstPitch, c[5], c[1]);
#define PIXEL10_11 Interp1(pOut+dstPitch, c[5], c[4]);
#define PIXEL10_13 Interp1(pOut+dstPitch, c[4], c[5]);
#define PIXEL10_21 Interp2(pOut+dstPitch, c[4], c[5], c[2]);
#define PIXEL10_32 Interp3(pOut+dstPitch, c[5], c[2]);
#define PIXEL10_50 Interp5(pOut+dstPitch, c[4], c[5]);
#define PIXEL10_60 Interp6(pOut+dstPitch, c[5], c[4], c[2]);
#define PIXEL10_61 Interp6(pOut+dstPitch, c[5], c[4], c[1]);
#define PIXEL10_81 Interp8(pOut+dstPitch, c[5], c[4]);
#define PIXEL10_83 Interp8(pOut+dstPitch, c[4], c[2]);
#define PIXEL11_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL)) = c[5];
#define PIXEL11_30 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[1]);
#define PIXEL11_31 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[4]);
#define PIXEL11_32 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[2]);
#define PIXEL11_70 Interp7(pOut+dstPitch+SIZE_PIXEL, c[5], c[4], c[2]);
#define PIXEL12_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
#define PIXEL12_30 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
#define PIXEL12_31 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
#define PIXEL12_32 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL12_70 Interp7(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[2]);
#define PIXEL13_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
#define PIXEL13_10 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]);
#define PIXEL13_12 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL13_14 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
#define PIXEL13_21 Interp2(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5], c[2]);
#define PIXEL13_31 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]);
#define PIXEL13_50 Interp5(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
#define PIXEL13_60 Interp6(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[2]);
#define PIXEL13_61 Interp6(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[3]);
#define PIXEL13_82 Interp8(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL13_83 Interp8(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[2]);
#define PIXEL20_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch)) = c[5];
#define PIXEL20_10 Interp1(pOut+dstPitch+dstPitch, c[5], c[7]);
#define PIXEL20_12 Interp1(pOut+dstPitch+dstPitch, c[5], c[4]);
#define PIXEL20_14 Interp1(pOut+dstPitch+dstPitch, c[4], c[5]);
#define PIXEL20_21 Interp2(pOut+dstPitch+dstPitch, c[4], c[5], c[8]);
#define PIXEL20_31 Interp3(pOut+dstPitch+dstPitch, c[5], c[8]);
#define PIXEL20_50 Interp5(pOut+dstPitch+dstPitch, c[4], c[5]);
#define PIXEL20_60 Interp6(pOut+dstPitch+dstPitch, c[5], c[4], c[8]);
#define PIXEL20_61 Interp6(pOut+dstPitch+dstPitch, c[5], c[4], c[7]);
#define PIXEL20_82 Interp8(pOut+dstPitch+dstPitch, c[5], c[4]);
#define PIXEL20_83 Interp8(pOut+dstPitch+dstPitch, c[4], c[8]);
#define PIXEL21_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL)) = c[5];
#define PIXEL21_30 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[7]);
#define PIXEL21_31 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]);
#define PIXEL21_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4]);
#define PIXEL21_70 Interp7(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4], c[8]);
#define PIXEL22_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
#define PIXEL22_30 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
#define PIXEL22_31 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL22_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
#define PIXEL22_70 Interp7(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8]);
#define PIXEL23_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
#define PIXEL23_10 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
#define PIXEL23_11 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL23_13 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
#define PIXEL23_21 Interp2(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5], c[8]);
#define PIXEL23_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
#define PIXEL23_50 Interp5(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]);
#define PIXEL23_60 Interp6(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8]);
#define PIXEL23_61 Interp6(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[9]);
#define PIXEL23_81 Interp8(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL23_83 Interp8(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[8]);
#define PIXEL30_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch)) = c[5];
#define PIXEL30_11 Interp1(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8]);
#define PIXEL30_12 Interp1(pOut+dstPitch+dstPitch+dstPitch, c[5], c[4]);
#define PIXEL30_20 Interp2(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8], c[4]);
#define PIXEL30_50 Interp5(pOut+dstPitch+dstPitch+dstPitch, c[8], c[4]);
#define PIXEL30_80 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[7]);
#define PIXEL30_81 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8]);
#define PIXEL30_82 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[4]);
#define PIXEL31_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL)) = c[5];
#define PIXEL31_10 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[7]);
#define PIXEL31_11 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]);
#define PIXEL31_13 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5]);
#define PIXEL31_21 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5], c[4]);
#define PIXEL31_32 Interp3(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4]);
#define PIXEL31_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5]);
#define PIXEL31_60 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8], c[4]);
#define PIXEL31_61 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8], c[7]);
#define PIXEL31_81 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]);
#define PIXEL31_83 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[4]);
#define PIXEL32_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
#define PIXEL32_10 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
#define PIXEL32_12 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
#define PIXEL32_14 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5]);
#define PIXEL32_21 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5], c[6]);
#define PIXEL32_31 Interp3(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL32_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5]);
#define PIXEL32_60 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[6]);
#define PIXEL32_61 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[9]);
#define PIXEL32_82 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
#define PIXEL32_83 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[6]);
#define PIXEL33_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5];
#define PIXEL33_11 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL33_12 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
#define PIXEL33_20 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[6]);
#define PIXEL33_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[8], c[6]);
#define PIXEL33_80 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]);
#define PIXEL33_81 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]);
#define PIXEL33_82 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]);
#endif
#if defined(_HQ3X)
#if defined(_16BIT)
void hq3x16(unsigned char * pIn, unsigned int srcPitch,
unsigned char *,
unsigned char * pOut, unsigned int dstPitch,
int Xres, int Yres)
#elif defined(_32BIT)
void hq3x32(unsigned char * pIn, unsigned int srcPitch,
unsigned char *,
unsigned char * pOut, unsigned int dstPitch,
int Xres, int Yres)
#endif
#elif defined(_HQ4X)
#if defined(_16BIT)
void hq4x16(unsigned char * pIn, unsigned int srcPitch,
unsigned char *,
unsigned char * pOut, unsigned int dstPitch,
int Xres, int Yres)
#elif defined(_32BIT)
void hq4x32(unsigned char * pIn, unsigned int srcPitch,
unsigned char *,
unsigned char * pOut, unsigned int dstPitch,
int Xres, int Yres)
#endif
#endif
{
unsigned int YUV1, YUV2;
int i, j, k;
unsigned int line;
COLORTYPE c[10];
// +----+----+----+
// | | | |
// | c1 | c2 | c3 |
// +----+----+----+
// | | | |
// | c4 | c5 | c6 |
// +----+----+----+
// | | | |
// | c7 | c8 | c9 |
// +----+----+----+
for (j=0; j<Yres; j++)
{
if ( (j>0) || (j<Yres-1) ) line = srcPitch; else line = 0;
for (i=0; i<Xres; i++)
{
c[2] = *((COLORTYPE*)(pIn - line));
c[5] = *((COLORTYPE*)(pIn ));
c[8] = *((COLORTYPE*)(pIn + line));
if (i>0)
{
c[1] = *((COLORTYPE*)(pIn - line - SIZE_PIXEL));
c[4] = *((COLORTYPE*)(pIn - SIZE_PIXEL));
c[7] = *((COLORTYPE*)(pIn + line - SIZE_PIXEL));
}
else
{
c[1] = c[2];
c[4] = c[5];
c[7] = c[8];
}
if (i<Xres-1)
{
c[3] = *((COLORTYPE*)(pIn - line + SIZE_PIXEL));
c[6] = *((COLORTYPE*)(pIn + SIZE_PIXEL));
c[9] = *((COLORTYPE*)(pIn + line + SIZE_PIXEL));
}
else
{
c[3] = c[2];
c[6] = c[5];
c[9] = c[8];
}
int pattern = 0;
int flag = 1;
YUV1 = RGBtoYUV(c[5]);
for (k=1; k<=9; k++)
{
if (k==5) continue;
if ( c[k] != c[5] )
{
YUV2 = RGBtoYUV(c[k]);
if (
( abs32((YUV1 & 0x00FF0000) - (YUV2 & 0x00FF0000)) > 0x00300000 ) ||
( abs32((YUV1 & 0x0000FF00) - (YUV2 & 0x0000FF00)) > 0x00000700 ) ||
( abs32((YUV1 & 0x000000FF) - (YUV2 & 0x000000FF)) > 0x00000006 )
)
pattern |= flag;
}
flag <<= 1;
}
#if defined(_HQ3X)
#include "hq3x_pattern.h"
#elif defined(_HQ4X)
#include "hq4x_pattern.h"
#endif
pIn += SIZE_PIXEL;
pOut += _MAGNIFICATION * SIZE_PIXEL;
}
pIn += srcPitch - (Xres * SIZE_PIXEL);
pOut += dstPitch-(_MAGNIFICATION * Xres * SIZE_PIXEL);
pOut += (_MAGNIFICATION-1) * dstPitch;
}
}
#undef SIZE_PIXEL
#undef COLORTYPE
#undef abs32

Binary file not shown.

View File

@ -89,6 +89,10 @@ extern void hq2x(u8*,u32,u8*,u8*,u32,int,int);
extern void hq2x32(u8*,u32,u8*,u8*,u32,int,int); 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 hq3x32(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 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);
@ -154,6 +158,8 @@ int sensorY = 2047;
int filter = 0; int filter = 0;
u8 *delta = NULL; u8 *delta = NULL;
int filter_enlarge = 2;
int sdlPrintUsage = 0; int sdlPrintUsage = 0;
int disableMMX = 0; int disableMMX = 0;
@ -327,6 +333,8 @@ struct option sdlOptions[] = {
{ "filter-scanlines", no_argument, &filter, 11 }, { "filter-scanlines", no_argument, &filter, 11 },
{ "filter-hq2x", no_argument, &filter, 12 }, { "filter-hq2x", no_argument, &filter, 12 },
{ "filter-lq2x", no_argument, &filter, 13 }, { "filter-lq2x", no_argument, &filter, 13 },
{ "filter-hq3x", no_argument, &filter, 14 },
{ "filter-hq4x", no_argument, &filter, 15 },
{ "flash-size", required_argument, 0, 'S' }, { "flash-size", required_argument, 0, 'S' },
{ "flash-64k", no_argument, &sdlFlashSize, 0 }, { "flash-64k", no_argument, &sdlFlashSize, 0 },
{ "flash-128k", no_argument, &sdlFlashSize, 1 }, { "flash-128k", no_argument, &sdlFlashSize, 1 },
@ -1114,7 +1122,7 @@ void sdlReadPreferences(FILE *f)
strcpy(biosFileName, value); strcpy(biosFileName, value);
} else if(!strcmp(key, "filter")) { } else if(!strcmp(key, "filter")) {
filter = sdlFromHex(value); filter = sdlFromHex(value);
if(filter < 0 || filter > 13) if(filter < 0 || filter > 15)
filter = 0; filter = 0;
} else if(!strcmp(key, "disableStatus")) { } else if(!strcmp(key, "disableStatus")) {
disableStatusMessages = sdlFromHex(value) ? true : false; disableStatusMessages = sdlFromHex(value) ? true : false;
@ -1899,6 +1907,8 @@ Options:\n\
--filter-scanlines 11 - Scanlines\n\ --filter-scanlines 11 - Scanlines\n\
--filter-hq2x 12 - hq2x\n\ --filter-hq2x 12 - hq2x\n\
--filter-lq2x 13 - lq2x\n\ --filter-lq2x 13 - lq2x\n\
--filter-hq3x 14 - hq3x\n\
--filter-hq4x 15 - hq4x\n\
-h, --help Print this help\n\ -h, --help Print this help\n\
-i, --ips=PATCH Apply given IPS patch\n\ -i, --ips=PATCH Apply given IPS patch\n\
-p, --profile=[HERTZ] Enable profiling\n\ -p, --profile=[HERTZ] Enable profiling\n\
@ -2178,8 +2188,14 @@ int main(int argc, char **argv)
} }
} }
switch (filter)
{
case 14: filter_enlarge = 3; break;
case 15: filter_enlarge = 4; break;
}
if(filter) { if(filter) {
sizeOption = 1; sizeOption = filter_enlarge-1;
} }
for(int i = 0; i < 24;) { for(int i = 0; i < 24;) {
@ -2467,6 +2483,12 @@ int main(int argc, char **argv)
case 13: case 13:
filterFunction = lq2x; filterFunction = lq2x;
break; break;
case 14:
filterFunction = hq3x16;
break;
case 15:
filterFunction = hq4x16;
break;
default: default:
filterFunction = NULL; filterFunction = NULL;
break; break;
@ -2515,6 +2537,12 @@ int main(int argc, char **argv)
case 13: case 13:
filterFunction = lq2x32; filterFunction = lq2x32;
break; break;
case 14:
filterFunction = hq3x32;
break;
case 15:
filterFunction = hq4x32;
break;
default: default:
filterFunction = NULL; filterFunction = NULL;
break; break;
@ -2669,19 +2697,21 @@ void systemDrawScreen()
} }
if(filterFunction) { if(filterFunction) {
if(systemColorDepth == 16) if(systemColorDepth == 16) {
filterFunction(pix+destWidth+4,destWidth+4, delta, filterFunction(pix+destWidth+4,destWidth+4, delta,
(u8*)surface->pixels,surface->pitch, (u8*)surface->pixels,surface->pitch,
srcWidth, srcWidth,
srcHeight); srcHeight);
else } else {
filterFunction(pix+destWidth*2+4, unsigned int destw = destWidth*(filter_enlarge == 2 ? 2 : 1)+4;
destWidth*2+4, filterFunction(pix+destw,
destw,
delta, delta,
(u8*)surface->pixels, (u8*)surface->pixels,
surface->pitch, surface->pitch,
srcWidth, srcWidth,
srcHeight); srcHeight);
}
} else { } else {
int destPitch = surface->pitch; int destPitch = surface->pitch;
u8 *src = pix; u8 *src = pix;