MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLibInternals.h File Reference


Data Structures

struct  SCRATCH_DATA

Defines

#define BITBUFSIZ   32
#define MAXMATCH   256
#define THRESHOLD   3
#define CODE_BIT   16
#define BAD_TABLE   - 1
#define NC   (0xff + MAXMATCH + 2 - THRESHOLD)
#define CBIT   9
#define MAXPBIT   5
#define TBIT   5
#define MAXNP   ((1U << MAXPBIT) - 1)
#define NT   (CODE_BIT + 3)
#define NPT   MAXNP

Functions

VOID FillBuf (IN SCRATCH_DATA *Sd, IN UINT16 NumOfBits)
UINT32 GetBits (IN SCRATCH_DATA *Sd, IN UINT16 NumOfBits)
UINT16 MakeTable (IN SCRATCH_DATA *Sd, IN UINT16 NumOfChar, IN UINT8 *BitLen, IN UINT16 TableBits, OUT UINT16 *Table)
UINT32 DecodeP (IN SCRATCH_DATA *Sd)
UINT16 ReadPTLen (IN SCRATCH_DATA *Sd, IN UINT16 nn, IN UINT16 nbit, IN UINT16 Special)
VOID ReadCLen (SCRATCH_DATA *Sd)
UINT16 DecodeC (SCRATCH_DATA *Sd)
VOID Decode (SCRATCH_DATA *Sd)

Detailed Description

Internal data structure defintions for Base UEFI Decompress Libary.

Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Define Documentation

#define BAD_TABLE   - 1

Referenced by MakeTable().

#define BITBUFSIZ   32

#define CBIT   9

Referenced by ReadCLen().

#define CODE_BIT   16

#define MAXMATCH   256

#define MAXNP   ((1U << MAXPBIT) - 1)

Referenced by DecodeC(), and DecodeP().

#define MAXPBIT   5

#define NC   (0xff + MAXMATCH + 2 - THRESHOLD)

Referenced by DecodeC(), MakeTable(), and ReadCLen().

#define NPT   MAXNP

Referenced by ReadPTLen().

#define NT   (CODE_BIT + 3)

Referenced by DecodeC(), and ReadCLen().

#define TBIT   5

Referenced by DecodeC().

#define THRESHOLD   3

Referenced by Decode().


Function Documentation

VOID Decode ( SCRATCH_DATA Sd  ) 

Decode the source data and put the resulting data into the destination buffer.

Parameters:
Sd The global scratch data.

References BIT8, DecodeC(), DecodeP(), SCRATCH_DATA::mBadTableFlag, SCRATCH_DATA::mDstBase, SCRATCH_DATA::mOrigSize, SCRATCH_DATA::mOutBuf, and THRESHOLD.

Referenced by UefiDecompress().

UINT16 DecodeC ( SCRATCH_DATA Sd  ) 

Decode a character/length value.

Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates Huffman code mapping table for Extra Set, Code&Len Set and Position Set.

Parameters:
Sd The global scratch data.
Returns:
The value decoded.

References BITBUFSIZ, FillBuf(), GetBits(), Mask, MAXNP, SCRATCH_DATA::mBadTableFlag, SCRATCH_DATA::mBitBuf, SCRATCH_DATA::mBlockSize, SCRATCH_DATA::mCLen, SCRATCH_DATA::mCTable, SCRATCH_DATA::mLeft, SCRATCH_DATA::mPBit, SCRATCH_DATA::mRight, NC, NT, ReadCLen(), ReadPTLen(), and TBIT.

Referenced by Decode().

UINT32 DecodeP ( IN SCRATCH_DATA Sd  ) 

Decodes a position value.

Get a position value according to Position Huffman Table.

Parameters:
Sd The global scratch data.
Returns:
The position value decoded.

References BITBUFSIZ, FillBuf(), GetBits(), Mask, and MAXNP.

Referenced by Decode().

VOID FillBuf ( IN SCRATCH_DATA Sd,
IN UINT16  NumOfBits 
)

Read NumOfBit of bits from source into mBitBuf.

Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.

Parameters:
Sd The global scratch data.
NumOfBits The number of bits to shift and read.

Referenced by DecodeC(), DecodeP(), GetBits(), ReadCLen(), ReadPTLen(), and UefiDecompress().

UINT32 GetBits ( IN SCRATCH_DATA Sd,
IN UINT16  NumOfBits 
)

Get NumOfBits of bits out from mBitBuf.

Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent NumOfBits of bits from source. Returns NumOfBits of bits that are popped out.

Parameters:
Sd The global scratch data.
NumOfBits The number of bits to pop and read.
Returns:
The bits that are popped out.

References BITBUFSIZ, and FillBuf().

Referenced by DecodeC(), DecodeP(), ReadCLen(), and ReadPTLen().

UINT16 MakeTable ( IN SCRATCH_DATA Sd,
IN UINT16  NumOfChar,
IN UINT8 BitLen,
IN UINT16  TableBits,
OUT UINT16 Table 
)

Creates Huffman Code mapping table according to code length array.

Creates Huffman Code mapping table for Extra Set, Char&Len Set and Position Set according to code length array. If TableBits > 16, then ASSERT ().

Parameters:
Sd The global scratch data.
NumOfChar The number of symbols in the symbol set.
BitLen Code length array.
TableBits The width of the mapping table.
Table The table to be created.
Return values:
0 OK.
BAD_TABLE The table is corrupted.

References ASSERT, BAD_TABLE, Len, Mask, NC, and SetMem16().

Referenced by ReadCLen(), and ReadPTLen().

VOID ReadCLen ( SCRATCH_DATA Sd  ) 

Reads code lengths for Char&Len Set.

Read in and decode the Char&Len Set Code Length Array, then generate the Huffman Code mapping table for the Char&Len Set.

Parameters:
Sd The global scratch data.

References BITBUFSIZ, CBIT, FillBuf(), GetBits(), MakeTable(), Mask, SCRATCH_DATA::mBitBuf, SCRATCH_DATA::mCLen, SCRATCH_DATA::mCTable, SCRATCH_DATA::mLeft, SCRATCH_DATA::mPTLen, SCRATCH_DATA::mPTTable, SCRATCH_DATA::mRight, NC, NT, SetMem(), and SetMem16().

Referenced by DecodeC().

UINT16 ReadPTLen ( IN SCRATCH_DATA Sd,
IN UINT16  nn,
IN UINT16  nbit,
IN UINT16  Special 
)

Reads code lengths for the Extra Set or the Position Set.

Read in the Extra Set or Pointion Set Length Arrary, then generate the Huffman code mapping for them.

Parameters:
Sd The global scratch data.
nn The number of symbols.
nbit The number of bits needed to represent nn.
Special The special symbol that needs to be taken care of.
Return values:
0 OK.
BAD_TABLE Table is corrupted.

References ASSERT, BITBUFSIZ, FillBuf(), GetBits(), MakeTable(), Mask, NPT, SetMem(), and SetMem16().

Referenced by DecodeC().


Generated on Thu Sep 24 23:14:24 2015 for MdePkg[ALL] by  doxygen 1.5.7.1