Lines Matching full:a

16     in a product, an acknowledgment in the product documentation would be
42 #if defined(_MSC_VER) && (_MSC_VER >= 1310) /*Visual Studio: A few warning types are not desired he…
99 /* convince the compiler to inline a function, for use when this measurably improves performance */
117 where a full C library is not available. The compiler can recognize them and compile
131 static size_t lodepng_strlen(const char* a) { in lodepng_strlen() argument
132 const char* orig = a; in lodepng_strlen()
135 while(*a) a++; in lodepng_strlen()
136 return (size_t)(a - orig); in lodepng_strlen()
139 #define LODEPNG_MAX(a, b) (((a) > (b)) ? (a) : (b)) argument
140 #define LODEPNG_MIN(a, b) (((a) < (b)) ? (a) : (b)) argument
146 static int lodepng_addofl(size_t a, size_t b, size_t* result) { in lodepng_addofl() argument
147 *result = a + b; /* Unsigned addition is well defined and safe in C90 */ in lodepng_addofl()
148 return *result < a; in lodepng_addofl()
155 static int lodepng_mulofl(size_t a, size_t b, size_t* result) { in lodepng_mulofl() argument
156 *result = a * b; /* Unsigned multiplication is well defined and safe in C90 */ in lodepng_mulofl()
157 return (a != 0 && *result / a != b); in lodepng_mulofl()
161 /* Safely check if a + b > c, even if overflow could happen. */
162 static int lodepng_gtofl(size_t a, size_t b, size_t c) { in lodepng_gtofl() argument
164 if(lodepng_addofl(a, b, &d)) return 1; in lodepng_gtofl()
172 Often in case of an error a value is assigned to a variable and then it breaks
173 out of a loop (to go to the cleanup phase of a function). This macro does that.
206 -All of them wrap dynamic arrays or text strings in a similar way.
310 /* dynamically allocates a new string with a copy of the null terminated input text */
659 unsigned maxbitlen; /*maximum number of bits a single code can get*/
684 /* a symbol value too big to represent any valid symbol, to indicate reading disallowed huffman bit…
717 /* freeing tree->table values is done at a higher scope */ in HuffmanTree_makeTable()
784 /* As length, use a value smaller than FIRSTBITS for the head table, in HuffmanTree_makeTable()
785 and a value larger than FIRSTBITS for the secondary table, to ensure in HuffmanTree_makeTable()
792 /* A good huffman tree has N * 2 - 1 nodes, of which N - 1 are internal nodes. in HuffmanTree_makeTable()
847 by Deflate. maxbitlen is the maximum bits that a code in the tree can have.
863 /*BPM: Boundary Package Merge, see "A Fast and Space-Economical Algorithm for Length-Limited Coding…
888 /*creates a new chain node with the given parameters, from the memory in the lists */
922 BPMNode* a = (counter & 1) ? mem : leaves; in bpmnode_sort() local
930 if(i < q && (j >= r || a[i].weight <= a[j].weight)) b[k] = a[i++]; in bpmnode_sort()
931 else b[k] = a[j++]; in bpmnode_sort()
973 if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/ in lodepng_huffman_code_lengths()
1060 /*get the literal and length code tree of a deflated block with fixed tree, as per the deflate spec…
1078 /*get the distance code tree of a deflated block with fixed tree, as specified in the deflate speci…
1120 /*get the tree of a deflated block with fixed tree, as specified in the deflate specification
1128 /*get the tree of a deflated block with dynamic tree, the tree itself is also Huffman compressed wi…
1131 …/*make sure that length values that aren't filled in will be 0, or a wrong tree will be generated*/ in getTreeInflateDynamic()
1185 if(code <= 15) /*a length code*/ { in getTreeInflateDynamic()
1261 /*inflate a block with dynamic of fixed Huffman tree. btype must be 1 or 2.*/
1430 …/*if there's a max output size, and the custom zlib returned error, then indicate that error inste… in inflatev()
1503 unsigned short* zeros; /*length of zeros streak, used as a second hash chain*/
1546 /*A simple shift and xor hash is used. Since the data of PNGs is dominated in getHash()
1547 by zeroes due to the filters, a better hash does not have a significant in getHash()
1587 It uses a hash table technique to let it encode faster. When doing LZ77 encoding, a
1589 the "dictionary". A brute force search through all possible distances would be slow, and
1655 /*common case in PNGs is lots of zeros. Quickly skip over them as a speedup*/ in encodeLZ77()
1672 /*jump out once a length of max length is found (speed gain). This also jumps in encodeLZ77()
1718 /*compensate for the fact that longer offsets have more extra bits, a in encodeLZ77()
1787 if(val > 256) /*for a length code, 3 more things have to be added*/ { in writeLZ77data()
1805 /*Deflate for a block of type "dynamic", that is, with freely, optimally, created huffman trees*/
1812 A block is compressed as follows: The PNG data is lz77 encoded, resulting in in deflateDynamic()
1817 are also run-length encoded and huffman compressed. This gives a huffman tree in deflateDynamic()
1831 …unsigned* bitlen_lld_e = 0; /*bitlen_lld encoded with repeat codes (this is a rudimentary run leng… in deflateDynamic()
1859 /*This while loop never loops due to a break at the end, it is here to in deflateDynamic()
1946 /*after a repeat code come the bits that specify the number of repetitions, in deflateDynamic()
2148 /*at least 5552 sums can be done before the sums overflow, saving a lot of module divisions*/ in update_adler32()
2182 …/*error: 256 * in[0] + in[1] must be a multiple of 31, the FCHECK value is supposed to be made tha… in lodepng_zlib_decompressv()
2198 "The additional flags shall not specify a preset dictionary."*/ in lodepng_zlib_decompressv()
2233 …/*if there's a max output size, and the custom zlib returned error, then indicate that error inste… in zlib_decompress()
2329 /*this is a good tradeoff between speed and compression ratio*/
2516 if(chunk >= end || end - chunk < 12) return end; /*too small to contain a chunk*/ in lodepng_chunk_next()
2532 if(chunk >= end || end - chunk < 12) return end; /*too small to contain a chunk*/ in lodepng_chunk_next_const()
2637 Return value is a LodePNG error code.*/
2720 static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColorMode* b) { in lodepng_color_mode_equal() argument
2722 if(a->colortype != b->colortype) return 0; in lodepng_color_mode_equal()
2723 if(a->bitdepth != b->bitdepth) return 0; in lodepng_color_mode_equal()
2724 if(a->key_defined != b->key_defined) return 0; in lodepng_color_mode_equal()
2725 if(a->key_defined) { in lodepng_color_mode_equal()
2726 if(a->key_r != b->key_r) return 0; in lodepng_color_mode_equal()
2727 if(a->key_g != b->key_g) return 0; in lodepng_color_mode_equal()
2728 if(a->key_b != b->key_b) return 0; in lodepng_color_mode_equal()
2730 if(a->palettesize != b->palettesize) return 0; in lodepng_color_mode_equal()
2731 for(i = 0; i != a->palettesize * 4; ++i) { in lodepng_color_mode_equal()
2732 if(a->palette[i] != b->palette[i]) return 0; in lodepng_color_mode_equal()
2744 unsigned char r, unsigned char g, unsigned char b, unsigned char a) { in lodepng_palette_add() argument
2755 info->palette[4 * info->palettesize + 3] = a; in lodepng_palette_add()
2808 /*in an idat chunk, each scanline is a multiple of 8 bits, unlike the lodepng output buffer,
2809 and in addition has one extra byte per line: the filter byte. So this gives a larger
2821 you can safely compute in a size_t (but not an unsigned):
3108 One node of a color tree
3109 This is the data structure used to count the number of unique colors and to get a palette
3110 index for a color. It's like an octree, but because the alpha channel is used too, each
3115 int index; /*the payload. Only has a meaningful value if this is in the last level*/
3134 …lor_tree_get(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a) { in color_tree_get() argument
3137 … int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1); in color_tree_get()
3145 …lor_tree_has(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a) { in color_tree_has() argument
3146 return color_tree_get(tree, r, g, b, a) >= 0; in color_tree_has()
3154 … unsigned char r, unsigned char g, unsigned char b, unsigned char a, unsigned index) { in color_tree_add() argument
3157 … int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1); in color_tree_add()
3169 /*put a pixel, given its RGBA color, into image of any color type*/
3172 unsigned char r, unsigned char g, unsigned char b, unsigned char a) { in rgba8ToPixel() argument
3193 int index = color_tree_get(tree, r, g, b, a); in rgba8ToPixel()
3201 out[i * 2 + 1] = a; in rgba8ToPixel()
3204 out[i * 4 + 2] = out[i * 4 + 3] = a; in rgba8ToPixel()
3211 out[i * 4 + 3] = a; in rgba8ToPixel()
3216 out[i * 8 + 6] = out[i * 8 + 7] = a; in rgba8ToPixel()
3223 /*put a pixel, given its RGBA16 color, into image of any color 16-bitdepth type*/
3226 unsigned short r, unsigned short g, unsigned short b, unsigned short a) { in rgba16ToPixel() argument
3242 out[i * 4 + 2] = (a >> 8) & 255; in rgba16ToPixel()
3243 out[i * 4 + 3] = a & 255; in rgba16ToPixel()
3251 out[i * 8 + 6] = (a >> 8) & 255; in rgba16ToPixel()
3252 out[i * 8 + 7] = a & 255; in rgba16ToPixel()
3258 unsigned char* b, unsigned char* a, in getPixelColorRGBA8() argument
3264 if(mode->key_defined && *r == mode->key_r) *a = 0; in getPixelColorRGBA8()
3265 else *a = 255; in getPixelColorRGBA8()
3268 if(mode->key_defined && 256U * in[i * 2 + 0] + in[i * 2 + 1] == mode->key_r) *a = 0; in getPixelColorRGBA8()
3269 else *a = 255; in getPixelColorRGBA8()
3275 if(mode->key_defined && value == mode->key_r) *a = 0; in getPixelColorRGBA8()
3276 else *a = 255; in getPixelColorRGBA8()
3281 if(mode->key_defined && *r == mode->key_r && *g == mode->key_g && *b == mode->key_b) *a = 0; in getPixelColorRGBA8()
3282 else *a = 255; in getPixelColorRGBA8()
3289 && 256U * in[i * 6 + 4] + in[i * 6 + 5] == mode->key_b) *a = 0; in getPixelColorRGBA8()
3290 else *a = 255; in getPixelColorRGBA8()
3303 *a = mode->palette[index * 4 + 3]; in getPixelColorRGBA8()
3307 *a = in[i * 2 + 1]; in getPixelColorRGBA8()
3310 *a = in[i * 4 + 2]; in getPixelColorRGBA8()
3317 *a = in[i * 4 + 3]; in getPixelColorRGBA8()
3322 *a = in[i * 8 + 6]; in getPixelColorRGBA8()
3501 …oid getPixelColorRGBA16(unsigned short* r, unsigned short* g, unsigned short* b, unsigned short* a, in getPixelColorRGBA16() argument
3505 if(mode->key_defined && 256U * in[i * 2 + 0] + in[i * 2 + 1] == mode->key_r) *a = 0; in getPixelColorRGBA16()
3506 else *a = 65535; in getPixelColorRGBA16()
3514 && 256u * in[i * 6 + 4] + in[i * 6 + 5] == mode->key_b) *a = 0; in getPixelColorRGBA16()
3515 else *a = 65535; in getPixelColorRGBA16()
3518 *a = 256u * in[i * 4 + 2] + in[i * 4 + 3]; in getPixelColorRGBA16()
3523 *a = 256u * in[i * 8 + 6] + in[i * 8 + 7]; in getPixelColorRGBA16()
3551 Note that we never create a new palette ourselves.*/ in lodepng_convert()
3576 unsigned short r = 0, g = 0, b = 0, a = 0; in lodepng_convert() local
3577 getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode_in); in lodepng_convert()
3578 rgba16ToPixel(out, i, mode_out, r, g, b, a); in lodepng_convert()
3585 unsigned char r = 0, g = 0, b = 0, a = 0; in lodepng_convert() local
3587 getPixelColorRGBA8(&r, &g, &b, &a, in, i, mode_in); in lodepng_convert()
3588 error = rgba8ToPixel(out, i, mode_out, &tree, r, g, b, a); in lodepng_convert()
3602 /* Converts a single rgb color without alpha from one type to another, color bits truncated to
3605 this is for bKGD, supporting alpha may prevent it from finding a color in the palette, from the
3640 /* a 16-bit color cannot be in the palette */ in lodepng_convert_rgb()
3703 /* mark things as done already if it would be impossible to have a more expensive case */ in lodepng_compute_color_stats()
3738 unsigned short r = 0, g = 0, b = 0, a = 0; in lodepng_compute_color_stats() local
3740 getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode_in); in lodepng_compute_color_stats()
3742 … (b & 255) != ((b >> 8) & 255) || (a & 255) != ((a >> 8) & 255)) /*first and second byte differ*/ { in lodepng_compute_color_stats()
3753 unsigned short r = 0, g = 0, b = 0, a = 0; in lodepng_compute_color_stats() local
3756 getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode_in); in lodepng_compute_color_stats()
3765 if(a != 65535 && (a != 0 || (stats->key && !matchkey))) { in lodepng_compute_color_stats()
3769 } else if(a == 0 && !stats->alpha && !stats->key) { in lodepng_compute_color_stats()
3774 } else if(a == 65535 && stats->key && matchkey) { in lodepng_compute_color_stats()
3786 getPixelColorRGBA16(&r, &g, &b, &a, in, i, mode_in); in lodepng_compute_color_stats()
3787 if(a != 0 && r == stats->key_r && g == stats->key_g && b == stats->key_b) { in lodepng_compute_color_stats()
3796 unsigned char r = 0, g = 0, b = 0, a = 0; in lodepng_compute_color_stats() local
3798 getPixelColorRGBA8(&r, &g, &b, &a, in, i, mode_in); in lodepng_compute_color_stats()
3815 if(a != 255 && (a != 0 || (stats->key && !matchkey))) { in lodepng_compute_color_stats()
3820 } else if(a == 0 && !stats->alpha && !stats->key) { in lodepng_compute_color_stats()
3825 } else if(a == 255 && stats->key && matchkey) { in lodepng_compute_color_stats()
3835 if(!color_tree_has(&tree, r, g, b, a)) { in lodepng_compute_color_stats()
3836 error = color_tree_add(&tree, r, g, b, a, stats->numcolors); in lodepng_compute_color_stats()
3844 p[n * 4 + 3] = a; in lodepng_compute_color_stats()
3856 getPixelColorRGBA8(&r, &g, &b, &a, in, i, mode_in); in lodepng_compute_color_stats()
3857 if(a != 0 && r == stats->key_r && g == stats->key_g && b == stats->key_b) { in lodepng_compute_color_stats()
3879 /*Adds a single color to the color stats. The stats must already have been inited. The color must b…
3881 all pixels of an image but only for a few additional values. */
3883 unsigned r, unsigned g, unsigned b, unsigned a) { in lodepng_color_stats_add() argument
3889 image[4] = b >> 8; image[5] = b; image[6] = a >> 8; image[7] = a; in lodepng_color_stats_add()
3898 /*Computes a minimal PNG color model that can contain all colors as indicated by the stats.
3933 …if(numpixels < n * 2) palette_ok = 0; /*don't add palette overhead if image has only a few pixels*/ in auto_choose_color()
3977 static unsigned char paethPredictor(short a, short b, short c) { in paethPredictor() argument
3979 short pb = LODEPNG_ABS(a - c); in paethPredictor()
3980 short pc = LODEPNG_ABS(a + b - c - c); in paethPredictor()
3982 if(pb < pa) { a = b; pa = pb; } in paethPredictor()
3983 return (pc < pa) ? c : a; in paethPredictor()
4005 "padded" is only relevant if bpp is less than 8 and a scanline or image does not
4006 end at a full byte
4048 …CERROR_RETURN_ERROR(state->error, 27); /*error: the data length is smaller than the length of a PN… in lodepng_inspect()
4051 …/*when decoding a new PNG image, make sure all parameters created after previous decoding are rese… in lodepng_inspect()
4052 /* TODO: remove this. One should use a new LodePNGState for new sessions */ in lodepng_inspect()
4064 CERROR_RETURN_ERROR(state->error, 29); /*error: it doesn't start with a IHDR chunk!*/ in lodepng_inspect()
4108 unfilter a PNG image scanline by scanline. when the pixels are smaller than 1 byte, in unfilterScanline()
4146 …/* Unroll independent paths of the paeth predictor. A 6x and 8x version would also be possible but… in unfilterScanline()
4204 …this function unfilters a single image (e.g. without interlacing this is called once, with Adam7 s… in unfilter()
4215 /*the width of a scanline in bytes, not including the filter type*/ in unfilter()
4233 reduced images so that each reduced image starts at a byte.
4234 out: the same pixels, but re-ordered so that they're now a non-interlaced image with size w*h
4239 (because that's likely a little bit faster)
4263 } else /*bpp < 8: Adam7 with pixels < 8 bit is a bit trickier: with bit pointers*/ { in Adam7_deinterlace()
4290 …also used to move bits after earlier such operations happened, e.g. in a sequence of reduced image… in removePaddingBits()
4291 only useful if (ilinebits - olinebits) is a value in the range 1..7 in removePaddingBits()
4340 … bits between the different reduced images: each reduced image still starts nicely at a byte*/ in postProcessScanlines()
4438 while(!error) /*not really a while loop, only used to break on error*/ { in readChunk_tEXt()
4486 while(!error) /*not really a while loop, only used to break on error*/ { in readChunk_zTXt()
4532 while(!error) /*not really a while loop, only used to break on error*/ { in readChunk_iTXt()
4534 …it'd still fail with other error checks below if it's too short. This just gives a different error… in readChunk_iTXt()
4759 /*read a PNG, the result will be in the same color type as the PNG (hence "generic")*/
4789 /*the input filesize is a safe upper bound for the sum of idat chunks size*/ in decodeGeneric()
5120 /* only adds the chunk if needed (there is a key or palette with alpha) */
5451 out must be a buffer with as size: h + (w * h * bpp + 7u) / 8u, because there are in filter()
5456 /*the width of a scanline in bytes, not including the filter type*/ in filter()
5467 …There is a heuristic called the minimum sum of absolute differences heuristic, suggested by the PN… in filter()
5517 … (converted to signed char). Filtertype 0 isn't a difference though, so use unsigned there. in filter()
5534 … out[y * (linebytes + 1)] = bestType; /*the first byte of a scanline will be the filter type*/ in filter()
5573 … out[y * (linebytes + 1)] = bestType; /*the first byte of a scanline will be the filter type*/ in filter()
5602 cases better compression. It does make this a bit less slow, so it's worth doing this.*/ in filter()
5604 /*a custom encoder likely doesn't read the btype setting and is optimized for complete PNG in filter()
5616 … /*if(testsize > 8) testsize /= 8;*/ /*it already works good enough by testing a part of the row*/ in filter()
5630 … out[y * (linebytes + 1)] = bestType; /*the first byte of a scanline will be the filter type*/ in filter()
5664 reduced image starts at a byte.
5691 } else /*bpp < 8: Adam7 with pixels < 8 bit is a bit trickier: with bit pointers*/ { in Adam7_interlace()
5798 It is a gray profile if bytes 16-19 are "GRAY", rgb profile if bytes 16-19 in isGrayICCProfile()
5802 requires using a non-gray color model if there is an ICC profile with "RGB " in isGrayICCProfile()
5804 data), and requires using a gray color model if it is "GRAY". in isGrayICCProfile()
5807 return profile[16] == 'G' && profile[17] == 'R' && profile[18] == 'A' && profile[19] == 'Y'; in isGrayICCProfile()
5860 /*the PNG specification does not allow to use palette with a GRAY ICC profile, even in lodepng_encode()
6139 This returns the description of a numerical error code in English. This is also
6157 case 21: return "NLEN is not ones complement of LEN in a deflate block"; in lodepng_error_text()
6162 happen in a normal, well encoded, PNG image.*/ in lodepng_error_text()
6168 case 27: return "PNG file is smaller than a PNG header"; in lodepng_error_text()
6177 case 35: return "chunk length of a chunk is too large or the chunk too small"; in lodepng_error_text()
6208 case 63: return "length of a chunk too long, max allowed for PNG is 2147483647 bytes per chunk"; in lodepng_error_text()
6209 …/*this would result in the inability of a deflated block to ever contain an end code. It must be a… in lodepng_error_text()
6211 …case 66: return "the length of a text chunk keyword given to the encoder is longer than the maximu… in lodepng_error_text()
6212 …case 67: return "the length of a text chunk keyword given to the encoder is smaller than the minim… in lodepng_error_text()
6213 …case 68: return "tried to encode a PLTE chunk with a palette that has less than 1 or more than 256… in lodepng_error_text()
6225 case 80: return "tried creating a tree of 0 symbols"; in lodepng_error_text()
6227 …case 82: return "color conversion to palette requested while a color isn't in palette, or index ou… in lodepng_error_text()
6235 case 90: return "windowsize must be a power of two"; in lodepng_error_text()
6239 case 94: return "header chunk must have a size of 13 bytes"; in lodepng_error_text()
6253 case 108: return "tried to add more than 256 values to a palette"; in lodepng_error_text()