Debian Codegraph @

src/gui/render_scalers.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2002-2010 The DOSBox Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #ifndef _RENDER_SCALERS_H
20 #define _RENDER_SCALERS_H
21
22 //#include "render.h"
23 #include "video.h"
24 #if RENDER_USE_ADVANCED_SCALERS>0
25 #define SCALER_MAXWIDTH 1280
26 #define SCALER_MAXHEIGHT 1024
27 #else
28 // reduced to save some memory
29 #define SCALER_MAXWIDTH 800
30 #define SCALER_MAXHEIGHT 600
31 #endif
32
33 #if RENDER_USE_ADVANCED_SCALERS>1
34 #define SCALER_COMPLEXWIDTH 800
35 #define SCALER_COMPLEXHEIGHT 600
36 #endif
37
38 #define SCALER_BLOCKSIZE 16
39
40 typedef enum {
41 scalerMode8, scalerMode15, scalerMode16, scalerMode32
42 } scalerMode_t;
43
44 typedef enum scalerOperation {
45 scalerOpNormal,
46 #if RENDER_USE_ADVANCED_SCALERS>2
47 scalerOpAdvMame,
48 scalerOpAdvInterp,
49 scalerOpHQ,
50 scalerOpSaI,
51 scalerOpSuperSaI,
52 scalerOpSuperEagle,
53 #endif
54 #if RENDER_USE_ADVANCED_SCALERS>0
55 scalerOpTV,
56 scalerOpRGB,
57 scalerOpScan,
58 #endif
59 scalerLast
60 } scalerOperation_t;
61
62 typedef void (*ScalerLineHandler_t)(const void *src);
63 typedef void (*ScalerComplexHandler_t)(void);
64
65 extern Bit8u Scaler_Aspect[];
66 extern Bit8u diff_table[];
67 extern Bitu Scaler_ChangedLineIndex;
68 extern Bit16u Scaler_ChangedLines[];
69 #if RENDER_USE_ADVANCED_SCALERS>1
70 /* Not entirely happy about those +2's since they make a non power of 2, with muls instead of shift */
71 typedef Bit8u scalerChangeCache_t [SCALER_COMPLEXHEIGHT][SCALER_COMPLEXWIDTH / SCALER_BLOCKSIZE] ;
72 typedef union {
73 Bit32u b32 [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH];
74 Bit16u b16 [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH];
75 Bit8u b8 [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH];
76 } scalerFrameCache_t;
77 #endif
78 typedef union {
79 Bit32u b32 [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH];
80 Bit16u b16 [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH];
81 Bit8u b8 [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH];
82 } scalerSourceCache_t;
83 extern scalerSourceCache_t scalerSourceCache;
84 #if RENDER_USE_ADVANCED_SCALERS>1
85 extern scalerChangeCache_t scalerChangeCache;
86 #endif
87 typedef ScalerLineHandler_t ScalerLineBlock_t[5][4];
88
89 typedef struct {
90 const char *name;
91 Bitu gfxFlags;
92 Bitu xscale,yscale;
93 ScalerComplexHandler_t Linear[4];
94 ScalerComplexHandler_t Random[4];
95 } ScalerComplexBlock_t;
96
97 typedef struct {
98 const char *name;
99 Bitu gfxFlags;
100 Bitu xscale,yscale;
101 ScalerLineBlock_t Linear;
102 ScalerLineBlock_t Random;
103 } ScalerSimpleBlock_t;
104
105
106 #define SCALE_LEFT 0x1
107 #define SCALE_RIGHT 0x2
108 #define SCALE_FULL 0x4
109
110 /* Simple scalers */
111 extern ScalerSimpleBlock_t ScaleNormal1x;
112 extern ScalerSimpleBlock_t ScaleNormalDw;
113 extern ScalerSimpleBlock_t ScaleNormalDh;
114 extern ScalerSimpleBlock_t ScaleNormal2x;
115 extern ScalerSimpleBlock_t ScaleNormal3x;
116 #if RENDER_USE_ADVANCED_SCALERS>0
117 extern ScalerSimpleBlock_t ScaleTV2x;
118 extern ScalerSimpleBlock_t ScaleTV3x;
119 extern ScalerSimpleBlock_t ScaleRGB2x;
120 extern ScalerSimpleBlock_t ScaleRGB3x;
121 extern ScalerSimpleBlock_t ScaleScan2x;
122 extern ScalerSimpleBlock_t ScaleScan3x;
123 #endif
124 /* Complex scalers */
125 #if RENDER_USE_ADVANCED_SCALERS>2
126 extern ScalerComplexBlock_t ScaleHQ2x;
127 extern ScalerComplexBlock_t ScaleHQ3x;
128 extern ScalerComplexBlock_t Scale2xSaI;
129 extern ScalerComplexBlock_t ScaleSuper2xSaI;
130 extern ScalerComplexBlock_t ScaleSuperEagle;
131 extern ScalerComplexBlock_t ScaleAdvMame2x;
132 extern ScalerComplexBlock_t ScaleAdvMame3x;
133 extern ScalerComplexBlock_t ScaleAdvInterp2x;
134 extern ScalerComplexBlock_t ScaleAdvInterp3x;
135 #endif
136 #if RENDER_USE_ADVANCED_SCALERS>1
137 extern ScalerLineBlock_t ScalerCache;
138 #endif
139 #endif