* Remove debug output
* Further optimization to the colortree, now allocated in one single chunk of 4090 bytes (2051 times better than original code!). Not doing all the malloc/frees should be slightly faster, and it also helps with cache locality (the whole tree can fit in the cache). * Remove the useless color "balancing" multipliers that did more harm than good. We still need some improvements on the median cut, or maybe switch to a smarter algorithm; or add some cheats. See the JFIF quirks for an example. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1876 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
@@ -55,17 +55,22 @@ typedef struct CT_Node_s
|
||||
// * makes them smaller
|
||||
// * helps with cache locality
|
||||
|
||||
// palette index (valid iff any child is NULL)
|
||||
byte index;
|
||||
|
||||
// child nodes
|
||||
struct CT_Node_s* children[2];
|
||||
// Child nodes :
|
||||
// Either two indices in the colorTree array, or
|
||||
// 0 and a palette index
|
||||
// 0 is not a valid array index, because no node points to the root !
|
||||
word children[2];
|
||||
} CT_Node;
|
||||
|
||||
CT_Node* CT_new();
|
||||
void CT_delete(CT_Node* t);
|
||||
byte CT_get(CT_Node* t,byte r,byte g,byte b);
|
||||
void CT_set(CT_Node** colorTree, byte Rmin, byte Gmin, byte Bmin,
|
||||
typedef struct ColorTree_S {
|
||||
short nodecount;
|
||||
CT_Node nodes[511];
|
||||
} CT_Tree;
|
||||
|
||||
CT_Tree* CT_new();
|
||||
void CT_delete(CT_Tree* t);
|
||||
byte CT_get(CT_Tree* t,byte r,byte g,byte b);
|
||||
void CT_set(CT_Tree* colorTree, byte Rmin, byte Gmin, byte Bmin,
|
||||
byte Rmax, byte Gmax, byte Bmax, byte index);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user