]>
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__
21 // The package level header files this module uses
25 // The Library classes this module consumes
27 #include <Library/UefiDecompressLib.h>
28 #include <Library/CustomDecompressLib.h>
29 #include <Library/DebugLib.h>
30 #include <Library/BaseMemoryLib.h>
33 // Decompression algorithm begins here
42 // C: Char&Len Set; P: Position Set; T: exTra Set
44 #define NC (0xff + MAXMATCH + 2 - THRESHOLD)
48 #define MAXNP ((1U << MAXPBIT) - 1)
49 #define NT (CODE_BIT + 3)
57 UINT8
*mSrcBase
; // Starting address of compressed data
58 UINT8
*mDstBase
; // Starting address of decompressed data
71 UINT16 mLeft
[2 * NC
- 1];
72 UINT16 mRight
[2 * NC
- 1];
79 // The length of the field 'Position Set Code Length Array Size' in Block Header.
80 // For EFI 1.1 de/compression algorithm, mPBit = 4
81 // For Tiano de/compression algorithm, mPBit = 5
87 Read NumOfBit of bits from source into mBitBuf
89 Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
91 @param Sd The global scratch data
92 @param NumOfBits The number of bits to shift and read.
102 Get NumOfBits of bits out from mBitBuf
104 Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
105 NumOfBits of bits from source. Returns NumOfBits of bits that are
108 @param Sd The global scratch data.
109 @param NumOfBits The number of bits to pop and read.
111 @return The bits that are popped out.
121 Creates Huffman Code mapping table according to code length array.
123 Creates Huffman Code mapping table for Extra Set, Char&Len Set
124 and Position Set according to code length array.
126 @param Sd The global scratch data
127 @param NumOfChar Number of symbols in the symbol set
128 @param BitLen Code length array
129 @param TableBits The width of the mapping table
130 @param Table The table
133 @retval BAD_TABLE The table is corrupted.
146 Decodes a position value.
148 Get a position value according to Position Huffman Table.
150 @param Sd the global scratch data
152 @return The position value decoded.
161 Reads code lengths for the Extra Set or the Position Set.
163 Read in the Extra Set or Pointion Set Length Arrary, then
164 generate the Huffman code mapping for them.
166 @param Sd The global scratch data.
167 @param nn Number of symbols.
168 @param nbit Number of bits needed to represent nn.
169 @param Special The special symbol that needs to be taken care of.
172 @retval BAD_TABLE Table is corrupted.
184 Reads code lengths for Char&Len Set.
186 Read in and decode the Char&Len Set Code Length Array, then
187 generate the Huffman Code mapping table for the Char&Len Set.
189 @param Sd the global scratch data
198 Decode a character/length value.
200 Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
201 Huffman code mapping table for Extra Set, Code&Len Set and
204 @param Sd The global scratch data.
206 @return The value decoded.
215 Decode the source data and put the resulting data into the destination buffer.
217 Decode the source data and put the resulting data into the destination buffer.
219 @param Sd The global scratch data
229 UefiTianoDecompress (
230 IN CONST VOID
*Source
,
231 IN OUT VOID
*Destination
,
232 IN OUT VOID
*Scratch
,