summaryrefslogtreecommitdiff
path: root/common/quant.h
blob: b1609b2abfe7a3d1a46dcb8bea4226fb0029653d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
///////////////////////////////////////
// DL1 Quantization

#ifndef _QUANT_H_
#define _QUANT_H_

typedef struct
{
	unsigned long r, g, b;
	unsigned long pixel_count;
	unsigned long pixels_in_cube;
	unsigned char children;
	unsigned char palette_index;
} CUBE;

typedef struct
{
	unsigned char level;
	unsigned short index;
} FCUBE;

typedef struct
{
	unsigned char palette_index, red, green, blue;
	unsigned long distance;
	unsigned long squares[255+255+1];
} CLOSEST_INFO;

bool dl1quant(unsigned char *inbuf, unsigned char *outbuf, int width, int height, int quant_to, int dither, unsigned char userpal[3][256]);

#endif // _QUANT_H_