# MIUncompContextHuffman

## Definitions

      #include <nitro/mi/uncomp_stream.h>

      typedef struct
      {
      u8* destp;        // 4B
      s32 destCount;    // 4B
      u8* treep;        // 4B
      u32 srcTmp;       // 4B
      u32 destTmp;      // 4B
      s16 treeSize;     // 2B
      u8  srcTmpCnt;    // 1B
      u8  destTmpCnt;   // 1B
      u8  bitSize;      // 1B
      u8  _padding2[3]; // 3B
      u8  tree[0x200];  // 512B
      // Total 540B
      } MIUncompContextHuffman;

## Description

This is the context structure for saving the state of data uncompression when Huffman-compressed data is being read from the Card and undergoing streaming uncompression. The context is initialized by the `MI_InitUncompContextHuffman` function and used by the `MI_ReadUncompHuffman` function to save the uncompression state.
If the compressed data is 4-bit encoded data, there will not be any problems if the tree member's array size is 32 bytes, so it is OK to provide a region that is 480 bytes smaller than `sizeof( MIUncompContextHufffman )`.
If the compressed data is 8-bit encoded data you need 512 bytes, so you cannot trim the size of the structure.

destp | Pointer to region where uncompressed data will be written
destCount | Remaining write size
treep | For storing Huffman encoding table, current pointer
srcTmp | For storing data while reading
destTmp | For storing data while writing
treeSize | For storing the size of the Huffman encoding table
srcTmpCnt | For storing data size while reading
destTmpCnt | For storing data size while writing
bitSize | Encoded bit size
tree | Buffer for reading Huffman encoding table

## See Also

`MI_InitUncompContextHuffman`, `MI_ReadUncompHuffman`, `MIUncompContextLZ`, `MIUncompContextRL`

## Revision History

11/30/2004 Initial version.

CONFIDENTIAL