#include "lodepng.h"
Data Structures | |
struct | HuffmanTree |
struct | ucvector |
struct | uivector |
Macros | |
#define | FIRST_LENGTH_CODE_INDEX 257 |
#define | LAST_LENGTH_CODE_INDEX 285 |
#define | NUM_CODE_LENGTH_CODES 19 /*the code length codes. 0-15: code lengths, 16: copy previous 3-6 times, 17: 3-10 zeros, 18: 11-138 zeros*/ |
#define | NUM_DEFLATE_CODE_SYMBOLS 288 /*256 literals, the end code, some length codes, and 2 unused codes*/ |
#define | NUM_DISTANCE_SYMBOLS 32 /*the distance codes have their own symbols, 30 used, 2 unused*/ |
#define | VERSION_STRING "20100314" |
Typedefs | |
typedef struct HuffmanTree | HuffmanTree |
typedef struct ucvector | ucvector |
typedef struct uivector | uivector |
Functions | |
static void | Adam7_deinterlace (unsigned char *out, const unsigned char *in, unsigned w, unsigned h, unsigned bpp) |
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 unsigned | adler32 (const unsigned char *data, unsigned len) |
static unsigned | checkColorValidity (unsigned colorType, unsigned bd) |
static unsigned | Crc32_crc (const unsigned char *buf, size_t len) |
static void | Crc32_make_crc_table (void) |
static unsigned | Crc32_update_crc (const unsigned char *buf, unsigned crc, size_t len) |
static void | decodeGeneric (LodePNG_Decoder *decoder, unsigned char **out, size_t *outsize, const unsigned char *in, size_t size) |
static unsigned | generateDistanceTree (HuffmanTree *tree) |
static unsigned | generateFixedTree (HuffmanTree *tree) |
static unsigned | getBpp (unsigned colorType, unsigned bitDepth) |
static unsigned | getNumColorChannels (unsigned colorType) |
static unsigned | getTreeInflateDynamic (HuffmanTree *codetree, HuffmanTree *codetreeD, HuffmanTree *codelengthcodetree, const unsigned char *in, size_t *bp, size_t inlength) |
static void | getTreeInflateFixed (HuffmanTree *tree, HuffmanTree *treeD) |
static unsigned | huffmanDecodeSymbol (unsigned int *error, const unsigned char *in, size_t *bp, const HuffmanTree *codetree, size_t inlength) |
static void | HuffmanTree_cleanup (HuffmanTree *tree) |
static unsigned | HuffmanTree_decode (const HuffmanTree *tree, unsigned *decoded, unsigned *result, unsigned *treepos, unsigned char bit) |
static void | HuffmanTree_init (HuffmanTree *tree) |
static unsigned | HuffmanTree_make2DTree (HuffmanTree *tree) |
static unsigned | HuffmanTree_makeFromLengths (HuffmanTree *tree, const unsigned *bitlen, size_t numcodes, unsigned maxbitlen) |
static unsigned | HuffmanTree_makeFromLengths2 (HuffmanTree *tree) |
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) |
unsigned | LodeFlate_inflate (ucvector *out, const unsigned char *in, size_t insize, size_t inpos) |
unsigned | LodePNG_append_chunk (unsigned char **out, size_t *outlength, const unsigned char *chunk) |
unsigned | LodePNG_chunk_check_crc (const unsigned char *chunk) |
unsigned char | LodePNG_chunk_critical (const unsigned char *chunk) |
unsigned char * | LodePNG_chunk_data (unsigned char *chunk) |
const unsigned char * | LodePNG_chunk_data_const (const unsigned char *chunk) |
void | LodePNG_chunk_generate_crc (unsigned char *chunk) |
unsigned | LodePNG_chunk_length (const unsigned char *chunk) |
unsigned char * | LodePNG_chunk_next (unsigned char *chunk) |
const unsigned char * | LodePNG_chunk_next_const (const unsigned char *chunk) |
unsigned char | LodePNG_chunk_private (const unsigned char *chunk) |
unsigned char | LodePNG_chunk_safetocopy (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 | LodePNG_convert (unsigned char *out, const unsigned char *in, LodePNG_InfoColor *infoOut, LodePNG_InfoColor *infoIn, unsigned w, unsigned h) |
unsigned | LodePNG_create_chunk (unsigned char **out, size_t *outlength, unsigned length, const char *type, const unsigned char *data) |
void | LodePNG_decode (LodePNG_Decoder *decoder, unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize) |
unsigned | LodePNG_decode32 (unsigned char **out, unsigned *w, unsigned *h, const unsigned char *in, size_t insize) |
void | LodePNG_Decoder_cleanup (LodePNG_Decoder *decoder) |
void | LodePNG_Decoder_copy (LodePNG_Decoder *dest, const LodePNG_Decoder *source) |
void | LodePNG_Decoder_init (LodePNG_Decoder *decoder) |
void | LodePNG_DecodeSettings_init (LodePNG_DecodeSettings *settings) |
static unsigned | LodePNG_decompress (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodeZlib_DecompressSettings *settings) |
unsigned | LodePNG_InfoColor_addPalette (LodePNG_InfoColor *info, unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
void | LodePNG_InfoColor_cleanup (LodePNG_InfoColor *info) |
void | LodePNG_InfoColor_clearPalette (LodePNG_InfoColor *info) |
unsigned | LodePNG_InfoColor_copy (LodePNG_InfoColor *dest, const LodePNG_InfoColor *source) |
unsigned | LodePNG_InfoColor_equal (const LodePNG_InfoColor *info1, const LodePNG_InfoColor *info2) |
unsigned | LodePNG_InfoColor_getBpp (const LodePNG_InfoColor *info) |
unsigned | LodePNG_InfoColor_getChannels (const LodePNG_InfoColor *info) |
void | LodePNG_InfoColor_init (LodePNG_InfoColor *info) |
unsigned | LodePNG_InfoColor_isAlphaType (const LodePNG_InfoColor *info) |
unsigned | LodePNG_InfoColor_isGreyscaleType (const LodePNG_InfoColor *info) |
void | LodePNG_InfoPng_cleanup (LodePNG_InfoPng *info) |
unsigned | LodePNG_InfoPng_copy (LodePNG_InfoPng *dest, const LodePNG_InfoPng *source) |
void | LodePNG_InfoPng_init (LodePNG_InfoPng *info) |
void | LodePNG_InfoPng_swap (LodePNG_InfoPng *a, LodePNG_InfoPng *b) |
void | LodePNG_InfoRaw_cleanup (LodePNG_InfoRaw *info) |
unsigned | LodePNG_InfoRaw_copy (LodePNG_InfoRaw *dest, const LodePNG_InfoRaw *source) |
void | LodePNG_InfoRaw_init (LodePNG_InfoRaw *info) |
void | LodePNG_inspect (LodePNG_Decoder *decoder, const unsigned char *in, size_t inlength) |
unsigned | LodePNG_IText_add (LodePNG_IText *text, const char *key, const char *langtag, const char *transkey, const char *str) |
void | LodePNG_IText_cleanup (LodePNG_IText *text) |
void | LodePNG_IText_clear (LodePNG_IText *text) |
unsigned | LodePNG_IText_copy (LodePNG_IText *dest, const LodePNG_IText *source) |
void | LodePNG_IText_init (LodePNG_IText *text) |
static unsigned | LodePNG_read32bitInt (const unsigned char *buffer) |
static void | LodePNG_set32bitInt (unsigned char *buffer, unsigned value) |
unsigned | LodePNG_Text_add (LodePNG_Text *text, const char *key, const char *str) |
void | LodePNG_Text_cleanup (LodePNG_Text *text) |
void | LodePNG_Text_clear (LodePNG_Text *text) |
unsigned | LodePNG_Text_copy (LodePNG_Text *dest, const LodePNG_Text *source) |
void | LodePNG_Text_init (LodePNG_Text *text) |
void | LodePNG_UnknownChunks_cleanup (LodePNG_UnknownChunks *chunks) |
unsigned | LodePNG_UnknownChunks_copy (LodePNG_UnknownChunks *dest, const LodePNG_UnknownChunks *src) |
void | LodePNG_UnknownChunks_init (LodePNG_UnknownChunks *chunks) |
unsigned | LodeZlib_decompress (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodeZlib_DecompressSettings *settings) |
void | LodeZlib_DecompressSettings_init (LodeZlib_DecompressSettings *settings) |
unsigned | LodeZlib_read32bitInt (const unsigned char *buffer) |
static int | paethPredictor (int a, int b, int c) |
static unsigned | postProcessScanlines (unsigned char *out, unsigned char *in, const LodePNG_InfoPng *infoPng) |
static unsigned char | readBitFromReversedStream (size_t *bitpointer, const unsigned char *bitstream) |
static unsigned char | readBitFromStream (size_t *bitpointer, const unsigned char *bitstream) |
static unsigned | readBitsFromReversedStream (size_t *bitpointer, const unsigned char *bitstream, size_t nbits) |
static unsigned | readBitsFromStream (size_t *bitpointer, const unsigned char *bitstream, size_t nbits) |
static void | removePaddingBits (unsigned char *out, const unsigned char *in, size_t olinebits, size_t ilinebits, unsigned h) |
static void | setBitOfReversedStream (size_t *bitpointer, unsigned char *bitstream, unsigned char bit) |
static void | setBitOfReversedStream0 (size_t *bitpointer, unsigned char *bitstream, unsigned char bit) |
static void | string_cleanup (char **out) |
static void | string_init (char **out) |
static unsigned | string_resize (char **out, size_t size) |
static void | string_set (char **out, const char *in) |
static void | ucvector_cleanup (void *p) |
static void | ucvector_init (ucvector *p) |
static void | ucvector_init_buffer (ucvector *p, unsigned char *buffer, size_t size) |
static unsigned | ucvector_push_back (ucvector *p, unsigned char c) |
static unsigned | ucvector_resize (ucvector *p, size_t size) |
static unsigned | ucvector_resizev (ucvector *p, size_t size, unsigned char value) |
static void | uivector_cleanup (void *p) |
static void | uivector_init (uivector *p) |
static unsigned | uivector_resize (uivector *p, size_t size) |
static unsigned | uivector_resizev (uivector *p, size_t size, unsigned value) |
static unsigned | unfilter (unsigned char *out, const unsigned char *in, unsigned w, unsigned h, unsigned bpp) |
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 | update_adler32 (unsigned adler, const unsigned char *data, unsigned len) |
Variables | |
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 } |
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 | CLCL [NUM_CODE_LENGTH_CODES] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15} |
static unsigned | Crc32_crc_table [256] |
static unsigned | Crc32_crc_table_computed = 0 |
static const unsigned | DISTANCEBASE [30] = {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} |
static const unsigned | DISTANCEEXTRA [30] = {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} |
static const unsigned | LENGTHBASE [29] = {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} |
static const unsigned | LENGTHEXTRA [29] = {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} |
const LodeZlib_DecompressSettings | LodeZlib_defaultDecompressSettings = {0} |
#define FIRST_LENGTH_CODE_INDEX 257 |
Referenced by inflateHuffmanBlock().
#define LAST_LENGTH_CODE_INDEX 285 |
Referenced by inflateHuffmanBlock().
#define NUM_CODE_LENGTH_CODES 19 /*the code length codes. 0-15: code lengths, 16: copy previous 3-6 times, 17: 3-10 zeros, 18: 11-138 zeros*/ |
Referenced by getTreeInflateDynamic().
#define NUM_DEFLATE_CODE_SYMBOLS 288 /*256 literals, the end code, some length codes, and 2 unused codes*/ |
Referenced by generateFixedTree(), and getTreeInflateDynamic().
#define NUM_DISTANCE_SYMBOLS 32 /*the distance codes have their own symbols, 30 used, 2 unused*/ |
Referenced by generateDistanceTree(), and getTreeInflateDynamic().
#define VERSION_STRING "20100314" |
typedef struct HuffmanTree HuffmanTree |
|
static |
References Adam7_getpassvalues(), b, i, readBitFromReversedStream(), setBitOfReversedStream0(), w, x, and y.
Referenced by postProcessScanlines().
|
static |
References i.
Referenced by Adam7_deinterlace(), and postProcessScanlines().
|
static |
References update_adler32().
Referenced by LodeZlib_decompress().
|
static |
Referenced by LodePNG_inspect().
|
static |
References Crc32_update_crc().
Referenced by LodePNG_chunk_check_crc(), LodePNG_chunk_generate_crc(), and LodePNG_inspect().
|
static |
Referenced by Crc32_update_crc().
|
static |
References c, Crc32_make_crc_table(), and n.
Referenced by Crc32_crc().
|
static |
References LodePNG_InfoPng::background_b, LodePNG_InfoPng::background_defined, LodePNG_InfoPng::background_g, LodePNG_InfoPng::background_r, LodePNG_InfoPng::color, LodePNG_InfoColor::colorType, data, ucvector::data, LodePNG_UnknownChunks::data, LodePNG_UnknownChunks::datasize, LodePNG_Time::day, LodePNG_Decoder::error, LodePNG_InfoPng::height, LodePNG_Time::hour, i, LodePNG_DecodeSettings::ignoreCrc, LodePNG_Decoder::infoPng, LodePNG_InfoPng::itext, key, LodePNG_InfoColor::key_b, LodePNG_InfoColor::key_defined, LodePNG_InfoColor::key_g, LodePNG_InfoColor::key_r, length, LodePNG_append_chunk(), LodePNG_chunk_check_crc(), LodePNG_chunk_critical(), LodePNG_chunk_data_const(), LodePNG_chunk_length(), LodePNG_chunk_next_const(), LodePNG_chunk_type_equals(), LodePNG_decompress(), LodePNG_InfoColor_getBpp(), LodePNG_inspect(), LodePNG_IText_add(), LodePNG_Text_add(), LodePNG_Time::minute, LodePNG_Time::month, LodePNG_InfoColor::palette, LodePNG_InfoColor::palettesize, LodePNG_InfoPng::phys_defined, LodePNG_InfoPng::phys_unit, LodePNG_InfoPng::phys_x, LodePNG_InfoPng::phys_y, postProcessScanlines(), LodePNG_DecodeSettings::readTextChunks, LodePNG_DecodeSettings::rememberUnknownChunks, scanlines, LodePNG_Time::second, LodePNG_Decoder::settings, ucvector::size, str, LodePNG_InfoPng::text, LodePNG_InfoPng::time, LodePNG_InfoPng::time_defined, ucvector_cleanup(), ucvector_init(), ucvector_push_back(), ucvector_resize(), ucvector_resizev(), LodePNG_InfoPng::unknown_chunks, LodePNG_InfoPng::width, LodePNG_Time::year, and LodePNG_DecodeSettings::zlibsettings.
Referenced by LodePNG_decode().
|
static |
References uivector::data, error(), HuffmanTree_makeFromLengths(), i, NUM_DISTANCE_SYMBOLS, uivector_cleanup(), uivector_init(), and uivector_resize().
Referenced by getTreeInflateFixed().
|
static |
References uivector::data, error(), HuffmanTree_makeFromLengths(), i, NUM_DEFLATE_CODE_SYMBOLS, uivector_cleanup(), uivector_init(), and uivector_resize().
Referenced by getTreeInflateFixed().
|
static |
References getNumColorChannels().
Referenced by LodePNG_InfoColor_getBpp().
|
static |
Referenced by getBpp(), and LodePNG_InfoColor_getChannels().
|
static |
References CLCL, uivector::data, error(), huffmanDecodeSymbol(), HuffmanTree_makeFromLengths(), i, n, NUM_CODE_LENGTH_CODES, NUM_DEFLATE_CODE_SYMBOLS, NUM_DISTANCE_SYMBOLS, readBitsFromStream(), uivector::size, uivector_cleanup(), uivector_init(), uivector_resize(), and uivector_resizev().
Referenced by inflateHuffmanBlock().
|
static |
References generateDistanceTree(), and generateFixedTree().
Referenced by inflateHuffmanBlock().
|
static |
References HuffmanTree_decode(), and readBitFromStream().
Referenced by getTreeInflateDynamic(), and inflateHuffmanBlock().
|
static |
References HuffmanTree::lengths, HuffmanTree::tree1d, HuffmanTree::tree2d, and uivector_cleanup().
Referenced by inflateHuffmanBlock().
|
static |
References uivector::data, HuffmanTree::numcodes, and HuffmanTree::tree2d.
Referenced by huffmanDecodeSymbol().
|
static |
References HuffmanTree::lengths, HuffmanTree::tree1d, HuffmanTree::tree2d, and uivector_init().
Referenced by inflateHuffmanBlock().
|
static |
References uivector::data, i, HuffmanTree::lengths, n, HuffmanTree::numcodes, HuffmanTree::tree1d, HuffmanTree::tree2d, and uivector_resize().
Referenced by HuffmanTree_makeFromLengths2().
|
static |
References uivector::data, HuffmanTree_makeFromLengths2(), i, HuffmanTree::lengths, HuffmanTree::maxbitlen, HuffmanTree::numcodes, and uivector_resize().
Referenced by generateDistanceTree(), generateFixedTree(), and getTreeInflateDynamic().
|
static |
|
static |
References ucvector::data, DISTANCEBASE, DISTANCEEXTRA, error(), FIRST_LENGTH_CODE_INDEX, getTreeInflateDynamic(), getTreeInflateFixed(), huffmanDecodeSymbol(), HuffmanTree_cleanup(), HuffmanTree_init(), LAST_LENGTH_CODE_INDEX, length, LENGTHBASE, LENGTHEXTRA, readBitsFromStream(), ucvector::size, start, and ucvector_resize().
Referenced by LodeFlate_inflate().
|
static |
References ucvector::data, error(), n, ucvector::size, and ucvector_resize().
Referenced by LodeFlate_inflate().
unsigned LodeFlate_inflate | ( | ucvector * | out, |
const unsigned char * | in, | ||
size_t | insize, | ||
size_t | inpos | ||
) |
References error(), inflateHuffmanBlock(), inflateNoCompression(), readBitFromStream(), and ucvector_resize().
Referenced by LodeZlib_decompress().
|
static |
References LodeZlib_decompress().
Referenced by decodeGeneric().
unsigned LodePNG_InfoColor_equal | ( | const LodePNG_InfoColor * | info1, |
const LodePNG_InfoColor * | info2 | ||
) |
References LodePNG_InfoColor::bitDepth, and LodePNG_InfoColor::colorType.
Referenced by LodePNG_convert(), and LodePNG_decode().
void LodePNG_InfoPng_swap | ( | LodePNG_InfoPng * | a, |
LodePNG_InfoPng * | b | ||
) |
|
static |
Referenced by LodePNG_chunk_check_crc(), LodePNG_chunk_length(), and LodePNG_inspect().
|
static |
Referenced by LodePNG_chunk_generate_crc(), and LodePNG_create_chunk().
unsigned LodeZlib_read32bitInt | ( | const unsigned char * | buffer | ) |
Referenced by LodeZlib_decompress().
|
static |
Referenced by unfilterScanline().
|
static |
|
static |
Referenced by Adam7_deinterlace(), readBitsFromReversedStream(), and removePaddingBits().
|
static |
Referenced by huffmanDecodeSymbol(), LodeFlate_inflate(), and readBitsFromStream().
|
static |
References i, nbits, and readBitFromReversedStream().
Referenced by LodePNG_convert().
|
static |
References i, nbits, and readBitFromStream().
Referenced by getTreeInflateDynamic(), and inflateHuffmanBlock().
|
static |
References readBitFromReversedStream(), setBitOfReversedStream(), x, and y.
Referenced by postProcessScanlines().
|
static |
Referenced by removePaddingBits().
|
static |
Referenced by Adam7_deinterlace().
|
static |
References NULL.
Referenced by LodePNG_IText_clear(), and LodePNG_Text_clear().
|
static |
References NULL, and string_resize().
Referenced by LodePNG_IText_add(), and LodePNG_Text_add().
|
static |
References data.
Referenced by string_init(), and string_set().
|
static |
References i, and string_resize().
Referenced by LodePNG_IText_add(), and LodePNG_Text_add().
|
static |
Referenced by decodeGeneric().
|
static |
References ucvector::allocsize, ucvector::data, NULL, and ucvector::size.
Referenced by decodeGeneric().
|
static |
References ucvector::allocsize, buffer, ucvector::data, and ucvector::size.
Referenced by LodeZlib_decompress().
|
static |
References c, ucvector::data, ucvector::size, and ucvector_resize().
Referenced by decodeGeneric().
|
static |
References ucvector::allocsize, data, ucvector::data, and ucvector::size.
Referenced by decodeGeneric(), inflateHuffmanBlock(), inflateNoCompression(), LodeFlate_inflate(), ucvector_push_back(), and ucvector_resizev().
|
static |
References ucvector::data, i, ucvector::size, and ucvector_resize().
Referenced by decodeGeneric().
|
static |
|
static |
References uivector::allocsize, uivector::data, NULL, and uivector::size.
Referenced by generateDistanceTree(), generateFixedTree(), getTreeInflateDynamic(), HuffmanTree_init(), and HuffmanTree_makeFromLengths2().
|
static |
References uivector::allocsize, data, uivector::data, and uivector::size.
Referenced by generateDistanceTree(), generateFixedTree(), getTreeInflateDynamic(), HuffmanTree_make2DTree(), HuffmanTree_makeFromLengths(), HuffmanTree_makeFromLengths2(), and uivector_resizev().
|
static |
References uivector::data, i, uivector::size, and uivector_resize().
Referenced by getTreeInflateDynamic(), and HuffmanTree_makeFromLengths2().
|
static |
References error(), unfilterScanline(), and y.
Referenced by postProcessScanlines().
|
static |
References i, length, and paethPredictor().
Referenced by unfilter().
|
static |
Referenced by adler32().
|
static |
|
static |
|
static |
|
static |
|
static |
Referenced by getTreeInflateDynamic().
|
static |
|
static |
|
static |
Referenced by inflateHuffmanBlock().
|
static |
Referenced by inflateHuffmanBlock().
|
static |
Referenced by inflateHuffmanBlock().
|
static |
Referenced by inflateHuffmanBlock().