2021-03-02 02:13:17 +00:00
|
|
|
// Project64 - A Nintendo 64 emulator
|
2021-05-18 11:51:36 +00:00
|
|
|
// https://www.pj64-emu.com/
|
2021-03-02 02:13:17 +00:00
|
|
|
// Copyright(C) 2001-2021 Project64
|
|
|
|
// Copyright(C) 2007 Hiroshi Morii
|
|
|
|
// Copyright(C) 2003 Rice1964
|
|
|
|
// GNU/GPLv2 licensed: https://gnu.org/licenses/gpl-2.0.html
|
2013-04-17 10:30:38 +00:00
|
|
|
|
|
|
|
#ifndef __TXQUANTIZE_H__
|
|
|
|
#define __TXQUANTIZE_H__
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
// Glide64 DXTn workaround
|
|
|
|
// (0:disable, 1:enable)
|
2013-04-17 10:30:38 +00:00
|
|
|
#define GLIDE64_DXTN 1
|
|
|
|
|
|
|
|
#include "TxInternal.h"
|
|
|
|
#include "TxUtil.h"
|
|
|
|
|
|
|
|
class TxQuantize
|
|
|
|
{
|
|
|
|
private:
|
2017-04-26 10:23:36 +00:00
|
|
|
TxUtil *_txUtil;
|
|
|
|
int _numcore;
|
|
|
|
|
|
|
|
fxtCompressTexFuncExt _tx_compress_fxt1;
|
|
|
|
dxtCompressTexFuncExt _tx_compress_dxtn;
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
// Fast optimized...well, sort of
|
2017-04-26 10:23:36 +00:00
|
|
|
void ARGB1555_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB4444_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void RGB565_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void A8_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void AI44_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void AI88_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
|
|
|
|
|
|
|
void ARGB8888_ARGB1555(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_ARGB4444(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_RGB565(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_A8(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_AI44(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_AI88(uint32* src, uint32* dst, int width, int height);
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
// Quality
|
2017-04-26 10:23:36 +00:00
|
|
|
void ARGB8888_RGB565_ErrD(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_ARGB1555_ErrD(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_ARGB4444_ErrD(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_AI44_ErrD(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_AI88_Slow(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_I8_Slow(uint32* src, uint32* dst, int width, int height);
|
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
// Compressors
|
2017-04-26 10:23:36 +00:00
|
|
|
bool FXT1(uint8 *src, uint8 *dest,
|
|
|
|
int srcwidth, int srcheight, uint16 srcformat,
|
|
|
|
int *destwidth, int *destheight, uint16 *destformat);
|
|
|
|
bool DXTn(uint8 *src, uint8 *dest,
|
|
|
|
int srcwidth, int srcheight, uint16 srcformat,
|
|
|
|
int *destwidth, int *destheight, uint16 *destformat);
|
2013-04-17 10:30:38 +00:00
|
|
|
|
|
|
|
public:
|
2017-04-26 10:23:36 +00:00
|
|
|
TxQuantize();
|
|
|
|
~TxQuantize();
|
2013-04-17 10:30:38 +00:00
|
|
|
|
2021-05-18 11:51:36 +00:00
|
|
|
// Others
|
2017-04-26 10:23:36 +00:00
|
|
|
void P8_16BPP(uint32* src, uint32* dst, int width, int height, uint32* palette);
|
2013-04-17 10:30:38 +00:00
|
|
|
|
2017-04-26 10:23:36 +00:00
|
|
|
bool quantize(uint8* src, uint8* dest, int width, int height, uint16 srcformat, uint16 destformat, bool fastQuantizer = 1);
|
2013-04-17 10:30:38 +00:00
|
|
|
|
2017-04-26 10:23:36 +00:00
|
|
|
bool compress(uint8 *src, uint8 *dest,
|
|
|
|
int srcwidth, int srcheight, uint16 srcformat,
|
|
|
|
int *destwidth, int *destheight, uint16 *destformat,
|
|
|
|
int compressionType);
|
2013-04-17 10:30:38 +00:00
|
|
|
|
|
|
|
#if 0 /* unused */
|
2017-04-26 10:23:36 +00:00
|
|
|
void ARGB8888_I8(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void I8_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
|
|
|
|
|
|
|
void ARGB1555_ABGR8888(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB4444_ABGR8888(uint32* src, uint32* dst, int width, int height);
|
|
|
|
void ARGB8888_ABGR8888(uint32* src, uint32* dst, int width, int height);
|
2013-04-17 10:30:38 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __TXQUANTIZE_H__ */
|