TianoCore EDK2 master
Loading...
Searching...
No Matches
BaseUefiDecompressLibInternals.h
Go to the documentation of this file.
1
9#ifndef __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__
10#define __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__
11
12#include <Base.h>
13#include <Library/BaseLib.h>
14#include <Library/DebugLib.h>
17//
18// Decompression algorithm begins here
19//
20#define BITBUFSIZ 32
21#define MAXMATCH 256
22#define THRESHOLD 3
23#define CODE_BIT 16
24#define BAD_TABLE - 1
25
26//
27// C: Char&Len Set; P: Position Set; T: exTra Set
28//
29#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
30#define CBIT 9
31#define MAXPBIT 5
32#define TBIT 5
33#define MAXNP ((1U << MAXPBIT) - 1)
34#define NT (CODE_BIT + 3)
35#if NT > MAXNP
36#define NPT NT
37#else
38#define NPT MAXNP
39#endif
40
41typedef struct {
42 UINT8 *mSrcBase; // The starting address of compressed data
43 UINT8 *mDstBase; // The starting address of decompressed data
44 UINT32 mOutBuf;
45 UINT32 mInBuf;
46
47 UINT16 mBitCount;
48 UINT32 mBitBuf;
49 UINT32 mSubBitBuf;
50 UINT16 mBlockSize;
51 UINT32 mCompSize;
52 UINT32 mOrigSize;
53
54 UINT16 mBadTableFlag;
55
56 UINT16 mLeft[2 * NC - 1];
57 UINT16 mRight[2 * NC - 1];
58 UINT8 mCLen[NC];
59 UINT8 mPTLen[NPT];
60 UINT16 mCTable[4096];
61 UINT16 mPTTable[256];
62
68 UINT8 mPBit;
70
80VOID
81FillBuf (
82 IN SCRATCH_DATA *Sd,
83 IN UINT16 NumOfBits
84 );
85
99UINT32
100GetBits (
101 IN SCRATCH_DATA *Sd,
102 IN UINT16 NumOfBits
103 );
104
122UINT16
123MakeTable (
124 IN SCRATCH_DATA *Sd,
125 IN UINT16 NumOfChar,
126 IN UINT8 *BitLen,
127 IN UINT16 TableBits,
128 OUT UINT16 *Table
129 );
130
141UINT32
142DecodeP (
143 IN SCRATCH_DATA *Sd
144 );
145
161UINT16
162ReadPTLen (
163 IN SCRATCH_DATA *Sd,
164 IN UINT16 nn,
165 IN UINT16 nbit,
166 IN UINT16 Special
167 );
168
178VOID
179ReadCLen (
180 SCRATCH_DATA *Sd
181 );
182
195UINT16
196DecodeC (
197 SCRATCH_DATA *Sd
198 );
199
206VOID
207Decode (
208 SCRATCH_DATA *Sd
209 );
210
241RETURN_STATUS
243 IN CONST VOID *Source,
244 IN OUT VOID *Destination,
245 IN OUT VOID *Scratch,
246 IN UINT32 Version
247 );
248
249#endif
VOID FillBuf(IN SCRATCH_DATA *Sd, IN UINT16 NumOfBits)
RETURN_STATUS UefiTianoDecompress(IN CONST VOID *Source, IN OUT VOID *Destination, IN OUT VOID *Scratch, IN UINT32 Version)
UINT32 GetBits(IN SCRATCH_DATA *Sd, IN UINT16 NumOfBits)
VOID ReadCLen(SCRATCH_DATA *Sd)
UINT32 DecodeP(IN SCRATCH_DATA *Sd)
UINT16 ReadPTLen(IN SCRATCH_DATA *Sd, IN UINT16 nn, IN UINT16 nbit, IN UINT16 Special)
UINT16 MakeTable(IN SCRATCH_DATA *Sd, IN UINT16 NumOfChar, IN UINT8 *BitLen, IN UINT16 TableBits, OUT UINT16 *Table)
VOID Decode(SCRATCH_DATA *Sd)
UINT16 DecodeC(SCRATCH_DATA *Sd)
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284