DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/gui/render_scalers.cpp
00001 /*
00002  *  Copyright (C) 2002-2020  The DOSBox Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License along
00015  *  with this program; if not, write to the Free Software Foundation, Inc.,
00016  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 
00020 //TODO:
00021 //Maybe just do the cache checking back into the simple scalers so they can 
00022 //just handle it all in one go, but this seems to work well enough for now
00023 
00024 #include "dosbox.h"
00025 #include "render.h"
00026 #include <string.h>
00027 
00028 Bit8u Scaler_Aspect[SCALER_MAXHEIGHT];
00029 Bit16u Scaler_ChangedLines[SCALER_MAXHEIGHT];
00030 Bitu Scaler_ChangedLineIndex;
00031 
00032 static union {
00033         Bit32u b32 [4][SCALER_MAXWIDTH*3];
00034         Bit16u b16 [4][SCALER_MAXWIDTH*3];
00035         Bit8u b8 [4][SCALER_MAXWIDTH*3];
00036 } scalerWriteCache;
00037 //scalerFrameCache_t scalerFrameCache;
00038 scalerSourceCache_t scalerSourceCache;
00039 #if RENDER_USE_ADVANCED_SCALERS>1
00040 scalerChangeCache_t scalerChangeCache;
00041 #endif
00042 
00043 #define _conc2(A,B) A ## B
00044 #define _conc3(A,B,C) A ## B ## C
00045 #define _conc4(A,B,C,D) A ## B ## C ## D
00046 #define _conc5(A,B,C,D,E) A ## B ## C ## D ## E
00047 #define _conc7(A,B,C,D,E,F,G) A ## B ## C ## D ## E ## F ## G
00048 
00049 #define conc2(A,B) _conc2(A,B)
00050 #define conc3(A,B,C) _conc3(A,B,C)
00051 #define conc4(A,B,C,D) _conc4(A,B,C,D)
00052 #define conc2d(A,B) _conc3(A,_,B)
00053 #define conc3d(A,B,C) _conc5(A,_,B,_,C)
00054 #define conc4d(A,B,C,D) _conc7(A,_,B,_,C,_,D)
00055 
00056 static INLINE void BituMove( void *_dst, const void * _src, Bitu size) {
00057         Bitu * dst=(Bitu *)(_dst);
00058         const Bitu * src=(Bitu *)(_src);
00059         size/=sizeof(Bitu);
00060         for (Bitu x=0; x<size;x++)
00061                 dst[x] = src[x];
00062 }
00063 
00064 static INLINE void ScalerAddLines( Bitu changed, Bitu count ) {
00065         if ((Scaler_ChangedLineIndex & 1) == changed ) {
00066                 Scaler_ChangedLines[Scaler_ChangedLineIndex] += (Bit16u)count;
00067         } else {
00068                 Scaler_ChangedLines[++Scaler_ChangedLineIndex] = (Bit16u)count;
00069         }
00070         render.scale.outWrite += render.scale.outPitch * count;
00071 }
00072 
00073 
00074 #define BituMove2(_DST,_SRC,_SIZE)                      \
00075 {                                                                                       \
00076         Bitu bsize=(_SIZE)/sizeof(Bitu);                \
00077         Bitu * bdst=(Bitu *)(_DST);                             \
00078         Bitu * bsrc=(Bitu *)(_SRC);                             \
00079         while (bsize--) *bdst++=*bsrc++;                \
00080 }
00081 
00082 #if !defined(C_SDL2) && defined(MACOSX)
00083 /* SDL1 builds are subject to Mac OS X strange BGRA (alpha in low byte) order.
00084    The code in the #else case happens to work because most OSes put the alpha byte in the upper 32 bits,
00085    while on Mac OS X the blue channel is up there. Integer overflow will trash the blue channel in that
00086    case, without this alternate code. */
00087 #define interp_w2(P0,P1,W0,W1)                                                                                                                  \
00088         ((((uint64_t)(P0&redblueMask)*(uint64_t)W0+(uint64_t)(P1&redblueMask)*(uint64_t)W1)/(uint64_t)(W0+W1)) & redblueMask) | \
00089         ((((uint64_t)(P0&  greenMask)*(uint64_t)W0+(uint64_t)(P1&  greenMask)*(uint64_t)W1)/(uint64_t)(W0+W1)) & greenMask)
00090 #define interp_w3(P0,P1,P2,W0,W1,W2)                                                                                                            \
00091         ((((uint64_t)(P0&redblueMask)*(uint64_t)W0+(uint64_t)(P1&redblueMask)*(uint64_t)W1+(uint64_t)(P2&redblueMask)*(uint64_t)W2)/(uint64_t)(W0+W1+W2)) & redblueMask) |      \
00092         ((((uint64_t)(P0&  greenMask)*(uint64_t)W0+(uint64_t)(P1&  greenMask)*(uint64_t)W1+(uint64_t)(P2&  greenMask)*(uint64_t)W2)/(uint64_t)(W0+W1+W2)) & greenMask)
00093 #define interp_w4(P0,P1,P2,P3,W0,W1,W2,W3)                                                                                                              \
00094         ((((uint64_t)(P0&redblueMask)*(uint64_t)W0+(uint64_t)(P1&redblueMask)*(uint64_t)W1+(uint64_t)(P2&redblueMask)*(uint64_t)W2+(uint64_t)(P3&redblueMask)*(uint64_t)W3)/(uint64_t)(W0+W1+W2+W3)) & redblueMask) |   \
00095         ((((uint64_t)(P0&  greenMask)*(uint64_t)W0+(uint64_t)(P1&  greenMask)*(uint64_t)W1+(uint64_t)(P2&  greenMask)*(uint64_t)W2+(uint64_t)(P3&  greenMask)*(uint64_t)W3)/(uint64_t)(W0+W1+W2+W3)) & greenMask)
00096 #else
00097 #define interp_w2(P0,P1,W0,W1)                                                                                                                  \
00098         ((((P0&redblueMask)*W0+(P1&redblueMask)*W1)/(W0+W1)) & redblueMask) |   \
00099         ((((P0&  greenMask)*W0+(P1&  greenMask)*W1)/(W0+W1)) & greenMask)
00100 #define interp_w3(P0,P1,P2,W0,W1,W2)                                                                                                            \
00101         ((((P0&redblueMask)*W0+(P1&redblueMask)*W1+(P2&redblueMask)*W2)/(W0+W1+W2)) & redblueMask) |    \
00102         ((((P0&  greenMask)*W0+(P1&  greenMask)*W1+(P2&  greenMask)*W2)/(W0+W1+W2)) & greenMask)
00103 #define interp_w4(P0,P1,P2,P3,W0,W1,W2,W3)                                                                                                              \
00104         ((((P0&redblueMask)*W0+(P1&redblueMask)*W1+(P2&redblueMask)*W2+(P3&redblueMask)*W3)/(W0+W1+W2+W3)) & redblueMask) |     \
00105         ((((P0&  greenMask)*W0+(P1&  greenMask)*W1+(P2&  greenMask)*W2+(P3&  greenMask)*W3)/(W0+W1+W2+W3)) & greenMask)
00106 #endif
00107 
00108 #define CC scalerChangeCache
00109 
00110 /* Include the different rendering routines */
00111 #define SBPP 8
00112 #define DBPP 8
00113 #include "render_templates.h"
00114 #undef DBPP
00115 #define DBPP 15
00116 #include "render_templates.h"
00117 #undef DBPP
00118 #define DBPP 16
00119 #include "render_templates.h"
00120 #undef DBPP
00121 #define DBPP 32
00122 #include "render_templates.h"
00123 #undef SBPP
00124 #undef DBPP
00125 
00126 /* SBPP 9 is a special case with palette check support */
00127 #define SBPP 9
00128 #define DBPP 8
00129 #include "render_templates.h"
00130 #undef DBPP
00131 #define DBPP 15
00132 #include "render_templates.h"
00133 #undef DBPP
00134 #define DBPP 16
00135 #include "render_templates.h"
00136 #undef DBPP
00137 #define DBPP 32
00138 #include "render_templates.h"
00139 #undef SBPP
00140 #undef DBPP
00141 
00142 #define SBPP 15
00143 #define DBPP 15
00144 #include "render_templates.h"
00145 #undef DBPP
00146 #define DBPP 16
00147 #include "render_templates.h"
00148 #undef DBPP
00149 #define DBPP 32
00150 #include "render_templates.h"
00151 #undef SBPP
00152 #undef DBPP
00153 
00154 #define SBPP 16
00155 #define DBPP 15
00156 #include "render_templates.h"
00157 #undef DBPP
00158 #define DBPP 16
00159 #include "render_templates.h"
00160 #undef DBPP
00161 #define DBPP 32
00162 #include "render_templates.h"
00163 #undef SBPP
00164 #undef DBPP
00165 
00166 #define SBPP 32
00167 #define DBPP 15
00168 #include "render_templates.h"
00169 #undef DBPP
00170 #define DBPP 16
00171 #include "render_templates.h"
00172 #undef DBPP
00173 #define DBPP 32
00174 #include "render_templates.h"
00175 #undef SBPP
00176 #undef DBPP
00177 
00178 
00179 #if RENDER_USE_ADVANCED_SCALERS>1
00180 ScalerLineBlock_t ScalerCache = {
00181 {       Cache_8_8,      Cache_8_15 ,    Cache_8_16 ,    Cache_8_32 },
00182 {               0,      Cache_15_15,    Cache_15_16,    Cache_15_32},
00183 {               0,      Cache_16_15,    Cache_16_16,    Cache_16_32},
00184 {               0,      Cache_32_15,    Cache_32_16,    Cache_32_32},
00185 {       Cache_8_8,      Cache_9_15 ,    Cache_9_16 ,    Cache_9_32 }
00186 };
00187 #endif
00188 
00189 ScalerSimpleBlock_t ScaleNormal1x = {
00190         "Normal",
00191         GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00192         1,1,{
00193 {       Normal1x_8_8_L,         Normal1x_8_15_L ,       Normal1x_8_16_L ,       Normal1x_8_32_L },
00194 {                    0,         Normal1x_15_15_L,       Normal1x_15_16_L,       Normal1x_15_32_L},
00195 {                    0,         Normal1x_16_15_L,       Normal1x_16_16_L,       Normal1x_16_32_L},
00196 {                    0,         Normal1x_32_15_L,       Normal1x_32_16_L,       Normal1x_32_32_L},
00197 {       Normal1x_8_8_L,         Normal1x_9_15_L ,       Normal1x_9_16_L ,       Normal1x_9_32_L }
00198 },{
00199 {       Normal1x_8_8_R,         Normal1x_8_15_R ,       Normal1x_8_16_R ,       Normal1x_8_32_R },
00200 {                    0,         Normal1x_15_15_R,       Normal1x_15_16_R,       Normal1x_15_32_R},
00201 {                    0,         Normal1x_16_15_R,       Normal1x_16_16_R,       Normal1x_16_32_R},
00202 {                    0,         Normal1x_32_15_R,       Normal1x_32_16_R,       Normal1x_32_32_R},
00203 {       Normal1x_8_8_R,         Normal1x_9_15_R ,       Normal1x_9_16_R ,       Normal1x_9_32_R }
00204 }};
00205 
00206 ScalerSimpleBlock_t ScaleNormalDw = {
00207         "Normal",
00208         GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00209         2,1,{
00210 {       NormalDw_8_8_L,         NormalDw_8_15_L ,       NormalDw_8_16_L ,       NormalDw_8_32_L },
00211 {                    0,         NormalDw_15_15_L,       NormalDw_15_16_L,       NormalDw_15_32_L},
00212 {                    0,         NormalDw_16_15_L,       NormalDw_16_16_L,       NormalDw_16_32_L},
00213 {                    0,         NormalDw_32_15_L,       NormalDw_32_16_L,       NormalDw_32_32_L},
00214 {       NormalDw_8_8_L,         NormalDw_9_15_L ,       NormalDw_9_16_L ,       NormalDw_9_32_L }
00215 },{
00216 {       NormalDw_8_8_R,         NormalDw_8_15_R ,       NormalDw_8_16_R ,       NormalDw_8_32_R },
00217 {                    0,         NormalDw_15_15_R,       NormalDw_15_16_R,       NormalDw_15_32_R},
00218 {                    0,         NormalDw_16_15_R,       NormalDw_16_16_R,       NormalDw_16_32_R},
00219 {                    0,         NormalDw_32_15_R,       NormalDw_32_16_R,       NormalDw_32_32_R},
00220 {       NormalDw_8_8_R,         NormalDw_9_15_R ,       NormalDw_9_16_R ,       NormalDw_9_32_R }
00221 }};
00222 
00223 ScalerSimpleBlock_t ScaleNormalDh = {
00224         "Normal",
00225         GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00226         1,2,{
00227 {       NormalDh_8_8_L,         NormalDh_8_15_L ,       NormalDh_8_16_L ,       NormalDh_8_32_L },
00228 {                    0,         NormalDh_15_15_L,       NormalDh_15_16_L,       NormalDh_15_32_L},
00229 {                    0,         NormalDh_16_15_L,       NormalDh_16_16_L,       NormalDh_16_32_L},
00230 {                    0,         NormalDh_32_15_L,       NormalDh_32_16_L,       NormalDh_32_32_L},
00231 {       NormalDh_8_8_L,         NormalDh_9_15_L ,       NormalDh_9_16_L ,       NormalDh_9_32_L }
00232 },{
00233 {       NormalDh_8_8_R,         NormalDh_8_15_R ,       NormalDh_8_16_R ,       NormalDh_8_32_R },
00234 {                    0,         NormalDh_15_15_R,       NormalDh_15_16_R,       NormalDh_15_32_R},
00235 {                    0,         NormalDh_16_15_R,       NormalDh_16_16_R,       NormalDh_16_32_R},
00236 {                    0,         NormalDh_32_15_R,       NormalDh_32_16_R,       NormalDh_32_32_R},
00237 {       NormalDh_8_8_R,         NormalDh_9_15_R ,       NormalDh_9_16_R ,       NormalDh_9_32_R }
00238 }};
00239 
00240 ScalerSimpleBlock_t ScaleNormal2xDw = {
00241         "Normal2x",
00242         GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00243         4,2,{
00244 {       Normal2xDw_8_8_L,               Normal2xDw_8_15_L ,     Normal2xDw_8_16_L ,     Normal2xDw_8_32_L },
00245 {                      0,               Normal2xDw_15_15_L,     Normal2xDw_15_16_L,     Normal2xDw_15_32_L},
00246 {                      0,               Normal2xDw_16_15_L,     Normal2xDw_16_16_L,     Normal2xDw_16_32_L},
00247 {                      0,               Normal2xDw_32_15_L,     Normal2xDw_32_16_L,     Normal2xDw_32_32_L},
00248 {       Normal2xDw_8_8_L,               Normal2xDw_9_15_L ,     Normal2xDw_9_16_L ,     Normal2xDw_9_32_L }
00249 },{
00250 {       Normal2xDw_8_8_R,               Normal2xDw_8_15_R ,     Normal2xDw_8_16_R ,     Normal2xDw_8_32_R },
00251 {                      0,               Normal2xDw_15_15_R,     Normal2xDw_15_16_R,     Normal2xDw_15_32_R},
00252 {                      0,               Normal2xDw_16_15_R,     Normal2xDw_16_16_R,     Normal2xDw_16_32_R},
00253 {                      0,               Normal2xDw_32_15_R,     Normal2xDw_32_16_R,     Normal2xDw_32_32_R},
00254 {       Normal2xDw_8_8_R,               Normal2xDw_9_15_R ,     Normal2xDw_9_16_R ,     Normal2xDw_9_32_R }
00255 }};
00256 
00257 ScalerSimpleBlock_t ScaleNormal2xDh = {
00258         "Normal2x",
00259         GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00260         2,4,{
00261 {       Normal2xDh_8_8_L,               Normal2xDh_8_15_L ,     Normal2xDh_8_16_L ,     Normal2xDh_8_32_L },
00262 {                      0,               Normal2xDh_15_15_L,     Normal2xDh_15_16_L,     Normal2xDh_15_32_L},
00263 {                      0,               Normal2xDh_16_15_L,     Normal2xDh_16_16_L,     Normal2xDh_16_32_L},
00264 {                      0,               Normal2xDh_32_15_L,     Normal2xDh_32_16_L,     Normal2xDh_32_32_L},
00265 {       Normal2xDh_8_8_L,               Normal2xDh_9_15_L ,     Normal2xDh_9_16_L ,     Normal2xDh_9_32_L }
00266 },{
00267 {       Normal2xDh_8_8_R,               Normal2xDh_8_15_R ,     Normal2xDh_8_16_R ,     Normal2xDh_8_32_R },
00268 {                      0,               Normal2xDh_15_15_R,     Normal2xDh_15_16_R,     Normal2xDh_15_32_R},
00269 {                      0,               Normal2xDh_16_15_R,     Normal2xDh_16_16_R,     Normal2xDh_16_32_R},
00270 {                      0,               Normal2xDh_32_15_R,     Normal2xDh_32_16_R,     Normal2xDh_32_32_R},
00271 {       Normal2xDh_8_8_R,               Normal2xDh_9_15_R ,     Normal2xDh_9_16_R ,     Normal2xDh_9_32_R }
00272 }};
00273 
00274 ScalerSimpleBlock_t ScaleNormal2x = {
00275         "Normal2x",
00276         GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00277         2,2,{
00278 {       Normal2x_8_8_L,         Normal2x_8_15_L,        Normal2x_8_16_L,        Normal2x_8_32_L },
00279 {                    0,         Normal2x_15_15_L,       Normal2x_15_16_L,       Normal2x_15_32_L},
00280 {                    0,         Normal2x_16_15_L,       Normal2x_16_16_L,       Normal2x_16_32_L},
00281 {                    0,         Normal2x_32_15_L,       Normal2x_32_16_L,       Normal2x_32_32_L},
00282 {       Normal2x_8_8_L,         Normal2x_9_15_L ,       Normal2x_9_16_L,        Normal2x_9_32_L }
00283 },{
00284 {       Normal2x_8_8_R,         Normal2x_8_15_R ,       Normal2x_8_16_R,        Normal2x_8_32_R },
00285 {                    0,         Normal2x_15_15_R,       Normal2x_15_16_R,       Normal2x_15_32_R},
00286 {                    0,         Normal2x_16_15_R,       Normal2x_16_16_R,       Normal2x_16_32_R},
00287 {                    0,         Normal2x_32_15_R,       Normal2x_32_16_R,       Normal2x_32_32_R},
00288 {       Normal2x_8_8_R,         Normal2x_9_15_R ,       Normal2x_9_16_R,        Normal2x_9_32_R },
00289 }};
00290 
00291 ScalerSimpleBlock_t ScaleNormal3x = {
00292         "Normal3x",
00293         GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00294         3,3,{
00295 {       Normal3x_8_8_L,         Normal3x_8_15_L ,       Normal3x_8_16_L ,       Normal3x_8_32_L },
00296 {                    0,         Normal3x_15_15_L,       Normal3x_15_16_L,       Normal3x_15_32_L},
00297 {                    0,         Normal3x_16_15_L,       Normal3x_16_16_L,       Normal3x_16_32_L},
00298 {                    0,         Normal3x_32_15_L,       Normal3x_32_16_L,       Normal3x_32_32_L},
00299 {       Normal3x_8_8_L,         Normal3x_9_15_L ,       Normal3x_9_16_L ,       Normal3x_9_32_L }
00300 },{
00301 {       Normal3x_8_8_R,         Normal3x_8_15_R ,       Normal3x_8_16_R ,       Normal3x_8_32_R },
00302 {                    0,         Normal3x_15_15_R,       Normal3x_15_16_R,       Normal3x_15_32_R},
00303 {                    0,         Normal3x_16_15_R,       Normal3x_16_16_R,       Normal3x_16_32_R},
00304 {                    0,         Normal3x_32_15_R,       Normal3x_32_16_R,       Normal3x_32_32_R},
00305 {       Normal3x_8_8_R,         Normal3x_9_15_R ,       Normal3x_9_16_R ,       Normal3x_9_32_R }
00306 }};
00307 
00308 ScalerSimpleBlock_t ScaleNormal4x = {
00309     "Normal4x",
00310     GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00311     4,4,{
00312 {    Normal4x_8_8_L,        Normal4x_8_15_L ,    Normal4x_8_16_L ,    Normal4x_8_32_L },
00313 {                 0,        Normal4x_15_15_L,    Normal4x_15_16_L,    Normal4x_15_32_L},
00314 {                 0,        Normal4x_16_15_L,    Normal4x_16_16_L,    Normal4x_16_32_L},
00315 {                 0,        Normal4x_32_15_L,    Normal4x_32_16_L,    Normal4x_32_32_L},
00316 {    Normal4x_8_8_L,        Normal4x_9_15_L ,    Normal4x_9_16_L ,    Normal4x_9_32_L }
00317 },{
00318 {    Normal4x_8_8_R,        Normal4x_8_15_R ,    Normal4x_8_16_R ,    Normal4x_8_32_R },
00319 {                 0,        Normal4x_15_15_R,    Normal4x_15_16_R,    Normal4x_15_32_R},
00320 {                 0,        Normal4x_16_15_R,    Normal4x_16_16_R,    Normal4x_16_32_R},
00321 {                 0,        Normal4x_32_15_R,    Normal4x_32_16_R,    Normal4x_32_32_R},
00322 {    Normal4x_8_8_R,        Normal4x_9_15_R ,    Normal4x_9_16_R ,    Normal4x_9_32_R }
00323 }};
00324 
00325 ScalerSimpleBlock_t ScaleNormal5x = {
00326     "Normal5x",
00327     GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00328     5,5,{
00329 {    Normal5x_8_8_L,        Normal5x_8_15_L ,    Normal5x_8_16_L ,    Normal5x_8_32_L },
00330 {                 0,        Normal5x_15_15_L,    Normal5x_15_16_L,    Normal5x_15_32_L},
00331 {                 0,        Normal5x_16_15_L,    Normal5x_16_16_L,    Normal5x_16_32_L},
00332 {                 0,        Normal5x_32_15_L,    Normal5x_32_16_L,    Normal5x_32_32_L},
00333 {    Normal5x_8_8_L,        Normal5x_9_15_L ,    Normal5x_9_16_L ,    Normal5x_9_32_L }
00334 },{
00335 {    Normal5x_8_8_R,        Normal5x_8_15_R ,    Normal5x_8_16_R ,    Normal5x_8_32_R },
00336 {                 0,        Normal5x_15_15_R,    Normal5x_15_16_R,    Normal5x_15_32_R},
00337 {                 0,        Normal5x_16_15_R,    Normal5x_16_16_R,    Normal5x_16_32_R},
00338 {                 0,        Normal5x_32_15_R,    Normal5x_32_16_R,    Normal5x_32_32_R},
00339 {    Normal5x_8_8_R,        Normal5x_9_15_R ,    Normal5x_9_16_R ,    Normal5x_9_32_R }
00340 }};
00341 
00342 /*ScalerSimpleBlock_t ScaleNormal6x = {
00343     "Normal6x",
00344     GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00345     6,6,{
00346 {    Normal6x_8_8_L,        Normal6x_8_15_L ,    Normal6x_8_16_L ,    Normal6x_8_32_L },
00347 {                 0,        Normal6x_15_15_L,    Normal6x_15_16_L,    Normal6x_15_32_L},
00348 {                 0,        Normal6x_16_15_L,    Normal6x_16_16_L,    Normal6x_16_32_L},
00349 {                 0,        Normal6x_32_15_L,    Normal6x_32_16_L,    Normal6x_32_32_L},
00350 {    Normal6x_8_8_L,        Normal6x_9_15_L ,    Normal6x_9_16_L ,    Normal6x_9_32_L }
00351 },{
00352 {    Normal6x_8_8_R,        Normal6x_8_15_R ,    Normal6x_8_16_R ,    Normal6x_8_32_R },
00353 {                 0,        Normal6x_15_15_R,    Normal6x_15_16_R,    Normal6x_15_32_R},
00354 {                 0,        Normal6x_16_15_R,    Normal6x_16_16_R,    Normal6x_16_32_R},
00355 {                 0,        Normal6x_32_15_R,    Normal6x_32_16_R,    Normal6x_32_32_R},
00356 {    Normal6x_8_8_R,        Normal6x_9_15_R ,    Normal6x_9_16_R ,    Normal6x_9_32_R }
00357 }};*/
00358 
00359 #if RENDER_USE_ADVANCED_SCALERS>0
00360 ScalerSimpleBlock_t ScaleTV2x = {
00361         "TV2x",
00362         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00363         2,2,{
00364 {       0,              TV2x_8_15_L ,   TV2x_8_16_L ,   TV2x_8_32_L },
00365 {       0,              TV2x_15_15_L,   TV2x_15_16_L,   TV2x_15_32_L},
00366 {       0,              TV2x_16_15_L,   TV2x_16_16_L,   TV2x_16_32_L},
00367 {       0,              TV2x_32_15_L,   TV2x_32_16_L,   TV2x_32_32_L},
00368 {       0,              TV2x_9_15_L ,   TV2x_9_16_L ,   TV2x_9_32_L }
00369 },{
00370 {       0,              TV2x_8_15_R ,   TV2x_8_16_R ,   TV2x_8_32_R },
00371 {       0,              TV2x_15_15_R,   TV2x_15_16_R,   TV2x_15_32_R},
00372 {       0,              TV2x_16_15_R,   TV2x_16_16_R,   TV2x_16_32_R},
00373 {       0,              TV2x_32_15_R,   TV2x_32_16_R,   TV2x_32_32_R},
00374 {       0,              TV2x_9_15_R ,   TV2x_9_16_R ,   TV2x_9_32_R }
00375 }};
00376 
00377 ScalerSimpleBlock_t ScaleTVDh = {
00378         "TV2x",
00379         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00380         1,2,{
00381 {       0,              TVDh_8_15_L ,   TVDh_8_16_L ,   TVDh_8_32_L },
00382 {       0,              TVDh_15_15_L,   TVDh_15_16_L,   TVDh_15_32_L},
00383 {       0,              TVDh_16_15_L,   TVDh_16_16_L,   TVDh_16_32_L},
00384 {       0,              TVDh_32_15_L,   TVDh_32_16_L,   TVDh_32_32_L},
00385 {       0,              TVDh_9_15_L ,   TVDh_9_16_L ,   TVDh_9_32_L }
00386 },{
00387 {       0,              TVDh_8_15_R ,   TVDh_8_16_R ,   TVDh_8_32_R },
00388 {       0,              TVDh_15_15_R,   TVDh_15_16_R,   TVDh_15_32_R},
00389 {       0,              TVDh_16_15_R,   TVDh_16_16_R,   TVDh_16_32_R},
00390 {       0,              TVDh_32_15_R,   TVDh_32_16_R,   TVDh_32_32_R},
00391 {       0,              TVDh_9_15_R ,   TVDh_9_16_R ,   TVDh_9_32_R }
00392 }};
00393 
00394 ScalerSimpleBlock_t ScaleTV3x = {
00395         "TV3x",
00396         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00397         3,3,{
00398 {       0,              TV3x_8_15_L ,   TV3x_8_16_L ,   TV3x_8_32_L },
00399 {       0,              TV3x_15_15_L,   TV3x_15_16_L,   TV3x_15_32_L},
00400 {       0,              TV3x_16_15_L,   TV3x_16_16_L,   TV3x_16_32_L},
00401 {       0,              TV3x_32_15_L,   TV3x_32_16_L,   TV3x_32_32_L},
00402 {       0,              TV3x_9_15_L ,   TV3x_9_16_L ,   TV3x_9_32_L }
00403 },{
00404 {       0,              TV3x_8_15_R ,   TV3x_8_16_R ,   TV3x_8_32_R },
00405 {       0,              TV3x_15_15_R,   TV3x_15_16_R,   TV3x_15_32_R},
00406 {       0,              TV3x_16_15_R,   TV3x_16_16_R,   TV3x_16_32_R},
00407 {       0,              TV3x_32_15_R,   TV3x_32_16_R,   TV3x_32_32_R},
00408 {       0,              TV3x_9_15_R ,   TV3x_9_16_R ,   TV3x_9_32_R }
00409 }};
00410 
00411 ScalerSimpleBlock_t ScaleScan2x = {
00412         "Scan2x",
00413         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00414         2,2,{
00415 {       0,              Scan2x_8_15_L , Scan2x_8_16_L , Scan2x_8_32_L },
00416 {       0,              Scan2x_15_15_L, Scan2x_15_16_L, Scan2x_15_32_L},
00417 {       0,              Scan2x_16_15_L, Scan2x_16_16_L, Scan2x_16_32_L},
00418 {       0,              Scan2x_32_15_L, Scan2x_32_16_L, Scan2x_32_32_L},
00419 {       0,              Scan2x_9_15_L , Scan2x_9_16_L , Scan2x_9_32_L }
00420 },{
00421 {       0,              Scan2x_8_15_R , Scan2x_8_16_R , Scan2x_8_32_R },
00422 {       0,              Scan2x_15_15_R, Scan2x_15_16_R, Scan2x_15_32_R},
00423 {       0,              Scan2x_16_15_R, Scan2x_16_16_R, Scan2x_16_32_R},
00424 {       0,              Scan2x_32_15_R, Scan2x_32_16_R, Scan2x_32_32_R},
00425 {       0,              Scan2x_9_15_R , Scan2x_9_16_R , Scan2x_9_32_R }
00426 }};
00427 
00428 ScalerSimpleBlock_t ScaleScanDh = {
00429         "Scan2x",
00430         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00431         1,2,{
00432 {       0,              ScanDh_8_15_L , ScanDh_8_16_L , ScanDh_8_32_L },
00433 {       0,              ScanDh_15_15_L, ScanDh_15_16_L, ScanDh_15_32_L},
00434 {       0,              ScanDh_16_15_L, ScanDh_16_16_L, ScanDh_16_32_L},
00435 {       0,              ScanDh_32_15_L, ScanDh_32_16_L, ScanDh_32_32_L},
00436 {       0,              ScanDh_9_15_L , ScanDh_9_16_L , ScanDh_9_32_L }
00437 },{
00438 {       0,              ScanDh_8_15_R , ScanDh_8_16_R , ScanDh_8_32_R },
00439 {       0,              ScanDh_15_15_R, ScanDh_15_16_R, ScanDh_15_32_R},
00440 {       0,              ScanDh_16_15_R, ScanDh_16_16_R, ScanDh_16_32_R},
00441 {       0,              ScanDh_32_15_R, ScanDh_32_16_R, ScanDh_32_32_R},
00442 {       0,              ScanDh_9_15_R , ScanDh_9_16_R , ScanDh_9_32_R }
00443 }};
00444 
00445 ScalerSimpleBlock_t ScaleScan3x = {
00446         "Scan3x",
00447         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00448         3,3,{
00449 {       0,              Scan3x_8_15_L , Scan3x_8_16_L , Scan3x_8_32_L },
00450 {       0,              Scan3x_15_15_L, Scan3x_15_16_L, Scan3x_15_32_L},
00451 {       0,              Scan3x_16_15_L, Scan3x_16_16_L, Scan3x_16_32_L},
00452 {       0,              Scan3x_32_15_L, Scan3x_32_16_L, Scan3x_32_32_L},
00453 {       0,              Scan3x_9_15_L , Scan3x_9_16_L , Scan3x_9_32_L },
00454 },{
00455 {       0,              Scan3x_8_15_R , Scan3x_8_16_R , Scan3x_8_32_R },
00456 {       0,              Scan3x_15_15_R, Scan3x_15_16_R, Scan3x_15_32_R},
00457 {       0,              Scan3x_16_15_R, Scan3x_16_16_R, Scan3x_16_32_R},
00458 {       0,              Scan3x_32_15_R, Scan3x_32_16_R, Scan3x_32_32_R},
00459 {       0,              Scan3x_9_15_R , Scan3x_9_16_R , Scan3x_9_32_R }
00460 }};
00461 
00462 ScalerSimpleBlock_t ScaleRGB2x = {
00463         "RGB2x",
00464         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00465         2,2,{
00466 {       0,              RGB2x_8_15_L ,  RGB2x_8_16_L ,  RGB2x_8_32_L },
00467 {       0,              RGB2x_15_15_L,  RGB2x_15_16_L,  RGB2x_15_32_L},
00468 {       0,              RGB2x_16_15_L,  RGB2x_16_16_L,  RGB2x_16_32_L},
00469 {       0,              RGB2x_32_15_L,  RGB2x_32_16_L,  RGB2x_32_32_L},
00470 {       0,              RGB2x_9_15_L ,  RGB2x_9_16_L ,  RGB2x_9_32_L }
00471 },{
00472 {       0,              RGB2x_8_15_R ,  RGB2x_8_16_R ,  RGB2x_8_32_R },
00473 {       0,              RGB2x_15_15_R,  RGB2x_15_16_R,  RGB2x_15_32_R},
00474 {       0,              RGB2x_16_15_R,  RGB2x_16_16_R,  RGB2x_16_32_R},
00475 {       0,              RGB2x_32_15_R,  RGB2x_32_16_R,  RGB2x_32_32_R},
00476 {       0,              RGB2x_9_15_R ,  RGB2x_9_16_R ,  RGB2x_9_32_R }
00477 }};
00478 
00479 ScalerSimpleBlock_t ScaleRGB3x = {
00480         "RGB3x",
00481         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00482         3,3,{
00483 {       0,              RGB3x_8_15_L ,  RGB3x_8_16_L ,  RGB3x_8_32_L },
00484 {       0,              RGB3x_15_15_L,  RGB3x_15_16_L,  RGB3x_15_32_L},
00485 {       0,              RGB3x_16_15_L,  RGB3x_16_16_L,  RGB3x_16_32_L},
00486 {       0,              RGB3x_32_15_L,  RGB3x_32_16_L,  RGB3x_32_32_L},
00487 {       0,              RGB3x_9_15_L ,  RGB3x_9_16_L ,  RGB3x_9_32_L }
00488 },{
00489 {       0,              RGB3x_8_15_R ,  RGB3x_8_16_R ,  RGB3x_8_32_R },
00490 {       0,              RGB3x_15_15_R,  RGB3x_15_16_R,  RGB3x_15_32_R},
00491 {       0,              RGB3x_16_15_R,  RGB3x_16_16_R,  RGB3x_16_32_R},
00492 {       0,              RGB3x_32_15_R,  RGB3x_32_16_R,  RGB3x_32_32_R},
00493 {       0,              RGB3x_9_15_R ,  RGB3x_9_16_R ,  RGB3x_9_32_R }
00494 }};
00495 
00496 ScalerSimpleBlock_t ScaleGrayNormal = {
00497         "Gray2x",
00498         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00499         1,1,{
00500 {       0,              GrayNormal_8_15_L ,     GrayNormal_8_16_L ,     GrayNormal_8_32_L },
00501 {       0,              GrayNormal_15_15_L,     GrayNormal_15_16_L,     GrayNormal_15_32_L},
00502 {       0,              GrayNormal_16_15_L,     GrayNormal_16_16_L,     GrayNormal_16_32_L},
00503 {       0,              GrayNormal_32_15_L,     GrayNormal_32_16_L,     GrayNormal_32_32_L},
00504 {       0,              GrayNormal_9_15_L ,     GrayNormal_9_16_L ,     GrayNormal_9_32_L }
00505 },{
00506 {       0,              GrayNormal_8_15_R ,     GrayNormal_8_16_R ,     GrayNormal_8_32_R },
00507 {       0,              GrayNormal_15_15_R,     GrayNormal_15_16_R,     GrayNormal_15_32_R},
00508 {       0,              GrayNormal_16_15_R,     GrayNormal_16_16_R,     GrayNormal_16_32_R},
00509 {       0,              GrayNormal_32_15_R,     GrayNormal_32_16_R,     GrayNormal_32_32_R},
00510 {       0,              GrayNormal_9_15_R ,     GrayNormal_9_16_R ,     GrayNormal_9_32_R }
00511 }};
00512 
00513 ScalerSimpleBlock_t ScaleGrayDw = {
00514         "Gray2x",
00515         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00516         2,1,{
00517 {       0,              GrayDw_8_15_L , GrayDw_8_16_L , GrayDw_8_32_L },
00518 {       0,              GrayDw_15_15_L, GrayDw_15_16_L, GrayDw_15_32_L},
00519 {       0,              GrayDw_16_15_L, GrayDw_16_16_L, GrayDw_16_32_L},
00520 {       0,              GrayDw_32_15_L, GrayDw_32_16_L, GrayDw_32_32_L},
00521 {       0,              GrayDw_9_15_L , GrayDw_9_16_L , GrayDw_9_32_L }
00522 },{
00523 {       0,              GrayDw_8_15_R , GrayDw_8_16_R , GrayDw_8_32_R },
00524 {       0,              GrayDw_15_15_R, GrayDw_15_16_R, GrayDw_15_32_R},
00525 {       0,              GrayDw_16_15_R, GrayDw_16_16_R, GrayDw_16_32_R},
00526 {       0,              GrayDw_32_15_R, GrayDw_32_16_R, GrayDw_32_32_R},
00527 {       0,              GrayDw_9_15_R , GrayDw_9_16_R , GrayDw_9_32_R }
00528 }};
00529 
00530 ScalerSimpleBlock_t ScaleGrayDh = {
00531         "Gray2x",
00532         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00533         1,2,{
00534 {       0,              GrayDh_8_15_L , GrayDh_8_16_L , GrayDh_8_32_L },
00535 {       0,              GrayDh_15_15_L, GrayDh_15_16_L, GrayDh_15_32_L},
00536 {       0,              GrayDh_16_15_L, GrayDh_16_16_L, GrayDh_16_32_L},
00537 {       0,              GrayDh_32_15_L, GrayDh_32_16_L, GrayDh_32_32_L},
00538 {       0,              GrayDh_9_15_L , GrayDh_9_16_L , GrayDh_9_32_L }
00539 },{
00540 {       0,              GrayDh_8_15_R , GrayDh_8_16_R , GrayDh_8_32_R },
00541 {       0,              GrayDh_15_15_R, GrayDh_15_16_R, GrayDh_15_32_R},
00542 {       0,              GrayDh_16_15_R, GrayDh_16_16_R, GrayDh_16_32_R},
00543 {       0,              GrayDh_32_15_R, GrayDh_32_16_R, GrayDh_32_32_R},
00544 {       0,              GrayDh_9_15_R , GrayDh_9_16_R , GrayDh_9_32_R }
00545 }};
00546 
00547 ScalerSimpleBlock_t ScaleGray2x = {
00548         "Gray2x",
00549         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00550         2,2,{
00551 {       0,              Gray2x_8_15_L , Gray2x_8_16_L , Gray2x_8_32_L },
00552 {       0,              Gray2x_15_15_L, Gray2x_15_16_L, Gray2x_15_32_L},
00553 {       0,              Gray2x_16_15_L, Gray2x_16_16_L, Gray2x_16_32_L},
00554 {       0,              Gray2x_32_15_L, Gray2x_32_16_L, Gray2x_32_32_L},
00555 {       0,              Gray2x_9_15_L , Gray2x_9_16_L , Gray2x_9_32_L }
00556 },{
00557 {       0,              Gray2x_8_15_R , Gray2x_8_16_R , Gray2x_8_32_R },
00558 {       0,              Gray2x_15_15_R, Gray2x_15_16_R, Gray2x_15_32_R},
00559 {       0,              Gray2x_16_15_R, Gray2x_16_16_R, Gray2x_16_32_R},
00560 {       0,              Gray2x_32_15_R, Gray2x_32_16_R, Gray2x_32_32_R},
00561 {       0,              Gray2x_9_15_R , Gray2x_9_16_R , Gray2x_9_32_R }
00562 }};
00563 #endif
00564 
00565 
00566 /* Complex scalers */
00567 
00568 #if RENDER_USE_ADVANCED_SCALERS>2
00569 ScalerComplexBlock_t ScaleAdvMame2x ={
00570         "AdvMame2x",
00571         GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00572         2,2,
00573 {       AdvMame2x_8_L,AdvMame2x_16_L,AdvMame2x_16_L,AdvMame2x_32_L},
00574 {       AdvMame2x_8_R,AdvMame2x_16_R,AdvMame2x_16_R,AdvMame2x_32_R}
00575 };
00576 
00577 ScalerComplexBlock_t ScaleAdvMame3x = {
00578         "AdvMame3x",
00579         GFX_CAN_8|GFX_CAN_15|GFX_CAN_16|GFX_CAN_32,
00580         3,3,
00581 {       AdvMame3x_8_L,AdvMame3x_16_L,AdvMame3x_16_L,AdvMame3x_32_L},
00582 {       AdvMame3x_8_R,AdvMame3x_16_R,AdvMame3x_16_R,AdvMame3x_32_R}
00583 };
00584 
00585 /* These need specific 15bpp versions */
00586 ScalerComplexBlock_t ScaleHQ2x ={
00587         "HQ2x",
00588         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00589         2,2,
00590 {       0,HQ2x_16_L,HQ2x_16_L,HQ2x_32_L},
00591 {       0,HQ2x_16_R,HQ2x_16_R,HQ2x_32_R}
00592 };
00593 
00594 ScalerComplexBlock_t ScaleHQ3x ={
00595         "HQ3x",
00596         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00597         3,3,
00598 {       0,HQ3x_16_L,HQ3x_16_L,HQ3x_32_L},
00599 {       0,HQ3x_16_R,HQ3x_16_R,HQ3x_32_R}
00600 };
00601 
00602 ScalerComplexBlock_t ScaleSuper2xSaI ={
00603         "Super2xSaI",
00604         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00605         2,2,
00606 {       0,Super2xSaI_16_L,Super2xSaI_16_L,Super2xSaI_32_L},
00607 {       0,Super2xSaI_16_R,Super2xSaI_16_R,Super2xSaI_32_R}
00608 };
00609 
00610 ScalerComplexBlock_t Scale2xSaI ={
00611         "2xSaI",
00612         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00613         2,2,
00614 {       0,_2xSaI_16_L,_2xSaI_16_L,_2xSaI_32_L},
00615 {       0,_2xSaI_16_R,_2xSaI_16_R,_2xSaI_32_R}
00616 };
00617 
00618 ScalerComplexBlock_t ScaleSuperEagle ={
00619         "SuperEagle",
00620         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00621         2,2,
00622 {       0,SuperEagle_16_L,SuperEagle_16_L,SuperEagle_32_L},
00623 {       0,SuperEagle_16_R,SuperEagle_16_R,SuperEagle_32_R}
00624 };
00625 
00626 ScalerComplexBlock_t ScaleAdvInterp2x = {
00627         "AdvInterp2x",
00628         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00629         2,2,
00630 {       0,AdvInterp2x_15_L,AdvInterp2x_16_L,AdvInterp2x_32_L},
00631 {       0,AdvInterp2x_15_R,AdvInterp2x_16_R,AdvInterp2x_32_R}
00632 };
00633 
00634 ScalerComplexBlock_t ScaleAdvInterp3x = {
00635         "AdvInterp3x",
00636         GFX_CAN_15|GFX_CAN_16|GFX_CAN_32|GFX_RGBONLY,
00637         3,3,
00638 {       0,AdvInterp3x_15_L,AdvInterp3x_16_L,AdvInterp3x_32_L},
00639 {       0,AdvInterp3x_15_R,AdvInterp3x_16_R,AdvInterp3x_32_R}
00640 };
00641 
00642 #endif