# MI_CompressHuffman

## Syntax

  `#include <nitro/mi.h>`
  `u32 MI_CompressHuffman( const u8 *srcp, u32 size, u8 *dstp, u8 huffBitSize, u8 *work);
  `

## Arguments

srcp | Source address where the data to compress is stored.
size | Data size of the source to compress.
dstp | Needs a pointer to the compression destination buffer and a region greater than the source data size. Needs a 4-byte alignment.
huffBitSize | Bit size (4 or 8) to Huffman encode.
work | Work buffer used in Huffman compression. Requires the size of `MI_HUFFMAN_COMPRESS_WORK_SIZE`. Needs a 4-byte alignment.

## Return Values

Returns the size of the compressed data. If the data after compression is larger than the source file, no compression is performed, and 0 is returned.

## Description

Performs Huffman compression and writes to a designated memory region. A region of the same size as the source data must be prepared in the compression destination buffer.

The function writes in 8-bit units, so for NITRO, an address in VRAM cannot be specified in dstp.
An address in VRAM can be specified in srcp for both NITRO and TWL.

## Internal Operation

Processing takes place only on the CPU, without the use of a system call or DMA.

## See Also

`MI_UncompressHuffman`
`MI_ReadUncompHuffman`
`MI_CompressLZ*`
`MI_CompressRL`

## Revision History

2008/12/05 Added TWL-related description.
2005/06/28 Added work to Syntax.
2005/02/01 Initial version.

CONFIDENTIAL