]>
git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLibInternals.h
29995387b49835f4d58b1c66ee2a173bd2913009
2 Internal include file for Base UEFI Decompress Libary.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 Module Name: BaseUefiCustomDecompressLibInternals.h
17 #ifndef __BASE_UEFI_TIANO_CUSTOM_DECOMPRESS_LIB_INTERNALS_H__
18 #define __BASE_UEFI_TIANO_CUSTOM_DECOMPRESS_LIB_INTERNALS_H__
22 #include <Library/UefiDecompressLib.h>
23 #include <Library/DebugLib.h>
24 #include <Library/ExtractGuidedSectionLib.h>
27 // Decompression algorithm begins here
36 // C: Char&Len Set; P: Position Set; T: exTra Set
38 #define NC (0xff + MAXMATCH + 2 - THRESHOLD)
42 #define MAXNP ((1U << MAXPBIT) - 1)
43 #define NT (CODE_BIT + 3)
51 UINT8
*mSrcBase
; // Starting address of compressed data
52 UINT8
*mDstBase
; // Starting address of decompressed data
65 UINT16 mLeft
[2 * NC
- 1];
66 UINT16 mRight
[2 * NC
- 1];
73 // The length of the field 'Position Set Code Length Array Size' in Block Header.
74 // For EFI 1.1 de/compression algorithm, mPBit = 4
75 // For Tiano de/compression algorithm, mPBit = 5
81 Read NumOfBit of bits from source into mBitBuf
83 Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
85 @param Sd The global scratch data
86 @param NumOfBits The number of bits to shift and read.
96 Get NumOfBits of bits out from mBitBuf
98 Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
99 NumOfBits of bits from source. Returns NumOfBits of bits that are
102 @param Sd The global scratch data.
103 @param NumOfBits The number of bits to pop and read.
105 @return The bits that are popped out.
115 Creates Huffman Code mapping table according to code length array.
117 Creates Huffman Code mapping table for Extra Set, Char&Len Set
118 and Position Set according to code length array.
120 @param Sd The global scratch data
121 @param NumOfChar Number of symbols in the symbol set
122 @param BitLen Code length array
123 @param TableBits The width of the mapping table
124 @param Table The table
127 @retval BAD_TABLE The table is corrupted.
140 Decodes a position value.
142 Get a position value according to Position Huffman Table.
144 @param Sd the global scratch data
146 @return The position value decoded.
155 Reads code lengths for the Extra Set or the Position Set.
157 Read in the Extra Set or Pointion Set Length Arrary, then
158 generate the Huffman code mapping for them.
160 @param Sd The global scratch data.
161 @param nn Number of symbols.
162 @param nbit Number of bits needed to represent nn.
163 @param Special The special symbol that needs to be taken care of.
166 @retval BAD_TABLE Table is corrupted.
178 Reads code lengths for Char&Len Set.
180 Read in and decode the Char&Len Set Code Length Array, then
181 generate the Huffman Code mapping table for the Char&Len Set.
183 @param Sd the global scratch data
192 Decode a character/length value.
194 Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
195 Huffman code mapping table for Extra Set, Code&Len Set and
198 @param Sd The global scratch data.
200 @return The value decoded.
209 Decode the source data and put the resulting data into the destination buffer.
211 Decode the source data and put the resulting data into the destination buffer.
213 @param Sd The global scratch data
223 UefiTianoDecompress (
224 IN CONST VOID
*Source
,
225 IN OUT VOID
*Destination
,
226 IN OUT VOID
*Scratch
,