Lines Matching refs:Sd
96 IN SCRATCH_DATA *Sd, in FillBuf() argument
114 Sd->mBitBuf = (UINT32) (Sd->mBitBuf << NumOfBits); in FillBuf()
116 while (NumOfBits > Sd->mBitCount) { in FillBuf()
118 Sd->mBitBuf |= (UINT32) (Sd->mSubBitBuf << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount))); in FillBuf()
120 if (Sd->mCompSize > 0) { in FillBuf()
124 Sd->mCompSize--; in FillBuf()
125 Sd->mSubBitBuf = 0; in FillBuf()
126 Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++]; in FillBuf()
127 Sd->mBitCount = 8; in FillBuf()
133 Sd->mSubBitBuf = 0; in FillBuf()
134 Sd->mBitCount = 8; in FillBuf()
139 Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits); in FillBuf()
140 Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount; in FillBuf()
146 IN SCRATCH_DATA *Sd, in GetBits() argument
170 OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits)); in GetBits()
172 FillBuf (Sd, NumOfBits); in GetBits()
180 IN SCRATCH_DATA *Sd, in MakeTable() argument
286 Sd->mRight[Avail] = Sd->mLeft[Avail] = 0; in MakeTable()
291 Pointer = &Sd->mRight[*Pointer]; in MakeTable()
293 Pointer = &Sd->mLeft[*Pointer]; in MakeTable()
315 IN SCRATCH_DATA *Sd in DecodeP() argument
337 Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)]; in DecodeP()
344 if (Sd->mBitBuf & Mask) { in DecodeP()
345 Val = Sd->mRight[Val]; in DecodeP()
347 Val = Sd->mLeft[Val]; in DecodeP()
356 FillBuf (Sd, Sd->mPTLen[Val]); in DecodeP()
360 Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1))); in DecodeP()
369 IN SCRATCH_DATA *Sd, in ReadPTLen() argument
399 Number = (UINT16) GetBits (Sd, nbit); in ReadPTLen()
402 CharC = (UINT16) GetBits (Sd, nbit); in ReadPTLen()
405 Sd->mPTTable[Index] = CharC; in ReadPTLen()
409 Sd->mPTLen[Index] = 0; in ReadPTLen()
419 CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3)); in ReadPTLen()
423 while (Mask & Sd->mBitBuf) { in ReadPTLen()
429 FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3)); in ReadPTLen()
431 Sd->mPTLen[Index++] = (UINT8) CharC; in ReadPTLen()
434 CharC = (UINT16) GetBits (Sd, 2); in ReadPTLen()
436 Sd->mPTLen[Index++] = 0; in ReadPTLen()
442 Sd->mPTLen[Index++] = 0; in ReadPTLen()
445 return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable); in ReadPTLen()
451 SCRATCH_DATA *Sd in ReadCLen() argument
472 Number = (UINT16) GetBits (Sd, CBIT); in ReadCLen()
475 CharC = (UINT16) GetBits (Sd, CBIT); in ReadCLen()
478 Sd->mCLen[Index] = 0; in ReadCLen()
482 Sd->mCTable[Index] = CharC; in ReadCLen()
491 CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)]; in ReadCLen()
497 if (Mask & Sd->mBitBuf) { in ReadCLen()
498 CharC = Sd->mRight[CharC]; in ReadCLen()
500 CharC = Sd->mLeft[CharC]; in ReadCLen()
510 FillBuf (Sd, Sd->mPTLen[CharC]); in ReadCLen()
517 CharC = (UINT16) (GetBits (Sd, 4) + 3); in ReadCLen()
519 CharC = (UINT16) (GetBits (Sd, CBIT) + 20); in ReadCLen()
523 Sd->mCLen[Index++] = 0; in ReadCLen()
528 Sd->mCLen[Index++] = (UINT8) (CharC - 2); in ReadCLen()
534 Sd->mCLen[Index++] = 0; in ReadCLen()
537 MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable); in ReadCLen()
545 SCRATCH_DATA *Sd in DecodeC() argument
566 if (Sd->mBlockSize == 0) { in DecodeC()
570 Sd->mBlockSize = (UINT16) GetBits (Sd, 16); in DecodeC()
571 Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3); in DecodeC()
572 if (Sd->mBadTableFlag != 0) { in DecodeC()
576 ReadCLen (Sd); in DecodeC()
578 Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16) (-1)); in DecodeC()
579 if (Sd->mBadTableFlag != 0) { in DecodeC()
584 Sd->mBlockSize--; in DecodeC()
585 Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)]; in DecodeC()
591 if (Sd->mBitBuf & Mask) { in DecodeC()
592 Index2 = Sd->mRight[Index2]; in DecodeC()
594 Index2 = Sd->mLeft[Index2]; in DecodeC()
603 FillBuf (Sd, Sd->mCLen[Index2]); in DecodeC()
611 SCRATCH_DATA *Sd in Decode() argument
636 CharC = DecodeC (Sd); in Decode()
637 if (Sd->mBadTableFlag != 0) { in Decode()
645 if (Sd->mOutBuf >= Sd->mOrigSize) { in Decode()
648 Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC; in Decode()
659 DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1; in Decode()
663 Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++]; in Decode()
664 if (Sd->mOutBuf >= Sd->mOrigSize) { in Decode()
755 SCRATCH_DATA *Sd; in Decompress() local
767 Sd = (SCRATCH_DATA *) Scratch; in Decompress()
794 ((UINT8 *) Sd)[Index] = 0; in Decompress()
803 Sd->mPBit = 4; in Decompress()
807 Sd->mPBit = 5; in Decompress()
817 Sd->mSrcBase = Src; in Decompress()
818 Sd->mDstBase = Dst; in Decompress()
819 Sd->mCompSize = CompSize; in Decompress()
820 Sd->mOrigSize = OrigSize; in Decompress()
825 FillBuf (Sd, BITBUFSIZ); in Decompress()
830 Decode (Sd); in Decompress()
832 if (Sd->mBadTableFlag != 0) { in Decompress()