DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
src/gui/render_scalers.h
00001 /*
00002  *  Copyright (C) 2002-2015  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
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef _RENDER_SCALERS_H
00020 #define _RENDER_SCALERS_H
00021 
00022 //#include "render.h"
00023 #include "video.h"
00024 #if RENDER_USE_ADVANCED_SCALERS>0
00025 #define SCALER_MAXWIDTH         1920
00026 #define SCALER_MAXHEIGHT        1200
00027 #else
00028 // reduced to save some memory
00029 #define SCALER_MAXWIDTH         800 
00030 #define SCALER_MAXHEIGHT        600
00031 #endif
00032 
00033 #if RENDER_USE_ADVANCED_SCALERS>1
00034 #define SCALER_COMPLEXWIDTH             800
00035 #define SCALER_COMPLEXHEIGHT    600
00036 #endif
00037 
00038 #define SCALER_BLOCKSIZE        16
00039 
00040 typedef enum {
00041         scalerMode8, scalerMode15, scalerMode16, scalerMode32
00042 } scalerMode_t;
00043 
00044 typedef enum scalerOperation {
00045         scalerOpNormal,
00046 #if RENDER_USE_ADVANCED_SCALERS>2
00047         scalerOpAdvMame,
00048         scalerOpAdvInterp,
00049         scalerOpHQ,
00050         scalerOpSaI,
00051         scalerOpSuperSaI,
00052         scalerOpSuperEagle,
00053 #endif
00054 #if RENDER_USE_ADVANCED_SCALERS>0
00055         scalerOpTV,
00056         scalerOpRGB,
00057         scalerOpScan,
00058 #endif
00059         scalerLast
00060 } scalerOperation_t;
00061 
00062 typedef void (*ScalerLineHandler_t)(const void *src);
00063 typedef void (*ScalerComplexHandler_t)(void);
00064 
00065 extern Bit8u Scaler_Aspect[];
00066 extern Bit8u diff_table[];
00067 extern Bitu Scaler_ChangedLineIndex;
00068 extern Bit16u Scaler_ChangedLines[];
00069 #if RENDER_USE_ADVANCED_SCALERS>1
00070 /* Not entirely happy about those +2's since they make a non power of 2, with muls instead of shift */
00071 typedef Bit8u scalerChangeCache_t [SCALER_COMPLEXHEIGHT][SCALER_COMPLEXWIDTH / SCALER_BLOCKSIZE] ;
00072 typedef union {
00073         Bit32u b32      [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH];
00074         Bit16u b16      [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH];
00075         Bit8u b8        [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH];
00076 } scalerFrameCache_t;
00077 #endif
00078 typedef union {
00079         Bit32u b32      [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH];
00080         Bit16u b16      [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH];
00081         Bit8u b8        [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH];
00082 } scalerSourceCache_t;
00083 extern scalerSourceCache_t scalerSourceCache;
00084 #if RENDER_USE_ADVANCED_SCALERS>1
00085 extern scalerChangeCache_t scalerChangeCache;
00086 #endif
00087 typedef ScalerLineHandler_t ScalerLineBlock_t[5][4];
00088 
00089 typedef struct {
00090         const char *name;
00091         Bitu gfxFlags;
00092         Bitu xscale,yscale;
00093         ScalerComplexHandler_t Linear[4];
00094         ScalerComplexHandler_t Random[4];
00095 } ScalerComplexBlock_t;
00096 
00097 typedef struct {
00098         const char *name;
00099         Bitu gfxFlags;
00100         Bitu xscale,yscale;
00101         ScalerLineBlock_t       Linear;
00102         ScalerLineBlock_t       Random;
00103 } ScalerSimpleBlock_t;
00104 
00105 
00106 #define SCALE_LEFT      0x1
00107 #define SCALE_RIGHT     0x2
00108 #define SCALE_FULL      0x4
00109 
00110 /* Simple scalers */
00111 extern ScalerSimpleBlock_t ScaleNormal1x;
00112 extern ScalerSimpleBlock_t ScaleNormalDw;
00113 extern ScalerSimpleBlock_t ScaleNormalDh;
00114 extern ScalerSimpleBlock_t ScaleNormal2x;
00115 extern ScalerSimpleBlock_t ScaleNormal3x;
00116 extern ScalerSimpleBlock_t ScaleNormal4x;
00117 extern ScalerSimpleBlock_t ScaleNormal5x;
00118 #if RENDER_USE_ADVANCED_SCALERS>0
00119 extern ScalerSimpleBlock_t ScaleTV2x;
00120 extern ScalerSimpleBlock_t ScaleTV3x;
00121 extern ScalerSimpleBlock_t ScaleRGB2x;
00122 extern ScalerSimpleBlock_t ScaleRGB3x;
00123 extern ScalerSimpleBlock_t ScaleScan2x;
00124 extern ScalerSimpleBlock_t ScaleScan3x;
00125 #endif
00126 /* Complex scalers */
00127 #if RENDER_USE_ADVANCED_SCALERS>2
00128 extern ScalerComplexBlock_t ScaleHQ2x;
00129 extern ScalerComplexBlock_t ScaleHQ3x;
00130 extern ScalerComplexBlock_t Scale2xSaI;
00131 extern ScalerComplexBlock_t ScaleSuper2xSaI;
00132 extern ScalerComplexBlock_t ScaleSuperEagle;
00133 extern ScalerComplexBlock_t ScaleAdvMame2x;
00134 extern ScalerComplexBlock_t ScaleAdvMame3x;
00135 extern ScalerComplexBlock_t ScaleAdvInterp2x;
00136 extern ScalerComplexBlock_t ScaleAdvInterp3x;
00137 #endif
00138 #if RENDER_USE_ADVANCED_SCALERS>1
00139 extern ScalerLineBlock_t ScalerCache;
00140 #endif
00141 #endif