FreeRDP
lodepng.c File Reference
#include "lodepng.h"
#include <winpr/wtypes.h>
#include <winpr/file.h>
#include <stdio.h>
#include <stdlib.h>

Macros

#define VERSION_STRING   "20140823"
 
#define CERROR_BREAK(errorvar, code)
 
#define ERROR_BREAK(code)   CERROR_BREAK(error, code)
 
#define CERROR_RETURN_ERROR(errorvar, code)
 
#define CERROR_TRY_RETURN(call)
 
#define READBIT(bitpointer, bitstream)    ((bitstream[bitpointer >> 3] >> (bitpointer & 0x7)) & (unsigned char)1)
 
#define FIRST_LENGTH_CODE_INDEX   257
 
#define LAST_LENGTH_CODE_INDEX   285
 
#define NUM_DEFLATE_CODE_SYMBOLS   288
 
#define NUM_DISTANCE_SYMBOLS   32
 
#define NUM_CODE_LENGTH_CODES   19
 
#define DEFAULT_WINDOWSIZE   2048
 

Functions

static void uivector_cleanup (void *p)
 
static unsigned uivector_reserve (uivector *p, size_t allocsize)
 
static unsigned uivector_resize (uivector *p, size_t size)
 
static unsigned uivector_resizev (uivector *p, size_t size, unsigned value)
 
static void uivector_init (uivector *p)
 
static unsigned uivector_push_back (uivector *p, unsigned c)
 
static unsigned uivector_copy (uivector *p, const uivector *q)
 
static void ucvector_cleanup (void *p)
 
static unsigned ucvector_reserve (ucvector *p, size_t allocsize)
 
static unsigned ucvector_resize (ucvector *p, size_t size)
 
static void ucvector_init (ucvector *p)
 
static unsigned ucvector_resizev (ucvector *p, size_t size, unsigned char value)
 
static void ucvector_init_buffer (ucvector *p, unsigned char *buffer, size_t size)
 
static unsigned ucvector_push_back (ucvector *p, unsigned char c)
 
static void string_cleanup (char **out)
 
static unsigned string_resize (char **out, size_t size)
 
static void string_init (char **out)
 
static void string_set (char **out, const char *in)
 
static unsigned lodepng_read32bitInt (const unsigned char *buffer)
 
static void lodepng_set32bitInt (unsigned char *buffer, unsigned value)
 
static int lodepng_add32bitInt (ucvector *buffer, unsigned value)
 
unsigned lodepng_load_file (unsigned char **out, size_t *outsize, const char *filename)
 
unsigned lodepng_save_file (const unsigned char *buffer, size_t buffersize, const char *filename)
 
static int addBitToStream (size_t *bitpointer, ucvector *bitstream, unsigned char bit)
 
static void addBitsToStream (size_t *bitpointer, ucvector *bitstream, unsigned value, size_t nbits)
 
static void addBitsToStreamReversed (size_t *bitpointer, ucvector *bitstream, unsigned value, size_t nbits)
 
static unsigned char readBitFromStream (size_t *bitpointer, const unsigned char *bitstream)
 
static unsigned readBitsFromStream (size_t *bitpointer, const unsigned char *bitstream, size_t nbits)
 
static void HuffmanTree_init (HuffmanTree *tree)
 
static void HuffmanTree_cleanup (HuffmanTree *tree)
 
static unsigned HuffmanTree_make2DTree (HuffmanTree *tree)
 
static unsigned HuffmanTree_makeFromLengths2 (HuffmanTree *tree)
 
static unsigned HuffmanTree_makeFromLengths (HuffmanTree *tree, const unsigned *bitlen, size_t numcodes, unsigned maxbitlen)
 
static void coin_init (Coin *c)
 
static void coin_cleanup (void *c)
 
static void coin_copy (Coin *c1, const Coin *c2)
 
static void add_coins (Coin *c1, const Coin *c2)
 
static void init_coins (Coin *coins, size_t num)
 
static void cleanup_coins (Coin *coins, size_t num)
 
static int coin_compare (const void *a, const void *b)
 
static unsigned append_symbol_coins (Coin *coins, const unsigned *frequencies, unsigned numcodes, size_t sum)
 
unsigned lodepng_huffman_code_lengths (unsigned *lengths, const unsigned *frequencies, size_t numcodes, unsigned maxbitlen)
 
static unsigned HuffmanTree_makeFromFrequencies (HuffmanTree *tree, const unsigned *frequencies, size_t mincodes, size_t numcodes, unsigned maxbitlen)
 
static unsigned HuffmanTree_getCode (const HuffmanTree *tree, unsigned index)
 
static unsigned HuffmanTree_getLength (const HuffmanTree *tree, unsigned index)
 
static unsigned generateFixedLitLenTree (HuffmanTree *tree)
 
static unsigned generateFixedDistanceTree (HuffmanTree *tree)
 
static unsigned huffmanDecodeSymbol (const unsigned char *in, size_t *bp, const HuffmanTree *codetree, size_t inbitlength)
 
static int getTreeInflateFixed (HuffmanTree *tree_ll, HuffmanTree *tree_d)
 
static unsigned getTreeInflateDynamic (HuffmanTree *tree_ll, HuffmanTree *tree_d, const unsigned char *in, size_t *bp, size_t inlength)
 
static unsigned inflateHuffmanBlock (ucvector *out, const unsigned char *in, size_t *bp, size_t *pos, size_t inlength, unsigned btype)
 
static unsigned inflateNoCompression (ucvector *out, const unsigned char *in, size_t *bp, size_t *pos, size_t inlength)
 
static unsigned lodepng_inflatev (ucvector *out, const unsigned char *in, size_t insize, const LodePNGDecompressSettings *settings)
 
unsigned lodepng_inflate (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGDecompressSettings *settings)
 
static unsigned inflate (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGDecompressSettings *settings)
 
static void addHuffmanSymbol (size_t *bp, ucvector *compressed, unsigned code, unsigned bitlen)
 
static size_t searchCodeIndex (const unsigned *array, size_t array_size, size_t value)
 
static void addLengthDistance (uivector *values, size_t length, size_t distance)
 
static unsigned hash_init (Hash *hash, unsigned windowsize)
 
static void hash_cleanup (Hash *hash)
 
static unsigned getHash (const unsigned char *data, size_t size, size_t pos)
 
static unsigned countZeros (const unsigned char *data, size_t size, size_t pos)
 
static void updateHashChain (Hash *hash, size_t wpos, unsigned hashval, unsigned short numzeros)
 
static unsigned encodeLZ77 (uivector *out, Hash *hash, const unsigned char *in, size_t inpos, size_t insize, unsigned windowsize, unsigned minmatch, unsigned nicematch, unsigned lazymatching)
 
static unsigned deflateNoCompression (ucvector *out, const unsigned char *data, size_t datasize)
 
static void writeLZ77data (size_t *bp, ucvector *out, const uivector *lz77_encoded, const HuffmanTree *tree_ll, const HuffmanTree *tree_d)
 
static unsigned deflateDynamic (ucvector *out, size_t *bp, Hash *hash, const unsigned char *data, size_t datapos, size_t dataend, const LodePNGCompressSettings *settings, unsigned final)
 
static unsigned deflateFixed (ucvector *out, size_t *bp, Hash *hash, const unsigned char *data, size_t datapos, size_t dataend, const LodePNGCompressSettings *settings, unsigned final)
 
static unsigned lodepng_deflatev (ucvector *out, const unsigned char *in, size_t insize, const LodePNGCompressSettings *settings)
 
unsigned lodepng_deflate (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGCompressSettings *settings)
 
static unsigned deflate (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGCompressSettings *settings)
 
static unsigned update_adler32 (unsigned adler, const unsigned char *data, unsigned len)
 
static unsigned adler32 (const unsigned char *data, unsigned len)
 
unsigned lodepng_zlib_decompress (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGDecompressSettings *settings)
 
static unsigned zlib_decompress (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGDecompressSettings *settings)
 
unsigned lodepng_zlib_compress (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGCompressSettings *settings)
 
static unsigned zlib_compress (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGCompressSettings *settings)
 
void lodepng_compress_settings_init (LodePNGCompressSettings *settings)
 
void lodepng_decompress_settings_init (LodePNGDecompressSettings *settings)
 
unsigned lodepng_crc32 (const unsigned char *buf, size_t len)
 
static unsigned char readBitFromReversedStream (size_t *bitpointer, const unsigned char *bitstream)
 
static unsigned readBitsFromReversedStream (size_t *bitpointer, const unsigned char *bitstream, size_t nbits)
 
static void setBitOfReversedStream0 (size_t *bitpointer, unsigned char *bitstream, unsigned char bit)
 
static void setBitOfReversedStream (size_t *bitpointer, unsigned char *bitstream, unsigned char bit)
 
unsigned lodepng_chunk_length (const unsigned char *chunk)
 
void lodepng_chunk_type (char type[5], const unsigned char *chunk)
 
unsigned char lodepng_chunk_type_equals (const unsigned char *chunk, const char *type)
 
unsigned char lodepng_chunk_ancillary (const unsigned char *chunk)
 
unsigned char lodepng_chunk_private (const unsigned char *chunk)
 
unsigned char lodepng_chunk_safetocopy (const unsigned char *chunk)
 
unsigned char * lodepng_chunk_data (unsigned char *chunk)
 
const unsigned char * lodepng_chunk_data_const (const unsigned char *chunk)
 
unsigned lodepng_chunk_check_crc (const unsigned char *chunk)
 
void lodepng_chunk_generate_crc (unsigned char *chunk)
 
unsigned char * lodepng_chunk_next (unsigned char *chunk)
 
const unsigned char * lodepng_chunk_next_const (const unsigned char *chunk)
 
unsigned lodepng_chunk_append (unsigned char **out, size_t *outlength, const unsigned char *chunk)
 
unsigned lodepng_chunk_create (unsigned char **out, size_t *outlength, unsigned length, const char *type, const unsigned char *data)
 
static unsigned checkColorValidity (LodePNGColorType colortype, unsigned bd)
 
static unsigned getNumColorChannels (LodePNGColorType colortype)
 
static unsigned lodepng_get_bpp_lct (LodePNGColorType colortype, unsigned bitdepth)
 
void lodepng_color_mode_init (LodePNGColorMode *info)
 
void lodepng_color_mode_cleanup (LodePNGColorMode *info)
 
unsigned lodepng_color_mode_copy (LodePNGColorMode *dest, const LodePNGColorMode *source)
 
static int lodepng_color_mode_equal (const LodePNGColorMode *a, const LodePNGColorMode *b)
 
void lodepng_palette_clear (LodePNGColorMode *info)
 
unsigned lodepng_palette_add (LodePNGColorMode *info, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 
unsigned lodepng_get_bpp (const LodePNGColorMode *info)
 
unsigned lodepng_get_channels (const LodePNGColorMode *info)
 
unsigned lodepng_is_greyscale_type (const LodePNGColorMode *info)
 
unsigned lodepng_is_alpha_type (const LodePNGColorMode *info)
 
unsigned lodepng_is_palette_type (const LodePNGColorMode *info)
 
unsigned lodepng_has_palette_alpha (const LodePNGColorMode *info)
 
unsigned lodepng_can_have_alpha (const LodePNGColorMode *info)
 
size_t lodepng_get_raw_size (unsigned w, unsigned h, const LodePNGColorMode *color)
 
static size_t lodepng_get_raw_size_idat (unsigned w, unsigned h, const LodePNGColorMode *color)
 
static void LodePNGUnknownChunks_init (LodePNGInfo *info)
 
static void LodePNGUnknownChunks_cleanup (LodePNGInfo *info)
 
static unsigned LodePNGUnknownChunks_copy (LodePNGInfo *dest, const LodePNGInfo *src)
 
static void LodePNGText_init (LodePNGInfo *info)
 
static void LodePNGText_cleanup (LodePNGInfo *info)
 
static unsigned LodePNGText_copy (LodePNGInfo *dest, const LodePNGInfo *source)
 
void lodepng_clear_text (LodePNGInfo *info)
 
unsigned lodepng_add_text (LodePNGInfo *info, const char *key, const char *str)
 
static void LodePNGIText_init (LodePNGInfo *info)
 
static void LodePNGIText_cleanup (LodePNGInfo *info)
 
static unsigned LodePNGIText_copy (LodePNGInfo *dest, const LodePNGInfo *source)
 
void lodepng_clear_itext (LodePNGInfo *info)
 
unsigned lodepng_add_itext (LodePNGInfo *info, const char *key, const char *langtag, const char *transkey, const char *str)
 
void lodepng_info_init (LodePNGInfo *info)
 
void lodepng_info_cleanup (LodePNGInfo *info)
 
unsigned lodepng_info_copy (LodePNGInfo *dest, const LodePNGInfo *source)
 
static void addColorBits (unsigned char *out, size_t index, unsigned bits, unsigned in)
 
static void color_tree_init (ColorTree *tree)
 
static void color_tree_cleanup (ColorTree *tree)
 
static int color_tree_get (ColorTree *tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 
static int color_tree_has (ColorTree *tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 
static void color_tree_add (ColorTree *tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a, unsigned index)
 
static unsigned rgba8ToPixel (unsigned char *out, size_t i, const LodePNGColorMode *mode, ColorTree *tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 
static void rgba16ToPixel (unsigned char *out, size_t i, const LodePNGColorMode *mode, unsigned short r, unsigned short g, unsigned short b, unsigned short a)
 
static void getPixelColorRGBA8 (unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a, const unsigned char *in, size_t i, const LodePNGColorMode *mode)
 
static void getPixelColorsRGBA8 (unsigned char *buffer, size_t numpixels, unsigned has_alpha, const unsigned char *in, const LodePNGColorMode *mode)
 
static void getPixelColorRGBA16 (unsigned short *r, unsigned short *g, unsigned short *b, unsigned short *a, const unsigned char *in, size_t i, const LodePNGColorMode *mode)
 
unsigned lodepng_convert (unsigned char *out, const unsigned char *in, LodePNGColorMode *mode_out, const LodePNGColorMode *mode_in, unsigned w, unsigned h)
 
void lodepng_color_profile_init (LodePNGColorProfile *profile)
 
static unsigned getValueRequiredBits (unsigned char value)
 
unsigned get_color_profile (LodePNGColorProfile *profile, const unsigned char *in, unsigned w, unsigned h, const LodePNGColorMode *mode)
 
unsigned lodepng_auto_choose_color (LodePNGColorMode *mode_out, const unsigned char *image, unsigned w, unsigned h, const LodePNGColorMode *mode_in)
 
static unsigned char paethPredictor (short a, short b, short c)
 
static void Adam7_getpassvalues (unsigned passw[7], unsigned passh[7], size_t filter_passstart[8], size_t padded_passstart[8], size_t passstart[8], unsigned w, unsigned h, unsigned bpp)
 
unsigned lodepng_inspect (unsigned *w, unsigned *h, LodePNGState *state, const unsigned char *in, size_t insize)
 
static unsigned unfilterScanline (unsigned char *recon, const unsigned char *scanline, const unsigned char *precon, size_t bytewidth, unsigned char filterType, size_t length)
 
static unsigned unfilter (unsigned char *out, const unsigned char *in, unsigned w, unsigned h, unsigned bpp)
 
static void Adam7_deinterlace (unsigned char *out, const unsigned char *in, unsigned w, unsigned h, unsigned bpp)
 
static void removePaddingBits (unsigned char *out, const unsigned char *in, size_t olinebits, size_t ilinebits, unsigned h)
 
static unsigned postProcessScanlines (unsigned char *out, unsigned char *in, unsigned w, unsigned h, const LodePNGInfo *info_png)
 
static unsigned readChunk_PLTE (LodePNGColorMode *color, const unsigned char *data, size_t chunkLength)
 
static unsigned readChunk_tRNS (LodePNGColorMode *color, const unsigned char *data, size_t chunkLength)
 
static unsigned readChunk_bKGD (LodePNGInfo *info, const unsigned char *data, size_t chunkLength)
 
static unsigned readChunk_tEXt (LodePNGInfo *info, const unsigned char *data, size_t chunkLength)
 
static unsigned readChunk_zTXt (LodePNGInfo *info, const LodePNGDecompressSettings *zlibsettings, const unsigned char *data, size_t chunkLength)
 
static unsigned readChunk_iTXt (LodePNGInfo *info, const LodePNGDecompressSettings *zlibsettings, const unsigned char *data, size_t chunkLength)
 
static unsigned readChunk_tIME (LodePNGInfo *info, const unsigned char *data, size_t chunkLength)
 
static unsigned readChunk_pHYs (LodePNGInfo *info, const unsigned char *data, size_t chunkLength)
 
static void decodeGeneric (unsigned char **out, unsigned *w, unsigned *h, LodePNGState *state, const unsigned char *in, size_t insize)
 
unsigned lodepng_decode (unsigned char **out, unsigned *w, unsigned *h, LodePNGState *state, const unsigned char *in, size_t insize)
 
unsigned lodepng_decode_memory (unsigned char **out, unsigned *w, unsigned *h, const unsigned char *in, size_t insize, LodePNGColorType colortype, unsigned bitdepth)
 
unsigned lodepng_decode32 (unsigned char **out, unsigned *w, unsigned *h, const unsigned char *in, size_t insize)
 
unsigned lodepng_decode24 (unsigned char **out, unsigned *w, unsigned *h, const unsigned char *in, size_t insize)
 
unsigned lodepng_decode_file (unsigned char **out, unsigned *w, unsigned *h, const char *filename, LodePNGColorType colortype, unsigned bitdepth)
 
unsigned lodepng_decode32_file (unsigned char **out, unsigned *w, unsigned *h, const char *filename)
 
unsigned lodepng_decode24_file (unsigned char **out, unsigned *w, unsigned *h, const char *filename)
 
void lodepng_decoder_settings_init (LodePNGDecoderSettings *settings)
 
void lodepng_state_init (LodePNGState *state)
 
void lodepng_state_cleanup (LodePNGState *state)
 
void lodepng_state_copy (LodePNGState *dest, const LodePNGState *source)
 
static unsigned addChunk (ucvector *out, const char *chunkName, const unsigned char *data, size_t length)
 
static unsigned writeSignature (ucvector *out)
 
static unsigned addChunk_IHDR (ucvector *out, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth, unsigned interlace_method)
 
static unsigned addChunk_PLTE (ucvector *out, const LodePNGColorMode *info)
 
static unsigned addChunk_tRNS (ucvector *out, const LodePNGColorMode *info)
 
static unsigned addChunk_IDAT (ucvector *out, const unsigned char *data, size_t datasize, LodePNGCompressSettings *zlibsettings)
 
static unsigned addChunk_IEND (ucvector *out)
 
static unsigned addChunk_tEXt (ucvector *out, const char *keyword, const char *textstring)
 
static unsigned addChunk_zTXt (ucvector *out, const char *keyword, const char *textstring, LodePNGCompressSettings *zlibsettings)
 
static unsigned addChunk_iTXt (ucvector *out, unsigned compressed, const char *keyword, const char *langtag, const char *transkey, const char *textstring, LodePNGCompressSettings *zlibsettings)
 
static unsigned addChunk_bKGD (ucvector *out, const LodePNGInfo *info)
 
static unsigned addChunk_tIME (ucvector *out, const LodePNGTime *time)
 
static unsigned addChunk_pHYs (ucvector *out, const LodePNGInfo *info)
 
static void filterScanline (unsigned char *out, const unsigned char *scanline, const unsigned char *prevline, size_t length, size_t bytewidth, unsigned char filterType)
 
static float flog2 (float f)
 
static unsigned filter (unsigned char *out, const unsigned char *in, unsigned w, unsigned h, const LodePNGColorMode *info, const LodePNGEncoderSettings *settings)
 
static void addPaddingBits (unsigned char *out, const unsigned char *in, size_t olinebits, size_t ilinebits, unsigned h)
 
static void Adam7_interlace (unsigned char *out, const unsigned char *in, unsigned w, unsigned h, unsigned bpp)
 
static unsigned preProcessScanlines (unsigned char **out, size_t *outsize, const unsigned char *in, unsigned w, unsigned h, const LodePNGInfo *info_png, const LodePNGEncoderSettings *settings)
 
static unsigned getPaletteTranslucency (const unsigned char *palette, size_t palettesize)
 
static unsigned addUnknownChunks (ucvector *out, unsigned char *data, size_t datasize)
 
unsigned lodepng_encode (unsigned char **out, size_t *outsize, const unsigned char *image, unsigned w, unsigned h, LodePNGState *state)
 
unsigned lodepng_encode_memory (unsigned char **out, size_t *outsize, const unsigned char *image, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth)
 
unsigned lodepng_encode32 (unsigned char **out, size_t *outsize, const unsigned char *image, unsigned w, unsigned h)
 
unsigned lodepng_encode24 (unsigned char **out, size_t *outsize, const unsigned char *image, unsigned w, unsigned h)
 
unsigned lodepng_encode_file (const char *filename, const unsigned char *image, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth)
 
unsigned lodepng_encode32_file (const char *filename, const unsigned char *image, unsigned w, unsigned h)
 
unsigned lodepng_encode24_file (const char *filename, const unsigned char *image, unsigned w, unsigned h)
 
void lodepng_encoder_settings_init (LodePNGEncoderSettings *settings)
 
const char * lodepng_error_text (unsigned code)
 

Variables

static const unsigned LENGTHBASE [29]
 
static const unsigned LENGTHEXTRA [29]
 
static const unsigned DISTANCEBASE [30]
 
static const unsigned DISTANCEEXTRA [30]
 
static const unsigned CLCL_ORDER [NUM_CODE_LENGTH_CODES]
 
static const size_t MAX_SUPPORTED_DEFLATE_LENGTH = 258
 
static const unsigned HASH_NUM_VALUES = 65536
 
static const unsigned HASH_BIT_MASK
 
const LodePNGCompressSettings lodepng_default_compress_settings
 
const LodePNGDecompressSettings lodepng_default_decompress_settings = { 0, 0, 0, 0 }
 
static unsigned lodepng_crc32_table [256]
 
static const unsigned ADAM7_IX [7] = { 0, 4, 0, 2, 0, 1, 0 }
 
static const unsigned ADAM7_IY [7] = { 0, 0, 4, 0, 2, 0, 1 }
 
static const unsigned ADAM7_DX [7] = { 8, 8, 4, 4, 2, 2, 1 }
 
static const unsigned ADAM7_DY [7] = { 8, 8, 8, 4, 4, 2, 2 }
 

Macro Definition Documentation

◆ CERROR_BREAK

#define CERROR_BREAK (   errorvar,
  code 
)
Value:
{ \
errorvar = code; \
break; \
}
UINT32 code
Definition: include/freerdp/event.h:68

◆ CERROR_RETURN_ERROR

#define CERROR_RETURN_ERROR (   errorvar,
  code 
)
Value:
do \
{ \
errorvar = code; \
return code; \
} while (0)

◆ CERROR_TRY_RETURN

#define CERROR_TRY_RETURN (   call)
Value:
do \
{ \
unsigned error = call; \
if (error) \
return error; \
} while (0)

◆ DEFAULT_WINDOWSIZE

#define DEFAULT_WINDOWSIZE   2048

◆ ERROR_BREAK

#define ERROR_BREAK (   code)    CERROR_BREAK(error, code)

◆ FIRST_LENGTH_CODE_INDEX

#define FIRST_LENGTH_CODE_INDEX   257

◆ LAST_LENGTH_CODE_INDEX

#define LAST_LENGTH_CODE_INDEX   285

◆ NUM_CODE_LENGTH_CODES

#define NUM_CODE_LENGTH_CODES   19

◆ NUM_DEFLATE_CODE_SYMBOLS

#define NUM_DEFLATE_CODE_SYMBOLS   288

◆ NUM_DISTANCE_SYMBOLS

#define NUM_DISTANCE_SYMBOLS   32

◆ READBIT

#define READBIT (   bitpointer,
  bitstream 
)     ((bitstream[bitpointer >> 3] >> (bitpointer & 0x7)) & (unsigned char)1)

◆ VERSION_STRING

#define VERSION_STRING   "20140823"

Function Documentation

◆ Adam7_deinterlace()

static void Adam7_deinterlace ( unsigned char *  out,
const unsigned char *  in,
unsigned  w,
unsigned  h,
unsigned  bpp 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Adam7_getpassvalues()

static void Adam7_getpassvalues ( unsigned  passw[7],
unsigned  passh[7],
size_t  filter_passstart[8],
size_t  padded_passstart[8],
size_t  passstart[8],
unsigned  w,
unsigned  h,
unsigned  bpp 
)
static
Here is the caller graph for this function:

◆ Adam7_interlace()

static void Adam7_interlace ( unsigned char *  out,
const unsigned char *  in,
unsigned  w,
unsigned  h,
unsigned  bpp 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_coins()

static void add_coins ( Coin *  c1,
const Coin *  c2 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addBitsToStream()

static void addBitsToStream ( size_t *  bitpointer,
ucvector *  bitstream,
unsigned  value,
size_t  nbits 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addBitsToStreamReversed()

static void addBitsToStreamReversed ( size_t *  bitpointer,
ucvector *  bitstream,
unsigned  value,
size_t  nbits 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addBitToStream()

static int addBitToStream ( size_t *  bitpointer,
ucvector *  bitstream,
unsigned char  bit 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk()

static unsigned addChunk ( ucvector *  out,
const char *  chunkName,
const unsigned char *  data,
size_t  length 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_bKGD()

static unsigned addChunk_bKGD ( ucvector *  out,
const LodePNGInfo info 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_IDAT()

static unsigned addChunk_IDAT ( ucvector *  out,
const unsigned char *  data,
size_t  datasize,
LodePNGCompressSettings zlibsettings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_IEND()

static unsigned addChunk_IEND ( ucvector *  out)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_IHDR()

static unsigned addChunk_IHDR ( ucvector *  out,
unsigned  w,
unsigned  h,
LodePNGColorType  colortype,
unsigned  bitdepth,
unsigned  interlace_method 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_iTXt()

static unsigned addChunk_iTXt ( ucvector *  out,
unsigned  compressed,
const char *  keyword,
const char *  langtag,
const char *  transkey,
const char *  textstring,
LodePNGCompressSettings zlibsettings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_pHYs()

static unsigned addChunk_pHYs ( ucvector *  out,
const LodePNGInfo info 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_PLTE()

static unsigned addChunk_PLTE ( ucvector *  out,
const LodePNGColorMode info 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_tEXt()

static unsigned addChunk_tEXt ( ucvector *  out,
const char *  keyword,
const char *  textstring 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_tIME()

static unsigned addChunk_tIME ( ucvector *  out,
const LodePNGTime time 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_tRNS()

static unsigned addChunk_tRNS ( ucvector *  out,
const LodePNGColorMode info 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addChunk_zTXt()

static unsigned addChunk_zTXt ( ucvector *  out,
const char *  keyword,
const char *  textstring,
LodePNGCompressSettings zlibsettings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addColorBits()

static void addColorBits ( unsigned char *  out,
size_t  index,
unsigned  bits,
unsigned  in 
)
static
Here is the caller graph for this function:

◆ addHuffmanSymbol()

static void addHuffmanSymbol ( size_t *  bp,
ucvector *  compressed,
unsigned  code,
unsigned  bitlen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addLengthDistance()

static void addLengthDistance ( uivector *  values,
size_t  length,
size_t  distance 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addPaddingBits()

static void addPaddingBits ( unsigned char *  out,
const unsigned char *  in,
size_t  olinebits,
size_t  ilinebits,
unsigned  h 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addUnknownChunks()

static unsigned addUnknownChunks ( ucvector *  out,
unsigned char *  data,
size_t  datasize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ adler32()

static unsigned adler32 ( const unsigned char *  data,
unsigned  len 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ append_symbol_coins()

static unsigned append_symbol_coins ( Coin *  coins,
const unsigned *  frequencies,
unsigned  numcodes,
size_t  sum 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkColorValidity()

static unsigned checkColorValidity ( LodePNGColorType  colortype,
unsigned  bd 
)
static
Here is the caller graph for this function:

◆ cleanup_coins()

static void cleanup_coins ( Coin *  coins,
size_t  num 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ coin_cleanup()

static void coin_cleanup ( void *  c)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ coin_compare()

static int coin_compare ( const void *  a,
const void *  b 
)
static
Here is the caller graph for this function:

◆ coin_copy()

static void coin_copy ( Coin *  c1,
const Coin *  c2 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ coin_init()

static void coin_init ( Coin *  c)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ color_tree_add()

static void color_tree_add ( ColorTree *  tree,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a,
unsigned  index 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ color_tree_cleanup()

static void color_tree_cleanup ( ColorTree *  tree)
static
Here is the caller graph for this function:

◆ color_tree_get()

static int color_tree_get ( ColorTree *  tree,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)
static
Here is the caller graph for this function:

◆ color_tree_has()

static int color_tree_has ( ColorTree *  tree,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ color_tree_init()

static void color_tree_init ( ColorTree *  tree)
static
Here is the caller graph for this function:

◆ countZeros()

static unsigned countZeros ( const unsigned char *  data,
size_t  size,
size_t  pos 
)
static
Here is the caller graph for this function:

◆ decodeGeneric()

static void decodeGeneric ( unsigned char **  out,
unsigned *  w,
unsigned *  h,
LodePNGState state,
const unsigned char *  in,
size_t  insize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deflate()

static unsigned deflate ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  in,
size_t  insize,
const LodePNGCompressSettings settings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deflateDynamic()

static unsigned deflateDynamic ( ucvector *  out,
size_t *  bp,
Hash *  hash,
const unsigned char *  data,
size_t  datapos,
size_t  dataend,
const LodePNGCompressSettings settings,
unsigned  final 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deflateFixed()

static unsigned deflateFixed ( ucvector *  out,
size_t *  bp,
Hash *  hash,
const unsigned char *  data,
size_t  datapos,
size_t  dataend,
const LodePNGCompressSettings settings,
unsigned  final 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deflateNoCompression()

static unsigned deflateNoCompression ( ucvector *  out,
const unsigned char *  data,
size_t  datasize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ encodeLZ77()

static unsigned encodeLZ77 ( uivector *  out,
Hash *  hash,
const unsigned char *  in,
size_t  inpos,
size_t  insize,
unsigned  windowsize,
unsigned  minmatch,
unsigned  nicematch,
unsigned  lazymatching 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filter()

static unsigned filter ( unsigned char *  out,
const unsigned char *  in,
unsigned  w,
unsigned  h,
const LodePNGColorMode info,
const LodePNGEncoderSettings settings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filterScanline()

static void filterScanline ( unsigned char *  out,
const unsigned char *  scanline,
const unsigned char *  prevline,
size_t  length,
size_t  bytewidth,
unsigned char  filterType 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flog2()

static float flog2 ( float  f)
static
Here is the caller graph for this function:

◆ generateFixedDistanceTree()

static unsigned generateFixedDistanceTree ( HuffmanTree *  tree)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateFixedLitLenTree()

static unsigned generateFixedLitLenTree ( HuffmanTree *  tree)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_color_profile()

unsigned get_color_profile ( LodePNGColorProfile profile,
const unsigned char *  in,
unsigned  w,
unsigned  h,
const LodePNGColorMode mode 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHash()

static unsigned getHash ( const unsigned char *  data,
size_t  size,
size_t  pos 
)
static
Here is the caller graph for this function:

◆ getNumColorChannels()

static unsigned getNumColorChannels ( LodePNGColorType  colortype)
static
Here is the caller graph for this function:

◆ getPaletteTranslucency()

static unsigned getPaletteTranslucency ( const unsigned char *  palette,
size_t  palettesize 
)
static
Here is the caller graph for this function:

◆ getPixelColorRGBA16()

static void getPixelColorRGBA16 ( unsigned short *  r,
unsigned short *  g,
unsigned short *  b,
unsigned short *  a,
const unsigned char *  in,
size_t  i,
const LodePNGColorMode mode 
)
static
Here is the caller graph for this function:

◆ getPixelColorRGBA8()

static void getPixelColorRGBA8 ( unsigned char *  r,
unsigned char *  g,
unsigned char *  b,
unsigned char *  a,
const unsigned char *  in,
size_t  i,
const LodePNGColorMode mode 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPixelColorsRGBA8()

static void getPixelColorsRGBA8 ( unsigned char *  buffer,
size_t  numpixels,
unsigned  has_alpha,
const unsigned char *  in,
const LodePNGColorMode mode 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTreeInflateDynamic()

static unsigned getTreeInflateDynamic ( HuffmanTree *  tree_ll,
HuffmanTree *  tree_d,
const unsigned char *  in,
size_t *  bp,
size_t  inlength 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTreeInflateFixed()

static int getTreeInflateFixed ( HuffmanTree *  tree_ll,
HuffmanTree *  tree_d 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getValueRequiredBits()

static unsigned getValueRequiredBits ( unsigned char  value)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash_cleanup()

static void hash_cleanup ( Hash *  hash)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash_init()

static unsigned hash_init ( Hash *  hash,
unsigned  windowsize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ huffmanDecodeSymbol()

static unsigned huffmanDecodeSymbol ( const unsigned char *  in,
size_t *  bp,
const HuffmanTree *  codetree,
size_t  inbitlength 
)
static
Here is the caller graph for this function:

◆ HuffmanTree_cleanup()

static void HuffmanTree_cleanup ( HuffmanTree *  tree)
static
Here is the caller graph for this function:

◆ HuffmanTree_getCode()

static unsigned HuffmanTree_getCode ( const HuffmanTree *  tree,
unsigned  index 
)
static
Here is the caller graph for this function:

◆ HuffmanTree_getLength()

static unsigned HuffmanTree_getLength ( const HuffmanTree *  tree,
unsigned  index 
)
static
Here is the caller graph for this function:

◆ HuffmanTree_init()

static void HuffmanTree_init ( HuffmanTree *  tree)
static
Here is the caller graph for this function:

◆ HuffmanTree_make2DTree()

static unsigned HuffmanTree_make2DTree ( HuffmanTree *  tree)
static
Here is the caller graph for this function:

◆ HuffmanTree_makeFromFrequencies()

static unsigned HuffmanTree_makeFromFrequencies ( HuffmanTree *  tree,
const unsigned *  frequencies,
size_t  mincodes,
size_t  numcodes,
unsigned  maxbitlen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HuffmanTree_makeFromLengths()

static unsigned HuffmanTree_makeFromLengths ( HuffmanTree *  tree,
const unsigned *  bitlen,
size_t  numcodes,
unsigned  maxbitlen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HuffmanTree_makeFromLengths2()

static unsigned HuffmanTree_makeFromLengths2 ( HuffmanTree *  tree)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ inflate()

static unsigned inflate ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  in,
size_t  insize,
const LodePNGDecompressSettings settings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ inflateHuffmanBlock()

static unsigned inflateHuffmanBlock ( ucvector *  out,
const unsigned char *  in,
size_t *  bp,
size_t *  pos,
size_t  inlength,
unsigned  btype 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ inflateNoCompression()

static unsigned inflateNoCompression ( ucvector *  out,
const unsigned char *  in,
size_t *  bp,
size_t *  pos,
size_t  inlength 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_coins()

static void init_coins ( Coin *  coins,
size_t  num 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_add32bitInt()

static int lodepng_add32bitInt ( ucvector *  buffer,
unsigned  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_add_itext()

unsigned lodepng_add_itext ( LodePNGInfo info,
const char *  key,
const char *  langtag,
const char *  transkey,
const char *  str 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_add_text()

unsigned lodepng_add_text ( LodePNGInfo info,
const char *  key,
const char *  str 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_auto_choose_color()

unsigned lodepng_auto_choose_color ( LodePNGColorMode mode_out,
const unsigned char *  image,
unsigned  w,
unsigned  h,
const LodePNGColorMode mode_in 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_can_have_alpha()

unsigned lodepng_can_have_alpha ( const LodePNGColorMode info)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_chunk_ancillary()

unsigned char lodepng_chunk_ancillary ( const unsigned char *  chunk)
Here is the caller graph for this function:

◆ lodepng_chunk_append()

unsigned lodepng_chunk_append ( unsigned char **  out,
size_t *  outlength,
const unsigned char *  chunk 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_chunk_check_crc()

unsigned lodepng_chunk_check_crc ( const unsigned char *  chunk)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_chunk_create()

unsigned lodepng_chunk_create ( unsigned char **  out,
size_t *  outlength,
unsigned  length,
const char *  type,
const unsigned char *  data 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_chunk_data()

unsigned char* lodepng_chunk_data ( unsigned char *  chunk)

◆ lodepng_chunk_data_const()

const unsigned char* lodepng_chunk_data_const ( const unsigned char *  chunk)
Here is the caller graph for this function:

◆ lodepng_chunk_generate_crc()

void lodepng_chunk_generate_crc ( unsigned char *  chunk)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_chunk_length()

unsigned lodepng_chunk_length ( const unsigned char *  chunk)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_chunk_next()

unsigned char* lodepng_chunk_next ( unsigned char *  chunk)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_chunk_next_const()

const unsigned char* lodepng_chunk_next_const ( const unsigned char *  chunk)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_chunk_private()

unsigned char lodepng_chunk_private ( const unsigned char *  chunk)

◆ lodepng_chunk_safetocopy()

unsigned char lodepng_chunk_safetocopy ( const unsigned char *  chunk)

◆ lodepng_chunk_type()

void lodepng_chunk_type ( char  type[5],
const unsigned char *  chunk 
)

◆ lodepng_chunk_type_equals()

unsigned char lodepng_chunk_type_equals ( const unsigned char *  chunk,
const char *  type 
)
Here is the caller graph for this function:

◆ lodepng_clear_itext()

void lodepng_clear_itext ( LodePNGInfo info)
Here is the call graph for this function:

◆ lodepng_clear_text()

void lodepng_clear_text ( LodePNGInfo info)
Here is the call graph for this function:

◆ lodepng_color_mode_cleanup()

void lodepng_color_mode_cleanup ( LodePNGColorMode info)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_color_mode_copy()

unsigned lodepng_color_mode_copy ( LodePNGColorMode dest,
const LodePNGColorMode source 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_color_mode_equal()

static int lodepng_color_mode_equal ( const LodePNGColorMode a,
const LodePNGColorMode b 
)
static
Here is the caller graph for this function:

◆ lodepng_color_mode_init()

void lodepng_color_mode_init ( LodePNGColorMode info)
Here is the caller graph for this function:

◆ lodepng_color_profile_init()

void lodepng_color_profile_init ( LodePNGColorProfile profile)
Here is the caller graph for this function:

◆ lodepng_compress_settings_init()

void lodepng_compress_settings_init ( LodePNGCompressSettings settings)
Here is the caller graph for this function:

◆ lodepng_convert()

unsigned lodepng_convert ( unsigned char *  out,
const unsigned char *  in,
LodePNGColorMode mode_out,
const LodePNGColorMode mode_in,
unsigned  w,
unsigned  h 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_crc32()

unsigned lodepng_crc32 ( const unsigned char *  buf,
size_t  len 
)
Here is the caller graph for this function:

◆ lodepng_decode()

unsigned lodepng_decode ( unsigned char **  out,
unsigned *  w,
unsigned *  h,
LodePNGState state,
const unsigned char *  in,
size_t  insize 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_decode24()

unsigned lodepng_decode24 ( unsigned char **  out,
unsigned *  w,
unsigned *  h,
const unsigned char *  in,
size_t  insize 
)
Here is the call graph for this function:

◆ lodepng_decode24_file()

unsigned lodepng_decode24_file ( unsigned char **  out,
unsigned *  w,
unsigned *  h,
const char *  filename 
)
Here is the call graph for this function:

◆ lodepng_decode32()

unsigned lodepng_decode32 ( unsigned char **  out,
unsigned *  w,
unsigned *  h,
const unsigned char *  in,
size_t  insize 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_decode32_file()

unsigned lodepng_decode32_file ( unsigned char **  out,
unsigned *  w,
unsigned *  h,
const char *  filename 
)
Here is the call graph for this function:

◆ lodepng_decode_file()

unsigned lodepng_decode_file ( unsigned char **  out,
unsigned *  w,
unsigned *  h,
const char *  filename,
LodePNGColorType  colortype,
unsigned  bitdepth 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_decode_memory()

unsigned lodepng_decode_memory ( unsigned char **  out,
unsigned *  w,
unsigned *  h,
const unsigned char *  in,
size_t  insize,
LodePNGColorType  colortype,
unsigned  bitdepth 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_decoder_settings_init()

void lodepng_decoder_settings_init ( LodePNGDecoderSettings settings)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_decompress_settings_init()

void lodepng_decompress_settings_init ( LodePNGDecompressSettings settings)
Here is the caller graph for this function:

◆ lodepng_deflate()

unsigned lodepng_deflate ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  in,
size_t  insize,
const LodePNGCompressSettings settings 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_deflatev()

static unsigned lodepng_deflatev ( ucvector *  out,
const unsigned char *  in,
size_t  insize,
const LodePNGCompressSettings settings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_encode()

unsigned lodepng_encode ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  image,
unsigned  w,
unsigned  h,
LodePNGState state 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_encode24()

unsigned lodepng_encode24 ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  image,
unsigned  w,
unsigned  h 
)
Here is the call graph for this function:

◆ lodepng_encode24_file()

unsigned lodepng_encode24_file ( const char *  filename,
const unsigned char *  image,
unsigned  w,
unsigned  h 
)
Here is the call graph for this function:

◆ lodepng_encode32()

unsigned lodepng_encode32 ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  image,
unsigned  w,
unsigned  h 
)
Here is the call graph for this function:

◆ lodepng_encode32_file()

unsigned lodepng_encode32_file ( const char *  filename,
const unsigned char *  image,
unsigned  w,
unsigned  h 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_encode_file()

unsigned lodepng_encode_file ( const char *  filename,
const unsigned char *  image,
unsigned  w,
unsigned  h,
LodePNGColorType  colortype,
unsigned  bitdepth 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_encode_memory()

unsigned lodepng_encode_memory ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  image,
unsigned  w,
unsigned  h,
LodePNGColorType  colortype,
unsigned  bitdepth 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_encoder_settings_init()

void lodepng_encoder_settings_init ( LodePNGEncoderSettings settings)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_error_text()

const char* lodepng_error_text ( unsigned  code)

◆ lodepng_get_bpp()

unsigned lodepng_get_bpp ( const LodePNGColorMode info)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_get_bpp_lct()

static unsigned lodepng_get_bpp_lct ( LodePNGColorType  colortype,
unsigned  bitdepth 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_get_channels()

unsigned lodepng_get_channels ( const LodePNGColorMode info)
Here is the call graph for this function:

◆ lodepng_get_raw_size()

size_t lodepng_get_raw_size ( unsigned  w,
unsigned  h,
const LodePNGColorMode color 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_get_raw_size_idat()

static size_t lodepng_get_raw_size_idat ( unsigned  w,
unsigned  h,
const LodePNGColorMode color 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_has_palette_alpha()

unsigned lodepng_has_palette_alpha ( const LodePNGColorMode info)
Here is the caller graph for this function:

◆ lodepng_huffman_code_lengths()

unsigned lodepng_huffman_code_lengths ( unsigned *  lengths,
const unsigned *  frequencies,
size_t  numcodes,
unsigned  maxbitlen 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_inflate()

unsigned lodepng_inflate ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  in,
size_t  insize,
const LodePNGDecompressSettings settings 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_inflatev()

static unsigned lodepng_inflatev ( ucvector *  out,
const unsigned char *  in,
size_t  insize,
const LodePNGDecompressSettings settings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_info_cleanup()

void lodepng_info_cleanup ( LodePNGInfo info)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_info_copy()

unsigned lodepng_info_copy ( LodePNGInfo dest,
const LodePNGInfo source 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_info_init()

void lodepng_info_init ( LodePNGInfo info)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_inspect()

unsigned lodepng_inspect ( unsigned *  w,
unsigned *  h,
LodePNGState state,
const unsigned char *  in,
size_t  insize 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_is_alpha_type()

unsigned lodepng_is_alpha_type ( const LodePNGColorMode info)
Here is the caller graph for this function:

◆ lodepng_is_greyscale_type()

unsigned lodepng_is_greyscale_type ( const LodePNGColorMode info)
Here is the caller graph for this function:

◆ lodepng_is_palette_type()

unsigned lodepng_is_palette_type ( const LodePNGColorMode info)

◆ lodepng_load_file()

unsigned lodepng_load_file ( unsigned char **  out,
size_t *  outsize,
const char *  filename 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_palette_add()

unsigned lodepng_palette_add ( LodePNGColorMode info,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)
Here is the caller graph for this function:

◆ lodepng_palette_clear()

void lodepng_palette_clear ( LodePNGColorMode info)
Here is the caller graph for this function:

◆ lodepng_read32bitInt()

static unsigned lodepng_read32bitInt ( const unsigned char *  buffer)
static
Here is the caller graph for this function:

◆ lodepng_save_file()

unsigned lodepng_save_file ( const unsigned char *  buffer,
size_t  buffersize,
const char *  filename 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_set32bitInt()

static void lodepng_set32bitInt ( unsigned char *  buffer,
unsigned  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_state_cleanup()

void lodepng_state_cleanup ( LodePNGState state)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_state_copy()

void lodepng_state_copy ( LodePNGState dest,
const LodePNGState source 
)
Here is the call graph for this function:

◆ lodepng_state_init()

void lodepng_state_init ( LodePNGState state)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_zlib_compress()

unsigned lodepng_zlib_compress ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  in,
size_t  insize,
const LodePNGCompressSettings settings 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lodepng_zlib_decompress()

unsigned lodepng_zlib_decompress ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  in,
size_t  insize,
const LodePNGDecompressSettings settings 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LodePNGIText_cleanup()

static void LodePNGIText_cleanup ( LodePNGInfo info)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LodePNGIText_copy()

static unsigned LodePNGIText_copy ( LodePNGInfo dest,
const LodePNGInfo source 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LodePNGIText_init()

static void LodePNGIText_init ( LodePNGInfo info)
static
Here is the caller graph for this function:

◆ LodePNGText_cleanup()

static void LodePNGText_cleanup ( LodePNGInfo info)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LodePNGText_copy()

static unsigned LodePNGText_copy ( LodePNGInfo dest,
const LodePNGInfo source 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LodePNGText_init()

static void LodePNGText_init ( LodePNGInfo info)
static
Here is the caller graph for this function:

◆ LodePNGUnknownChunks_cleanup()

static void LodePNGUnknownChunks_cleanup ( LodePNGInfo info)
static
Here is the caller graph for this function:

◆ LodePNGUnknownChunks_copy()

static unsigned LodePNGUnknownChunks_copy ( LodePNGInfo dest,
const LodePNGInfo src 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LodePNGUnknownChunks_init()

static void LodePNGUnknownChunks_init ( LodePNGInfo info)
static
Here is the caller graph for this function:

◆ paethPredictor()

static unsigned char paethPredictor ( short  a,
short  b,
short  c 
)
static
Here is the caller graph for this function:

◆ postProcessScanlines()

static unsigned postProcessScanlines ( unsigned char *  out,
unsigned char *  in,
unsigned  w,
unsigned  h,
const LodePNGInfo info_png 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ preProcessScanlines()

static unsigned preProcessScanlines ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  in,
unsigned  w,
unsigned  h,
const LodePNGInfo info_png,
const LodePNGEncoderSettings settings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readBitFromReversedStream()

static unsigned char readBitFromReversedStream ( size_t *  bitpointer,
const unsigned char *  bitstream 
)
static
Here is the caller graph for this function:

◆ readBitFromStream()

static unsigned char readBitFromStream ( size_t *  bitpointer,
const unsigned char *  bitstream 
)
static
Here is the caller graph for this function:

◆ readBitsFromReversedStream()

static unsigned readBitsFromReversedStream ( size_t *  bitpointer,
const unsigned char *  bitstream,
size_t  nbits 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readBitsFromStream()

static unsigned readBitsFromStream ( size_t *  bitpointer,
const unsigned char *  bitstream,
size_t  nbits 
)
static
Here is the caller graph for this function:

◆ readChunk_bKGD()

static unsigned readChunk_bKGD ( LodePNGInfo info,
const unsigned char *  data,
size_t  chunkLength 
)
static
Here is the caller graph for this function:

◆ readChunk_iTXt()

static unsigned readChunk_iTXt ( LodePNGInfo info,
const LodePNGDecompressSettings zlibsettings,
const unsigned char *  data,
size_t  chunkLength 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readChunk_pHYs()

static unsigned readChunk_pHYs ( LodePNGInfo info,
const unsigned char *  data,
size_t  chunkLength 
)
static
Here is the caller graph for this function:

◆ readChunk_PLTE()

static unsigned readChunk_PLTE ( LodePNGColorMode color,
const unsigned char *  data,
size_t  chunkLength 
)
static
Here is the caller graph for this function:

◆ readChunk_tEXt()

static unsigned readChunk_tEXt ( LodePNGInfo info,
const unsigned char *  data,
size_t  chunkLength 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readChunk_tIME()

static unsigned readChunk_tIME ( LodePNGInfo info,
const unsigned char *  data,
size_t  chunkLength 
)
static
Here is the caller graph for this function:

◆ readChunk_tRNS()

static unsigned readChunk_tRNS ( LodePNGColorMode color,
const unsigned char *  data,
size_t  chunkLength 
)
static
Here is the caller graph for this function:

◆ readChunk_zTXt()

static unsigned readChunk_zTXt ( LodePNGInfo info,
const LodePNGDecompressSettings zlibsettings,
const unsigned char *  data,
size_t  chunkLength 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removePaddingBits()

static void removePaddingBits ( unsigned char *  out,
const unsigned char *  in,
size_t  olinebits,
size_t  ilinebits,
unsigned  h 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rgba16ToPixel()

static void rgba16ToPixel ( unsigned char *  out,
size_t  i,
const LodePNGColorMode mode,
unsigned short  r,
unsigned short  g,
unsigned short  b,
unsigned short  a 
)
static
Here is the caller graph for this function:

◆ rgba8ToPixel()

static unsigned rgba8ToPixel ( unsigned char *  out,
size_t  i,
const LodePNGColorMode mode,
ColorTree *  tree,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ searchCodeIndex()

static size_t searchCodeIndex ( const unsigned *  array,
size_t  array_size,
size_t  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBitOfReversedStream()

static void setBitOfReversedStream ( size_t *  bitpointer,
unsigned char *  bitstream,
unsigned char  bit 
)
static
Here is the caller graph for this function:

◆ setBitOfReversedStream0()

static void setBitOfReversedStream0 ( size_t *  bitpointer,
unsigned char *  bitstream,
unsigned char  bit 
)
static
Here is the caller graph for this function:

◆ string_cleanup()

static void string_cleanup ( char **  out)
static
Here is the caller graph for this function:

◆ string_init()

static void string_init ( char **  out)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ string_resize()

static unsigned string_resize ( char **  out,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ string_set()

static void string_set ( char **  out,
const char *  in 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ucvector_cleanup()

static void ucvector_cleanup ( void *  p)
static
Here is the caller graph for this function:

◆ ucvector_init()

static void ucvector_init ( ucvector *  p)
static
Here is the caller graph for this function:

◆ ucvector_init_buffer()

static void ucvector_init_buffer ( ucvector *  p,
unsigned char *  buffer,
size_t  size 
)
static
Here is the caller graph for this function:

◆ ucvector_push_back()

static unsigned ucvector_push_back ( ucvector *  p,
unsigned char  c 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ucvector_reserve()

static unsigned ucvector_reserve ( ucvector *  p,
size_t  allocsize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ucvector_resize()

static unsigned ucvector_resize ( ucvector *  p,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ucvector_resizev()

static unsigned ucvector_resizev ( ucvector *  p,
size_t  size,
unsigned char  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uivector_cleanup()

static void uivector_cleanup ( void *  p)
static
Here is the caller graph for this function:

◆ uivector_copy()

static unsigned uivector_copy ( uivector *  p,
const uivector *  q 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uivector_init()

static void uivector_init ( uivector *  p)
static
Here is the caller graph for this function:

◆ uivector_push_back()

static unsigned uivector_push_back ( uivector *  p,
unsigned  c 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uivector_reserve()

static unsigned uivector_reserve ( uivector *  p,
size_t  allocsize 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uivector_resize()

static unsigned uivector_resize ( uivector *  p,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uivector_resizev()

static unsigned uivector_resizev ( uivector *  p,
size_t  size,
unsigned  value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unfilter()

static unsigned unfilter ( unsigned char *  out,
const unsigned char *  in,
unsigned  w,
unsigned  h,
unsigned  bpp 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unfilterScanline()

static unsigned unfilterScanline ( unsigned char *  recon,
const unsigned char *  scanline,
const unsigned char *  precon,
size_t  bytewidth,
unsigned char  filterType,
size_t  length 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_adler32()

static unsigned update_adler32 ( unsigned  adler,
const unsigned char *  data,
unsigned  len 
)
static
Here is the caller graph for this function:

◆ updateHashChain()

static void updateHashChain ( Hash *  hash,
size_t  wpos,
unsigned  hashval,
unsigned short  numzeros 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeLZ77data()

static void writeLZ77data ( size_t *  bp,
ucvector *  out,
const uivector *  lz77_encoded,
const HuffmanTree *  tree_ll,
const HuffmanTree *  tree_d 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeSignature()

static unsigned writeSignature ( ucvector *  out)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zlib_compress()

static unsigned zlib_compress ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  in,
size_t  insize,
const LodePNGCompressSettings settings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zlib_decompress()

static unsigned zlib_decompress ( unsigned char **  out,
size_t *  outsize,
const unsigned char *  in,
size_t  insize,
const LodePNGDecompressSettings settings 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ADAM7_DX

const unsigned ADAM7_DX[7] = { 8, 8, 4, 4, 2, 2, 1 }
static

◆ ADAM7_DY

const unsigned ADAM7_DY[7] = { 8, 8, 8, 4, 4, 2, 2 }
static

◆ ADAM7_IX

const unsigned ADAM7_IX[7] = { 0, 4, 0, 2, 0, 1, 0 }
static

◆ ADAM7_IY

const unsigned ADAM7_IY[7] = { 0, 0, 4, 0, 2, 0, 1 }
static

◆ CLCL_ORDER

const unsigned CLCL_ORDER[NUM_CODE_LENGTH_CODES]
static
Initial value:
= { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
11, 4, 12, 3, 13, 2, 14, 1, 15 }

◆ DISTANCEBASE

const unsigned DISTANCEBASE[30]
static
Initial value:
= { 1, 2, 3, 4, 5, 7, 9, 13,
17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073,
4097, 6145, 8193, 12289, 16385, 24577 }

◆ DISTANCEEXTRA

const unsigned DISTANCEEXTRA[30]
static
Initial value:
= { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6,
6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 }

◆ HASH_BIT_MASK

const unsigned HASH_BIT_MASK
static
Initial value:
=
65535

◆ HASH_NUM_VALUES

const unsigned HASH_NUM_VALUES = 65536
static

◆ LENGTHBASE

const unsigned LENGTHBASE[29]
static
Initial value:
= { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13,
15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
67, 83, 99, 115, 131, 163, 195, 227, 258 }

◆ LENGTHEXTRA

const unsigned LENGTHEXTRA[29]
static
Initial value:
= { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2,
2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 }

◆ lodepng_crc32_table

unsigned lodepng_crc32_table[256]
static

◆ lodepng_default_compress_settings

const LodePNGCompressSettings lodepng_default_compress_settings
Initial value:
3, 128, 1,
0, 0, 0 }
#define DEFAULT_WINDOWSIZE
Definition: lodepng.c:2532

◆ lodepng_default_decompress_settings

const LodePNGDecompressSettings lodepng_default_decompress_settings = { 0, 0, 0, 0 }

◆ MAX_SUPPORTED_DEFLATE_LENGTH

const size_t MAX_SUPPORTED_DEFLATE_LENGTH = 258
static