Go to the source code of this file.
|
void | BZ2_hbMakeCodeLengths (UChar *len, Int32 *freq, Int32 alphaSize, Int32 maxLen) |
|
void | BZ2_hbAssignCodes (Int32 *code, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize) |
|
void | BZ2_hbCreateDecodeTables (Int32 *limit, Int32 *base, Int32 *perm, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize) |
|
#define ADDWEIGHTS |
( |
|
zw1, |
|
|
|
zw2 |
|
) |
| |
#define DEPTHOF |
( |
|
zz1 | ) |
((zz1) & 0x000000ff) |
Value:
zz = z; tmp = heap[zz]; \
weight[heap[yy+1]] < weight[heap[yy]]) \
yy++; \
if (weight[tmp] < weight[heap[yy]]) break; \
heap[zz] = heap[yy]; \
zz = yy; \
} \
heap[zz] = tmp; \
}
Definition at line 47 of file huffman.c.
#define MYMAX |
( |
|
zz2, |
|
|
|
zz3 |
|
) |
| ((zz2) > (zz3) ? (zz2) : (zz3)) |
Value:
zz = z; tmp = heap[zz]; \
while (weight[tmp] < weight[heap[zz >> 1]]) { \
heap[zz] = heap[zz >> 1]; \
zz >>= 1; \
} \
heap[zz] = tmp; \
}
Definition at line 36 of file huffman.c.
#define WEIGHTOF |
( |
|
zz0 | ) |
((zz0) & 0xffffff00) |
Definition at line 155 of file huffman.c.
164 for (n = minLen; n <= maxLen; n++) {
165 for (i = 0; i < alphaSize; i++)
166 if (length[i] == n) {
code[i] = vec; vec++; };
Definition at line 173 of file huffman.c.
184 for (i = minLen; i <= maxLen; i++)
185 for (j = 0; j < alphaSize; j++)
186 if (length[j] == i) { perm[pp] = j; pp++; };
189 for (i = 0; i < alphaSize; i++) base[length[i]+1]++;
196 for (i = minLen; i <= maxLen; i++) {
197 vec += (base[i+1] - base[i]);
201 for (i = minLen + 1; i <= maxLen; i++)
202 base[i] = ((limit[i-1] + 1) << 1) - base[i];
Definition at line 66 of file huffman.c.
75 Int32 nNodes, nHeap, n1, n2, i, j, k;
82 for (i = 0; i < alphaSize; i++)
83 weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
94 for (i = 1; i <= alphaSize; i++) {
104 n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--;
DOWNHEAP(1);
105 n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--;
DOWNHEAP(1);
107 parent[n1] = parent[n2] = nNodes;
108 weight[nNodes] =
ADDWEIGHTS(weight[n1], weight[n2]);
111 heap[nHeap] = nNodes;
118 for (i = 1; i <= alphaSize; i++) {
121 while (parent[k] >= 0) { k = parent[k]; j++; }
123 if (j > maxLen) tooLong =
True;
126 if (! tooLong)
break;
145 for (i = 1; i <= alphaSize; i++) {
#define ADDWEIGHTS(zw1, zw2)
#define AssertH(cond, errcode)
#define BZ_MAX_ALPHA_SIZE