home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************
- * *
- * process.h *
- * ========= *
- * *
- * Palette optimization function library *
- * *
- * Version 0.30 (20-Oct-1993) *
- * *
- * (C) 1993 DEEJ Technology PLC *
- * *
- ************************************************************************/
-
- #ifndef __palette_h
- #define __palette_h
-
- #include "sprite.h"
-
- /*
- #define HASH_STAT
- */
- #define COLOUR_STAT
-
- /* Constants */
-
- /*
- #define HASH_SIZE (21*255+1)
- #define HASH_ALG(r,g,b) (((b & 255)<<2) + ((g & 255)<<4) + (r & 255))
- */
-
- #define HASH_SIZE (73*255+1)
- #define HASH_ALG(r,g,b) (((b & 255)<<3) + ((g & 255)<<6) + (r & 255))
-
- /*
- #define HASH_SIZE (273*255+1)
- #define HASH_ALG(r,g,b) (((b & 255)<<4) + ((g & 255)<<8) + (r & 255))
- */
- /*
- #define HASH_SIZE 65527
- #define HASH_ALG(r,g,b) (rgb % HASH_SIZE)
- */
-
- /* fraction of image area to use as pixel usage filter */
- #define FILTER_FRAC 10000
-
- /* sugested maximum size of optimization table */
- #define TABLE_MAX 2048
-
-
- /* Structures */
-
- typedef struct _hist_entry
- {
- struct _hist_entry *next;
- uint value;
- int count;
- } hist_entry;
-
- typedef struct
- {
- uint value;
- int count;
- int closest[2];
- int diff[2];
- } opt_table_entry;
-
- typedef struct
- {
- /* information fields from histogram */
- hist_entry *list_head;
- int colours;
- int more1;
- int more10;
- int more100;
- int more_frac;
- int fraction;
- int max_use;
- int avg_use;
- /* info on hash table used in making histogram */
- int hash_size;
- int hash_used;
- int hash_hits;
- int hash_miss;
- int hash_chain;
- } hist_info;
-
- typedef hist_entry* hist_entry_ptr;
- typedef opt_table_entry* opt_table_entry_ptr;
-
- /* Function prototypes */
-
- void optimize_palette(spr_info_str*, spr_info_str*);
- hist_info *build_histogram(spr_info_str*);
-
- #endif
-
-
-