1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
7<META http-equiv="Content-Style-Type" content="text/css">
8<title>MI_CompressHuffman</title>
9<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
10</head>
11
12<body>
13
14<h1 align="left">MI_CompressHuffman <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></h1>
15<h2>Syntax</h2>
16
17<dl>
18  <dd>
19<CODE>#include &lt;nitro/mi.h&gt;</CODE><BR> <BR> <CODE>u32 MI_CompressHuffman( const u8 *srcp, u32 size, u8 *dstp, u8 huffBitSize, u8 *work);<BR></CODE></dd>
20</dl>
21<h2>Arguments</h2>
22<TABLE border="1" width="100%">
23  <TBODY>
24    <TR>
25<TD width="13%"><SPAN class="argument">srcp</SPAN></TD>
26<TD width="87%">Source address where the data to compress is stored.</TD>
27    </TR>
28    <TR>
29<TD><SPAN class="argument">size</SPAN></TD>
30<TD>Data size of the source to compress.</TD>
31    </TR>
32    <TR>
33<TD width="13%"><SPAN class="argument">dstp</SPAN></TD>
34<TD width="87%">Needs a pointer to the compression destination buffer and a region greater than the source data size. Needs a 4-byte alignment.</TD>
35    </TR>
36    <TR>
37<TD><SPAN class="argument">huffBitSize</SPAN></TD>
38<TD>Bit size (4 or 8) to Huffman encode.</TD>
39    </TR>
40    <TR>
41<TD><SPAN class="argument">work</SPAN></TD>
42<TD>Work buffer used in Huffman compression. Requires the size of <CODE>MI_HUFFMAN_COMPRESS_WORK_SIZE</CODE>. Needs a 4-byte alignment.</TD>
43    </TR>
44  </TBODY>
45</TABLE>
46
47<h2>Return Values</h2>
48<p>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.</p>
49
50<H2>Description</H2>
51<P>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.</P>
52<P>The function writes in 8-bit units, so for NITRO, an address in VRAM cannot be specified in <SPAN class="argument">dstp</SPAN>.<BR>An address in VRAM can be specified in <SPAN class="argument">srcp</SPAN> for both NITRO and TWL.<BR>
53</P>
54
55<h2>Internal Operation</h2>
56<P>Processing takes place only on the CPU, without the use of a system call or DMA.</P>
57
58<h2>See Also</h2>
59<p><A href="MI_UncompressHuffman.html"><CODE>MI_UncompressHuffman</CODE></A><BR> <A href="MI_ReadUncompHuffman.html"><CODE>MI_ReadUncompHuffman</CODE></A><BR> <A href="MI_CompressLZ.html"><CODE>MI_CompressLZ*</CODE></A><BR> <A href="MI_CompressRL.html"><CODE>MI_CompressRL</CODE></A></p>
60
61<H2>Revision History</H2>
62<P>
632008/12/05 Added TWL-related description.<BR> 2005/06/28 Added <SPAN class="argument">work</SPAN> to <B>Syntax</B>.<BR> 2005/02/01 Initial version.</P>
64<hr><p>CONFIDENTIAL</p></body>
65</html>
66