#ifndef __huffman_h
#define __huffman_h

#include "buffer.h"

#define HTN	34
#define MXOFF	250

typedef const unsigned char val[2];

struct huffcodetab
{
	unsigned int	treelen;	// length of decoder tree
	unsigned int	xlen; 		// max. x-index+ - 1
	unsigned int	ylen;		// max. y-index+ - 1
	unsigned int	linbits;	// number of linbits
	val*		val;		// decoder tree
};

extern struct huffcodetab ht[HTN];/* global memory block		*/
				/* array of all huffcodtable headers	*/
				/* 0..31 Huffman code table 0..31	*/
				/* 32,33 count1-tables			*/

void initialize_huffman(void);
void finalize_huffman(void);

int* huffman_dualdecoder(bytebuf* hbuff, int grBits, const struct huffcodetab *h,
			int *from, int *to);

int* huffman_quaddecoder(bytebuf* hbuff, int grBits, const struct huffcodetab *h,
			int *from, int *to);

#endif
