25 if (num <= 0)
return 0;
26 else if (num <= 1)
return 1;
27 else if (num <= 2)
return 2;
28 else if (num <= 4)
return 3;
29 else if (num <= (alphasize >= 150 ? 8 : 6))
return 4;
30 else if (num <= 9)
return 5;
31 else if (num <= (alphasize >= 150 ? 25 : 15))
return 6;
47 if (allCount >= (alphasize >= 150 ? 128 : 30)) {
61 if (alphasize < 150) {
75 if ((pos > 0) && (text[pos-1] > 0)) {
76 state |= (int)(log(text[pos-1])+0.5);
85 if (allCount >= (alphasize >= 150 ? 128 : 30)) {
99 if (alphasize < 150) {
113 if ((pos > 0) && (text[pos-1] > 0)) {
114 state |= (int)(log(text[pos-1])+0.5);
126 if (
See[state][0] >= (alphasize >= 100 ? 500 : 4000)) {
127 See[state][0] = (
See[state][0] >> 1) + 1;
128 See[state][1] = (
See[state][1] >> 1) + 1;
130 See[state][1] += (alphasize >= 100 ? 16 : 17);
133 if (
See[state][1] >= (alphasize >= 100 ? 800 : 8000)) {
134 See[state][0] = (
See[state][0] >> 1) + 1;
135 See[state][1] = (
See[state][1] >> 1) + 1;
142 for (i=0; i< 1<<14; i++) {
Uint totalCount
< Total number of symbols occuring at this state.
BOOL isRootFsmTree(const fsmTree_t tree)
Indicates if the parameter node is the root of the tree.
struct decoderTree * parent
Pointer to the parent of this node.
Uint alphasize
Alphabet size.
unsigned char Uchar
Unsigned char type.
struct decoderTree * origin
Pointer to the original node this one descends from.
Uchar * text
Input text to the encoder.
BOOL isRootDecoderTree(decoderTree_t tree)
Indicates if the parameter node is the root of the tree.
struct fsmTree * origin
Pointer to the original node this one descends from.
unsigned long Uint
Unsigned int type.
#define BOOL
Boolean data type.
Encoder context tree structure.
static short pos
Current position in the buffer.
static int get3ByteRepresentation(const Uint num, const Uint alphasize)
int getSeeStateEncoder(fsmTree_t tree, Uint allCount, Uint pos, Uint numMasked, const Uchar *text, Uint alphasize)
Returns the contents of the SEE table for the encoder.
Uint totalSyms
Total number of symbols occuring at this state.
Uint See[1<< 14][2]
SEE table structure.
void initSee()
Initalizes the SEE table.
struct fsmTree * parent
Pointer to the parent of this node.
void updateSee(Uint state, BOOL escape, Uint alphasize)
Updates the SEE table.
Decoder context tree structure.
int getSeeStateDecoder(decoderTree_t tree, Uint allCount, Uint pos, Uint numMasked, const Uchar *text, Uint alphasize)
Returns the contents of the SEE table for the encoder.