ALL: Huge upstream synch + PerRom DelaySI & CountPerOp parameters
[mupen64plus-pandora.git] / source / gles2glide64 / src / GlideHQ / TxQuantize.h
1 /*
2  * Texture Filtering
3  * Version:  1.0
4  *
5  * Copyright (C) 2007  Hiroshi Morii   All Rights Reserved.
6  * Email koolsmoky(at)users.sourceforge.net
7  * Web   http://www.3dfxzone.it/koolsmoky
8  *
9  * this is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * this is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with GNU Make; see the file COPYING.  If not, write to
21  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22  */
23
24 #ifndef __TXQUANTIZE_H__
25 #define __TXQUANTIZE_H__
26
27 /* Glide64 DXTn workaround
28  * (0:disable, 1:enable) */
29 #define GLIDE64_DXTN 1
30
31 #include "TxInternal.h"
32 #include "TxUtil.h"
33
34 class TxQuantize
35 {
36 private:
37   TxUtil *_txUtil;
38   int _numcore;
39
40   fxtCompressTexFuncExt _tx_compress_fxt1;
41   dxtCompressTexFuncExt _tx_compress_dxtn_rgba;
42
43   /* fast optimized... well, sort of. */
44   void ARGB1555_ARGB8888(uint32* src, uint32* dst, int width, int height);
45   void ARGB4444_ARGB8888(uint32* src, uint32* dst, int width, int height);
46   void RGB565_ARGB8888(uint32* src, uint32* dst, int width, int height);
47   void A8_ARGB8888(uint32* src, uint32* dst, int width, int height);
48   void AI44_ARGB8888(uint32* src, uint32* dst, int width, int height);
49   void AI88_ARGB8888(uint32* src, uint32* dst, int width, int height);
50
51   void ARGB8888_ARGB1555(uint32* src, uint32* dst, int width, int height);
52   void ARGB8888_ARGB4444(uint32* src, uint32* dst, int width, int height);
53   void ARGB8888_RGB565(uint32* src, uint32* dst, int width, int height);
54   void ARGB8888_A8(uint32* src, uint32* dst, int width, int height);
55   void ARGB8888_AI44(uint32* src, uint32* dst, int width, int height);
56   void ARGB8888_AI88(uint32* src, uint32* dst, int width, int height);
57
58   /* quality */
59   void ARGB8888_RGB565_ErrD(uint32* src, uint32* dst, int width, int height);
60   void ARGB8888_ARGB1555_ErrD(uint32* src, uint32* dst, int width, int height);
61   void ARGB8888_ARGB4444_ErrD(uint32* src, uint32* dst, int width, int height);
62   void ARGB8888_AI44_ErrD(uint32* src, uint32* dst, int width, int height);
63   void ARGB8888_AI88_Slow(uint32* src, uint32* dst, int width, int height);
64   void ARGB8888_I8_Slow(uint32* src, uint32* dst, int width, int height);
65
66   /* compressors */
67   boolean FXT1(uint8 *src, uint8 *dest,
68                int srcwidth, int srcheight, uint16 srcformat,
69                int *destwidth, int *destheight, uint16 *destformat);
70   boolean DXTn(uint8 *src, uint8 *dest,
71                int srcwidth, int srcheight, uint16 srcformat,
72                int *destwidth, int *destheight, uint16 *destformat);
73
74 public:
75   TxQuantize();
76   ~TxQuantize();
77
78   /* others */
79   void P8_16BPP(uint32* src, uint32* dst, int width, int height, uint32* palette);
80
81   boolean quantize(uint8* src, uint8* dest, int width, int height, uint16 srcformat, uint16 destformat, boolean fastQuantizer = 1);
82
83   boolean compress(uint8 *src, uint8 *dest,
84                    int srcwidth, int srcheight, uint16 srcformat,
85                    int *destwidth, int *destheight, uint16 *destformat,
86                    int compressionType);
87
88
89 #if 0 /* unused */
90   void ARGB8888_I8(uint32* src, uint32* dst, int width, int height);
91   void I8_ARGB8888(uint32* src, uint32* dst, int width, int height);
92   
93   void ARGB1555_ABGR8888(uint32* src, uint32* dst, int width, int height);
94   void ARGB4444_ABGR8888(uint32* src, uint32* dst, int width, int height);
95   void ARGB8888_ABGR8888(uint32* src, uint32* dst, int width, int height);
96 #endif
97 };
98
99 #endif /* __TXQUANTIZE_H__ */