Home | History | Annotate | Download | only in libtests

Lines Matching defs:in

6  * Last changed in libpng 1.6.22 [(PENDING RELEASE)]
10 * and license in png.h
30 * a skipped test, in earlier versions we need to succeed on a skipped test, so:
83 * "Algorithms") but it comes from the 'feedback taps' table in Horowitz and
92 /* There are thirty three bits, the next bit in the sequence is bit-33 XOR
93 * bit-20. The top 1 bit is in u1, the bottom 32 are in u0.
98 /* First generate 8 new bits then shift them in at the end. */
151 * fesetround() call in main(). sRGB_to_d optimizes the 8 to 16-bit conversion.
235 /* The error that results from using a 2.2 power law in place of the correct
308 /* "multiple_algorithms" in this case means that a color-map has been
620 /* Delete function; cleans out all the allocated data and the temporary file in
704 /* Check for overwrite in the image buffer. */
746 /* Log an error and close a file (just a utility to do both things in one
790 /* The components, for grayscale images the gray value is in 'g' and if alpha
799 * integer format and as a double precision linear value in the range 0..1
811 * the format in a function pointer, these are the routines:
1025 * correct entry in the color-map.
1160 * IN G GA RGB RGBA G GA RGB RGBA
1204 gpc_noop(Pixel *out, const Pixel *in, const Background *back)
1207 out->r = in->r;
1208 out->g = in->g;
1209 out->b = in->b;
1210 out->a = in->a;
1215 gpc_nop8(Pixel *out, const Pixel *in, const Background *back)
1218 if (in->a == 0)
1223 out->r = in->r;
1224 out->g = in->g;
1225 out->b = in->b;
1228 out->a = in->a;
1234 gpc_nop6(Pixel *out, const Pixel *in, const Background *back)
1237 if (in->a == 0)
1242 out->r = in->r;
1243 out->g = in->g;
1244 out->b = in->b;
1247 out->a = in->a;
1254 gpc_bckg(Pixel *out, const Pixel *in, const Background *back)
1256 if (in->a <= 0)
1259 else if (in->a >= 255)
1260 out->r = out->g = out->b = in->g;
1264 double a = in->a / 255.;
1266 out->r = out->g = out->b = sRGB(sRGB_to_d[in->g] * a + back->dg * (1-a));
1274 gpc_bckc(Pixel *out, const Pixel *in, const Background *back)
1276 if (in->a <= 0)
1283 else if (in->a >= 255)
1285 out->r = in->r;
1286 out->g = in->g;
1287 out->b = in->b;
1292 double a = in->a / 255.;
1294 out->r = sRGB(sRGB_to_d[in->r] * a + back->dr * (1-a));
1295 out->g = sRGB(sRGB_to_d[in->g] * a + back->dg * (1-a));
1296 out->b = sRGB(sRGB_to_d[in->b] * a + back->db * (1-a));
1304 gpc_g8(Pixel *out, const Pixel *in, const Background *back)
1308 if (in->r == in->g && in->g == in->b)
1309 out->r = out->g = out->b = in->g;
1313 sRGB(YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1315 out->a = in->a;
1320 gpc_g8b(Pixel *out, const Pixel *in, const Background *back)
1322 if (in->a <= 0)
1325 else if (in->a >= 255)
1327 if (in->r == in->g && in->g == in->b)
1328 out->r = out->g = out->b = in->g;
1332 sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1337 double a = in->a/255.;
1339 out->r = out->g = out->b = sRGB(a * YfromRGB(sRGB_to_d[in->r],
1340 sRGB_to_d[in->g], sRGB_to_d[in->b]) + back->dg * (1-a));
1349 gpc_lin(Pixel *out, const Pixel *in, const Background *back)
1353 out->r = ilinear(in->r);
1355 if (in->g == in->r)
1359 if (in->b == in->r)
1363 out->b = ilinear(in->b);
1368 out->g = ilinear(in->g);
1370 if (in->b == in->r)
1373 else if (in->b == in->g)
1377 out->b = ilinear(in->b);
1385 gpc_pre(Pixel *out, const Pixel *in, const Background *back)
1389 out->r = ilineara(in->r, in->a);
1391 if (in->g == in->r)
1395 if (in->b == in->r)
1399 in->b, in->a);
1404 out->g = ilineara(in->g, in->a);
1406 if (in->b == in->r)
1409 else if (in->b == in->g)
1413 out->b = ilineara(in->b, in->a);
1416 out->a = in->a * 257;
1421 gpc_preq(Pixel *out, const Pixel *in, const Background *back)
1425 out->r = ilineara(in->r, in->a);
1427 if (in->g == in->r)
1431 if (in->b == in->r)
1435 out->b = ilineara(in->b, in->a);
1440 out->g = ilineara(in->g, in->a);
1442 if (in->b == in->r)
1445 else if (in->b == in->g)
1449 out->b = ilineara(in->b, in->a);
1457 gpc_glin(Pixel *out, const Pixel *in, const Background *back)
1461 if (in->r == in->g && in->g == in->b)
1462 out->r = out->g = out->b = ilinear(in->g);
1466 YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1473 gpc_gpre(Pixel *out, const Pixel *in, const Background *back)
1477 if (in->r == in->g && in->g == in->b)
1478 out->r = out->g = out->b = ilineara(in->g, in->a);
1481 out->r = out->g = out->b = u16d(in->a * 257 *
1482 YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1484 out->a = 257 * in->a;
1489 gpc_gprq(Pixel *out, const Pixel *in, const Background *back)
1493 if (in->r == in->g && in->g == in->b)
1494 out->r = out->g = out->b = ilineara(in->g, in->a);
1497 out->r = out->g = out->b = u16d(in->a * 257 *
1498 YfromRGB(sRGB_to_d[in->r], sRGB_to_d[in->g], sRGB_to_d[in->b]));
1506 gpc_Lin(Pixel *out, const Pixel *in, const Background *back)
1510 out->r = ilinear_g22(in->r);
1512 if (in->g == in->r)
1516 if (in->b == in->r)
1520 out->b = ilinear_g22(in->b);
1525 out->g = ilinear_g22(in->g);
1527 if (in->b == in->r)
1530 else if (in->b == in->g)
1534 out->b = ilinear_g22(in->b);
1544 gpc_Pre(Pixel *out, const Pixel *in, const Background *back)
1548 out->r = ilineara_g22(in->r, in->a);
1550 if (in->g == in->r)
1554 if (in->b == in->r)
1558 out->b = ilineara_g22(in->b, in->a);
1563 out->g = ilineara_g22(in->g, in->a);
1565 if (in->b == in->r)
1568 else if (in->b == in->g)
1572 out->b = ilineara_g22(in->b, in->a);
1575 out->a = in->a * 257;
1582 gpc_Preq(Pixel *out, const Pixel *in, const Background *back)
1586 out->r = ilineara_g22(in->r, in->a);
1588 if (in->g == in->r)
1592 if (in->b == in->r)
1596 out->b = ilineara_g22(in->b, in->a);
1601 out->g = ilineara_g22(in->g, in->a);
1603 if (in->b == in->r)
1606 else if (in->b == in->g)
1610 out->b = ilineara_g22(in->b, in->a);
1621 gpc_Glin(Pixel *out, const Pixel *in, const Background *back)
1625 if (in->r == in->g && in->g == in->b)
1626 out->r = out->g = out->b = ilinear_g22(in->g);
1630 YfromRGB(g22_to_d[in->r], g22_to_d[in->g], g22_to_d[in->b]));
1641 gpc_Gpre(Pixel *out, const Pixel *in, const Background *back)
1645 if (in->r == in->g && in->g == in->b)
1646 out->r = out->g = out->b = ilineara_g22(in->g, in->a);
1649 out->r = out->g = out->b = u16d(in->a * 257 *
1650 YfromRGB(g22_to_d[in->r], g22_to_d[in->g], g22_to_d[in->b]));
1652 out->a = 257 * in->a;
1659 gpc_Gprq(Pixel *out, const Pixel *in, const Background *back)
1663 if (in->r == in->g && in->g == in->b)
1664 out->r = out->g = out->b = ilineara_g22(in->g, in->a);
1667 out->r = out->g = out->b = u16d(in->a * 257 *
1668 YfromRGB(g22_to_d[in->r], g22_to_d[in->g], g22_to_d[in->b]));
1677 gpc_sRGB(Pixel *out, const Pixel *in, const Background *back)
1681 out->r = isRGB(in->r);
1683 if (in->g == in->r)
1687 if (in->b == in->r)
1691 out->b = isRGB(in->b);
1696 out->g = isRGB(in->g);
1698 if (in->b == in->r)
1701 else if (in->b == in->g)
1705 out->b = isRGB(in->b);
1713 gpc_unpg(Pixel *out, const Pixel *in, const Background *back)
1717 if (in->a <= 128)
1725 out->r = out->g = out->b = sRGB((double)in->g / in->a);
1726 out->a = u8d(in->a / 257.);
1732 gpc_unpc(Pixel *out, const Pixel *in, const Background *back)
1736 if (in->a <= 128)
1744 out->r = sRGB((double)in->r / in->a);
1745 out->g = sRGB((double)in->g / in->a);
1746 out->b = sRGB((double)in->b / in->a);
1747 out->a = u8d(in->a / 257.);
1753 gpc_b16g(Pixel *out, const Pixel *in, const Background *back)
1755 if (in->a <= 0)
1760 double a = in->a/65535.;
1764 out->r = out->g = out->b = sRGB(in->g * a + back->dg * a1);
1772 gpc_b16c(Pixel *out, const Pixel *in, const Background *back)
1774 if (in->a <= 0)
1783 double a = in->a/65535.;
1787 out->r = sRGB(in->r * a + back->dr * a1);
1788 out->g = sRGB(in->g * a + back->dg * a1);
1789 out->b = sRGB(in->b * a + back->db * a1);
1797 gpc_sG(Pixel *out, const Pixel *in, const Background *back)
1801 out->r = out->g = out->b = sRGB(YfromRGBint(in->r, in->g, in->b)/65535);
1807 gpc_sGp(Pixel *out, const Pixel *in, const Background *back)
1811 if (in->a <= 128)
1819 out->r = out->g = out->b = sRGB(YfromRGBint(in->r, in->g, in->b)/in->a);
1820 out->a = u8d(in->a / 257.);
1826 gpc_sCp(Pixel *out, const Pixel *in, const Background *back)
1830 if (in->a <= 128)
1838 out->r = sRGB((double)in->r / in->a);
1839 out->g = sRGB((double)in->g / in->a);
1840 out->b = sRGB((double)in->b / in->a);
1841 out->a = u8d(in->a / 257.);
1848 gpc_gb16(Pixel *out, const Pixel *in, const Background *back)
1850 if (in->a <= 0)
1853 else if (in->a >= 65535)
1854 out->r = out->g = out->b = isRGB(in->g);
1858 double a = in->a / 65535.;
1862 out->r = out->g = out->b = sRGB(in->g * a + back->dg * a1);
1870 gpc_cb16(Pixel *out, const Pixel *in, const Background *back)
1872 if (in->a <= 0)
1879 else if (in->a >= 65535)
1881 out->r = isRGB(in->r);
1882 out->g = isRGB(in->g);
1883 out->b = isRGB(in->b);
1888 double a = in->a / 65535.;
1892 out->r = sRGB(in->r * a + back->dr * a1);
1893 out->g = sRGB(in->g * a + back->dg * a1);
1894 out->b = sRGB(in->b * a + back->db * a1);
1903 gpc_A(Pixel *out, const Pixel *in, const Background *back)
1906 out->r = in->r;
1907 out->g = in->g;
1908 out->b = in->b;
1914 gpc_g16(Pixel *out, const Pixel *in, const Background *back)
1917 out->r = out->g = out->b = u16d(YfromRGBint(in->r, in->g, in->b));
1923 gpc_g16q(Pixel *out, const Pixel *in, const Background *back)
1926 out->r = out->g = out->b = u16d(YfromRGBint(in->r, in->g, in->b));
1927 out->a = in->a;
1933 (Pixel *out, const Pixel *in, const Background *back) =
1940 * IN G GA RGB RGBA G GA RGB RGBA
1950 * The matrix is held in an array indexed thus:
1959 static void (* const gpc_fn[8/*in*/][8/*out*/])
1960 (Pixel *out, const Pixel *in, const Background *back) =
1976 static void (* const gpc_fn_colormapped[8/*in*/][8/*out*/])
1977 (Pixel *out, const Pixel *in, const Background *back) =
1990 /* The error arrays record the error in the same matrix; 64 entries, however
1991 * the different algorithms used in libpng for colormap and direct conversions
1995 * In some cases the conversion between sRGB formats goes via a linear
1998 * error array from an arbitrary 'in' format to one of the four basic outputs
2002 * then instead of logging errors they are simply added in.
2005 * opaque input pixel values. Notice that alpha should be exact in each case.
2007 * Errors in alpha should only occur when converting from a direct format
2009 * errors can occur.) There should be no error in the '0' and 'opaque'
2010 * values. The fourth entry in the array is used for the alpha error (and it
2016 * impossible to obtain a reasonable result, these are held in
2046 void (*transform)(Pixel *out, const Pixel *in, const Background *back);
2049 void (*from_linear)(Pixel *out, const Pixel *in, const Background *back);
2054 * input pixels (in turn).
2058 /* Where these are stored in the static array (for 'accumulate') */
2101 /* Check for an error in this program: */
2131 * functions to deal with errors in the libpng implementation.
2143 * this program crashes in the even of a programming error.
2227 * provided; if pngstest crashes then that is a bug in this program
2269 * in instability in the low values and even with 16-bit precision sRGB(1) ends
2270 * up mapping to sRGB(0) as a result of rounding in the 16-bit representation.
2271 * This gives an error of 1 in the handling of value 1 only.
2273 * 2) libpng currently uses an intermediate 8-bit linear value in gamma
2274 * correction of 8-bit values. This results in many more errors, the worse of
2310 * ok in this case.
2348 const Pixel *in, const Pixel *calc, const Pixel *out, const char *reason)
2359 print_pixel(pixel_in, in, in_format);
2420 cmppixel(Transform *transform, png_const_voidp in, png_const_voidp out,
2427 transform->in_gp(&pixel_in, in);
2533 * The mask 'loc' contains the component offset of the channels in the
2595 /* Compare two images, the original 'a', which was written out then read back in
2641 * then there is a problem in libpng.
2690 /* This is used in logpixel to get the error message correct. */
2699 * accumulating errors in which case the program just ignores them.
2744 * instead, but first validate that the pixel indexes are in range (but
2782 * The fist two the tests (in the order given above) (using the boolean
2801 * out how, recording the result in the btoa array, which says where in
2812 * channel in b, where to find the corresponding value in a, for the
2824 alpha_added = bloc[0]; /* location of alpha channel in image b */
2830 alpha_removed = aloc[0]; /* location of alpha channel in image a */
3007 * not lost in the pass through a colormap format.
3037 in image->file_name, but uses
3038 * image->opts to choose the method. The file is always read in its native
3145 * FIO21-C.+Do+not+create+temporary+files+in+shared+directories
3234 /* This is non-fatal but ignoring it was causing serious problems in
3269 /* 'output' has an initialized temporary image, read this back in and compare
3372 copy.opts = opts; /* in case read_file needs to change it */
3410 /* This may involve a conversion via linear; in the ideal world
3491 /* This error should not exist in 1.7 or later: */
3632 /* Don't allow '\0' in file names, and terminate with '\n' or,
3671 unsigned int in;
3679 printf(" * and license in png.h\n");
3690 printf("static png_uint_16 gpc_error[16/*in*/][16/*out*/][4/*a*/] =\n");
3692 for (in=0; in<16; ++in)
3695 printf(" { /* input: %s */\n ", format_names[in]);
3702 printf(" %d", gpc_error[in][out][alpha]);
3714 if (in < 15)
3723 for (in=0; in<16; ++in)
3726 printf(" { /* input: %s */\n ", format_names[in]);
3733 printf(" %d", gpc_error_via_linear[in][out][alpha]);
3742 if (in < 15)
3751 for (in=0; in<8; ++in)
3754 printf(" { /* input: %s */\n ", format_names[in]);
3761 printf(" %d", gpc_error_to_colormap[in][out][alpha]);
3773 if (in < 7)
3815 fprintf(stderr, "pngstest: no read support in libpng, test skipped\n");