]>
git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLibInternals.h
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/BaseLib.h>
23 #include <Library/UefiDecompressLib.h>
24 #include <Library/DebugLib.h>
25 #include <Library/BaseMemoryLib.h>
26 #include <Library/ExtractGuidedSectionLib.h>
29 // Decompression algorithm begins here
38 // C: Char&Len Set; P: Position Set; T: exTra Set
40 #define NC (0xff + MAXMATCH + 2 - THRESHOLD)
44 #define MAXNP ((1U << MAXPBIT) - 1)
45 #define NT (CODE_BIT + 3)
53 UINT8
*mSrcBase
; // Starting address of compressed data
54 UINT8
*mDstBase
; // Starting address of decompressed data
67 UINT16 mLeft
[2 * NC
- 1];
68 UINT16 mRight
[2 * NC
- 1];
75 // The length of the field 'Position Set Code Length Array Size' in Block Header.
76 // For UEFI 2.0 de/compression algorithm, mPBit = 4
77 // For Tiano de/compression algorithm, mPBit = 5
83 Read NumOfBit of bits from source into mBitBuf
85 Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
87 @param Sd The global scratch data
88 @param NumOfBits The number of bits to shift and read.
98 Get NumOfBits of bits out from mBitBuf
100 Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
101 NumOfBits of bits from source. Returns NumOfBits of bits that are
104 @param Sd The global scratch data.
105 @param NumOfBits The number of bits to pop and read.
107 @return The bits that are popped out.
117 Creates Huffman Code mapping table according to code length array.
119 Creates Huffman Code mapping table for Extra Set, Char&Len Set
120 and Position Set according to code length array.
122 @param Sd The global scratch data
123 @param NumOfChar Number of symbols in the symbol set
124 @param BitLen Code length array
125 @param TableBits The width of the mapping table
126 @param Table The table
129 @retval BAD_TABLE The table is corrupted.
142 Decodes a position value.
144 Get a position value according to Position Huffman Table.
146 @param Sd the global scratch data
148 @return The position value decoded.
157 Reads code lengths for the Extra Set or the Position Set.
159 Read in the Extra Set or Pointion Set Length Arrary, then
160 generate the Huffman code mapping for them.
162 @param Sd The global scratch data.
163 @param nn Number of symbols.
164 @param nbit Number of bits needed to represent nn.
165 @param Special The special symbol that needs to be taken care of.
168 @retval BAD_TABLE Table is corrupted.
180 Reads code lengths for Char&Len Set.
182 Read in and decode the Char&Len Set Code Length Array, then
183 generate the Huffman Code mapping table for the Char&Len Set.
185 @param Sd the global scratch data
194 Decode a character/length value.
196 Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
197 Huffman code mapping table for Extra Set, Code&Len Set and
200 @param Sd The global scratch data.
202 @return The value decoded.
211 Decode the source data and put the resulting data into the destination buffer.
213 Decode the source data and put the resulting data into the destination buffer.
215 @param Sd The global scratch data
225 UefiTianoDecompress (
226 IN CONST VOID
*Source
,
227 IN OUT VOID
*Destination
,
228 IN OUT VOID
*Scratch
,