Update contrib.
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32\sfile\sf_deflate.h
18 #ifndef __SF_DEFLATE_H__
19 #define __SF_DEFLATE_H__
20 #include "e32huffman.h"
23 typedef TUint8* (*TMemoryMoveFunction)(TAny* aTrg,const TAny* aSrc,TInt aLength);
25 #define __CONFIGURABLE_F32_LOADER_INFLATE_WINDOW_SIZE__ 0x8000
27 // deflation constants
28 const TInt KDeflateLengthMag=8;
29 const TInt KDeflateDistanceMag=12;
31 const TInt KDeflateMinLength=3;
32 const TInt KDeflateMaxLength=KDeflateMinLength-1 + (1<<KDeflateLengthMag);
33 const TInt KDeflateMaxDistance=(1<<KDeflateDistanceMag);
34 const TInt KDeflateDistCodeBase=0x200;
36 const TUint KDeflateHashMultiplier=0xAC4B9B19u;
37 const TInt KDeflateHashShift=24;
39 const TInt KInflateWindowSize=__CONFIGURABLE_F32_LOADER_INFLATE_WINDOW_SIZE__ ;
44 enum {ELiterals=256,ELengths=(KDeflateLengthMag-1)*4,ESpecials=1,EDistances=(KDeflateDistanceMag-1)*4};
45 enum {ELitLens=ELiterals+ELengths+ESpecials};
46 enum {EEos=ELiterals+ELengths};
48 TUint32 iLitLen[ELitLens];
49 TUint32 iDistance[EDistances];
52 const TInt KDeflationCodes=TEncoding::ELitLens+TEncoding::EDistances;
54 NONSHARABLE_CLASS(CInflater) : public CBase
57 enum {EBufSize = 0x800, ESafetyZone=8};
59 static CInflater* NewLC(TBitInput& aInput);
62 TInt ReadL(TUint8* aBuffer,TInt aLength, TMemoryMoveFunction aMemMovefn);
63 TInt SkipL(TInt aLength);
65 CInflater(TBitInput& aInput);
71 const TUint8* iRptr; // partial segment
73 const TUint8* iAvail; // available data
76 TUint8* iOut; // circular buffer for distance matches
79 void DeflateL(const TUint8* aBuf, TInt aLength, TBitOutput& aOutput);
81 NONSHARABLE_CLASS(TFileInput) : public TBitInput
83 enum {KBufSize=KInflateWindowSize};
85 TFileInput(RFile& aFile);
94 TUint8 iBuf1[KBufSize];
95 TUint8 iBuf2[KBufSize];