Go to the documentation of this file.Go to the SVN repository for this file.
25 #define WEIGHTOF(zz0) ((zz0) & 0xffffff00)
26 #define DEPTHOF(zz1) ((zz1) & 0x000000ff)
27 #define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3))
29 #define ADDWEIGHTS(zw1,zw2) \
30 (WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \
31 (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2)))
36 zz = z; tmp = heap[zz]; \
37 while (weight[tmp] < weight[heap[zz >> 1]]) { \
38 heap[zz] = heap[zz >> 1]; \
47 zz = z; tmp = heap[zz]; \
50 if (yy > nHeap) break; \
52 weight[heap[yy+1]] < weight[heap[yy]]) \
54 if (weight[tmp] < weight[heap[yy]]) break; \
55 heap[zz] = heap[yy]; \
72 Int32 nNodes, nHeap, n1, n2,
i, j, k;
79 for (
i = 0;
i < alphaSize;
i++)
80 weight[
i+1] = (freq[
i] == 0 ? 1 : freq[
i]) << 8;
91 for (
i = 1;
i <= alphaSize;
i++) {
104 parent[n1] = parent[n2] = nNodes;
108 heap[nHeap] = nNodes;
115 for (
i = 1;
i <= alphaSize;
i++) {
118 while (parent[k] >= 0) { k = parent[k]; j++; }
120 if (j > maxLen) tooLong =
True;
123 if (! tooLong)
break;
142 for (
i = 1;
i <= alphaSize;
i++) {
161 for (
n = minLen;
n <= maxLen;
n++) {
162 for (
i = 0;
i < alphaSize;
i++)
163 if (length[
i] ==
n) {
code[
i] = vec; vec++; };
181 for (
i = minLen;
i <= maxLen;
i++)
182 for (j = 0; j < alphaSize; j++)
183 if (length[j] ==
i) { perm[pp] = j; pp++; };
186 for (
i = 0;
i < alphaSize;
i++) base[length[
i]+1]++;
193 for (
i = minLen;
i <= maxLen;
i++) {
194 vec += (base[
i+1] - base[
i]);
198 for (
i = minLen + 1;
i <= maxLen;
i++)
199 base[
i] = ((limit[
i-1] + 1) << 1) - base[
i];
#define AssertH(cond, errcode)
#define BZ_MAX_ALPHA_SIZE
static int heap[2 *(256+1+29)+1]
void BZ2_hbCreateDecodeTables(Int32 *limit, Int32 *base, Int32 *perm, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize)
void BZ2_hbAssignCodes(Int32 *code, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize)
#define ADDWEIGHTS(zw1, zw2)
void BZ2_hbMakeCodeLengths(UChar *len, Int32 *freq, Int32 alphaSize, Int32 maxLen)