]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h
2 Internal data structure defintions for Base UEFI Decompress Library.
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__
10 #define __BASE_UEFI_DECOMPRESS_LIB_INTERNALS_H__
13 // Decompression algorithm begins here
22 // C: Char&Len Set; P: Position Set; T: exTra Set
24 #define NC (0xff + MAXMATCH + 2 - THRESHOLD)
28 #define MAXNP ((1U << MAXPBIT) - 1)
29 #define NT (CODE_BIT + 3)
37 UINT8
*mSrcBase
; // The starting address of compressed data
38 UINT8
*mDstBase
; // The starting address of decompressed data
51 UINT16 mLeft
[2 * NC
- 1];
52 UINT16 mRight
[2 * NC
- 1];
59 /// The length of the field 'Position Set Code Length Array Size' in Block Header.
60 /// For UEFI 2.0 de/compression algorithm, mPBit = 4.
66 Read NumOfBit of bits from source into mBitBuf.
68 Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
70 @param Sd The global scratch data.
71 @param NumOfBits The number of bits to shift and read.
81 Get NumOfBits of bits out from mBitBuf.
83 Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
84 NumOfBits of bits from source. Returns NumOfBits of bits that are
87 @param Sd The global scratch data.
88 @param NumOfBits The number of bits to pop and read.
90 @return The bits that are popped out.
100 Creates Huffman Code mapping table according to code length array.
102 Creates Huffman Code mapping table for Extra Set, Char&Len Set
103 and Position Set according to code length array.
104 If TableBits > 16, then ASSERT ().
106 @param Sd The global scratch data.
107 @param NumOfChar The number of symbols in the symbol set.
108 @param BitLen Code length array.
109 @param TableBits The width of the mapping table.
110 @param Table The table to be created.
113 @retval BAD_TABLE The table is corrupted.
126 Decodes a position value.
128 Get a position value according to Position Huffman Table.
130 @param Sd The global scratch data.
132 @return The position value decoded.
141 Reads code lengths for the Extra Set or the Position Set.
143 Read in the Extra Set or Position Set Length Array, then
144 generate the Huffman code mapping for them.
146 @param Sd The global scratch data.
147 @param nn The number of symbols.
148 @param nbit The number of bits needed to represent nn.
149 @param Special The special symbol that needs to be taken care of.
152 @retval BAD_TABLE Table is corrupted.
164 Reads code lengths for Char&Len Set.
166 Read in and decode the Char&Len Set Code Length Array, then
167 generate the Huffman Code mapping table for the Char&Len Set.
169 @param Sd The global scratch data.
178 Decode a character/length value.
180 Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
181 Huffman code mapping table for Extra Set, Code&Len Set and
184 @param Sd The global scratch data.
186 @return The value decoded.
195 Decode the source data and put the resulting data into the destination buffer.
197 @param Sd The global scratch data.