Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/LZH/LZHMacro.hpp

Go to the documentation of this file.
00001 #ifndef __J2K__LZH__LZHMacro_HPP__
00002 #define __J2K__LZH__LZHMacro_HPP__
00003 
00004 #ifndef BYTE
00005   #define BYTE   unsigned char
00006 #endif
00007 
00008 #ifndef INT16
00009   #define INT16  signed short
00010 #endif
00011 
00012 #ifndef INT32
00013   #define INT32  signed long
00014 #endif
00015 
00016 #ifndef UINT16
00017   #define UINT16 unsigned short
00018 #endif
00019 
00020 #ifndef UINT32
00021   #define UINT32 unsigned long
00022 #endif
00023 
00024 #ifndef min
00025   #define min( a, b ) ( (a) < (b) ? (a) : (b) )
00026 #endif
00027 
00028 #ifndef max
00029   #define max( a, b ) ( (a) > (b) ? (a) : (b) )
00030 #endif
00031 
00032 #ifdef _MSC_VER
00033   #pragma intrinsic( memcpy, memset, _rotl )
00034   #define ROTL( x, y ) _rotl( x, y )
00035 #else
00036   #define ROTL( x, y ) ( ( (x) << (y) ) | ( (x) >> (32-(y)) ) )
00037 #endif
00038 
00039 #define LZMIN 4
00040 
00041 //{{{{{{{{{{{{{{{{{ USER - TUNABLE ********************************************
00042 
00043 //Affect format
00044 #define LZBUFBITS 16
00045 //LZBUFBITS is a log2(LZBUFSIZE) and must be in range 10 - 16
00046 
00047 //NOT affect format
00048 #define LZMATCH 5
00049 
00050 #define LZSLOWHASH
00051 #define LZTABLEBITS 15
00052 //LZTABLEBITS is a log2(LZTABLESIZE) and should be in range 9 - 17
00053 
00054 #define LZOVERLAP
00055 #define LZBACKWARDMATCH
00056 #define LZLAZYMATCH
00057 #define LZSKIPHASH 1024
00058 
00059 #define HUFFRECALCLEN 4096
00060 //HUFFRECALCLEN should be <= 16384
00061 
00062 //}}}}}}}}}}}}}}}}} USER - TUNABLE ********************************************
00063 
00064 #define LZTABLESIZE (1<<(LZTABLEBITS))
00065 #define LZBUFSIZE (1<<(LZBUFBITS))
00066 
00067 /**************************************************************************/
00068 #define LZPOS UINT32
00069 #define LZBUFMASK ( (LZBUFSIZE) - 1 )
00070 
00071 #define LZTABLEINT UINT16
00072 typedef LZTABLEINT LZTableItem;
00073 
00074 #define LZHASH UINT32
00075 /**************************************************************************/
00076 
00077 #define HUFFINT      INT16
00078 #define HUFFUINT     UINT16
00079 #define NHUFFSYMBOLS ( 256 + 16 + 2 )
00080 
00081 /**************************************************************************/
00082 
00083 #ifdef LZSLOWHASH
00084 #define LZHASHSHIFT 5
00085 
00086 #define UPDATE_HASH( hash, c )          \
00087     {                                   \
00088     hash ^= (c);                        \
00089     hash = ROTL( hash, LZHASHSHIFT );   \
00090     }
00091 
00092 #define UPDATE_HASH_EX( hash, src )                     \
00093     {                                                   \
00094     hash ^= ROTL( (src)[ 0 ], LZHASHSHIFT * LZMATCH );  \
00095     hash ^= (src)[ LZMATCH ];                           \
00096     hash = ROTL( hash, LZHASHSHIFT );                   \
00097     }
00098 
00099 #define HASH_POS(hash) ((( (hash) * 214013 + 2531011) >> (32-LZTABLEBITS)) )
00100 
00101 #else
00102 
00103 #define LZHASHSHIFT (((LZTABLEBITS)+(LZMATCH)-1)/(LZMATCH))
00104 
00105 #define UPDATE_HASH( hash, c ) { hash = ( hash << LZHASHSHIFT ) ^ (c); }
00106 #define UPDATE_HASH_EX( hash, src )  { hash = ( hash << LZHASHSHIFT ) ^ (src)[ LZMATCH ]; }
00107 #define LZHASHMASK ((LZTABLESIZE)-1)
00108 #define HASH_POS( hash ) ( (hash) & LZHASHMASK )
00109 #endif
00110 
00111 #define HUFFRECALCSTAT( s ) ( (s) >> 1 )
00112 
00113 #endif

Generated on Sun Oct 14 18:46:33 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001