add patch 1485766 from Kronuz.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2682
This commit is contained in:
parent
196d204ccf
commit
7db3da30f6
10 changed files with 5294 additions and 5 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dosbox.cpp,v 1.101 2006-06-29 09:10:10 c2woody Exp $ */
|
||||
/* $Id: dosbox.cpp,v 1.102 2006-08-05 09:06:44 qbix79 Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -271,7 +271,9 @@ void DOSBOX_Init(void) {
|
|||
"frameskip -- How many frames dosbox skips before drawing one.\n"
|
||||
"aspect -- Do aspect correction, if your output method doesn't support scaling this can slow things down!.\n"
|
||||
"scaler -- Scaler used to enlarge/enhance low resolution modes.\n"
|
||||
" Supported are none,normal2x,normal3x,advmame2x,advmame3x,advinterp2x,advinterp3x,tv2x,tv3x,rgb2x,rgb3x,scan2x,scan3x.\n"
|
||||
" Supported are none,normal2x,normal3x,advmame2x,advmame3x,hq2x,hq3x,\n"
|
||||
" 2xsai,super2xsai,supereagle,advinterp2x,advinterp3x,\n"
|
||||
" tv2x,tv3x,rgb2x,rgb3x,scan2x,scan3x.\n"
|
||||
);
|
||||
|
||||
secprop=control->AddSection_prop("cpu",&CPU_Init,true);//done
|
||||
|
|
|
@ -4,5 +4,7 @@ noinst_LIBRARIES = libgui.a
|
|||
libgui_a_SOURCES = sdlmain.cpp sdl_mapper.cpp dosbox_logo.h \
|
||||
render.cpp render_scalers.cpp render_scalers.h \
|
||||
render_templates.h render_loops.h render_simple.h \
|
||||
render_templates_hq.h render_templates_hq.h \
|
||||
render_templates_hq2x.h render_templates_hq3x.h \
|
||||
midi.cpp midi_win32.h midi_oss.h midi_coreaudio.h midi_alsa.h
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: render.cpp,v 1.46 2006-05-27 07:01:33 qbix79 Exp $ */
|
||||
/* $Id: render.cpp,v 1.47 2006-08-05 09:06:44 qbix79 Exp $ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
@ -238,6 +238,24 @@ void RENDER_CallBack( GFX_CallBackFunctions_t function ) {
|
|||
else if (render.scale.size == 3)
|
||||
complexBlock = &ScaleAdvMame3x;
|
||||
break;
|
||||
case scalerOpHQ:
|
||||
if (render.scale.size == 2)
|
||||
complexBlock = &ScaleHQ2x;
|
||||
else if (render.scale.size == 3)
|
||||
complexBlock = &ScaleHQ3x;
|
||||
break;
|
||||
case scalerOpSuperSaI:
|
||||
if (render.scale.size == 2)
|
||||
complexBlock = &ScaleSuper2xSaI;
|
||||
break;
|
||||
case scalerOpSuperEagle:
|
||||
if (render.scale.size == 2)
|
||||
complexBlock = &ScaleSuperEagle;
|
||||
break;
|
||||
case scalerOpSaI:
|
||||
if (render.scale.size == 2)
|
||||
complexBlock = &Scale2xSaI;
|
||||
break;
|
||||
case scalerOpTV:
|
||||
if (render.scale.size == 2)
|
||||
simpleBlock = &ScaleTV2x;
|
||||
|
@ -274,10 +292,12 @@ forcenormal:
|
|||
gfx_flags = complexBlock->gfxFlags;
|
||||
xscale = complexBlock->xscale;
|
||||
yscale = complexBlock->yscale;
|
||||
// LOG_MSG("Scaler:%s",complexBlock->name);
|
||||
} else {
|
||||
gfx_flags = simpleBlock->gfxFlags;
|
||||
xscale = simpleBlock->xscale;
|
||||
yscale = simpleBlock->yscale;
|
||||
// LOG_MSG("Scaler:%s",simpleBlock->name);
|
||||
}
|
||||
switch (render.src.bpp) {
|
||||
case 8:
|
||||
|
@ -421,6 +441,18 @@ static void DecreaseFrameSkip(bool pressed) {
|
|||
LOG_MSG("Frame Skip at %d",render.frameskip.max);
|
||||
GFX_SetTitle(-1,render.frameskip.max,false);
|
||||
}
|
||||
/* Disabled as I don't want to waste a keybind for that. Might be used in the future (Qbix)
|
||||
static void ChangeScaler(bool pressed) {
|
||||
if (!pressed)
|
||||
return;
|
||||
render.scale.op = (scalerOperation)((int)render.scale.op+1);
|
||||
if((render.scale.op) >= scalerLast || render.scale.size == 1) {
|
||||
render.scale.op = (scalerOperation)0;
|
||||
if(++render.scale.size > 3)
|
||||
render.scale.size = 1;
|
||||
}
|
||||
RENDER_CallBack( GFX_CallBackReset );
|
||||
} */
|
||||
|
||||
void RENDER_Init(Section * sec) {
|
||||
Section_prop * section=static_cast<Section_prop *>(sec);
|
||||
|
@ -448,6 +480,11 @@ void RENDER_Init(Section * sec) {
|
|||
else if (!strcasecmp(scaler,"advmame3x")) { render.scale.op = scalerOpAdvMame;render.scale.size = 3; }
|
||||
else if (!strcasecmp(scaler,"advinterp2x")) { render.scale.op = scalerOpAdvInterp;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"advinterp3x")) { render.scale.op = scalerOpAdvInterp;render.scale.size = 3; }
|
||||
else if (!strcasecmp(scaler,"hq2x")) { render.scale.op = scalerOpHQ;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"hq3x")) { render.scale.op = scalerOpHQ;render.scale.size = 3; }
|
||||
else if (!strcasecmp(scaler,"2xsai")) { render.scale.op = scalerOpSaI;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"super2xsai")) { render.scale.op = scalerOpSuperSaI;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"supereagle")) { render.scale.op = scalerOpSuperEagle;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"tv2x")) { render.scale.op = scalerOpTV;render.scale.size = 2; }
|
||||
else if (!strcasecmp(scaler,"tv3x")) { render.scale.op = scalerOpTV;render.scale.size = 3; }
|
||||
else if (!strcasecmp(scaler,"rgb2x")){ render.scale.op = scalerOpRGB;render.scale.size = 2; }
|
||||
|
|
|
@ -158,6 +158,7 @@ ScalerLineBlock_t ScalerCache = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleNormal1x = {
|
||||
"Normal",
|
||||
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
|
||||
1,1,
|
||||
Normal1x_8_8_L, Normal1x_8_15_L, Normal1x_8_16_L, Normal1x_8_32_L,
|
||||
|
@ -173,6 +174,7 @@ ScalerSimpleBlock_t ScaleNormal1x = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleNormalDw = {
|
||||
"Normal",
|
||||
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
|
||||
2,1,
|
||||
NormalDw_8_8_L, NormalDw_8_15_L, NormalDw_8_16_L, NormalDw_8_32_L,
|
||||
|
@ -188,6 +190,7 @@ ScalerSimpleBlock_t ScaleNormalDw = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleNormalDh = {
|
||||
"Normal",
|
||||
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
|
||||
1,2,
|
||||
NormalDh_8_8_L, NormalDh_8_15_L, NormalDh_8_16_L, NormalDh_8_32_L,
|
||||
|
@ -203,6 +206,7 @@ ScalerSimpleBlock_t ScaleNormalDh = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleNormal2x = {
|
||||
"Normal2x",
|
||||
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
|
||||
2,2,
|
||||
Normal2x_8_8_L, Normal2x_8_15_L, Normal2x_8_16_L, Normal2x_8_32_L,
|
||||
|
@ -218,6 +222,7 @@ ScalerSimpleBlock_t ScaleNormal2x = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleNormal3x = {
|
||||
"Normal3x",
|
||||
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
|
||||
3,3,
|
||||
Normal3x_8_8_L, Normal3x_8_15_L, Normal3x_8_16_L, Normal3x_8_32_L,
|
||||
|
@ -233,6 +238,7 @@ ScalerSimpleBlock_t ScaleNormal3x = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleTV2x = {
|
||||
"TV2x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
2,2,
|
||||
0, TV2x_8_15_L, TV2x_8_16_L, TV2x_8_32_L,
|
||||
|
@ -248,6 +254,7 @@ ScalerSimpleBlock_t ScaleTV2x = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleTV3x = {
|
||||
"TV3x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
3,3,
|
||||
0, TV3x_8_15_L, TV3x_8_16_L, TV3x_8_32_L,
|
||||
|
@ -263,6 +270,7 @@ ScalerSimpleBlock_t ScaleTV3x = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleScan2x = {
|
||||
"Scan2x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
2,2,
|
||||
0, Scan2x_8_15_L, Scan2x_8_16_L, Scan2x_8_32_L,
|
||||
|
@ -278,6 +286,7 @@ ScalerSimpleBlock_t ScaleScan2x = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleScan3x = {
|
||||
"Scan3x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
3,3,
|
||||
0, Scan3x_8_15_L, Scan3x_8_16_L, Scan3x_8_32_L,
|
||||
|
@ -293,6 +302,7 @@ ScalerSimpleBlock_t ScaleScan3x = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleRGB2x = {
|
||||
"RGB2x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
2,2,
|
||||
0, RGB2x_8_15_L, RGB2x_8_16_L, RGB2x_8_32_L,
|
||||
|
@ -308,6 +318,7 @@ ScalerSimpleBlock_t ScaleRGB2x = {
|
|||
};
|
||||
|
||||
ScalerSimpleBlock_t ScaleRGB3x = {
|
||||
"RGB3x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
3,3,
|
||||
0, RGB3x_8_15_L, RGB3x_8_16_L, RGB3x_8_32_L,
|
||||
|
@ -326,6 +337,7 @@ ScalerSimpleBlock_t ScaleRGB3x = {
|
|||
/* Complex scalers */
|
||||
|
||||
ScalerComplexBlock_t ScaleAdvMame2x ={
|
||||
"AdvMame2x",
|
||||
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
|
||||
2,2,
|
||||
AdvMame2x_8_L,AdvMame2x_16_L,AdvMame2x_16_L,AdvMame2x_32_L,
|
||||
|
@ -333,6 +345,7 @@ ScalerComplexBlock_t ScaleAdvMame2x ={
|
|||
};
|
||||
|
||||
ScalerComplexBlock_t ScaleAdvMame3x = {
|
||||
"AdvMame3x",
|
||||
GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
|
||||
3,3,
|
||||
AdvMame3x_8_L,AdvMame3x_16_L,AdvMame3x_16_L,AdvMame3x_32_L,
|
||||
|
@ -340,7 +353,48 @@ ScalerComplexBlock_t ScaleAdvMame3x = {
|
|||
};
|
||||
|
||||
/* These need specific 15bpp versions */
|
||||
ScalerComplexBlock_t ScaleHQ2x ={
|
||||
"HQ2x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
2,2,
|
||||
0,HQ2x_16_L,HQ2x_16_L,HQ2x_32_L,
|
||||
0,HQ2x_16_R,HQ2x_16_R,HQ2x_32_R
|
||||
};
|
||||
|
||||
ScalerComplexBlock_t ScaleHQ3x ={
|
||||
"HQ3x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
3,3,
|
||||
0,HQ3x_16_L,HQ3x_16_L,HQ3x_32_L,
|
||||
0,HQ3x_16_R,HQ3x_16_R,HQ3x_32_R
|
||||
};
|
||||
|
||||
ScalerComplexBlock_t ScaleSuper2xSaI ={
|
||||
"Super2xSaI",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
2,2,
|
||||
0,Super2xSaI_16_L,Super2xSaI_16_L,Super2xSaI_32_L,
|
||||
0,Super2xSaI_16_R,Super2xSaI_16_R,Super2xSaI_32_R
|
||||
};
|
||||
|
||||
ScalerComplexBlock_t Scale2xSaI ={
|
||||
"2xSaI",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
2,2,
|
||||
0,_2xSaI_16_L,_2xSaI_16_L,_2xSaI_32_L,
|
||||
0,_2xSaI_16_R,_2xSaI_16_R,_2xSaI_32_R
|
||||
};
|
||||
|
||||
ScalerComplexBlock_t ScaleSuperEagle ={
|
||||
"SuperEagle",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
2,2,
|
||||
0,SuperEagle_16_L,SuperEagle_16_L,SuperEagle_32_L,
|
||||
0,SuperEagle_16_R,SuperEagle_16_R,SuperEagle_32_R
|
||||
};
|
||||
|
||||
ScalerComplexBlock_t ScaleAdvInterp2x = {
|
||||
"AdvInterp2x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
2,2,
|
||||
0,AdvInterp2x_15_L,AdvInterp2x_16_L,AdvInterp2x_32_L,
|
||||
|
@ -348,6 +402,7 @@ ScalerComplexBlock_t ScaleAdvInterp2x = {
|
|||
};
|
||||
|
||||
ScalerComplexBlock_t ScaleAdvInterp3x = {
|
||||
"AdvInterp3x",
|
||||
GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
|
||||
3,3,
|
||||
0,AdvInterp3x_15_L,AdvInterp3x_16_L,AdvInterp3x_32_L,
|
||||
|
|
|
@ -33,13 +33,18 @@ typedef enum {
|
|||
scalerMode8, scalerMode15, scalerMode16, scalerMode32
|
||||
} scalerMode_t;
|
||||
|
||||
typedef enum {
|
||||
typedef enum scalerOperation {
|
||||
scalerOpNormal,
|
||||
scalerOpAdvMame,
|
||||
scalerOpAdvInterp,
|
||||
scalerOpHQ,
|
||||
scalerOpSaI,
|
||||
scalerOpSuperSaI,
|
||||
scalerOpSuperEagle,
|
||||
scalerOpTV,
|
||||
scalerOpRGB,
|
||||
scalerOpScan,
|
||||
scalerLast,
|
||||
} scalerOperation_t;
|
||||
|
||||
typedef void (*ScalerLineHandler_t)(const void *src);
|
||||
|
@ -66,6 +71,7 @@ extern scalerChangeCache_t scalerChangeCache;
|
|||
typedef ScalerLineHandler_t ScalerLineBlock_t[5][4];
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
Bitu gfxFlags;
|
||||
Bitu xscale,yscale;
|
||||
ScalerComplexHandler_t Linear[4];
|
||||
|
@ -73,6 +79,7 @@ typedef struct {
|
|||
} ScalerComplexBlock_t;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
Bitu gfxFlags;
|
||||
Bitu xscale,yscale;
|
||||
ScalerLineBlock_t Linear;
|
||||
|
@ -97,6 +104,11 @@ extern ScalerSimpleBlock_t ScaleRGB3x;
|
|||
extern ScalerSimpleBlock_t ScaleScan2x;
|
||||
extern ScalerSimpleBlock_t ScaleScan3x;
|
||||
/* Complex scalers */
|
||||
extern ScalerComplexBlock_t ScaleHQ2x;
|
||||
extern ScalerComplexBlock_t ScaleHQ3x;
|
||||
extern ScalerComplexBlock_t Scale2xSaI;
|
||||
extern ScalerComplexBlock_t ScaleSuper2xSaI;
|
||||
extern ScalerComplexBlock_t ScaleSuperEagle;
|
||||
extern ScalerComplexBlock_t ScaleAdvMame2x;
|
||||
extern ScalerComplexBlock_t ScaleAdvMame3x;
|
||||
extern ScalerComplexBlock_t ScaleAdvInterp2x;
|
||||
|
|
|
@ -25,6 +25,12 @@
|
|||
#define redMask 0
|
||||
#define greenMask 0
|
||||
#define blueMask 0
|
||||
#define redBits 0
|
||||
#define greenBits 0
|
||||
#define blueBits 0
|
||||
#define redShift 0
|
||||
#define greenShift 0
|
||||
#define blueShift 0
|
||||
#elif DBPP == 15 || DBPP == 16
|
||||
#define PSIZE 2
|
||||
#define PTYPE Bit16u
|
||||
|
@ -35,10 +41,22 @@
|
|||
#define redMask 0x7C00
|
||||
#define greenMask 0x03E0
|
||||
#define blueMask 0x001F
|
||||
#define redBits 5
|
||||
#define greenBits 5
|
||||
#define blueBits 5
|
||||
#define redShift 10
|
||||
#define greenShift 5
|
||||
#define blueShift 0
|
||||
#elif DBPP == 16
|
||||
#define redMask 0xF800
|
||||
#define greenMask 0x07E0
|
||||
#define blueMask 0x001F
|
||||
#define redBits 5
|
||||
#define greenBits 6
|
||||
#define blueBits 5
|
||||
#define redShift 11
|
||||
#define greenShift 5
|
||||
#define blueShift 0
|
||||
#endif
|
||||
#elif DBPP == 32
|
||||
#define PSIZE 4
|
||||
|
@ -49,6 +67,12 @@
|
|||
#define redMask 0xff0000
|
||||
#define greenMask 0x00ff00
|
||||
#define blueMask 0x0000ff
|
||||
#define redBits 8
|
||||
#define greenBits 8
|
||||
#define blueBits 8
|
||||
#define redShift 16
|
||||
#define greenShift 8
|
||||
#define blueShift 0
|
||||
#endif
|
||||
|
||||
#define redblueMask (redMask | blueMask)
|
||||
|
@ -104,6 +128,11 @@
|
|||
#define SRCTYPE Bit32u
|
||||
#endif
|
||||
|
||||
// C0 C1 C2 D3
|
||||
// C3 C4 C5 D4
|
||||
// C6 C7 C8 D5
|
||||
// D0 D1 D2 D6
|
||||
|
||||
#define C0 fc[-1 - SCALER_COMPLEXWIDTH]
|
||||
#define C1 fc[+0 - SCALER_COMPLEXWIDTH]
|
||||
#define C2 fc[+1 - SCALER_COMPLEXWIDTH]
|
||||
|
@ -114,6 +143,15 @@
|
|||
#define C7 fc[+0 + SCALER_COMPLEXWIDTH]
|
||||
#define C8 fc[+1 + SCALER_COMPLEXWIDTH]
|
||||
|
||||
#define D0 fc[-1 + 2*SCALER_COMPLEXWIDTH]
|
||||
#define D1 fc[+0 + 2*SCALER_COMPLEXWIDTH]
|
||||
#define D2 fc[+1 + 2*SCALER_COMPLEXWIDTH]
|
||||
#define D3 fc[+2 - SCALER_COMPLEXWIDTH]
|
||||
#define D4 fc[+2]
|
||||
#define D5 fc[+2 + SCALER_COMPLEXWIDTH]
|
||||
#define D6 fc[+2 + 2*SCALER_COMPLEXWIDTH]
|
||||
|
||||
|
||||
static void conc3d(Cache,SBPP,DBPP) (const void * s) {
|
||||
const SRCTYPE * src = (SRCTYPE*)s;
|
||||
PTYPE *fc= &FC[render.scale.inLine+1][1];
|
||||
|
@ -352,6 +390,62 @@ static void conc3d(Cache,SBPP,DBPP) (const void * s) {
|
|||
|
||||
#if (DBPP > 8)
|
||||
|
||||
#include "render_templates_hq.h"
|
||||
|
||||
#define SCALERNAME HQ2x
|
||||
#define SCALERWIDTH 2
|
||||
#define SCALERHEIGHT 2
|
||||
#include "render_templates_hq2x.h"
|
||||
#define SCALERFUNC conc2d(Hq2x,SBPP)(line0, line1, fc)
|
||||
#include "render_loops.h"
|
||||
#undef SCALERNAME
|
||||
#undef SCALERWIDTH
|
||||
#undef SCALERHEIGHT
|
||||
#undef SCALERFUNC
|
||||
|
||||
#define SCALERNAME HQ3x
|
||||
#define SCALERWIDTH 3
|
||||
#define SCALERHEIGHT 3
|
||||
#include "render_templates_hq3x.h"
|
||||
#define SCALERFUNC conc2d(Hq3x,SBPP)(line0, line1, line2, fc)
|
||||
#include "render_loops.h"
|
||||
#undef SCALERNAME
|
||||
#undef SCALERWIDTH
|
||||
#undef SCALERHEIGHT
|
||||
#undef SCALERFUNC
|
||||
|
||||
#include "render_templates_sai.h"
|
||||
|
||||
#define SCALERNAME Super2xSaI
|
||||
#define SCALERWIDTH 2
|
||||
#define SCALERHEIGHT 2
|
||||
#define SCALERFUNC conc2d(Super2xSaI,SBPP)(line0, line1, fc)
|
||||
#include "render_loops.h"
|
||||
#undef SCALERNAME
|
||||
#undef SCALERWIDTH
|
||||
#undef SCALERHEIGHT
|
||||
#undef SCALERFUNC
|
||||
|
||||
#define SCALERNAME SuperEagle
|
||||
#define SCALERWIDTH 2
|
||||
#define SCALERHEIGHT 2
|
||||
#define SCALERFUNC conc2d(SuperEagle,SBPP)(line0, line1, fc)
|
||||
#include "render_loops.h"
|
||||
#undef SCALERNAME
|
||||
#undef SCALERWIDTH
|
||||
#undef SCALERHEIGHT
|
||||
#undef SCALERFUNC
|
||||
|
||||
#define SCALERNAME _2xSaI
|
||||
#define SCALERWIDTH 2
|
||||
#define SCALERHEIGHT 2
|
||||
#define SCALERFUNC conc2d(_2xSaI,SBPP)(line0, line1, fc)
|
||||
#include "render_loops.h"
|
||||
#undef SCALERNAME
|
||||
#undef SCALERWIDTH
|
||||
#undef SCALERHEIGHT
|
||||
#undef SCALERFUNC
|
||||
|
||||
#define SCALERNAME AdvInterp2x
|
||||
#define SCALERWIDTH 2
|
||||
#define SCALERHEIGHT 2
|
||||
|
@ -458,5 +552,10 @@ static void conc3d(Cache,SBPP,DBPP) (const void * s) {
|
|||
#undef greenMask
|
||||
#undef blueMask
|
||||
#undef redblueMask
|
||||
#undef redBits
|
||||
#undef greenBits
|
||||
#undef blueBits
|
||||
#undef redShift
|
||||
#undef greenShift
|
||||
#undef blueShift
|
||||
#undef SRCTYPE
|
||||
|
||||
|
|
85
src/gui/render_templates_hq.h
Normal file
85
src/gui/render_templates_hq.h
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2006 The DOSBox 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The HQ3x high quality 3x graphics filter.
|
||||
* Original author Maxim Stepin (see http://www.hiend3d.com/hq3x.html).
|
||||
* Adapted for DOSBox from ScummVM and HiEnd3D code by Kronuz.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef RENDER_TEMPLATES_HQNX_TABLE_H
|
||||
#define RENDER_TEMPLATES_HQNX_TABLE_H
|
||||
|
||||
static Bit32u *_RGBtoYUV = 0;
|
||||
static inline bool diffYUV(Bit32u yuv1, Bit32u yuv2)
|
||||
{
|
||||
static const Bit32u Ymask = 0x00FF0000;
|
||||
static const Bit32u Umask = 0x0000FF00;
|
||||
static const Bit32u Vmask = 0x000000FF;
|
||||
static const Bit32u trY = 0x00300000;
|
||||
static const Bit32u trU = 0x00000700;
|
||||
static const Bit32u trV = 0x00000006;
|
||||
|
||||
Bit32u diff;
|
||||
Bit32u mask;
|
||||
|
||||
diff = ((yuv1 & Ymask) - (yuv2 & Ymask));
|
||||
mask = diff >> 31; // -1 if value < 0, 0 otherwise
|
||||
diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value
|
||||
if (diff > trY) return true;
|
||||
|
||||
diff = ((yuv1 & Umask) - (yuv2 & Umask));
|
||||
mask = diff >> 31; // -1 if value < 0, 0 otherwise
|
||||
diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value
|
||||
if (diff > trU) return true;
|
||||
|
||||
diff = ((yuv1 & Vmask) - (yuv2 & Vmask));
|
||||
mask = diff >> 31; // -1 if value < 0, 0 otherwise
|
||||
diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value
|
||||
if (diff > trV) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline void conc2d(InitLUTs,SBPP)(void)
|
||||
{
|
||||
int r, g, b;
|
||||
int Y, u, v;
|
||||
|
||||
_RGBtoYUV = (Bit32u *)malloc(65536 * sizeof(Bit32u));
|
||||
|
||||
for (int color = 0; color < 65536; ++color) {
|
||||
#if SBPP == 32
|
||||
r = ((color & 0xF800) >> 11) << (8 - 5);
|
||||
g = ((color & 0x07E0) >> 5) << (8 - 6);
|
||||
b = ((color & 0x001F) >> 0) << (8 - 5);
|
||||
#else
|
||||
r = ((color & redMask) >> redShift) << (8 - redBits);
|
||||
g = ((color & greenMask) >> greenShift) << (8 - greenBits);
|
||||
b = ((color & blueMask) >> blueShift) << (8 - blueBits);
|
||||
#endif
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((-r + 2 * g - b) >> 3);
|
||||
_RGBtoYUV[color] = (Y << 16) | (u << 8) | v;
|
||||
}
|
||||
}
|
1896
src/gui/render_templates_hq2x.h
Normal file
1896
src/gui/render_templates_hq2x.h
Normal file
File diff suppressed because it is too large
Load diff
2872
src/gui/render_templates_hq3x.h
Normal file
2872
src/gui/render_templates_hq3x.h
Normal file
File diff suppressed because it is too large
Load diff
229
src/gui/render_templates_sai.h
Normal file
229
src/gui/render_templates_sai.h
Normal file
|
@ -0,0 +1,229 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2006 The DOSBox 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
static inline int conc2d(GetResult,SBPP)(PTYPE A, PTYPE B, PTYPE C, PTYPE D) {
|
||||
const bool ac = (A==C);
|
||||
const bool bc = (B==C);
|
||||
const int x1 = ac;
|
||||
const int y1 = (bc & !ac);
|
||||
const bool ad = (A==D);
|
||||
const bool bd = (B==D);
|
||||
const int x2 = ad;
|
||||
const int y2 = (bd & !ad);
|
||||
const int x = x1+x2;
|
||||
const int y = y1+y2;
|
||||
static const int rmap[3][3] = {
|
||||
{0, 0, -1},
|
||||
{0, 0, -1},
|
||||
{1, 1, 0}
|
||||
};
|
||||
return rmap[y][x];
|
||||
}
|
||||
|
||||
inline void conc2d(Super2xSaI,SBPP)(PTYPE * line0, PTYPE * line1, const PTYPE * fc)
|
||||
{
|
||||
//--------------------------------------
|
||||
if (C7 == C5 && C4 != C8) {
|
||||
line1[1] = line0[1] = C7;
|
||||
} else if (C4 == C8 && C7 != C5) {
|
||||
line1[1] = line0[1] = C4;
|
||||
} else if (C4 == C8 && C7 == C5) {
|
||||
register int r = 0;
|
||||
r += conc2d(GetResult,SBPP)(C5,C4,C6,D1);
|
||||
r += conc2d(GetResult,SBPP)(C5,C4,C3,C1);
|
||||
r += conc2d(GetResult,SBPP)(C5,C4,D2,D5);
|
||||
r += conc2d(GetResult,SBPP)(C5,C4,C2,D4);
|
||||
|
||||
if (r > 0)
|
||||
line1[1] = line0[1] = C5;
|
||||
else if (r < 0)
|
||||
line1[1] = line0[1] = C4;
|
||||
else {
|
||||
line1[1] = line0[1] = interp_w2(C4,C5,1U,1U);
|
||||
}
|
||||
} else {
|
||||
if (C5 == C8 && C8 == D1 && C7 != D2 && C8 != D0)
|
||||
line1[1] = interp_w2(C8,C7,3U,1U);
|
||||
else if (C4 == C7 && C7 == D2 && D1 != C8 && C7 != D6)
|
||||
line1[1] = interp_w2(C7,C8,3U,1U);
|
||||
else
|
||||
line1[1] = interp_w2(C7,C8,1U,1U);
|
||||
|
||||
if (C5 == C8 && C5 == C1 && C4 != C2 && C5 != C0)
|
||||
line0[1] = interp_w2(C5,C4,3U,1U);
|
||||
else if (C4 == C7 && C4 == C2 && C1 != C5 && C4 != D3)
|
||||
line0[1] = interp_w2(C4,C5,3U,1U);
|
||||
else
|
||||
line0[1] = interp_w2(C4,C5,1U,1U);
|
||||
}
|
||||
|
||||
if (C4 == C8 && C7 != C5 && C3 == C4 && C4 != D2)
|
||||
line1[0] = interp_w2(C7,C4,1U,1U);
|
||||
else if (C4 == C6 && C5 == C4 && C3 != C7 && C4 != D0)
|
||||
line1[0] = interp_w2(C7,C4,1U,1U);
|
||||
else
|
||||
line1[0] = C7;
|
||||
|
||||
if (C7 == C5 && C4 != C8 && C6 == C7 && C7 != C2)
|
||||
line0[0] = interp_w2(C7,C4,1U,1U);
|
||||
else if (C3 == C7 && C8 == C7 && C6 != C4 && C7 != C0)
|
||||
line0[0] = interp_w2(C7,C4,1U,1U);
|
||||
else
|
||||
line0[0] = C4;
|
||||
}
|
||||
|
||||
inline void conc2d(SuperEagle,SBPP)(PTYPE * line0, PTYPE * line1, const PTYPE * fc)
|
||||
{
|
||||
// --------------------------------------
|
||||
if (C4 != C8) {
|
||||
if (C7 == C5) {
|
||||
line0[1] = line1[0] = C7;
|
||||
if ((C6 == C7) || (C5 == C2)) {
|
||||
line0[0] = interp_w2(C7,C4,3U,1U);
|
||||
} else {
|
||||
line0[0] = interp_w2(C4,C5,1U,1U);
|
||||
}
|
||||
|
||||
if ((C5 == D4) || (C7 == D1)) {
|
||||
line1[1] = interp_w2(C7,C8,3U,1U);
|
||||
} else {
|
||||
line1[1] = interp_w2(C7,C8,1U,1U);
|
||||
}
|
||||
} else {
|
||||
line1[1] = interp_w3(C8,C7,C5,6U,1U,1U);
|
||||
line0[0] = interp_w3(C4,C7,C5,6U,1U,1U);
|
||||
|
||||
line1[0] = interp_w3(C7,C4,C8,6U,1U,1U);
|
||||
line0[1] = interp_w3(C5,C4,C8,6U,1U,1U);
|
||||
}
|
||||
} else {
|
||||
if (C7 != C5) {
|
||||
line1[1] = line0[0] = C4;
|
||||
|
||||
if ((C1 == C4) || (C8 == D5)) {
|
||||
line0[1] = interp_w2(C4,C5,3U,1U);
|
||||
} else {
|
||||
line0[1] = interp_w2(C4,C5,1U,1U);
|
||||
}
|
||||
|
||||
if ((C8 == D2) || (C3 == C4)) {
|
||||
line1[0] = interp_w2(C4,C7,3U,1U);
|
||||
} else {
|
||||
line1[0] = interp_w2(C7,C8,1U,1U);
|
||||
}
|
||||
} else {
|
||||
register int r = 0;
|
||||
r += conc2d(GetResult,SBPP)(C5,C4,C6,D1);
|
||||
r += conc2d(GetResult,SBPP)(C5,C4,C3,C1);
|
||||
r += conc2d(GetResult,SBPP)(C5,C4,D2,D5);
|
||||
r += conc2d(GetResult,SBPP)(C5,C4,C2,D4);
|
||||
|
||||
if (r > 0) {
|
||||
line0[1] = line1[0] = C7;
|
||||
line0[0] = line1[1] = interp_w2(C4,C5,1U,1U);
|
||||
} else if (r < 0) {
|
||||
line1[1] = line0[0] = C4;
|
||||
line0[1] = line1[0] = interp_w2(C4,C5,1U,1U);
|
||||
} else {
|
||||
line1[1] = line0[0] = C4;
|
||||
line0[1] = line1[0] = C7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void conc2d(_2xSaI,SBPP)(PTYPE * line0, PTYPE * line1, const PTYPE * fc)
|
||||
{
|
||||
if ((C4 == C8) && (C5 != C7)) {
|
||||
if (((C4 == C1) && (C5 == D5)) ||
|
||||
((C4 == C7) && (C4 == C2) && (C5 != C1) && (C5 == D3))) {
|
||||
line0[1] = C4;
|
||||
} else {
|
||||
line0[1] = interp_w2(C4,C5,1U,1U);
|
||||
}
|
||||
|
||||
if (((C4 == C3) && (C7 == D2)) ||
|
||||
((C4 == C5) && (C4 == C6) && (C3 != C7) && (C7 == D0))) {
|
||||
line1[0] = C4;
|
||||
} else {
|
||||
line1[0] = interp_w2(C4,C7,1U,1U);
|
||||
}
|
||||
line1[1] = C4;
|
||||
} else if ((C5 == C7) && (C4 != C8)) {
|
||||
if (((C5 == C2) && (C4 == C6)) ||
|
||||
((C5 == C1) && (C5 == C8) && (C4 != C2) && (C4 == C0))) {
|
||||
line0[1] = C5;
|
||||
} else {
|
||||
line0[1] = interp_w2(C4,C5,1U,1U);
|
||||
}
|
||||
|
||||
if (((C7 == C6) && (C4 == C2)) ||
|
||||
((C7 == C3) && (C7 == C8) && (C4 != C6) && (C4 == C0))) {
|
||||
line1[0] = C7;
|
||||
} else {
|
||||
line1[0] = interp_w2(C4,C7,1U,1U);
|
||||
}
|
||||
line1[1] = C5;
|
||||
} else if ((C4 == C8) && (C5 == C7)) {
|
||||
if (C4 == C5) {
|
||||
line0[1] = C4;
|
||||
line1[0] = C4;
|
||||
line1[1] = C4;
|
||||
} else {
|
||||
register int r = 0;
|
||||
r += conc2d(GetResult,SBPP)(C4,C5,C3,C1);
|
||||
r -= conc2d(GetResult,SBPP)(C5,C4,D4,C2);
|
||||
r -= conc2d(GetResult,SBPP)(C5,C4,C6,D1);
|
||||
r += conc2d(GetResult,SBPP)(C4,C5,D5,D2);
|
||||
|
||||
if (r > 0)
|
||||
line1[1] = C4;
|
||||
else if (r < 0)
|
||||
line1[1] = C5;
|
||||
else {
|
||||
line1[1] = interp_w4(C4,C5,C7,C8,1U,1U,1U,1U);
|
||||
}
|
||||
|
||||
line1[0] = interp_w2(C4,C7,1U,1U);
|
||||
line0[1] = interp_w2(C4,C5,1U,1U);
|
||||
}
|
||||
} else {
|
||||
line1[1] = interp_w4(C4,C5,C7,C8,1U,1U,1U,1U);
|
||||
|
||||
if ((C4 == C7) && (C4 == C2)
|
||||
&& (C5 != C1) && (C5 == D3)) {
|
||||
line0[1] = C4;
|
||||
} else if ((C5 == C1) && (C5 == C8)
|
||||
&& (C4 != C2) && (C4 == C0)) {
|
||||
line0[1] = C5;
|
||||
} else {
|
||||
line0[1] = interp_w2(C4,C5,1U,1U);
|
||||
}
|
||||
|
||||
if ((C4 == C5) && (C4 == C6)
|
||||
&& (C3 != C7) && (C7 == D0)) {
|
||||
line1[0] = C4;
|
||||
} else if ((C7 == C3) && (C7 == C8)
|
||||
&& (C4 != C6) && (C4 == C0)) {
|
||||
line1[0] = C7;
|
||||
} else {
|
||||
line1[0] = interp_w2(C4,C7,1U,1U);
|
||||
}
|
||||
}
|
||||
line0[0] = C4;
|
||||
}
|
Loading…
Add table
Reference in a new issue