/** * LZ/RLE compression algorithm * * @file platon/compress/lz-rle.h * @author iMatix SFL project team * @version \$Platon: $ * @date 2004 * * These subroutines are extracted from Standard Function Library (SFL) * created by iMatix Corporation. */ #ifndef _PLATON_COMPRESS_LZ_RLE_H #define _PLATON_COMPRESS_LZ_RLE_H #ifndef PLATON_FUNC # define PLATON_FUNC(_name) _name #endif #ifndef PLATON_FUNC_STR # define PLATON_FUNC_STR(_name) #_name #endif #ifndef PLATON_DOXYGEN_SKIP /* Skipped parts of code by Doxygen are already documented. It can be usuable when generating private documentation for libplaton developers, not for public usage. */ /** * @name LZ/RLE flags * @internal dummy text to make Doxygen happy */ /*@{*/ #define COMPRESS_LZ_RLE_COPY 0x80 /**< COPY flag */ #define COMPRESS_LZ_RLE_COMPRESS 0x40 /**< COMPRESS flag */ /*@}*/ #endif /* #ifndef PLATON_DOXYGEN_SKIP */ #ifdef __cplusplus extern "C" { #endif /** * Compresses a block using LZ/RLE algorithm * * @param src uncompressed data * @param dst compressed data * @param src_size size of uncompressed data * @return size of compressed data * * Takes uncompressed data in src, compresses it using a fast LZ/RLE * algorithm and places the result in dst. The compression technique is * comparable to that used by Zip and such tools, but less agressive. It * is, however, fast enough to use in realtime. Returns the size of the * compressed data. To decompress the data, use the uncompress_lz_rle() * function. */ int PLATON_FUNC(compress_lz_rle) (const unsigned char *src, unsigned char *dst, int src_size); /** * Expands a block of data previously compressed using * the compress_lz_rle() function * * @param src compressed data * @param dst uncompressed data * @param src_size size of uncompressed data * @return size of uncompressed data * * The compressed block is passed in src; the expanded result in dst. * Array dst must be large enough to accomodate the largest possible * decompressed block. Returns the size of the uncompressed data. */ int PLATON_FUNC(uncompress_lz_rle) (const unsigned char *src, unsigned char *dst, int src_size); #ifdef __cplusplus } #endif #endif /* #ifndef _PLATON_COMPRESS_LZ_RLE_H */