Compare commits
1395 Commits
libpng-1.6
...
v1.6.37
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a40189cf88 | ||
|
|
8da8257d0b | ||
|
|
27e8b99287 | ||
|
|
62a56d4fcc | ||
|
|
3342fafa60 | ||
|
|
3f0f1d5579 | ||
|
|
dcefbc7dcd | ||
|
|
1f0221fad7 | ||
|
|
a627bd26a3 | ||
|
|
82ae623ec9 | ||
|
|
9c0d5c77bf | ||
|
|
8439534daa | ||
|
|
70d122aac4 | ||
|
|
0a882b5787 | ||
|
|
fef895aa28 | ||
|
|
43b4141839 | ||
|
|
6a94d14567 | ||
|
|
0e13545712 | ||
|
|
eddf902320 | ||
|
|
85acd919b9 | ||
|
|
e79085a172 | ||
|
|
81a65de25d | ||
|
|
702a07e716 | ||
|
|
7b2224cb6e | ||
|
|
ee7967eea4 | ||
|
|
a54a0562c5 | ||
|
|
94429a335b | ||
|
|
1ceaa83a84 | ||
|
|
b66ed71131 | ||
|
|
7734cda20c | ||
|
|
2fc5ddff18 | ||
|
|
8033c96f32 | ||
|
|
d3d1baadb4 | ||
|
|
a294c1bcb6 | ||
|
|
ceb327789b | ||
|
|
1ef8882814 | ||
|
|
58eedced25 | ||
|
|
1d89a5db66 | ||
|
|
43446b735d | ||
|
|
6c059f8f5b | ||
|
|
f5d48df418 | ||
|
|
9730362202 | ||
|
|
7cb7afb43d | ||
|
|
1bd4214a42 | ||
|
|
6d55a14c58 | ||
|
|
8440326590 | ||
|
|
b729fff4a3 | ||
|
|
c36c09f004 | ||
|
|
a873893279 | ||
|
|
47f18784e4 | ||
|
|
d4fb621429 | ||
|
|
fb6312a9f9 | ||
|
|
ddc842bf06 | ||
|
|
46924bd877 | ||
|
|
8da397423e | ||
|
|
c17d164b44 | ||
|
|
46aedd8961 | ||
|
|
2471434d29 | ||
|
|
8a05766cb7 | ||
|
|
a74aa9a002 | ||
|
|
916117d970 | ||
|
|
7784cd3f6f | ||
|
|
cde1e1fe79 | ||
|
|
0e06b5948c | ||
|
|
3fecfeada1 | ||
|
|
140f3aa280 | ||
|
|
eb91c0e4ed | ||
|
|
d5e4915ebe | ||
|
|
fe669f6f38 | ||
|
|
84e6e35675 | ||
|
|
28d0ee757d | ||
|
|
f07b985ddb | ||
|
|
d532334ef5 | ||
|
|
7292c861b1 | ||
|
|
fc32eb1662 | ||
|
|
7ca2f0e078 | ||
|
|
babae66b48 | ||
|
|
3403a6e387 | ||
|
|
b196bd6566 | ||
|
|
f23b41d7b1 | ||
|
|
7125401411 | ||
|
|
4b52ef8e76 | ||
|
|
5d7b4ab289 | ||
|
|
7ee802a5a2 | ||
|
|
2f8b82ebca | ||
|
|
aea0ec4346 | ||
|
|
af08094ba6 | ||
|
|
9bddba26de | ||
|
|
3b5bcea010 | ||
|
|
adefba1b03 | ||
|
|
48a2460393 | ||
|
|
2be0f33e7c | ||
|
|
ccc77d2a8d | ||
|
|
f648294931 | ||
|
|
83f27f018c | ||
|
|
fefe0affc1 | ||
|
|
a3d1057a73 | ||
|
|
12384eae6f | ||
|
|
357af1f095 | ||
|
|
ab791fc9d6 | ||
|
|
f5f8b98dbb | ||
|
|
293b6aaa59 | ||
|
|
98a3b2a5c2 | ||
|
|
78ad1208d6 | ||
|
|
477a241c10 | ||
|
|
edb1f47139 | ||
|
|
0f9f170e9f | ||
|
|
99d4a62c9a | ||
|
|
2227793efc | ||
|
|
b78804f9a2 | ||
|
|
345fc37fdc | ||
|
|
c1effe1bbf | ||
|
|
2ee8cb0559 | ||
|
|
414de98047 | ||
|
|
0512c63533 | ||
|
|
cae11e3e43 | ||
|
|
4f0a0b9a94 | ||
|
|
dc22583aca | ||
|
|
346cbf2c2a | ||
|
|
8eb79b3435 | ||
|
|
13a158690f | ||
|
|
e4c8312d31 | ||
|
|
3d2d0b52a3 | ||
|
|
073fe76f6a | ||
|
|
4b7635ce72 | ||
|
|
96333b6bea | ||
|
|
90dd185aed | ||
|
|
8746d57184 | ||
|
|
0165badb9d | ||
|
|
60d297d592 | ||
|
|
2da37077db | ||
|
|
e1220aefc4 | ||
|
|
5efa483265 | ||
|
|
5f0c9fabbc | ||
|
|
397c7eea38 | ||
|
|
066cb34268 | ||
|
|
721b96ef90 | ||
|
|
562a68513e | ||
|
|
a7722aee32 | ||
|
|
413de0a56a | ||
|
|
04e16d2817 | ||
|
|
d1a0937cae | ||
|
|
1c98b85886 | ||
|
|
4de130c255 | ||
|
|
4ddead1e1c | ||
|
|
d7edcc40e4 | ||
|
|
7d40b53fbf | ||
|
|
76b269b1f4 | ||
|
|
61d29bfc80 | ||
|
|
0f2adc19eb | ||
|
|
1aabcfdbae | ||
|
|
b5ae93d72e | ||
|
|
6a2a762914 | ||
|
|
50c9e15a7d | ||
|
|
c0f02a8078 | ||
|
|
3789cba2f2 | ||
|
|
8592873f24 | ||
|
|
051dcaf877 | ||
|
|
95046512a4 | ||
|
|
4e9839d453 | ||
|
|
d17041f052 | ||
|
|
cbcb39932c | ||
|
|
52a566af97 | ||
|
|
9050c32365 | ||
|
|
4911714f74 | ||
|
|
c77de19ba9 | ||
|
|
051d6cc19b | ||
|
|
61e0a38091 | ||
|
|
fca1862ac9 | ||
|
|
c2c8b398a9 | ||
|
|
9495ab477b | ||
|
|
62a2463211 | ||
|
|
dcd3edaf87 | ||
|
|
b47e0f5ceb | ||
|
|
84a5bf83ff | ||
|
|
f3a22d396a | ||
|
|
eb2f42aa97 | ||
|
|
47aa798127 | ||
|
|
5c27e93f51 | ||
|
|
efaf42e5df | ||
|
|
d3220babe2 | ||
|
|
a1b5be044f | ||
|
|
58720d3c06 | ||
|
|
d64c5ea1a8 | ||
|
|
50d2d49220 | ||
|
|
d2b9af04ac | ||
|
|
321c24b0d7 | ||
|
|
14a8996fe6 | ||
|
|
ef76b1f688 | ||
|
|
5c616548a0 | ||
|
|
da923d334d | ||
|
|
e06ec26906 | ||
|
|
f6ca33d42c | ||
|
|
f8110669f0 | ||
|
|
df7e9dae0c | ||
|
|
4760bac13d | ||
|
|
737f347f23 | ||
|
|
1257369169 | ||
|
|
de315dfaad | ||
|
|
ba5f7f6a3e | ||
|
|
b0d14c7d13 | ||
|
|
735fde494a | ||
|
|
d2533b96f3 | ||
|
|
ddabd0c70a | ||
|
|
945759162e | ||
|
|
bcb739a864 | ||
|
|
90b437e372 | ||
|
|
ab3ea490fd | ||
|
|
d19e8b9a4b | ||
|
|
c5f801c82b | ||
|
|
7b8b7115d9 | ||
|
|
646fad9d55 | ||
|
|
06ec4252a4 | ||
|
|
33848546a3 | ||
|
|
fa2f72258a | ||
|
|
7653aaa4b1 | ||
|
|
c362a8c80e | ||
|
|
c339da7fc2 | ||
|
|
33787340a4 | ||
|
|
cf713fb0ab | ||
|
|
c82ae40e9f | ||
|
|
099558d100 | ||
|
|
8ed418b042 | ||
|
|
39d84f4f6a | ||
|
|
c5c778bcfc | ||
|
|
1ebe4f75cc | ||
|
|
13bc0b6b1f | ||
|
|
fcd1bb9312 | ||
|
|
c33d624988 | ||
|
|
0ec733ce61 | ||
|
|
dbdeb1f3fa | ||
|
|
3d7f3e57b5 | ||
|
|
a64c8ca9e9 | ||
|
|
378e926d78 | ||
|
|
3a957dd96f | ||
|
|
554d4400ab | ||
|
|
2037030d50 | ||
|
|
207392821d | ||
|
|
2dca15686f | ||
|
|
469317d9bd | ||
|
|
894a9869dd | ||
|
|
c14be73428 | ||
|
|
2dbef2f2a9 | ||
|
|
4ac8b5e0d6 | ||
|
|
9d4215e6c0 | ||
|
|
d683af0f12 | ||
|
|
095b4ce16b | ||
|
|
bfdabdacff | ||
|
|
6f89dff45e | ||
|
|
d930d36155 | ||
|
|
a1fe2c9848 | ||
|
|
6b53a5ed7b | ||
|
|
70041f4038 | ||
|
|
96b65b3644 | ||
|
|
347538efbd | ||
|
|
2b37d46564 | ||
|
|
2df5c96352 | ||
|
|
3fa1df48a1 | ||
|
|
f30f1ae3ea | ||
|
|
7c709f039f | ||
|
|
f8de55da04 | ||
|
|
fd6b87253c | ||
|
|
821b1dcf34 | ||
|
|
611b29acd8 | ||
|
|
71a56180e5 | ||
|
|
cb628b2e4e | ||
|
|
bc68c41d5f | ||
|
|
4aad3c0eb0 | ||
|
|
68a80b10fe | ||
|
|
c17b7b38b0 | ||
|
|
91540c56af | ||
|
|
90d3ff290f | ||
|
|
619cf868e6 | ||
|
|
3524b0d201 | ||
|
|
3e753f5cbe | ||
|
|
c77274ffa9 | ||
|
|
323c8655cf | ||
|
|
40afb68570 | ||
|
|
4ab78af90a | ||
|
|
b73c891891 | ||
|
|
fbff8986e7 | ||
|
|
9fcb846402 | ||
|
|
136b3203f4 | ||
|
|
1ed0b3f7ca | ||
|
|
a354e5c1ff | ||
|
|
3de6fa1122 | ||
|
|
db16b27d11 | ||
|
|
d2fcc41eec | ||
|
|
cd37210184 | ||
|
|
a5b6751bbd | ||
|
|
cd8eb93ecb | ||
|
|
68cb0aaee3 | ||
|
|
40943eb67a | ||
|
|
f78a3e7326 | ||
|
|
72d07d3202 | ||
|
|
ecea632c4c | ||
|
|
fd9c48fd9c | ||
|
|
f2621c5137 | ||
|
|
a947052ec2 | ||
|
|
0a9d2719c5 | ||
|
|
aa6e0482fa | ||
|
|
77a063af16 | ||
|
|
5cc23552a7 | ||
|
|
76b3a7e78f | ||
|
|
2b80b401be | ||
|
|
f16c3406cd | ||
|
|
918a6ac2b4 | ||
|
|
bd5a826d37 | ||
|
|
50b6df5389 | ||
|
|
857ef82edf | ||
|
|
f380ae5243 | ||
|
|
23b51990e3 | ||
|
|
77417b8ea0 | ||
|
|
eed9efec4e | ||
|
|
b5c16f8bfc | ||
|
|
89b8c133e7 | ||
|
|
54126d5c59 | ||
|
|
660ce58597 | ||
|
|
9f7134c3fc | ||
|
|
145361aaac | ||
|
|
8c552ddf5b | ||
|
|
58649f19cb | ||
|
|
14be73c8a3 | ||
|
|
87cd2dc07d | ||
|
|
2d306c4b15 | ||
|
|
5aaf6e889c | ||
|
|
c548328904 | ||
|
|
11629b1c1a | ||
|
|
774922da91 | ||
|
|
7da2ea45b9 | ||
|
|
95f3c07d6f | ||
|
|
a315efe3b2 | ||
|
|
6155c6629d | ||
|
|
d40ac082ef | ||
|
|
d2ac910a53 | ||
|
|
a1577bf965 | ||
|
|
e486c76253 | ||
|
|
30d1f909ed | ||
|
|
8359b90057 | ||
|
|
11c25c0e9e | ||
|
|
b99308a33c | ||
|
|
170a44b222 | ||
|
|
0808d75851 | ||
|
|
2eff8ef504 | ||
|
|
60d8ae1003 | ||
|
|
53f22aed41 | ||
|
|
13370c536c | ||
|
|
054be18721 | ||
|
|
64f81108db | ||
|
|
ead7079f1d | ||
|
|
82add753e5 | ||
|
|
b3ffdc5991 | ||
|
|
e744ee1338 | ||
|
|
ab8dbdcce5 | ||
|
|
7bbd665b34 | ||
|
|
dce241c107 | ||
|
|
8c50acb9d2 | ||
|
|
92fcd25e9d | ||
|
|
9b0170dd03 | ||
|
|
2239961279 | ||
|
|
18834ff62b | ||
|
|
03a6f3f9c9 | ||
|
|
b363e01e6b | ||
|
|
d42e88d5b3 | ||
|
|
fae874c8ca | ||
|
|
0b1f7e412b | ||
|
|
a8de1a70d1 | ||
|
|
7db98a18fe | ||
|
|
a7029a5b4c | ||
|
|
4f31b7f242 | ||
|
|
b475d0593c | ||
|
|
862a2858b0 | ||
|
|
364450bf8d | ||
|
|
f6d358ff42 | ||
|
|
7980c79d69 | ||
|
|
5e8c50cc8d | ||
|
|
7218761fe1 | ||
|
|
3644db298b | ||
|
|
29775cef5e | ||
|
|
a343882c74 | ||
|
|
6f6c396604 | ||
|
|
483bcad21d | ||
|
|
310dee21f7 | ||
|
|
d1c12e85c1 | ||
|
|
99d7285f20 | ||
|
|
d4bdca45b3 | ||
|
|
58e9d5d59d | ||
|
|
7428ca944d | ||
|
|
ae15e839d9 | ||
|
|
8a242668fd | ||
|
|
b42e8bce3a | ||
|
|
b1be78460a | ||
|
|
d57bed7838 | ||
|
|
b8afc73b73 | ||
|
|
19425d32f3 | ||
|
|
9bd58f9387 | ||
|
|
f2b829166d | ||
|
|
ab2a639a2a | ||
|
|
0aa1b967f0 | ||
|
|
80041d15b2 | ||
|
|
2cc569eab7 | ||
|
|
bea573d370 | ||
|
|
d0d310f1cb | ||
|
|
3907feb306 | ||
|
|
acb155d893 | ||
|
|
c47ddcf22b | ||
|
|
565d4beea2 | ||
|
|
c43aaa8b20 | ||
|
|
6ddcd33daa | ||
|
|
24b27e5948 | ||
|
|
f604c74a5f | ||
|
|
c3f4e5fb1a | ||
|
|
adbf1d6d1c | ||
|
|
9b0311a4d8 | ||
|
|
b455622aa8 | ||
|
|
ccef5edbfe | ||
|
|
91acd4baf8 | ||
|
|
6ff408d423 | ||
|
|
ee5804fa14 | ||
|
|
2b6e59d968 | ||
|
|
ae794eefaa | ||
|
|
dd24a6ca15 | ||
|
|
a0e3160ad4 | ||
|
|
4c0740c8de | ||
|
|
8c6c9e6d56 | ||
|
|
f8fe5f8560 | ||
|
|
eaca53a2d9 | ||
|
|
bef76802de | ||
|
|
ebede25ceb | ||
|
|
4ddac468c4 | ||
|
|
0a181e1665 | ||
|
|
17ad597dba | ||
|
|
b784934049 | ||
|
|
93b3476358 | ||
|
|
6df2225c55 | ||
|
|
562751dcc9 | ||
|
|
3785125faf | ||
|
|
edef058e18 | ||
|
|
16fe975928 | ||
|
|
24dfd3f2d7 | ||
|
|
f8bdbd4d8f | ||
|
|
f981826204 | ||
|
|
14e885a54c | ||
|
|
dd8aa3e939 | ||
|
|
29b9fd605e | ||
|
|
aa5bb2c3dd | ||
|
|
993bd61329 | ||
|
|
b9b490c7f5 | ||
|
|
09fae1b5d3 | ||
|
|
e4b59e5583 | ||
|
|
e9c3d83d5a | ||
|
|
812768d7a9 | ||
|
|
a3b5edc934 | ||
|
|
aaed6782e8 | ||
|
|
fd3a683b2a | ||
|
|
08d00b25d8 | ||
|
|
61a9a054fd | ||
|
|
bf90247a63 | ||
|
|
4708ca268e | ||
|
|
7bb00afec3 | ||
|
|
13a354f81e | ||
|
|
8187ba1518 | ||
|
|
dbb5fce3d8 | ||
|
|
d65a92b951 | ||
|
|
a69dd76eac | ||
|
|
e36003e9b8 | ||
|
|
2accfbd6f3 | ||
|
|
858cb585d7 | ||
|
|
35cbe7640b | ||
|
|
0c440812db | ||
|
|
436ce2c6e9 | ||
|
|
a1312f7b19 | ||
|
|
01e99bbac1 | ||
|
|
dd6d7f031f | ||
|
|
f7fe4db91b | ||
|
|
a106899acd | ||
|
|
ffaeff82d3 | ||
|
|
13bdd8bcdf | ||
|
|
7d7694ae6a | ||
|
|
b3540f9932 | ||
|
|
a5084f1522 | ||
|
|
565a751ca2 | ||
|
|
f6497e03d1 | ||
|
|
b7b59b7fe9 | ||
|
|
890611200a | ||
|
|
ce45f85c61 | ||
|
|
761d833372 | ||
|
|
3875d9af4c | ||
|
|
ad3318ddc8 | ||
|
|
7184475a98 | ||
|
|
c180e7a437 | ||
|
|
fbe3e002bc | ||
|
|
b5b77a72b4 | ||
|
|
97dfccb632 | ||
|
|
319c9852bf | ||
|
|
1b363fa6b0 | ||
|
|
fa24421216 | ||
|
|
d84fd77bf8 | ||
|
|
04dab1e82d | ||
|
|
394be58371 | ||
|
|
217546ae43 | ||
|
|
8aa1638ccc | ||
|
|
89ea081433 | ||
|
|
7835716cef | ||
|
|
cb1787f033 | ||
|
|
1842d7c865 | ||
|
|
bc2bb96cd7 | ||
|
|
5cb1700702 | ||
|
|
7dc0329250 | ||
|
|
90ea4af4a1 | ||
|
|
a744b11975 | ||
|
|
597b1a1b5e | ||
|
|
f0b453bc3e | ||
|
|
c9d7b865b6 | ||
|
|
eb5cdf0c64 | ||
|
|
e3a6631123 | ||
|
|
434aecf327 | ||
|
|
abd88841ef | ||
|
|
42e5441888 | ||
|
|
01b6ca34b7 | ||
|
|
4ade4e8a0d | ||
|
|
d1f14c829a | ||
|
|
b43133b361 | ||
|
|
2e2330bf25 | ||
|
|
0a2d496d58 | ||
|
|
000f07bfbe | ||
|
|
2e7c3a6e70 | ||
|
|
05a4db1fcd | ||
|
|
ee5e39835c | ||
|
|
143434ac78 | ||
|
|
4dc4b2efac | ||
|
|
e175eb1ffb | ||
|
|
4be85e1b37 | ||
|
|
9cab7a24fd | ||
|
|
39df0ced18 | ||
|
|
2705f55221 | ||
|
|
4679be7c2b | ||
|
|
935676cdad | ||
|
|
8ff2ed2fe1 | ||
|
|
6bdaf38d12 | ||
|
|
e018ab98be | ||
|
|
92a7c79db2 | ||
|
|
19fefd3a4b | ||
|
|
cdc0e74ee6 | ||
|
|
0c29ab2b31 | ||
|
|
b50d5cea2b | ||
|
|
3d3c23b39f | ||
|
|
2bb9ee89fa | ||
|
|
96db0fff50 | ||
|
|
99663e95f8 | ||
|
|
1153ddccb6 | ||
|
|
8d091a640b | ||
|
|
2c0b7a8ff6 | ||
|
|
faa3e537e1 | ||
|
|
0a5e99d7ee | ||
|
|
d1f9149d8a | ||
|
|
ee079481c9 | ||
|
|
639b48625f | ||
|
|
dd70604cec | ||
|
|
34c783e2fe | ||
|
|
82d0009885 | ||
|
|
baed0e32f9 | ||
|
|
3c7c436303 | ||
|
|
9b14f5f85a | ||
|
|
0fd9a249de | ||
|
|
7a18a2de59 | ||
|
|
5d7c7d5132 | ||
|
|
192e92d681 | ||
|
|
1b9f4817c8 | ||
|
|
d9940f6207 | ||
|
|
f7d5419816 | ||
|
|
9928ee0a52 | ||
|
|
66f796e74c | ||
|
|
a3eac818d5 | ||
|
|
cfc19ff1b6 | ||
|
|
80495124b2 | ||
|
|
2c21a4778d | ||
|
|
14b8dee96f | ||
|
|
11c88033d4 | ||
|
|
25bb30c9b8 | ||
|
|
54feb0ad2a | ||
|
|
b733c50bc0 | ||
|
|
a93744423d | ||
|
|
9957c45073 | ||
|
|
0ac91cc657 | ||
|
|
d9779744f9 | ||
|
|
ed5a01d922 | ||
|
|
d43f93ff93 | ||
|
|
3f2879bf60 | ||
|
|
ee1e535298 | ||
|
|
4b4a9583b4 | ||
|
|
da2ba024a5 | ||
|
|
e5d468ea9c | ||
|
|
21d9e6e0fb | ||
|
|
98af505439 | ||
|
|
1df0ace0b4 | ||
|
|
4af267c07b | ||
|
|
6c7c5a04b8 | ||
|
|
42069e9432 | ||
|
|
36762ac4b4 | ||
|
|
147dc568da | ||
|
|
29135161d7 | ||
|
|
9c04f57cab | ||
|
|
e1123aa80c | ||
|
|
4a8105e925 | ||
|
|
51df269afe | ||
|
|
bf2613b975 | ||
|
|
5c6b7e177c | ||
|
|
428f5ddabd | ||
|
|
a4b26efa1f | ||
|
|
5a8b04137f | ||
|
|
87c14c528a | ||
|
|
5756fcab2f | ||
|
|
047737496a | ||
|
|
b9c62013ef | ||
|
|
287fb89248 | ||
|
|
2b667e4923 | ||
|
|
070a616b82 | ||
|
|
da7a1e79af | ||
|
|
eed640dbe8 | ||
|
|
d55c4f32fc | ||
|
|
238e7646a8 | ||
|
|
d21eae44e7 | ||
|
|
1cc02f0395 | ||
|
|
a710317d2f | ||
|
|
339ef1ec97 | ||
|
|
0e60f06b7c | ||
|
|
a066d49b01 | ||
|
|
05f3788b7a | ||
|
|
90e288241d | ||
|
|
fca68966b2 | ||
|
|
a4f7ea0d11 | ||
|
|
41db297e63 | ||
|
|
0da9cf38cd | ||
|
|
d14caad2e9 | ||
|
|
c2ac10b502 | ||
|
|
c86cf4b7e4 | ||
|
|
981560ae60 | ||
|
|
d5a80e0944 | ||
|
|
5a13159bfc | ||
|
|
ae1b45a046 | ||
|
|
187694b9ec | ||
|
|
3484a760f4 | ||
|
|
715423c8d6 | ||
|
|
d57dc304c4 | ||
|
|
8a2033d77f | ||
|
|
932d7ac5e9 | ||
|
|
f9accb9df2 | ||
|
|
7a4e497b62 | ||
|
|
0207529f27 | ||
|
|
a08f60352c | ||
|
|
0bddb27e75 | ||
|
|
a67ddd4b9f | ||
|
|
a7e9d7bfc2 | ||
|
|
28c3a2f9f9 | ||
|
|
df0773c1b9 | ||
|
|
902dbe619e | ||
|
|
0f59bbb5b6 | ||
|
|
9ca5f1bdc8 | ||
|
|
9f01d0d665 | ||
|
|
da544d7d3e | ||
|
|
ea8d0b9408 | ||
|
|
9287447cef | ||
|
|
d35a3a826e | ||
|
|
e23fedc9de | ||
|
|
cd3f5bb507 | ||
|
|
b0270a9e47 | ||
|
|
52cbf46f30 | ||
|
|
d61b42c81d | ||
|
|
8fd9c16642 | ||
|
|
e22ea758e4 | ||
|
|
f22c0ac2a5 | ||
|
|
4f547b7177 | ||
|
|
c4fe32016c | ||
|
|
1be5c22e5c | ||
|
|
956c0599e6 | ||
|
|
97c8fbb949 | ||
|
|
a50ce74850 | ||
|
|
8973ee17bb | ||
|
|
2e31b96a5a | ||
|
|
0222124801 | ||
|
|
61b23d59b1 | ||
|
|
cc1fa5df3a | ||
|
|
cc5664ddad | ||
|
|
e209df47c4 | ||
|
|
585f8b49b5 | ||
|
|
4491fa237f | ||
|
|
59d3ef11ed | ||
|
|
6bc7fc80da | ||
|
|
5b03469a93 | ||
|
|
f5b9abde98 | ||
|
|
340c9b237b | ||
|
|
fb2bd00859 | ||
|
|
5109688803 | ||
|
|
8fdd2fcef6 | ||
|
|
e7625063dc | ||
|
|
24f40e321c | ||
|
|
0bb898a885 | ||
|
|
61a2d8a2a7 | ||
|
|
af96543688 | ||
|
|
34f5449736 | ||
|
|
484a48e221 | ||
|
|
cc5226bf2a | ||
|
|
8fbb563f4e | ||
|
|
65e6d5a34f | ||
|
|
47be2e7c3a | ||
|
|
4d694dadd8 | ||
|
|
59397f985e | ||
|
|
cc1d4d0dbc | ||
|
|
070434c045 | ||
|
|
0dc882d7c3 | ||
|
|
c3ac9a507a | ||
|
|
a6afebc718 | ||
|
|
d41915dc2a | ||
|
|
5a5ad7a5fa | ||
|
|
9dad5e37ae | ||
|
|
adde7b5c1e | ||
|
|
3bdde42e40 | ||
|
|
6b4dee12f5 | ||
|
|
355b90387b | ||
|
|
f512ca7625 | ||
|
|
16ee3e9870 | ||
|
|
c8444775b1 | ||
|
|
784d80b509 | ||
|
|
98aacb16c3 | ||
|
|
8a35e25852 | ||
|
|
97eb073189 | ||
|
|
28534bd47a | ||
|
|
2053a26873 | ||
|
|
736a230890 | ||
|
|
3926448598 | ||
|
|
11130874d4 | ||
|
|
ef5a57119a | ||
|
|
31f4e52842 | ||
|
|
0e1aad158a | ||
|
|
5f5d6d637b | ||
|
|
a2336bcf05 | ||
|
|
20e6003290 | ||
|
|
54c633b810 | ||
|
|
f0c2cc32b1 | ||
|
|
8709982e22 | ||
|
|
686d45dcfd | ||
|
|
8502e1ff25 | ||
|
|
603c9fd959 | ||
|
|
86946fdc03 | ||
|
|
af4c99b21a | ||
|
|
97d2d68428 | ||
|
|
ce5d7cb7aa | ||
|
|
c4ff4e7167 | ||
|
|
b94d24eb25 | ||
|
|
379d0160ea | ||
|
|
23c2ea38a6 | ||
|
|
d486eb18c5 | ||
|
|
a10d488a32 | ||
|
|
25d754e86d | ||
|
|
bba85637d7 | ||
|
|
94c3a45f4c | ||
|
|
221be3def1 | ||
|
|
1daf8980dd | ||
|
|
5945408a93 | ||
|
|
9a8c568e3c | ||
|
|
fb05477e11 | ||
|
|
df68ef4d5e | ||
|
|
d857ed275e | ||
|
|
14181b7f48 | ||
|
|
6916ec5fa9 | ||
|
|
acb4822f6b | ||
|
|
79fb836d66 | ||
|
|
010110a0be | ||
|
|
756f873a25 | ||
|
|
e2d740ae04 | ||
|
|
ff244b6181 | ||
|
|
d3494d172c | ||
|
|
2922c07e67 | ||
|
|
c03a949a0d | ||
|
|
377e3ca5e6 | ||
|
|
f320728911 | ||
|
|
b4a5d88e0a | ||
|
|
7ea0b3b9e2 | ||
|
|
aa3725c860 | ||
|
|
8aa84c7fce | ||
|
|
453ceae85f | ||
|
|
1f5a0b9fa6 | ||
|
|
820a8d1de9 | ||
|
|
6bb02b28a1 | ||
|
|
60ba227d57 | ||
|
|
175e21f5e1 | ||
|
|
97db6709e4 | ||
|
|
c0fc0dfc45 | ||
|
|
f3eadd1737 | ||
|
|
c4ec48281c | ||
|
|
1a006390d9 | ||
|
|
953f265513 | ||
|
|
468877578a | ||
|
|
ff14eeb4f2 | ||
|
|
5f3eabf4cd | ||
|
|
bbc70d2471 | ||
|
|
a0cafa3d0b | ||
|
|
58219ca22f | ||
|
|
50b28f3bf2 | ||
|
|
0f8345abf7 | ||
|
|
4f213e08aa | ||
|
|
8493de3cee | ||
|
|
fee6e7428f | ||
|
|
d10616d364 | ||
|
|
85d143a273 | ||
|
|
6e72bc46d3 | ||
|
|
b8eed1d830 | ||
|
|
a64ecdfa5b | ||
|
|
bcfc0ce5f6 | ||
|
|
8bc0719dde | ||
|
|
185cd6c058 | ||
|
|
afb77541b4 | ||
|
|
c4a5c2de26 | ||
|
|
87bc4b08ff | ||
|
|
65cdb3dfa8 | ||
|
|
cc411ae004 | ||
|
|
f521b99b09 | ||
|
|
b08f330d62 | ||
|
|
41ffb1c950 | ||
|
|
ebe3ea3204 | ||
|
|
d94c4516c6 | ||
|
|
b0f8d9bb97 | ||
|
|
04dfe7b3f6 | ||
|
|
547afcfc74 | ||
|
|
48afdb4eef | ||
|
|
9ee96e3ba9 | ||
|
|
0311f5412e | ||
|
|
e734eba51e | ||
|
|
7ed40716cb | ||
|
|
155889b318 | ||
|
|
4dd011f6d0 | ||
|
|
e45a5d3a32 | ||
|
|
80a1050237 | ||
|
|
54592bba4d | ||
|
|
902d4d109a | ||
|
|
d8daacf157 | ||
|
|
0da5bcb414 | ||
|
|
ac6555fa3c | ||
|
|
2af7ef63c3 | ||
|
|
6da5b35fca | ||
|
|
abd68eb92b | ||
|
|
bf451ffc9a | ||
|
|
be734f5592 | ||
|
|
9f0c080847 | ||
|
|
3a1ba773b0 | ||
|
|
849a1ab845 | ||
|
|
940de5ab02 | ||
|
|
dd9578f379 | ||
|
|
0ce807691b | ||
|
|
4f8ea5eede | ||
|
|
7869e676af | ||
|
|
af0a726689 | ||
|
|
8d9263fca6 | ||
|
|
d6a0cbaade | ||
|
|
2302a4d04f | ||
|
|
8f9a2d08ea | ||
|
|
30c73195b5 | ||
|
|
097485195c | ||
|
|
c5f6fa110a | ||
|
|
90cfcecc09 | ||
|
|
dee0e2ed0f | ||
|
|
5ad9884ff1 | ||
|
|
188eb6b426 | ||
|
|
8361f64dbf | ||
|
|
2a6227941e | ||
|
|
a582b8f840 | ||
|
|
5316f66005 | ||
|
|
f86905457a | ||
|
|
abb211c4e8 | ||
|
|
bb56c39d16 | ||
|
|
77237196c7 | ||
|
|
a310a3b398 | ||
|
|
e0f6c7d90b | ||
|
|
a1587302aa | ||
|
|
cc0bff446b | ||
|
|
9b8ddff5b7 | ||
|
|
ac4942e26b | ||
|
|
2c55e3e917 | ||
|
|
db082802c6 | ||
|
|
b367fb5ac6 | ||
|
|
e9ab2f8d94 | ||
|
|
a845cca037 | ||
|
|
3ab6ef0aa1 | ||
|
|
198ed18b9e | ||
|
|
9110473f93 | ||
|
|
97313e0aab | ||
|
|
8876e74e43 | ||
|
|
510227e39e | ||
|
|
7a1f214166 | ||
|
|
5913dd10f1 | ||
|
|
087ebd80da | ||
|
|
bc9267e3a6 | ||
|
|
a019c335c9 | ||
|
|
ed49c8c1b6 | ||
|
|
2a243fc074 | ||
|
|
47045ce402 | ||
|
|
d6e67586bf | ||
|
|
6e9783bd25 | ||
|
|
8dc3729522 | ||
|
|
7aad4e7fb4 | ||
|
|
930af7d50b | ||
|
|
0f544f62d6 | ||
|
|
398c212955 | ||
|
|
2ec1fc60c3 | ||
|
|
c01ee053b1 | ||
|
|
b0baee5e36 | ||
|
|
b55295cb12 | ||
|
|
5928ee97ca | ||
|
|
2445ad4331 | ||
|
|
93d6d9d835 | ||
|
|
d207e6a6ad | ||
|
|
df6f3f404a | ||
|
|
357c1c8c53 | ||
|
|
44827ccad8 | ||
|
|
0d1a2dd7a9 | ||
|
|
471c9b47fe | ||
|
|
23b9a2fda0 | ||
|
|
7d6103ad6c | ||
|
|
ec39f8f8d7 | ||
|
|
a2cde53c87 | ||
|
|
13714e87f2 | ||
|
|
9101d75316 | ||
|
|
233edbf415 | ||
|
|
bd209f75fa | ||
|
|
27854a478e | ||
|
|
f12a87a96c | ||
|
|
cb4358ddbb | ||
|
|
c4819d78ba | ||
|
|
0b721cd4c4 | ||
|
|
b025757328 | ||
|
|
4bd73b6947 | ||
|
|
f3c42680db | ||
|
|
c10066205d | ||
|
|
21b7aaa428 | ||
|
|
d7225fdfce | ||
|
|
deb870c77d | ||
|
|
c05538959b | ||
|
|
f6c761dda1 | ||
|
|
877b08d6d2 | ||
|
|
a69064328b | ||
|
|
01b9566e50 | ||
|
|
ca3a100be6 | ||
|
|
1655e4ddb0 | ||
|
|
526f839764 | ||
|
|
1a86bd2a09 | ||
|
|
610e7b5bd6 | ||
|
|
86f6c04d84 | ||
|
|
fb3a1da4bb | ||
|
|
525efcbb7b | ||
|
|
ea4340e1ec | ||
|
|
91f3864fbd | ||
|
|
14fa704caf | ||
|
|
ad1f8180a5 | ||
|
|
e364f899af | ||
|
|
40683870ea | ||
|
|
7569d7c069 | ||
|
|
c87ddbb3ce | ||
|
|
793fedcf57 | ||
|
|
74fd86a69e | ||
|
|
f234091207 | ||
|
|
772b72139a | ||
|
|
6e6a844baf | ||
|
|
2f2f80273b | ||
|
|
353d8860ac | ||
|
|
fab96cb72a | ||
|
|
2203e41900 | ||
|
|
e16f2bc5f7 | ||
|
|
2381cf3269 | ||
|
|
7e3a82cd9c | ||
|
|
115817d118 | ||
|
|
5cfea4fc98 | ||
|
|
a87c870f99 | ||
|
|
b9d671326b | ||
|
|
8e4e070151 | ||
|
|
4607e1386f | ||
|
|
9686172872 | ||
|
|
8563ac1664 | ||
|
|
9a80a35f4b | ||
|
|
4cde19b0c9 | ||
|
|
230e8b436f | ||
|
|
dbb86efac3 | ||
|
|
e8d28e1b1c | ||
|
|
a3a5d0d1f4 | ||
|
|
4cf1ca4338 | ||
|
|
f174f27096 | ||
|
|
1a15762c59 | ||
|
|
fec6a4ca4e | ||
|
|
bcc878bb81 | ||
|
|
df61a00acc | ||
|
|
878fea5403 | ||
|
|
804cc98cd1 | ||
|
|
6e00020a9f | ||
|
|
2aac9a1fa3 | ||
|
|
5aa8676122 | ||
|
|
ea88d94dcf | ||
|
|
eaa1b0a5f2 | ||
|
|
de5c932283 | ||
|
|
3b673e0fb0 | ||
|
|
83b84d65c2 | ||
|
|
c31e04e2f8 | ||
|
|
a460e00574 | ||
|
|
c593d488f9 | ||
|
|
44a7c89e02 | ||
|
|
88bbbfa567 | ||
|
|
e3f9ce59eb | ||
|
|
12f0c2f580 | ||
|
|
6099e57b07 | ||
|
|
e53ecd35c0 | ||
|
|
8397b45b20 | ||
|
|
bcb1b414ed | ||
|
|
bef02a89ea | ||
|
|
1aae1bf9fd | ||
|
|
078f2aecfb | ||
|
|
c87f913eb9 | ||
|
|
a5fc3eb9d4 | ||
|
|
780dc06584 | ||
|
|
365cddf35f | ||
|
|
c099ea497a | ||
|
|
336b43d278 | ||
|
|
08e585d948 | ||
|
|
7aacd895ee | ||
|
|
3130af0e2b | ||
|
|
02a58af3c0 | ||
|
|
86645a3f19 | ||
|
|
edc3994cfd | ||
|
|
71f29b701d | ||
|
|
b4b853b4c5 | ||
|
|
d5483f3352 | ||
|
|
2522de8594 | ||
|
|
e5e60564cf | ||
|
|
bf2dabe6f1 | ||
|
|
70c873bcac | ||
|
|
5aabf5b8eb | ||
|
|
20e82ae2a2 | ||
|
|
e890cb118c | ||
|
|
275d1aa94e | ||
|
|
f748fda0ed | ||
|
|
87480bf6d4 | ||
|
|
bd6f1edea8 | ||
|
|
ed4c9fc4e9 | ||
|
|
8f8be84024 | ||
|
|
ead562ed05 | ||
|
|
8cf8726c7c | ||
|
|
b83df4e711 | ||
|
|
7e64470a71 | ||
|
|
fd3d717df5 | ||
|
|
d4ebb803fa | ||
|
|
5d276731e6 | ||
|
|
6dcfbc479d | ||
|
|
d8bf20d9ac | ||
|
|
38453101f0 | ||
|
|
8e46375186 | ||
|
|
c75d7fb32e | ||
|
|
6e0cf087ad | ||
|
|
af9a41d770 | ||
|
|
d6dc43db7d | ||
|
|
4c49647788 | ||
|
|
3de7bde0e1 | ||
|
|
dc38e24fed | ||
|
|
a61724c004 | ||
|
|
29b738b4e6 | ||
|
|
602d314ba0 | ||
|
|
a68974409c | ||
|
|
5d67107c79 | ||
|
|
da9b591621 | ||
|
|
2e8aa25844 | ||
|
|
6611322a8b | ||
|
|
948c6ee88d | ||
|
|
b7a9d80f28 | ||
|
|
277f6fbe49 | ||
|
|
e05080f5a8 | ||
|
|
4de250dd75 | ||
|
|
8f2f7f431c | ||
|
|
4f67b78853 | ||
|
|
4b14b35208 | ||
|
|
bc2ab12f99 | ||
|
|
c3166b2a48 | ||
|
|
1eef1e5b2f | ||
|
|
8191965555 | ||
|
|
f1c9244dfd | ||
|
|
58155a9921 | ||
|
|
5d398a69fb | ||
|
|
4560de58f4 | ||
|
|
7f9f605781 | ||
|
|
41cad5fbed | ||
|
|
e4f15b0f0e | ||
|
|
d4e3ef6eae | ||
|
|
eda90ace80 | ||
|
|
0c127348e1 | ||
|
|
eb6b59af64 | ||
|
|
11066e33f8 | ||
|
|
51a32d64d8 | ||
|
|
77a9f59487 | ||
|
|
1814c4e45b | ||
|
|
722f5fd8d4 | ||
|
|
e9c8dcf96c | ||
|
|
89e0d95883 | ||
|
|
aeb9906717 | ||
|
|
368971ec8b | ||
|
|
0112826daf | ||
|
|
9023e8f7bb | ||
|
|
48fac4e8ce | ||
|
|
edeccce619 | ||
|
|
60668aa210 | ||
|
|
455e8a4281 | ||
|
|
5d7fe7a718 | ||
|
|
64ca95e375 | ||
|
|
837eecbc91 | ||
|
|
26cc10a00c | ||
|
|
f12abe957d | ||
|
|
caaf688582 | ||
|
|
3dfd0cd62a | ||
|
|
18bd86f154 | ||
|
|
338f465019 | ||
|
|
ac13f5e6f9 | ||
|
|
1b6f6d80ea | ||
|
|
18b078414a | ||
|
|
f6ce318061 | ||
|
|
a21c94e3dc | ||
|
|
38b92d56e7 | ||
|
|
a08d95b971 | ||
|
|
339416b38b | ||
|
|
7e2f07486a | ||
|
|
a3e569cdda | ||
|
|
d68d8d82e6 | ||
|
|
997b4a544d | ||
|
|
176d2b622e | ||
|
|
3a9ab23713 | ||
|
|
9e88fcd58c | ||
|
|
39ffc1c3c7 | ||
|
|
69d0e44295 | ||
|
|
d2d5e540ac | ||
|
|
d7bd2d2b2c | ||
|
|
ddf5fc8a42 | ||
|
|
0841c63e0d | ||
|
|
a4d439b975 | ||
|
|
8de509a837 | ||
|
|
219760639a | ||
|
|
38ed8795ab | ||
|
|
55697d7dc9 | ||
|
|
a7fb782aea | ||
|
|
d91c64e428 | ||
|
|
4aa911abc6 | ||
|
|
64c72bb919 | ||
|
|
fec191d3cc | ||
|
|
7430bcbc44 | ||
|
|
eba11d2ba5 | ||
|
|
a3a724f805 | ||
|
|
a770d71890 | ||
|
|
1de866cd09 | ||
|
|
54380f53a2 | ||
|
|
7d870524d3 | ||
|
|
d28aad9a58 | ||
|
|
8be63adbc8 | ||
|
|
7d8f352e0a | ||
|
|
587382c0ba | ||
|
|
0f714ca6bc | ||
|
|
63da1df6fe | ||
|
|
bbe589da44 | ||
|
|
b278e91338 | ||
|
|
f2609e133d | ||
|
|
e14fdbbddb | ||
|
|
a162155919 | ||
|
|
4d7ae382a8 | ||
|
|
0c86eb2dc7 | ||
|
|
70c2db8b9f | ||
|
|
c1dd118d2c | ||
|
|
2d21d91abd | ||
|
|
e5ee05dc0d | ||
|
|
c0d53e176b | ||
|
|
b26d188190 | ||
|
|
0a6382e2af | ||
|
|
1214d8cd26 | ||
|
|
65a30ab0a2 | ||
|
|
61616abef2 | ||
|
|
bb1fcd1ba8 | ||
|
|
6d65121993 | ||
|
|
ecf0bffb79 | ||
|
|
af2ea0a1f2 | ||
|
|
286467db82 | ||
|
|
6b60a31ebf | ||
|
|
54028e5943 | ||
|
|
0c062e839d | ||
|
|
0fcbf05b6d | ||
|
|
f4276c36c9 | ||
|
|
ba05bddf92 | ||
|
|
7a63d75a83 | ||
|
|
da3f74a70e | ||
|
|
5f26656fc5 | ||
|
|
2f76e90d1a | ||
|
|
1296329f02 | ||
|
|
e38b432846 | ||
|
|
549a5101e7 | ||
|
|
031a8648cb | ||
|
|
a8476a8404 | ||
|
|
25c8491fc8 | ||
|
|
d0d637dd47 | ||
|
|
977c6bd44c | ||
|
|
89ad3aa168 | ||
|
|
55b921dab2 | ||
|
|
92d0fe938f | ||
|
|
d07e9b03c4 | ||
|
|
6cbd1cba68 | ||
|
|
3b8df1f143 | ||
|
|
85f7d0a8d5 | ||
|
|
556450a2ff | ||
|
|
6048b12510 | ||
|
|
8cafc1e1ac | ||
|
|
51807d7608 | ||
|
|
e104df5bb7 | ||
|
|
c6df7e5899 | ||
|
|
d0a4300dde | ||
|
|
d8865433f9 | ||
|
|
9c2bd642ba | ||
|
|
09883db208 | ||
|
|
f7f68f7160 | ||
|
|
31f744a8c0 | ||
|
|
bc66c96275 | ||
|
|
87c2acdeae | ||
|
|
6b90023764 | ||
|
|
e502bca962 | ||
|
|
c4d44b72e8 | ||
|
|
e7324bb94f | ||
|
|
8431b2c190 | ||
|
|
7d376ccd8c | ||
|
|
382410249d | ||
|
|
bfb5132362 | ||
|
|
4489dbc630 | ||
|
|
5c31bc8ffc | ||
|
|
baee5f46cf | ||
|
|
66ab7ffa15 | ||
|
|
32df7eb346 | ||
|
|
576b532b45 | ||
|
|
b520414d5a | ||
|
|
b54fd5c588 | ||
|
|
d9b4c01719 | ||
|
|
84d5d968a6 | ||
|
|
9c8717e42f | ||
|
|
3215e97b17 | ||
|
|
975e721432 | ||
|
|
b8bccdd081 | ||
|
|
4310a4d813 | ||
|
|
b96b342561 | ||
|
|
eb1cd11d57 | ||
|
|
a55c72890d | ||
|
|
247e230581 | ||
|
|
1586ea6fe9 | ||
|
|
ae505c50b0 | ||
|
|
fce1b4b1fb | ||
|
|
c6bcbf4951 | ||
|
|
6ed6086da5 | ||
|
|
9f7b16ad19 | ||
|
|
fc70a92071 | ||
|
|
ccaaab2898 | ||
|
|
8d36e630f2 | ||
|
|
eb1f347bca | ||
|
|
7db798186c | ||
|
|
a1cd94bfbb | ||
|
|
d9d2a6f6d9 | ||
|
|
b8c4b82d18 | ||
|
|
b8f615d7a1 | ||
|
|
35d97eb5c5 | ||
|
|
fc15b2e479 | ||
|
|
936df0d290 | ||
|
|
3236beddf8 | ||
|
|
c13f8f10e6 | ||
|
|
d8b530b93c | ||
|
|
2296f211e8 | ||
|
|
a5136b8863 | ||
|
|
913bc38217 | ||
|
|
4b7dca3d2c | ||
|
|
5c58e3ee31 | ||
|
|
49f304bd07 | ||
|
|
c95be42221 | ||
|
|
dbc07e13bb | ||
|
|
5ca40ebc22 | ||
|
|
a8e07274ae | ||
|
|
af99dba018 | ||
|
|
03dfa028d2 | ||
|
|
541b47ac2a | ||
|
|
507a35a9be | ||
|
|
1eddb5463e | ||
|
|
d91769efd4 | ||
|
|
134a8eb272 | ||
|
|
930be98598 | ||
|
|
28e3cb3e93 | ||
|
|
6328671ef8 | ||
|
|
fab1959d00 | ||
|
|
5ab788cd84 | ||
|
|
ce2a6d3739 | ||
|
|
40dd10dfb2 | ||
|
|
e41076e082 | ||
|
|
582fec4e11 | ||
|
|
42ae02aa08 | ||
|
|
79e3fc64c4 | ||
|
|
b188d671d1 | ||
|
|
5ecf1b53ea | ||
|
|
0636311d37 | ||
|
|
219d3b449f | ||
|
|
22eaa89c5a | ||
|
|
79e28a4c2e | ||
|
|
db05b1eb2b | ||
|
|
d20666a228 | ||
|
|
9cc7b03503 | ||
|
|
b38f12d519 | ||
|
|
e736f1ead9 | ||
|
|
b56c1f6023 | ||
|
|
268f0d64fc | ||
|
|
b3ea17736b | ||
|
|
963daeaec5 | ||
|
|
249bd44ebc | ||
|
|
04a1b1c123 | ||
|
|
3922e7afc3 | ||
|
|
f0a97a0d80 | ||
|
|
88713fd590 | ||
|
|
394759e0c8 | ||
|
|
c229f65dcf | ||
|
|
f929861609 | ||
|
|
f024ce7675 | ||
|
|
f3fcf00392 | ||
|
|
08313ef870 | ||
|
|
911c469d69 | ||
|
|
07c089ee04 | ||
|
|
dadc944810 | ||
|
|
80663032a9 | ||
|
|
67c75ee7f0 | ||
|
|
62626737a5 | ||
|
|
e404eed318 | ||
|
|
3c115428ea | ||
|
|
db40ca4aca | ||
|
|
f456d0d6bb | ||
|
|
06fe17eb9f | ||
|
|
7945bdb88f | ||
|
|
f7794ec181 | ||
|
|
16851b3eb3 | ||
|
|
c72d8d4d29 | ||
|
|
2b7436558e | ||
|
|
e59c47d5b1 | ||
|
|
c1523ad16d | ||
|
|
d0be8e27de | ||
|
|
5c66b81289 | ||
|
|
1a42cb2013 | ||
|
|
cf2978cbbb | ||
|
|
8a9733e777 | ||
|
|
ba880c5501 | ||
|
|
788f962fbd | ||
|
|
12f8283560 | ||
|
|
4d27f6b77b | ||
|
|
413ed28246 | ||
|
|
ad084f559a | ||
|
|
3832ab1c21 | ||
|
|
999bceb413 | ||
|
|
e8f6605642 | ||
|
|
3148c65323 | ||
|
|
0a3d2cc68b | ||
|
|
11cf76edb3 | ||
|
|
8833ad415c | ||
|
|
bc290d8e6c | ||
|
|
9c5b3a4060 | ||
|
|
04bbba55c7 | ||
|
|
40b70d5373 | ||
|
|
833d32646e | ||
|
|
6cdefb3cac | ||
|
|
f959d3ee7a | ||
|
|
b0952eabc7 | ||
|
|
43bb4ba4bf | ||
|
|
c2de22abeb | ||
|
|
a0113ee049 | ||
|
|
05db10fda3 | ||
|
|
948ee23a2a | ||
|
|
271a2931b6 | ||
|
|
9fe05edd47 | ||
|
|
c2573702cf | ||
|
|
b8e76b586e | ||
|
|
11a89964b9 | ||
|
|
b5bfcbae59 | ||
|
|
efe95a6953 | ||
|
|
e88a5eca8b | ||
|
|
2e3980e1de | ||
|
|
0ff85c6923 | ||
|
|
e3358d1839 | ||
|
|
f5eac0c7fa | ||
|
|
6034592a27 | ||
|
|
7b00d826d3 | ||
|
|
52ef3586b9 | ||
|
|
4118fcdd14 | ||
|
|
d9e18047d3 | ||
|
|
734f320ade | ||
|
|
79f25cdeb2 | ||
|
|
413f3db617 | ||
|
|
4db11d5143 | ||
|
|
78d28c6b96 | ||
|
|
24df7333a2 | ||
|
|
8694cd8bf5 |
69
ANNOUNCE
@@ -1,48 +1,47 @@
|
||||
Libpng 1.6.23 - June 9, 2016
|
||||
libpng 1.6.37 - April 14, 2019
|
||||
==============================
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
This is a public release of libpng, intended for use in production code.
|
||||
|
||||
Files available for download:
|
||||
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
Files available for download
|
||||
----------------------------
|
||||
|
||||
libpng-1.6.23.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.23.tar.gz
|
||||
Source files with LF line endings (for Unix/Linux):
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
* libpng-1.6.37.tar.xz (LZMA-compressed, recommended)
|
||||
* libpng-1.6.37.tar.gz
|
||||
|
||||
lpng1623.7z (LZMA-compressed, recommended)
|
||||
lpng1623.zip
|
||||
Source files with CRLF line endings (for Windows):
|
||||
|
||||
* lp1637.7z (LZMA-compressed, recommended)
|
||||
* lp1637.zip
|
||||
|
||||
Other information:
|
||||
|
||||
libpng-1.6.23-README.txt
|
||||
libpng-1.6.23-LICENSE.txt
|
||||
libpng-1.6.23-*.asc (armored detached GPG signatures)
|
||||
* README.md
|
||||
* LICENSE.md
|
||||
* AUTHORS.md
|
||||
* TRADEMARK.md
|
||||
|
||||
Changes since the last public release (1.6.22):
|
||||
|
||||
Stop a potential memory leak in png_set_tRNS() (Bug report by Ted Ying).
|
||||
Fixed the progressive reader to handle empty first IDAT chunk properly
|
||||
(patch by Timothy Nikkel). This bug was introduced in libpng-1.6.0 and
|
||||
only affected the libpng16 branch.
|
||||
Added tests in pngvalid.c to check zero-length IDAT chunks in various
|
||||
positions. Fixed the sequential reader to handle these more robustly
|
||||
(John Bowler).
|
||||
Corrected progressive read input buffer in pngvalid.c. The previous version
|
||||
the code invariably passed just one byte at a time to libpng. The intent
|
||||
was to pass a random number of bytes in the range 0..511.
|
||||
Moved sse2 prototype from pngpriv.h to contrib/intel/intel_sse.patch.
|
||||
Added missing ")" in pngerror.c (Matt Sarrett).
|
||||
Fixed undefined behavior in png_push_save_buffer(). Do not call
|
||||
memcpy() with a null source, even if count is zero (Leon Scroggins III).
|
||||
Fixed bad link to RFC2083 in png.5 (Nikola Forro).
|
||||
Changes since the previous public release (version 1.6.36)
|
||||
----------------------------------------------------------
|
||||
|
||||
(subscription required; visit
|
||||
* Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
|
||||
* Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
|
||||
* Fixed a memory leak in pngtest.c.
|
||||
* Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
|
||||
contrib/pngminus; refactor.
|
||||
* Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
|
||||
(Contributed by Willem van Schaik)
|
||||
* Fixed a typo in the libpng license v2.
|
||||
(Contributed by Miguel Ojeda)
|
||||
* Added makefiles for AddressSanitizer-enabled builds.
|
||||
* Cleaned up various makefiles.
|
||||
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
||||
Subscription is required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe)
|
||||
or to glennrp at users.sourceforge.net
|
||||
|
||||
Glenn R-P
|
||||
to subscribe.
|
||||
|
||||
45
AUTHORS
Normal file
@@ -0,0 +1,45 @@
|
||||
PNG REFERENCE LIBRARY AUTHORS
|
||||
=============================
|
||||
|
||||
This is the list of PNG Reference Library ("libpng") Contributing
|
||||
Authors, for copyright and licensing purposes.
|
||||
|
||||
* Andreas Dilger
|
||||
* Cosmin Truta
|
||||
* Dave Martindale
|
||||
* Eric S. Raymond
|
||||
* Gilles Vollant
|
||||
* Glenn Randers-Pehrson
|
||||
* Greg Roelofs
|
||||
* Guy Eric Schalnat
|
||||
* James Yu
|
||||
* John Bowler
|
||||
* Kevin Bracey
|
||||
* Magnus Holmgren
|
||||
* Mandar Sahastrabuddhe
|
||||
* Mans Rullgard
|
||||
* Matt Sarett
|
||||
* Mike Klein
|
||||
* Paul Schmidt
|
||||
* Sam Bushell
|
||||
* Samuel Williams
|
||||
* Simon-Pierre Cadieux
|
||||
* Tim Wegner
|
||||
* Tom Lane
|
||||
* Tom Tanner
|
||||
* Vadim Barkov
|
||||
* Willem van Schaik
|
||||
* Zhijie Liang
|
||||
* Arm Holdings
|
||||
- Richard Townsend
|
||||
* Google Inc.
|
||||
- Matt Sarett
|
||||
- Mike Klein
|
||||
|
||||
The build projects, the build scripts, the test scripts, and other
|
||||
files in the "projects", "scripts" and "tests" directories, have other
|
||||
copyright owners, but are released under the libpng license.
|
||||
|
||||
Some files in the "contrib" directory, and some tools-generated files
|
||||
that are distributed with libpng, have other copyright owners, and are
|
||||
released under other open source licenses.
|
||||
543
CHANGES
@@ -1,4 +1,3 @@
|
||||
#if 0
|
||||
CHANGES - changes for libpng
|
||||
|
||||
version 0.1 [March 29, 1995]
|
||||
@@ -593,7 +592,7 @@ Version 1.0.5e [November 30, 1999]
|
||||
with trailing compressed parts easier in the future, and added new functions
|
||||
png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP,
|
||||
png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond).
|
||||
NOTE: Applications that write text chunks MUST define png_text->lang
|
||||
NOTE: Applications that write text chunks MUST define png_text->lang
|
||||
before calling png_set_text(). It must be set to NULL if you want to
|
||||
write tEXt or zTXt chunks. If you want your application to be able to
|
||||
run with older versions of libpng, use
|
||||
@@ -833,7 +832,7 @@ Version 1.0.7beta11 [May 7, 2000]
|
||||
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
||||
which are no longer used.
|
||||
Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is
|
||||
defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED
|
||||
defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXt_SUPPORTED
|
||||
is defined.
|
||||
Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory
|
||||
overrun when old applications fill the info_ptr->text structure directly.
|
||||
@@ -1454,7 +1453,7 @@ Version 1.2.6beta4 [July 28, 2004]
|
||||
sequential read support.
|
||||
Added some "#if PNG_WRITE_SUPPORTED" blocks.
|
||||
Added #ifdef to remove some redundancy in png_malloc_default().
|
||||
Use png_malloc instead of png_zalloc to allocate the pallete.
|
||||
Use png_malloc instead of png_zalloc to allocate the palette.
|
||||
|
||||
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
|
||||
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
|
||||
@@ -3259,7 +3258,7 @@ Version 1.5.2beta01 [February 13, 2011]
|
||||
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
|
||||
old VisualC++ preprocessor.
|
||||
Turned on interlace handling in png_read_png().
|
||||
Fixed gcc pendantic warnings.
|
||||
Fixed gcc pedantic warnings.
|
||||
Handle longjmp in Cygwin.
|
||||
Fixed png_get_current_row_number() in the interlaced case.
|
||||
Cleaned up ALPHA flags and transformations.
|
||||
@@ -3359,7 +3358,7 @@ Version 1.5.3beta05 [May 6, 2011]
|
||||
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
|
||||
was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691.
|
||||
Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
|
||||
optimization configureable.
|
||||
optimization configurable.
|
||||
IDAT compression failed if preceded by a compressed text chunk (bug
|
||||
introduced in libpng-1.5.3beta01-02). This was because the attempt to
|
||||
reset the zlib stream in png_write_IDAT happened after the first IDAT
|
||||
@@ -3643,7 +3642,7 @@ Version 1.5.6beta05 [October 12, 2011]
|
||||
Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
|
||||
|
||||
Version 1.5.6beta06 [October 17, 2011]
|
||||
Removed two redundant tests for unitialized row.
|
||||
Removed two redundant tests for uninitialized row.
|
||||
Fixed a relatively harmless memory overwrite in compressed text writing
|
||||
with a 1 byte zlib buffer.
|
||||
Add ability to call png_read_update_info multiple times to pngvalid.c.
|
||||
@@ -3689,7 +3688,7 @@ Version 1.5.7beta01 [November 4, 2011]
|
||||
crash. The pngmem.c implementation of png_malloc() included a cast
|
||||
to png_size_t which would fail on large allocations on 16-bit systems.
|
||||
Fix for the preprocessor of the Intel C compiler. The preprocessor
|
||||
splits adjacent @ signs with a space; this changes the concatentation
|
||||
splits adjacent @ signs with a space; this changes the concatenation
|
||||
token from @-@-@ to PNG_JOIN; that should work with all compiler
|
||||
preprocessors.
|
||||
Paeth filter speed improvements from work by Siarhei Siamashka. This
|
||||
@@ -3735,7 +3734,7 @@ Version 1.5.7beta03 [November 17, 2011]
|
||||
gray (on palette) itself.
|
||||
Fixes for C++ compilation using g++ When libpng source is compiled
|
||||
using g++. The compiler imposes C++ rules on the C source; thus it
|
||||
is desireable to make the source work with either C or C++ rules
|
||||
is desirable to make the source work with either C or C++ rules
|
||||
without throwing away useful error information. This change adds
|
||||
png_voidcast to allow C semantic (void*) cases or the corresponding
|
||||
C++ static_cast operation, as appropriate.
|
||||
@@ -4061,7 +4060,7 @@ Version 1.6.0beta17 [March 10, 2012]
|
||||
possible to call png_inflate() incrementally. A warning is no longer
|
||||
issued if the language tag or translated keyword in the iTXt chunk
|
||||
has zero length.
|
||||
If benign errors are disabled use maximum window on ancilliary inflate.
|
||||
If benign errors are disabled use maximum window on ancillary inflate.
|
||||
This works round a bug introduced in 1.5.4 where compressed ancillary
|
||||
chunks could end up with a too-small windowBits value in the deflate
|
||||
header.
|
||||
@@ -4176,7 +4175,7 @@ Version 1.6.0beta27 [August 11, 2012]
|
||||
declared even though the functions are never actually defined. This
|
||||
change provides a dummy definition so that the declarations work, yet any
|
||||
implementation will fail to compile because of an incomplete type.
|
||||
Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of
|
||||
Re-eliminated the use of strcpy() in pngtest.c. An unnecessary use of
|
||||
strcpy() was accidentally re-introduced in libpng16; this change replaces
|
||||
it with strncpy().
|
||||
Eliminated use of png_sizeof(); use sizeof() instead.
|
||||
@@ -4309,7 +4308,7 @@ Version 1.6.0beta31 [November 1, 2012]
|
||||
resulting in VS2010 having to update the files.
|
||||
Removed non-working ICC profile support code that was mostly added to
|
||||
libpng-1.6.0beta29 and beta30. There was too much code for too little
|
||||
gain; implementing full ICC color correction may be desireable but is left
|
||||
gain; implementing full ICC color correction may be desirable but is left
|
||||
up to applications.
|
||||
|
||||
Version 1.6.0beta32 [November 25, 2012]
|
||||
@@ -4592,7 +4591,7 @@ Version 1.6.3beta07 [June 8, 2013]
|
||||
the optimizations ('check' vs 'api') are exposed in the public header files
|
||||
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
|
||||
decision about whether or not to use the optimizations.
|
||||
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
|
||||
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS usage.
|
||||
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
|
||||
on __ARM_NEON__ from configure time to compile time. This breaks symbol
|
||||
prefixing because the definition of the special png_init_filter_functions
|
||||
@@ -5596,11 +5595,515 @@ Version 1.6.23rc02 [June 4, 2016]
|
||||
Version 1.6.23 [June 9, 2016]
|
||||
Fixed bad link to RFC2083 in png.5 (Nikola Forro).
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe)
|
||||
or to glennrp at users.sourceforge.net
|
||||
Version 1.6.24beta01 [June 11, 2016]
|
||||
Avoid potential overflow of the PNG_IMAGE_SIZE macro. This macro
|
||||
is not used within libpng, but is used in some of the examples.
|
||||
|
||||
Glenn R-P
|
||||
#endif
|
||||
Version 1.6.24beta02 [June 23, 2016]
|
||||
Correct filter heuristic overflow handling. This was broken when the
|
||||
write filter code was moved out-of-line; if there is a single filter and
|
||||
the heuristic sum overflows the calculation of the filtered line is not
|
||||
completed. In versions prior to 1.6 the code was duplicated in-line
|
||||
and the check not performed, so the filter operation completed; however,
|
||||
in the multi-filter case where the sum is performed the 'none' filter would
|
||||
be selected if all the sums overflowed, even if it wasn't in the filter
|
||||
list. The fix to the first problem is simply to provide PNG_SIZE_MAX as
|
||||
the current lmins sum value; this means the sum can never exceed it and
|
||||
overflows silently. A reasonable compiler that does choose to inline
|
||||
the code will simply eliminate the sum check.
|
||||
The fix to the second problem is to use high precision arithmetic (this is
|
||||
implemented in 1.7), however a simple safe fix here is to chose the lowest
|
||||
numbered filter in the list from png_set_filter (this only works if the
|
||||
first problem is also fixed) (John Bowler).
|
||||
Use a more efficient absolute value calculation on SSE2 (Matthieu Darbois).
|
||||
Fixed the case where PNG_IMAGE_BUFFER_SIZE can overflow in the application
|
||||
as a result of the application using an increased 'row_stride'; previously
|
||||
png_image_finish_read only checked for overflow on the base calculation of
|
||||
components. (I.e. it checked for overflow of a 32-bit number on the total
|
||||
number of pixel components in the output format, not the possibly padded row
|
||||
length and not the number of bytes, which for linear formats is twice the
|
||||
number of components.)
|
||||
MSVC does not like '-(unsigned)', so replaced it with 0U-(unsigned)
|
||||
MSVC does not like (uInt) = -(unsigned) (i.e. as an initializer), unless
|
||||
the conversion is explicitly invoked by a cast.
|
||||
Put the SKIP definition in the correct place. It needs to come after the
|
||||
png.h include (see all the other .c files in contrib/libtests) because it
|
||||
depends on PNG_LIBPNG_VER.
|
||||
Removed the three compile warning options from the individual project
|
||||
files into the zlib.props globals. It increases the warning level from 4
|
||||
to All and adds a list of the warnings that need to be turned off. This is
|
||||
semi-documentary; the intent is to tell libpng users which warnings have
|
||||
been examined and judged non-fixable at present. The warning about
|
||||
structure padding is fixable, but it would be a significant change (moving
|
||||
structure members around).
|
||||
|
||||
Version 1.6.24beta03 [July 4, 2016]
|
||||
Optimized absolute value calculation in filter selection, similar to
|
||||
code in the PAETH decoder in pngrutil.c. Build with PNG_USE_ABS to
|
||||
use this.
|
||||
Added pngcp to the build together with a pngcp.dfa configuration test.
|
||||
Added high resolution timing to pngcp.
|
||||
Added "Common linking failures" section to INSTALL.
|
||||
Relocated misplaced #endif in png.c sRGB profile checking.
|
||||
Fixed two Coverity issues in pngcp.c.
|
||||
|
||||
Version 1.6.24beta04 [July 8, 2016]
|
||||
Avoid filter-selection heuristic sum calculations in cases where only one
|
||||
filter is a candidate for selection. This trades off code size (added
|
||||
private png_setup_*_row_only() functions) for speed.
|
||||
|
||||
Version 1.6.24beta05 [July 13, 2016]
|
||||
Fixed some indentation to comply with our coding style.
|
||||
Added contrib/tools/reindent.
|
||||
|
||||
Version 1.6.24beta06 [July 18, 2016]
|
||||
Fixed more indentation to comply with our coding style.
|
||||
Eliminated unnecessary tests of boolean png_isaligned() vs 0.
|
||||
|
||||
Version 1.6.24rc01 [July 25, 2016]
|
||||
No changes.
|
||||
|
||||
Version 1.6.24rc02 [August 1, 2016]
|
||||
Conditionally compile SSE2 headers in contrib/intel/intel_sse.patch
|
||||
Conditionally compile png_decompress_chunk().
|
||||
|
||||
Version 1.6.24rc03 [August 2, 2016]
|
||||
Conditionally compile ARM_NEON headers in pngpriv.h
|
||||
Updated contrib/intel/intel_sse.patch
|
||||
|
||||
Version 1.6.24[August 4, 2016]
|
||||
No changes.
|
||||
|
||||
Version 1.6.25beta01 [August 12, 2016]
|
||||
Reject oversized iCCP profile immediately.
|
||||
Cleaned up PNG_DEBUG compile of pngtest.c.
|
||||
Conditionally compile png_inflate().
|
||||
|
||||
Version 1.6.25beta02 [August 18, 2016]
|
||||
Don't install pngcp; it conflicts with pngcp in the pngtools package.
|
||||
Minor editing of INSTALL, (whitespace, added copyright line)
|
||||
|
||||
Version 1.6.25rc01 [August 24, 2016]
|
||||
No changes.
|
||||
|
||||
Version 1.6.25rc02 [August 29, 2016]
|
||||
Added MIPS support (Mandar Sahastrabuddhe <Mandar.Sahastrabuddhe@imgtec.com>).
|
||||
Only the UP filter is currently implemented.
|
||||
|
||||
Version 1.6.25rc03 [August 29, 2016]
|
||||
Rebased contrib/intel/intel_sse.patch after the MIPS implementation.
|
||||
|
||||
Version 1.6.25rc04 [August 30, 2016]
|
||||
Added MIPS support for SUB, AVG, and PAETH filters (Mandar Sahastrabuddhe).
|
||||
|
||||
Version 1.6.25rc05 [August 30, 2016]
|
||||
Rebased contrib/intel/intel_sse.patch after the MIPS implementation update..
|
||||
|
||||
Version 1.6.25 [September 1, 2016]
|
||||
No changes.
|
||||
|
||||
Version 1.6.26beta01 [September 26, 2016]
|
||||
Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
|
||||
bugfix by John Bowler).
|
||||
Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL
|
||||
has allocated memory that libpng needs to free.
|
||||
Conditionally compile png_set_benign_errors() in pngread.c and pngtest.c
|
||||
Issue a png_benign_error instead of a png_error on ADLER32 mismatch
|
||||
while decoding compressed data chunks.
|
||||
Changed PNG_ZLIB_VERNUM to ZLIB_VERNUM in pngpriv.h, pngstruct.h, and
|
||||
pngrutil.c.
|
||||
If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE,
|
||||
ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs.
|
||||
Issue png_benign_error() on ADLER32 checksum mismatch instead of png_error().
|
||||
Add tests/badcrc.png and tests/badadler.png to tests/pngtest.
|
||||
Merged pngtest.c with libpng-1.7.0beta84/pngtest.c
|
||||
|
||||
Version 1.6.26beta02 [October 1, 2016]
|
||||
Updated the documentation about CRC and ADLER32 handling.
|
||||
Quieted 117 warnings from clang-3.8 in pngtrans.c, pngread.c,
|
||||
pngwrite.c, pngunknown.c, and pngvalid.c.
|
||||
Quieted 58 (out of 144) -Wconversion compiler warnings by changing
|
||||
flag definitions in pngpriv.h from 0xnnnn to 0xnnnnU and trivial changes
|
||||
in png.c, pngread.c, and pngwutil.c.
|
||||
|
||||
Version 1.6.26beta03 [October 2, 2016]
|
||||
Removed contrib/libtests/*.orig and *.rej that slipped into the tarballs.
|
||||
Quieted the 86 remaining -Wconversion compiler warnings by
|
||||
revising the png_isaligned() macro and trivial changes in png.c,
|
||||
pngerror.c, pngget.c, pngmem.c, pngset.c, pngrtran.c, pngrutil.c,
|
||||
pngwtran.c, pngwrite.c, and pngwutil.c.
|
||||
|
||||
Version 1.6.26beta04 [October 3, 2016]
|
||||
Quieted (bogus?) clang warnings about "absolute value has no effect"
|
||||
when PNG_USE_ABS is defined.
|
||||
Fixed offsets in contrib/intel/intel_sse.patch
|
||||
|
||||
Version 1.6.26beta05 [October 6, 2016]
|
||||
Changed integer constant 4294967294 to unsigned 4294967294U in pngconf.h
|
||||
to avoid a signed/unsigned compare in the preprocessor.
|
||||
|
||||
Version 1.6.26beta06 [October 7, 2016]
|
||||
Use zlib-1.2.8.1 inflateValidate() instead of inflateReset2() to
|
||||
optionally avoid ADLER32 evaluation.
|
||||
|
||||
Version 1.6.26rc01 [October 12, 2016]
|
||||
No changes.
|
||||
|
||||
Version 1.6.26 [October 20, 2016]
|
||||
Cosmetic change, "ptr != 0" to "ptr != NULL" in png.c and pngrutil.c
|
||||
Despammed email addresses (replaced "@" with " at ").
|
||||
|
||||
Version 1.6.27beta01 [November 2, 2016]
|
||||
Restrict the new ADLER32-skipping to IDAT chunks. It broke iCCP chunk
|
||||
handling: an erroneous iCCP chunk would throw a png_error and reject the
|
||||
entire PNG image instead of rejecting just the iCCP chunk with a warning,
|
||||
if built with zlib-1.2.8.1.
|
||||
|
||||
Version 1.6.27rc01 [December 27, 2016]
|
||||
Control ADLER32 checking with new PNG_IGNORE_ADLER32 option. Fixes
|
||||
an endless loop when handling erroneous ADLER32 checksums; bug
|
||||
introduced in libpng-1.6.26.
|
||||
Removed the use of a macro containing the pre-processor 'defined'
|
||||
operator. It is unclear whether this is valid; a macro that
|
||||
"generates" 'defined' is not permitted, but the use of the word
|
||||
"generates" within the C90 standard seems to imply more than simple
|
||||
substitution of an expression itself containing a well-formed defined
|
||||
operation.
|
||||
Added ARM support to CMakeLists.txt (Andreas Franek).
|
||||
|
||||
Version 1.6.27 [December 29, 2016]
|
||||
Fixed a potential null pointer dereference in png_set_text_2() (bug report
|
||||
and patch by Patrick Keshishian, CVE-2016-10087).
|
||||
|
||||
Version 1.6.28rc01 [January 3, 2017]
|
||||
Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna).
|
||||
Added option to Cmake build allowing a custom location of zlib to be
|
||||
specified in a scenario where libpng is being built as a subproject
|
||||
alongside zlib by another project (Sam Serrels).
|
||||
Changed png_ptr->options from a png_byte to png_uint_32, to accommodate
|
||||
up to 16 options.
|
||||
|
||||
Version 1.6.28rc02 [January 4, 2017]
|
||||
Added "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna).
|
||||
Moved SSE2 optimization code into the main libpng source directory.
|
||||
Configure libpng with "configure --enable-intel-sse" or compile
|
||||
libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
|
||||
|
||||
Version 1.6.28rc03 [January 4, 2017]
|
||||
Backed out the SSE optimization and last CMakeLists.txt to allow time for QA.
|
||||
|
||||
Version 1.6.28 [January 5, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.29beta01 [January 12, 2017]
|
||||
Readded "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna).
|
||||
Moved SSE2 optimization code into the main libpng source directory.
|
||||
Configure libpng with "configure --enable-intel-sse" or compile
|
||||
libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
|
||||
Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt).
|
||||
|
||||
Version 1.6.29beta02 [February 22, 2017]
|
||||
Avoid conditional directives that break statements in pngrutil.c (Romero
|
||||
Malaquias)
|
||||
The contrib/examples/pngtopng.c recovery code was in the wrong "if"
|
||||
branches; the comments were correct.
|
||||
Added code for PowerPC VSX optimisation (Vadim Barkov).
|
||||
|
||||
Version 1.6.29beta03 [March 1, 2017]
|
||||
Avoid potential overflow of shift operations in png_do_expand() (Aaron Boxer).
|
||||
Change test ZLIB_VERNUM >= 0x1281 to ZLIB_VERNUM >= 0x1290 in pngrutil.c
|
||||
because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1,
|
||||
as suggested in zlib FAQ, item 24.
|
||||
Suppress clang warnings about implicit sign changes in png.c
|
||||
|
||||
Version 1.6.29 [March 16, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.30beta01 [April 1, 2017]
|
||||
Added missing "$(CPPFLAGS)" to the compile line for c.pic.o in
|
||||
makefile.linux and makefile.solaris-x86 (Cosmin).
|
||||
Revised documentation of png_get_error_ptr() in the libpng manual.
|
||||
Silence clang -Wcomma and const drop warnings (Viktor Szakats).
|
||||
Update Sourceforge URLs in documentation (https instead of http).
|
||||
|
||||
Version 1.6.30beta02 [April 22, 2017]
|
||||
Document need to check for integer overflow when allocating a pixel
|
||||
buffer for multiple rows in contrib/gregbook, contrib/pngminus,
|
||||
example.c, and in the manual (suggested by Jaeseung Choi). This
|
||||
is similar to the bug reported against pngquant in CVE-2016-5735.
|
||||
Removed reference to the obsolete PNG_SAFE_LIMITS macro in the documentation.
|
||||
|
||||
Version 1.6.30beta03 [May 22, 2017]
|
||||
Check for integer overflow in contrib/visupng and contrib/tools/genpng.
|
||||
Do not double evaluate CMAKE_SYSTEM_PROCESSOR in CMakeLists.txt.
|
||||
Test CMAKE_HOST_WIN32 instead of WIN32 in CMakeLists.txt.
|
||||
Fix some URL in documentation.
|
||||
|
||||
Version 1.6.30beta04 [June 7, 2017]
|
||||
Avoid writing an empty IDAT when the last IDAT exactly fills the
|
||||
compression buffer (bug report by Brian Baird). This bug was
|
||||
introduced in libpng-1.6.0.
|
||||
|
||||
Version 1.6.30rc01 [June 14, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.30rc02 [June 25, 2017]
|
||||
Update copyright year in pnglibconf.h, make ltmain.sh executable.
|
||||
Add a reference to the libpng.download site in README.
|
||||
|
||||
Version 1.6.30 [June 28, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.31beta01 [July 5, 2017]
|
||||
Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it;
|
||||
bug report by Michael Felt).
|
||||
Revised pngpriv.h to work around failure to compile arm/filter_neon.S
|
||||
("typedef" directive is unrecognized by the assembler). The problem
|
||||
was introduced in libpng-1.6.30beta01.
|
||||
Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx).
|
||||
Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish).
|
||||
|
||||
Version 1.6.31beta02 [July 8, 2017]
|
||||
Added instructions for disabling hardware optimizations in INSTALL.
|
||||
Added "--enable-hardware-optimizations" configuration flag to enable
|
||||
or disable all hardware optimizations with one flag.
|
||||
|
||||
Version 1.6.31beta03 [July 9, 2017]
|
||||
Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms.
|
||||
Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent
|
||||
possible integer overflow (Bug report by John Bowler).
|
||||
Quieted "declaration after statement" warnings in intel/filter_sse2.c.
|
||||
Added scripts/makefile-linux-opt, which has hardware optimizations enabled.
|
||||
|
||||
Version 1.6.31beta04 [July 11, 2017]
|
||||
Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when
|
||||
integers appear on both sides of a compare. Worked around the others by
|
||||
forcing the strict-overflow setting in the relevant functions to a level
|
||||
where they are not reported (John Bowler).
|
||||
Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like
|
||||
the space.
|
||||
Worked around some C-style casts from (void*) because g++ 5.4.0 objects
|
||||
to them.
|
||||
Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint
|
||||
overflow' check that is on by default with -Wall -Wextra.
|
||||
|
||||
Version 1.6.31beta05 [July 13, 2017]
|
||||
Added eXIf chunk support.
|
||||
|
||||
Version 1.6.31beta06 [July 17, 2017]
|
||||
Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm
|
||||
tags) to pngtest.png.
|
||||
|
||||
Version 1.6.31beta07 [July 18, 2017]
|
||||
Revised the eXIf chunk in pngtest.png to fix "Bad IFD1 Directory" warning.
|
||||
|
||||
Version 1.6.31rc01 [July 19, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.31rc02 [July 25, 2017]
|
||||
Fixed typo in example.c (png_free_image should be png_image_free) (Bug
|
||||
report by John Smith)
|
||||
|
||||
Version 1.6.31 [July 27, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.32beta01 [July 31, 2017]
|
||||
Avoid possible NULL dereference in png_handle_eXIf when benign_errors
|
||||
are allowed. Avoid leaking the input buffer "eXIf_buf".
|
||||
Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif
|
||||
to arguments for png_get_eXIf() and png_set_eXIf().
|
||||
Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in
|
||||
pngwrite.c, and made various other fixes to png_write_eXIf().
|
||||
Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and
|
||||
png_set_eXIf_1(), respectively, to avoid breaking API compatibility
|
||||
with libpng-1.6.31.
|
||||
|
||||
Version 1.6.32beta02 [August 1, 2017]
|
||||
Updated contrib/libtests/pngunknown.c with eXIf chunk.
|
||||
|
||||
Version 1.6.32beta03 [August 2, 2017]
|
||||
Initialized btoa[] in pngstest.c
|
||||
Stop memory leak when returning from png_handle_eXIf() with an error
|
||||
(Bug report from the OSS-fuzz project).
|
||||
|
||||
Version 1.6.32beta04 [August 2, 2017]
|
||||
Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf().
|
||||
Update libpng.3 and libpng-manual.txt about eXIf functions.
|
||||
|
||||
Version 1.6.32beta05 [August 2, 2017]
|
||||
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatibility.
|
||||
|
||||
Version 1.6.32beta06 [August 2, 2017]
|
||||
Removed png_get_eXIf_1() and png_set_eXIf_1().
|
||||
|
||||
Version 1.6.32beta07 [August 3, 2017]
|
||||
Check length of all chunks except IDAT against user limit to fix an
|
||||
OSS-fuzz issue (Fixes CVE-2017-12652).
|
||||
|
||||
Version 1.6.32beta08 [August 3, 2017]
|
||||
Check length of IDAT against maximum possible IDAT size, accounting
|
||||
for height, rowbytes, interlacing and zlib/deflate overhead.
|
||||
Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf)
|
||||
does not work (the eXIf chunk data can contain zeroes).
|
||||
|
||||
Version 1.6.32beta09 [August 3, 2017]
|
||||
Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
|
||||
no longer using deprecated cmake LOCATION feature (Clifford Yapp).
|
||||
Fixed five-byte error in the calculation of IDAT maximum possible size.
|
||||
|
||||
Version 1.6.32beta10 [August 5, 2017]
|
||||
Moved chunk-length check into a png_check_chunk_length() private
|
||||
function (Suggested by Max Stepin).
|
||||
Moved bad pngs from tests to contrib/libtests/crashers
|
||||
Moved testing of bad pngs into a separate tests/pngtest-badpngs script
|
||||
Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL
|
||||
in the output but PASS for the libpng test.
|
||||
Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp).
|
||||
Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the
|
||||
num_exif argument to png_get_eXIf_1() (Github Issue 171).
|
||||
|
||||
Version 1.6.32beta11 [August 7, 2017]
|
||||
Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks().
|
||||
Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers.
|
||||
Make pngtest --strict, --relax, --xfail options imply -m (multiple).
|
||||
Removed unused chunk_name parameter from png_check_chunk_length().
|
||||
Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak.
|
||||
Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue.
|
||||
Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR.
|
||||
Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue.
|
||||
Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account
|
||||
for the minimum 'deflate' stream, and relocate the test to a point
|
||||
after the keyword has been read.
|
||||
Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM".
|
||||
|
||||
Version 1.6.32rc01 [August 18, 2017]
|
||||
Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers,
|
||||
one for each known chunk type, with length = 2GB-1.
|
||||
Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts
|
||||
in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706,
|
||||
and 162707).
|
||||
Renamed chunks in contrib/testpngs/crashers to avoid having files whose
|
||||
names differ only in case; this causes problems with some platforms
|
||||
(github issue #172).
|
||||
|
||||
Version 1.6.32rc02 [August 22, 2017]
|
||||
Added contrib/oss-fuzz directory which contains files used by the oss-fuzz
|
||||
project (https://github.com/google/oss-fuzz/tree/master/projects/libpng).
|
||||
|
||||
Version 1.6.32 [August 24, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.33beta01 [August 28, 2017]
|
||||
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
|
||||
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
|
||||
Fixed off-by-one error in png_do_check_palette_indexes() (Bug report
|
||||
by Mick P., Source Forge Issue #269).
|
||||
|
||||
Version 1.6.33beta02 [September 3, 2017]
|
||||
Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
|
||||
to fix shortlived oss-fuzz issue 3234.
|
||||
Compute a larger limit on IDAT because some applications write a deflate
|
||||
buffer for each row (Bug report by Andrew Church).
|
||||
Use current date (DATE) instead of release-date (RDATE) in last
|
||||
changed date of contrib/oss-fuzz files.
|
||||
Enabled ARM support in CMakeLists.txt (Bernd Kuhls).
|
||||
|
||||
Version 1.6.33beta03 [September 14, 2017]
|
||||
Fixed incorrect typecast of some arguments to png_malloc() and
|
||||
png_calloc() that were png_uint_32 instead of png_alloc_size_t
|
||||
(Bug report by "irwir" in Github libpng issue #175).
|
||||
Use pnglibconf.h.prebuilt when building for ANDROID with cmake (Github
|
||||
issue 162, by rcdailey).
|
||||
|
||||
Version 1.6.33rc01 [September 20, 2017]
|
||||
Initialize memory allocated by png_inflate to zero, using memset, to
|
||||
stop an oss-fuzz "use of uninitialized value" detection in png_set_text_2()
|
||||
due to truncated iTXt or zTXt chunk.
|
||||
Initialize memory allocated by png_read_buffer to zero, using memset, to
|
||||
stop an oss-fuzz "use of uninitialized value" detection in
|
||||
png_icc_check_tag_table() due to truncated iCCP chunk.
|
||||
Removed a redundant test (suggested by "irwir" in Github issue #180).
|
||||
|
||||
Version 1.6.33rc02 [September 23, 2017]
|
||||
Added an interlaced version of each file in contrib/pngsuite.
|
||||
Relocate new memset() call in pngrutil.c.
|
||||
Removed more redundant tests (suggested by "irwir" in Github issue #180).
|
||||
Add support for loading images with associated alpha in the Simplified
|
||||
API (Samuel Williams).
|
||||
|
||||
Version 1.6.33 [September 28, 2017]
|
||||
Revert contrib/oss-fuzz/libpng_read_fuzzer.cc to libpng-1.6.32 state.
|
||||
Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
|
||||
Add end_info structure and png_read_end() to the libpng fuzzer.
|
||||
|
||||
Version 1.6.34 [September 29, 2017]
|
||||
Removed contrib/pngsuite/i*.png; some of them caused test failures.
|
||||
|
||||
Version 1.6.35beta01 [March 6, 2018]
|
||||
Restored 21 of the contrib/pngsuite/i*.png, which do not cause test
|
||||
failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png.
|
||||
Added calls to png_set_*() transforms commonly used by browsers to
|
||||
the fuzzer.
|
||||
Removed some unnecessary brackets in pngrtran.c
|
||||
Fixed miscellaneous typos (Patch by github user "luzpaz").
|
||||
Change "ASM C" to "C ASM" in CMakeLists.txt
|
||||
Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin)
|
||||
Added hardware optimization directories to zip and 7z distributions.
|
||||
Fixed incorrect bitmask for options.
|
||||
Fixed many spelling typos.
|
||||
|
||||
Version 1.6.35beta02 [March 28, 2018]
|
||||
Make png_get_iCCP consistent with man page (allow compression-type argument
|
||||
to be NULL, bug report by Lenard Szolnoki).
|
||||
|
||||
Version 1.6.35 [July 15, 2018]
|
||||
Replaced the remaining uses of png_size_t with size_t (Cosmin)
|
||||
Fixed the calculation of row_factor in png_check_chunk_length
|
||||
(reported by Thuan Pham in SourceForge issue #278)
|
||||
Added missing parentheses to a macro definition
|
||||
(suggested by "irwir" in GitHub issue #216)
|
||||
|
||||
Version 1.6.36 [December 1, 2018]
|
||||
Optimized png_do_expand_palette for ARM processors.
|
||||
Improved performance by around 10-22% on a recent ARM Chromebook.
|
||||
(Contributed by Richard Townsend, ARM Holdings)
|
||||
Fixed manipulation of machine-specific optimization options.
|
||||
(Contributed by Vicki Pfau)
|
||||
Used memcpy instead of manual pointer arithmetic on Intel SSE2.
|
||||
(Contributed by Samuel Williams)
|
||||
Fixed build errors with MSVC on ARM64.
|
||||
(Contributed by Zhijie Liang)
|
||||
Fixed detection of libm in CMakeLists.
|
||||
(Contributed by Cameron Cawley)
|
||||
Fixed incorrect creation of pkg-config file in CMakeLists.
|
||||
(Contributed by Kyle Bentley)
|
||||
Fixed the CMake build on Windows MSYS by avoiding symlinks.
|
||||
Fixed a build warning on OpenBSD.
|
||||
(Contributed by Theo Buehler)
|
||||
Fixed various typos in comments.
|
||||
(Contributed by "luz.paz")
|
||||
Raised the minimum required CMake version from 3.0.2 to 3.1.
|
||||
Removed yet more of the vestigial support for pre-ANSI C compilers.
|
||||
Removed ancient makefiles for ancient systems that have been broken
|
||||
across all previous libpng-1.6.x versions.
|
||||
Removed the Y2K compliance statement and the export control
|
||||
information.
|
||||
Applied various code style and documentation fixes.
|
||||
|
||||
Version 1.6.37 [April 14, 2019]
|
||||
Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
|
||||
Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
|
||||
Fixed a memory leak in pngtest.c.
|
||||
Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
|
||||
contrib/pngminus; refactor.
|
||||
Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
|
||||
(Contributed by Willem van Schaik)
|
||||
Fixed a typo in the libpng license v2.
|
||||
(Contributed by Miguel Ojeda)
|
||||
Added makefiles for AddressSanitizer-enabled builds.
|
||||
Cleaned up various makefiles.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
||||
Subscription is required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe.
|
||||
|
||||
443
CMakeLists.txt
@@ -1,58 +1,52 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
# Copyright (C) 2007,2009-2016 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2018 Cosmin Truta
|
||||
# Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson
|
||||
# Written by Christian Ehrlicher, 2007
|
||||
# Revised by Roger Lowman, 2009-2010
|
||||
# Revised by Clifford Yapp, 2011-2012
|
||||
# Revised by Clifford Yapp, 2011-2012,2017
|
||||
# Revised by Roger Leigh, 2016
|
||||
# Revised by Andreas Franek, 2016
|
||||
# Revised by Sam Serrels, 2017
|
||||
# Revised by Vadim Barkov, 2017
|
||||
# Revised by Vicky Pfau, 2018
|
||||
# Revised by Cameron Cawley, 2018
|
||||
# Revised by Cosmin Truta, 2018
|
||||
# Revised by Kyle Bentley, 2018
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
cmake_policy(VERSION 2.8.3)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
cmake_policy(VERSION 3.1)
|
||||
|
||||
# Set MacOSX @rpath usage globally.
|
||||
if (POLICY CMP0020)
|
||||
cmake_policy(SET CMP0020 NEW)
|
||||
endif(POLICY CMP0020)
|
||||
if (POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif(POLICY CMP0042)
|
||||
# Use new variable expansion policy.
|
||||
if (POLICY CMP0053)
|
||||
cmake_policy(SET CMP0053 NEW)
|
||||
endif(POLICY CMP0053)
|
||||
if (POLICY CMP0054)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
endif(POLICY CMP0054)
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
|
||||
|
||||
project(libpng C)
|
||||
project(libpng C ASM)
|
||||
enable_testing()
|
||||
|
||||
set(PNGLIB_MAJOR 1)
|
||||
set(PNGLIB_MINOR 6)
|
||||
set(PNGLIB_RELEASE 23)
|
||||
set(PNGLIB_RELEASE 37)
|
||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||
|
||||
# needed packages
|
||||
find_package(ZLIB REQUIRED)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(NOT WIN32)
|
||||
find_library(M_LIBRARY
|
||||
NAMES m
|
||||
PATHS /usr/lib /usr/local/lib
|
||||
)
|
||||
if(NOT M_LIBRARY)
|
||||
message(STATUS "math lib 'libm' not found; floating point support disabled")
|
||||
endif()
|
||||
# needed packages
|
||||
|
||||
# Allow users to specify location of Zlib.
|
||||
# Useful if zlib is being built alongside this as a sub-project.
|
||||
option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF)
|
||||
|
||||
if(NOT PNG_BUILD_ZLIB)
|
||||
find_package(ZLIB REQUIRED)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
|
||||
find_library(M_LIBRARY m)
|
||||
else()
|
||||
# not needed on windows
|
||||
# libm is not needed and/or not available
|
||||
set(M_LIBRARY "")
|
||||
endif()
|
||||
|
||||
@@ -63,12 +57,145 @@ option(PNG_TESTS "Build libpng tests" ON)
|
||||
|
||||
# Many more configuration options could be added here
|
||||
option(PNG_FRAMEWORK "Build OS X framework" OFF)
|
||||
option(PNG_DEBUG "Build with debug output" OFF)
|
||||
option(PNGARG "Disable ANSI-C prototypes" OFF)
|
||||
option(PNG_DEBUG "Build with debug output" OFF)
|
||||
option(PNG_HARDWARE_OPTIMIZATIONS "Enable hardware optimizations" ON)
|
||||
|
||||
set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
|
||||
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
|
||||
|
||||
if(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
|
||||
# set definitions and sources for arm
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
||||
set(PNG_ARM_NEON_POSSIBLE_VALUES check on off)
|
||||
set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations:
|
||||
check: (default) use internal checking code;
|
||||
off: disable the optimizations;
|
||||
on: turn on unconditionally.")
|
||||
set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS
|
||||
${PNG_ARM_NEON_POSSIBLE_VALUES})
|
||||
list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index)
|
||||
if(index EQUAL -1)
|
||||
message(FATAL_ERROR
|
||||
"PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]")
|
||||
elseif(NOT ${PNG_ARM_NEON} STREQUAL "off")
|
||||
set(libpng_arm_sources
|
||||
arm/arm_init.c
|
||||
arm/filter_neon.S
|
||||
arm/filter_neon_intrinsics.c
|
||||
arm/palette_neon_intrinsics.c)
|
||||
|
||||
if(${PNG_ARM_NEON} STREQUAL "on")
|
||||
add_definitions(-DPNG_ARM_NEON_OPT=2)
|
||||
elseif(${PNG_ARM_NEON} STREQUAL "check")
|
||||
add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DPNG_ARM_NEON_OPT=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# set definitions and sources for powerpc
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*")
|
||||
set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off)
|
||||
set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations:
|
||||
off: disable the optimizations.")
|
||||
set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS
|
||||
${PNG_POWERPC_VSX_POSSIBLE_VALUES})
|
||||
list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index)
|
||||
if(index EQUAL -1)
|
||||
message(FATAL_ERROR
|
||||
"PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]")
|
||||
elseif(NOT ${PNG_POWERPC_VSX} STREQUAL "off")
|
||||
set(libpng_powerpc_sources
|
||||
powerpc/powerpc_init.c
|
||||
powerpc/filter_vsx_intrinsics.c)
|
||||
if(${PNG_POWERPC_VSX} STREQUAL "on")
|
||||
add_definitions(-DPNG_POWERPC_VSX_OPT=2)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# set definitions and sources for intel
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
|
||||
set(PNG_INTEL_SSE_POSSIBLE_VALUES on off)
|
||||
set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations:
|
||||
off: disable the optimizations")
|
||||
set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS
|
||||
${PNG_INTEL_SSE_POSSIBLE_VALUES})
|
||||
list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index)
|
||||
if(index EQUAL -1)
|
||||
message(FATAL_ERROR
|
||||
"PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]")
|
||||
elseif(NOT ${PNG_INTEL_SSE} STREQUAL "off")
|
||||
set(libpng_intel_sources
|
||||
intel/intel_init.c
|
||||
intel/filter_sse2_intrinsics.c)
|
||||
if(${PNG_INTEL_SSE} STREQUAL "on")
|
||||
add_definitions(-DPNG_INTEL_SSE_OPT=1)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DPNG_INTEL_SSE_OPT=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# set definitions and sources for MIPS
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
|
||||
set(PNG_MIPS_MSA_POSSIBLE_VALUES on off)
|
||||
set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations:
|
||||
off: disable the optimizations")
|
||||
set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS
|
||||
${PNG_MIPS_MSA_POSSIBLE_VALUES})
|
||||
list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index)
|
||||
if(index EQUAL -1)
|
||||
message(FATAL_ERROR
|
||||
"PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]")
|
||||
elseif(NOT ${PNG_MIPS_MSA} STREQUAL "off")
|
||||
set(libpng_mips_sources
|
||||
mips/mips_init.c
|
||||
mips/filter_msa_intrinsics.c)
|
||||
if(${PNG_MIPS_MSA} STREQUAL "on")
|
||||
add_definitions(-DPNG_MIPS_MSA_OPT=2)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
else(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
|
||||
# set definitions and sources for arm
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
|
||||
add_definitions(-DPNG_ARM_NEON_OPT=0)
|
||||
endif()
|
||||
|
||||
# set definitions and sources for powerpc
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*")
|
||||
add_definitions(-DPNG_POWERPC_VSX_OPT=0)
|
||||
endif()
|
||||
|
||||
# set definitions and sources for intel
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*")
|
||||
add_definitions(-DPNG_INTEL_SSE_OPT=0)
|
||||
endif()
|
||||
|
||||
# set definitions and sources for MIPS
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*")
|
||||
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
||||
endif()
|
||||
|
||||
endif(PNG_HARDWARE_OPTIMIZATIONS)
|
||||
|
||||
# SET LIBNAME
|
||||
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
|
||||
@@ -124,17 +251,17 @@ function(symbol_prefix)
|
||||
foreach(line ${OUT})
|
||||
string(REGEX MATCH "^PREFIX=" found_match "${line}")
|
||||
if(found_match)
|
||||
STRING(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
|
||||
string(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
|
||||
string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}")
|
||||
if(found_match)
|
||||
STRING(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
|
||||
string(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
|
||||
endif()
|
||||
set(SYMBOL_PREFIX "${prefix}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}")
|
||||
set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE)
|
||||
message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}")
|
||||
set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(UNIX)
|
||||
@@ -145,7 +272,7 @@ find_program(AWK NAMES gawk awk)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if(NOT AWK)
|
||||
if(NOT AWK OR ANDROID)
|
||||
# No awk available to generate sources; use pre-built pnglibconf.h
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
|
||||
@@ -159,11 +286,11 @@ else()
|
||||
set(oneValueArgs INPUT OUTPUT)
|
||||
set(multiValueArgs DEPENDS)
|
||||
cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if (NOT _GC_INPUT)
|
||||
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
|
||||
if(NOT _GC_INPUT)
|
||||
message(FATAL_ERROR "generate_chk: Missing INPUT argument")
|
||||
endif()
|
||||
if (NOT _GC_OUTPUT)
|
||||
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
|
||||
if(NOT _GC_OUTPUT)
|
||||
message(FATAL_ERROR "generate_chk: Missing OUTPUT argument")
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT "${_GC_OUTPUT}"
|
||||
@@ -182,11 +309,11 @@ else()
|
||||
set(oneValueArgs INPUT OUTPUT)
|
||||
set(multiValueArgs DEPENDS)
|
||||
cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if (NOT _GO_INPUT)
|
||||
message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
|
||||
if(NOT _GO_INPUT)
|
||||
message(FATAL_ERROR "generate_out: Missing INPUT argument")
|
||||
endif()
|
||||
if (NOT _GO_OUTPUT)
|
||||
message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
|
||||
if(NOT _GO_OUTPUT)
|
||||
message(FATAL_ERROR "generate_out: Missing OUTPUT argument")
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT "${_GO_OUTPUT}"
|
||||
@@ -205,8 +332,8 @@ else()
|
||||
set(oneValueArgs OUTPUT)
|
||||
set(multiValueArgs DEPENDS)
|
||||
cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if (NOT _GSO_OUTPUT)
|
||||
message(FATAL_ERROR "Invalid arguments. generate_source requires output.")
|
||||
if(NOT _GSO_OUTPUT)
|
||||
message(FATAL_ERROR "generate_source: Missing OUTPUT argument")
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
|
||||
@@ -307,7 +434,7 @@ else()
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
# A single target handles generation of all generated files. If
|
||||
# they are dependend upon separately by multiple targets, this
|
||||
# they are depended upon separately by multiple targets, this
|
||||
# confuses parallel make (it would require a separate top-level
|
||||
# target for each file to track the dependencies properly).
|
||||
add_custom_target(genfiles DEPENDS
|
||||
@@ -324,7 +451,7 @@ else()
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
|
||||
endif(NOT AWK)
|
||||
endif(NOT AWK OR ANDROID)
|
||||
|
||||
# OUR SOURCES
|
||||
set(libpng_public_hdrs
|
||||
@@ -338,7 +465,7 @@ set(libpng_private_hdrs
|
||||
pnginfo.h
|
||||
pngstruct.h
|
||||
)
|
||||
if(AWK)
|
||||
if(AWK AND NOT ANDROID)
|
||||
list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
|
||||
endif()
|
||||
set(libpng_sources
|
||||
@@ -359,6 +486,10 @@ set(libpng_sources
|
||||
pngwrite.c
|
||||
pngwtran.c
|
||||
pngwutil.c
|
||||
${libpng_arm_sources}
|
||||
${libpng_intel_sources}
|
||||
${libpng_mips_sources}
|
||||
${libpng_powerpc_sources}
|
||||
)
|
||||
set(pngtest_sources
|
||||
pngtest.c
|
||||
@@ -384,7 +515,7 @@ set(png_fix_itxt_sources
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
endif(MSVC)
|
||||
endif()
|
||||
|
||||
if(PNG_DEBUG)
|
||||
add_definitions(-DPNG_DEBUG)
|
||||
@@ -464,7 +595,7 @@ if(NOT PNG_LIB_TARGETS)
|
||||
message(SEND_ERROR
|
||||
"No library variant selected to build. "
|
||||
"Please enable at least one of the following options: "
|
||||
" PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK")
|
||||
"PNG_STATIC, PNG_SHARED, PNG_FRAMEWORK")
|
||||
endif()
|
||||
|
||||
if(PNG_SHARED AND WIN32)
|
||||
@@ -477,11 +608,11 @@ function(png_add_test)
|
||||
set(multiValueArgs OPTIONS FILES)
|
||||
cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if (NOT _PAT_NAME)
|
||||
message(FATAL_ERROR "Invalid arguments. png_add_test requires name.")
|
||||
if(NOT _PAT_NAME)
|
||||
message(FATAL_ERROR "png_add_test: Missing NAME argument")
|
||||
endif()
|
||||
if (NOT _PAT_COMMAND)
|
||||
message(FATAL_ERROR "Invalid arguments. png_add_test requires command.")
|
||||
if(NOT _PAT_COMMAND)
|
||||
message(FATAL_ERROR "png_add_test: Missing COMMAND argument")
|
||||
endif()
|
||||
|
||||
set(TEST_OPTIONS "${_PAT_OPTIONS}")
|
||||
@@ -489,19 +620,11 @@ function(png_add_test)
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" @ONLY)
|
||||
if(CMAKE_MAJOR_VERSION GREATER 2) # have generator expressions
|
||||
add_test(NAME "${_PAT_NAME}"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
"-DLIBPNG=$<TARGET_FILE:png>"
|
||||
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
|
||||
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
||||
else() # old 2.x add_test; limited and won't work well on Windows
|
||||
# Note LIBPNG is a dummy value as there are no generator expressions
|
||||
add_test("${_PAT_NAME}" "${CMAKE_COMMAND}"
|
||||
"-DLIBPNG=${CMAKE_CURRENT_BINARY_DIR}/libpng.so"
|
||||
"-DTEST_COMMAND=./${_PAT_COMMAND}"
|
||||
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
||||
endif()
|
||||
add_test(NAME "${_PAT_NAME}"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
"-DLIBPNG=$<TARGET_FILE:png>"
|
||||
"-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
|
||||
-P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
|
||||
endfunction()
|
||||
|
||||
if(PNG_TESTS AND PNG_SHARED)
|
||||
@@ -566,11 +689,11 @@ if(PNG_TESTS AND PNG_SHARED)
|
||||
set(TEST_PNG_VALID TRUE)
|
||||
|
||||
if(TEST_PNG_ALPHA)
|
||||
if (NOT "${alpha_type}" STREQUAL "alpha")
|
||||
if(NOT "${alpha_type}" STREQUAL "alpha")
|
||||
set(TEST_PNG_VALID FALSE)
|
||||
endif()
|
||||
else()
|
||||
if ("${alpha_type}" STREQUAL "alpha")
|
||||
if("${alpha_type}" STREQUAL "alpha")
|
||||
set(TEST_PNG_VALID FALSE)
|
||||
endif()
|
||||
endif()
|
||||
@@ -634,31 +757,51 @@ if(PNG_SHARED)
|
||||
list(APPEND PNG_BIN_TARGETS png-fix-itxt)
|
||||
endif()
|
||||
|
||||
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
|
||||
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib")
|
||||
ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
|
||||
# Set a variable with CMake code which:
|
||||
# Creates a symlink from src to dest (if possible) or alternatively
|
||||
# copies if different.
|
||||
macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
|
||||
FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
||||
if(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SRC_FILE}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SRC_FILE}" ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE}
|
||||
DEPENDS ${PNG_LIB_TARGETS}
|
||||
)
|
||||
ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
|
||||
else(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
get_filename_component(LINK_TARGET "${SRC_FILE}" NAME)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
|
||||
endmacro()
|
||||
include(CMakeParseArguments)
|
||||
|
||||
function(create_symlink DEST_FILE)
|
||||
|
||||
cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN})
|
||||
|
||||
if(NOT S_TARGET AND NOT S_FILE)
|
||||
message(FATAL_ERROR "create_symlink: Missing TARGET or FILE argument")
|
||||
endif()
|
||||
|
||||
if(S_TARGET AND S_FILE)
|
||||
message(FATAL_ERROR "create_symlink: Both source file ${S_FILE} and build target ${S_TARGET} arguments are present; can only have one.")
|
||||
endif()
|
||||
|
||||
if(S_FILE)
|
||||
# If we don't need to symlink something that's coming from a build target,
|
||||
# we can go ahead and symlink/copy at configure time.
|
||||
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(S_TARGET)
|
||||
# We need to use generator expressions, which can be a bit tricky, so for
|
||||
# simplicity make the symlink a POST_BUILD step and use the TARGET
|
||||
# signature of add_custom_command.
|
||||
if(CMAKE_HOST_WIN32 AND NOT CYGWIN)
|
||||
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
||||
else()
|
||||
add_custom_command(TARGET ${S_TARGET} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E create_symlink $<TARGET_LINKER_FILE_NAME:${S_TARGET}> $<TARGET_LINKER_FILE_DIR:${S_TARGET}>/${DEST_FILE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
# Create source generation scripts.
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
|
||||
@@ -668,111 +811,97 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
|
||||
|
||||
|
||||
# libpng is a library so default to 'lib'
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set(CMAKE_INSTALL_LIBDIR lib)
|
||||
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
endif()
|
||||
|
||||
# CREATE PKGCONFIG FILES
|
||||
# we use the same files like ./configure, so we have to set its vars
|
||||
# We use the same files like ./configure, so we have to set its vars.
|
||||
# Only do this on Windows for Cygwin - the files don't make much sense outside
|
||||
# a UNIX look alike
|
||||
# of a UNIX look-alike.
|
||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
|
||||
set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
|
||||
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
|
||||
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
|
||||
set(LIBS "-lz -lm")
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
|
||||
CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc)
|
||||
create_symlink(libpng.pc FILE ${PNGLIB_NAME}.pc)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
|
||||
CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config)
|
||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
create_symlink(libpng-config FILE ${PNGLIB_NAME}-config)
|
||||
endif()
|
||||
|
||||
# SET UP LINKS
|
||||
if(PNG_SHARED)
|
||||
set_target_properties(png PROPERTIES
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.23
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.37
|
||||
VERSION 16.${PNGLIB_RELEASE}.0
|
||||
SOVERSION 16
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
endif()
|
||||
|
||||
# If CMake > 2.4.x, we set a variable used below to export
|
||||
# targets to an export file.
|
||||
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
|
||||
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
|
||||
set(PNG_EXPORT_RULE EXPORT libpng)
|
||||
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
|
||||
set(PNG_EXPORT_RULE EXPORT libpng)
|
||||
endif()
|
||||
|
||||
# INSTALL
|
||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
|
||||
install(TARGETS ${PNG_LIB_TARGETS}
|
||||
${PNG_EXPORT_RULE}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
EXPORT libpng
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
if(PNG_SHARED)
|
||||
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
|
||||
if(CYGWIN OR MINGW)
|
||||
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
|
||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif(CYGWIN OR MINGW)
|
||||
create_symlink(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png)
|
||||
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
|
||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif(NOT WIN32)
|
||||
endif(PNG_SHARED)
|
||||
create_symlink(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png)
|
||||
install(FILES $<TARGET_LINKER_FILE_DIR:png>/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PNG_STATIC)
|
||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
get_target_property(BUILD_TARGET_LOCATION png_static LOCATION_${CMAKE_BUILD_TYPE})
|
||||
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
endif()
|
||||
create_symlink(libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static)
|
||||
install(FILES $<TARGET_LINKER_FILE_DIR:png_static>/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
||||
install(FILES ${libpng_public_hdrs} DESTINATION include)
|
||||
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
|
||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
|
||||
install(FILES ${libpng_public_hdrs} DESTINATION include)
|
||||
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
|
||||
endif()
|
||||
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
|
||||
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL)
|
||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||
DESTINATION bin)
|
||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL )
|
||||
if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL)
|
||||
install(TARGETS ${PNG_BIN_TARGETS}
|
||||
RUNTIME DESTINATION bin)
|
||||
RUNTIME DESTINATION bin)
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL)
|
||||
# Install man pages
|
||||
if(NOT PNG_MAN_DIR)
|
||||
set(PNG_MAN_DIR "share/man")
|
||||
endif()
|
||||
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
|
||||
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
|
||||
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
|
||||
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
|
||||
# Install pkg-config files
|
||||
if(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
if(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
|
||||
@@ -781,12 +910,11 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
|
||||
DESTINATION bin)
|
||||
endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# On versions of CMake that support it, create an export file CMake
|
||||
# users can include() to import our targets
|
||||
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
|
||||
# Create an export file that CMake users can include() to import our targets.
|
||||
if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL)
|
||||
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
|
||||
endif()
|
||||
|
||||
@@ -801,4 +929,3 @@ endif()
|
||||
# to create msvc import lib for mingw compiled shared lib
|
||||
# pexports libpng.dll > libpng.def
|
||||
# lib /def:libpng.def /machine:x86
|
||||
|
||||
|
||||
174
INSTALL
@@ -1,24 +1,26 @@
|
||||
|
||||
Installing libpng
|
||||
Installing libpng
|
||||
|
||||
Contents
|
||||
|
||||
I. Simple installation
|
||||
II. Rebuilding the configure scripts
|
||||
III. Using scripts/makefile*
|
||||
IV. Using cmake
|
||||
V. Directory structure
|
||||
VI. Building with project files
|
||||
VII. Building with makefiles
|
||||
VIII. Configuring libpng for 16-bit platforms
|
||||
IX. Configuring for DOS
|
||||
X. Configuring for Medium Model
|
||||
XI. Prepending a prefix to exported symbols
|
||||
XII. Configuring for compiler xxx:
|
||||
XIII. Removing unwanted object code
|
||||
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
XV. Setjmp/longjmp issues
|
||||
XVI. Other sources of information about libpng
|
||||
I. Simple installation
|
||||
II. Rebuilding the configure scripts
|
||||
III. Using scripts/makefile*
|
||||
IV. Using cmake
|
||||
V. Directory structure
|
||||
VI. Building with project files
|
||||
VII. Building with makefiles
|
||||
VIII. Configuring libpng for 16-bit platforms
|
||||
IX. Configuring for DOS
|
||||
X. Configuring for Medium Model
|
||||
XI. Prepending a prefix to exported symbols
|
||||
XII. Configuring for compiler xxx:
|
||||
XIII. Removing unwanted object code
|
||||
XIV. Enabling or disabling hardware optimizations
|
||||
XV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
XVI. Setjmp/longjmp issues
|
||||
XVII. Common linking failures
|
||||
XVIII. Other sources of information about libpng
|
||||
|
||||
I. Simple installation
|
||||
|
||||
@@ -77,8 +79,8 @@ Or you can use one of the "projects" in the "projects" directory.
|
||||
|
||||
Before installing libpng, you must first install zlib, if it
|
||||
is not already on your system. zlib can usually be found
|
||||
wherever you got libpng; otherwise go to http://zlib.net. You can place
|
||||
zlib in in the same directory as libpng or in another directory.
|
||||
wherever you got libpng; otherwise go to https://zlib.net/. You can
|
||||
place zlib in the same directory as libpng or in another directory.
|
||||
|
||||
If your system already has a preinstalled zlib you will still need
|
||||
to have access to the zlib.h and zconf.h include files that
|
||||
@@ -89,22 +91,24 @@ standard library search path, put ZLIBLIB, ZLIBINC, CPPFLAGS, LDFLAGS,
|
||||
and LD_LIBRARY_PATH in your environment before running "make test"
|
||||
or "make distcheck":
|
||||
|
||||
ZLIBLIB=/path/to/lib export ZLIBLIB
|
||||
ZLIBINC=/path/to/include export ZLIBINC
|
||||
CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
|
||||
LDFLAGS="-L$ZLIBLIB" export LDFLAGS
|
||||
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
|
||||
ZLIBLIB=/path/to/lib export ZLIBLIB
|
||||
ZLIBINC=/path/to/include export ZLIBINC
|
||||
CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
|
||||
LDFLAGS="-L$ZLIBLIB" export LDFLAGS
|
||||
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
|
||||
|
||||
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
|
||||
in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test".
|
||||
in your environment and type
|
||||
|
||||
make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test
|
||||
|
||||
IV. Using cmake
|
||||
|
||||
If you want to use "cmake" (see www.cmake.org), type
|
||||
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=/path
|
||||
make
|
||||
make install
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=/path
|
||||
make
|
||||
make install
|
||||
|
||||
As when using the simple configure method described above, "/path" points to
|
||||
the installation directory where you want to put the libpng "lib", "include",
|
||||
@@ -118,8 +122,8 @@ or "zlib128") so that you have directories called "zlib" and "libpng".
|
||||
|
||||
Your directory structure should look like this:
|
||||
|
||||
.. (the parent directory)
|
||||
libpng (this directory)
|
||||
.. (the parent directory)
|
||||
libpng (this directory)
|
||||
INSTALL (this file)
|
||||
README
|
||||
*.h, *.c => libpng source files
|
||||
@@ -162,10 +166,15 @@ VII. Building with makefiles
|
||||
Copy the file (or files) that you need from the
|
||||
scripts directory into this directory, for example
|
||||
|
||||
MSDOS example: copy scripts\makefile.msc makefile
|
||||
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
|
||||
UNIX example: cp scripts/makefile.std makefile
|
||||
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
||||
MSDOS example:
|
||||
|
||||
copy scripts\makefile.msc makefile
|
||||
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
|
||||
|
||||
UNIX example:
|
||||
|
||||
cp scripts/makefile.std makefile
|
||||
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
||||
|
||||
Read the makefile to see if you need to change any source or
|
||||
target directories to match your preferences.
|
||||
@@ -241,7 +250,7 @@ libpng are compiled. All the defines end in _SUPPORTED. If you are
|
||||
never going to use a capability, you can change the #define to #undef
|
||||
before recompiling libpng and save yourself code and data space, or
|
||||
you can turn off individual capabilities with defines that begin with
|
||||
PNG_NO_.
|
||||
"PNG_NO_".
|
||||
|
||||
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
|
||||
|
||||
@@ -273,7 +282,57 @@ library to fail if they call functions not available in your library.
|
||||
The size of the library itself should not be an issue, because only
|
||||
those sections that are actually used will be loaded into memory.
|
||||
|
||||
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
XIV. Enabling or disabling hardware optimizations
|
||||
|
||||
Certain hardware capabilities, such as the Intel SSE instructions,
|
||||
are normally detected at run time. Enable them with configure options
|
||||
such as one of
|
||||
|
||||
--enable-arm-neon=yes
|
||||
--enable-mips-msa=yes
|
||||
--enable-intel-sse=yes
|
||||
--enable-powerpc-vsx=yes
|
||||
|
||||
or enable them all at once with
|
||||
|
||||
--enable-hardware-optimizations=yes
|
||||
|
||||
or, if you are not using "configure", you can use one
|
||||
or more of
|
||||
|
||||
CPPFLAGS += "-DPNG_ARM_NEON"
|
||||
CPPFLAGS += "-DPNG_MIPS_MSA"
|
||||
CPPFLAGS += "-DPNG_INTEL_SSE"
|
||||
CPPFLAGS += "-DPNG_POWERPC_VSX"
|
||||
|
||||
See for example scripts/makefile.linux-opt
|
||||
|
||||
If you wish to avoid using them,
|
||||
you can disable them via the configure option
|
||||
|
||||
--disable-hardware-optimizations
|
||||
|
||||
to disable them all, or
|
||||
|
||||
--enable-intel-sse=no
|
||||
|
||||
to disable a particular one,
|
||||
or via compiler-command options such as
|
||||
|
||||
CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0,
|
||||
-DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0"
|
||||
|
||||
If you are using cmake, hardware optimizations are "on"
|
||||
by default. To disable them, use
|
||||
|
||||
cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \
|
||||
-DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no
|
||||
|
||||
or disable them all at once with
|
||||
|
||||
cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
|
||||
|
||||
XV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
|
||||
Details of internal changes to the library code can be found in the CHANGES
|
||||
file and in the GIT repository logs. These will be of no concern to the vast
|
||||
@@ -309,7 +368,7 @@ only png_longjmp_ptr, which must match the C longjmp function.) The new
|
||||
approach is documented in pngconf.h
|
||||
|
||||
Despite these changes, libpng 1.5.0 only supports the native C function
|
||||
calling standard on those platforms tested so far (__cdecl on Microsoft
|
||||
calling standard on those platforms tested so far ("__cdecl" on Microsoft
|
||||
Windows). This is because the support requirements for alternative
|
||||
calling conventions seem to no longer exist. Developers who find it
|
||||
necessary to set PNG_API_RULE to 1 should advise the mailing list
|
||||
@@ -364,7 +423,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built
|
||||
libpng, because than the settings would not accurately reflect the settings
|
||||
that were used to build libpng.
|
||||
|
||||
XV. Setjmp/longjmp issues
|
||||
XVI. Setjmp/longjmp issues
|
||||
|
||||
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
|
||||
is known to be not thread-safe on some platforms and we don't know of
|
||||
@@ -373,7 +432,7 @@ your application is going to be using multiple threads, you should
|
||||
configure libpng with PNG_NO_SETJMP in your pngusr.dfa file, with
|
||||
-DPNG_NO_SETJMP on your compile line, or with
|
||||
|
||||
#undef PNG_SETJMP_SUPPORTED
|
||||
#undef PNG_SETJMP_SUPPORTED
|
||||
|
||||
in your pnglibconf.h or pngusr.h.
|
||||
|
||||
@@ -382,28 +441,25 @@ This requires setjmp/longjmp, so you must either build the library
|
||||
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
|
||||
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
|
||||
|
||||
XVI. Other sources of information about libpng:
|
||||
XVII. Common linking failures
|
||||
|
||||
If your application fails to find libpng or zlib entries while linking:
|
||||
|
||||
Be sure "-lz" appears after "-lpng" on your linking command.
|
||||
|
||||
Be sure you have built libpng, zlib, and your application for the
|
||||
same platform (e.g., 32-bit or 64-bit).
|
||||
|
||||
If you are using the vstudio project, observe the WARNING in
|
||||
project/vstudio/README.txt.
|
||||
|
||||
XVIII. Other sources of information about libpng:
|
||||
|
||||
Further information can be found in the README and libpng-manual.txt
|
||||
files, in the individual makefiles, in png.h, and the manual pages
|
||||
libpng.3 and png.5.
|
||||
|
||||
Using the ./configure script -- 16 December 2002.
|
||||
=================================================
|
||||
|
||||
The ./configure script should work compatibly with what scripts/makefile.*
|
||||
did, however there are some options you might need to add to configure
|
||||
explicitly, which previously was done semi-automatically (if you didn't edit
|
||||
scripts/makefile.* yourself, that is)
|
||||
|
||||
CFLAGS="-Wall -O -funroll-loops \
|
||||
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
||||
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
||||
|
||||
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
||||
/usr/include/libpng16, or whatever.
|
||||
|
||||
If you find that the configure script is out-of-date or is not supporting
|
||||
your platform properly, try running autogen.sh to regenerate "configure",
|
||||
"Makefile.in", and the other configuration files. Then try configure again.
|
||||
|
||||
Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
|
||||
This document is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
and license in png.h.
|
||||
|
||||
174
LICENSE
@@ -1,50 +1,82 @@
|
||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
||||
=========================================
|
||||
|
||||
This copy of the libpng notices is provided for your convenience. In case of
|
||||
any discrepancy between this copy and the notices in the file png.h that is
|
||||
included in the libpng distribution, the latter shall prevail.
|
||||
PNG Reference Library License version 2
|
||||
---------------------------------------
|
||||
|
||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
* Copyright (c) 1995-2019 The PNG Reference Library Authors.
|
||||
* Copyright (c) 2018-2019 Cosmin Truta.
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||
* Copyright (c) 1996-1997 Andreas Dilger.
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
The software is supplied "as is", without warranty of any kind,
|
||||
express or implied, including, without limitation, the warranties
|
||||
of merchantability, fitness for a particular purpose, title, and
|
||||
non-infringement. In no event shall the Copyright owners, or
|
||||
anyone distributing the software, be liable for any damages or
|
||||
other liability, whether in contract, tort or otherwise, arising
|
||||
from, out of, or in connection with the software, or the use or
|
||||
other dealings in the software, even if advised of the possibility
|
||||
of such damage.
|
||||
|
||||
This code is released under the libpng license.
|
||||
Permission is hereby granted to use, copy, modify, and distribute
|
||||
this software, or portions hereof, for any purpose, without fee,
|
||||
subject to the following restrictions:
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.23, June 9, 2016 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you
|
||||
use this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated, but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
|
||||
|
||||
PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
|
||||
derived from libpng-1.0.6, and are distributed according to the same
|
||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
added to the list of Contributing Authors:
|
||||
|
||||
Simon-Pierre Cadieux
|
||||
Eric S. Raymond
|
||||
Mans Rullgard
|
||||
Cosmin Truta
|
||||
Gilles Vollant
|
||||
James Yu
|
||||
Simon-Pierre Cadieux
|
||||
Eric S. Raymond
|
||||
Mans Rullgard
|
||||
Cosmin Truta
|
||||
Gilles Vollant
|
||||
James Yu
|
||||
Mandar Sahastrabuddhe
|
||||
Google Inc.
|
||||
Vadim Barkov
|
||||
|
||||
and with the following additions to the disclaimer:
|
||||
|
||||
There is no warranty against interference with your enjoyment of the
|
||||
library or against infringement. There is no warranty that our
|
||||
efforts or the library will fulfill any of your particular purposes
|
||||
or needs. This library is provided with all faults, and the entire
|
||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||
the user.
|
||||
There is no warranty against interference with your enjoyment of
|
||||
the library or against infringement. There is no warranty that our
|
||||
efforts or the library will fulfill any of your particular purposes
|
||||
or needs. This library is provided with all faults, and the entire
|
||||
risk of satisfactory quality, performance, accuracy, and effort is
|
||||
with the user.
|
||||
|
||||
Some files in the "contrib" directory and some configure-generated
|
||||
files that are distributed with libpng have other copyright owners and
|
||||
files that are distributed with libpng have other copyright owners, and
|
||||
are released under other open source licenses.
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||
libpng-0.96, and are distributed according to the same disclaimer and
|
||||
license as libpng-0.96, with the following individuals added to the list
|
||||
of Contributing Authors:
|
||||
license as libpng-0.96, with the following individuals added to the
|
||||
list of Contributing Authors:
|
||||
|
||||
Tom Lane
|
||||
Glenn Randers-Pehrson
|
||||
Willem van Schaik
|
||||
Tom Lane
|
||||
Glenn Randers-Pehrson
|
||||
Willem van Schaik
|
||||
|
||||
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
||||
@@ -52,14 +84,14 @@ and are distributed according to the same disclaimer and license as
|
||||
libpng-0.88, with the following individuals added to the list of
|
||||
Contributing Authors:
|
||||
|
||||
John Bowler
|
||||
Kevin Bracey
|
||||
Sam Bushell
|
||||
Magnus Holmgren
|
||||
Greg Roelofs
|
||||
Tom Tanner
|
||||
John Bowler
|
||||
Kevin Bracey
|
||||
Sam Bushell
|
||||
Magnus Holmgren
|
||||
Greg Roelofs
|
||||
Tom Tanner
|
||||
|
||||
Some files in the "scripts" directory have other copyright owners
|
||||
Some files in the "scripts" directory have other copyright owners,
|
||||
but are released under this license.
|
||||
|
||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||
@@ -68,63 +100,35 @@ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
For the purposes of this copyright and license, "Contributing Authors"
|
||||
is defined as the following set of individuals:
|
||||
|
||||
Andreas Dilger
|
||||
Dave Martindale
|
||||
Guy Eric Schalnat
|
||||
Paul Schmidt
|
||||
Tim Wegner
|
||||
Andreas Dilger
|
||||
Dave Martindale
|
||||
Guy Eric Schalnat
|
||||
Paul Schmidt
|
||||
Tim Wegner
|
||||
|
||||
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||
including, without limitation, the warranties of merchantability and of
|
||||
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||
assume no liability for direct, indirect, incidental, special, exemplary,
|
||||
or consequential damages, which may result from the use of the PNG
|
||||
Reference Library, even if advised of the possibility of such damage.
|
||||
The PNG Reference Library is supplied "AS IS". The Contributing
|
||||
Authors and Group 42, Inc. disclaim all warranties, expressed or
|
||||
implied, including, without limitation, the warranties of
|
||||
merchantability and of fitness for any purpose. The Contributing
|
||||
Authors and Group 42, Inc. assume no liability for direct, indirect,
|
||||
incidental, special, exemplary, or consequential damages, which may
|
||||
result from the use of the PNG Reference Library, even if advised of
|
||||
the possibility of such damage.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
source code, or portions hereof, for any purpose, without fee, subject
|
||||
to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented.
|
||||
1. The origin of this source code must not be misrepresented.
|
||||
|
||||
2. Altered versions must be plainly marked as such and must not
|
||||
be misrepresented as being the original source.
|
||||
2. Altered versions must be plainly marked as such and must not
|
||||
be misrepresented as being the original source.
|
||||
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
|
||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||
fee, and encourage the use of this source code as a component to
|
||||
supporting the PNG file format in commercial products. If you use this
|
||||
source code in a product, acknowledgment is not required but would be
|
||||
appreciated.
|
||||
|
||||
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||
|
||||
TRADEMARK:
|
||||
|
||||
The name "libpng" has not been registered by the Copyright owner
|
||||
as a trademark in any jurisdiction. However, because libpng has
|
||||
been distributed and maintained world-wide, continually since 1995,
|
||||
the Copyright owner claims "common-law trademark protection" in any
|
||||
jurisdiction where common-law trademark is recognized.
|
||||
|
||||
OSI CERTIFICATION:
|
||||
|
||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
||||
a certification mark of the Open Source Initiative. OSI has not addressed
|
||||
the additional disclaimers inserted at version 1.0.7.
|
||||
|
||||
EXPORT CONTROL:
|
||||
|
||||
The Copyright owner believes that the Export Control Classification
|
||||
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||
controls or International Traffic in Arms Regulations (ITAR) because
|
||||
it is open source, publicly available software, that does not contain
|
||||
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||
734.7(b).
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
June 9, 2016
|
||||
The Contributing Authors and Group 42, Inc. specifically permit,
|
||||
without fee, and encourage the use of this source code as a component
|
||||
to supporting the PNG file format in commercial products. If you use
|
||||
this source code in a product, acknowledgment is not required but would
|
||||
be appreciated.
|
||||
|
||||
29
Makefile.am
@@ -1,7 +1,7 @@
|
||||
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||
#
|
||||
# Copyright (c) 2018 Cosmin Truta
|
||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||
# Last changed in libpng 1.6.22 [(PENDING RELEASE)]
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -12,7 +12,7 @@ PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||
ACLOCAL_AMFLAGS = -I scripts
|
||||
|
||||
# test programs - run on make check, make distcheck
|
||||
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage
|
||||
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
|
||||
if HAVE_CLOCK_GETTIME
|
||||
check_PROGRAMS += timepng
|
||||
endif
|
||||
@@ -53,10 +53,14 @@ pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||
|
||||
pngcp_SOURCES = contrib/tools/pngcp.c
|
||||
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
# Generally these are single line shell scripts to run a test with a particular
|
||||
# set of parameters:
|
||||
TESTS =\
|
||||
tests/pngtest\
|
||||
tests/pngtest-badpngs\
|
||||
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
|
||||
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
|
||||
tests/pngvalid-gamma-expand16-background\
|
||||
@@ -91,7 +95,23 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
|
||||
|
||||
if PNG_ARM_NEON
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
||||
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
||||
arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
||||
arm/palette_neon_intrinsics.c
|
||||
endif
|
||||
|
||||
if PNG_MIPS_MSA
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
|
||||
mips/filter_msa_intrinsics.c
|
||||
endif
|
||||
|
||||
if PNG_INTEL_SSE
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += intel/intel_init.c\
|
||||
intel/filter_sse2_intrinsics.c
|
||||
endif
|
||||
|
||||
if PNG_POWERPC_VSX
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += powerpc/powerpc_init.c\
|
||||
powerpc/filter_vsx_intrinsics.c
|
||||
endif
|
||||
|
||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||
@@ -128,7 +148,7 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
||||
# from those directories being included. This only works if the configure is
|
||||
# not done in the source directory!
|
||||
EXTRA_DIST= \
|
||||
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
|
||||
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
|
||||
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
||||
@@ -230,6 +250,7 @@ contrib/libtests/timepng.o: pnglibconf.h
|
||||
|
||||
contrib/tools/makesRGB.o: pnglibconf.h
|
||||
contrib/tools/pngfix.o: pnglibconf.h
|
||||
contrib/tools/pngcp.o: pnglibconf.h
|
||||
|
||||
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
|
||||
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
|
||||
|
||||
2428
Makefile.in
Normal file
124
README
@@ -1,15 +1,16 @@
|
||||
README for libpng version 1.6.23 - June 9, 2016 (shared library 16.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
README for libpng version 1.6.37 - April 14, 2019
|
||||
=================================================
|
||||
|
||||
See the note about version numbers near the top of png.h.
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
|
||||
libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
|
||||
or lpng*.7z or lpng*.zip if you want DOS-style line endings.
|
||||
libpng-*.tar.xz or if you want UNIX-style line endings in the text
|
||||
files, or lpng*.7z or lpng*.zip if you want DOS-style line endings.
|
||||
|
||||
Version 0.89 was the first official release of libpng. Don't let the
|
||||
fact that it's the first release fool you. The libpng library has been in
|
||||
extensive use and testing since mid-1995. By late 1997 it had
|
||||
fact that it's the first release fool you. The libpng library has been
|
||||
in extensive use and testing since mid-1995. By late 1997 it had
|
||||
finally gotten to the stage where there hadn't been significant
|
||||
changes to the API in some time, and people have a bad feeling about
|
||||
libraries with versions < 1.0. Version 1.0.0 was released in
|
||||
@@ -23,7 +24,7 @@ earlier versions if you are using a shared library. The type of the
|
||||
png_uint_32, which will affect shared-library applications that use
|
||||
this function.
|
||||
|
||||
To avoid problems with changes to the internals of png info_struct,
|
||||
To avoid problems with changes to the internals of the png info_struct,
|
||||
new APIs have been made available in 0.95 to avoid direct application
|
||||
access to info_ptr. These functions are the png_set_<chunk> and
|
||||
png_get_<chunk> functions. These functions should be used when
|
||||
@@ -60,94 +61,59 @@ the library action on the detection of chunk CRC errors. It is possible
|
||||
to set different actions based on whether the CRC error occurred in a
|
||||
critical or an ancillary chunk.
|
||||
|
||||
The changes made to the library, and bugs fixed are based on discussions
|
||||
on the PNG-implement mailing list and not on material submitted
|
||||
privately to Guy, Andreas, or Glenn. They will forward any good
|
||||
suggestions to the list.
|
||||
|
||||
For a detailed description on using libpng, read libpng-manual.txt. For
|
||||
examples of libpng in a program, see example.c and pngtest.c. For usage
|
||||
information and restrictions (what little they are) on libpng, see
|
||||
png.h. For a description on using zlib (the compression library used by
|
||||
libpng) and zlib's restrictions, see zlib.h
|
||||
For a detailed description on using libpng, read libpng-manual.txt.
|
||||
For examples of libpng in a program, see example.c and pngtest.c. For
|
||||
usage information and restrictions (what little they are) on libpng,
|
||||
see png.h. For a description on using zlib (the compression library
|
||||
used by libpng) and zlib's restrictions, see zlib.h
|
||||
|
||||
I have included a general makefile, as well as several machine and
|
||||
compiler specific ones, but you may have to modify one for your own needs.
|
||||
compiler specific ones, but you may have to modify one for your own
|
||||
needs.
|
||||
|
||||
You should use zlib 1.0.4 or later to run this, but it MAY work with
|
||||
versions as old as zlib 0.95. Even so, there are bugs in older zlib
|
||||
versions which can cause the output of invalid compression streams for
|
||||
some images. You will definitely need zlib 1.0.4 or later if you are
|
||||
taking advantage of the MS-DOS "far" structure allocation for the small
|
||||
and medium memory models. You should also note that zlib is a
|
||||
compression library that is useful for more things than just PNG files.
|
||||
You can use zlib as a drop-in replacement for fread() and fwrite() if
|
||||
you are so inclined.
|
||||
some images.
|
||||
|
||||
zlib should be available at the same place that libpng is, or at zlib.net.
|
||||
You should also note that zlib is a compression library that is useful
|
||||
for more things than just PNG files. You can use zlib as a drop-in
|
||||
replacement for fread() and fwrite(), if you are so inclined.
|
||||
|
||||
zlib should be available at the same place that libpng is, or at
|
||||
https://zlib.net.
|
||||
|
||||
You may also want a copy of the PNG specification. It is available
|
||||
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||
these at http://www.libpng.org/pub/png/documents/
|
||||
these at http://www.libpng.org/pub/png/pngdocs.html .
|
||||
|
||||
This code is currently being archived at libpng.sf.net in the
|
||||
[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it
|
||||
in any of those places, e-mail me, and I'll help you find it.
|
||||
This code is currently being archived at libpng.sourceforge.io in the
|
||||
[DOWNLOAD] area, and at http://libpng.download/src .
|
||||
|
||||
I am not a lawyer, but I believe that the Export Control Classification
|
||||
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||
controls or International Traffic in Arms Regulations (ITAR) because it
|
||||
is open source, publicly available software, that does not contain any
|
||||
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
|
||||
|
||||
If you have any code changes, requests, problems, etc., please e-mail
|
||||
them to me. Also, I'd appreciate any make files or project files,
|
||||
and any modifications you needed to make to get libpng to compile,
|
||||
along with a #define variable to tell what compiler/system you are on.
|
||||
If you needed to add transformations to libpng, or wish libpng would
|
||||
provide the image in a different way, drop me a note (and code, if
|
||||
possible), so I can consider supporting the transformation.
|
||||
Finally, if you get any warning messages when compiling libpng
|
||||
(note: not zlib), and they are easy to fix, I'd appreciate the
|
||||
fix. Please mention "libpng" somewhere in the subject line. Thanks.
|
||||
|
||||
This release was created and will be supported by myself (of course
|
||||
based in a large way on Guy's and Andreas' earlier work), and the PNG
|
||||
This release, based in a large way on Glenn's, Guy's and Andreas'
|
||||
earlier work, was created and will be supported by myself and the PNG
|
||||
development group.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at
|
||||
lists.sourceforge.net (subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe) or to glennrp at users.sourceforge.net
|
||||
to subscribe).
|
||||
|
||||
You can't reach Guy, the original libpng author, at the addresses
|
||||
given in previous versions of this document. He and Andreas will
|
||||
read mail addressed to the png-implement list, however.
|
||||
|
||||
Please do not send general questions about PNG. Send them to
|
||||
png-mng-misc at lists.sf.net (subscription required; visit
|
||||
Send general questions about the PNG specification to png-mng-misc
|
||||
at lists.sourceforge.net (subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
|
||||
subscribe). If you have a question about something
|
||||
in the PNG specification that is related to using libpng, send it
|
||||
to me. Send me any questions that start with "I was using libpng,
|
||||
and ...". If in doubt, send questions to me. I'll bounce them
|
||||
to others, if necessary.
|
||||
|
||||
Please do not send suggestions on how to change PNG. We have
|
||||
been discussing PNG for twenty years now, and it is official and
|
||||
finished. If you have suggestions for libpng, however, I'll
|
||||
gladly listen. Even if your suggestion is not used immediately,
|
||||
it may be used later.
|
||||
subscribe).
|
||||
|
||||
Files in this distribution:
|
||||
|
||||
ANNOUNCE => Announcement of this version, with recent changes
|
||||
AUTHORS => List of contributing authors
|
||||
CHANGES => Description of changes between libpng versions
|
||||
KNOWNBUG => List of known bugs and deficiencies
|
||||
LICENSE => License to use and redistribute libpng
|
||||
README => This file
|
||||
TODO => Things not implemented in the current library
|
||||
Y2KINFO => Statement of Y2K compliance
|
||||
TRADEMARK => Trademark information
|
||||
example.c => Example code for using libpng functions
|
||||
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
||||
libpng-manual.txt => Description of libpng and its functions
|
||||
@@ -179,18 +145,25 @@ Files in this distribution:
|
||||
pngwtran.c => Write data transformations
|
||||
pngwutil.c => Write utility functions
|
||||
arm => Contains optimized code for the ARM platform
|
||||
powerpc => Contains optimized code for the PowerPC platform
|
||||
contrib => Contributions
|
||||
arm-neon => Optimized code for ARM-NEON platform
|
||||
powerpc-vsx => Optimized code for POWERPC-VSX platform
|
||||
examples => Example programs
|
||||
gregbook => source code for PNG reading and writing, from
|
||||
Greg Roelofs' "PNG: The Definitive Guide",
|
||||
O'Reilly, 1999
|
||||
libtests => Test programs
|
||||
mips-msa => Optimized code for MIPS-MSA platform
|
||||
pngminim => Minimal decoder, encoder, and progressive decoder
|
||||
programs demonstrating use of pngusr.dfa
|
||||
pngminus => Simple pnm2png and png2pnm programs
|
||||
pngsuite => Test images
|
||||
testpngs
|
||||
tools => Various tools
|
||||
visupng => Contains a MSVC workspace for VisualPng
|
||||
intel => Optimized code for INTEL-SSE2 platform
|
||||
mips => Optimized code for MIPS platform
|
||||
projects => Contains project files and workspaces for
|
||||
building a DLL
|
||||
owatcom => Contains a WATCOM project for building libpng
|
||||
@@ -201,15 +174,10 @@ Files in this distribution:
|
||||
scripts => Directory containing scripts for building libpng:
|
||||
(see scripts/README.txt for the list of scripts)
|
||||
|
||||
Good luck, and happy coding.
|
||||
Good luck, and happy coding!
|
||||
|
||||
-Glenn Randers-Pehrson (current maintainer, since 1998)
|
||||
Internet: glennrp at users.sourceforge.net
|
||||
|
||||
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||
Internet: adilger at enel.ucalgary.ca
|
||||
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
|
||||
|
||||
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||
(formerly of Group 42, Inc)
|
||||
Internet: gschal at infinet.com
|
||||
* Cosmin Truta (current maintainer, since 2018)
|
||||
* Glenn Randers-Pehrson (former maintainer, 1998-2018)
|
||||
* Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||
* Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||
(formerly of Group 42, Inc.)
|
||||
|
||||
48
TODO
@@ -1,29 +1,23 @@
|
||||
/*
|
||||
TODO - list of things to do for libpng:
|
||||
|
||||
Final bug fixes.
|
||||
Better C++ wrapper/full C++ implementation?
|
||||
Fix problem with C++ and EXTERN "C".
|
||||
cHRM transformation.
|
||||
Remove setjmp/longjmp usage in favor of returning error codes.
|
||||
Palette creation.
|
||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||
Improved dithering.
|
||||
Multi-lingual error and warning message support.
|
||||
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
||||
Make profile checking optional via a png_set_something() call.
|
||||
Man pages for function calls.
|
||||
Better documentation.
|
||||
Better filter selection
|
||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||
Histogram creation.
|
||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||
Avoid building gamma tables whenever possible.
|
||||
Use greater precision when changing to linear gamma for compositing against
|
||||
background and doing rgb-to-gray transformation.
|
||||
Investigate pre-incremented loop counters and other loop constructions.
|
||||
Add interpolated method of handling interlacing.
|
||||
Switch to the simpler zlib (zlib/libpng) license if legally possible.
|
||||
Extend pngvalid.c to validate more of the libpng transformations.
|
||||
|
||||
*/
|
||||
* Fix all defects (duh!)
|
||||
* Better C++ wrapper / full C++ implementation (?)
|
||||
* Fix the problems with C++ and 'extern "C"'.
|
||||
* cHRM transformation.
|
||||
* Palette creation.
|
||||
* "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||
* Improved dithering.
|
||||
* Multi-lingual error and warning message support.
|
||||
* Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
|
||||
* Man pages for function calls.
|
||||
* Better documentation.
|
||||
* Better filter selection
|
||||
(e.g., counting huffman bits/precompression; filter inertia; filter costs).
|
||||
* Histogram creation.
|
||||
* Text conversion between different code pages (e.g., Latin-1 -> Mac).
|
||||
* Avoid building gamma tables whenever possible.
|
||||
* Greater precision in changing to linear gamma for compositing against
|
||||
background, and in doing rgb-to-gray transformations.
|
||||
* Investigate pre-incremented loop counters and other loop constructions.
|
||||
* Interpolated method of handling interlacing.
|
||||
* More validations for libpng transformations.
|
||||
|
||||
8
TRADEMARK
Normal file
@@ -0,0 +1,8 @@
|
||||
TRADEMARK
|
||||
=========
|
||||
|
||||
The name "libpng" has not been registered by the Copyright owners
|
||||
as a trademark in any jurisdiction. However, because libpng has
|
||||
been distributed and maintained world-wide, continually since 1995,
|
||||
the Copyright owners claim "common-law trademark protection" in any
|
||||
jurisdiction where common-law trademark is recognized.
|
||||
1196
aclocal.m4
vendored
Normal file
@@ -1,14 +1,15 @@
|
||||
|
||||
/* arm_init.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.22 [June 9, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
||||
* called.
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
/* filter_neon.S - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -16,7 +16,7 @@
|
||||
#define PNG_VERSION_INFO_ONLY
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#if defined(__linux__) && defined(__ELF__)
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
|
||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
||||
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
||||
*
|
||||
* Last changed in libpng 1.6.22 [June 9, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
@@ -19,7 +18,11 @@
|
||||
/* This code requires -mfpu=neon on the command line: */
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||
|
||||
#include <arm_neon.h>
|
||||
#if defined(_MSC_VER) && defined(_M_ARM64)
|
||||
# include <arm64_neon.h>
|
||||
#else
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
||||
* however this code will only work with appropriate alignment. arm/arm_init.c
|
||||
@@ -33,6 +36,11 @@
|
||||
* 'type'. This is written this way just to hide the GCC strict aliasing
|
||||
* warning; note that the code is safe because there never is an alias between
|
||||
* the input and output pointers.
|
||||
*
|
||||
* When compiling with MSVC ARM64, the png_ldr macro can't be passed directly
|
||||
* to vst4_lane_u32, because of an internal compiler error inside MSVC.
|
||||
* To avoid this compiler bug, we use a temporary variable (vdest_val) to store
|
||||
* the result of png_ldr.
|
||||
*/
|
||||
#define png_ldr(type,pointer)\
|
||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
||||
@@ -125,12 +133,15 @@ png_read_filter_row_sub4_neon(png_row_infop row_info, png_bytep row,
|
||||
uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
uint8x8x4_t vrp = *vrpt;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
uint32x2x4_t vdest_val;
|
||||
|
||||
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
||||
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||
|
||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||
}
|
||||
|
||||
PNG_UNUSED(prev_row)
|
||||
@@ -223,6 +234,7 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
||||
uint8x8x4_t *vrpt, *vppt;
|
||||
uint8x8x4_t vrp, vpp;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
uint32x2x4_t vdest_val;
|
||||
|
||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
@@ -240,7 +252,8 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
||||
vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
||||
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,6 +372,7 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
||||
uint8x8x4_t *vrpt, *vppt;
|
||||
uint8x8x4_t vrp, vpp;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
uint32x2x4_t vdest_val;
|
||||
|
||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
@@ -378,7 +392,8 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
||||
|
||||
vlast = vpp.val[3];
|
||||
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
149
arm/palette_neon_intrinsics.c
Normal file
@@ -0,0 +1,149 @@
|
||||
|
||||
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
|
||||
*
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 2017-2018 Arm Holdings. All rights reserved.
|
||||
* Written by Richard Townsend <Richard.Townsend@arm.com>, February 2017.
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
|
||||
#include "../pngpriv.h"
|
||||
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1
|
||||
|
||||
#if defined(_MSC_VER) && defined(_M_ARM64)
|
||||
# include <arm64_neon.h>
|
||||
#else
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
/* Build an RGBA8 palette from the separate RGB and alpha palettes. */
|
||||
void
|
||||
png_riffle_palette_neon(png_structrp png_ptr)
|
||||
{
|
||||
png_const_colorp palette = png_ptr->palette;
|
||||
png_bytep riffled_palette = png_ptr->riffled_palette;
|
||||
png_const_bytep trans_alpha = png_ptr->trans_alpha;
|
||||
int num_trans = png_ptr->num_trans;
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_riffle_palette_neon");
|
||||
|
||||
/* Initially black, opaque. */
|
||||
uint8x16x4_t w = {{
|
||||
vdupq_n_u8(0x00),
|
||||
vdupq_n_u8(0x00),
|
||||
vdupq_n_u8(0x00),
|
||||
vdupq_n_u8(0xff),
|
||||
}};
|
||||
|
||||
/* First, riffle the RGB colours into an RGBA8 palette.
|
||||
* The alpha component is set to opaque for now.
|
||||
*/
|
||||
for (i = 0; i < 256; i += 16)
|
||||
{
|
||||
uint8x16x3_t v = vld3q_u8((png_const_bytep)(palette + i));
|
||||
w.val[0] = v.val[0];
|
||||
w.val[1] = v.val[1];
|
||||
w.val[2] = v.val[2];
|
||||
vst4q_u8(riffled_palette + (i << 2), w);
|
||||
}
|
||||
|
||||
/* Fix up the missing transparency values. */
|
||||
for (i = 0; i < num_trans; i++)
|
||||
riffled_palette[(i << 2) + 3] = trans_alpha[i];
|
||||
}
|
||||
|
||||
/* Expands a palettized row into RGBA8. */
|
||||
int
|
||||
png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
||||
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
||||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
const png_uint_32 *riffled_palette =
|
||||
(const png_uint_32 *)png_ptr->riffled_palette;
|
||||
const png_int_32 pixels_per_chunk = 4;
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_do_expand_palette_rgba8_neon");
|
||||
|
||||
if (row_width < pixels_per_chunk)
|
||||
return 0;
|
||||
|
||||
/* This function originally gets the last byte of the output row.
|
||||
* The NEON part writes forward from a given position, so we have
|
||||
* to seek this back by 4 pixels x 4 bytes.
|
||||
*/
|
||||
*ddp = *ddp - ((pixels_per_chunk * sizeof(png_uint_32)) - 1);
|
||||
|
||||
for (i = 0; i < row_width; i += pixels_per_chunk)
|
||||
{
|
||||
uint32x4_t cur;
|
||||
png_bytep sp = *ssp - i, dp = *ddp - (i << 2);
|
||||
cur = vld1q_dup_u32 (riffled_palette + *(sp - 3));
|
||||
cur = vld1q_lane_u32(riffled_palette + *(sp - 2), cur, 1);
|
||||
cur = vld1q_lane_u32(riffled_palette + *(sp - 1), cur, 2);
|
||||
cur = vld1q_lane_u32(riffled_palette + *(sp - 0), cur, 3);
|
||||
vst1q_u32((void *)dp, cur);
|
||||
}
|
||||
if (i != row_width)
|
||||
{
|
||||
/* Remove the amount that wasn't processed. */
|
||||
i -= pixels_per_chunk;
|
||||
}
|
||||
|
||||
/* Decrement output pointers. */
|
||||
*ssp = *ssp - i;
|
||||
*ddp = *ddp - (i << 2);
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Expands a palettized row into RGB8. */
|
||||
int
|
||||
png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
|
||||
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
||||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
png_const_bytep palette = (png_const_bytep)png_ptr->palette;
|
||||
const png_uint_32 pixels_per_chunk = 8;
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_do_expand_palette_rgb8_neon");
|
||||
|
||||
if (row_width <= pixels_per_chunk)
|
||||
return 0;
|
||||
|
||||
/* Seeking this back by 8 pixels x 3 bytes. */
|
||||
*ddp = *ddp - ((pixels_per_chunk * sizeof(png_color)) - 1);
|
||||
|
||||
for (i = 0; i < row_width; i += pixels_per_chunk)
|
||||
{
|
||||
uint8x8x3_t cur;
|
||||
png_bytep sp = *ssp - i, dp = *ddp - ((i << 1) + i);
|
||||
cur = vld3_dup_u8(palette + sizeof(png_color) * (*(sp - 7)));
|
||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 6)), cur, 1);
|
||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 5)), cur, 2);
|
||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 4)), cur, 3);
|
||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 3)), cur, 4);
|
||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 2)), cur, 5);
|
||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 1)), cur, 6);
|
||||
cur = vld3_lane_u8(palette + sizeof(png_color) * (*(sp - 0)), cur, 7);
|
||||
vst3_u8((void *)dp, cur);
|
||||
}
|
||||
|
||||
if (i != row_width)
|
||||
{
|
||||
/* Remove the amount that wasn't processed. */
|
||||
i -= pixels_per_chunk;
|
||||
}
|
||||
|
||||
/* Decrement output pointers. */
|
||||
*ssp = *ssp - i;
|
||||
*ddp = *ddp - ((i << 1) + i);
|
||||
return i;
|
||||
}
|
||||
|
||||
#endif /* PNG_ARM_NEON_IMPLEMENTATION */
|
||||
@@ -194,7 +194,7 @@ case "$mode" in
|
||||
if test -d .git
|
||||
then
|
||||
exec >&2
|
||||
echo "ERROR: running autoreconf on an initialized sytem"
|
||||
echo "ERROR: running autoreconf on an initialized system"
|
||||
echo " This is not necessary; it is only necessary to remake the"
|
||||
echo " autotools generated files if Makefile.am or configure.ac"
|
||||
echo " change and make does the right thing with:"
|
||||
|
||||
348
compile
Executable file
@@ -0,0 +1,348 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
1476
config.guess
vendored
Executable file
126
config.h.in
Normal file
@@ -0,0 +1,126 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `feenableexcept' function. */
|
||||
#undef HAVE_FEENABLEEXCEPT
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `pow' function. */
|
||||
#undef HAVE_POW
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Turn on ARM Neon optimizations at run-time */
|
||||
#undef PNG_ARM_NEON_API_SUPPORTED
|
||||
|
||||
/* Check for ARM Neon support at run-time */
|
||||
#undef PNG_ARM_NEON_CHECK_SUPPORTED
|
||||
|
||||
/* Enable ARM Neon optimizations */
|
||||
#undef PNG_ARM_NEON_OPT
|
||||
|
||||
/* Enable Intel SSE optimizations */
|
||||
#undef PNG_INTEL_SSE_OPT
|
||||
|
||||
/* Turn on MIPS MSA optimizations at run-time */
|
||||
#undef PNG_MIPS_MSA_API_SUPPORTED
|
||||
|
||||
/* Check for MIPS MSA support at run-time */
|
||||
#undef PNG_MIPS_MSA_CHECK_SUPPORTED
|
||||
|
||||
/* Enable MIPS MSA optimizations */
|
||||
#undef PNG_MIPS_MSA_OPT
|
||||
|
||||
/* Turn on POWERPC VSX optimizations at run-time */
|
||||
#undef PNG_POWERPC_VSX_API_SUPPORTED
|
||||
|
||||
/* Check for POWERPC VSX support at run-time */
|
||||
#undef PNG_POWERPC_VSX_CHECK_SUPPORTED
|
||||
|
||||
/* Enable POWERPC VSX optimizations */
|
||||
#undef PNG_POWERPC_VSX_OPT
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported directly. */
|
||||
#undef restrict
|
||||
/* Work around a bug in Sun C++: it does not support _Restrict or
|
||||
__restrict__, even though the corresponding Sun C compiler ends up with
|
||||
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
||||
previous line. Perhaps some future version of Sun C++ will work with
|
||||
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
||||
#if defined __SUNPRO_CC && !defined __RESTRICT
|
||||
# define _Restrict
|
||||
# define __restrict__
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
1801
config.sub
vendored
Executable file
192
configure.ac
@@ -1,7 +1,7 @@
|
||||
# configure.ac
|
||||
|
||||
# Copyright (c) 2004-2015 Glenn Randers-Pehrson
|
||||
# Last changed in libpng 1.6.22 [June 9, 2016]
|
||||
# Copyright (c) 2018 Cosmin Truta
|
||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -25,7 +25,7 @@ AC_PREREQ([2.68])
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng],[1.6.23],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_INIT([libpng],[1.6.37],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts])
|
||||
|
||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||
@@ -36,7 +36,7 @@ AC_CONFIG_MACRO_DIR([scripts])
|
||||
# 1.13 is required for parallel tests
|
||||
AM_INIT_AUTOMAKE([1.13 foreign dist-xz color-tests silent-rules subdir-objects])
|
||||
# The following line causes --disable-maintainer-mode to be the default to
|
||||
# configure, this is necessary because libpng distributions cannot rely on the
|
||||
# configure. This is necessary because libpng distributions cannot rely on the
|
||||
# time stamps of the autotools generated files being correct
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
@@ -46,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
|
||||
dnl AM_PREREQ([1.11.2])
|
||||
dnl stop configure from automagically running automake
|
||||
|
||||
PNGLIB_VERSION=1.6.23
|
||||
PNGLIB_VERSION=1.6.37
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=6
|
||||
PNGLIB_RELEASE=23
|
||||
PNGLIB_RELEASE=37
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
@@ -67,7 +67,7 @@ AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
dnl libtool/libtoolize; version 2.4.2 is the tested version, this or any
|
||||
dnl libtool/libtoolize; version 2.4.2 is the tested version. This or any
|
||||
dnl compatible later version may be used
|
||||
LT_INIT([win32-dll])
|
||||
LT_PREREQ([2.4.2])
|
||||
@@ -144,7 +144,6 @@ AC_C_RESTRICT
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_STRTOD
|
||||
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
|
||||
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
|
||||
|
||||
# Some later POSIX 1003.1 functions are required for test programs, failure here
|
||||
@@ -300,6 +299,55 @@ AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
|
||||
# HOST SPECIFIC OPTIONS
|
||||
# =====================
|
||||
#
|
||||
# DEFAULT
|
||||
# =======
|
||||
#
|
||||
AC_ARG_ENABLE([hardware-optimizations],
|
||||
AS_HELP_STRING([[[--enable-hardware-optimizations]]],
|
||||
[Enable hardware optimizations: =no/off, yes/on:]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
# disable hardware optimization on all systems:
|
||||
enable_arm_neon=no
|
||||
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
||||
[Disable ARM_NEON optimizations])
|
||||
enable_mips_msa=no
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||
[Disable MIPS_MSA optimizations])
|
||||
enable_powerpc_vsx=no
|
||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
|
||||
[Disable POWERPC VSX optimizations])
|
||||
enable_intel_sse=no
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
||||
[Disable INTEL_SSE optimizations])
|
||||
;;
|
||||
*)
|
||||
# allow enabling hardware optimization on any system:
|
||||
case "$host_cpu" in
|
||||
arm*|aarch64*)
|
||||
enable_arm_neon=yes
|
||||
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
||||
[Enable ARM_NEON optimizations])
|
||||
;;
|
||||
mipsel*|mips64el*)
|
||||
enable_mips_msa=yes
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||
[Enable MIPS_MSA optimizations])
|
||||
;;
|
||||
i?86|x86_64)
|
||||
enable_intel_sse=yes
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
||||
[Enable Intel SSE optimizations])
|
||||
;;
|
||||
powerpc*|ppc64*)
|
||||
enable_powerpc_vsx=yes
|
||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
|
||||
[Enable POWERPC VSX optimizations])
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac])
|
||||
|
||||
# ARM
|
||||
# ===
|
||||
#
|
||||
@@ -346,6 +394,134 @@ AM_CONDITIONAL([PNG_ARM_NEON],
|
||||
*) test "$enable_arm_neon" != '';;
|
||||
esac])
|
||||
|
||||
# MIPS
|
||||
# ===
|
||||
#
|
||||
# MIPS MSA (SIMD) support.
|
||||
|
||||
AC_ARG_ENABLE([mips-msa],
|
||||
AS_HELP_STRING([[[--enable-mips-msa]]],
|
||||
[Enable MIPS MSA optimizations: =no/off, check, api, yes/on:]
|
||||
[no/off: disable the optimizations; check: use internal checking code]
|
||||
[(deprecated and poorly supported); api: disable by default, enable by]
|
||||
[a call to png_set_option; yes/on: turn on unconditionally.]
|
||||
[If not specified: determined by the compiler.]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
# disable the default enabling on __mips_msa systems:
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||
[Disable MIPS MSA optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_mips_msa=no;;
|
||||
check)
|
||||
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
|
||||
[Check for MIPS MSA support at run-time]);;
|
||||
api)
|
||||
AC_DEFINE([PNG_MIPS_MSA_API_SUPPORTED], [],
|
||||
[Turn on MIPS MSA optimizations at run-time]);;
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
|
||||
[Enable MIPS MSA optimizations])
|
||||
AC_MSG_WARN([--enable-mips-msa: please specify 'check' or 'api', if]
|
||||
[you want the optimizations unconditionally pass '-mmsa -mfp64']
|
||||
[to the compiler.]);;
|
||||
*)
|
||||
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
|
||||
esac])
|
||||
|
||||
# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
|
||||
# where MIPS optimizations were explicitly requested (this allows a fallback if a
|
||||
# future host CPU does not match 'mips*')
|
||||
|
||||
AM_CONDITIONAL([PNG_MIPS_MSA],
|
||||
[test "$enable_mips_msa" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
mipsel*|mips64el*) :;;
|
||||
esac])
|
||||
|
||||
# INTEL
|
||||
# =====
|
||||
#
|
||||
# INTEL SSE (SIMD) support.
|
||||
|
||||
AC_ARG_ENABLE([intel-sse],
|
||||
AS_HELP_STRING([[[--enable-intel-sse]]],
|
||||
[Enable Intel SSE optimizations: =no/off, yes/on:]
|
||||
[no/off: disable the optimizations;]
|
||||
[yes/on: enable the optimizations.]
|
||||
[If not specified: determined by the compiler.]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
# disable the default enabling:
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
||||
[Disable Intel SSE optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_intel_sse=no;;
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
||||
[Enable Intel SSE optimizations]);;
|
||||
*)
|
||||
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
|
||||
esac])
|
||||
|
||||
# Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
|
||||
# or where Intel optimizations were explicitly requested (this allows a
|
||||
# fallback if a future host CPU does not match 'x86*')
|
||||
AM_CONDITIONAL([PNG_INTEL_SSE],
|
||||
[test "$enable_intel_sse" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
i?86|x86_64) :;;
|
||||
*) test "$enable_intel_sse" != '';;
|
||||
esac])
|
||||
|
||||
# PowerPC
|
||||
# ===
|
||||
#
|
||||
# PowerPC VSX (SIMD) support.
|
||||
|
||||
AC_ARG_ENABLE([powerpc-vsx],
|
||||
AS_HELP_STRING([[[--enable-powerpc-vsx]]],
|
||||
[Enable POWERPC VSX optimizations: =no/off, check, api, yes/on:]
|
||||
[no/off: disable the optimizations; check: use internal checking code]
|
||||
[api: disable by default, enable by a call to png_set_option]
|
||||
[yes/on: turn on unconditionally.]
|
||||
[If not specified: determined by the compiler.]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
# disable the default enabling on __ppc64__ systems:
|
||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [0],
|
||||
[Disable POWERPC VSX optimizations])
|
||||
# Prevent inclusion of the platform specific files below:
|
||||
enable_powerpc_vsx=no;;
|
||||
check)
|
||||
AC_DEFINE([PNG_POWERPC_VSX_CHECK_SUPPORTED], [],
|
||||
[Check for POWERPC VSX support at run-time])
|
||||
AC_MSG_WARN([--enable-powerpc-vsx Please check contrib/powerpc/README file]
|
||||
[for the list of supported OSes.]);;
|
||||
api)
|
||||
AC_DEFINE([PNG_POWERPC_VSX_API_SUPPORTED], [],
|
||||
[Turn on POWERPC VSX optimizations at run-time]);;
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_POWERPC_VSX_OPT], [2],
|
||||
[Enable POWERPC VSX optimizations])
|
||||
AC_MSG_WARN([--enable-powerpc-vsx: please specify 'check' or 'api', if]
|
||||
[you want the optimizations unconditionally pass '-maltivec -mvsx']
|
||||
[or '-mcpu=power8'to the compiler.]);;
|
||||
*)
|
||||
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value])
|
||||
esac])
|
||||
|
||||
# Add PowerPC specific files to all builds where the host_cpu is powerpc('powerpc*') or
|
||||
# where POWERPC optimizations were explicitly requested (this allows a fallback if a
|
||||
# future host CPU does not match 'powerpc*')
|
||||
|
||||
AM_CONDITIONAL([PNG_POWERPC_VSX],
|
||||
[test "$enable_powerpc_vsx" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
powerpc*|ppc64*) :;;
|
||||
esac])
|
||||
|
||||
|
||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||
|
||||
# Config files, substituting as above
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* Documentation:
|
||||
* http://www.kandroid.org/ndk/docs/CPU-ARM-NEON.html
|
||||
* http://code.google.com/p/android/issues/detail?id=49065
|
||||
* https://code.google.com/p/android/issues/detail?id=49065
|
||||
*
|
||||
* NOTE: this requires that libpng is built against the Android NDK and linked
|
||||
* with an implementation of the Android ARM 'cpu-features' library. The code
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* contrib/arm-neon/linux.c
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by John Bowler, 2014.
|
||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2014, 2017 Glenn Randers-Pehrson
|
||||
* Written by John Bowler, 2014, 2017.
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -62,7 +62,7 @@ png_have_neon(png_structp png_ptr)
|
||||
|
||||
counter=0;
|
||||
state = Feature;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case Feature:
|
||||
/* Match 'FEATURE', ASCII case insensitive. */
|
||||
@@ -75,7 +75,7 @@ png_have_neon(png_structp png_ptr)
|
||||
|
||||
/* did not match 'feature' */
|
||||
state = SkipLine;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case SkipLine:
|
||||
skipLine:
|
||||
@@ -110,7 +110,7 @@ png_have_neon(png_structp png_ptr)
|
||||
|
||||
state = Neon;
|
||||
counter = 0;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case Neon:
|
||||
/* Look for 'neon' tag */
|
||||
@@ -122,7 +122,7 @@ png_have_neon(png_structp png_ptr)
|
||||
}
|
||||
|
||||
state = SkipTag;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case SkipTag:
|
||||
/* Skip non-space characters */
|
||||
|
||||
57
contrib/conftest/pngcp.dfa
Normal file
@@ -0,0 +1,57 @@
|
||||
# pngcp.dfa
|
||||
# Build time configuration of libpng
|
||||
#
|
||||
# Author: John Bowler
|
||||
# Copyright: (c) John Bowler, 2016
|
||||
# Usage rights:
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
#
|
||||
# Build libpng with support for pngcp. This means just png_read_png,
|
||||
# png_write_png and small number of configuration settings.
|
||||
#
|
||||
everything = off
|
||||
|
||||
# This option is specific to this configuration; it adds a #define to the
|
||||
# generated pnglibconf.h which turns on the (not portable) timing option for
|
||||
# pngcp. Note that any option is automatically preceded by PNG_; there is no
|
||||
# way round this and this is deliberate.
|
||||
option PNGCP_TIMING
|
||||
|
||||
# Because of the everything off above the option must also be turned on. This
|
||||
# may not be done in one step because it is safer and avoids mis-spelled options
|
||||
# in user .dfa files to error out if an unrecognized option is turned on.
|
||||
option PNGCP_TIMING on
|
||||
|
||||
# Options to turn on png_read_png and png_write_png:
|
||||
option INFO_IMAGE on
|
||||
option SEQUENTIAL_READ on
|
||||
option EASY_ACCESS on
|
||||
option WRITE on
|
||||
option WRITE_16BIT on
|
||||
option WRITE_FILTER on
|
||||
|
||||
# pngcp needs this to preserve unknown chunks, switching all these on means that
|
||||
# pngcp can work without explicit known chunk reading support
|
||||
option UNKNOWN_CHUNKS on
|
||||
option SET_UNKNOWN_CHUNKS on
|
||||
option HANDLE_AS_UNKNOWN on
|
||||
option SAVE_UNKNOWN_CHUNKS on
|
||||
option WRITE_UNKNOWN_CHUNKS on
|
||||
|
||||
# pngcp needs this to handle palette files with invalid indices:
|
||||
option CHECK_FOR_INVALID_INDEX on
|
||||
option GET_PALETTE_MAX on
|
||||
|
||||
# Pre-libpng 1.7 pngcp has to stash text chunks manually, post 1.7 without this
|
||||
# text chunks should be handled as unknown ok.
|
||||
option TEXT on
|
||||
|
||||
# this is used to turn off limits:
|
||||
option USER_LIMITS on
|
||||
option SET_USER_LIMITS on
|
||||
|
||||
# these are just required for specific customizations
|
||||
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
|
||||
option WRITE_CUSTOMIZE_COMPRESSION on
|
||||
@@ -21,4 +21,4 @@ ORIGINAL AUTHORS
|
||||
of the people below claim any rights with regard to the contents of this
|
||||
directory.
|
||||
|
||||
John Bowler <jbowler@acm.org>
|
||||
John Bowler <jbowler at acm.org>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* without processing the image. Notice that some header information may occur
|
||||
* after the image data. Textual data and comments are an example; the approach
|
||||
* in this file won't work reliably for such data because it only looks for the
|
||||
* information in the section of the file that preceeds the image data.
|
||||
* information in the section of the file that precedes the image data.
|
||||
*
|
||||
* Compile and link against libpng and zlib, plus anything else required on the
|
||||
* system you use.
|
||||
|
||||
@@ -42,7 +42,7 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
|
||||
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
|
||||
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
|
||||
|
||||
row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi);
|
||||
row = (png_const_bytep)(((const png_byte (*)[8])row) + bit_offset_hi);
|
||||
row += bit_offset_lo >> 3;
|
||||
bit_offset_lo &= 0x07;
|
||||
|
||||
@@ -73,7 +73,7 @@ static void
|
||||
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||
png_uint_32 x)
|
||||
{
|
||||
PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
||||
unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
||||
|
||||
switch (png_get_color_type(png_ptr, info_ptr))
|
||||
{
|
||||
@@ -87,7 +87,7 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||
*/
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
{
|
||||
PNG_CONST int index = component(row, x, 0, bit_depth, 1);
|
||||
int index = component(row, x, 0, bit_depth, 1);
|
||||
png_colorp palette = NULL;
|
||||
int num_palette = 0;
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
/*- pngtopng
|
||||
*
|
||||
* COPYRIGHT: Written by John Cunningham Bowler, 2011.
|
||||
* COPYRIGHT: Written by John Cunningham Bowler, 2011, 2017.
|
||||
* To the extent possible under law, the author has waived all copyright and
|
||||
* related or neighboring rights to this work. This work is published from:
|
||||
* United States.
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
*
|
||||
* Read a PNG and write it out in a fixed format, using the 'simplified API'
|
||||
* that was introduced in libpng-1.6.0.
|
||||
*
|
||||
@@ -59,26 +61,27 @@ int main(int argc, const char **argv)
|
||||
else
|
||||
fprintf(stderr, "pngtopng: write %s: %s\n", argv[2],
|
||||
image.message);
|
||||
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "pngtopng: read %s: %s\n", argv[1],
|
||||
image.message);
|
||||
|
||||
/* This is the only place where a 'free' is required; libpng does
|
||||
* the cleanup on error and success, but in this case we couldn't
|
||||
* complete the read because of running out of memory.
|
||||
*/
|
||||
png_image_free(&image);
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "pngtopng: out of memory: %lu bytes\n",
|
||||
(unsigned long)PNG_IMAGE_SIZE(image));
|
||||
|
||||
/* This is the only place where a 'free' is required; libpng does
|
||||
* the cleanup on error and success, but in this case we couldn't
|
||||
* complete the read because of running out of memory and so libpng
|
||||
* has not got to the point where it can do cleanup.
|
||||
*/
|
||||
png_image_free(&image);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
@@ -15,7 +15,7 @@ of PBMPLUS/NetPBM) and converts them to PNG.
|
||||
|
||||
The source code for all three demo programs currently compiles under
|
||||
Unix, OpenVMS, and 32-bit Windows. (Special thanks to Martin Zinser,
|
||||
zinser@decus.de, for making the necessary changes for OpenVMS and for
|
||||
zinser at decus.de, for making the necessary changes for OpenVMS and for
|
||||
providing an appropriate build script.) Build instructions can be found
|
||||
below.
|
||||
|
||||
@@ -55,7 +55,7 @@ mation and links to the latest version of the source code, and Chapters
|
||||
13-15 of the book for detailed discussion of the three programs.
|
||||
|
||||
Greg Roelofs
|
||||
http://pobox.com/~newt/greg_contact.html
|
||||
https://pobox.com/~newt/greg_contact.html
|
||||
16 March 2008
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ BUILD INSTRUCTIONS
|
||||
|
||||
- Prerequisites (in order of compilation):
|
||||
|
||||
- zlib http://zlib.net/
|
||||
- zlib https://zlib.net/
|
||||
- libpng http://www.libpng.org/pub/png/libpng.html
|
||||
- pngbook http://www.libpng.org/pub/png/book/sources.html
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007,2017 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
@@ -264,6 +264,12 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
||||
*pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
*pChannels = (int)png_get_channels(png_ptr, info_ptr);
|
||||
|
||||
/* Guard against integer overflow */
|
||||
if (height > ((size_t)(-1))/rowbytes) {
|
||||
fprintf(stderr, "readpng: image_data buffer would be too large\n",
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) {
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return NULL;
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
|
||||
Changelog:
|
||||
2015-11-12 - Check return value of png_get_bKGD() (Glenn R-P)
|
||||
2017-04-22 - Guard against integer overflow (Glenn R-P)
|
||||
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
@@ -145,7 +146,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
||||
/* These byte strings were copied from png.h. If a future version
|
||||
* of readpng2.c recognizes more chunks, add them to this list.
|
||||
*/
|
||||
static PNG_CONST png_byte chunks_to_process[] = {
|
||||
static const png_byte chunks_to_process[] = {
|
||||
98, 75, 71, 68, '\0', /* bKGD */
|
||||
103, 65, 77, 65, '\0', /* gAMA */
|
||||
115, 82, 71, 66, '\0', /* sRGB */
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007,2017 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
@@ -154,12 +154,17 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
||||
*pRowbytes = rowbytes = channels*width;
|
||||
*pChannels = channels;
|
||||
|
||||
if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) {
|
||||
Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height));
|
||||
|
||||
/* Guard against integer overflow */
|
||||
if (height > ((size_t)(-1))/rowbytes) {
|
||||
fprintf(stderr, PROGNAME ": image_data buffer would be too large\n",
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Trace((stderr, "readpng_get_image: rowbytes = %ld, height = %ld\n", rowbytes, height));
|
||||
|
||||
if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* now we can go ahead and just read the whole image */
|
||||
|
||||
|
||||
@@ -24,10 +24,11 @@
|
||||
- 1.10: enabled "message window"/console (thanks to David Geldreich)
|
||||
- 2.00: dual-licensed (added GNU GPL)
|
||||
- 2.01: fixed improper display of usage screen on PNG error(s)
|
||||
- 2.02: check for integer overflow (Glenn R-P)
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2008, 2017 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
@@ -182,7 +183,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
#ifndef __CYGWIN__
|
||||
/* First reenable console output, which normally goes to the bit bucket
|
||||
* for windowed apps. Closing the console window will terminate the
|
||||
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||
* app. Thanks to David.Geldreich at realviz.com for supplying the magical
|
||||
* incantation. */
|
||||
|
||||
AllocConsole();
|
||||
@@ -496,6 +497,12 @@ static int rpng_win_create_window(HINSTANCE hInst, int showmode)
|
||||
|
||||
wimage_rowbytes = ((3*image_width + 3L) >> 2) << 2;
|
||||
|
||||
/* Guard against integer overflow */
|
||||
if (image_height > ((size_t)(-1))/wimage_rowbytes) {
|
||||
fprintf(stderr, PROGNAME ": image_data buffer would be too large\n");
|
||||
return 4; /* fail */
|
||||
}
|
||||
|
||||
if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
|
||||
wimage_rowbytes*image_height)))
|
||||
{
|
||||
|
||||
@@ -28,10 +28,11 @@
|
||||
- 2.01: fixed improper display of usage screen on PNG error(s)
|
||||
- 2.02: Added "void(argc);" statement to quiet pedantic compiler warnings
|
||||
about unused variable (GR-P)
|
||||
- 2.03: check for integer overflow (Glenn R-P)
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2008, 2017 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
|
||||
@@ -33,12 +33,11 @@
|
||||
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
||||
unexpected-EOF and file-read-error cases
|
||||
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
|
||||
- 2.04:
|
||||
(GR-P)
|
||||
- 2.04: check for integer overflow (Glenn R-P)
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2008, 2017 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
@@ -301,7 +300,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
|
||||
#ifndef __CYGWIN__
|
||||
/* Next reenable console output, which normally goes to the bit bucket
|
||||
* for windowed apps. Closing the console window will terminate the
|
||||
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
|
||||
* app. Thanks to David.Geldreich at realviz.com for supplying the magical
|
||||
* incantation. */
|
||||
|
||||
AllocConsole();
|
||||
@@ -650,6 +649,13 @@ static void rpng2_win_init()
|
||||
Trace((stderr, " width = %ld\n", rpng2_info.width))
|
||||
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
||||
|
||||
/* Guard against integer overflow */
|
||||
if (rpng2_info.height > ((size_t)(-1))/rowbytes) {
|
||||
fprintf(stderr, PROGNAME ": image_data buffer would be too large\n",
|
||||
readpng2_cleanup(&rpng2_info);
|
||||
return;
|
||||
}
|
||||
|
||||
rpng2_info.image_data = (uch *)malloc(rowbytes * rpng2_info.height);
|
||||
if (!rpng2_info.image_data) {
|
||||
readpng2_cleanup(&rpng2_info);
|
||||
|
||||
@@ -44,9 +44,11 @@
|
||||
- 2.04: Added "void(foo);" statements to quiet pedantic compiler warnings
|
||||
about unused variables (GR-P)
|
||||
- 2.05: Use nanosleep() instead of usleep(), which is deprecated (GR-P).
|
||||
- 2.06: check for integer overflow (Glenn R-P)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2010, 2014-2015 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2010, 2014-2015, 2017 Greg Roelofs. All rights
|
||||
reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
@@ -780,6 +782,13 @@ static void rpng2_x_init(void)
|
||||
Trace((stderr, " width = %ld\n", rpng2_info.width))
|
||||
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
||||
|
||||
/* Guard against integer overflow */
|
||||
if (rpng2_info.height > ((size_t)(-1))/rpng2_info.rowbytes) {
|
||||
fprintf(stderr, PROGNAME ": image_data buffer would be too large\n");
|
||||
readpng2_cleanup(&rpng2_info);
|
||||
return;
|
||||
}
|
||||
|
||||
rpng2_info.image_data = (uch *)malloc(rowbytes * rpng2_info.height);
|
||||
if (!rpng2_info.image_data) {
|
||||
readpng2_cleanup(&rpng2_info);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
- 1.04: fixed DOS/OS2/Win32 detection, including partial Cygwin fix
|
||||
(see http://home.att.net/~perlspinr/diffs/GregBook_cygwin.diff)
|
||||
- 2.00: dual-licensed (added GNU GPL)
|
||||
- 2.01: check for integer overflow (Glenn R-P)
|
||||
|
||||
[REPORTED BUG (win32 only): "contrib/gregbook/wpng.c - cmd line
|
||||
dose not work! In order to do something useful I needed to redirect
|
||||
@@ -38,7 +39,7 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007, 2017 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
@@ -702,7 +703,18 @@ int main(int argc, char **argv)
|
||||
if (wpng_info.interlaced) {
|
||||
long i;
|
||||
ulg bytes;
|
||||
ulg image_bytes = rowbytes * wpng_info.height; /* overflow? */
|
||||
ulg image_bytes;
|
||||
|
||||
/* Guard against integer overflow */
|
||||
if (wpng_info_height > ((size_t)(-1)/rowbytes ||
|
||||
wpng_info_height > ((ulg)(-1)/rowbytes) {
|
||||
fprintf(stderr, PROGNAME ": image_data buffer too large\n");
|
||||
writepng_cleanup(&wpng_info);
|
||||
wpng_cleanup();
|
||||
exit(5);
|
||||
}
|
||||
|
||||
image_bytes = rowbytes * wpng_info.height;
|
||||
|
||||
wpng_info.image_data = (uch *)malloc(image_bytes);
|
||||
wpng_info.row_pointers = (uch **)malloc(wpng_info.height*sizeof(uch *));
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2007 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2007, 2017 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
Enabling SSE support
|
||||
|
||||
Copyright (c) 2016 Google, Inc.
|
||||
Written by Mike Klein, Matt Sarett
|
||||
|
||||
This INSTALL file written by Glenn Randers-Pehrson, 2016.
|
||||
|
||||
If you have moved intel_init.c and filter_sse2_intrinsics.c to a different
|
||||
directory, be sure to update the '#include "../../pngpriv.h"' line in both
|
||||
files if necessary to point to the correct relative location of pngpriv.h
|
||||
with respect to the new location of those files.
|
||||
|
||||
To enable SSE support in libpng, follow the instructions in I, II, or III,
|
||||
below:
|
||||
|
||||
I. Using patched "configure" scripts:
|
||||
|
||||
First, apply intel_sse.patch in your build directory.
|
||||
|
||||
patch -i contrib/intel/intel_sse.patch -p1
|
||||
|
||||
Then, if you are not building in a new GIT clone, e.g., in a tar
|
||||
distribution, remove any existing pre-built configure scripts:
|
||||
|
||||
./configure --enable-maintainer-mode
|
||||
make maintainer-clean
|
||||
./autogen.sh --maintainer --clean
|
||||
|
||||
Finally, configure libpng with -DPNG_INTEL_SSE in CPPFLAGS:
|
||||
|
||||
./autogen.sh --maintainer
|
||||
CPPFLAGS="-DPNG_INTEL_SSE" ./configure [options]
|
||||
make CPPFLAGS="-DPNG_INTEL_SSE" [options]
|
||||
make
|
||||
|
||||
II. Using a custom makefile:
|
||||
|
||||
If you are using a custom makefile makefile, you will have to update it
|
||||
manually to include contrib/intel/*.o in the dependencies, and to define
|
||||
PNG_INTEL_SSE.
|
||||
|
||||
III. Using manually updated "configure" scripts:
|
||||
|
||||
If you prefer, manually edit pngpriv.h, configure.ac, and Makefile.am,
|
||||
following the instructions below, then follow the instructions in
|
||||
section II of INSTALL in the main libpng directory, then configure libpng
|
||||
with -DPNG_INTEL_SSE in CPPFLAGS.
|
||||
|
||||
1. Add the following code to configure.ac under HOST SPECIFIC OPTIONS
|
||||
directly beneath the section for ARM:
|
||||
|
||||
-----------------cut----------------
|
||||
# INTEL
|
||||
# =====
|
||||
#
|
||||
# INTEL SSE (SIMD) support.
|
||||
|
||||
AC_ARG_ENABLE([intel-sse],
|
||||
AS_HELP_STRING([[[--enable-intel-sse]]],
|
||||
[Enable Intel SSE optimizations: =no/off, yes/on:]
|
||||
[no/off: disable the optimizations;]
|
||||
[yes/on: enable the optimizations.]
|
||||
[If not specified: determined by the compiler.]),
|
||||
[case "$enableval" in
|
||||
no|off)
|
||||
# disable the default enabling:
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
||||
[Disable Intel SSE optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_intel_sse=no;;
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
||||
[Enable Intel SSE optimizations]);;
|
||||
*)
|
||||
AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
|
||||
esac])
|
||||
|
||||
# Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
|
||||
# or where Intel optimizations were explicitly requested (this allows a
|
||||
# fallback if a future host CPU does not match 'x86*')
|
||||
AM_CONDITIONAL([PNG_INTEL_SSE],
|
||||
[test "$enable_intel_sse" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
i?86|x86_64) :;;
|
||||
*) test "$enable_intel_sse" != '';;
|
||||
esac])
|
||||
-----------------cut----------------
|
||||
|
||||
2. Add the following code to Makefile.am under HOST SPECIFIC OPTIONS
|
||||
directly beneath the "if PNG_ARM_NEON ... endif" statement:
|
||||
|
||||
-----------------cut----------------
|
||||
if PNG_INTEL_SSE
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += contrib/intel/intel_init.c\
|
||||
contrib/intel/filter_sse2_intrinsics.c
|
||||
endif
|
||||
-----------------cut----------------
|
||||
|
||||
3. Add the following lines to pngpriv.h, following the PNG_ARM_NEON_OPT
|
||||
code:
|
||||
|
||||
-----------------cut----------------
|
||||
#ifndef PNG_INTEL_SSE_OPT
|
||||
# ifdef PNG_INTEL_SSE
|
||||
/* Only check for SSE if the build configuration has been modified to
|
||||
* enable SSE optimizations. This means that these optimizations will
|
||||
* be off by default. See contrib/intel for more details.
|
||||
*/
|
||||
# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
|
||||
defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
|
||||
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
||||
# define PNG_INTEL_SSE_OPT 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if PNG_INTEL_SSE_OPT > 0
|
||||
# ifndef PNG_INTEL_SSE_IMPLEMENTATION
|
||||
# if defined(__SSE4_1__) || defined(__AVX__)
|
||||
/* We are not actually using AVX, but checking for AVX is the best
|
||||
way we can detect SSE4.1 and SSSE3 on MSVC.
|
||||
*/
|
||||
# define PNG_INTEL_SSE_IMPLEMENTATION 3
|
||||
# elif defined(__SSSE3__)
|
||||
# define PNG_INTEL_SSE_IMPLEMENTATION 2
|
||||
# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
|
||||
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
||||
# define PNG_INTEL_SSE_IMPLEMENTATION 1
|
||||
# else
|
||||
# define PNG_INTEL_SSE_IMPLEMENTATION 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
|
||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
|
||||
# endif
|
||||
#endif
|
||||
|
||||
-----------------cut----------------
|
||||
|
||||
4. Add the following lines to pngpriv.h, following the prototype for
|
||||
png_read_filter_row_paeth4_neon:
|
||||
|
||||
-----------------cut----------------
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
|
||||
-----------------cut----------------
|
||||
@@ -1,183 +0,0 @@
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
--- a/configure.ac 2016-05-25 18:59:10.000000000 -0400
|
||||
+++ b/configure.ac 2016-05-25 19:48:10.631751170 -0400
|
||||
@@ -341,16 +341,50 @@ AC_ARG_ENABLE([arm-neon],
|
||||
|
||||
AM_CONDITIONAL([PNG_ARM_NEON],
|
||||
[test "$enable_arm_neon" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
arm*|aarch64*) :;;
|
||||
*) test "$enable_arm_neon" != '';;
|
||||
esac])
|
||||
|
||||
+# INTEL
|
||||
+# =====
|
||||
+#
|
||||
+# INTEL SSE (SIMD) support.
|
||||
+
|
||||
+AC_ARG_ENABLE([intel-sse],
|
||||
+ AS_HELP_STRING([[[--enable-intel-sse]]],
|
||||
+ [Enable Intel SSE optimizations: =no/off, yes/on:]
|
||||
+ [no/off: disable the optimizations;]
|
||||
+ [yes/on: enable the optimizations.]
|
||||
+ [If not specified: determined by the compiler.]),
|
||||
+ [case "$enableval" in
|
||||
+ no|off)
|
||||
+ # disable the default enabling:
|
||||
+ AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
||||
+ [Disable Intel SSE optimizations])
|
||||
+ # Prevent inclusion of the assembler files below:
|
||||
+ enable_intel_sse=no;;
|
||||
+ yes|on)
|
||||
+ AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
||||
+ [Enable Intel SSE optimizations]);;
|
||||
+ *)
|
||||
+ AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
|
||||
+ esac])
|
||||
+
|
||||
+# Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
|
||||
+# or where Intel optimizations were explicitly requested (this allows a
|
||||
+# fallback if a future host CPU does not match 'x86*')
|
||||
+AM_CONDITIONAL([PNG_INTEL_SSE],
|
||||
+ [test "$enable_intel_sse" != 'no' &&
|
||||
+ case "$host_cpu" in
|
||||
+ i?86|x86_64) :;;
|
||||
+ *) test "$enable_intel_sse" != '';;
|
||||
+ esac])
|
||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||
|
||||
# Config files, substituting as above
|
||||
AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
|
||||
AC_CONFIG_FILES([libpng-config:libpng-config.in],
|
||||
[chmod +x libpng-config])
|
||||
|
||||
AC_OUTPUT
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
--- a/Makefile.am 2016-05-17 18:15:12.000000000 -0400
|
||||
+++ b/Makefile.am 2016-05-25 19:48:10.631751170 -0400
|
||||
@@ -89,16 +89,20 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SO
|
||||
pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
|
||||
png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa
|
||||
|
||||
if PNG_ARM_NEON
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
||||
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
||||
endif
|
||||
|
||||
+if PNG_INTEL_SSE
|
||||
+libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += contrib/intel/intel_init.c\
|
||||
+ contrib/intel/filter_sse2_intrinsics.c
|
||||
+endif
|
||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||
-version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
|
||||
|
||||
if HAVE_LD_VERSION_SCRIPT
|
||||
# Versioned symbols and restricted exports
|
||||
if HAVE_SOLARIS_LD
|
||||
diff --git a/pngpriv.h b/pngpriv.h
|
||||
--- a/pngpriv.h 2016-05-31 09:20:34.442885047 -0500
|
||||
+++ b/pngpriv.h 2016-05-31 09:14:54.583492341 -0500
|
||||
@@ -177,16 +177,52 @@
|
||||
# endif /* !PNG_ARM_NEON_IMPLEMENTATION */
|
||||
|
||||
# ifndef PNG_ARM_NEON_IMPLEMENTATION
|
||||
/* Use the intrinsics code by default. */
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 1
|
||||
# endif
|
||||
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||
|
||||
+#ifndef PNG_INTEL_SSE_OPT
|
||||
+# ifdef PNG_INTEL_SSE
|
||||
+ /* Only check for SSE if the build configuration has been modified to
|
||||
+ * enable SSE optimizations. This means that these optimizations will
|
||||
+ * be off by default. See contrib/intel for more details.
|
||||
+ */
|
||||
+# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
|
||||
+ defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
|
||||
+ (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
||||
+# define PNG_INTEL_SSE_OPT 1
|
||||
+# endif
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#if PNG_INTEL_SSE_OPT > 0
|
||||
+# ifndef PNG_INTEL_SSE_IMPLEMENTATION
|
||||
+# if defined(__SSE4_1__) || defined(__AVX__)
|
||||
+ /* We are not actually using AVX, but checking for AVX is the best
|
||||
+ way we can detect SSE4.1 and SSSE3 on MSVC.
|
||||
+ */
|
||||
+# define PNG_INTEL_SSE_IMPLEMENTATION 3
|
||||
+# elif defined(__SSSE3__)
|
||||
+# define PNG_INTEL_SSE_IMPLEMENTATION 2
|
||||
+# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
|
||||
+ (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
||||
+# define PNG_INTEL_SSE_IMPLEMENTATION 1
|
||||
+# else
|
||||
+# define PNG_INTEL_SSE_IMPLEMENTATION 0
|
||||
+# endif
|
||||
+# endif
|
||||
+
|
||||
+# if PNG_INTEL_SSE_IMPLEMENTATION > 0
|
||||
+# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
/* Is this a build of a DLL where compilation of the object modules requires
|
||||
* different preprocessor settings to those required for a simple library? If
|
||||
* so PNG_BUILD_DLL must be set.
|
||||
*
|
||||
* If libpng is used inside a DLL but that DLL does not export the libpng APIs
|
||||
* PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a
|
||||
* static library of libpng then link the DLL against that.
|
||||
*/
|
||||
@@ -1184,16 +1220,29 @@ PNG_INTERNAL_FUNCTION(void,png_read_filt
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_neon,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
|
||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
|
||||
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop
|
||||
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop
|
||||
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop
|
||||
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop
|
||||
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop
|
||||
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
|
||||
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
||||
+
|
||||
/* Choose the best filter to use and filter the row data */
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
|
||||
png_row_infop row_info),PNG_EMPTY);
|
||||
|
||||
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_IDAT_data,(png_structrp png_ptr,
|
||||
png_bytep output, png_alloc_size_t avail_out),PNG_EMPTY);
|
||||
/* Read 'avail_out' bytes of data from the IDAT stream. If the output buffer
|
||||
@@ -1910,16 +1959,18 @@ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_O
|
||||
/* Just declare the optimization that will be used */
|
||||
#else
|
||||
/* List *all* the possible optimizations here - this branch is required if
|
||||
* the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
|
||||
* CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
|
||||
*/
|
||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||
+PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
|
||||
+ (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
||||
png_const_charp key, png_bytep new_key), PNG_EMPTY);
|
||||
|
||||
/* Maintainer: Put new private prototypes here ^ */
|
||||
|
||||
#include "pngdebug.h"
|
||||
@@ -661,7 +661,7 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
const png_uint_32 luma = colors[1];
|
||||
png_uint_32 luma = colors[1];
|
||||
png_uint_32 x;
|
||||
|
||||
for (x=0; x<=size_max; ++x)
|
||||
@@ -672,8 +672,8 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||
|
||||
case 2:
|
||||
{
|
||||
const png_uint_32 luma = colors[1];
|
||||
const png_uint_32 alpha = colors[2];
|
||||
png_uint_32 luma = colors[1];
|
||||
png_uint_32 alpha = colors[2];
|
||||
png_uint_32 x;
|
||||
|
||||
for (x=0; x<size_max; ++x)
|
||||
@@ -688,9 +688,9 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||
|
||||
case 3:
|
||||
{
|
||||
const png_uint_32 red = colors[1];
|
||||
const png_uint_32 green = colors[2];
|
||||
const png_uint_32 blue = colors[3];
|
||||
png_uint_32 red = colors[1];
|
||||
png_uint_32 green = colors[2];
|
||||
png_uint_32 blue = colors[3];
|
||||
png_uint_32 x;
|
||||
|
||||
for (x=0; x<=size_max; ++x)
|
||||
@@ -707,10 +707,10 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||
|
||||
case 4:
|
||||
{
|
||||
const png_uint_32 red = colors[1];
|
||||
const png_uint_32 green = colors[2];
|
||||
const png_uint_32 blue = colors[3];
|
||||
const png_uint_32 alpha = colors[4];
|
||||
png_uint_32 red = colors[1];
|
||||
png_uint_32 green = colors[2];
|
||||
png_uint_32 blue = colors[3];
|
||||
png_uint_32 alpha = colors[4];
|
||||
png_uint_32 x;
|
||||
|
||||
for (x=0; x<=size_max; ++x)
|
||||
@@ -812,7 +812,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||
png_error(png_ptr, "OOM allocating info structure");
|
||||
|
||||
{
|
||||
const unsigned int size =
|
||||
unsigned int size =
|
||||
image_size_of_type(color_type, bit_depth, colors, small);
|
||||
unsigned int ysize;
|
||||
png_fixed_point real_gamma = 45455; /* For sRGB */
|
||||
@@ -824,7 +824,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||
*/
|
||||
if (small)
|
||||
{
|
||||
const unsigned int pixel_depth =
|
||||
unsigned int pixel_depth =
|
||||
pixel_depth_of_type(color_type, bit_depth);
|
||||
|
||||
if (pixel_depth <= 8U)
|
||||
@@ -950,7 +950,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||
int passes = 1;
|
||||
# endif /* !WRITE_INTERLACING */
|
||||
int pass;
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
row = malloc(rowbytes);
|
||||
|
||||
@@ -1094,7 +1094,7 @@ load_file(png_const_charp name, png_bytepp result)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static png_size_t
|
||||
static size_t
|
||||
load_fake(png_charp param, png_bytepp profile)
|
||||
{
|
||||
char *endptr = NULL;
|
||||
@@ -1164,7 +1164,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||
{
|
||||
case '<':
|
||||
{
|
||||
png_size_t filelen = load_file(params[1]+1, &profile);
|
||||
size_t filelen = load_file(params[1]+1, &profile);
|
||||
if (filelen > 0xfffffffc) /* Maximum profile length */
|
||||
{
|
||||
fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n",
|
||||
@@ -1179,7 +1179,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
{
|
||||
png_size_t fake_len = load_fake(params[1], &profile);
|
||||
size_t fake_len = load_fake(params[1], &profile);
|
||||
|
||||
if (fake_len > 0) /* else a simple parameter */
|
||||
{
|
||||
@@ -1274,7 +1274,7 @@ set_text(png_structp png_ptr, png_infop info_ptr, png_textp text,
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
{
|
||||
png_bytep data = NULL;
|
||||
png_size_t fake_len = load_fake(param, &data);
|
||||
size_t fake_len = load_fake(param, &data);
|
||||
|
||||
if (fake_len > 0) /* else a simple parameter */
|
||||
{
|
||||
@@ -1378,10 +1378,10 @@ static void
|
||||
insert_sBIT(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||
png_charpp params)
|
||||
{
|
||||
const int ct = png_get_color_type(png_ptr, info_ptr);
|
||||
const int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
|
||||
int ct = png_get_color_type(png_ptr, info_ptr);
|
||||
int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
|
||||
(ct & PNG_COLOR_MASK_ALPHA ? 1 : 0);
|
||||
const unsigned int maxval =
|
||||
unsigned int maxval =
|
||||
ct & PNG_COLOR_MASK_PALETTE ? 8U : png_get_bit_depth(png_ptr, info_ptr);
|
||||
png_color_8 sBIT;
|
||||
|
||||
@@ -1856,7 +1856,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* Check the colors */
|
||||
{
|
||||
const unsigned int lim = (color_type == PNG_COLOR_TYPE_PALETTE ? 255U :
|
||||
unsigned int lim = (color_type == PNG_COLOR_TYPE_PALETTE ? 255U :
|
||||
(1U<<bit_depth)-1);
|
||||
unsigned int i;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Copyright (c) 2015,2016 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -45,8 +45,19 @@
|
||||
# define SKIP 0
|
||||
#endif
|
||||
|
||||
#if defined(PNG_INFO_IMAGE_SUPPORTED) && defined(PNG_SEQUENTIAL_READ_SUPPORTED)\
|
||||
&& (defined(PNG_READ_PNG_SUPPORTED) || PNG_LIBPNG_VER < 10700)
|
||||
#if PNG_LIBPNG_VER < 10700
|
||||
/* READ_PNG and WRITE_PNG were not defined, so: */
|
||||
# ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
# define PNG_READ_PNG_SUPPORTED
|
||||
# endif /* SEQUENTIAL_READ */
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
# define PNG_WRITE_PNG_SUPPORTED
|
||||
# endif /* WRITE */
|
||||
# endif /* INFO_IMAGE */
|
||||
#endif /* pre 1.7.0 */
|
||||
|
||||
#ifdef PNG_READ_PNG_SUPPORTED
|
||||
/* If a transform is valid on both read and write this implies that if the
|
||||
* transform is applied to read it must also be applied on write to produce
|
||||
* meaningful data. This is because these transforms when performed on read
|
||||
@@ -395,7 +406,7 @@ buffer_destroy(struct buffer *buffer)
|
||||
buffer_destroy_list(list);
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
#ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
static void
|
||||
buffer_start_write(struct buffer *buffer)
|
||||
{
|
||||
@@ -540,7 +551,7 @@ struct display
|
||||
png_structp original_pp; /* used on the original read */
|
||||
png_infop original_ip; /* set by the original read */
|
||||
|
||||
png_size_t original_rowbytes; /* of the original rows: */
|
||||
size_t original_rowbytes; /* of the original rows: */
|
||||
png_bytepp original_rows; /* from the original read */
|
||||
|
||||
/* Original chunks valid */
|
||||
@@ -565,7 +576,7 @@ struct display
|
||||
png_structp read_pp;
|
||||
png_infop read_ip;
|
||||
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
# ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
/* Used to write a new image (the original info_ptr is used) */
|
||||
png_structp write_pp;
|
||||
struct buffer written_file; /* where the file gets written */
|
||||
@@ -592,7 +603,7 @@ display_init(struct display *dp)
|
||||
dp->read_ip = NULL;
|
||||
buffer_init(&dp->original_file);
|
||||
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
# ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
dp->write_pp = NULL;
|
||||
buffer_init(&dp->written_file);
|
||||
# endif
|
||||
@@ -605,7 +616,7 @@ display_clean_read(struct display *dp)
|
||||
png_destroy_read_struct(&dp->read_pp, &dp->read_ip, NULL);
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
#ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
static void
|
||||
display_clean_write(struct display *dp)
|
||||
{
|
||||
@@ -617,7 +628,7 @@ display_clean_write(struct display *dp)
|
||||
static void
|
||||
display_clean(struct display *dp)
|
||||
{
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
# ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
display_clean_write(dp);
|
||||
# endif
|
||||
display_clean_read(dp);
|
||||
@@ -635,7 +646,7 @@ static void
|
||||
display_destroy(struct display *dp)
|
||||
{
|
||||
/* Release any memory held in the display. */
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
# ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
buffer_destroy(&dp->written_file);
|
||||
# endif
|
||||
|
||||
@@ -796,7 +807,7 @@ display_cache_file(struct display *dp, const char *filename)
|
||||
|
||||
static void
|
||||
buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
||||
png_size_t size)
|
||||
size_t size)
|
||||
{
|
||||
struct buffer_list *last = bp->current;
|
||||
size_t read_count = bp->read_count;
|
||||
@@ -844,7 +855,7 @@ buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
read_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
read_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
buffer_read(get_dp(pp), get_buffer(pp), data, size);
|
||||
}
|
||||
@@ -916,7 +927,7 @@ update_display(struct display *dp)
|
||||
png_structp pp;
|
||||
png_infop ip;
|
||||
|
||||
/* Now perform the initial read with a 0 tranform. */
|
||||
/* Now perform the initial read with a 0 transform. */
|
||||
read_png(dp, &dp->original_file, "original read", 0/*no transform*/);
|
||||
|
||||
/* Move the result to the 'original' fields */
|
||||
@@ -1082,6 +1093,7 @@ compare_read(struct display *dp, int applied_transforms)
|
||||
}
|
||||
|
||||
else
|
||||
# ifdef PNG_sBIT_SUPPORTED
|
||||
{
|
||||
unsigned long y;
|
||||
int bpp; /* bits-per-pixel then bytes-per-pixel */
|
||||
@@ -1243,15 +1255,19 @@ compare_read(struct display *dp, int applied_transforms)
|
||||
}
|
||||
} /* for y */
|
||||
}
|
||||
# else /* !sBIT */
|
||||
display_log(dp, INTERNAL_ERROR,
|
||||
"active shift transform but no sBIT support");
|
||||
# endif /* !sBIT */
|
||||
}
|
||||
|
||||
return 1; /* compare succeeded */
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
#ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
static void
|
||||
buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
||||
png_size_t size)
|
||||
size_t size)
|
||||
/* Generic write function used both from the write callback provided to
|
||||
* libpng and from the generic read code.
|
||||
*/
|
||||
@@ -1295,7 +1311,7 @@ buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
write_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
write_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
buffer_write(get_dp(pp), get_buffer(pp), data, size);
|
||||
}
|
||||
@@ -1347,7 +1363,7 @@ write_png(struct display *dp, png_infop ip, int transforms)
|
||||
*/
|
||||
display_clean_write(dp);
|
||||
}
|
||||
#endif /* WRITE_SUPPORTED */
|
||||
#endif /* WRITE_PNG */
|
||||
|
||||
static int
|
||||
skip_transform(struct display *dp, int tr)
|
||||
@@ -1409,7 +1425,7 @@ test_one_file(struct display *dp, const char *filename)
|
||||
return; /* no point testing more */
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
#ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
/* Second test: write the original PNG data out to a new file (to test the
|
||||
* write side) then read the result back in and make sure that it hasn't
|
||||
* changed.
|
||||
@@ -1430,7 +1446,7 @@ test_one_file(struct display *dp, const char *filename)
|
||||
* unsigned, because some transforms are negative on a 16-bit system.
|
||||
*/
|
||||
unsigned int active = dp->active_transforms;
|
||||
const int exhaustive = (dp->options & EXHAUSTIVE) != 0;
|
||||
int exhaustive = (dp->options & EXHAUSTIVE) != 0;
|
||||
unsigned int current = first_transform(active);
|
||||
unsigned int bad_transforms = 0;
|
||||
unsigned int bad_combo = ~0U; /* bitwise AND of failing transforms */
|
||||
@@ -1450,7 +1466,7 @@ test_one_file(struct display *dp, const char *filename)
|
||||
* out and read it back in again (without the reversible transforms)
|
||||
* we should get back to the place where we started.
|
||||
*/
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
#ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
if ((current & write_transforms) == current)
|
||||
{
|
||||
/* All transforms reversible: write the PNG with the transformations
|
||||
@@ -1556,7 +1572,7 @@ do_test(struct display *dp, const char *file)
|
||||
}
|
||||
|
||||
int
|
||||
main(const int argc, const char * const * const argv)
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
/* For each file on the command line test it with a range of transforms */
|
||||
int option_end, ilog = 0;
|
||||
@@ -1658,7 +1674,7 @@ main(const int argc, const char * const * const argv)
|
||||
/* Here on any return, including failures, except user/internal issues
|
||||
*/
|
||||
{
|
||||
const int pass = (d.options & STRICT) ?
|
||||
int pass = (d.options & STRICT) ?
|
||||
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
|
||||
|
||||
if (!pass)
|
||||
@@ -1686,7 +1702,7 @@ main(const int argc, const char * const * const argv)
|
||||
return errors != 0;
|
||||
}
|
||||
}
|
||||
#else /* !INFO_IMAGE || !SEQUENTIAL_READ || !READ_PNG*/
|
||||
#else /* !READ_PNG */
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/*-
|
||||
* pngstest.c
|
||||
*
|
||||
* Copyright (c) 2013-2016 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2013-2017 John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -26,15 +25,6 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
|
||||
* a skipped test, in earlier versions we need to succeed on a skipped test, so:
|
||||
*/
|
||||
#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
|
||||
# define SKIP 77
|
||||
#else
|
||||
# define SKIP 0
|
||||
#endif
|
||||
|
||||
/* Define the following to use this test against your installed libpng, rather
|
||||
* than the one being built here:
|
||||
*/
|
||||
@@ -44,6 +34,15 @@
|
||||
# include "../../png.h"
|
||||
#endif
|
||||
|
||||
/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
|
||||
* a skipped test, in earlier versions we need to succeed on a skipped test, so:
|
||||
*/
|
||||
#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
|
||||
# define SKIP 77
|
||||
#else
|
||||
# define SKIP 0
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED /* Else nothing can be done */
|
||||
#include "../tools/sRGB.h"
|
||||
|
||||
@@ -373,7 +372,7 @@ print_opts(png_uint_32 opts)
|
||||
*/
|
||||
#define FORMAT_COUNT 64
|
||||
#define FORMAT_MASK 0x3f
|
||||
static PNG_CONST char * PNG_CONST format_names[FORMAT_COUNT] =
|
||||
static const char * const format_names[FORMAT_COUNT] =
|
||||
{
|
||||
"sRGB-gray",
|
||||
"sRGB-gray+alpha",
|
||||
@@ -579,11 +578,11 @@ typedef struct
|
||||
int stride_extra;
|
||||
FILE *input_file;
|
||||
png_voidp input_memory;
|
||||
png_size_t input_memory_size;
|
||||
size_t input_memory_size;
|
||||
png_bytep buffer;
|
||||
ptrdiff_t stride;
|
||||
png_size_t bufsize;
|
||||
png_size_t allocsize;
|
||||
size_t bufsize;
|
||||
size_t allocsize;
|
||||
char tmpfile_name[32];
|
||||
png_uint_16 colormap[256*4];
|
||||
}
|
||||
@@ -666,7 +665,7 @@ static void initimage(Image *image, png_uint_32 opts, const char *file_name,
|
||||
static void
|
||||
allocbuffer(Image *image)
|
||||
{
|
||||
png_size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
|
||||
size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
|
||||
|
||||
if (size+32 > image->bufsize)
|
||||
{
|
||||
@@ -1143,7 +1142,7 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
|
||||
}
|
||||
}
|
||||
|
||||
/* Convertion between pixel formats. The code above effectively eliminates the
|
||||
/* Conversion between pixel formats. The code above effectively eliminates the
|
||||
* component ordering changes leaving three basic changes:
|
||||
*
|
||||
* 1) Remove an alpha channel by pre-multiplication or compositing on a
|
||||
@@ -2037,7 +2036,7 @@ typedef struct
|
||||
/* Precalculated values: */
|
||||
int in_opaque; /* Value of input alpha that is opaque */
|
||||
int is_palette; /* Sample values come from the palette */
|
||||
int accumulate; /* Accumlate component errors (don't log) */
|
||||
int accumulate; /* Accumulate component errors (don't log) */
|
||||
int output_8bit; /* Output is 8-bit (else 16-bit) */
|
||||
|
||||
void (*in_gp)(Pixel*, png_const_voidp);
|
||||
@@ -2347,8 +2346,8 @@ static int
|
||||
logpixel(const Transform *transform, png_uint_32 x, png_uint_32 y,
|
||||
const Pixel *in, const Pixel *calc, const Pixel *out, const char *reason)
|
||||
{
|
||||
const png_uint_32 in_format = transform->in_image->image.format;
|
||||
const png_uint_32 out_format = transform->out_image->image.format;
|
||||
png_uint_32 in_format = transform->in_image->image.format;
|
||||
png_uint_32 out_format = transform->out_image->image.format;
|
||||
|
||||
png_uint_32 back_format = out_format & ~PNG_FORMAT_FLAG_ALPHA;
|
||||
const char *via_linear = "";
|
||||
@@ -2603,17 +2602,17 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
ptrdiff_t strideb = b->stride;
|
||||
png_const_bytep rowa = a->buffer+16;
|
||||
png_const_bytep rowb = b->buffer+16;
|
||||
const png_uint_32 width = a->image.width;
|
||||
const png_uint_32 height = a->image.height;
|
||||
const png_uint_32 formata = a->image.format;
|
||||
const png_uint_32 formatb = b->image.format;
|
||||
const unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
|
||||
const unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
|
||||
png_uint_32 width = a->image.width;
|
||||
png_uint_32 height = a->image.height;
|
||||
png_uint_32 formata = a->image.format;
|
||||
png_uint_32 formatb = b->image.format;
|
||||
unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
|
||||
unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
|
||||
int alpha_added, alpha_removed;
|
||||
int bchannels;
|
||||
int btoa[4];
|
||||
png_uint_32 y;
|
||||
Transform tr;
|
||||
int btoa[4]={0,0,0,0};
|
||||
|
||||
/* This should never happen: */
|
||||
if (width != b->image.width || height != b->image.height)
|
||||
@@ -2727,7 +2726,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
result = 0;
|
||||
}
|
||||
|
||||
/* If reqested copy the error values back from the Transform. */
|
||||
/* If requested, copy the error values back from the Transform. */
|
||||
if (a->opts & ACCUMULATE)
|
||||
{
|
||||
tr.error_ptr[0] = tr.error[0];
|
||||
@@ -2746,22 +2745,27 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
*/
|
||||
else if ((a->opts & ACCUMULATE) == 0)
|
||||
{
|
||||
# ifdef __GNUC__
|
||||
# define BYTE_CHARS 20 /* 2^32: GCC sprintf warning */
|
||||
# else
|
||||
# define BYTE_CHARS 3 /* 2^8: real maximum value */
|
||||
# endif
|
||||
/* Check the original image first,
|
||||
* TODO: deal with input images with bad pixel values?
|
||||
*/
|
||||
if (amax >= a->image.colormap_entries)
|
||||
{
|
||||
char pindex[9];
|
||||
sprintf(pindex, "%d[%lu]", amax,
|
||||
(unsigned long)a->image.colormap_entries);
|
||||
char pindex[3+2*BYTE_CHARS];
|
||||
sprintf(pindex, "%d[%u]", amax,
|
||||
(png_byte)/*SAFE*/a->image.colormap_entries);
|
||||
return logerror(a, a->file_name, ": bad pixel index: ", pindex);
|
||||
}
|
||||
|
||||
else if (bmax >= b->image.colormap_entries)
|
||||
{
|
||||
char pindex[9];
|
||||
sprintf(pindex, "%d[%lu]", bmax,
|
||||
(unsigned long)b->image.colormap_entries);
|
||||
char pindex[3+2*BYTE_CHARS];
|
||||
sprintf(pindex, "%d[%u]", bmax,
|
||||
(png_byte)/*SAFE*/b->image.colormap_entries);
|
||||
return logerror(b, b->file_name, ": bad pixel index: ", pindex);
|
||||
}
|
||||
}
|
||||
@@ -2786,8 +2790,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
(formata & (formatb ^ PNG_FORMAT_FLAG_COLOR) & PNG_FORMAT_FLAG_COLOR)))
|
||||
{
|
||||
/* Was an alpha channel changed? */
|
||||
const png_uint_32 alpha_changed = (formata ^ formatb) &
|
||||
PNG_FORMAT_FLAG_ALPHA;
|
||||
png_uint_32 alpha_changed = (formata ^ formatb) & PNG_FORMAT_FLAG_ALPHA;
|
||||
|
||||
/* Was an alpha channel removed? (The third test.) If so the direct
|
||||
* comparison is only possible if the input alpha is opaque.
|
||||
@@ -2881,10 +2884,13 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
{
|
||||
case 4:
|
||||
if (pua[btoa[3]] != pub[3]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 3:
|
||||
if (pua[btoa[2]] != pub[2]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
if (pua[btoa[1]] != pub[1]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
if (pua[btoa[0]] != pub[0]) break;
|
||||
if (alpha_added != 4 && pub[alpha_added] != 65535) break;
|
||||
@@ -2900,10 +2906,13 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
{
|
||||
case 4:
|
||||
if (psa[btoa[3]] != psb[3]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 3:
|
||||
if (psa[btoa[2]] != psb[2]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
if (psa[btoa[1]] != psb[1]) break;
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
if (psa[btoa[0]] != psb[0]) break;
|
||||
if (alpha_added != 4 && psb[alpha_added] != 255) break;
|
||||
@@ -2922,7 +2931,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
}
|
||||
}
|
||||
|
||||
/* If reqested copy the error values back from the Transform. */
|
||||
/* If requested, copy the error values back from the Transform. */
|
||||
if (a->opts & ACCUMULATE)
|
||||
{
|
||||
tr.error_ptr[0] = tr.error[0];
|
||||
@@ -3617,7 +3626,7 @@ main(int argc, char **argv)
|
||||
|
||||
if (arg[0] == '-')
|
||||
{
|
||||
const int term = (arg[1] == '0' ? 0 : '\n');
|
||||
int term = (arg[1] == '0' ? 0 : '\n');
|
||||
unsigned int ich = 0;
|
||||
|
||||
/* Loop reading files, use a static buffer to simplify this and just
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
/* pngunknown.c - test the read side unknown chunk handling
|
||||
*
|
||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
||||
* Copyright (c) 2015,2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 2015,2017 Glenn Randers-Pehrson
|
||||
* Written by John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
@@ -56,7 +56,7 @@
|
||||
defined(PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
|
||||
#if PNG_LIBPNG_VER < 10500
|
||||
/* This deliberately lacks the PNG_CONST. */
|
||||
/* This deliberately lacks the const. */
|
||||
typedef png_byte *png_const_bytep;
|
||||
|
||||
/* This is copied from 1.5.1 png.h: */
|
||||
@@ -85,7 +85,7 @@ typedef png_byte *png_const_bytep;
|
||||
#define PNG_WRITE_16BIT_SUPPORTED
|
||||
#define PNG_READ_16BIT_SUPPORTED
|
||||
|
||||
/* This comes from pnglibconf.h afer 1.5: */
|
||||
/* This comes from pnglibconf.h after 1.5: */
|
||||
#define PNG_FP_1 100000
|
||||
#define PNG_GAMMA_THRESHOLD_FIXED\
|
||||
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
||||
@@ -114,6 +114,7 @@ typedef png_byte *png_const_bytep;
|
||||
#define png_PLTE PNG_U32( 80, 76, 84, 69)
|
||||
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
||||
#define png_cHRM PNG_U32( 99, 72, 82, 77)
|
||||
#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
|
||||
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
|
||||
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
||||
#define png_gIFg PNG_U32(103, 73, 70, 103)
|
||||
@@ -210,6 +211,13 @@ static struct
|
||||
1,
|
||||
# endif
|
||||
1, START, 0 },
|
||||
{ "eXIf", PNG_INFO_eXIf, png_eXIf,
|
||||
# ifdef PNG_READ_eXIf_SUPPORTED
|
||||
0,
|
||||
# else
|
||||
1,
|
||||
# endif
|
||||
1, END, 0 },
|
||||
{ "gAMA", PNG_INFO_gAMA, png_gAMA,
|
||||
# ifdef PNG_READ_gAMA_SUPPORTED
|
||||
0,
|
||||
@@ -478,7 +486,7 @@ get_valid(display *d, png_infop info_ptr)
|
||||
png_textp text;
|
||||
png_uint_32 ntext = png_get_text(d->png_ptr, info_ptr, &text, NULL);
|
||||
|
||||
while (ntext-- > 0) switch (text[ntext].compression)
|
||||
while (ntext > 0) switch (text[--ntext].compression)
|
||||
{
|
||||
case -1:
|
||||
flags |= PNG_INFO_tEXt;
|
||||
@@ -614,7 +622,7 @@ get_unknown(display *d, png_infop info_ptr, int after_IDAT)
|
||||
++(d->error_count);
|
||||
break;
|
||||
}
|
||||
/* FALL THROUGH (safe) */
|
||||
/* FALLTHROUGH */ /* (safe) */
|
||||
case PNG_HANDLE_CHUNK_ALWAYS:
|
||||
break;
|
||||
}
|
||||
@@ -1090,7 +1098,7 @@ static const char *standard_tests[] =
|
||||
"sTER", "sTER=if-safe", 0,
|
||||
"IDAT", "default=discard", "IDAT=save", 0,
|
||||
"sAPI", "bKGD=save", "cHRM=save", "gAMA=save", "all=discard", "iCCP=save",
|
||||
"sBIT=save", "sRGB=save", 0,
|
||||
"sBIT=save", "sRGB=save", "eXIf=save", 0,
|
||||
0/*end*/
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
/* pngvalid.c - validate libpng by constructing then reading png files.
|
||||
*
|
||||
* Last changed in libpng 1.6.23 [June 9, 2016]
|
||||
* Copyright (c) 2014-2016 Glenn Randers-Pehrson
|
||||
* Written by John Cunningham Bowler
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2014-2017 John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -22,6 +21,7 @@
|
||||
#define _POSIX_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1 /* For floating point */
|
||||
#define _GNU_SOURCE 1 /* For the floating point exception extension */
|
||||
#define _BSD_SOURCE 1 /* For the floating point exception extension */
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
@@ -103,7 +103,7 @@ typedef png_byte *png_const_bytep;
|
||||
#define PNG_WRITE_16BIT_SUPPORTED
|
||||
#define PNG_READ_16BIT_SUPPORTED
|
||||
|
||||
/* This comes from pnglibconf.h afer 1.5: */
|
||||
/* This comes from pnglibconf.h after 1.5: */
|
||||
#define PNG_FP_1 100000
|
||||
#define PNG_GAMMA_THRESHOLD_FIXED\
|
||||
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
||||
@@ -712,7 +712,7 @@ typedef struct png_store_file
|
||||
unsigned int IDAT_bits; /* Number of bits in IDAT size */
|
||||
png_uint_32 IDAT_size; /* Total size of IDAT data */
|
||||
png_uint_32 id; /* must be correct (see FILEID) */
|
||||
png_size_t datacount; /* In this (the last) buffer */
|
||||
size_t datacount; /* In this (the last) buffer */
|
||||
png_store_buffer data; /* Last buffer in file */
|
||||
int npalette; /* Number of entries in palette */
|
||||
store_palette_entry* palette; /* May be NULL */
|
||||
@@ -778,10 +778,10 @@ typedef struct png_store
|
||||
png_infop piread;
|
||||
png_store_file* current; /* Set when reading */
|
||||
png_store_buffer* next; /* Set when reading */
|
||||
png_size_t readpos; /* Position in *next */
|
||||
size_t readpos; /* Position in *next */
|
||||
png_byte* image; /* Buffer for reading interlaced images */
|
||||
png_size_t cb_image; /* Size of this buffer */
|
||||
png_size_t cb_row; /* Row size of the image(s) */
|
||||
size_t cb_image; /* Size of this buffer */
|
||||
size_t cb_row; /* Row size of the image(s) */
|
||||
uLong IDAT_crc;
|
||||
png_uint_32 IDAT_len; /* Used when re-chunking IDAT chunks */
|
||||
png_uint_32 IDAT_pos; /* Used when re-chunking IDAT chunks */
|
||||
@@ -792,7 +792,7 @@ typedef struct png_store
|
||||
png_store_file* saved;
|
||||
png_structp pwrite; /* Used when writing a new file */
|
||||
png_infop piwrite;
|
||||
png_size_t writepos; /* Position in .new */
|
||||
size_t writepos; /* Position in .new */
|
||||
char wname[FILE_NAME_SIZE];
|
||||
png_store_buffer new; /* The end of the new PNG file being written. */
|
||||
store_pool write_memory_pool;
|
||||
@@ -962,7 +962,7 @@ bits_of(png_uint_32 num)
|
||||
return b; /* 0..32 */
|
||||
}
|
||||
|
||||
/* Main interface to file storeage, after writing a new PNG file (see the API
|
||||
/* Main interface to file storage, after writing a new PNG file (see the API
|
||||
* below) call store_storefile to store the result with the given name and id.
|
||||
*/
|
||||
static void
|
||||
@@ -1115,7 +1115,7 @@ store_warning(png_structp ppIn, png_const_charp message)
|
||||
if (!ps->expect_warning)
|
||||
store_log(ps, pp, message, 0 /* warning */);
|
||||
else
|
||||
ps->saw_warning = 1;
|
||||
ps->saw_warning = 1;
|
||||
}
|
||||
|
||||
/* These somewhat odd functions are used when reading an image to ensure that
|
||||
@@ -1126,7 +1126,7 @@ static png_bytep
|
||||
store_image_row(const png_store* ps, png_const_structp pp, int nImage,
|
||||
png_uint_32 y)
|
||||
{
|
||||
png_size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
|
||||
size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
|
||||
|
||||
if (ps->image == NULL)
|
||||
png_error(pp, "no allocated image");
|
||||
@@ -1161,9 +1161,9 @@ store_image_free(png_store *ps, png_const_structp pp)
|
||||
|
||||
static void
|
||||
store_ensure_image(png_store *ps, png_const_structp pp, int nImages,
|
||||
png_size_t cbRow, png_uint_32 cRows)
|
||||
size_t cbRow, png_uint_32 cRows)
|
||||
{
|
||||
png_size_t cb = nImages * cRows * (cbRow + 5);
|
||||
size_t cb = nImages * cRows * (cbRow + 5);
|
||||
|
||||
if (ps->cb_image < cb)
|
||||
{
|
||||
@@ -1235,14 +1235,14 @@ store_image_check(const png_store* ps, png_const_structp pp, int iImage)
|
||||
png_error(pp, "image overwrite");
|
||||
else
|
||||
{
|
||||
png_size_t cbRow = ps->cb_row;
|
||||
size_t cbRow = ps->cb_row;
|
||||
png_uint_32 rows = ps->image_h;
|
||||
|
||||
image += iImage * (cbRow+5) * ps->image_h;
|
||||
|
||||
image += 2; /* skip image first row markers */
|
||||
|
||||
while (rows-- > 0)
|
||||
for (; rows > 0; --rows)
|
||||
{
|
||||
if (image[-2] != 190 || image[-1] != 239)
|
||||
png_error(pp, "row start overwritten");
|
||||
@@ -1279,7 +1279,7 @@ valid_chunktype(png_uint_32 chunktype)
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
store_write(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
store_write(png_structp ppIn, png_bytep pb, size_t st)
|
||||
{
|
||||
png_const_structp pp = ppIn;
|
||||
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
||||
@@ -1347,13 +1347,13 @@ store_write(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
|
||||
else /* chunkpos >= 8 */
|
||||
{
|
||||
png_size_t cb = st;
|
||||
size_t cb = st;
|
||||
|
||||
if (cb > STORE_BUFFER_SIZE - writepos)
|
||||
cb = STORE_BUFFER_SIZE - writepos;
|
||||
|
||||
if (cb > chunklen - chunkpos/* bytes left in chunk*/)
|
||||
cb = (png_size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
cb = (size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
|
||||
memcpy(ps->new.buffer + writepos, pb, cb);
|
||||
chunkpos += (png_uint_32)/*SAFE*/cb;
|
||||
@@ -1441,7 +1441,7 @@ store_read_buffer_next(png_store *ps)
|
||||
* during progressive read, where the io_ptr is set internally by libpng.
|
||||
*/
|
||||
static void
|
||||
store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
|
||||
store_read_imp(png_store *ps, png_bytep pb, size_t st)
|
||||
{
|
||||
if (ps->current == NULL || ps->next == NULL)
|
||||
png_error(ps->pread, "store state damaged");
|
||||
@@ -1464,14 +1464,13 @@ store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
|
||||
}
|
||||
}
|
||||
|
||||
static png_size_t
|
||||
store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
const png_size_t min)
|
||||
static size_t
|
||||
store_read_chunk(png_store *ps, png_bytep pb, size_t max, size_t min)
|
||||
{
|
||||
png_uint_32 chunklen = ps->chunklen;
|
||||
png_uint_32 chunktype = ps->chunktype;
|
||||
png_uint_32 chunkpos = ps->chunkpos;
|
||||
png_size_t st = max;
|
||||
size_t st = max;
|
||||
|
||||
if (st > 0) do
|
||||
{
|
||||
@@ -1589,7 +1588,7 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
{
|
||||
if (chunkpos < chunklen-4U)
|
||||
{
|
||||
uInt avail = -1;
|
||||
uInt avail = (uInt)-1;
|
||||
|
||||
if (avail > (IDAT_len-4U) - IDAT_pos)
|
||||
avail = (uInt)/*SAFE*/((IDAT_len-4U) - IDAT_pos);
|
||||
@@ -1602,8 +1601,8 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
|
||||
store_read_imp(ps, pb, avail);
|
||||
ps->IDAT_crc = crc32(ps->IDAT_crc, pb, avail);
|
||||
pb += (png_size_t)/*SAFE*/avail;
|
||||
st -= (png_size_t)/*SAFE*/avail;
|
||||
pb += (size_t)/*SAFE*/avail;
|
||||
st -= (size_t)/*SAFE*/avail;
|
||||
chunkpos += (png_uint_32)/*SAFE*/avail;
|
||||
IDAT_size -= (png_uint_32)/*SAFE*/avail;
|
||||
IDAT_pos += (png_uint_32)/*SAFE*/avail;
|
||||
@@ -1670,10 +1669,10 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
|
||||
else /* Return chunk bytes, including the CRC */
|
||||
{
|
||||
png_size_t avail = st;
|
||||
size_t avail = st;
|
||||
|
||||
if (avail > chunklen - chunkpos)
|
||||
avail = (png_size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
avail = (size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
|
||||
store_read_imp(ps, pb, avail);
|
||||
pb += avail;
|
||||
@@ -1699,7 +1698,7 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
store_read(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
store_read(png_structp ppIn, png_bytep pb, size_t st)
|
||||
{
|
||||
png_const_structp pp = ppIn;
|
||||
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
||||
@@ -1725,7 +1724,7 @@ store_progressive_read(png_store *ps, png_structp pp, png_infop pi)
|
||||
while (store_read_buffer_avail(ps) > 0)
|
||||
{
|
||||
static png_uint_32 noise = 2;
|
||||
png_size_t cb;
|
||||
size_t cb;
|
||||
png_byte buffer[512];
|
||||
|
||||
/* Generate 15 more bits of stuff: */
|
||||
@@ -2591,7 +2590,7 @@ static double digitize(double value, int depth, int do_round)
|
||||
* rounding and 'do_round' should be 1, if it is 0 the digitized value will
|
||||
* be truncated.
|
||||
*/
|
||||
const unsigned int digitization_factor = (1U << depth) -1;
|
||||
unsigned int digitization_factor = (1U << depth) - 1;
|
||||
|
||||
/* Limiting the range is done as a convenience to the caller - it's easier to
|
||||
* do it once here than every time at the call site.
|
||||
@@ -2992,7 +2991,7 @@ modifier_setbuffer(png_modifier *pm)
|
||||
* png_struct.
|
||||
*/
|
||||
static void
|
||||
modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||
modifier_read_imp(png_modifier *pm, png_bytep pb, size_t st)
|
||||
{
|
||||
while (st > 0)
|
||||
{
|
||||
@@ -3138,7 +3137,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||
*/
|
||||
if (len+12 <= sizeof pm->buffer)
|
||||
{
|
||||
png_size_t s = len+12-pm->buffer_count;
|
||||
size_t s = len+12-pm->buffer_count;
|
||||
store_read_chunk(&pm->this, pm->buffer+pm->buffer_count, s, s);
|
||||
pm->buffer_count = len+12;
|
||||
|
||||
@@ -3197,7 +3196,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||
|
||||
/* The callback: */
|
||||
static void PNGCBAPI
|
||||
modifier_read(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
modifier_read(png_structp ppIn, png_bytep pb, size_t st)
|
||||
{
|
||||
png_const_structp pp = ppIn;
|
||||
png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp));
|
||||
@@ -3227,7 +3226,7 @@ modifier_progressive_read(png_modifier *pm, png_structp pp, png_infop pi)
|
||||
for (;;)
|
||||
{
|
||||
static png_uint_32 noise = 1;
|
||||
png_size_t cb, cbAvail;
|
||||
size_t cb, cbAvail;
|
||||
png_byte buffer[512];
|
||||
|
||||
/* Generate 15 more bits of stuff: */
|
||||
@@ -3689,8 +3688,8 @@ init_standard_palette(png_store *ps, png_structp pp, png_infop pi, int npalette,
|
||||
|
||||
#ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||
static void
|
||||
set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
|
||||
const int bit_depth)
|
||||
set_random_tRNS(png_structp pp, png_infop pi, png_byte colour_type,
|
||||
int bit_depth)
|
||||
{
|
||||
/* To make this useful the tRNS color needs to match at least one pixel.
|
||||
* Random values are fine for gray, including the 16-bit case where we know
|
||||
@@ -3698,7 +3697,7 @@ set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
|
||||
* method as only 65536 different RGB values are generated.
|
||||
*/
|
||||
png_color_16 tRNS;
|
||||
const png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
|
||||
png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
|
||||
|
||||
R8(tRNS); /* makes unset fields random */
|
||||
|
||||
@@ -4011,8 +4010,11 @@ check_interlace_type(int const interlace_type)
|
||||
# define do_own_interlace 1
|
||||
#endif /* WRITE_INTERLACING tests */
|
||||
|
||||
#define CAN_WRITE_INTERLACE\
|
||||
PNG_LIBPNG_VER >= 10700 || defined PNG_WRITE_INTERLACING_SUPPORTED
|
||||
#if PNG_LIBPNG_VER >= 10700 || defined PNG_WRITE_INTERLACING_SUPPORTED
|
||||
# define CAN_WRITE_INTERLACE 1
|
||||
#else
|
||||
# define CAN_WRITE_INTERLACE 0
|
||||
#endif
|
||||
|
||||
/* Do the same thing for read interlacing; this controls whether read tests do
|
||||
* their own de-interlace or use libpng.
|
||||
@@ -4336,7 +4338,7 @@ make_size_image(png_store* const ps, png_byte const colour_type,
|
||||
|
||||
/* Make a name and get an appropriate id for the store: */
|
||||
char name[FILE_NAME_SIZE];
|
||||
const png_uint_32 id = FILEID(colour_type, bit_depth, 0/*palette*/,
|
||||
png_uint_32 id = FILEID(colour_type, bit_depth, 0/*palette*/,
|
||||
interlace_type, w, h, do_interlace);
|
||||
|
||||
standard_name_from_id(name, sizeof name, 0, id);
|
||||
@@ -4412,7 +4414,7 @@ make_size_image(png_store* const ps, png_byte const colour_type,
|
||||
for (pass=0; pass<npasses; ++pass)
|
||||
{
|
||||
/* The following two are for checking the macros: */
|
||||
const png_uint_32 wPass = PNG_PASS_COLS(w, pass);
|
||||
png_uint_32 wPass = PNG_PASS_COLS(w, pass);
|
||||
|
||||
/* If do_interlace is set we don't call png_write_row for every
|
||||
* row because some of them are empty. In fact, for a 1x1 image,
|
||||
@@ -4644,7 +4646,7 @@ make_error(png_store* const ps, png_byte const colour_type,
|
||||
Try
|
||||
{
|
||||
png_infop pi;
|
||||
const png_structp pp = set_store_for_write(ps, &pi, name);
|
||||
png_structp pp = set_store_for_write(ps, &pi, name);
|
||||
png_uint_32 w, h;
|
||||
gnu_volatile(pp)
|
||||
|
||||
@@ -4704,7 +4706,7 @@ make_error(png_store* const ps, png_byte const colour_type,
|
||||
else
|
||||
{
|
||||
/* Now write the whole image, just to make sure that the detected, or
|
||||
* undetected, errro has not created problems inside libpng. This
|
||||
* undetected, error has not created problems inside libpng. This
|
||||
* doesn't work if there was a png_error in png_write_info because that
|
||||
* can abort before PLTE was written.
|
||||
*/
|
||||
@@ -4999,7 +5001,7 @@ standard_display_init(standard_display *dp, png_store* ps, png_uint_32 id,
|
||||
dp->npalette = 0;
|
||||
/* Preset the transparent color to black: */
|
||||
memset(&dp->transparent, 0, sizeof dp->transparent);
|
||||
/* Preset the palette to full intensity/opaque througout: */
|
||||
/* Preset the palette to full intensity/opaque throughout: */
|
||||
memset(dp->palette, 0xff, sizeof dp->palette);
|
||||
}
|
||||
|
||||
@@ -5268,7 +5270,7 @@ standard_info_part1(standard_display *dp, png_structp pp, png_infop pi)
|
||||
*/
|
||||
standard_palette_validate(dp, pp, pi);
|
||||
|
||||
/* In any case always check for a tranparent color (notice that the
|
||||
/* In any case always check for a transparent color (notice that the
|
||||
* colour type 3 case must not give a successful return on the get_tRNS call
|
||||
* with these arguments!)
|
||||
*/
|
||||
@@ -5467,14 +5469,14 @@ progressive_row(png_structp ppIn, png_bytep new_row, png_uint_32 y, int pass)
|
||||
|
||||
static void
|
||||
sequential_row(standard_display *dp, png_structp pp, png_infop pi,
|
||||
const int iImage, const int iDisplay)
|
||||
int iImage, int iDisplay)
|
||||
{
|
||||
const int npasses = dp->npasses;
|
||||
const int do_interlace = dp->do_interlace &&
|
||||
int npasses = dp->npasses;
|
||||
int do_interlace = dp->do_interlace &&
|
||||
dp->interlace_type == PNG_INTERLACE_ADAM7;
|
||||
const png_uint_32 height = standard_height(pp, dp->id);
|
||||
const png_uint_32 width = standard_width(pp, dp->id);
|
||||
const png_store* ps = dp->ps;
|
||||
png_uint_32 height = standard_height(pp, dp->id);
|
||||
png_uint_32 width = standard_width(pp, dp->id);
|
||||
const png_store* ps = dp->ps;
|
||||
int pass;
|
||||
|
||||
for (pass=0; pass<npasses; ++pass)
|
||||
@@ -5868,7 +5870,7 @@ test_size(png_modifier* const pm, png_byte const colour_type,
|
||||
*/
|
||||
static const png_byte hinc[] = {1, 3, 11, 1, 5};
|
||||
static const png_byte winc[] = {1, 9, 5, 7, 1};
|
||||
const int save_bdlo = bdlo;
|
||||
int save_bdlo = bdlo;
|
||||
|
||||
for (; bdlo <= bdhi; ++bdlo)
|
||||
{
|
||||
@@ -6076,12 +6078,12 @@ image_pixel_init(image_pixel *this, png_const_bytep row, png_byte colour_type,
|
||||
png_byte bit_depth, png_uint_32 x, store_palette palette,
|
||||
const image_pixel *format /*from pngvalid transform of input*/)
|
||||
{
|
||||
const png_byte sample_depth = (png_byte)(colour_type ==
|
||||
PNG_COLOR_TYPE_PALETTE ? 8 : bit_depth);
|
||||
const unsigned int max = (1U<<sample_depth)-1;
|
||||
const int swap16 = (format != 0 && format->swap16);
|
||||
const int littleendian = (format != 0 && format->littleendian);
|
||||
const int sig_bits = (format != 0 && format->sig_bits);
|
||||
png_byte sample_depth =
|
||||
(png_byte)(colour_type == PNG_COLOR_TYPE_PALETTE ? 8 : bit_depth);
|
||||
unsigned int max = (1U<<sample_depth)-1;
|
||||
int swap16 = (format != 0 && format->swap16);
|
||||
int littleendian = (format != 0 && format->littleendian);
|
||||
int sig_bits = (format != 0 && format->sig_bits);
|
||||
|
||||
/* Initially just set everything to the same number and the alpha to opaque.
|
||||
* Note that this currently assumes a simple palette where entry x has colour
|
||||
@@ -6099,7 +6101,7 @@ image_pixel_init(image_pixel *this, png_const_bytep row, png_byte colour_type,
|
||||
/* This permits the caller to default to the sample value. */
|
||||
if (palette != 0)
|
||||
{
|
||||
const unsigned int i = this->palette_index;
|
||||
unsigned int i = this->palette_index;
|
||||
|
||||
this->red = palette[i].red;
|
||||
this->green = palette[i].green;
|
||||
@@ -6430,8 +6432,8 @@ static void
|
||||
image_transform_mod_end(const image_transform *this, image_pixel *that,
|
||||
png_const_structp pp, const transform_display *display)
|
||||
{
|
||||
const unsigned int scale = (1U<<that->sample_depth)-1;
|
||||
const int sig_bits = that->sig_bits;
|
||||
unsigned int scale = (1U<<that->sample_depth)-1;
|
||||
int sig_bits = that->sig_bits;
|
||||
|
||||
UNUSED(this)
|
||||
UNUSED(pp)
|
||||
@@ -6582,16 +6584,16 @@ transform_info_imp(transform_display *dp, png_structp pp, png_infop pi)
|
||||
{
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
if (dp->output_bit_depth > 8) goto error;
|
||||
/*FALL THROUGH*/
|
||||
/* FALLTHROUGH */
|
||||
case PNG_COLOR_TYPE_GRAY:
|
||||
if (dp->output_bit_depth == 1 || dp->output_bit_depth == 2 ||
|
||||
dp->output_bit_depth == 4)
|
||||
break;
|
||||
/*FALL THROUGH*/
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
if (dp->output_bit_depth == 8 || dp->output_bit_depth == 16)
|
||||
break;
|
||||
/*FALL THROUGH*/
|
||||
/* FALLTHROUGH */
|
||||
error:
|
||||
{
|
||||
char message[128];
|
||||
@@ -6754,19 +6756,19 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
|
||||
{
|
||||
/* Constants for the loop below: */
|
||||
const png_store* const ps = dp->this.ps;
|
||||
const png_byte in_ct = dp->this.colour_type;
|
||||
const png_byte in_bd = dp->this.bit_depth;
|
||||
const png_uint_32 w = dp->this.w;
|
||||
const png_uint_32 h = dp->this.h;
|
||||
const png_byte out_ct = dp->output_colour_type;
|
||||
const png_byte out_bd = dp->output_bit_depth;
|
||||
const png_byte sample_depth = (png_byte)(out_ct ==
|
||||
PNG_COLOR_TYPE_PALETTE ? 8 : out_bd);
|
||||
const png_byte red_sBIT = dp->this.red_sBIT;
|
||||
const png_byte green_sBIT = dp->this.green_sBIT;
|
||||
const png_byte blue_sBIT = dp->this.blue_sBIT;
|
||||
const png_byte alpha_sBIT = dp->this.alpha_sBIT;
|
||||
const int have_tRNS = dp->this.is_transparent;
|
||||
png_byte in_ct = dp->this.colour_type;
|
||||
png_byte in_bd = dp->this.bit_depth;
|
||||
png_uint_32 w = dp->this.w;
|
||||
png_uint_32 h = dp->this.h;
|
||||
png_byte out_ct = dp->output_colour_type;
|
||||
png_byte out_bd = dp->output_bit_depth;
|
||||
png_byte sample_depth =
|
||||
(png_byte)(out_ct == PNG_COLOR_TYPE_PALETTE ? 8 : out_bd);
|
||||
png_byte red_sBIT = dp->this.red_sBIT;
|
||||
png_byte green_sBIT = dp->this.green_sBIT;
|
||||
png_byte blue_sBIT = dp->this.blue_sBIT;
|
||||
png_byte alpha_sBIT = dp->this.alpha_sBIT;
|
||||
int have_tRNS = dp->this.is_transparent;
|
||||
double digitization_error;
|
||||
|
||||
store_palette out_palette;
|
||||
@@ -6778,7 +6780,7 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
|
||||
store_image_check(dp->this.ps, pp, 0);
|
||||
|
||||
/* Read the palette corresponding to the output if the output colour type
|
||||
* indicates a palette, othewise set out_palette to garbage.
|
||||
* indicates a palette, otherwise set out_palette to garbage.
|
||||
*/
|
||||
if (out_ct == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
@@ -6927,7 +6929,7 @@ transform_end(png_structp ppIn, png_infop pi)
|
||||
|
||||
/* A single test run. */
|
||||
static void
|
||||
transform_test(png_modifier *pmIn, const png_uint_32 idIn,
|
||||
transform_test(png_modifier *pmIn, png_uint_32 idIn,
|
||||
const image_transform* transform_listIn, const char * const name)
|
||||
{
|
||||
transform_display d;
|
||||
@@ -7740,13 +7742,11 @@ image_transform_png_set_rgb_to_gray_ini(const image_transform *this,
|
||||
* NOTE: this number only affects the internal limit check in pngvalid,
|
||||
* it has no effect on the limits applied to the libpng values.
|
||||
*/
|
||||
that->pm->limit += pow(
|
||||
# if DIGITIZE
|
||||
2.0
|
||||
# else
|
||||
1.0
|
||||
# endif
|
||||
/255, data.gamma);
|
||||
#if DIGITIZE
|
||||
that->pm->limit += pow( 2.0/255, data.gamma);
|
||||
#else
|
||||
that->pm->limit += pow( 1.0/255, data.gamma);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7764,7 +7764,7 @@ static void
|
||||
image_transform_png_set_rgb_to_gray_set(const image_transform *this,
|
||||
transform_display *that, png_structp pp, png_infop pi)
|
||||
{
|
||||
const int error_action = 1; /* no error, no defines in png.h */
|
||||
int error_action = 1; /* no error, no defines in png.h */
|
||||
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
png_set_rgb_to_gray(pp, error_action, data.red_to_set, data.green_to_set);
|
||||
@@ -7905,10 +7905,10 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
# if DIGITIZE
|
||||
{
|
||||
png_modifier *pm = display->pm;
|
||||
const unsigned int sample_depth = that->sample_depth;
|
||||
const unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
|
||||
unsigned int sample_depth = that->sample_depth;
|
||||
unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
|
||||
sample_depth);
|
||||
const unsigned int gamma_depth =
|
||||
unsigned int gamma_depth =
|
||||
(sample_depth == 16 ?
|
||||
display->max_gamma_8 :
|
||||
(pm->assume_16_bit_calculations ?
|
||||
@@ -7991,7 +7991,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
/* Now calculate the actual gray values. Although the error in the
|
||||
* coefficients depends on whether they were specified on the command
|
||||
* line (in which case truncation to 15 bits happened) or not (rounding
|
||||
* was used) the maxium error in an individual coefficient is always
|
||||
* was used) the maximum error in an individual coefficient is always
|
||||
* 2/32768, because even in the rounding case the requirement that
|
||||
* coefficients add up to 32768 can cause a larger rounding error.
|
||||
*
|
||||
@@ -8002,7 +8002,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
b * data.blue_coefficient;
|
||||
|
||||
{
|
||||
const int do_round = data.gamma != 1 || calc_depth == 16;
|
||||
int do_round = data.gamma != 1 || calc_depth == 16;
|
||||
const double ce = 2. / 32768;
|
||||
|
||||
graylo = DD(rlo * (data.red_coefficient-ce) +
|
||||
@@ -8207,7 +8207,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
that->bluef = that->greenf = that->redf = gray;
|
||||
that->bluee = that->greene = that->rede = err;
|
||||
|
||||
/* The sBIT is the minium of the three colour channel sBITs. */
|
||||
/* The sBIT is the minimum of the three colour channel sBITs. */
|
||||
if (that->red_sBIT > that->green_sBIT)
|
||||
that->red_sBIT = that->green_sBIT;
|
||||
if (that->red_sBIT > that->blue_sBIT)
|
||||
@@ -8626,7 +8626,7 @@ image_transform_png_set_filler_mod(const image_transform *this,
|
||||
(that->colour_type == PNG_COLOR_TYPE_RGB ||
|
||||
that->colour_type == PNG_COLOR_TYPE_GRAY))
|
||||
{
|
||||
const unsigned int max = (1U << that->bit_depth)-1;
|
||||
unsigned int max = (1U << that->bit_depth)-1;
|
||||
that->alpha = data.filler & max;
|
||||
that->alphaf = ((double)that->alpha) / max;
|
||||
that->alphae = 0;
|
||||
@@ -8693,7 +8693,7 @@ image_transform_png_set_add_alpha_mod(const image_transform *this,
|
||||
(that->colour_type == PNG_COLOR_TYPE_RGB ||
|
||||
that->colour_type == PNG_COLOR_TYPE_GRAY))
|
||||
{
|
||||
const unsigned int max = (1U << that->bit_depth)-1;
|
||||
unsigned int max = (1U << that->bit_depth)-1;
|
||||
that->alpha = data.filler & max;
|
||||
that->alphaf = ((double)that->alpha) / max;
|
||||
that->alphae = 0;
|
||||
@@ -8884,7 +8884,7 @@ image_transform_png_set_shift_set(const image_transform *this,
|
||||
* field is randomized independently. This acts as a check that
|
||||
* libpng does use the correct field.
|
||||
*/
|
||||
const unsigned int depth = that->this.bit_depth;
|
||||
unsigned int depth = that->this.bit_depth;
|
||||
|
||||
data.red = (png_byte)/*SAFE*/(random_mod(depth)+1);
|
||||
data.green = (png_byte)/*SAFE*/(random_mod(depth)+1);
|
||||
@@ -9299,12 +9299,12 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
|
||||
int mode = dp->do_background - ALPHA_MODE_OFFSET;
|
||||
|
||||
/* The gamma value is the output gamma, and is in the standard,
|
||||
* non-inverted, represenation. It provides a default for the PNG file
|
||||
* non-inverted, representation. It provides a default for the PNG file
|
||||
* gamma, but since the file has a gAMA chunk this does not matter.
|
||||
*/
|
||||
const double sg = dp->screen_gamma;
|
||||
# ifndef PNG_FLOATING_POINT_SUPPORTED
|
||||
const png_fixed_point g = fix(sg);
|
||||
png_fixed_point g = fix(sg);
|
||||
# endif
|
||||
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
@@ -9352,7 +9352,7 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
|
||||
*/
|
||||
const double bg = dp->background_gamma;
|
||||
# ifndef PNG_FLOATING_POINT_SUPPORTED
|
||||
const png_fixed_point g = fix(bg);
|
||||
png_fixed_point g = fix(bg);
|
||||
# endif
|
||||
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
@@ -9426,7 +9426,7 @@ static void
|
||||
init_validate_info(validate_info *vi, gamma_display *dp, png_const_structp pp,
|
||||
int in_depth, int out_depth)
|
||||
{
|
||||
const unsigned int outmax = (1U<<out_depth)-1;
|
||||
unsigned int outmax = (1U<<out_depth)-1;
|
||||
|
||||
vi->pp = pp;
|
||||
vi->dp = dp;
|
||||
@@ -9588,14 +9588,14 @@ gamma_component_compose(int do_background, double input_sample, double alpha,
|
||||
/* This API returns the encoded *input* component, in the range 0..1 */
|
||||
static double
|
||||
gamma_component_validate(const char *name, const validate_info *vi,
|
||||
const unsigned int id, const unsigned int od,
|
||||
unsigned int id, unsigned int od,
|
||||
const double alpha /* <0 for the alpha channel itself */,
|
||||
const double background /* component background value */)
|
||||
{
|
||||
const unsigned int isbit = id >> vi->isbit_shift;
|
||||
const unsigned int sbit_max = vi->sbit_max;
|
||||
const unsigned int outmax = vi->outmax;
|
||||
const int do_background = vi->do_background;
|
||||
unsigned int isbit = id >> vi->isbit_shift;
|
||||
unsigned int sbit_max = vi->sbit_max;
|
||||
unsigned int outmax = vi->outmax;
|
||||
int do_background = vi->do_background;
|
||||
|
||||
double i;
|
||||
|
||||
@@ -9746,7 +9746,7 @@ gamma_component_validate(const char *name, const validate_info *vi,
|
||||
*
|
||||
* pngvalid calculations:
|
||||
* input_sample: linear result; i linearized and composed, range 0..1
|
||||
* encoded_sample: encoded result; input_sample scaled to ouput bit depth
|
||||
* encoded_sample: encoded result; input_sample scaled to output bit depth
|
||||
*
|
||||
* libpng calculations:
|
||||
* output: linear result; od scaled to 0..1 and linearized
|
||||
@@ -9994,9 +9994,9 @@ gamma_component_validate(const char *name, const validate_info *vi,
|
||||
case PNG_BACKGROUND_GAMMA_FILE:
|
||||
case PNG_BACKGROUND_GAMMA_UNIQUE:
|
||||
use_background = (alpha >= 0 && alpha < 1);
|
||||
/*FALL THROUGH*/
|
||||
# endif
|
||||
# ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
/* FALLTHROUGH */
|
||||
case ALPHA_MODE_OFFSET + PNG_ALPHA_STANDARD:
|
||||
case ALPHA_MODE_OFFSET + PNG_ALPHA_BROKEN:
|
||||
case ALPHA_MODE_OFFSET + PNG_ALPHA_OPTIMIZED:
|
||||
@@ -10161,13 +10161,13 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
{
|
||||
/* Get some constants derived from the input and output file formats: */
|
||||
const png_store* const ps = dp->this.ps;
|
||||
const png_byte in_ct = dp->this.colour_type;
|
||||
const png_byte in_bd = dp->this.bit_depth;
|
||||
const png_uint_32 w = dp->this.w;
|
||||
const png_uint_32 h = dp->this.h;
|
||||
png_byte in_ct = dp->this.colour_type;
|
||||
png_byte in_bd = dp->this.bit_depth;
|
||||
png_uint_32 w = dp->this.w;
|
||||
png_uint_32 h = dp->this.h;
|
||||
const size_t cbRow = dp->this.cbRow;
|
||||
const png_byte out_ct = png_get_color_type(pp, pi);
|
||||
const png_byte out_bd = png_get_bit_depth(pp, pi);
|
||||
png_byte out_ct = png_get_color_type(pp, pi);
|
||||
png_byte out_bd = png_get_bit_depth(pp, pi);
|
||||
|
||||
/* There are three sources of error, firstly the quantization in the
|
||||
* file encoding, determined by sbit and/or the file depth, secondly
|
||||
@@ -10183,10 +10183,10 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
* Since the library must quantize the output to 8 or 16 bits there is
|
||||
* a fundamental limit on the accuracy of the output of +/-.5 - this
|
||||
* quantization limit is included in addition to the other limits
|
||||
* specified by the paramaters to the API. (Effectively, add .5
|
||||
* specified by the parameters to the API. (Effectively, add .5
|
||||
* everywhere.)
|
||||
*
|
||||
* The behavior of the 'sbit' paramter is defined by section 12.5
|
||||
* The behavior of the 'sbit' parameter is defined by section 12.5
|
||||
* (sample depth scaling) of the PNG spec. That section forces the
|
||||
* decoder to assume that the PNG values have been scaled if sBIT is
|
||||
* present:
|
||||
@@ -10208,11 +10208,11 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
* The basic tests below do not do this, however if 'use_input_precision'
|
||||
* is set a subsequent test is performed above.
|
||||
*/
|
||||
const unsigned int samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
|
||||
unsigned int samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
|
||||
int processing;
|
||||
png_uint_32 y;
|
||||
const store_palette_entry *in_palette = dp->this.palette;
|
||||
const int in_is_transparent = dp->this.is_transparent;
|
||||
int in_is_transparent = dp->this.is_transparent;
|
||||
int process_tRNS;
|
||||
int out_npalette = -1;
|
||||
int out_is_transparent = 0; /* Just refers to the palette case */
|
||||
@@ -10260,9 +10260,9 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
double alpha = 1; /* serves as a flag value */
|
||||
|
||||
/* Record the palette index for index images. */
|
||||
const unsigned int in_index =
|
||||
unsigned int in_index =
|
||||
in_ct == 3 ? sample(std, 3, in_bd, x, 0, 0, 0) : 256;
|
||||
const unsigned int out_index =
|
||||
unsigned int out_index =
|
||||
out_ct == 3 ? sample(std, 3, out_bd, x, 0, 0, 0) : 256;
|
||||
|
||||
/* Handle input alpha - png_set_background will cause the output
|
||||
@@ -10271,7 +10271,7 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
if ((in_ct & PNG_COLOR_MASK_ALPHA) != 0 ||
|
||||
(in_ct == 3 && in_is_transparent))
|
||||
{
|
||||
const unsigned int input_alpha = in_ct == 3 ?
|
||||
unsigned int input_alpha = in_ct == 3 ?
|
||||
dp->this.palette[in_index].alpha :
|
||||
sample(std, in_ct, in_bd, x, samples_per_pixel, 0, 0);
|
||||
|
||||
@@ -10396,14 +10396,14 @@ gamma_end(png_structp ppIn, png_infop pi)
|
||||
* maxpc: maximum percentage error (as a percentage)
|
||||
*/
|
||||
static void
|
||||
gamma_test(png_modifier *pmIn, const png_byte colour_typeIn,
|
||||
const png_byte bit_depthIn, const int palette_numberIn,
|
||||
const int interlace_typeIn,
|
||||
gamma_test(png_modifier *pmIn, png_byte colour_typeIn,
|
||||
png_byte bit_depthIn, int palette_numberIn,
|
||||
int interlace_typeIn,
|
||||
const double file_gammaIn, const double screen_gammaIn,
|
||||
const png_byte sbitIn, const int threshold_testIn,
|
||||
png_byte sbitIn, int threshold_testIn,
|
||||
const char *name,
|
||||
const int use_input_precisionIn, const int scale16In,
|
||||
const int expand16In, const int do_backgroundIn,
|
||||
int use_input_precisionIn, int scale16In,
|
||||
int expand16In, int do_backgroundIn,
|
||||
const png_color_16 *bkgd_colorIn, double bkgd_gammaIn)
|
||||
{
|
||||
gamma_display d;
|
||||
@@ -10607,11 +10607,11 @@ perform_gamma_threshold_tests(png_modifier *pm)
|
||||
}
|
||||
|
||||
static void gamma_transform_test(png_modifier *pm,
|
||||
const png_byte colour_type, const png_byte bit_depth,
|
||||
const int palette_number,
|
||||
const int interlace_type, const double file_gamma,
|
||||
const double screen_gamma, const png_byte sbit,
|
||||
const int use_input_precision, const int scale16)
|
||||
png_byte colour_type, png_byte bit_depth,
|
||||
int palette_number,
|
||||
int interlace_type, const double file_gamma,
|
||||
const double screen_gamma, png_byte sbit,
|
||||
int use_input_precision, int scale16)
|
||||
{
|
||||
size_t pos = 0;
|
||||
char name[64];
|
||||
@@ -10768,12 +10768,12 @@ static void perform_gamma_scale16_tests(png_modifier *pm)
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
static void gamma_composition_test(png_modifier *pm,
|
||||
const png_byte colour_type, const png_byte bit_depth,
|
||||
const int palette_number,
|
||||
const int interlace_type, const double file_gamma,
|
||||
png_byte colour_type, png_byte bit_depth,
|
||||
int palette_number,
|
||||
int interlace_type, const double file_gamma,
|
||||
const double screen_gamma,
|
||||
const int use_input_precision, const int do_background,
|
||||
const int expand_16)
|
||||
int use_input_precision, int do_background,
|
||||
int expand_16)
|
||||
{
|
||||
size_t pos = 0;
|
||||
png_const_charp base;
|
||||
@@ -11427,23 +11427,36 @@ perform_interlace_macro_validation(void)
|
||||
*/
|
||||
for (v=0;;)
|
||||
{
|
||||
/* The first two tests overflow if the pass row or column is outside
|
||||
* the possible range for a 32-bit result. In fact the values should
|
||||
* never be outside the range for a 31-bit result, but checking for 32
|
||||
* bits here ensures that if an app uses a bogus pass row or column
|
||||
* (just so long as it fits in a 32 bit integer) it won't get a
|
||||
* possibly dangerous overflow.
|
||||
*/
|
||||
/* First the base 0 stuff: */
|
||||
m = PNG_ROW_FROM_PASS_ROW(v, pass);
|
||||
f = png_row_from_pass_row(v, pass);
|
||||
if (m != f)
|
||||
if (v < png_pass_rows(0xFFFFFFFFU, pass))
|
||||
{
|
||||
fprintf(stderr, "PNG_ROW_FROM_PASS_ROW(%u, %d) = %u != %x\n",
|
||||
v, pass, m, f);
|
||||
exit(99);
|
||||
m = PNG_ROW_FROM_PASS_ROW(v, pass);
|
||||
f = png_row_from_pass_row(v, pass);
|
||||
if (m != f)
|
||||
{
|
||||
fprintf(stderr, "PNG_ROW_FROM_PASS_ROW(%u, %d) = %u != %x\n",
|
||||
v, pass, m, f);
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
|
||||
m = PNG_COL_FROM_PASS_COL(v, pass);
|
||||
f = png_col_from_pass_col(v, pass);
|
||||
if (m != f)
|
||||
if (v < png_pass_cols(0xFFFFFFFFU, pass))
|
||||
{
|
||||
fprintf(stderr, "PNG_COL_FROM_PASS_COL(%u, %d) = %u != %x\n",
|
||||
v, pass, m, f);
|
||||
exit(99);
|
||||
m = PNG_COL_FROM_PASS_COL(v, pass);
|
||||
f = png_col_from_pass_col(v, pass);
|
||||
if (m != f)
|
||||
{
|
||||
fprintf(stderr, "PNG_COL_FROM_PASS_COL(%u, %d) = %u != %x\n",
|
||||
v, pass, m, f);
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
|
||||
m = PNG_ROW_IN_INTERLACE_PASS(v, pass);
|
||||
@@ -11716,7 +11729,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Some default values (set the behavior for 'make check' here).
|
||||
* These values simply control the maximum error permitted in the gamma
|
||||
* transformations. The practial limits for human perception are described
|
||||
* transformations. The practical limits for human perception are described
|
||||
* below (the setting for maxpc16), however for 8 bit encodings it isn't
|
||||
* possible to meet the accepted capabilities of human vision - i.e. 8 bit
|
||||
* images can never be good enough, regardless of encoding.
|
||||
|
||||
@@ -60,7 +60,7 @@ read_png(FILE *fp)
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
{
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
/* Failure to initialize these is harmless */
|
||||
row = malloc(rowbytes);
|
||||
|
||||
@@ -108,7 +108,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
|
||||
do
|
||||
{
|
||||
png_size_t index;
|
||||
size_t index;
|
||||
int state, failed = 0;
|
||||
char buffer[64];
|
||||
|
||||
@@ -176,7 +176,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
}
|
||||
else if (PNG_FP_IS_POSITIVE(state) && !(test > 0))
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s' but postive value not so reported\n",
|
||||
fprintf(stderr, "%g[%d] -> '%s' but positive value not so reported\n",
|
||||
test, precision, buffer);
|
||||
failed = 1;
|
||||
assert(!PNG_FP_IS_NEGATIVE(state));
|
||||
@@ -329,10 +329,10 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
|
||||
{
|
||||
/* Test this character (ch) to ensure the parser does the correct thing.
|
||||
*/
|
||||
png_size_t index = 0;
|
||||
size_t index = 0;
|
||||
const char test = (char)ch;
|
||||
const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
||||
const int character_accepted = (index == 1);
|
||||
int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
||||
int character_accepted = (index == 1);
|
||||
|
||||
if (c.check_state != exponent && isdigit(ch) && ch != '0')
|
||||
c.is_zero = 0;
|
||||
|
||||
@@ -65,7 +65,7 @@ typedef struct
|
||||
} io_data;
|
||||
|
||||
static PNG_CALLBACK(void, read_and_copy,
|
||||
(png_structp png_ptr, png_bytep buffer, png_size_t cb))
|
||||
(png_structp png_ptr, png_bytep buffer, size_t cb))
|
||||
{
|
||||
io_data *io = (io_data*)png_get_io_ptr(png_ptr);
|
||||
|
||||
@@ -100,7 +100,7 @@ static void read_by_row(png_structp png_ptr, png_infop info_ptr,
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
{
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
row = voidcast(png_bytep,malloc(rowbytes));
|
||||
display = voidcast(png_bytep,malloc(rowbytes));
|
||||
|
||||
83
contrib/mips-msa/README
Normal file
@@ -0,0 +1,83 @@
|
||||
OPERATING SYSTEM SPECIFIC MIPS MSA DETECTION
|
||||
--------------------------------------------
|
||||
|
||||
Detection of the ability to execute MIPS MSA on an MIPS processor requires
|
||||
operating system support. (The information is not available in user mode.)
|
||||
|
||||
HOW TO USE THIS
|
||||
---------------
|
||||
|
||||
This directory contains C code fragments that can be included in mips/mips_init.c
|
||||
by setting the macro PNG_MIPS_MSA_FILE to the file name in "" or <> at build
|
||||
time. This setting is not recorded in pnglibconf.h and can be changed simply by
|
||||
rebuilding mips/msa_init.o with the required macro definition.
|
||||
|
||||
For any of this code to be used the MIPS MSA code must be enabled and run time
|
||||
checks must be supported. I.e.:
|
||||
|
||||
#if PNG_MIPS_MSA_OPT > 0
|
||||
#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED
|
||||
|
||||
This is done in a 'configure' build by passing configure the argument:
|
||||
|
||||
--enable-mips-msa=check
|
||||
|
||||
Apart from the basic Linux implementation in contrib/mips-msa/linux.c this code
|
||||
is unsupported. That means that it is not even compiled on a regular basis and
|
||||
may be broken in any given minor release.
|
||||
|
||||
FILE FORMAT
|
||||
-----------
|
||||
|
||||
Each file documents its testing status as of the last time it was tested (which
|
||||
may have been a long time ago):
|
||||
|
||||
STATUS: one of:
|
||||
SUPPORTED: This indicates that the file is included in the regularly
|
||||
performed test builds and bugs are fixed when discovered.
|
||||
COMPILED: This indicates that the code did compile at least once. See the
|
||||
more detailed description for the extent to which the result was
|
||||
successful.
|
||||
TESTED: This means the code was fully compiled into the libpng test programs
|
||||
and these were run at least once.
|
||||
|
||||
BUG REPORTS: an email address to which to send reports of problems
|
||||
|
||||
The file is a fragment of C code. It should not define any 'extern' symbols;
|
||||
everything should be static. It must define the function:
|
||||
|
||||
static int png_have_msa(png_structp png_ptr);
|
||||
|
||||
That function must return 1 if MIPS MSA instructions are supported, 0 if not.
|
||||
It must not execute png_error unless it detects a bug. A png_error will prevent
|
||||
the reading of the PNG and in the future, writing too.
|
||||
|
||||
BUG REPORTS
|
||||
-----------
|
||||
|
||||
If you mail a bug report for any file that is not SUPPORTED there may only be
|
||||
limited response. Consider fixing it and sending a patch to fix the problem -
|
||||
this is more likely to result in action.
|
||||
|
||||
CONTRIBUTIONS
|
||||
-------------
|
||||
|
||||
You may send contributions of new implementations to
|
||||
png-mng-implement@sourceforge.net. Please write code in strict C90 C where
|
||||
possible. Obviously OS dependencies are to be expected. If you submit code you
|
||||
must have the authors permission and it must have a license that is acceptable
|
||||
to the current maintainer; in particular that license must permit modification
|
||||
and redistribution.
|
||||
|
||||
Please try to make the contribution a single file and give the file a clear and
|
||||
unambiguous name that identifies the target OS. If multiple files really are
|
||||
required put them all in a sub-directory.
|
||||
|
||||
You must also be prepared to handle bug reports from users of the code, either
|
||||
by joining the png-mng-implement mailing list or by providing an email for the
|
||||
"BUG REPORTS" entry or both. Please make sure that the header of the file
|
||||
contains the STATUS and BUG REPORTS fields as above.
|
||||
|
||||
Please list the OS requirements as precisely as possible. Ideally you should
|
||||
also list the environment in which the code has been tested and certainly list
|
||||
any environments where you suspect it might not work.
|
||||
64
contrib/mips-msa/linux.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/* contrib/mips-msa/linux.c
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Randers-Pehrson
|
||||
* Written by Mandar Sahastrabuddhe, 2016.
|
||||
* Last changed in libpng 1.6.25beta03 [August 29, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
* SEE contrib/mips-msa/README before reporting bugs
|
||||
*
|
||||
* STATUS: SUPPORTED
|
||||
* BUG REPORTS: png-mng-implement@sourceforge.net
|
||||
*
|
||||
* png_have_msa implemented for Linux by reading the widely available
|
||||
* pseudo-file /proc/cpuinfo.
|
||||
*
|
||||
* This code is strict ANSI-C and is probably moderately portable; it does
|
||||
* however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int
|
||||
png_have_msa(png_structp png_ptr)
|
||||
{
|
||||
FILE *f = fopen("/proc/cpuinfo", "rb");
|
||||
|
||||
char *string = "msa";
|
||||
char word[10];
|
||||
|
||||
if (f != NULL)
|
||||
{
|
||||
while(!feof(f))
|
||||
{
|
||||
int ch = fgetc(f);
|
||||
static int i = 0;
|
||||
|
||||
while(!(ch <= 32))
|
||||
{
|
||||
word[i++] = ch;
|
||||
ch = fgetc(f);
|
||||
}
|
||||
|
||||
int val = strcmp(string, word);
|
||||
|
||||
if (val == 0)
|
||||
return 1;
|
||||
|
||||
i = 0;
|
||||
memset(word, 0, 10);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
else
|
||||
png_warning(png_ptr, "/proc/cpuinfo open failed");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
25
contrib/oss-fuzz/Dockerfile
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright 2016 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
FROM gcr.io/oss-fuzz-base/base-builder
|
||||
MAINTAINER glennrp@gmail.com
|
||||
RUN apt-get update && \
|
||||
apt-get install -y make autoconf automake libtool
|
||||
|
||||
RUN git clone --depth 1 https://github.com/madler/zlib.git
|
||||
RUN git clone --depth 1 https://github.com/glennrp/libpng.git
|
||||
RUN cp libpng/contrib/oss-fuzz/build.sh $SRC
|
||||
WORKDIR libpng
|
||||
37
contrib/oss-fuzz/README.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
Copyright (c) 2017 Glenn Randers-Pehrson
|
||||
|
||||
This code is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
and license in png.h
|
||||
|
||||
Files in this directory are used by the oss-fuzz project
|
||||
(https://github.com/google/oss-fuzz/tree/master/projects/libpng).
|
||||
for "fuzzing" libpng.
|
||||
|
||||
They were licensed by Google Inc, using the BSD-like Chromium license,
|
||||
which may be found at https://cs.chromium.org/chromium/src/LICENSE, or, if
|
||||
noted in the source, under the Apache-2.0 license, which may
|
||||
be found at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
If they have been modified, the derivatives are copyright Glenn Randers-Pehrson
|
||||
and are released under the same licenses as the originals. Several of
|
||||
the original files (libpng_read_fuzzer.options, png.dict, project.yaml)
|
||||
had no licensing information; we assumed that these were under the Chromium
|
||||
license. Any new files are released under the libpng license (see png.h).
|
||||
|
||||
The files are
|
||||
Original
|
||||
Filename or derived Copyright License
|
||||
========================= ========== ================ ==========
|
||||
Dockerfile* derived 2017, Glenn R-P Apache 2.0
|
||||
build.sh derived 2017, Glenn R-P Apache 2.0
|
||||
libpng_read_fuzzer.cc derived 2017, Glenn R-P Chromium
|
||||
libpng_read_fuzzer.options original 2015, Chrome Devs Chromium
|
||||
png.dict original 2015, Chrome Devs Chromium
|
||||
README.txt (this file) original 2017, Glenn R-P libpng
|
||||
|
||||
* Dockerfile is a copy of the file used by oss-fuzz. build.sh,
|
||||
png.dict and libpng_read_fuzzer.* are the actual files used by oss-fuzz,
|
||||
which retrieves them from the libpng repository at Github.
|
||||
|
||||
To do: exercise the progressive reader and the png encoder.
|
||||
51
contrib/oss-fuzz/build.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash -eu
|
||||
# Copyright 2017-2018 Glenn Randers-Pehrson
|
||||
# Copyright 2016 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
#
|
||||
# Revisions by Glenn Randers-Pehrson, 2017:
|
||||
# 1. Build only the library, not the tools (changed "make -j$(nproc) all" to
|
||||
# "make -j$(nproc) libpng16.la").
|
||||
# 2. Disabled WARNING and WRITE options in pnglibconf.dfa.
|
||||
# 3. Build zlib alongside libpng
|
||||
################################################################################
|
||||
|
||||
# Disable logging via library build configuration control.
|
||||
cat scripts/pnglibconf.dfa | \
|
||||
sed -e "s/option STDIO/option STDIO disabled/" \
|
||||
-e "s/option WARNING /option WARNING disabled/" \
|
||||
-e "s/option WRITE enables WRITE_INT_FUNCTIONS/option WRITE disabled/" \
|
||||
> scripts/pnglibconf.dfa.temp
|
||||
mv scripts/pnglibconf.dfa.temp scripts/pnglibconf.dfa
|
||||
|
||||
# build the libpng library.
|
||||
autoreconf -f -i
|
||||
./configure --with-libpng-prefix=OSS_FUZZ_
|
||||
make -j$(nproc) clean
|
||||
make -j$(nproc) libpng16.la
|
||||
|
||||
# build libpng_read_fuzzer.
|
||||
$CXX $CXXFLAGS -std=c++11 -I. \
|
||||
$SRC/libpng/contrib/oss-fuzz/libpng_read_fuzzer.cc \
|
||||
-o $OUT/libpng_read_fuzzer \
|
||||
-lFuzzingEngine .libs/libpng16.a -lz
|
||||
|
||||
# add seed corpus.
|
||||
find $SRC/libpng -name "*.png" | grep -v crashers | \
|
||||
xargs zip $OUT/libpng_read_fuzzer_seed_corpus.zip
|
||||
|
||||
cp $SRC/libpng/contrib/oss-fuzz/*.dict \
|
||||
$SRC/libpng/contrib/oss-fuzz/*.options $OUT/
|
||||
190
contrib/oss-fuzz/libpng_read_fuzzer.cc
Normal file
@@ -0,0 +1,190 @@
|
||||
|
||||
// libpng_read_fuzzer.cc
|
||||
// Copyright 2017-2018 Glenn Randers-Pehrson
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that may
|
||||
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
|
||||
|
||||
// Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
|
||||
// The modifications in 2017 by Glenn Randers-Pehrson include
|
||||
// 1. addition of a PNG_CLEANUP macro,
|
||||
// 2. setting the option to ignore ADLER32 checksums,
|
||||
// 3. adding "#include <string.h>" which is needed on some platforms
|
||||
// to provide memcpy().
|
||||
// 4. adding read_end_info() and creating an end_info structure.
|
||||
// 5. adding calls to png_set_*() transforms commonly used by browsers.
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
#define PNG_CLEANUP \
|
||||
if(png_handler.png_ptr) \
|
||||
{ \
|
||||
if (png_handler.row_ptr) \
|
||||
png_free(png_handler.png_ptr, png_handler.row_ptr); \
|
||||
if (png_handler.end_info_ptr) \
|
||||
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr,\
|
||||
&png_handler.end_info_ptr); \
|
||||
else if (png_handler.info_ptr) \
|
||||
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr,\
|
||||
nullptr); \
|
||||
else \
|
||||
png_destroy_read_struct(&png_handler.png_ptr, nullptr, nullptr); \
|
||||
png_handler.png_ptr = nullptr; \
|
||||
png_handler.row_ptr = nullptr; \
|
||||
png_handler.info_ptr = nullptr; \
|
||||
png_handler.end_info_ptr = nullptr; \
|
||||
}
|
||||
|
||||
struct BufState {
|
||||
const uint8_t* data;
|
||||
size_t bytes_left;
|
||||
};
|
||||
|
||||
struct PngObjectHandler {
|
||||
png_infop info_ptr = nullptr;
|
||||
png_structp png_ptr = nullptr;
|
||||
png_infop end_info_ptr = nullptr;
|
||||
png_voidp row_ptr = nullptr;
|
||||
BufState* buf_state = nullptr;
|
||||
|
||||
~PngObjectHandler() {
|
||||
if (row_ptr)
|
||||
png_free(png_ptr, row_ptr);
|
||||
if (end_info_ptr)
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info_ptr);
|
||||
else if (info_ptr)
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||
else
|
||||
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
|
||||
delete buf_state;
|
||||
}
|
||||
};
|
||||
|
||||
void user_read_data(png_structp png_ptr, png_bytep data, size_t length) {
|
||||
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
|
||||
if (length > buf_state->bytes_left) {
|
||||
png_error(png_ptr, "read error");
|
||||
}
|
||||
memcpy(data, buf_state->data, length);
|
||||
buf_state->bytes_left -= length;
|
||||
buf_state->data += length;
|
||||
}
|
||||
|
||||
static const int kPngHeaderSize = 8;
|
||||
|
||||
// Entry point for LibFuzzer.
|
||||
// Roughly follows the libpng book example:
|
||||
// http://www.libpng.org/pub/png/book/chapter13.html
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
if (size < kPngHeaderSize) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> v(data, data + size);
|
||||
if (png_sig_cmp(v.data(), 0, kPngHeaderSize)) {
|
||||
// not a PNG.
|
||||
return 0;
|
||||
}
|
||||
|
||||
PngObjectHandler png_handler;
|
||||
png_handler.png_ptr = nullptr;
|
||||
png_handler.row_ptr = nullptr;
|
||||
png_handler.info_ptr = nullptr;
|
||||
png_handler.end_info_ptr = nullptr;
|
||||
|
||||
png_handler.png_ptr = png_create_read_struct
|
||||
(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (!png_handler.png_ptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_handler.info_ptr = png_create_info_struct(png_handler.png_ptr);
|
||||
if (!png_handler.info_ptr) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_handler.end_info_ptr = png_create_info_struct(png_handler.png_ptr);
|
||||
if (!png_handler.end_info_ptr) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_set_crc_action(png_handler.png_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
|
||||
#ifdef PNG_IGNORE_ADLER32
|
||||
png_set_option(png_handler.png_ptr, PNG_IGNORE_ADLER32, PNG_OPTION_ON);
|
||||
#endif
|
||||
|
||||
// Setting up reading from buffer.
|
||||
png_handler.buf_state = new BufState();
|
||||
png_handler.buf_state->data = data + kPngHeaderSize;
|
||||
png_handler.buf_state->bytes_left = size - kPngHeaderSize;
|
||||
png_set_read_fn(png_handler.png_ptr, png_handler.buf_state, user_read_data);
|
||||
png_set_sig_bytes(png_handler.png_ptr, kPngHeaderSize);
|
||||
|
||||
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Reading.
|
||||
png_read_info(png_handler.png_ptr, png_handler.info_ptr);
|
||||
|
||||
// reset error handler to put png_deleter into scope.
|
||||
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_uint_32 width, height;
|
||||
int bit_depth, color_type, interlace_type, compression_type;
|
||||
int filter_type;
|
||||
|
||||
if (!png_get_IHDR(png_handler.png_ptr, png_handler.info_ptr, &width,
|
||||
&height, &bit_depth, &color_type, &interlace_type,
|
||||
&compression_type, &filter_type)) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This is going to be too slow.
|
||||
if (width && height > 100000000 / width) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Set several transforms that browsers typically use:
|
||||
png_set_gray_to_rgb(png_handler.png_ptr);
|
||||
png_set_expand(png_handler.png_ptr);
|
||||
png_set_packing(png_handler.png_ptr);
|
||||
png_set_scale_16(png_handler.png_ptr);
|
||||
png_set_tRNS_to_alpha(png_handler.png_ptr);
|
||||
|
||||
int passes = png_set_interlace_handling(png_handler.png_ptr);
|
||||
|
||||
png_read_update_info(png_handler.png_ptr, png_handler.info_ptr);
|
||||
|
||||
png_handler.row_ptr = png_malloc(
|
||||
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
|
||||
png_handler.info_ptr));
|
||||
|
||||
for (int pass = 0; pass < passes; ++pass) {
|
||||
for (png_uint_32 y = 0; y < height; ++y) {
|
||||
png_read_row(png_handler.png_ptr,
|
||||
static_cast<png_bytep>(png_handler.row_ptr), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
png_read_end(png_handler.png_ptr, png_handler.end_info_ptr);
|
||||
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
2
contrib/oss-fuzz/libpng_read_fuzzer.options
Normal file
@@ -0,0 +1,2 @@
|
||||
[libfuzzer]
|
||||
dict = png.dict
|
||||
39
contrib/oss-fuzz/png.dict
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
# AFL dictionary for PNG images
|
||||
# -----------------------------
|
||||
#
|
||||
# Just the basic, standard-originating sections; does not include vendor
|
||||
# extensions.
|
||||
#
|
||||
# Created by Michal Zalewski <lcamtuf@google.com>
|
||||
#
|
||||
|
||||
header_png="\x89PNG\x0d\x0a\x1a\x0a"
|
||||
|
||||
section_IDAT="IDAT"
|
||||
section_IEND="IEND"
|
||||
section_IHDR="IHDR"
|
||||
section_PLTE="PLTE"
|
||||
section_bKGD="bKGD"
|
||||
section_cHRM="cHRM"
|
||||
section_eXIf="eXIf"
|
||||
section_fRAc="fRAc"
|
||||
section_gAMA="gAMA"
|
||||
section_gIFg="gIFg"
|
||||
section_gIFt="gIFt"
|
||||
section_gIFx="gIFx"
|
||||
section_hIST="hIST"
|
||||
section_iCCP="iCCP"
|
||||
section_iTXt="iTXt"
|
||||
section_oFFs="oFFs"
|
||||
section_pCAL="pCAL"
|
||||
section_pHYs="pHYs"
|
||||
section_sBIT="sBIT"
|
||||
section_sCAL="sCAL"
|
||||
section_sPLT="sPLT"
|
||||
section_sRGB="sRGB"
|
||||
section_sTER="sTER"
|
||||
section_tEXt="tEXt"
|
||||
section_tIME="tIME"
|
||||
section_tRNS="tRNS"
|
||||
section_zTXt="zTXt"
|
||||
13
contrib/pngminus/CHANGES.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
pnm2png / png2pnm --- conversion from PBM/PGM/PPM-file to PNG-file
|
||||
copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||
|
||||
version 1.0 - 1999.10.15 - First version.
|
||||
1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
|
||||
1.2 - 2017.04.22 - Add buffer-size check
|
||||
1.3 - 2017.08.24 - Fix potential overflow in buffer-size check
|
||||
(Glenn Randers-Pehrson)
|
||||
1.4 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
|
||||
1.5 - 2018.08.05 - Fix buffer overflow in tokenizer (Cosmin Truta)
|
||||
1.6 - 2018.08.05 - Improve portability and fix style (Cosmin Truta)
|
||||
1.7 - 2019.01.22 - Change license to MIT (Willem van Schaik)
|
||||
24
contrib/pngminus/CMakeLists.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
cmake_policy(VERSION 3.1)
|
||||
|
||||
project(PNGMINUS C)
|
||||
|
||||
option(PNGMINUS_USE_STATIC_LIBRARIES "Use the static library builds" ON)
|
||||
|
||||
# libpng
|
||||
add_subdirectory(../.. libpng)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../..)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/libpng)
|
||||
if(PNGMINUS_USE_STATIC_LIBRARIES)
|
||||
set(PNGMINUS_PNG_LIBRARY png_static)
|
||||
else()
|
||||
set(PNGMINUS_PNG_LIBRARY png)
|
||||
endif()
|
||||
|
||||
# png2pnm
|
||||
add_executable(png2pnm png2pnm.c)
|
||||
target_link_libraries(png2pnm ${PNGMINUS_PNG_LIBRARY})
|
||||
|
||||
# pnm2png
|
||||
add_executable(pnm2png pnm2png.c)
|
||||
target_link_libraries(pnm2png ${PNGMINUS_PNG_LIBRARY})
|
||||
22
contrib/pngminus/LICENSE.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
pnm2png / png2pnm --- conversion from PBM/PGM/PPM-file to PNG-file
|
||||
|
||||
copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
The software is provided "as is", without warranty of any kind, express or
|
||||
implied, including but not limited to the warranties of merchantability,
|
||||
fitness for a particular purpose and noninfringement. In no event shall the
|
||||
authors or copyight holders be liable for any claim, damages or other
|
||||
liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
out of or in connection with the software or the use or other dealings in the
|
||||
software.
|
||||
62
contrib/pngminus/Makefile
Normal file
@@ -0,0 +1,62 @@
|
||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
||||
# Linux / Unix
|
||||
|
||||
#CC = cc
|
||||
CC = gcc
|
||||
LD = $(CC)
|
||||
|
||||
RM = rm -f
|
||||
|
||||
PNGINC = -I../..
|
||||
PNGLIB_SHARED = -L../.. -lpng
|
||||
PNGLIB_STATIC = ../../libpng.a
|
||||
|
||||
# Uncomment the following if you have a custom zlib build at ../../../zlib
|
||||
#ZINC = -I../../../zlib
|
||||
#ZLIB_SHARED = -L../../../zlib -lz
|
||||
#ZLIB_STATIC = ../../../zlib/libz.a
|
||||
|
||||
# Use the system zlib otherwise
|
||||
ZLIB_SHARED = -lz
|
||||
ZLIB_STATIC = -lz
|
||||
|
||||
CPPFLAGS = $(PNGINC) $(ZINC)
|
||||
CFLAGS =
|
||||
LDFLAGS =
|
||||
LIBS_SHARED = $(PNGLIB_SHARED) $(ZLIB_SHARED)
|
||||
LIBS_STATIC = $(PNGLIB_STATIC) $(ZLIB_STATIC)
|
||||
|
||||
EXEEXT =
|
||||
#EXEEXT = .exe
|
||||
|
||||
# dependencies
|
||||
|
||||
all: png2pnm$(EXEEXT) pnm2png$(EXEEXT) png2pnm-static$(EXEEXT) pnm2png-static$(EXEEXT)
|
||||
|
||||
png2pnm.o: png2pnm.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm.c
|
||||
|
||||
pnm2png.o: pnm2png.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png.c
|
||||
|
||||
png2pnm$(EXEEXT): png2pnm.o
|
||||
$(LD) $(LDFLAGS) -o png2pnm$(EXEEXT) png2pnm.o $(LIBS_SHARED) -lm
|
||||
|
||||
pnm2png$(EXEEXT): pnm2png.o
|
||||
$(LD) $(LDFLAGS) -o pnm2png$(EXEEXT) pnm2png.o $(LIBS_SHARED) -lm
|
||||
|
||||
png2pnm-static$(EXEEXT): png2pnm.o
|
||||
$(LD) $(LDFLAGS) -o png2pnm-static$(EXEEXT) png2pnm.o $(LIBS_STATIC) -lm
|
||||
|
||||
pnm2png-static$(EXEEXT): pnm2png.o
|
||||
$(LD) $(LDFLAGS) -o pnm2png-static$(EXEEXT) pnm2png.o $(LIBS_STATIC) -lm
|
||||
|
||||
clean:
|
||||
$(RM) png2pnm.o
|
||||
$(RM) pnm2png.o
|
||||
$(RM) png2pnm$(EXEEXT)
|
||||
$(RM) pnm2png$(EXEEXT)
|
||||
$(RM) png2pnm-static$(EXEEXT)
|
||||
$(RM) pnm2png-static$(EXEEXT)
|
||||
|
||||
# End of makefile for png2pnm / pnm2png
|
||||
@@ -1,26 +1,16 @@
|
||||
PngMinus
|
||||
--------
|
||||
(copyright Willem van Schaik, 1999)
|
||||
(copyright Willem van Schaik, 1999-2019)
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and
|
||||
that both that copyright notice and this permission notice appear in
|
||||
supporting documentation. This software is provided "as is" without
|
||||
express or implied warranty.
|
||||
|
||||
|
||||
Some history
|
||||
------------
|
||||
Soon after the creation of PNG in 1995, the need was felt for a set of
|
||||
pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I
|
||||
pnmtopng / pngtopnm utilities. Independently Alexander Lehmann and I
|
||||
(Willem van Schaik) started such a project. Luckily we discovered this
|
||||
and merged the two together into pnmtopng.tar.gz, which is available
|
||||
from a/o ftp://ftp.simplesystems.org/pub/libpng/png/.
|
||||
and merged the two, which later became part of NetPBM, available from
|
||||
SourceForge.
|
||||
|
||||
These two utilities have many, many options and make use of most of the
|
||||
features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes
|
||||
@@ -35,8 +25,8 @@ makes the whole setup a bit bulky. But that's unavoidable given the many
|
||||
features of pnmtopng.
|
||||
|
||||
|
||||
What now
|
||||
--------
|
||||
What now (1999)
|
||||
---------------
|
||||
At this moment libpng is in a very stable state and can do much of the
|
||||
work done in pnmtopng. Also, pnmtopng needs to be upgraded to the new
|
||||
interface of libpng. Hence, it is time for a rewrite from the ground up
|
||||
@@ -49,8 +39,8 @@ a small prototype that contains only the basic functionality. It doesn't
|
||||
have any of the options to read or write special chunks and it will do
|
||||
no gamma correction. But this makes it also a simple program that is
|
||||
quite easy to understand and can serve well as a template for other
|
||||
software developments. (By now there are of course a couple of programs,
|
||||
like Greg Roelofs' rpng/wpng, that can be used just as good.)
|
||||
software developments. By now there are of course a couple of programs,
|
||||
like Greg Roelofs' rpng/wpng, that can be used just as good.
|
||||
|
||||
|
||||
Can and can not
|
||||
@@ -60,7 +50,8 @@ PngMinus. Because I started this development in good-old Turbo-C, I
|
||||
avoided the use the netpbm library, which requires DOS extenders. Again,
|
||||
another reason to call it PngMinus (minus netpbm :-). So, part of the
|
||||
program are some elementary routines to read / write pgm- and ppm-files.
|
||||
It does not read b&w pbm-files.
|
||||
It does not handle B&W pbm-files, but instead you could do pgm with bit-
|
||||
depth 1.
|
||||
|
||||
The downside of this approach is that you can not use them on images
|
||||
that require blocks of memory bigger than 64k (the DOS version). For
|
||||
@@ -96,58 +87,34 @@ To list the options type "png2pnm -h" or "pnm2png -h".
|
||||
|
||||
Just like Scandinavian furniture
|
||||
--------------------------------
|
||||
You have to put it together yourself. I did test the software under
|
||||
MS-DOS with Turbo-C 3.0 and under RedHat Linux 4.2 with gcc. In both
|
||||
cases I used libpng-1.0.4 and zlib-1.1.3. Later versions should be OK,
|
||||
however some older libpng versions have a bug in pngmem.c when using
|
||||
Turbo-C 3.0 (see below).
|
||||
You have to put it together yourself. I developed the software on MS-DOS
|
||||
with Turbo-C 3.0 and RedHat Linux 4.2 with gcc. In both cases I used
|
||||
libpng-1.0.4 and zlib-1.1.3. By now (2019) it is twenty years later and
|
||||
more current versions are OK.
|
||||
|
||||
You can build it using one of the two makefiles (make -f makefile.###)
|
||||
or use the batch/script files pngminus.bat / pngminus.sh. This assumes
|
||||
that you have built the libraries in ../libpng and ../zlib. Using Linux,
|
||||
make sure that you have built libpng with makefile.std and not
|
||||
makefile.linux (also called .lnx in earlier versions of libpng). The
|
||||
latter creates a .so shared-library, while the PngMinus makefile assumes
|
||||
a normal .a static library.
|
||||
The makefile assumes that the libpng libraries can be found in ../.. and
|
||||
libz in ../../../zlib. But you can change this to for example ../libpng
|
||||
and ../zlib. The makefile creates two versions of each program, one with
|
||||
static library support and the other using shared libraries.
|
||||
|
||||
If you create a ../pngsuite directory and then store the basn####.png
|
||||
files from PngSuite (http://www.schaik.com/pngsuite/) in there, you can
|
||||
test in one go the proper functioning of PngMinus, see png2pnm.bat and
|
||||
pnm2png.bat (or the .sh versions).
|
||||
test the proper functioning of PngMinus by running pngminus.sh.
|
||||
|
||||
|
||||
Warranty
|
||||
-------
|
||||
Please, remember that this was just a small experiment to learn a few
|
||||
things. It will have many unforeseen features <vbg>. Who said bugs? Use
|
||||
it when you are in need for something simple or when you want to start
|
||||
developing your own stuff.
|
||||
|
||||
|
||||
The Turbo bug
|
||||
-------------
|
||||
** pngmem.old
|
||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
||||
hptr += 16L;
|
||||
** pngmem.c
|
||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
||||
hptr = hptr + 16L;
|
||||
**
|
||||
|
||||
** pngmem.old
|
||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
||||
hptr += (png_uint_32)65536L;
|
||||
** pngmem.c
|
||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
||||
hptr = hptr + 65536L;
|
||||
**
|
||||
things. It will have many unforeseen features <vbg> ... who said bugs? Use
|
||||
it when you are in need for something simple or when you want a starting
|
||||
point for developing your own stuff.
|
||||
|
||||
|
||||
The end
|
||||
-------
|
||||
Willem van Schaik
|
||||
mailto:willem@schaik.com
|
||||
mailto:willem at schaik dot com
|
||||
http://www.schaik.com/png/
|
||||
-------
|
||||
Oct 1999
|
||||
|
||||
Oct 1999, Jan 2019
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
||||
# Linux / Unix
|
||||
|
||||
#CC=cc
|
||||
CC=gcc
|
||||
LD=$(CC)
|
||||
|
||||
RM=rm -f
|
||||
|
||||
#PNGPATH = /usr/local
|
||||
#PNGINC = -I$(PNGPATH)/include/libpng16
|
||||
#PNGLIB = -L$(PNGPATH)/lib -lpng16
|
||||
#PNGLIBS = $(PNGPATH)/lib/libpng16.a
|
||||
PNGINC = -I../..
|
||||
PNGLIB = -L../.. -lpng
|
||||
PNGLIBS = ../../libpng.a
|
||||
|
||||
#ZPATH = /usr/local
|
||||
#ZINC = -I$(ZPATH)/include
|
||||
#ZLIB = -L$(ZPATH)/lib -lz
|
||||
#ZLIBS = $(ZPATH)/lib/libz.a
|
||||
ZINC = -I../../../zlib
|
||||
ZLIB = -L../../../zlib -lz
|
||||
ZLIBS = ../../../zlib/libz.a
|
||||
|
||||
CPPFLAGS=$(PNGINC) $(ZINC)
|
||||
CFLAGS=
|
||||
LDLIBS=$(PNGLIB) $(ZLIB)
|
||||
LDLIBSS=$(PNGLIBS) $(ZLIBS)
|
||||
C=.c
|
||||
O=.o
|
||||
L=.a
|
||||
E=
|
||||
|
||||
# dependencies
|
||||
|
||||
#all: png2pnm$(E) pnm2png$(E)
|
||||
all: png2pnm$(E) pnm2png$(E) png2pnm-static$(E) pnm2png-static$(E)
|
||||
|
||||
png2pnm$(O): png2pnm$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
|
||||
|
||||
png2pnm$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
|
||||
|
||||
png2pnm-static$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
|
||||
|
||||
pnm2png$(O): pnm2png$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
|
||||
|
||||
pnm2png$(E): pnm2png$(O)
|
||||
$(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
|
||||
|
||||
pnm2png-static$(E): pnm2png$(O)
|
||||
$(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
|
||||
|
||||
clean:
|
||||
$(RM) png2pnm$(O)
|
||||
$(RM) pnm2png$(O)
|
||||
$(RM) png2pnm$(E)
|
||||
$(RM) pnm2png$(E)
|
||||
$(RM) png2pnm-static$(E)
|
||||
$(RM) pnm2png-static$(E)
|
||||
|
||||
# End of makefile for png2pnm / pnm2png
|
||||
@@ -1,38 +0,0 @@
|
||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
||||
# TurboC++ 3.0
|
||||
|
||||
CC=tcc -Ic:\tc3\inc
|
||||
LD=tcc -Lc:\tc3\lib
|
||||
LB=tlib
|
||||
RM=del
|
||||
CP=copy
|
||||
MODEL=l
|
||||
CPPFLAGS=-I..\libpng -I..\zlib
|
||||
CFLAGS=-O -m$(MODEL)
|
||||
LDFLAGS=-m$(MODEL) -L..\libpng -L..\zlib
|
||||
C=.c
|
||||
O=.obj
|
||||
L=.lib
|
||||
E=.exe
|
||||
|
||||
# dependencies
|
||||
|
||||
all: png2pnm$(E) pnm2png$(E)
|
||||
|
||||
png2pnm$(O): png2pnm$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
|
||||
|
||||
png2pnm$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) png2pnm$(O) libpng$(L) zlib$(L)
|
||||
|
||||
pnm2png$(O): pnm2png$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
|
||||
|
||||
pnm2png$(E): pnm2png$(O)
|
||||
$(LD) $(LDFLAGS) pnm2png$(O) libpng$(L) zlib$(L)
|
||||
|
||||
clean:
|
||||
$(RM) *$(O)
|
||||
$(RM) *$(E)
|
||||
|
||||
# End of makefile for png2pnm / pnm2png
|
||||
@@ -7,7 +7,7 @@ png2pnm.exe -noraw ..\pngsuite\basn0g16.png basn0g16.pgm
|
||||
REM -- full-color
|
||||
png2pnm.exe -noraw ..\pngsuite\basn2c08.png basn2c08.ppm
|
||||
png2pnm.exe -noraw ..\pngsuite\basn2c16.png basn2c16.ppm
|
||||
REM -- palletted
|
||||
REM -- paletted
|
||||
png2pnm.exe -noraw ..\pngsuite\basn3p01.png basn3p01.ppm
|
||||
png2pnm.exe -noraw ..\pngsuite\basn3p02.png basn3p02.ppm
|
||||
png2pnm.exe -noraw ..\pngsuite\basn3p04.png basn3p04.ppm
|
||||
@@ -27,7 +27,7 @@ png2pnm.exe -raw ..\pngsuite\basn0g16.png rawn0g16.pgm
|
||||
REM -- full-color
|
||||
png2pnm.exe -raw ..\pngsuite\basn2c08.png rawn2c08.ppm
|
||||
png2pnm.exe -raw ..\pngsuite\basn2c16.png rawn2c16.ppm
|
||||
REM -- palletted
|
||||
REM -- paletted
|
||||
png2pnm.exe -raw ..\pngsuite\basn3p01.png rawn3p01.ppm
|
||||
png2pnm.exe -raw ..\pngsuite\basn3p02.png rawn3p02.ppm
|
||||
png2pnm.exe -raw ..\pngsuite\basn3p04.png rawn3p04.ppm
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
/*
|
||||
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
|
||||
* copyright (C) 1999 by Willem van Schaik <willem@schaik.com>
|
||||
* copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||
*
|
||||
* version 1.0 - 1999.10.15 - First version.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear in
|
||||
* supporting documentation. This software is provided "as is" without
|
||||
* express or implied warranty.
|
||||
* This software is released under the MIT license. For conditions of
|
||||
* distribution and use, see the LICENSE file part of this package.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __TURBOC__
|
||||
#include <mem.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL unsigned char
|
||||
@@ -30,36 +20,25 @@
|
||||
#define FALSE (BOOL) 0
|
||||
#endif
|
||||
|
||||
#ifdef __TURBOC__
|
||||
#define STDIN 0
|
||||
#define STDOUT 1
|
||||
#define STDERR 2
|
||||
#endif
|
||||
|
||||
/* to make png2pnm verbose so we can find problems (needs to be before png.h) */
|
||||
/* make png2pnm verbose so we can find problems (needs to be before png.h) */
|
||||
#ifndef PNG_DEBUG
|
||||
#define PNG_DEBUG 0
|
||||
#endif
|
||||
|
||||
#include "png.h"
|
||||
|
||||
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
|
||||
#ifndef png_jmpbuf
|
||||
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
||||
#endif
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
int main (int argc, char *argv[]);
|
||||
int main (int argc, char *argv[]);
|
||||
void usage ();
|
||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw,
|
||||
BOOL alpha);
|
||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
BOOL raw, BOOL alpha);
|
||||
|
||||
/*
|
||||
* main
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
FILE *fp_rd = stdin;
|
||||
FILE *fp_wr = stdout;
|
||||
@@ -86,21 +65,21 @@ int main(int argc, char *argv[])
|
||||
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: can not create alpha-channel file %s\n",
|
||||
argv[argi]);
|
||||
fprintf (stderr, "Error: cannot create alpha-channel file %s\n",
|
||||
argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
usage();
|
||||
exit(0);
|
||||
usage ();
|
||||
exit (0);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
|
||||
usage();
|
||||
exit(1);
|
||||
usage ();
|
||||
exit (1);
|
||||
break;
|
||||
} /* end switch */
|
||||
}
|
||||
@@ -108,9 +87,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if ((fp_rd = fopen (argv[argi], "rb")) == NULL)
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: file %s does not exist\n", argv[argi]);
|
||||
exit (1);
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: file %s does not exist\n", argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
else if (fp_wr == stdout)
|
||||
@@ -118,7 +97,7 @@ int main(int argc, char *argv[])
|
||||
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: can not create file %s\n", argv[argi]);
|
||||
fprintf (stderr, "Error: cannot create file %s\n", argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
@@ -126,21 +105,17 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: too many parameters\n");
|
||||
usage();
|
||||
exit(1);
|
||||
usage ();
|
||||
exit (1);
|
||||
}
|
||||
} /* end for */
|
||||
|
||||
#ifdef __TURBOC__
|
||||
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||
/* set stdin/stdout if required to binary */
|
||||
if (fp_rd == stdin)
|
||||
{
|
||||
setmode (STDIN, O_BINARY);
|
||||
}
|
||||
setmode (fileno (stdin), O_BINARY);
|
||||
if ((raw) && (fp_wr == stdout))
|
||||
{
|
||||
setmode (STDOUT, O_BINARY);
|
||||
}
|
||||
setmode (fileno (stdout), O_BINARY);
|
||||
#endif
|
||||
|
||||
/* call the conversion program itself */
|
||||
@@ -148,7 +123,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* close input file */
|
||||
@@ -166,23 +141,18 @@ int main(int argc, char *argv[])
|
||||
* usage
|
||||
*/
|
||||
|
||||
void usage()
|
||||
void usage ()
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, " by Willem van Schaik, 1999\n");
|
||||
#ifdef __TURBOC__
|
||||
fprintf (stderr, " for Turbo-C and Borland-C compilers\n");
|
||||
#else
|
||||
fprintf (stderr, " for Linux (and Unix) compilers\n");
|
||||
#endif
|
||||
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
|
||||
fprintf (stderr, " or: ... | png2pnm [options]\n");
|
||||
fprintf (stderr, "Options:\n");
|
||||
fprintf (stderr,
|
||||
" -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
|
||||
" -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
|
||||
fprintf (stderr, " -n[oraw] write pnm-file in ascii format (P1/P2/P3)\n");
|
||||
fprintf (stderr,
|
||||
" -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
|
||||
" -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
|
||||
fprintf (stderr, " -h | -? print this help-information\n");
|
||||
}
|
||||
|
||||
@@ -191,10 +161,10 @@ void usage()
|
||||
*/
|
||||
|
||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
volatile BOOL raw, BOOL alpha)
|
||||
BOOL raw, BOOL alpha)
|
||||
{
|
||||
png_struct *png_ptr = NULL;
|
||||
png_info *info_ptr = NULL;
|
||||
png_info *info_ptr = NULL;
|
||||
png_byte buf[8];
|
||||
png_byte *png_pixels = NULL;
|
||||
png_byte **row_pointers = NULL;
|
||||
@@ -218,24 +188,24 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
return FALSE;
|
||||
|
||||
ret = png_sig_cmp (buf, 0, 8);
|
||||
if (ret)
|
||||
if (ret != 0)
|
||||
return FALSE;
|
||||
|
||||
/* create png and info structures */
|
||||
|
||||
png_ptr = png_create_read_struct (png_get_libpng_ver(NULL),
|
||||
NULL, NULL, NULL);
|
||||
NULL, NULL, NULL);
|
||||
if (!png_ptr)
|
||||
return FALSE; /* out of memory */
|
||||
return FALSE; /* out of memory */
|
||||
|
||||
info_ptr = png_create_info_struct (png_ptr);
|
||||
if (!info_ptr)
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, NULL, NULL);
|
||||
return FALSE; /* out of memory */
|
||||
return FALSE; /* out of memory */
|
||||
}
|
||||
|
||||
if (setjmp (png_jmpbuf(png_ptr)))
|
||||
if (setjmp (png_jmpbuf (png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
return FALSE;
|
||||
@@ -243,15 +213,14 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
|
||||
/* set up the input control for C streams */
|
||||
png_init_io (png_ptr, png_file);
|
||||
png_set_sig_bytes (png_ptr, 8); /* we already read the 8 signature bytes */
|
||||
png_set_sig_bytes (png_ptr, 8); /* we already read the 8 signature bytes */
|
||||
|
||||
/* read the file information */
|
||||
png_read_info (png_ptr, info_ptr);
|
||||
|
||||
/* get size and bit-depth of the PNG-image */
|
||||
png_get_IHDR (png_ptr, info_ptr,
|
||||
&width, &height, &bit_depth, &color_type,
|
||||
NULL, NULL, NULL);
|
||||
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
/* set-up the transformations */
|
||||
|
||||
@@ -271,7 +240,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
png_set_strip_16 (png_ptr);
|
||||
/* transform grayscale images into full-color */
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb (png_ptr);
|
||||
/* only if file has a file gamma, we do a correction */
|
||||
if (png_get_gAMA (png_ptr, info_ptr, &file_gamma))
|
||||
@@ -285,14 +254,14 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
|
||||
/* get the new color-type and bit-depth (after expansion/stripping) */
|
||||
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||
NULL, NULL, NULL);
|
||||
NULL, NULL, NULL);
|
||||
|
||||
/* check for 16-bit files */
|
||||
if (bit_depth == 16)
|
||||
{
|
||||
raw = FALSE;
|
||||
#ifdef __TURBOC__
|
||||
pnm_file->flags &= ~((unsigned) _F_BIN);
|
||||
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||
setmode (fileno (pnm_file), O_BINARY);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -320,18 +289,25 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
|
||||
|
||||
if ((row_bytes == 0) ||
|
||||
((size_t) height > (size_t) (-1) / (size_t) row_bytes))
|
||||
{
|
||||
/* too big */
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
if ((png_pixels = (png_byte *)
|
||||
malloc (row_bytes * height * sizeof (png_byte))) == NULL) {
|
||||
malloc ((size_t) row_bytes * (size_t) height)) == NULL)
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((row_pointers = (png_byte **)
|
||||
malloc (height * sizeof (png_bytep))) == NULL)
|
||||
malloc ((size_t) height * sizeof (png_byte *))) == NULL)
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
free (png_pixels);
|
||||
png_pixels = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -346,7 +322,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
png_read_end (png_ptr, info_ptr);
|
||||
|
||||
/* clean up after the read, and free any memory allocated - REQUIRED */
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, (png_infopp) NULL);
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
|
||||
/* write header of PNM file */
|
||||
|
||||
@@ -386,14 +362,21 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
for (i = 0; i < (channels - alpha_present); i++)
|
||||
{
|
||||
if (raw)
|
||||
fputc ((int) *pix_ptr++ , pnm_file);
|
||||
{
|
||||
fputc ((int) *pix_ptr++, pnm_file);
|
||||
}
|
||||
else
|
||||
if (bit_depth == 16){
|
||||
{
|
||||
if (bit_depth == 16)
|
||||
{
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (pnm_file, "%ld ", (long) *pix_ptr++);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (alpha_present)
|
||||
{
|
||||
@@ -406,16 +389,23 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
else /* output alpha-channel as pgm file */
|
||||
{
|
||||
if (raw)
|
||||
fputc ((int) *pix_ptr++ , alpha_file);
|
||||
{
|
||||
fputc ((int) *pix_ptr++, alpha_file);
|
||||
}
|
||||
else
|
||||
if (bit_depth == 16){
|
||||
{
|
||||
if (bit_depth == 16)
|
||||
{
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* if alpha_present */
|
||||
} /* end if alpha_present */
|
||||
|
||||
if (!raw)
|
||||
if (col % 4 == 3)
|
||||
@@ -427,12 +417,11 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
fprintf (pnm_file, "\n");
|
||||
} /* end for row */
|
||||
|
||||
if (row_pointers != (unsigned char**) NULL)
|
||||
if (row_pointers != NULL)
|
||||
free (row_pointers);
|
||||
if (png_pixels != (unsigned char*) NULL)
|
||||
if (png_pixels != NULL)
|
||||
free (png_pixels);
|
||||
|
||||
return TRUE;
|
||||
|
||||
} /* end of source */
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# -- full-color
|
||||
./png2pnm -noraw ../pngsuite/basn2c08.png basn2c08.ppm
|
||||
./png2pnm -noraw ../pngsuite/basn2c16.png basn2c16.ppm
|
||||
# -- palletted
|
||||
# -- paletted
|
||||
./png2pnm -noraw ../pngsuite/basn3p01.png basn3p01.ppm
|
||||
./png2pnm -noraw ../pngsuite/basn3p02.png basn3p02.ppm
|
||||
./png2pnm -noraw ../pngsuite/basn3p04.png basn3p04.ppm
|
||||
@@ -28,7 +28,7 @@
|
||||
# -- full-color
|
||||
./png2pnm -raw ../pngsuite/basn2c08.png rawn2c08.ppm
|
||||
./png2pnm -raw ../pngsuite/basn2c16.png rawn2c16.ppm
|
||||
# -- palletted
|
||||
# -- paletted
|
||||
./png2pnm -raw ../pngsuite/basn3p01.png rawn3p01.ppm
|
||||
./png2pnm -raw ../pngsuite/basn3p02.png rawn3p02.ppm
|
||||
./png2pnm -raw ../pngsuite/basn3p04.png rawn3p04.ppm
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
make -f makefile.tc3
|
||||
make
|
||||
call png2pnm.bat
|
||||
call pnm2png.bat
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
make -f makefile.std
|
||||
make
|
||||
sh png2pnm.sh
|
||||
sh pnm2png.sh
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ pnm2png.exe basn0g16.pgm basn0g16.png
|
||||
REM -- full-color
|
||||
pnm2png.exe basn2c08.ppm basn2c08.png
|
||||
pnm2png.exe basn2c16.ppm basn2c16.png
|
||||
REM -- palletted
|
||||
REM -- paletted
|
||||
pnm2png.exe basn3p01.ppm basn3p01.png
|
||||
pnm2png.exe basn3p02.ppm basn3p02.png
|
||||
pnm2png.exe basn3p04.ppm basn3p04.png
|
||||
@@ -27,7 +27,7 @@ pnm2png.exe rawn0g16.pgm rawn0g16.png
|
||||
REM -- full-color
|
||||
pnm2png.exe rawn2c08.ppm rawn2c08.png
|
||||
pnm2png.exe rawn2c16.ppm rawn2c16.png
|
||||
REM -- palletted
|
||||
REM -- paletted
|
||||
pnm2png.exe rawn3p01.ppm rawn3p01.png
|
||||
pnm2png.exe rawn3p02.ppm rawn3p02.png
|
||||
pnm2png.exe rawn3p04.ppm rawn3p04.png
|
||||
|
||||
@@ -1,25 +1,14 @@
|
||||
/*
|
||||
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
|
||||
* copyright (C) 1999 by Willem van Schaik <willem@schaik.com>
|
||||
* copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||
*
|
||||
* version 1.0 - 1999.10.15 - First version.
|
||||
* version 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear in
|
||||
* supporting documentation. This software is provided "as is" without
|
||||
* express or implied warranty.
|
||||
* This software is released under the MIT license. For conditions of
|
||||
* distribution and use, see the LICENSE file part of this package.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __TURBOC__
|
||||
#include <mem.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL unsigned char
|
||||
@@ -31,29 +20,20 @@
|
||||
#define FALSE (BOOL) 0
|
||||
#endif
|
||||
|
||||
#define STDIN 0
|
||||
#define STDOUT 1
|
||||
#define STDERR 2
|
||||
|
||||
/* to make pnm2png verbose so we can find problems (needs to be before png.h) */
|
||||
/* make pnm2png verbose so we can find problems (needs to be before png.h) */
|
||||
#ifndef PNG_DEBUG
|
||||
#define PNG_DEBUG 0
|
||||
#endif
|
||||
|
||||
#include "png.h"
|
||||
|
||||
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
|
||||
#ifndef png_jmpbuf
|
||||
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
||||
#endif
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
int main (int argc, char *argv[]);
|
||||
int main (int argc, char *argv[]);
|
||||
void usage ();
|
||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
BOOL alpha);
|
||||
void get_token(FILE *pnm_file, char *token);
|
||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
|
||||
BOOL interlace, BOOL alpha);
|
||||
void get_token (FILE *pnm_file, char *token_buf, size_t token_buf_size);
|
||||
png_uint_32 get_data (FILE *pnm_file, int depth);
|
||||
png_uint_32 get_value (FILE *pnm_file, int depth);
|
||||
|
||||
@@ -61,7 +41,7 @@ png_uint_32 get_value (FILE *pnm_file, int depth);
|
||||
* main
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
FILE *fp_rd = stdin;
|
||||
FILE *fp_al = NULL;
|
||||
@@ -86,20 +66,20 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: alpha-channel file %s does not exist\n",
|
||||
argv[argi]);
|
||||
argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
usage();
|
||||
exit(0);
|
||||
usage ();
|
||||
exit (0);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
|
||||
usage();
|
||||
exit(1);
|
||||
usage ();
|
||||
exit (1);
|
||||
break;
|
||||
} /* end switch */
|
||||
}
|
||||
@@ -117,7 +97,7 @@ int main(int argc, char *argv[])
|
||||
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: can not create PNG-file %s\n", argv[argi]);
|
||||
fprintf (stderr, "Error: cannot create PNG-file %s\n", argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
@@ -125,21 +105,19 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: too many parameters\n");
|
||||
usage();
|
||||
usage ();
|
||||
exit (1);
|
||||
}
|
||||
} /* end for */
|
||||
|
||||
#ifdef __TURBOC__
|
||||
/* set stdin/stdout to binary, we're reading the PNM always! in binary format */
|
||||
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||
/* set stdin/stdout to binary,
|
||||
* we're reading the PNM always! in binary format
|
||||
*/
|
||||
if (fp_rd == stdin)
|
||||
{
|
||||
setmode (STDIN, O_BINARY);
|
||||
}
|
||||
setmode (fileno (stdin), O_BINARY);
|
||||
if (fp_wr == stdout)
|
||||
{
|
||||
setmode (STDOUT, O_BINARY);
|
||||
}
|
||||
setmode (fileno (stdout), O_BINARY);
|
||||
#endif
|
||||
|
||||
/* call the conversion program itself */
|
||||
@@ -165,15 +143,10 @@ int main(int argc, char *argv[])
|
||||
* usage
|
||||
*/
|
||||
|
||||
void usage()
|
||||
void usage ()
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, " by Willem van Schaik, 1999\n");
|
||||
#ifdef __TURBOC__
|
||||
fprintf (stderr, " for Turbo-C and Borland-C compilers\n");
|
||||
#else
|
||||
fprintf (stderr, " for Linux (and Unix) compilers\n");
|
||||
#endif
|
||||
fprintf (stderr, "Usage: pnm2png [options] <file>.<pnm> [<file>.png]\n");
|
||||
fprintf (stderr, " or: ... | pnm2png [options]\n");
|
||||
fprintf (stderr, "Options:\n");
|
||||
@@ -187,31 +160,31 @@ void usage()
|
||||
* pnm2png
|
||||
*/
|
||||
|
||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
BOOL alpha)
|
||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
|
||||
BOOL interlace, BOOL alpha)
|
||||
{
|
||||
png_struct *png_ptr = NULL;
|
||||
png_info *info_ptr = NULL;
|
||||
png_byte *png_pixels = NULL;
|
||||
png_byte **row_pointers = NULL;
|
||||
png_byte *pix_ptr = NULL;
|
||||
volatile png_uint_32 row_bytes;
|
||||
volatile png_uint_32 row_bytes;
|
||||
|
||||
char type_token[16];
|
||||
char width_token[16];
|
||||
char height_token[16];
|
||||
char maxval_token[16];
|
||||
volatile int color_type=1;
|
||||
unsigned long ul_width=0, ul_alpha_width=0;
|
||||
unsigned long ul_height=0, ul_alpha_height=0;
|
||||
unsigned long ul_maxval=0;
|
||||
volatile png_uint_32 width=0, height=0;
|
||||
volatile png_uint_32 alpha_width=0, alpha_height=0;
|
||||
volatile int color_type = 1;
|
||||
unsigned long ul_width = 0, ul_alpha_width = 0;
|
||||
unsigned long ul_height = 0, ul_alpha_height = 0;
|
||||
unsigned long ul_maxval = 0;
|
||||
volatile png_uint_32 width = 0, height = 0;
|
||||
volatile png_uint_32 alpha_width = 0, alpha_height = 0;
|
||||
png_uint_32 maxval;
|
||||
volatile int bit_depth = 0;
|
||||
int channels=0;
|
||||
volatile int bit_depth = 0;
|
||||
int channels = 0;
|
||||
int alpha_depth = 0;
|
||||
int alpha_present=0;
|
||||
int alpha_present = 0;
|
||||
int row, col;
|
||||
BOOL raw, alpha_raw = FALSE;
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
@@ -222,7 +195,7 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
|
||||
/* read header of PNM file */
|
||||
|
||||
get_token(pnm_file, type_token);
|
||||
get_token (pnm_file, type_token, sizeof (type_token));
|
||||
if (type_token[0] != 'P')
|
||||
{
|
||||
return FALSE;
|
||||
@@ -232,30 +205,31 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
raw = (type_token[1] == '4');
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
get_token(pnm_file, width_token);
|
||||
get_token (pnm_file, width_token, sizeof (width_token));
|
||||
sscanf (width_token, "%lu", &ul_width);
|
||||
width = (png_uint_32) ul_width;
|
||||
get_token(pnm_file, height_token);
|
||||
get_token (pnm_file, height_token, sizeof (height_token));
|
||||
sscanf (height_token, "%lu", &ul_height);
|
||||
height = (png_uint_32) ul_height;
|
||||
bit_depth = 1;
|
||||
packed_bitmap = TRUE;
|
||||
#else
|
||||
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and \n");
|
||||
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and\n");
|
||||
fprintf (stderr, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
||||
{
|
||||
raw = (type_token[1] == '5');
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
get_token(pnm_file, width_token);
|
||||
get_token (pnm_file, width_token, sizeof (width_token));
|
||||
sscanf (width_token, "%lu", &ul_width);
|
||||
width = (png_uint_32) ul_width;
|
||||
get_token(pnm_file, height_token);
|
||||
get_token (pnm_file, height_token, sizeof (height_token));
|
||||
sscanf (height_token, "%lu", &ul_height);
|
||||
height = (png_uint_32) ul_height;
|
||||
get_token(pnm_file, maxval_token);
|
||||
get_token (pnm_file, maxval_token, sizeof (maxval_token));
|
||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||
maxval = (png_uint_32) ul_maxval;
|
||||
|
||||
@@ -267,20 +241,22 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
bit_depth = 4;
|
||||
else if (maxval <= 255)
|
||||
bit_depth = 8;
|
||||
else /* if (maxval <= 65535) */
|
||||
else if (maxval <= 65535U)
|
||||
bit_depth = 16;
|
||||
else /* maxval > 65535U */
|
||||
return FALSE;
|
||||
}
|
||||
else if ((type_token[1] == '3') || (type_token[1] == '6'))
|
||||
{
|
||||
raw = (type_token[1] == '6');
|
||||
color_type = PNG_COLOR_TYPE_RGB;
|
||||
get_token(pnm_file, width_token);
|
||||
get_token (pnm_file, width_token, sizeof (width_token));
|
||||
sscanf (width_token, "%lu", &ul_width);
|
||||
width = (png_uint_32) ul_width;
|
||||
get_token(pnm_file, height_token);
|
||||
get_token (pnm_file, height_token, sizeof (height_token));
|
||||
sscanf (height_token, "%lu", &ul_height);
|
||||
height = (png_uint_32) ul_height;
|
||||
get_token(pnm_file, maxval_token);
|
||||
get_token (pnm_file, maxval_token, sizeof (maxval_token));
|
||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||
maxval = (png_uint_32) ul_maxval;
|
||||
if (maxval <= 1)
|
||||
@@ -291,8 +267,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
bit_depth = 4;
|
||||
else if (maxval <= 255)
|
||||
bit_depth = 8;
|
||||
else /* if (maxval <= 65535) */
|
||||
else if (maxval <= 65535U)
|
||||
bit_depth = 16;
|
||||
else /* maxval > 65535U */
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -308,7 +286,7 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
if (color_type == PNG_COLOR_TYPE_RGB)
|
||||
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||
|
||||
get_token(alpha_file, type_token);
|
||||
get_token (alpha_file, type_token, sizeof (type_token));
|
||||
if (type_token[0] != 'P')
|
||||
{
|
||||
return FALSE;
|
||||
@@ -316,17 +294,17 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
||||
{
|
||||
alpha_raw = (type_token[1] == '5');
|
||||
get_token(alpha_file, width_token);
|
||||
get_token (alpha_file, width_token, sizeof (width_token));
|
||||
sscanf (width_token, "%lu", &ul_alpha_width);
|
||||
alpha_width=(png_uint_32) ul_alpha_width;
|
||||
alpha_width = (png_uint_32) ul_alpha_width;
|
||||
if (alpha_width != width)
|
||||
return FALSE;
|
||||
get_token(alpha_file, height_token);
|
||||
get_token (alpha_file, height_token, sizeof (height_token));
|
||||
sscanf (height_token, "%lu", &ul_alpha_height);
|
||||
alpha_height = (png_uint_32) ul_alpha_height;
|
||||
if (alpha_height != height)
|
||||
return FALSE;
|
||||
get_token(alpha_file, maxval_token);
|
||||
get_token (alpha_file, maxval_token, sizeof (maxval_token));
|
||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||
maxval = (png_uint_32) ul_maxval;
|
||||
if (maxval <= 1)
|
||||
@@ -337,8 +315,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
alpha_depth = 4;
|
||||
else if (maxval <= 255)
|
||||
alpha_depth = 8;
|
||||
else /* if (maxval <= 65535) */
|
||||
else if (maxval <= 65535U)
|
||||
alpha_depth = 16;
|
||||
else /* maxval > 65535U */
|
||||
return FALSE;
|
||||
if (alpha_depth != bit_depth)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -366,16 +346,29 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
if (packed_bitmap)
|
||||
{
|
||||
/* row data is as many bytes as can fit width x channels x bit_depth */
|
||||
row_bytes = (width * channels * bit_depth + 7) / 8;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
||||
}
|
||||
|
||||
if ((png_pixels = (png_byte *)
|
||||
malloc (row_bytes * height * sizeof (png_byte))) == NULL)
|
||||
if ((row_bytes == 0) ||
|
||||
((size_t) height > (size_t) (-1) / (size_t) row_bytes))
|
||||
{
|
||||
/* too big */
|
||||
return FALSE;
|
||||
}
|
||||
if ((png_pixels = (png_byte *)
|
||||
malloc ((size_t) row_bytes * (size_t) height)) == NULL)
|
||||
{
|
||||
/* out of memory */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* read data from PNM file */
|
||||
pix_ptr = png_pixels;
|
||||
@@ -383,11 +376,15 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
for (row = 0; row < (int) height; row++)
|
||||
{
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
if (packed_bitmap) {
|
||||
if (packed_bitmap)
|
||||
{
|
||||
for (i = 0; i < (int) row_bytes; i++)
|
||||
{
|
||||
/* png supports this format natively so no conversion is needed */
|
||||
*pix_ptr++ = get_data (pnm_file, 8);
|
||||
} else
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for (col = 0; col < (int) width; col++)
|
||||
@@ -395,10 +392,15 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
for (i = 0; i < (channels - alpha_present); i++)
|
||||
{
|
||||
if (raw)
|
||||
{
|
||||
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bit_depth <= 8)
|
||||
{
|
||||
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (pnm_file, bit_depth);
|
||||
@@ -407,41 +409,46 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
*pix_ptr = (png_byte) (tmp16 & 0xFF);
|
||||
pix_ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (alpha) /* read alpha-channel from pgm file */
|
||||
{
|
||||
if (alpha_raw)
|
||||
{
|
||||
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (alpha_depth <= 8)
|
||||
{
|
||||
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (alpha_file, bit_depth);
|
||||
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
||||
}
|
||||
} /* if alpha */
|
||||
} /* if packed_bitmap */
|
||||
}
|
||||
} /* end if alpha */
|
||||
} /* end if packed_bitmap */
|
||||
} /* end for col */
|
||||
} /* end for row */
|
||||
|
||||
/* prepare the standard PNG structures */
|
||||
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL), NULL, NULL,
|
||||
NULL);
|
||||
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL),
|
||||
NULL, NULL, NULL);
|
||||
if (!png_ptr)
|
||||
{
|
||||
free (png_pixels);
|
||||
png_pixels = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
info_ptr = png_create_info_struct (png_ptr);
|
||||
if (!info_ptr)
|
||||
{
|
||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
||||
png_destroy_write_struct (&png_ptr, NULL);
|
||||
free (png_pixels);
|
||||
png_pixels = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -453,12 +460,10 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* setjmp() must be called in every function that calls a PNG-reading libpng function */
|
||||
if (setjmp (png_jmpbuf(png_ptr)))
|
||||
if (setjmp (png_jmpbuf (png_ptr)))
|
||||
{
|
||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||
free (png_pixels);
|
||||
png_pixels = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -467,21 +472,20 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
|
||||
/* we're going to write more or less the same PNG as the input file */
|
||||
png_set_IHDR (png_ptr, info_ptr, width, height, bit_depth, color_type,
|
||||
(!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
(!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
/* write the file header information */
|
||||
png_write_info (png_ptr, info_ptr);
|
||||
|
||||
/* if needed we will allocate memory for an new array of row-pointers */
|
||||
if (row_pointers == (unsigned char**) NULL)
|
||||
if (row_pointers == NULL)
|
||||
{
|
||||
if ((row_pointers = (png_byte **)
|
||||
malloc (height * sizeof (png_bytep))) == NULL)
|
||||
malloc (height * sizeof (png_byte *))) == NULL)
|
||||
{
|
||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||
free (png_pixels);
|
||||
png_pixels = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -499,59 +503,60 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
/* clean up after the write, and free any memory allocated */
|
||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||
|
||||
if (row_pointers != (unsigned char**) NULL)
|
||||
if (row_pointers != NULL)
|
||||
free (row_pointers);
|
||||
if (png_pixels != (unsigned char*) NULL)
|
||||
if (png_pixels != NULL)
|
||||
free (png_pixels);
|
||||
|
||||
return TRUE;
|
||||
} /* end of pnm2png */
|
||||
|
||||
/*
|
||||
* get_token() - gets the first string after whitespace
|
||||
* get_token - gets the first string after whitespace
|
||||
*/
|
||||
|
||||
void get_token(FILE *pnm_file, char *token)
|
||||
void get_token (FILE *pnm_file, char *token_buf, size_t token_buf_size)
|
||||
{
|
||||
int i = 0;
|
||||
size_t i = 0;
|
||||
int ret;
|
||||
|
||||
/* remove white-space and comment lines */
|
||||
do
|
||||
{
|
||||
ret = fgetc(pnm_file);
|
||||
if (ret == '#') {
|
||||
ret = fgetc (pnm_file);
|
||||
if (ret == '#')
|
||||
{
|
||||
/* the rest of this line is a comment */
|
||||
do
|
||||
{
|
||||
ret = fgetc(pnm_file);
|
||||
ret = fgetc (pnm_file);
|
||||
}
|
||||
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
|
||||
}
|
||||
if (ret == EOF) break;
|
||||
token[i] = (unsigned char) ret;
|
||||
token_buf[i] = (char) ret;
|
||||
}
|
||||
while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' '));
|
||||
while ((ret == '\n') || (ret == '\r') || (ret == ' '));
|
||||
|
||||
/* read string */
|
||||
do
|
||||
{
|
||||
ret = fgetc(pnm_file);
|
||||
ret = fgetc (pnm_file);
|
||||
if (ret == EOF) break;
|
||||
i++;
|
||||
token[i] = (unsigned char) ret;
|
||||
if (++i == token_buf_size - 1) break;
|
||||
token_buf[i] = (char) ret;
|
||||
}
|
||||
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
|
||||
while ((ret != '\n') && (ret != '\r') && (ret != ' '));
|
||||
|
||||
token[i] = '\0';
|
||||
token_buf[i] = '\0';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_data() - takes first byte and converts into next pixel value,
|
||||
* taking as much bits as defined by bit-depth and
|
||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
||||
* get_data - takes first byte and converts into next pixel value,
|
||||
* taking as much bits as defined by bit-depth and
|
||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
||||
*/
|
||||
|
||||
png_uint_32 get_data (FILE *pnm_file, int depth)
|
||||
@@ -583,14 +588,14 @@ png_uint_32 get_data (FILE *pnm_file, int depth)
|
||||
}
|
||||
|
||||
/*
|
||||
* get_value() - takes first (numeric) string and converts into number,
|
||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
||||
* get_value - takes first (numeric) string and converts into number,
|
||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
||||
*/
|
||||
|
||||
png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||
{
|
||||
static png_uint_32 mask = 0;
|
||||
png_byte token[16];
|
||||
char token[16];
|
||||
unsigned long ul_ret_value;
|
||||
png_uint_32 ret_value;
|
||||
int i = 0;
|
||||
@@ -599,8 +604,8 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||
for (i = 0; i < depth; i++)
|
||||
mask = (mask << 1) | 0x01;
|
||||
|
||||
get_token (pnm_file, (char *) token);
|
||||
sscanf ((const char *) token, "%lu", &ul_ret_value);
|
||||
get_token (pnm_file, token, sizeof (token));
|
||||
sscanf (token, "%lu", &ul_ret_value);
|
||||
ret_value = (png_uint_32) ul_ret_value;
|
||||
|
||||
ret_value &= mask;
|
||||
@@ -613,4 +618,3 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||
}
|
||||
|
||||
/* end of source */
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# -- full-color
|
||||
./pnm2png basn2c08.ppm basn2c08.png
|
||||
./pnm2png basn2c16.ppm basn2c16.png
|
||||
# -- palletted
|
||||
# -- paletted
|
||||
./pnm2png basn3p01.ppm basn3p01.png
|
||||
./pnm2png basn3p02.ppm basn3p02.png
|
||||
./pnm2png basn3p04.ppm basn3p04.png
|
||||
@@ -28,7 +28,7 @@
|
||||
# -- full-color
|
||||
./pnm2png rawn2c08.ppm rawn2c08.png
|
||||
./pnm2png rawn2c16.ppm rawn2c16.png
|
||||
# -- palletted
|
||||
# -- paletted
|
||||
./pnm2png rawn3p01.ppm rawn3p01.png
|
||||
./pnm2png rawn3p02.ppm rawn3p02.png
|
||||
./pnm2png rawn3p04.ppm rawn3p04.png
|
||||
|
||||
@@ -16,6 +16,8 @@ chunks, etc.
|
||||
The "ft*.png" images are "free/libre" replacements for the transparent
|
||||
corresponding t*.png images in the PngSuite.
|
||||
|
||||
The "i*.png" images are the same images, but interlaced.
|
||||
|
||||
The images in this directory represent the basic PNG color-types:
|
||||
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
||||
(1-8 bit) and grayscale or color images with alpha channel. You
|
||||
@@ -101,5 +103,5 @@ Testing basn6a16.png: PASS (1072 zero samples)
|
||||
libpng passes test
|
||||
|
||||
Willem van Schaik
|
||||
<willem@schaik.com>
|
||||
<willem at schaik.com>
|
||||
October 1999
|
||||
|
||||
9
contrib/pngsuite/bad_interlace_conversions.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
basn0g01.png
|
||||
basn0g02.png
|
||||
basn0g04.png
|
||||
basn3p01.png
|
||||
basn3p02.png
|
||||
basn3p04.png
|
||||
ftbbn0g01.png
|
||||
ftbbn0g02.png
|
||||
ftbbn0g04.png
|
||||
BIN
contrib/pngsuite/ibasn0g08.png
Normal file
|
After Width: | Height: | Size: 237 B |
BIN
contrib/pngsuite/ibasn0g16.png
Normal file
|
After Width: | Height: | Size: 274 B |
BIN
contrib/pngsuite/ibasn2c08.png
Normal file
|
After Width: | Height: | Size: 299 B |
BIN
contrib/pngsuite/ibasn2c16.png
Normal file
|
After Width: | Height: | Size: 558 B |
BIN
contrib/pngsuite/ibasn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/ibasn4a08.png
Normal file
|
After Width: | Height: | Size: 198 B |
BIN
contrib/pngsuite/ibasn4a16.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
contrib/pngsuite/ibasn6a08.png
Normal file
|
After Width: | Height: | Size: 339 B |
BIN
contrib/pngsuite/ibasn6a16.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
contrib/pngsuite/iftbbn2c16.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
contrib/pngsuite/iftbbn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftbgn2c16.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
contrib/pngsuite/iftbgn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftbrn2c08.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
contrib/pngsuite/iftbwn0g16.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
contrib/pngsuite/iftbwn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftbyn3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftp0n0g08.png
Normal file
|
After Width: | Height: | Size: 847 B |
BIN
contrib/pngsuite/iftp0n2c08.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
contrib/pngsuite/iftp0n3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftp1n3p08.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
2
contrib/pngsuite/interlaced/README
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
These images fail the "pngimage-quick" and "pngimage-full" tests.
|
||||
BIN
contrib/pngsuite/interlaced/ibasn0g01.png
Normal file
|
After Width: | Height: | Size: 201 B |
BIN
contrib/pngsuite/interlaced/ibasn0g02.png
Normal file
|
After Width: | Height: | Size: 138 B |
BIN
contrib/pngsuite/interlaced/ibasn0g04.png
Normal file
|
After Width: | Height: | Size: 231 B |