src/liblzma/lz/lz_encoder.c File Reference

LZ in window. More...

#include "lz_encoder.h"
#include "lz_encoder_hash.h"

Data Structures

struct  lzma_coder_s

Functions

static void move_window (lzma_mf *mf)
 Moves the data in the input window to free space for new data.
static lzma_ret fill_window (lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, lzma_action action)
 Tries to fill the input window (mf->buffer).
static lzma_ret lz_encode (lzma_coder *coder, lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action)
static bool lz_encoder_prepare (lzma_mf *mf, lzma_allocator *allocator, const lzma_lz_options *lz_options)
static bool lz_encoder_init (lzma_mf *mf, lzma_allocator *allocator, const lzma_lz_options *lz_options)
uint64_t lzma_lz_encoder_memusage (const lzma_lz_options *lz_options)
static void lz_encoder_end (lzma_coder *coder, lzma_allocator *allocator)
lzma_ret lzma_lz_encoder_init (lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters, lzma_ret(*lz_init)(lzma_lz_encoder *lz, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options))
 LZMA_API (lzma_bool)
 Test if the given Check ID is supported.


Detailed Description

LZ in window.


Function Documentation

static void move_window ( lzma_mf *  mf  )  [static]

Moves the data in the input window to free space for new data.

mf->buffer is a sliding input window, which keeps mf->keep_size_before bytes of input history available all the time. Now and then we need to "slide" the buffer to make space for the new data to the end of the buffer. At the same time, data older than keep_size_before is dropped.

Referenced by fill_window().

static lzma_ret fill_window ( lzma_coder coder,
lzma_allocator allocator,
const uint8_t *  in,
size_t *  in_pos,
size_t  in_size,
lzma_action  action 
) [static]

Tries to fill the input window (mf->buffer).

If we are the last encoder in the chain, our input data is in in[]. Otherwise we call the next filter in the chain to process in[] and write its output to mf->buffer.

This function must not be called once it has returned LZMA_STREAM_END.

References LZMA_OK, LZMA_RUN, LZMA_STREAM_END, and move_window().

LZMA_API ( lzma_bool   ) 

Test if the given Check ID is supported.

Test if given match finder is supported.

Test if the given Filter ID is supported for encoding.

Set a compression preset to lzma_options_lzma structure.

Test if given compression mode is supported.

Compare if two Index lists are identical.

Locate a Record.

Test if the given Filter ID is supported for decoding.

Returns true if the given Check ID is supported by this liblzma build. Otherwise false is returned. It is safe to call this with a value that is not in the range [0, 15]; in that case the return value is always false.

You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always supported (even if liblzma is built with limited features).

Returns true if the give Filter ID is supported for decoding by this liblzma build. Otherwise false is returned.

When the Index is available, it is possible to do random-access reading with granularity of Block size.

Parameters:
i Pointer to lzma_index structure
record Pointer to a structure to hold the search results
target Uncompressed target offset which the caller would like to locate from the Stream
If the target is smaller than the uncompressed size of the Stream (can be checked with lzma_index_uncompressed_size()):
  • Information about the Record containing the requested uncompressed offset is stored into *record.
  • Read offset will be adjusted so that calling lzma_index_read() can be used to read subsequent Records.
  • This function returns false.

If target is greater than the uncompressed size of the Stream, *record and the read position are not modified, and this function returns true.

Returns:
True if *a and *b are equal, false otherwise.
Returns true if the given compression mode is supported by this liblzma build. Otherwise false is returned. It is safe to call this with a value that isn't listed in lzma_mode enumeration; the return value will be false.

There is no way to list which modes are available in this particular liblzma version and build. It would be useless, because a new compression mode, which the application developer wasn't aware, could require giving additional options to the encoder that the older modes don't need.

0 is the fastest and 9 is the slowest. These match the switches -0 .. -9 of the xz command line tool. In addition, it is possible to bitwise-or flags to the preset. Currently only LZMA_PRESET_EXTREME is supported. The flags are defined in container.h, because the flags are used also with lzma_easy_encoder().

The preset values are subject to changes between liblzma versions.

This function is available only if LZMA1 or LZMA2 encoder has been enabled when building liblzma.

Test if the given Check ID is supported.

Compare if two Index lists are identical.

Locate a Record.

When the Index is available, it is possible to do random-access reading with granularity of Block size.

Parameters:
i Pointer to lzma_index structure
record Pointer to a structure to hold the search results
target Uncompressed target offset which the caller would like to locate from the Stream
If the target is smaller than the uncompressed size of the Stream (can be checked with lzma_index_uncompressed_size()):
  • Information about the Record containing the requested uncompressed offset is stored into *record.
  • Read offset will be adjusted so that calling lzma_index_read() can be used to read subsequent Records.
  • This function returns false.

If target is greater than the uncompressed size of the Stream, *record and the read position are not modified, and this function returns true.

Returns:
True if *a and *b are equal, false otherwise.


Generated on Wed May 25 10:35:47 2011 for XZ Utils by  doxygen 1.5.5