]>
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 - 2014, Intel Corporation. All rights reserved.<BR>
5 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.
15 #ifndef __TIANO_DECOMPRESS_H__
16 #define __TIANO_DECOMPRESS_H__
20 #include <Common/UefiBaseTypes.h>
24 // Decompression algorithm begins here
26 #define UTILITY_NAME "TianoCompress"
27 #define UTILITY_MAJOR_VERSION 0
28 #define UTILITY_MINOR_VERSION 1
31 // Default output file name
33 #define DEFAULT_OUTPUT_FILE "file.tmp"
44 // C: Char&Len Set; P: Position Set; T: exTra Set
46 #define NC (0xff + MAXMATCH + 2 - THRESHOLD)
50 #define MAXNP ((1U << MAXPBIT) - 1)
51 #define NT (CODE_BIT + 3)
59 UINT8
*mSrcBase
; // Starting address of compressed data
60 UINT8
*mDstBase
; // Starting address of decompressed data
73 UINT16 mLeft
[2 * NC
- 1];
74 UINT16 mRight
[2 * NC
- 1];
81 // The length of the field 'Position Set Code Length Array Size' in Block Header.
82 // For EFI 1.1 de/compression algorithm, mPBit = 4
83 // For Tiano de/compression algorithm, mPBit = 5
89 // Function Prototypes
94 IN
char *InputFileName
,
95 OUT UINT8
*FileBuffer
,
96 OUT UINT32
*BufferLength
282 IN UINT16 FreqParm
[],
283 OUT UINT8 LenParm
[ ],
284 OUT UINT16 CodeParm
[]
288 Read NumOfBit of bits from source into mBitBuf
290 Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
292 @param Sd The global scratch data
293 @param NumOfBits The number of bits to shift and read.
303 Get NumOfBits of bits out from mBitBuf
305 Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
306 NumOfBits of bits from source. Returns NumOfBits of bits that are
309 @param Sd The global scratch data.
310 @param NumOfBits The number of bits to pop and read.
312 @return The bits that are popped out.
322 Creates Huffman Code mapping table according to code length array.
324 Creates Huffman Code mapping table for Extra Set, Char&Len Set
325 and Position Set according to code length array.
327 @param Sd The global scratch data
328 @param NumOfChar Number of symbols in the symbol set
329 @param BitLen Code length array
330 @param TableBits The width of the mapping table
331 @param Table The table
334 @retval BAD_TABLE The table is corrupted.
347 Decodes a position value.
349 Get a position value according to Position Huffman Table.
351 @param Sd the global scratch data
353 @return The position value decoded.
362 Reads code lengths for the Extra Set or the Position Set.
364 Read in the Extra Set or Position Set Length Array, then
365 generate the Huffman code mapping for them.
367 @param Sd The global scratch data.
368 @param nn Number of symbols.
369 @param nbit Number of bits needed to represent nn.
370 @param Special The special symbol that needs to be taken care of.
373 @retval BAD_TABLE Table is corrupted.
385 Reads code lengths for Char&Len Set.
387 Read in and decode the Char&Len Set Code Length Array, then
388 generate the Huffman Code mapping table for the Char&Len Set.
390 @param Sd the global scratch data
399 Decode a character/length value.
401 Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
402 Huffman code mapping table for Extra Set, Code&Len Set and
405 @param Sd The global scratch data.
407 @return The value decoded.
416 Decode the source data and put the resulting data into the destination buffer.
418 Decode the source data and put the resulting data into the destination buffer.
420 @param Sd The global scratch data
432 IN OUT VOID
*Destination
,
433 IN OUT VOID
*Scratch
,