Lines Matching defs:in
6 * Last changed in libpng 1.6.8 [December 19, 2013]
10 * and license in png.h
74 * "Algorithms") but it comes from the 'feedback taps' table in Horowitz and
83 /* There are thirty three bits, the next bit in the sequence is bit-33 XOR
84 * bit-20. The top 1 bit is in u1, the bottom 32 are in u0.
89 /* First generate 8 new bits then shift them in at the end. */
134 * fesetround() call in main(). sRGB_to_d optimizes the 8 to 16-bit conversion.
218 /* The error that results from using a 2.2 power law in place of the correct
291 /* "multiple_algorithms" in this case means that a color-map has been
594 /* Delete function; cleans out all the allocated data and the temporary file in
678 /* Check for overwrite in the image buffer. */
720 /* Log an error and close a file (just a utility to do both things in one
757 /* The components, for grayscale images the gray value is in 'g' and if alpha
766 * integer format and as a double precision linear value in the range 0..1
778 * the format in a function pointer, these are the routines:
992 * correct entry in the color-map.
1127 * IN G GA RGB RGBA G GA RGB RGBA
1171 gpc_noop(Pixel *out, const Pixel *in, const Background *back)
1174 out->r = in->r;
1175 out->g = in->g;
1176 out->b = in->b;
1177 out->a = in->a;
1182 gpc_nop8(Pixel *out, const Pixel *in, const Background *back)
1185 if (in->a == 0)
1190 out->r = in->r;
1191 out->g = in->g;
1192 out->b = in->b;
1195 out->a = in->a;
1201 gpc_nop6(Pixel *out, const Pixel *in, const Background *back)
1204 if (in->a == 0)
1209 out->r = in->r;
1210 out->g = in->g;
1211 out->b = in->b;
1214 out->a = in->a;
1221 gpc_bckg(Pixel *out, const Pixel *in, const Background *back)
1223 if (in->a <= 0)
1226 else if (in->a >= 255)
1227 out->r = out->g = out->b = in->g;
1231 double a = in->a / 255.;
1233 out->r = out->g = out->b = sRGB(sRGB_to_d[in->g] * a + back->dg * (1-a));
1241 gpc_bckc(Pixel *out, const Pixel *in, const Background *back)
1243 if (in->a <= 0)
1250 else if (in->a >= 255)
1252 out->r = in->r;
1253 out->g = in->g;
1254 out->b = in->b;
1259 double a = in->a / 255.;
1261 out->r = sRGB(sRGB_to_d[in->r] * a + back->dr * (1-a));
1262 out->g = sRGB(sRGB_to_d[in->g] * a + back->dg * (1-a));
1263 out->b = sRGB(sRGB_to_d[in->b] * a + back->db * (1-a));
1271 gpc_g8(Pixel *out, const Pixel *in, const Background *back)
1275 if (in->r == in->g && in->g == in->b)
1276 out->r = out->g = out->b = in->g;
1280 sRGB(YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1282 out->a = in->a;
1287 gpc_g8b(Pixel *out, const Pixel *in, const Background *back)
1289 if (in->a <= 0)
1292 else if (in->a >= 255)
1294 if (in->r == in->g && in->g == in->b)
1295 out->r = out->g = out->b = in->g;
1299 sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1304 double a = in->a/255.;
1306 out->r = out->g = out->b = sRGB(a * YfromRGB(sRGB_to_d[in->r],
1307 sRGB_to_d[in->g], sRGB_to_d[in->b]) + back->dg * (1-a));
1316 gpc_lin(Pixel *out, const Pixel *in, const Background *back)
1320 out->r = ilinear(in->r);
1322 if (in->g == in->r)
1326 if (in->b == in->r)
1330 out->b = ilinear(in->b);
1335 out->g = ilinear(in->g);
1337 if (in->b == in->r)
1340 else if (in->b == in->g)
1344 out->b = ilinear(in->b);
1352 gpc_pre(Pixel *out, const Pixel *in, const Background *back)
1356 out->r = ilineara(in->r, in->a);
1358 if (in->g == in->r)
1362 if (in->b == in->r)
1366 out->b = ilineara(in->b, in->a);
1371 out->g = ilineara(in->g, in->a);
1373 if (in->b == in->r)
1376 else if (in->b == in->g)
1380 out->b = ilineara(in->b, in->a);
1383 out->a = in->a * 257;
1388 gpc_preq(Pixel *out, const Pixel *in, const Background *back)
1392 out->r = ilineara(in->r, in->a);
1394 if (in->g == in->r)
1398 if (in->b == in->r)
1402 out->b = ilineara(in->b, in->a);
1407 out->g = ilineara(in->g, in->a);
1409 if (in->b == in->r)
1412 else if (in->b == in->g)
1416 out->b = ilineara(in->b, in->a);
1424 gpc_glin(Pixel *out, const Pixel *in, const Background *back)
1428 if (in->r == in->g && in->g == in->b)
1429 in->g);
1433 YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1440 gpc_gpre(Pixel *out, const Pixel *in, const Background *back)
1444 if (in->r == in->g && in->g == in->b)
1445 out->r = out->g = out->b = ilineara(in->g, in->a);
1448 out->r = out->g = out->b = u16d(in->a * 257 *
1449 YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1451 out->a = 257 * in->a;
1456 gpc_gprq(Pixel *out, const Pixel *in, const Background *back)
1460 if (in->r == in->g && in->g == in->b)
1461 out->r = out->g = out->b = ilineara(in->g, in->a);
1464 out->r = out->g = out->b = u16d(in->a * 257 *
1465 YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1473 gpc_Lin(Pixel *out, const Pixel *in, const Background *back)
1477 out->r = ilinear_g22(in->r);
1479 if (in->g == in->r)
1483 if (in->b == in->r)
1487 out->b = ilinear_g22(in->b);
1492 out->g = ilinear_g22(in->g);
1494 if (in->b == in->r)
1497 else if (in->b == in->g)
1501 out->b = ilinear_g22(in->b);
1511 gpc_Pre(Pixel *out, const Pixel *in, const Background *back)
1515 out->r = ilineara_g22(in->r, in->a);
1517 if (in->g == in->r)
1521 if (in->b == in->r)
1525 out->b = ilineara_g22(in->b, in->a);
1530 out->g = ilineara_g22(in->g, in->a);
1532 if (in->b == in->r)
1535 else if (in->b == in->g)
1539 out->b = ilineara_g22(in->b, in->a);
1542 out->a = in->a * 257;
1549 gpc_Preq(Pixel *out, const Pixel *in, const Background *back)
1553 out->r = ilineara_g22(in->r, in->a);
1555 if (in->g == in->r)
1559 if (in->b == in->r)
1563 out->b = ilineara_g22(in->b, in->a);
1568 out->g = ilineara_g22(in->g, in->a);
1570 if (in->b == in->r)
1573 else if (in->b == in->g)
1577 out->b = ilineara_g22(in->b, in->a);
1588 gpc_Glin(Pixel *out, const Pixel *in, const Background *back)
1592 if (in->r == in->g && in->g == in->b)
1593 out->r = out->g = out->b = ilinear_g22(in->g);
1597 YfromRGB(g22_to_d[in->r], g22_to_d[in->g], g22_to_d[in->b]));
1608 gpc_Gpre(Pixel *out, const Pixel *in, const Background *back)
1612 if (in->r == in->g && in->g == in->b)
1613 out->r = out->g = out->b = ilineara_g22(in->g, in->a);
1616 out->r = out->g = out->b = u16d(in->a * 257 *
1617 YfromRGB(g22_to_d[in->r], g22_to_d[in->g], g22_to_d[in->b]));
1619 out->a = 257 * in->a;
1626 gpc_Gprq(Pixel *out, const Pixel *in, const Background *back)
1630 if (in->r == in->g && in->g == in->b)
1631 out->r = out->g = out->b = ilineara_g22(in->g, in->a);
1634 out->r = out->g = out->b = u16d(in->a * 257 *
1635 YfromRGB(g22_to_d[in->r], g22_to_d[in->g], g22_to_d[in->b]));
1644 gpc_sRGB(Pixel *out, const Pixel *in, const Background *back)
1648 out->r = isRGB(in->r);
1650 if (in->g == in->r)
1654 if (in->b == in->r)
1658 out->b = isRGB(in->b);
1663 out->g = isRGB(in->g);
1665 if (in->b == in->r)
1668 else if (in->b == in->g)
1672 out->b = isRGB(in->b);
1680 gpc_unpg(Pixel *out, const Pixel *in, const Background *back)
1684 if (in->a <= 128)
1692 out->r = out->g = out->b = sRGB((double)in->g / in->a);
1693 out->a = u8d(in->a / 257.);
1699 gpc_unpc(Pixel *out, const Pixel *in, const Background *back)
1703 if (in->a <= 128)
1711 out->r = sRGB((double)in->r / in->a);
1712 out->g = sRGB((double)in->g / in->a);
1713 out->b = sRGB((double)in->b / in->a);
1714 out->a = u8d(in->a / 257.);
1720 gpc_b16g(Pixel *out, const Pixel *in, const Background *back)
1722 if (in->a <= 0)
1727 double a = in->a/65535.;
1731 out->r = out->g = out->b = sRGB(in->g * a + back->dg * a1);
1739 gpc_b16c(Pixel *out, const Pixel *in, const Background *back)
1741 if (in->a <= 0)
1750 double a = in->a/65535.;
1754 out->r = sRGB(in->r * a + back->dr * a1);
1755 out->g = sRGB(in->g * a + back->dg * a1);
1756 out->b = sRGB(in->b * a + back->db * a1);
1764 gpc_sG(Pixel *out, const Pixel *in, const Background *back)
1768 out->r = out->g = out->b = sRGB(YfromRGBint(in->r, in->g, in->b)/65535);
1774 gpc_sGp(Pixel *out, const Pixel *in, const Background *back)
1778 if (in->a <= 128)
1786 out->r = out->g = out->b = sRGB(YfromRGBint(in->r, in->g, in->b)/in->a);
1787 out->a = u8d(in->a / 257.);
1793 gpc_sCp(Pixel *out, const Pixel *in, const Background *back)
1797 if (in->a <= 128)
1805 out->r = sRGB((double)in->r / in->a);
1806 out->g = sRGB((double)in->g / in->a);
1807 out->b = sRGB((double)in->b / in->a);
1808 out->a = u8d(in->a / 257.);
1815 gpc_gb16(Pixel *out, const Pixel *in, const Background *back)
1817 if (in->a <= 0)
1820 else if (in->a >= 65535)
1821 out->r = out->g = out->b = isRGB(in->g);
1825 double a = in->a / 65535.;
1829 out->r = out->g = out->b = sRGB(in->g * a + back->dg * a1);
1837 gpc_cb16(Pixel *out, const Pixel *in, const Background *back)
1839 if (in->a <= 0)
1846 else if (in->a >= 65535)
1848 out->r = isRGB(in->r);
1849 out->g = isRGB(in->g);
1850 out->b = isRGB(in->b);
1855 double a = in->a / 65535.;
1859 out->r = sRGB(in->r * a + back->dr * a1);
1860 out->g = sRGB(in->g * a + back->dg * a1);
1861 out->b = sRGB(in->b * a + back->db * a1);
1870 gpc_A(Pixel *out, const Pixel *in, const Background *back)
1873 out->r = in->r;
1874 out->g = in->g;
1875 out->b = in->b;
1881 gpc_g16(Pixel *out, const Pixel *in, const Background *back)
1884 out->r = out->g = out->b = u16d(YfromRGBint(in->r, in->g, in->b));
1890 gpc_g16q(Pixel *out, const Pixel *in, const Background *back)
1893 out->r = out->g = out->b = u16d(YfromRGBint(in->r, in->g, in->b));
1894 out->a = in->a;
1900 (Pixel *out, const Pixel *in, const Background *back) =
1907 * IN G GA RGB RGBA G GA RGB RGBA
1917 * The matrix is held in an array indexed thus:
1926 static void (* const gpc_fn[8/*in*/][8/*out*/])
1927 (Pixel *out, const Pixel *in, const Background *back) =
1943 static void (* const gpc_fn_colormapped[8/*in*/][8/*out*/])
1944 (Pixel *out, const Pixel *in, const Background *back) =
1957 /* The error arrays record the error in the same matrix; 64 entries, however
1958 * the different algorithms used in libpng for colormap and direct conversions
1962 * In some cases the conversion between sRGB formats goes via a linear
1965 * error array from an arbitrary 'in' format to one of the four basic outputs
1969 * then instead of logging errors they are simply added in.
1972 * opaque input pixel values. Notice that alpha should be exact in each case.
1974 * Errors in alpha should only occur when converting from a direct format
1976 * errors can occur.) There should be no error in the '0' and 'opaque'
1977 * values. The fourth entry in the array is used for the alpha error (and it
1983 * impossible to obtain a reasonable result, these are held in
1988 static png_uint_16 gpc_error[16/*in*/][16/*out*/][4/*a*/] =
2162 void (*transform)(Pixel *out, const Pixel *in, const Background *back);
2165 void (*from_linear)(Pixel *out, const Pixel *in, const Background *back);
2170 * input pixels (in turn).
2174 /* Where these are stored in the static array (for 'accumulate') */
2217 /* Check for an error in this program: */
2247 * functions to deal with errors in the libpng implementation.
2259 * this program crashes in the even of a programming error.
2343 * provided; if pngstest crashes then that is a bug in this program
2385 * in instability in the low values and even with 16-bit precision sRGB(1) ends
2386 * up mapping to sRGB(0) as a result of rounding in the 16-bit representation.
2387 * This gives an error of 1 in the handling of value 1 only.
2389 * 2) libpng currently uses an intermediate 8-bit linear value in gamma
2390 * correction of 8-bit values. This results in many more errors, the worse of
2426 * ok in this case.
2464 const Pixel *in, const Pixel *calc, const Pixel *out, const char *reason)
2475 print_pixel(pixel_in, in, in_format);
2536 cmppixel(Transform *transform, png_const_voidp in, png_const_voidp out,
2543 transform->in_gp(&pixel_in, in);
2649 * The mask 'loc' contains the component offset of the channels in the
2711 /* Compare two images, the original 'a', which was written out then read back in
2757 * then there is a problem in libpng.
2806 /* This is used in logpixel to get the error message correct. */
2815 * accumulating errors in which case the program just ignores them.
2860 * instead, but first validate that the pixel indexes are in range (but
2898 * The fist two the tests (in the order given above) (using the boolean
2917 * out how, recording the result in the btoa array, which says where in
2928 * channel in b, where to find the corresponding value in a, for the
2940 alpha_added = bloc[0]; /* location of alpha channel in image b */
2946 alpha_removed = aloc[0]; /* location of alpha channel in image a */
3123 * not lost in the pass through a colormap format.
3153 /* Reads from a filename, which must be in image->file_name, but uses
3154 * image->opts to choose the method. The file is always read in its native
3289 /* 'output' has an initialized temporary image, read this back in and compare
3392 copy.opts = opts; /* in case read_file needs to change it */
3430 /* This may involve a conversion via linear; in the ideal world
3638 /* Don't allow '\0' in file names, and terminate with '\n' or,
3677 unsigned int in;
3679 printf("static png_uint_16 gpc_error[16/*in*/][16/*out*/][4/*a*/] =\n");
3681 for (in=0; in<16; ++in)
3684 printf(" { /* input: %s */\n ", format_names[in]);
3691 printf(" %d", gpc_error[in][out][alpha]);
3703 if (in < 15)
3712 for (in=0; in<16; ++in)
3715 printf(" { /* input: %s */\n ", format_names[in]);
3722 printf(" %d", gpc_error_via_linear[in][out][alpha]);
3731 if (in < 15)
3740 for (in=0; in<8; ++in)
3743 printf(" { /* input: %s */\n ", format_names[in]);
3750 printf(" %d", gpc_error_to_colormap[in][out][alpha]);
3762 if (in < 7)
3803 fprintf(stderr, "pngstest: no read support in libpng, test skipped\n");