Lines Matching full:code
54 This source file is divided into the following large parts. The code sections
56 -Tools for C and common code for PNG and Zlib
57 -C Code for Zlib (huffman, deflate, ...)
58 -C Code for PNG (file format chunks, adam7, PNG filters, color conversions, ...)
64 /* // Tools for C, and common code for PNG and Zlib. // */
70 platform if needed. Everything else in the code calls these. Pass
74 lodepng source code. Don't forget to remove "static" if you copypaste them
154 behavior, compiler removing the code, etc...) and output result. */
164 behavior, compiler removing the code, etc...) and output result. */
186 It makes the error handling code shorter and more readable.
190 #define CERROR_BREAK(errorvar, code){\ argument
191 errorvar = code;\
196 #define ERROR_BREAK(code) CERROR_BREAK(error, code) argument
198 /*Set error var to the error code, and return it.*/
199 #define CERROR_RETURN_ERROR(errorvar, code){\ argument
200 errorvar = code;\
201 return code;\
204 /*Try the code, if it returns error, also return the error.*/
210 /*Set error var to the error code, and return from the void function.*/
211 #define CERROR_RETURN(errorvar, code){\ argument
212 errorvar = code;\
388 /* load file into buffer that already has the correct allocated size. Returns error code.*/
434 /* // End of common code and tools. Begin of Zlib related code. // */
638 /*256 literals, the end code, some length codes, and 2 unused codes*/
642 /*the code length codes. 0-15: code lengths, 16: copy previous 3-6 times, 17: 3-10 zeros, 18: 11-13…
669 /*the order in which "code length alphabet code lengths" are stored as specified by deflate, out of…
682 unsigned maxbitlen; /*maximum number of bits a single code can get*/
852 /*step 1: count number of instances of each code length*/ in HuffmanTree_makeFromLengths2()
862 /*remove superfluous bits from the code*/ in HuffmanTree_makeFromLengths2()
876 given the code lengths (as stored in the PNG file), generate the tree as defined
877 by Deflate. maxbitlen is the maximum bits that a code in the tree can have.
1028 Package-Merge code below also doesn't work correctly if there's only one in lodepng_huffman_code_lengths()
1099 /*get the literal and length code tree of a deflated block with fixed tree, as per the deflate spec…
1118 /*get the distance code tree of a deflated block with fixed tree, as specified in the deflate speci…
1136 returns the code. The bit reader must already have been ensured at least 15 bits
1140 unsigned short code = peekBits(reader, FIRSTBITS); in huffmanDecodeSymbol() local
1141 unsigned short l = codetree->table_len[code]; in huffmanDecodeSymbol()
1142 unsigned short value = codetree->table_value[code]; in huffmanDecodeSymbol()
1163 Returns error code.*/
1180 unsigned * bitlen_ll = 0; /*lit,len code lengths*/ in getTreeInflateDynamic()
1181 unsigned * bitlen_d = 0; /*dist code lengths*/ in getTreeInflateDynamic()
1182 …/*code length code lengths ("clcl"), the bit lengths of the huffman tree used to compress bitlen_l… in getTreeInflateDynamic()
1184 …HuffmanTree tree_cl; /*the code tree for code length codes (the huffman tree for compressed huffma… in getTreeInflateDynamic()
1193 /*number of code length codes. Unlike the spec, the value 4 is added to it here already*/ in getTreeInflateDynamic()
1202 /*read the code length codes out of 3 * (amount of code length codes) bits*/ in getTreeInflateDynamic()
1224 …/*i is the current symbol we're reading in the part that contains the code lengths of lit/len and … in getTreeInflateDynamic()
1227 unsigned code; in getTreeInflateDynamic() local
1228 ensureBits25(reader, 22); /* up to 15 bits for huffman code, up to 7 extra bits below*/ in getTreeInflateDynamic()
1229 code = huffmanDecodeSymbol(reader, &tree_cl); in getTreeInflateDynamic()
1230 if(code <= 15) { /*a length code*/ in getTreeInflateDynamic()
1231 if(i < HLIT) bitlen_ll[i] = code; in getTreeInflateDynamic()
1232 else bitlen_d[i - HLIT] = code; in getTreeInflateDynamic()
1235 else if(code == 16) { /*repeat previous*/ in getTreeInflateDynamic()
1237 unsigned value; /*set value to the previous code*/ in getTreeInflateDynamic()
1253 else if(code == 17) { /*repeat "0" 3-10 times*/ in getTreeInflateDynamic()
1266 else if(code == 18) { /*repeat "0" 11-138 times*/ in getTreeInflateDynamic()
1279 else { /*if(code == INVALIDSYMBOL)*/ in getTreeInflateDynamic()
1284 … /*return error code 10 or 11 depending on the situation that happened in huffmanDecodeSymbol in getTreeInflateDynamic()
1292 … if(bitlen_ll[256] == 0) ERROR_BREAK(64); /*the length of the end code 256 must be larger than 0*/ in getTreeInflateDynamic()
1294 … /*now we've finally got HLIT and HDIST, so generate the code trees, and the function is done*/ in getTreeInflateDynamic()
1330 while(!error && !done) { /*decode all symbols until end reached, breaks at end code*/ in inflateHuffmanBlock()
1331 /*code_ll is literal, length or end code*/ in inflateHuffmanBlock()
1333 …/* ensure enough bits for 2 huffman code reads (15 bits each): if the first is a literal, a second… in inflateHuffmanBlock()
1338 /*slightly faster code path if multiple literals in a row*/ in inflateHuffmanBlock()
1345 … else if(code_ll >= FIRST_LENGTH_CODE_INDEX && code_ll <= LAST_LENGTH_CODE_INDEX) { /*length code*/ in inflateHuffmanBlock()
1361 /*part 3: get distance code*/ in inflateHuffmanBlock()
1366 ERROR_BREAK(18); /*error: invalid distance code (30-31 are never used)*/ in inflateHuffmanBlock()
1400 done = 1; /*end code, finish the loop*/ in inflateHuffmanBlock()
1410 … /*return error code 10 or 11 depending on the situation that happened in huffmanDecodeSymbol in inflateHuffmanBlock()
1509 …/*the custom inflate is allowed to have its own error codes, however, we translate it to code 110*/ in inflatev()
1553 …257-285: length/distance pair (length code, followed by extra length bits, distance code, extra di… in addLengthDistance()
1674 LZ77-encode the data. Return value is error code. The input are raw bytes, the output
1886 if(val > 256) { /*for a length code, 3 more things have to be added*/ in writeLZ77data()
1916 stored using their code lengths, and to compress even more these code lengths in deflateDynamic()
1918 of code lengths "cl". The code lengths used to describe this third tree are in deflateDynamic()
1919 the code length code lengths ("clcl"). in deflateDynamic()
1926 HuffmanTree tree_cl; /*tree for encoding the code lengths representing tree_ll and tree_d*/ in deflateDynamic()
1929 unsigned * frequencies_cl = 0; /*frequency of code length codes*/ in deflateDynamic()
1930 …unsigned * bitlen_lld = 0; /*lit,len,dist code lengths (int bits), literally (without repeat codes… in deflateDynamic()
1935 …If we could call "bitlen_cl" the code length code lengths ("clcl"), that is the bit lengths of cod… in deflateDynamic()
1987 frequencies_ll[256] = 1; /*there will be exactly 1 end code, at the end of the block*/ in deflateDynamic()
1998 /*store the code lengths of both generated trees in bitlen_lld*/ in deflateDynamic()
2015 if(bitlen_lld[i] == 0 && j >= 2) { /*repeat code for zeroes*/ in deflateDynamic()
2017 if(j <= 10) { /*repeat code 17 supports max 10 zeroes*/ in deflateDynamic()
2021 else { /*repeat code 18 supports max 138 zeroes*/ in deflateDynamic()
2028 else if(j >= 3) { /*repeat code for value other than zero*/ in deflateDynamic()
2043 else { /*too short to benefit from repeat code*/ in deflateDynamic()
2051 /*after a repeat code come the bits that specify the number of repetitions, in deflateDynamic()
2060 /*compute amount of code-length-code-lengths to output*/ in deflateDynamic()
2072 - (HCLEN+4)*3 bits code lengths of code length alphabet in deflateDynamic()
2073 - HLIT + 257 code lengths of lit/length alphabet (encoded using the code length in deflateDynamic()
2075 - HDIST + 1 code lengths of distance alphabet (encoded using the code length in deflateDynamic()
2078 - 256 (end code) in deflateDynamic()
2096 /*write the code lengths of the code length alphabet ("bitlen_cl")*/ in deflateDynamic()
2110 /*error: the length of the end code 256 must be larger than 0*/ in deflateDynamic()
2113 /*write the end code*/ in deflateDynamic()
2169 /*add END code*/ in deflateFixed()
2239 …/*the custom deflate is allowed to have its own error codes, however, we translate it to code 111*/ in deflate()
2347 … /*the custom zlib is allowed to have its own error codes, however, we translate it to code 110*/ in zlib_decompress()
2415 … /*the custom zlib is allowed to have its own error codes, however, we translate it to code 111*/ in zlib_compress()
2493 /* // End of Zlib related code. Begin of PNG related code. // */
3056 Return value is a LodePNG error code.*/
3642 Returns error code, or 0 if ok*/
4714 too much code. Whether this speeds up anything depends on compiler and settings. */ in unfilterScanline()
5034 for the Adam7 code, the color convert code and the output to the user. in removePaddingBits()
5294 …ill fail with other error checks below if it's too short. This just gives a different error code.*/ in readChunk_iTXt()
6818 it may complicate the code or edge cases, and always requiring to give a palette in lodepng_encode()
7200 This returns the description of a numerical error code in English. This is also
7203 const char * lodepng_error_text(unsigned code) in lodepng_error_text() argument
7205 switch(code) { in lodepng_error_text()
7211 … return "end of input memory reached without huffman end code"; /*while huffman decoding*/ in lodepng_error_text()
7213 … return "error in code tree made it jump outside of huffman tree"; /*while huffman decoding*/ in lodepng_error_text()
7220 /*this error could happen if there are only 0 or 1 symbols present in the huffman code:*/ in lodepng_error_text()
7222 return "invalid code while processing dynamic deflate block"; in lodepng_error_text()
7226 return "invalid distance code while inflating"; in lodepng_error_text()
7324 …/*this would result in the inability of a deflated block to ever contain an end code. It must be a… in lodepng_error_text()
7431 return "unknown error code"; in lodepng_error_text()