Lines Matching refs:Sd
78 IN SCRATCH_DATA *Sd, in FillBuf() argument
96 Sd->mBitBuf = (UINT32) (Sd->mBitBuf << NumOfBits); in FillBuf()
98 while (NumOfBits > Sd->mBitCount) { in FillBuf()
100 Sd->mBitBuf |= (UINT32) (Sd->mSubBitBuf << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount))); in FillBuf()
102 if (Sd->mCompSize > 0) { in FillBuf()
106 Sd->mCompSize--; in FillBuf()
107 Sd->mSubBitBuf = 0; in FillBuf()
108 Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++]; in FillBuf()
109 Sd->mBitCount = 8; in FillBuf()
115 Sd->mSubBitBuf = 0; in FillBuf()
116 Sd->mBitCount = 8; in FillBuf()
121 Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits); in FillBuf()
122 Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount; in FillBuf()
127 IN SCRATCH_DATA *Sd, in GetBits() argument
151 OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits)); in GetBits()
153 FillBuf (Sd, NumOfBits); in GetBits()
160 IN SCRATCH_DATA *Sd, in MakeTable() argument
270 Sd->mRight[Avail] = Sd->mLeft[Avail] = 0; in MakeTable()
275 Pointer = &Sd->mRight[*Pointer]; in MakeTable()
277 Pointer = &Sd->mLeft[*Pointer]; in MakeTable()
298 IN SCRATCH_DATA *Sd in DecodeP() argument
320 Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)]; in DecodeP()
327 if (Sd->mBitBuf & Mask) { in DecodeP()
328 Val = Sd->mRight[Val]; in DecodeP()
330 Val = Sd->mLeft[Val]; in DecodeP()
339 FillBuf (Sd, Sd->mPTLen[Val]); in DecodeP()
343 Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1))); in DecodeP()
351 IN SCRATCH_DATA *Sd, in ReadPTLen() argument
381 Number = (UINT16) GetBits (Sd, nbit); in ReadPTLen()
384 CharC = (UINT16) GetBits (Sd, nbit); in ReadPTLen()
387 Sd->mPTTable[Index] = CharC; in ReadPTLen()
391 Sd->mPTLen[Index] = 0; in ReadPTLen()
401 CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3)); in ReadPTLen()
405 while (Mask & Sd->mBitBuf) { in ReadPTLen()
411 FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3)); in ReadPTLen()
413 Sd->mPTLen[Index++] = (UINT8) CharC; in ReadPTLen()
416 CharC = (UINT16) GetBits (Sd, 2); in ReadPTLen()
418 Sd->mPTLen[Index++] = 0; in ReadPTLen()
424 Sd->mPTLen[Index++] = 0; in ReadPTLen()
427 return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable); in ReadPTLen()
432 SCRATCH_DATA *Sd in ReadCLen() argument
453 Number = (UINT16) GetBits (Sd, CBIT); in ReadCLen()
456 CharC = (UINT16) GetBits (Sd, CBIT); in ReadCLen()
459 Sd->mCLen[Index] = 0; in ReadCLen()
463 Sd->mCTable[Index] = CharC; in ReadCLen()
472 CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)]; in ReadCLen()
478 if (Mask & Sd->mBitBuf) { in ReadCLen()
479 CharC = Sd->mRight[CharC]; in ReadCLen()
481 CharC = Sd->mLeft[CharC]; in ReadCLen()
491 FillBuf (Sd, Sd->mPTLen[CharC]); in ReadCLen()
498 CharC = (UINT16) (GetBits (Sd, 4) + 3); in ReadCLen()
500 CharC = (UINT16) (GetBits (Sd, CBIT) + 20); in ReadCLen()
504 Sd->mCLen[Index++] = 0; in ReadCLen()
509 Sd->mCLen[Index++] = (UINT8) (CharC - 2); in ReadCLen()
515 Sd->mCLen[Index++] = 0; in ReadCLen()
518 MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable); in ReadCLen()
525 SCRATCH_DATA *Sd in DecodeC() argument
546 if (Sd->mBlockSize == 0) { in DecodeC()
550 Sd->mBlockSize = (UINT16) GetBits (Sd, 16); in DecodeC()
551 Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3); in DecodeC()
552 if (Sd->mBadTableFlag != 0) { in DecodeC()
556 ReadCLen (Sd); in DecodeC()
558 Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16) (-1)); in DecodeC()
559 if (Sd->mBadTableFlag != 0) { in DecodeC()
564 Sd->mBlockSize--; in DecodeC()
565 Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)]; in DecodeC()
571 if (Sd->mBitBuf & Mask) { in DecodeC()
572 Index2 = Sd->mRight[Index2]; in DecodeC()
574 Index2 = Sd->mLeft[Index2]; in DecodeC()
583 FillBuf (Sd, Sd->mCLen[Index2]); in DecodeC()
590 SCRATCH_DATA *Sd in Decode() argument
615 CharC = DecodeC (Sd); in Decode()
616 if (Sd->mBadTableFlag != 0) { in Decode()
624 if (Sd->mOutBuf >= Sd->mOrigSize) { in Decode()
627 Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC; in Decode()
638 DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1; in Decode()
642 Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++]; in Decode()
643 if (Sd->mOutBuf >= Sd->mOrigSize) { in Decode()
734 SCRATCH_DATA *Sd; in Decompress() local
747 Sd = (SCRATCH_DATA *) Scratch; in Decompress()
774 ((UINT8 *) Sd)[Index] = 0; in Decompress()
784 Sd->mPBit = 4; in Decompress()
788 Sd->mPBit = 5; in Decompress()
798 Sd->mSrcBase = Src; in Decompress()
799 Sd->mDstBase = Dst; in Decompress()
800 Sd->mCompSize = CompSize; in Decompress()
801 Sd->mOrigSize = OrigSize; in Decompress()
806 FillBuf (Sd, BITBUFSIZ); in Decompress()
811 Decode (Sd); in Decompress()
813 if (Sd->mBadTableFlag != 0) { in Decompress()