# MI_ReadUncompLZ*

## Syntax

      #include <nitro/mi/uncomp_stream.h>

      s32 MI_ReadUncompLZ8(  MIUncompContextLZ *context,
                                const u8* data,
                                u32 len );

      s32 MI_ReadUncompLZ16( MIUncompContextLZ *context,
                                const u8* data,
      u32 len );

## Arguments

context | Pointer to the context structure for uncompression of LZ77-compressed data.
data | Pointer to a portion of the data to be uncompressed.
len | Size of the data provided in the second argument.

## Return Values

Returns the number of remaining bytes of data being uncompressed. If all of the data is finished being uncompressed, the function returns 0.

## Description

Performs streaming uncompression of LZ77-compressed data, doing just the data size given, and copying it to the buffer specified by the `MI_InitUncompContextLZ` function. This function is slow compared to the `MI_UncompressLZ*` function, which uncompresses all the data at once.

The `MI_ReadUncompLZ8` function writes in units of 8 bits. On NITRO, you cannot decompress directly to VRAM. On TWL, this is possible, but it is quite slow.
The `MI_ReadUncompLZ16` function writes in units of 16 bits. On both NITRO and TWL, you can also decompress directly to VRAM. However, the process is slower compared to normal memory.
For compressed data, allow for a 2-byte lead when searching for matching strings.

Decompresses data compressed in LZ77 or LZ77 extended format using `ntrcomp` tool or an `MI_CompressLZ*` function.

## Internal Operation

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

## See Also

`MI_UncompressLZ*`
`MI_InitUncompContextLZ`
`MIUncompContextLZ`
`MI_ReadUncompRL*`
`MI_ReadUncompHuffman`
`MI_CompressLZ*`

## Revision History

2008/12/05 Added description of TWL.
2007/11/01 Added description of LZ77 extended compression.
2004/11/30 Initial version.

CONFIDENTIAL