151 : m_pInStream(pInStream)
152 , m_pOutStream(pOutStream)
157 , m_nOutputBufferPos(0)
175 if ( (iCount == 0) || (iCount > 31 ) )
200 nBits = val & ((1U << iCount) - 1);
224 if (P2 < 4 || P2 > 6)
236 if ( 0 == (iBit & 0x01) )
266 if (0 !=
ReadBits(
static_cast<sal_uInt16
>(L1 - 7),
L2))
294 if (0 !=
ReadBits(
static_cast<sal_uInt16
>(
P2), D2))
298 sal_uInt32
distance = (D1 | D2) + 1;
321 sTemp[
i] = sTemp[
i-nRead];
340 for (sal_uInt32
i=nLen;
i > 0;
i--)
342 nBit = (nBits >> (
i -1) ) & 0x01;
355 sal_uInt32 nRead, nReadAlready;
360 for (sal_uInt16
i=2;
i <= 8;
i++)
365 nReadAlready = (nReadAlready << 1) | (nRead & 0x01);
370 if (nRet != 0xffffffff)
402 for (sal_uInt32
i=0;
i< 16;
i++)
433 for (sal_uInt32
i=0;
i< 64;
i++)
446 for (
int i=1;
i < 16;
i++)
462 std::string aCode(pInCode);
465 const char cLast = aCode.back();
470 pParent =
InsertNode(0xffffffff, aCode.c_str());
473 pParent->
left.reset(pNew);
475 pParent->
right.reset(pNew);
482 sal_uInt32 nLen = strlen(pCode);
485 for(sal_uInt32
i=0;
i<nLen && pNode;
i++)
487 char cChar= pCode[
i];
490 pNode = pNode->
left.get();
494 pNode = pNode->
right.get();
sal_uInt32 Decode(HuffmanTreeNode *pRoot)
@descr decode tree 1 for length
void ConstructTree2()
@descr construct tree 2 for distance
sal_uInt32 m_iArrayOfM[16]
void ConstructTree1()
@descr construct tree 1 for length
sal_uInt32 m_nCurrent4Byte
sal_uInt8 m_Output[MAXWIN]
sal_uInt32 m_nOutputBufferPos
std::unique_ptr< HuffmanTreeNode > m_Tree1
sal_uInt32 ReadBits(sal_uInt16 iCount, sal_uInt32 &nBits)
@descr read specified bits from input stream @argument iCount - number of bits to be read,...
SvStream * m_pInStream
compressed/decompressed stream
static void ToString(sal_uInt32 nBits, char *pChar, sal_uInt32 nLen)
@descr bits to string
sal_uInt8 m_Buffer[CHUNK]
Decompression(SvStream *pInStream, SvStream *pOutStream)
std::unique_ptr< HuffmanTreeNode > m_Tree2
sal_Int32 explode()
decompress from instream to outstream
sal_uInt32 QueryValue(const char *pCode)
HuffmanTreeNode(sal_uInt32 value=0xffffffff)
HuffmanTreeNode * InsertNode(sal_uInt32 nValue, const char *pInCode)
HuffmanTreeNode * QueryNode(const char *pCode)
std::unique_ptr< HuffmanTreeNode > left
std::unique_ptr< HuffmanTreeNode > right
std::size_t WriteBytes(const void *pData, std::size_t nSize)
sal_uInt64 Seek(sal_uInt64 nPos)
std::size_t ReadBytes(void *pData, std::size_t nSize)
sal_uInt64 SeekRel(sal_Int64 nPos)
sal_uInt8 m_pBuffer[RTL_DIGEST_LENGTH_SHA1]
const char Tree1String[][32]
const char Tree2String[][32]
#define CHUNK
define the function type for input read, output write