]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/TianoCompress/TianoCompress.h
2 Internal include file for Tiano Decompress Library.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __TIANO_DECOMPRESS_H__
10 #define __TIANO_DECOMPRESS_H__
14 #include <Common/UefiBaseTypes.h>
18 // Decompression algorithm begins here
20 #define UTILITY_NAME "TianoCompress"
21 #define UTILITY_MAJOR_VERSION 0
22 #define UTILITY_MINOR_VERSION 1
25 // Default output file name
27 #define DEFAULT_OUTPUT_FILE "file.tmp"
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 EFI 1.1 de/compression algorithm, mPBit = 4
77 // For Tiano de/compression algorithm, mPBit = 5
83 // Function Prototypes
88 IN
char *InputFileName
,
89 OUT UINT8
*FileBuffer
,
90 OUT UINT32
*BufferLength
276 IN UINT16 FreqParm
[],
277 OUT UINT8 LenParm
[ ],
278 OUT UINT16 CodeParm
[]
282 Read NumOfBit of bits from source into mBitBuf
284 Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
286 @param Sd The global scratch data
287 @param NumOfBits The number of bits to shift and read.
297 Get NumOfBits of bits out from mBitBuf
299 Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
300 NumOfBits of bits from source. Returns NumOfBits of bits that are
303 @param Sd The global scratch data.
304 @param NumOfBits The number of bits to pop and read.
306 @return The bits that are popped out.
316 Creates Huffman Code mapping table according to code length array.
318 Creates Huffman Code mapping table for Extra Set, Char&Len Set
319 and Position Set according to code length array.
321 @param Sd The global scratch data
322 @param NumOfChar Number of symbols in the symbol set
323 @param BitLen Code length array
324 @param TableBits The width of the mapping table
325 @param Table The table
328 @retval BAD_TABLE The table is corrupted.
341 Decodes a position value.
343 Get a position value according to Position Huffman Table.
345 @param Sd the global scratch data
347 @return The position value decoded.
356 Reads code lengths for the Extra Set or the Position Set.
358 Read in the Extra Set or Position Set Length Array, then
359 generate the Huffman code mapping for them.
361 @param Sd The global scratch data.
362 @param nn Number of symbols.
363 @param nbit Number of bits needed to represent nn.
364 @param Special The special symbol that needs to be taken care of.
367 @retval BAD_TABLE Table is corrupted.
379 Reads code lengths for Char&Len Set.
381 Read in and decode the Char&Len Set Code Length Array, then
382 generate the Huffman Code mapping table for the Char&Len Set.
384 @param Sd the global scratch data
393 Decode a character/length value.
395 Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
396 Huffman code mapping table for Extra Set, Code&Len Set and
399 @param Sd The global scratch data.
401 @return The value decoded.
410 Decode the source data and put the resulting data into the destination buffer.
412 Decode the source data and put the resulting data into the destination buffer.
414 @param Sd The global scratch data
426 IN OUT VOID
*Destination
,
427 IN OUT VOID
*Scratch
,