EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/LzFind.h

Go to the documentation of this file.
00001 /* LzFind.h -- Match finder for LZ algorithms
00002 2008-10-04 : Igor Pavlov : Public domain */
00003 
00004 #ifndef __LZFIND_H
00005 #define __LZFIND_H
00006 
00007 #include "Types.h"
00008 
00009 typedef UInt32 CLzRef;
00010 
00011 typedef struct _CMatchFinder
00012 {
00013   Byte *buffer;
00014   UInt32 pos;
00015   UInt32 posLimit;
00016   UInt32 streamPos;
00017   UInt32 lenLimit;
00018 
00019   UInt32 cyclicBufferPos;
00020   UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
00021 
00022   UInt32 matchMaxLen;
00023   CLzRef *hash;
00024   CLzRef *son;
00025   UInt32 hashMask;
00026   UInt32 cutValue;
00027 
00028   Byte *bufferBase;
00029   ISeqInStream *stream;
00030   int streamEndWasReached;
00031 
00032   UInt32 blockSize;
00033   UInt32 keepSizeBefore;
00034   UInt32 keepSizeAfter;
00035 
00036   UInt32 numHashBytes;
00037   int directInput;
00038   int btMode;
00039   /* int skipModeBits; */
00040   int bigHash;
00041   UInt32 historySize;
00042   UInt32 fixedHashSize;
00043   UInt32 hashSizeSum;
00044   UInt32 numSons;
00045   SRes result;
00046   UInt32 crc[256];
00047 } CMatchFinder;
00048 
00049 #define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
00050 #define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
00051 
00052 #define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
00053 
00054 int MatchFinder_NeedMove(CMatchFinder *p);
00055 Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
00056 void MatchFinder_MoveBlock(CMatchFinder *p);
00057 void MatchFinder_ReadIfRequired(CMatchFinder *p);
00058 
00059 void MatchFinder_Construct(CMatchFinder *p);
00060 
00061 /* Conditions:
00062      historySize <= 3 GB
00063      keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
00064 */
00065 int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
00066     UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
00067     ISzAlloc *alloc);
00068 void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
00069 void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
00070 void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
00071 
00072 UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
00073     UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
00074     UInt32 *distances, UInt32 maxLen);
00075 
00076 /*
00077 Conditions:
00078   Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
00079   Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
00080 */
00081 
00082 typedef void (*Mf_Init_Func)(void *object);
00083 typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
00084 typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
00085 typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
00086 typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
00087 typedef void (*Mf_Skip_Func)(void *object, UInt32);
00088 
00089 typedef struct _IMatchFinder
00090 {
00091   Mf_Init_Func Init;
00092   Mf_GetIndexByte_Func GetIndexByte;
00093   Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
00094   Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
00095   Mf_GetMatches_Func GetMatches;
00096   Mf_Skip_Func Skip;
00097 } IMatchFinder;
00098 
00099 void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
00100 
00101 void MatchFinder_Init(CMatchFinder *p);
00102 UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
00103 UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
00104 void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
00105 void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
00106 
00107 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines