34 for (i = 0; i < 256; i++)
44 { retVal = rrr; goto save_state_and_return; };
46 #define GET_BITS(lll,vvv,nnn) \
47 case lll: s->state = lll; \
49 if (s->bsLive >= nnn) { \
52 (s->bsLive-nnn)) & ((1 << nnn)-1); \
57 if (s->strm->avail_in == 0) RETURN(BZ_OK); \
59 = (s->bsBuff << 8) | \
61 (*((UChar*)(s->strm->next_in)))); \
64 s->strm->avail_in--; \
65 s->strm->total_in_lo32++; \
66 if (s->strm->total_in_lo32 == 0) \
67 s->strm->total_in_hi32++; \
70 #define GET_UCHAR(lll,uuu) \
73 #define GET_BIT(lll,uuu) \
77 #define GET_MTF_VAL(label1,label2,lval) \
79 if (groupPos == 0) { \
81 if (groupNo >= nSelectors) \
82 RETURN(BZ_DATA_ERROR); \
83 groupPos = BZ_G_SIZE; \
84 gSel = s->selector[groupNo]; \
85 gMinlen = s->minLens[gSel]; \
86 gLimit = &(s->limit[gSel][0]); \
87 gPerm = &(s->perm[gSel][0]); \
88 gBase = &(s->base[gSel][0]); \
92 GET_BITS(label1, zvec, zn); \
95 RETURN(BZ_DATA_ERROR); \
96 if (zvec <= gLimit[zn]) break; \
98 GET_BIT(label2, zj); \
99 zvec = (zvec << 1) | zj; \
101 if (zvec - gBase[zn] < 0 \
102 || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \
103 RETURN(BZ_DATA_ERROR); \
104 lval = gPerm[zvec - gBase[zn]]; \
113 Int32 minLen, maxLen;
227 if (uc == 0x17)
goto endhdr_2;
270 for (i = 0; i < 16; i++) {
277 for (i = 0; i < 256; i++) s->
inUse[i] =
False;
279 for (i = 0; i < 16; i++)
281 for (j = 0; j < 16; j++) {
283 if (uc == 1) s->
inUse[i * 16 + j] =
True;
294 for (i = 0; i < nSelectors; i++) {
308 for (v = 0; v < nGroups; v++) pos[v] = v;
310 for (i = 0; i < nSelectors; i++) {
313 while (v > 0) { pos[v] = pos[v-1]; v--; }
320 for (t = 0; t < nGroups; t++) {
322 for (i = 0; i < alphaSize; i++) {
328 if (uc == 0) curr++;
else curr--;
335 for (t = 0; t < nGroups; t++) {
338 for (i = 0; i < alphaSize; i++) {
339 if (s->
len[t][i] > maxLen) maxLen = s->
len[t][i];
340 if (s->
len[t][i] < minLen) minLen = s->
len[t][i];
347 minLen, maxLen, alphaSize
359 for (i = 0; i <= 255; i++) s->
unzftab[i] = 0;
380 if (nextSym == EOB)
break;
387 if (nextSym ==
BZ_RUNA) es = es + (0+1) * N;
else
388 if (nextSym ==
BZ_RUNB) es = es + (1+1) * N;
421 Int32 ii, jj, kk, pp, lno, off;
423 nn = (
UInt32)(nextSym - 1);
438 s->
mtfa[(pp+nn)] = s->
mtfa[(pp+nn)-1]; nn--;
461 for (ii = 256 /
MTFL_SIZE-1; ii >= 0; ii--) {
492 for (i = 1; i <= 256; i++) s->
cftab[i] = s->
unzftab[i-1];
494 for (i = 0; i <= 256; i++) {
495 if (s->
cftab[i] < 0 || s->
cftab[i] > nblock) {
513 for (i = 0; i < nblock; i++) {
543 for (i = 0; i < nblock; i++) {
545 s->
tt[s->
cftab[uc]] |= (i << 8);
596 save_state_and_return:
601 s->save_alphaSize = alphaSize;
602 s->save_nGroups = nGroups;
603 s->save_nSelectors = nSelectors;
605 s->save_groupNo = groupNo;
606 s->save_groupPos = groupPos;
607 s->save_nextSym = nextSym;
608 s->save_nblockMAX = nblockMAX;
609 s->save_nblock = nblock;
618 s->save_gMinlen = gMinlen;
619 s->save_gLimit = gLimit;
620 s->save_gBase = gBase;
621 s->save_gPerm = gPerm;
UChar selectorMtf[BZ_MAX_SELECTORS]
#define GET_BIT(lll, uuu)
#define BZ_RAND_INIT_MASK
Int32 limit[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]
#define BZ_DATA_ERROR_MAGIC
static ABC_NAMESPACE_IMPL_START void makeMaps_d(DState *s)
#define BZ_GET_FAST(cccc)
#define VPrintf1(zf, za1)
#define GET_UCHAR(lll, uuu)
UInt32 calculatedBlockCRC
UChar selector[BZ_MAX_SELECTORS]
for(p=first;p->value< newval;p=p->next)
#define AssertH(cond, errcode)
#define GET_BITS(lll, vvv, nnn)
#define ABC_NAMESPACE_IMPL_END
Int32 BZ2_decompress(DState *s)
Int32 mtfbase[256/MTFL_SIZE]
#define ABC_NAMESPACE_IMPL_START
Int32 minLens[BZ_N_GROUPS]
UChar len[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]
#define BZ_INITIALISE_CRC(crcVar)
Int32 base[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]
Int32 perm[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]
#define GET_MTF_VAL(label1, label2, lval)
void BZ2_hbCreateDecodeTables(Int32 *, Int32 *, Int32 *, UChar *, Int32, Int32, Int32)
#define BZ_GET_SMALL(cccc)