Compare commits
1456 Commits
libpng-1.6
...
v1.6.41
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba980b8f0c | ||
|
|
27e548af25 | ||
|
|
92b2128a75 | ||
|
|
6159bad8a9 | ||
|
|
3285bf0d4c | ||
|
|
4edbb4da81 | ||
|
|
9a774b9156 | ||
|
|
671661849a | ||
|
|
438a518611 | ||
|
|
8fb49b8b94 | ||
|
|
144b348e07 | ||
|
|
1a0d7a7481 | ||
|
|
866fdf6f8f | ||
|
|
6f8257e437 | ||
|
|
269b753496 | ||
|
|
2b814cde29 | ||
|
|
893b8113f0 | ||
|
|
7ec2bd28c7 | ||
|
|
70d10da35c | ||
|
|
064f992187 | ||
|
|
46f1106a3f | ||
|
|
a7fe3414e5 | ||
|
|
ce4b632dd7 | ||
|
|
6b0d1bd75b | ||
|
|
2a4f0f5aee | ||
|
|
7dacc4d5aa | ||
|
|
da109d3e6e | ||
|
|
f9348b77da | ||
|
|
2ea11e2235 | ||
|
|
b60316f4ee | ||
|
|
050ce505e4 | ||
|
|
2a23247420 | ||
|
|
6b241f3786 | ||
|
|
b3521c60af | ||
|
|
6beae586d6 | ||
|
|
bdbbcaa457 | ||
|
|
abb8d4a71f | ||
|
|
c993ae4c67 | ||
|
|
6abf8c1e91 | ||
|
|
0dfe422e9f | ||
|
|
71b9b5e16e | ||
|
|
9f9f8d8e63 | ||
|
|
437b24a958 | ||
|
|
2ed5a70bca | ||
|
|
85f866dea3 | ||
|
|
2fff013a69 | ||
|
|
acfd50ae0b | ||
|
|
8fc13a8704 | ||
|
|
1460b3ce78 | ||
|
|
e1088f99d4 | ||
|
|
d65b3ebf00 | ||
|
|
a3d1a35b98 | ||
|
|
9c1dc4d13d | ||
|
|
e755fb79ba | ||
|
|
f79c85e22d | ||
|
|
53d2188fa5 | ||
|
|
f2294569cf | ||
|
|
1547b335e4 | ||
|
|
b2ef6edbe8 | ||
|
|
5a6ea1822b | ||
|
|
22ad62c25e | ||
|
|
71475b064f | ||
|
|
ee9d6d7bf2 | ||
|
|
f8e5fa92b0 | ||
|
|
c81516e943 | ||
|
|
0b7bc40de1 | ||
|
|
82414985c1 | ||
|
|
c0616f1017 | ||
|
|
c741d1e392 | ||
|
|
ad9e42a877 | ||
|
|
d7f77bf271 | ||
|
|
f135775ad4 | ||
|
|
afc6c595bf | ||
|
|
e6c5bf46c4 | ||
|
|
8be5c147d5 | ||
|
|
f7abe3c419 | ||
|
|
82097c2108 | ||
|
|
e519af8b49 | ||
|
|
efc96c9d59 | ||
|
|
aab24fa1b3 | ||
|
|
efa9c2e920 | ||
|
|
c22ef3b2e3 | ||
|
|
66fede80d2 | ||
|
|
59fa76e164 | ||
|
|
70fda1837d | ||
|
|
aeb26da4cb | ||
|
|
cd0ea2a7f5 | ||
|
|
9923515ff4 | ||
|
|
61bfdb0cb0 | ||
|
|
9db8cff6ef | ||
|
|
b445aade83 | ||
|
|
3c152a8ef7 | ||
|
|
5a0b7e9c29 | ||
|
|
b126f80710 | ||
|
|
3c761b5135 | ||
|
|
07b8803110 | ||
|
|
32f465a66b | ||
|
|
074e2eaab0 | ||
|
|
790fef342b | ||
|
|
8a5732fcb3 | ||
|
|
77c3a39299 | ||
|
|
8cfdb5436d | ||
|
|
f6036c0aeb | ||
|
|
689e06516b | ||
|
|
33de006e12 | ||
|
|
9b5488054b | ||
|
|
04c016d79f | ||
|
|
b8ca9108ac | ||
|
|
e56f79c0c6 | ||
|
|
12222e6fbd | ||
|
|
9b65ad49d3 | ||
|
|
3f991d5092 | ||
|
|
b422bc1181 | ||
|
|
6fc5119423 | ||
|
|
0a158f3506 | ||
|
|
50d7a85154 | ||
|
|
2733482d8e | ||
|
|
3d57708c91 | ||
|
|
abccfd7968 | ||
|
|
823ef44f01 | ||
|
|
d72cda543c | ||
|
|
3c67eeca51 | ||
|
|
b60656ecdc | ||
|
|
c64655d058 | ||
|
|
8b7b99c1db | ||
|
|
62c027d4df | ||
|
|
e9e9801a84 | ||
|
|
0c2388cdae | ||
|
|
9cb84c4cb9 | ||
|
|
8c542ad9df | ||
|
|
2abaf81e0f | ||
|
|
ad0245bb96 | ||
|
|
1f974dd2a9 | ||
|
|
3ec225dd41 | ||
|
|
36bd1bbd54 | ||
|
|
0406deb1ca | ||
|
|
5f5f98a1a9 | ||
|
|
f10c6bb603 | ||
|
|
f16427e58e | ||
|
|
6aff792b66 | ||
|
|
ed8840a36f | ||
|
|
efdb24e54b | ||
|
|
1f20bc1e85 | ||
|
|
bbab57105b | ||
|
|
a1a81cc2ac | ||
|
|
c3a1d8424c | ||
|
|
eda0f47f46 | ||
|
|
3848c73ab4 | ||
|
|
dd8db8105c | ||
|
|
763c77e628 | ||
|
|
840af2eda6 | ||
|
|
8a354b41e9 | ||
|
|
0fe598d2f6 | ||
|
|
cbf8c64b58 | ||
|
|
6a42bc1c8e | ||
|
|
9e32b6f1ad | ||
|
|
cc0e959722 | ||
|
|
403422674d | ||
|
|
bfb0abe4d9 | ||
|
|
081e6751ab | ||
|
|
103f8346e3 | ||
|
|
723b2d9f2e | ||
|
|
b7ea74c97d | ||
|
|
8c3fdb0ac1 | ||
|
|
a37d483651 | ||
|
|
3796518809 | ||
|
|
8ca01083d6 | ||
|
|
cd03aaf7bf | ||
|
|
c4bd411c35 | ||
|
|
2224c8ea7b | ||
|
|
e2bb5e7512 | ||
|
|
d6e13b2acd | ||
|
|
c2e2cd2ec5 | ||
|
|
c3f209178b | ||
|
|
dbe3e0c43e | ||
|
|
2f753e260c | ||
|
|
f5d5f5ae0e | ||
|
|
3676fd324a | ||
|
|
28c0f8895e | ||
|
|
87378bc21d | ||
|
|
6c6f7d105a | ||
|
|
6842c58adc | ||
|
|
a6fc80300f | ||
|
|
5e8b45c436 | ||
|
|
6dd99ca9c8 | ||
|
|
52ee167644 | ||
|
|
eb6767273a | ||
|
|
9f734b13f4 | ||
|
|
3cec1a16f5 | ||
|
|
50bd1abdb1 | ||
|
|
2dd5630eae | ||
|
|
b9155ce3fd | ||
|
|
2c0aee56a0 | ||
|
|
301f7a1429 | ||
|
|
386707c6d1 | ||
|
|
216387f6f7 | ||
|
|
b9e811fa99 | ||
|
|
cdbb8ec7aa | ||
|
|
72fa126446 | ||
|
|
5df8e982e2 | ||
|
|
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 | ||
|
|
eb5cdf0c64 | ||
|
|
0c29ab2b31 | ||
|
|
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 |
78
.appveyor.yml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
version: 1.6.x-{build}
|
||||||
|
|
||||||
|
branches:
|
||||||
|
except:
|
||||||
|
- /libpng[0-1][0-7]/
|
||||||
|
|
||||||
|
image:
|
||||||
|
- Visual Studio 2022
|
||||||
|
|
||||||
|
shallow_clone: true
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- TOOLCHAIN: vstudio
|
||||||
|
AUTOMATION: cmake
|
||||||
|
ARCH: x86
|
||||||
|
- TOOLCHAIN: vstudio
|
||||||
|
AUTOMATION: cmake
|
||||||
|
ARCH: x64
|
||||||
|
- TOOLCHAIN: vstudio
|
||||||
|
AUTOMATION: cmake
|
||||||
|
ARCH: arm64
|
||||||
|
- TOOLCHAIN: llvm
|
||||||
|
AUTOMATION: cmake
|
||||||
|
ARCH: x64
|
||||||
|
- TOOLCHAIN: msys2
|
||||||
|
AUTOMATION: cmake
|
||||||
|
ARCH: i686
|
||||||
|
- TOOLCHAIN: msys2
|
||||||
|
AUTOMATION: cmake
|
||||||
|
ARCH: x86_64
|
||||||
|
- TOOLCHAIN: msys2
|
||||||
|
AUTOMATION: configure
|
||||||
|
ARCH: i686
|
||||||
|
- TOOLCHAIN: msys2
|
||||||
|
AUTOMATION: configure
|
||||||
|
ARCH: x86_64
|
||||||
|
- TOOLCHAIN: msys2
|
||||||
|
AUTOMATION: makefiles
|
||||||
|
ARCH: i686
|
||||||
|
- TOOLCHAIN: msys2
|
||||||
|
AUTOMATION: makefiles
|
||||||
|
ARCH: x86_64
|
||||||
|
|
||||||
|
install:
|
||||||
|
- 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe install zlib:%ARCH%-windows'
|
||||||
|
- 'if "%TOOLCHAIN%"=="vstudio" C:\tools\vcpkg\vcpkg.exe integrate install'
|
||||||
|
- 'if "%TOOLCHAIN%"=="llvm" C:\tools\vcpkg\vcpkg.exe install zlib:%ARCH%-windows'
|
||||||
|
- 'if "%TOOLCHAIN%"=="llvm" C:\tools\vcpkg\vcpkg.exe integrate install'
|
||||||
|
|
||||||
|
before_build:
|
||||||
|
- 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_GENERATOR=Visual Studio 17 2022'
|
||||||
|
- 'if "%TOOLCHAIN%"=="vstudio" set CI_CMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake'
|
||||||
|
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x86" set CI_CMAKE_GENERATOR_PLATFORM=Win32'
|
||||||
|
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="x64" set CI_CMAKE_GENERATOR_PLATFORM=x64'
|
||||||
|
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="arm64" set CI_CMAKE_GENERATOR_PLATFORM=ARM64'
|
||||||
|
- 'if "%TOOLCHAIN%"=="vstudio" if "%ARCH%"=="arm64" set CI_CMAKE_VARS=-DPNG_TESTS=0'
|
||||||
|
- 'if "%TOOLCHAIN%"=="llvm" set CI_CMAKE_GENERATOR=Ninja'
|
||||||
|
- 'if "%TOOLCHAIN%"=="llvm" set CI_CMAKE_TOOLCHAIN_FILE=C:\tools\vcpkg\scripts\buildsystems\vcpkg.cmake'
|
||||||
|
- 'if "%TOOLCHAIN%"=="llvm" set CI_CC=clang.exe'
|
||||||
|
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" set CI_CMAKE_GENERATOR=Unix Makefiles'
|
||||||
|
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="i686" set PATH=C:\msys64\mingw32\bin;%PATH%'
|
||||||
|
- 'if "%TOOLCHAIN%"=="msys2" if "%ARCH%"=="x86_64" set PATH=C:\msys64\mingw64\bin;%PATH%'
|
||||||
|
- 'if "%TOOLCHAIN%"=="msys2" set CI_CC=%ARCH%-w64-mingw32-gcc.exe'
|
||||||
|
- 'set CI_CMAKE_BUILD_FLAGS=-j2'
|
||||||
|
- 'set CI_CTEST_FLAGS=-j2'
|
||||||
|
- 'set CI_MAKE_FLAGS=-j2'
|
||||||
|
- 'set CI_MAKEFILES=scripts/makefile.gcc scripts/makefile.msys scripts/makefile.std'
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- 'if "%TOOLCHAIN%"=="vstudio" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_cmake.sh"'
|
||||||
|
- 'if "%TOOLCHAIN%"=="llvm" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_cmake.sh"'
|
||||||
|
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="cmake" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_cmake.sh"'
|
||||||
|
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="configure" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_configure.sh"'
|
||||||
|
- 'if "%TOOLCHAIN%"=="msys2" if "%AUTOMATION%"=="makefiles" C:\msys64\usr\bin\bash.exe -l "%APPVEYOR_BUILD_FOLDER%\ci\ci_verify_makefiles.sh"'
|
||||||
|
|
||||||
|
cache:
|
||||||
|
- C:\tools\vcpkg\installed
|
||||||
79
.gitignore
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Precompiled headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Linker output files
|
||||||
|
*.exp
|
||||||
|
*.ilk
|
||||||
|
*.map
|
||||||
|
|
||||||
|
# Compiled dynamic libraries
|
||||||
|
*.dll
|
||||||
|
*.dylib
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
|
||||||
|
# Compiled static libraries
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lai
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Compiled executables
|
||||||
|
*.app/
|
||||||
|
*.exe
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
||||||
|
*.idb
|
||||||
|
*.pdb
|
||||||
|
*.su
|
||||||
|
|
||||||
|
# Libpng configuration and build artifacts
|
||||||
|
*.out
|
||||||
|
.deps/
|
||||||
|
.dirstamp
|
||||||
|
/Makefile
|
||||||
|
/autom4te.cache/
|
||||||
|
/config.guess~
|
||||||
|
/config.h.in~
|
||||||
|
/config.log
|
||||||
|
/config.status
|
||||||
|
/config.sub~
|
||||||
|
/configure~
|
||||||
|
/install-sh~
|
||||||
|
/libpng-config
|
||||||
|
/libpng.pc
|
||||||
|
/libpng.vers
|
||||||
|
/libpng16-config
|
||||||
|
/libpng16.pc
|
||||||
|
/libtool
|
||||||
|
/stamp-h1
|
||||||
|
pnglibconf.[ch]
|
||||||
|
pnglibconf.dfn
|
||||||
|
pnglibconf.pre
|
||||||
|
pngprefix.h
|
||||||
|
|
||||||
|
# Libpng test artifacts
|
||||||
|
png-fix-itxt
|
||||||
|
pngcp
|
||||||
|
pngfix
|
||||||
|
pngimage
|
||||||
|
pngstest
|
||||||
|
pngtest
|
||||||
|
pngunknown
|
||||||
|
pngvalid
|
||||||
|
timepng
|
||||||
|
pngout.png
|
||||||
|
|
||||||
|
# Libpng CI artifacts
|
||||||
|
out/
|
||||||
33
.travis.yml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
branches:
|
||||||
|
except:
|
||||||
|
- /libpng[0-1][0-7]/
|
||||||
|
|
||||||
|
language: c
|
||||||
|
|
||||||
|
os:
|
||||||
|
- freebsd
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
|
|
||||||
|
env:
|
||||||
|
- AUTOMATION=cmake CI_CMAKE_VARS="-DPNG_HARDWARE_OPTIMIZATIONS=ON"
|
||||||
|
- AUTOMATION=cmake CI_CMAKE_VARS="-DPNG_HARDWARE_OPTIMIZATIONS=OFF"
|
||||||
|
- AUTOMATION=configure CI_CONFIGURE_FLAGS="--enable-hardware-optimizations"
|
||||||
|
- AUTOMATION=configure CI_CONFIGURE_FLAGS="--disable-hardware-optimizations"
|
||||||
|
- AUTOMATION=makefiles
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: osx
|
||||||
|
env: AUTOMATION=cmake CI_CMAKE_GENERATOR=Xcode
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- 'if test "$TRAVIS_OS_NAME" = "linux"; then export CI_CC="gcc"; else export CI_CC="clang"; fi'
|
||||||
|
- 'if test "$TRAVIS_OS_NAME" != "osx"; then export CI_SANITIZERS="address,undefined"; fi'
|
||||||
|
- 'export CI_MAKEFILES="scripts/makefile.$CI_CC scripts/makefile.std"'
|
||||||
|
- 'export CI_MAKE_FLAGS=-j2'
|
||||||
|
- 'export CI_CMAKE_BUILD_FLAGS=-j2'
|
||||||
|
- 'export CI_CTEST_FLAGS=-j2'
|
||||||
|
|
||||||
|
script:
|
||||||
|
- './ci/ci_verify_$AUTOMATION.sh'
|
||||||
5
.yamllint.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
extends: default
|
||||||
|
rules:
|
||||||
|
document-start: disable
|
||||||
|
document-end: disable
|
||||||
|
line-length: disable
|
||||||
104
ANNOUNCE
@@ -1,64 +1,66 @@
|
|||||||
Libpng 1.6.26 - October 20, 2016
|
libpng 1.6.41 - January 24, 2024
|
||||||
|
================================
|
||||||
|
|
||||||
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
|
Files available for download
|
||||||
"configure" script
|
----------------------------
|
||||||
|
|
||||||
libpng-1.6.26.tar.xz (LZMA-compressed, recommended)
|
Source files with LF line endings (for Unix/Linux):
|
||||||
libpng-1.6.26.tar.gz
|
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
* libpng-1.6.41.tar.xz (LZMA-compressed, recommended)
|
||||||
"configure" script
|
* libpng-1.6.41.tar.gz (deflate-compressed)
|
||||||
|
|
||||||
lpng1626.7z (LZMA-compressed, recommended)
|
Source files with CRLF line endings (for Windows):
|
||||||
lpng1626.zip
|
|
||||||
|
* lpng1641.7z (LZMA-compressed, recommended)
|
||||||
|
* lpng1641.zip (deflate-compressed)
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
libpng-1.6.26-README.txt
|
* README.md
|
||||||
libpng-1.6.26-LICENSE.txt
|
* LICENSE.md
|
||||||
libpng-1.6.26-*.asc (armored detached GPG signatures)
|
* AUTHORS.md
|
||||||
|
* TRADEMARK.md
|
||||||
|
|
||||||
Changes since the last public release (1.6.25):
|
|
||||||
|
|
||||||
Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
|
Changes from version 1.6.40 to version 1.6.41
|
||||||
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
|
|
||||||
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 the 144 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.
|
|
||||||
Quieted (bogus?) clang warnings about "absolute value has no effect"
|
|
||||||
when PNG_USE_ABS is defined.
|
|
||||||
Fixed offsets in contrib/intel/intel_sse.patch
|
|
||||||
Changed integer constant 4294967294 to unsigned 4294967294U in pngconf.h
|
|
||||||
to avoid a signed/unsigned compare in the preprocessor.
|
|
||||||
Use zlib-1.2.8.1 inflateValidate() instead of inflateReset2() to
|
|
||||||
optionally avoid ADLER32 evaluation.
|
|
||||||
Cosmetic change, "ptr != 0" to "ptr != NULL" in png.c and pngrutil.c
|
|
||||||
Despammed email addresses (replaced "@" with " at ").
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
* Added SIMD-optimized code for the Loongarch LSX hardware.
|
||||||
(subscription required; visit
|
(Contributed by GuXiWei, JinBo and ZhangLixia)
|
||||||
|
* Fixed the run-time discovery of MIPS MSA hardware.
|
||||||
|
(Contributed by Sui Jingfeng)
|
||||||
|
* Fixed an off-by-one error in the function `png_do_check_palette_indexes`,
|
||||||
|
which failed to recognize errors that might have existed in the first
|
||||||
|
column of a broken palette-encoded image. This was a benign regression
|
||||||
|
accidentally introduced in libpng-1.6.33. No pixel was harmed.
|
||||||
|
(Contributed by Adam Richter; reviewed by John Bowler)
|
||||||
|
* Fixed, improved and modernized the contrib/pngminus programs, i.e.,
|
||||||
|
png2pnm.c and pnm2png.c
|
||||||
|
* Removed old and peculiar portability hacks that were meant to silence
|
||||||
|
warnings issued by gcc version 7.1 alone.
|
||||||
|
(Contributed by John Bowler)
|
||||||
|
* Fixed and modernized the CMake file, and raised the minimum required
|
||||||
|
CMake version from 3.1 to 3.6.
|
||||||
|
(Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.)
|
||||||
|
* Allowed the configure script to disable the building of auxiliary tools
|
||||||
|
and tests, thus catching up with the CMake file.
|
||||||
|
(Contributed by Carlo Bramini)
|
||||||
|
* Fixed a build issue on Mac.
|
||||||
|
(Contributed by Zixu Wang)
|
||||||
|
* Moved the Autoconf macro files to scripts/autoconf.
|
||||||
|
* Moved the CMake files (except for the main CMakeLists.txt) to
|
||||||
|
scripts/cmake and moved the list of their contributing authors to
|
||||||
|
scripts/cmake/AUTHORS.md
|
||||||
|
* Updated the CI configurations and scripts.
|
||||||
|
* Relicensed the CI scripts to the MIT License.
|
||||||
|
* Improved the test coverage.
|
||||||
|
(Contributed by John Bowler)
|
||||||
|
|
||||||
|
|
||||||
|
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
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe)
|
to subscribe.
|
||||||
or to glennrp at users.sourceforge.net
|
|
||||||
|
|
||||||
Glenn R-P
|
|
||||||
|
|||||||
60
AUTHORS
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
PNG REFERENCE LIBRARY AUTHORS
|
||||||
|
=============================
|
||||||
|
|
||||||
|
This is the list of PNG Reference Library ("libpng") Contributing
|
||||||
|
Authors, for copyright and licensing purposes.
|
||||||
|
|
||||||
|
* Adam Richter
|
||||||
|
* 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
|
||||||
|
* Pascal Massimino
|
||||||
|
* Paul Schmidt
|
||||||
|
* Philippe Antoine
|
||||||
|
* Qiang Zhou
|
||||||
|
* Sam Bushell
|
||||||
|
* Samuel Williams
|
||||||
|
* Simon-Pierre Cadieux
|
||||||
|
* Tim Wegner
|
||||||
|
* Tom Lane
|
||||||
|
* Tom Tanner
|
||||||
|
* Vadim Barkov
|
||||||
|
* Willem van Schaik
|
||||||
|
* Zhijie Liang
|
||||||
|
* Apple Inc.
|
||||||
|
- Zixu Wang (王子旭)
|
||||||
|
* Arm Holdings
|
||||||
|
- Richard Townsend
|
||||||
|
* Google Inc.
|
||||||
|
- Dan Field
|
||||||
|
- Leon Scroggins III
|
||||||
|
- Matt Sarett
|
||||||
|
- Mike Klein
|
||||||
|
- Sami Boukortt
|
||||||
|
- Wan-Teh Chang
|
||||||
|
* Loongson Technology Corporation Ltd.
|
||||||
|
- GuXiWei (顾希伟)
|
||||||
|
- JinBo (金波)
|
||||||
|
- ZhangLixia (张利霞)
|
||||||
|
|
||||||
|
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 "ci" and "contrib" directories, as well as some
|
||||||
|
of the tools-generated files that are distributed with libpng, have
|
||||||
|
other copyright owners, and are released under other open source
|
||||||
|
licenses.
|
||||||
455
CHANGES
@@ -1,4 +1,3 @@
|
|||||||
#if 0
|
|
||||||
CHANGES - changes for libpng
|
CHANGES - changes for libpng
|
||||||
|
|
||||||
version 0.1 [March 29, 1995]
|
version 0.1 [March 29, 1995]
|
||||||
@@ -205,7 +204,7 @@ Version 0.97 [January, 1998]
|
|||||||
Added simple sRGB support (Glenn R-P)
|
Added simple sRGB support (Glenn R-P)
|
||||||
Easier conditional compiling, e.g.,
|
Easier conditional compiling, e.g.,
|
||||||
define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
|
define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
|
||||||
all configurable options can be selected from command-line instead
|
all configurable options can be selected from command line instead
|
||||||
of having to edit pngconf.h (Glenn R-P)
|
of having to edit pngconf.h (Glenn R-P)
|
||||||
Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P)
|
Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P)
|
||||||
Added more conditions for png_do_background, to avoid changing
|
Added more conditions for png_do_background, to avoid changing
|
||||||
@@ -833,7 +832,7 @@ Version 1.0.7beta11 [May 7, 2000]
|
|||||||
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
||||||
which are no longer used.
|
which are no longer used.
|
||||||
Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is
|
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.
|
is defined.
|
||||||
Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory
|
Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory
|
||||||
overrun when old applications fill the info_ptr->text structure directly.
|
overrun when old applications fill the info_ptr->text structure directly.
|
||||||
@@ -943,7 +942,7 @@ Version 1.0.8 [July 24, 2000]
|
|||||||
Version 1.0.9beta1 [November 10, 2000]
|
Version 1.0.9beta1 [November 10, 2000]
|
||||||
Fixed typo in scripts/makefile.hpux
|
Fixed typo in scripts/makefile.hpux
|
||||||
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
|
Updated makevms.com in scripts and contrib/* and contrib/* (Martin Zinser)
|
||||||
Fixed seqence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
|
Fixed sequence-point bug in contrib/pngminus/png2pnm (Martin Zinser)
|
||||||
Changed "cdrom.com" in documentation to "libpng.org"
|
Changed "cdrom.com" in documentation to "libpng.org"
|
||||||
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
|
Revised pnggccrd.c to get it all working, and updated makefile.gcmmx (Greg).
|
||||||
Changed type of "params" from voidp to png_voidp in png_read|write_png().
|
Changed type of "params" from voidp to png_voidp in png_read|write_png().
|
||||||
@@ -1454,7 +1453,7 @@ Version 1.2.6beta4 [July 28, 2004]
|
|||||||
sequential read support.
|
sequential read support.
|
||||||
Added some "#if PNG_WRITE_SUPPORTED" blocks.
|
Added some "#if PNG_WRITE_SUPPORTED" blocks.
|
||||||
Added #ifdef to remove some redundancy in png_malloc_default().
|
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]
|
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
|
||||||
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
|
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
|
||||||
@@ -2296,7 +2295,7 @@ Version 1.4.0beta58 [May 14, 2009]
|
|||||||
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
|
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
|
||||||
|
|
||||||
Version 1.4.0beta59 [May 15, 2009]
|
Version 1.4.0beta59 [May 15, 2009]
|
||||||
Reformated sources in libpng style (3-space intentation, comment format)
|
Reformatted sources in libpng style (3-space indentation, comment format)
|
||||||
Fixed typo in libpng docs (PNG_FILTER_AVE should be PNG_FILTER_AVG)
|
Fixed typo in libpng docs (PNG_FILTER_AVE should be PNG_FILTER_AVG)
|
||||||
Added sections about the git repository and our coding style to the
|
Added sections about the git repository and our coding style to the
|
||||||
documentation
|
documentation
|
||||||
@@ -2662,7 +2661,7 @@ Version 1.4.1beta06 [January 28, 2010]
|
|||||||
|
|
||||||
Version 1.4.1beta07 [February 6, 2010]
|
Version 1.4.1beta07 [February 6, 2010]
|
||||||
Folded some long lines in the source files.
|
Folded some long lines in the source files.
|
||||||
Added defineable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX,
|
Added definable PNG_USER_CHUNK_CACHE_MAX, PNG_USER_CHUNK_MALLOC_MAX,
|
||||||
and a PNG_USER_LIMITS_SUPPORTED flag.
|
and a PNG_USER_LIMITS_SUPPORTED flag.
|
||||||
Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as
|
Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as
|
||||||
png_ptr->png_user_chunk_malloc_max.
|
png_ptr->png_user_chunk_malloc_max.
|
||||||
@@ -3259,7 +3258,7 @@ Version 1.5.2beta01 [February 13, 2011]
|
|||||||
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
|
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
|
||||||
old VisualC++ preprocessor.
|
old VisualC++ preprocessor.
|
||||||
Turned on interlace handling in png_read_png().
|
Turned on interlace handling in png_read_png().
|
||||||
Fixed gcc pendantic warnings.
|
Fixed gcc pedantic warnings.
|
||||||
Handle longjmp in Cygwin.
|
Handle longjmp in Cygwin.
|
||||||
Fixed png_get_current_row_number() in the interlaced case.
|
Fixed png_get_current_row_number() in the interlaced case.
|
||||||
Cleaned up ALPHA flags and transformations.
|
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
|
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.
|
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
|
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
|
IDAT compression failed if preceded by a compressed text chunk (bug
|
||||||
introduced in libpng-1.5.3beta01-02). This was because the attempt to
|
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
|
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.
|
Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
|
||||||
|
|
||||||
Version 1.5.6beta06 [October 17, 2011]
|
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
|
Fixed a relatively harmless memory overwrite in compressed text writing
|
||||||
with a 1 byte zlib buffer.
|
with a 1 byte zlib buffer.
|
||||||
Add ability to call png_read_update_info multiple times to pngvalid.c.
|
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
|
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.
|
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
|
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
|
token from @-@-@ to PNG_JOIN; that should work with all compiler
|
||||||
preprocessors.
|
preprocessors.
|
||||||
Paeth filter speed improvements from work by Siarhei Siamashka. This
|
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.
|
gray (on palette) itself.
|
||||||
Fixes for C++ compilation using g++ When libpng source is compiled
|
Fixes for C++ compilation using g++ When libpng source is compiled
|
||||||
using g++. The compiler imposes C++ rules on the C source; thus it
|
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
|
without throwing away useful error information. This change adds
|
||||||
png_voidcast to allow C semantic (void*) cases or the corresponding
|
png_voidcast to allow C semantic (void*) cases or the corresponding
|
||||||
C++ static_cast operation, as appropriate.
|
C++ static_cast operation, as appropriate.
|
||||||
@@ -3887,7 +3886,7 @@ Version 1.6.0beta06 [January 24, 2012]
|
|||||||
Version 1.6.0beta07 [January 28, 2012]
|
Version 1.6.0beta07 [January 28, 2012]
|
||||||
Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
|
Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
|
||||||
compiler issues slightly different warnings from those issued by the
|
compiler issues slightly different warnings from those issued by the
|
||||||
current vesions of GCC. This eliminates those warnings by
|
current versions of GCC. This eliminates those warnings by
|
||||||
adding/removing casts and small code rewrites.
|
adding/removing casts and small code rewrites.
|
||||||
Updated configure.ac from autoupdate: added --enable-werror option.
|
Updated configure.ac from autoupdate: added --enable-werror option.
|
||||||
Also some layout regularization and removal of introduced tab characters
|
Also some layout regularization and removal of introduced tab characters
|
||||||
@@ -3920,7 +3919,7 @@ Version 1.6.0beta08 [February 1, 2012]
|
|||||||
version checking to configure.ac
|
version checking to configure.ac
|
||||||
Improved pngstest speed by not doing redundant tests and add const to
|
Improved pngstest speed by not doing redundant tests and add const to
|
||||||
the background parameter of png_image_finish_read. The --background
|
the background parameter of png_image_finish_read. The --background
|
||||||
option is now done automagically only when required, so that commandline
|
option is now done automagically only when required, so that command-line
|
||||||
option no longer exists.
|
option no longer exists.
|
||||||
Cleaned up pngpriv.h to consistently declare all functions and data.
|
Cleaned up pngpriv.h to consistently declare all functions and data.
|
||||||
Also eliminated PNG_CONST_DATA, which is apparently not needed but we
|
Also eliminated PNG_CONST_DATA, which is apparently not needed but we
|
||||||
@@ -4061,7 +4060,7 @@ Version 1.6.0beta17 [March 10, 2012]
|
|||||||
possible to call png_inflate() incrementally. A warning is no longer
|
possible to call png_inflate() incrementally. A warning is no longer
|
||||||
issued if the language tag or translated keyword in the iTXt chunk
|
issued if the language tag or translated keyword in the iTXt chunk
|
||||||
has zero length.
|
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
|
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
|
chunks could end up with a too-small windowBits value in the deflate
|
||||||
header.
|
header.
|
||||||
@@ -4176,7 +4175,7 @@ Version 1.6.0beta27 [August 11, 2012]
|
|||||||
declared even though the functions are never actually defined. This
|
declared even though the functions are never actually defined. This
|
||||||
change provides a dummy definition so that the declarations work, yet any
|
change provides a dummy definition so that the declarations work, yet any
|
||||||
implementation will fail to compile because of an incomplete type.
|
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
|
strcpy() was accidentally re-introduced in libpng16; this change replaces
|
||||||
it with strncpy().
|
it with strncpy().
|
||||||
Eliminated use of png_sizeof(); use sizeof() instead.
|
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.
|
resulting in VS2010 having to update the files.
|
||||||
Removed non-working ICC profile support code that was mostly added to
|
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
|
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.
|
up to applications.
|
||||||
|
|
||||||
Version 1.6.0beta32 [November 25, 2012]
|
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
|
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
|
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
|
||||||
decision about whether or not to use the optimizations.
|
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
|
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
|
||||||
on __ARM_NEON__ from configure time to compile time. This breaks symbol
|
on __ARM_NEON__ from configure time to compile time. This breaks symbol
|
||||||
prefixing because the definition of the special png_init_filter_functions
|
prefixing because the definition of the special png_init_filter_functions
|
||||||
@@ -5635,7 +5634,7 @@ Version 1.6.24beta02 [June 23, 2016]
|
|||||||
to All and adds a list of the warnings that need to be turned off. This is
|
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
|
semi-documentary; the intent is to tell libpng users which warnings have
|
||||||
been examined and judged non-fixable at present. The warning about
|
been examined and judged non-fixable at present. The warning about
|
||||||
structure padding is fixable, but it would be a signficant change (moving
|
structure padding is fixable, but it would be a significant change (moving
|
||||||
structure members around).
|
structure members around).
|
||||||
|
|
||||||
Version 1.6.24beta03 [July 4, 2016]
|
Version 1.6.24beta03 [July 4, 2016]
|
||||||
@@ -5754,11 +5753,415 @@ Version 1.6.26 [October 20, 2016]
|
|||||||
Cosmetic change, "ptr != 0" to "ptr != NULL" in png.c and pngrutil.c
|
Cosmetic change, "ptr != 0" to "ptr != NULL" in png.c and pngrutil.c
|
||||||
Despammed email addresses (replaced "@" with " at ").
|
Despammed email addresses (replaced "@" with " at ").
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Version 1.6.27beta01 [November 2, 2016]
|
||||||
(subscription required; visit
|
Restrict the new ADLER32-skipping to IDAT chunks. It broke iCCP chunk
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
handling: an erroneous iCCP chunk would throw a png_error and reject the
|
||||||
to subscribe)
|
entire PNG image instead of rejecting just the iCCP chunk with a warning,
|
||||||
or to glennrp at users.sourceforge.net
|
if built with zlib-1.2.8.1.
|
||||||
|
|
||||||
Glenn R-P
|
Version 1.6.27rc01 [December 27, 2016]
|
||||||
#endif
|
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.
|
||||||
|
|
||||||
|
Version 1.6.38 [September 14, 2022]
|
||||||
|
Added configurations and scripts for continuous integration.
|
||||||
|
Fixed various errors in the handling of tRNS, hIST and eXIf.
|
||||||
|
Implemented many stability improvements across all platforms.
|
||||||
|
Updated the internal documentation.
|
||||||
|
|
||||||
|
Version 1.6.39 [November 20, 2022]
|
||||||
|
Changed the error handler of oversized chunks (i.e. larger than
|
||||||
|
PNG_USER_CHUNK_MALLOC_MAX) from png_chunk_error to png_benign_error.
|
||||||
|
Fixed a buffer overflow error in contrib/tools/pngfix.
|
||||||
|
Fixed a memory leak (CVE-2019-6129) in contrib/tools/pngcp.
|
||||||
|
Disabled the ARM Neon optimizations by default in the CMake file,
|
||||||
|
following the default behavior of the configure script.
|
||||||
|
Allowed configure.ac to work with the trunk version of autoconf.
|
||||||
|
Removed the support for "install" targets from the legacy makefiles;
|
||||||
|
removed the obsolete makefile.cegcc.
|
||||||
|
Cleaned up the code and updated the internal documentation.
|
||||||
|
|
||||||
|
Version 1.6.40 [June 21, 2023]
|
||||||
|
Fixed the eXIf chunk multiplicity checks.
|
||||||
|
Fixed a memory leak in pCAL processing.
|
||||||
|
Corrected the validity report about tRNS inside png_get_valid().
|
||||||
|
Fixed various build issues on *BSD, Mac and Windows.
|
||||||
|
Updated the configurations and the scripts for continuous integration.
|
||||||
|
Cleaned up the code, the build scripts, and the documentation.
|
||||||
|
|
||||||
|
Version 1.6.41 [January 24, 2024]
|
||||||
|
Added SIMD-optimized code for the Loongarch LSX hardware.
|
||||||
|
(Contributed by GuXiWei, JinBo and ZhangLixia)
|
||||||
|
Fixed the run-time discovery of MIPS MSA hardware.
|
||||||
|
(Contributed by Sui Jingfeng)
|
||||||
|
Fixed an off-by-one error in the function `png_do_check_palette_indexes`,
|
||||||
|
which failed to recognize errors that might have existed in the first
|
||||||
|
column of a broken palette-encoded image. This was a benign regression
|
||||||
|
accidentally introduced in libpng-1.6.33. No pixel was harmed.
|
||||||
|
(Contributed by Adam Richter; reviewed by John Bowler)
|
||||||
|
Fixed, improved and modernized the contrib/pngminus programs, i.e.,
|
||||||
|
png2pnm.c and pnm2png.c
|
||||||
|
Removed old and peculiar portability hacks that were meant to silence
|
||||||
|
warnings issued by gcc version 7.1 alone.
|
||||||
|
(Contributed by John Bowler)
|
||||||
|
Fixed and modernized the CMake file, and raised the minimum required
|
||||||
|
CMake version from 3.1 to 3.6.
|
||||||
|
(Contributed by Clinton Ingram, Timothy Lyanguzov, Tyler Kropp, et al.)
|
||||||
|
Allowed the configure script to disable the building of auxiliary tools
|
||||||
|
and tests, thus catching up with the CMake file.
|
||||||
|
(Contributed by Carlo Bramini)
|
||||||
|
Fixed a build issue on Mac.
|
||||||
|
(Contributed by Zixu Wang)
|
||||||
|
Moved the Autoconf macro files to scripts/autoconf.
|
||||||
|
Moved the CMake files (except for the main CMakeLists.txt) to
|
||||||
|
scripts/cmake and moved the list of their contributing authors to
|
||||||
|
scripts/cmake/AUTHORS.md
|
||||||
|
Updated the CI configurations and scripts.
|
||||||
|
Relicensed the CI scripts to the MIT License.
|
||||||
|
Improved the test coverage.
|
||||||
|
(Contributed by John Bowler)
|
||||||
|
|
||||||
|
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.
|
||||||
|
|||||||
1119
CMakeLists.txt
148
INSTALL
@@ -16,10 +16,11 @@ Contents
|
|||||||
XI. Prepending a prefix to exported symbols
|
XI. Prepending a prefix to exported symbols
|
||||||
XII. Configuring for compiler xxx:
|
XII. Configuring for compiler xxx:
|
||||||
XIII. Removing unwanted object code
|
XIII. Removing unwanted object code
|
||||||
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
XIV. Enabling or disabling hardware optimizations
|
||||||
XV. Setjmp/longjmp issues
|
XV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||||
XVI. Common linking failures
|
XVI. Setjmp/longjmp issues
|
||||||
XVII. Other sources of information about libpng
|
XVII. Common linking failures
|
||||||
|
XVIII. Other sources of information about libpng
|
||||||
|
|
||||||
I. Simple installation
|
I. Simple installation
|
||||||
|
|
||||||
@@ -78,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
|
Before installing libpng, you must first install zlib, if it
|
||||||
is not already on your system. zlib can usually be found
|
is not already on your system. zlib can usually be found
|
||||||
wherever you got libpng; otherwise go to http://zlib.net. You can place
|
wherever you got libpng; otherwise go to https://zlib.net/. You can
|
||||||
zlib in the same directory as libpng or in another directory.
|
place zlib in the same directory as libpng or in another directory.
|
||||||
|
|
||||||
If your system already has a preinstalled zlib you will still need
|
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
|
to have access to the zlib.h and zconf.h include files that
|
||||||
@@ -127,16 +128,18 @@ Your directory structure should look like this:
|
|||||||
README
|
README
|
||||||
*.h, *.c => libpng source files
|
*.h, *.c => libpng source files
|
||||||
CMakeLists.txt => "cmake" script
|
CMakeLists.txt => "cmake" script
|
||||||
|
ci
|
||||||
|
ci_*.sh
|
||||||
configuration files:
|
configuration files:
|
||||||
configure.ac, configure, Makefile.am, Makefile.in,
|
configure.ac, configure, Makefile.am, Makefile.in,
|
||||||
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
|
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
|
||||||
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
||||||
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
depcomp, install-sh, mkinstalldirs, test-pngtest.sh, etc.
|
||||||
contrib
|
contrib
|
||||||
arm-neon, conftest, examples, gregbook, libtests, pngminim,
|
arm-neon, conftest, examples, gregbook, libtests, pngminim,
|
||||||
pngminus, pngsuite, tools, visupng
|
pngminus, pngsuite, tools, visupng
|
||||||
projects
|
projects
|
||||||
cbuilder5, owatcom, visualc71, vstudio, xcode
|
owatcom, visualc71, vstudio
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
*.def (module definition files)
|
*.def (module definition files)
|
||||||
@@ -144,7 +147,7 @@ Your directory structure should look like this:
|
|||||||
pngtest.png
|
pngtest.png
|
||||||
etc.
|
etc.
|
||||||
zlib
|
zlib
|
||||||
README, *.h, *.c contrib, etc.
|
README, *.h, *.c, contrib, etc.
|
||||||
|
|
||||||
If the line endings in the files look funny, you may wish to get the other
|
If the line endings in the files look funny, you may wish to get the other
|
||||||
distribution of libpng. It is available in both tar.gz (UNIX style line
|
distribution of libpng. It is available in both tar.gz (UNIX style line
|
||||||
@@ -152,28 +155,27 @@ endings) and zip (DOS style line endings) formats.
|
|||||||
|
|
||||||
VI. Building with project files
|
VI. Building with project files
|
||||||
|
|
||||||
If you are building libpng with MSVC, you can enter the
|
If you are building libpng with Microsoft Visual Studio, you can enter
|
||||||
libpng projects\visualc71 or vstudio directory and follow the instructions
|
the directory projects\visualc71 or projects\vstudio and follow the
|
||||||
in README.txt.
|
instructions in README.txt.
|
||||||
|
|
||||||
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
Otherwise, enter the zlib directory and follow the instructions in
|
||||||
then come back here and run "configure" or choose the appropriate
|
zlib/README, then come back here and run "configure" or choose the
|
||||||
makefile.sys in the scripts directory.
|
appropriate makefile in the scripts directory.
|
||||||
|
|
||||||
VII. Building with makefiles
|
VII. Building with makefiles
|
||||||
|
|
||||||
Copy the file (or files) that you need from the
|
Copy the file (or files) that you need from the
|
||||||
scripts directory into this directory, for example
|
scripts directory into this directory, for example
|
||||||
|
|
||||||
MSDOS example:
|
|
||||||
|
|
||||||
copy scripts\makefile.msc makefile
|
|
||||||
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
|
|
||||||
|
|
||||||
UNIX example:
|
UNIX example:
|
||||||
|
|
||||||
cp scripts/makefile.std makefile
|
cp scripts/makefile.std Makefile
|
||||||
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
make
|
||||||
|
|
||||||
|
Windows example:
|
||||||
|
|
||||||
|
nmake -f scripts\makefile.vcwin32
|
||||||
|
|
||||||
Read the makefile to see if you need to change any source or
|
Read the makefile to see if you need to change any source or
|
||||||
target directories to match your preferences.
|
target directories to match your preferences.
|
||||||
@@ -190,36 +192,33 @@ test. For more confidence, you can run another test by typing
|
|||||||
Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
|
Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
|
||||||
your output with the result shown in contrib/pngsuite/README.
|
your output with the result shown in contrib/pngsuite/README.
|
||||||
|
|
||||||
Most of the makefiles will allow you to run "make install" to
|
Most of the makefiles used to allow you to run "make install" to put
|
||||||
put the library in its final resting place (if you want to
|
the library in its final resting place, but that feature is no longer
|
||||||
do that, run "make install" in the zlib directory first if necessary).
|
supported. The only tested and supported manners to install libpng are
|
||||||
Some also allow you to run "make test-installed" after you have
|
the conventional build and install procedures driven by the configure
|
||||||
run "make install".
|
script or by the CMake file.
|
||||||
|
|
||||||
VIII. Configuring libpng for 16-bit platforms
|
VIII. Configuring for DOS and other 16-bit platforms
|
||||||
|
|
||||||
You will want to look into zconf.h to tell zlib (and thus libpng) that
|
Officially, the support for 16-bit platforms has been removed.
|
||||||
it cannot allocate more than 64K at a time. Even if you can, the memory
|
|
||||||
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
|
|
||||||
|
|
||||||
IX. Configuring for DOS
|
|
||||||
|
|
||||||
For DOS users who only have access to the lower 640K, you will
|
For DOS users who only have access to the lower 640K, you will
|
||||||
have to limit zlib's memory usage via a png_set_compression_mem_level()
|
have to limit zlib's memory usage via a png_set_compression_mem_level()
|
||||||
call. See zlib.h or zconf.h in the zlib library for more information.
|
call. See zlib.h or zconf.h in the zlib library for more information.
|
||||||
|
|
||||||
X. Configuring for Medium Model
|
You may be or may not be in luck if you target the "large" memory model,
|
||||||
|
but all the smaller models ("small", "compact" and "medium") are known
|
||||||
|
to be unworkable. For DOS users who have access beyond the lower 640K,
|
||||||
|
a "flat" 32-bit DOS model (such as DJGPP) is strongly recommended.
|
||||||
|
|
||||||
Libpng's support for medium model has been tested on most of the popular
|
For DOS users who only have access to the lower 640K, you will have to
|
||||||
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
|
limit zlib's memory usage via a png_set_compression_mem_level() call.
|
||||||
defined, and FAR gets defined to far in pngconf.h, and you should be
|
You will also have to look into zconf.h to tell zlib (and thus libpng)
|
||||||
all set. Everything in the library (except for zlib's structure) is
|
that it cannot allocate more than 64K at a time. Even if you can, the
|
||||||
expecting far data. You must use the typedefs with the p or pp on
|
memory won't be accessible. Therefore, you should limit zlib and libpng
|
||||||
the end for pointers (or at least look at them and be careful). Make
|
to 64K by defining MAXSEG_64K.
|
||||||
note that the rows of data are defined as png_bytepp, which is
|
|
||||||
an "unsigned char far * far *".
|
|
||||||
|
|
||||||
XI. Prepending a prefix to exported symbols
|
IX. Prepending a prefix to exported symbols
|
||||||
|
|
||||||
Starting with libpng-1.6.0, you can configure libpng (when using the
|
Starting with libpng-1.6.0, you can configure libpng (when using the
|
||||||
"configure" script) to prefix all exported symbols by means of the
|
"configure" script) to prefix all exported symbols by means of the
|
||||||
@@ -230,7 +229,7 @@ identifier). This creates a set of macros in pnglibconf.h, so this is
|
|||||||
transparent to applications; their function calls get transformed by
|
transparent to applications; their function calls get transformed by
|
||||||
the macros to use the modified names.
|
the macros to use the modified names.
|
||||||
|
|
||||||
XII. Configuring for compiler xxx:
|
X. Configuring for compiler xxx:
|
||||||
|
|
||||||
All includes for libpng are in pngconf.h. If you need to add, change
|
All includes for libpng are in pngconf.h. If you need to add, change
|
||||||
or delete an include, this is the place to do it.
|
or delete an include, this is the place to do it.
|
||||||
@@ -242,7 +241,7 @@ As of libpng-1.5.0, pngpriv.h also includes three other private header
|
|||||||
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
|
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
|
||||||
that previously appeared in the public headers.
|
that previously appeared in the public headers.
|
||||||
|
|
||||||
XIII. Removing unwanted object code
|
XI. Removing unwanted object code
|
||||||
|
|
||||||
There are a bunch of #define's in pngconf.h that control what parts of
|
There are a bunch of #define's in pngconf.h that control what parts of
|
||||||
libpng are compiled. All the defines end in _SUPPORTED. If you are
|
libpng are compiled. All the defines end in _SUPPORTED. If you are
|
||||||
@@ -281,7 +280,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
|
The size of the library itself should not be an issue, because only
|
||||||
those sections that are actually used will be loaded into memory.
|
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
|
XII. 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
|
||||||
|
|
||||||
|
XIII. 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
|
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
|
file and in the GIT repository logs. These will be of no concern to the vast
|
||||||
@@ -372,7 +421,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built
|
|||||||
libpng, because than the settings would not accurately reflect the settings
|
libpng, because than the settings would not accurately reflect the settings
|
||||||
that were used to build libpng.
|
that were used to build libpng.
|
||||||
|
|
||||||
XV. Setjmp/longjmp issues
|
XIV. Setjmp/longjmp issues
|
||||||
|
|
||||||
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
|
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
|
is known to be not thread-safe on some platforms and we don't know of
|
||||||
@@ -390,7 +439,7 @@ This requires setjmp/longjmp, so you must either build the library
|
|||||||
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
|
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
|
||||||
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
|
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
|
||||||
|
|
||||||
XVI. Common linking failures
|
XV. Common linking failures
|
||||||
|
|
||||||
If your application fails to find libpng or zlib entries while linking:
|
If your application fails to find libpng or zlib entries while linking:
|
||||||
|
|
||||||
@@ -402,12 +451,13 @@ If your application fails to find libpng or zlib entries while linking:
|
|||||||
If you are using the vstudio project, observe the WARNING in
|
If you are using the vstudio project, observe the WARNING in
|
||||||
project/vstudio/README.txt.
|
project/vstudio/README.txt.
|
||||||
|
|
||||||
XVII. Other sources of information about libpng:
|
XVI. Other sources of information about libpng:
|
||||||
|
|
||||||
Further information can be found in the README and libpng-manual.txt
|
Further information can be found in the README and libpng-manual.txt
|
||||||
files, in the individual makefiles, in png.h, and the manual pages
|
files, in the individual makefiles, in png.h, and the manual pages
|
||||||
libpng.3 and png.5.
|
libpng.3 and png.5.
|
||||||
|
|
||||||
|
Copyright (c) 2022 Cosmin Truta
|
||||||
Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
|
Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
|
||||||
This document is released under the libpng license.
|
This document is released under the libpng license.
|
||||||
For conditions of distribution and use, see the disclaimer
|
For conditions of distribution and use, see the disclaimer
|
||||||
|
|||||||
120
LICENSE
@@ -1,17 +1,46 @@
|
|||||||
|
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
||||||
|
=========================================
|
||||||
|
|
||||||
This copy of the libpng notices is provided for your convenience. In case of
|
PNG Reference Library License version 2
|
||||||
any discrepancy between this copy and the notices in the file png.h that is
|
---------------------------------------
|
||||||
included in the libpng distribution, the latter shall prevail.
|
|
||||||
|
|
||||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
* Copyright (c) 1995-2024 The PNG Reference Library Authors.
|
||||||
|
* Copyright (c) 2018-2024 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
|
The software is supplied "as is", without warranty of any kind,
|
||||||
this sentence.
|
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.26, October 20, 2016 are
|
1. The origin of this software must not be misrepresented; you
|
||||||
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
|
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
|
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
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
added to the list of Contributing Authors:
|
added to the list of Contributing Authors:
|
||||||
@@ -22,25 +51,28 @@ added to the list of Contributing Authors:
|
|||||||
Cosmin Truta
|
Cosmin Truta
|
||||||
Gilles Vollant
|
Gilles Vollant
|
||||||
James Yu
|
James Yu
|
||||||
|
Mandar Sahastrabuddhe
|
||||||
|
Google Inc.
|
||||||
|
Vadim Barkov
|
||||||
|
|
||||||
and with the following additions to the disclaimer:
|
and with the following additions to the disclaimer:
|
||||||
|
|
||||||
There is no warranty against interference with your enjoyment of the
|
There is no warranty against interference with your enjoyment of
|
||||||
library or against infringement. There is no warranty that our
|
the library or against infringement. There is no warranty that our
|
||||||
efforts or the library will fulfill any of your particular purposes
|
efforts or the library will fulfill any of your particular purposes
|
||||||
or needs. This library is provided with all faults, and the entire
|
or needs. This library is provided with all faults, and the entire
|
||||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
risk of satisfactory quality, performance, accuracy, and effort is
|
||||||
the user.
|
with the user.
|
||||||
|
|
||||||
Some files in the "contrib" directory and some configure-generated
|
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.
|
are released under other open source licenses.
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||||
libpng-0.96, and are distributed according to the same disclaimer and
|
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
|
license as libpng-0.96, with the following individuals added to the
|
||||||
of Contributing Authors:
|
list of Contributing Authors:
|
||||||
|
|
||||||
Tom Lane
|
Tom Lane
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
@@ -59,7 +91,7 @@ Contributing Authors:
|
|||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
Tom Tanner
|
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.
|
but are released under this license.
|
||||||
|
|
||||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
@@ -74,13 +106,14 @@ is defined as the following set of individuals:
|
|||||||
Paul Schmidt
|
Paul Schmidt
|
||||||
Tim Wegner
|
Tim Wegner
|
||||||
|
|
||||||
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
The PNG Reference Library is supplied "AS IS". The Contributing
|
||||||
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
Authors and Group 42, Inc. disclaim all warranties, expressed or
|
||||||
including, without limitation, the warranties of merchantability and of
|
implied, including, without limitation, the warranties of
|
||||||
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
merchantability and of fitness for any purpose. The Contributing
|
||||||
assume no liability for direct, indirect, incidental, special, exemplary,
|
Authors and Group 42, Inc. assume no liability for direct, indirect,
|
||||||
or consequential damages, which may result from the use of the PNG
|
incidental, special, exemplary, or consequential damages, which may
|
||||||
Reference Library, even if advised of the possibility of such damage.
|
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
|
Permission is hereby granted to use, copy, modify, and distribute this
|
||||||
source code, or portions hereof, for any purpose, without fee, subject
|
source code, or portions hereof, for any purpose, without fee, subject
|
||||||
@@ -94,37 +127,8 @@ to the following restrictions:
|
|||||||
3. This Copyright notice may not be removed or altered from any
|
3. This Copyright notice may not be removed or altered from any
|
||||||
source or altered source distribution.
|
source or altered source distribution.
|
||||||
|
|
||||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
The Contributing Authors and Group 42, Inc. specifically permit,
|
||||||
fee, and encourage the use of this source code as a component to
|
without fee, and encourage the use of this source code as a component
|
||||||
supporting the PNG file format in commercial products. If you use this
|
to supporting the PNG file format in commercial products. If you use
|
||||||
source code in a product, acknowledgment is not required but would be
|
this source code in a product, acknowledgment is not required but would
|
||||||
appreciated.
|
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
|
|
||||||
October 20, 2016
|
|
||||||
|
|||||||
63
Makefile.am
@@ -1,7 +1,7 @@
|
|||||||
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
# Makefile.am, the source file for Makefile.in (and hence Makefile), is
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2018-2024 Cosmin Truta
|
||||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
# Last changed in libpng 1.6.25 [October 20, 2016]
|
|
||||||
#
|
#
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
@@ -9,16 +9,24 @@
|
|||||||
|
|
||||||
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I scripts
|
ACLOCAL_AMFLAGS = -I scripts/autoconf
|
||||||
|
|
||||||
# test programs - run on make check, make distcheck
|
# test programs - run on make check, make distcheck
|
||||||
|
if ENABLE_TESTS
|
||||||
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
|
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
|
||||||
if HAVE_CLOCK_GETTIME
|
if HAVE_CLOCK_GETTIME
|
||||||
check_PROGRAMS += timepng
|
check_PROGRAMS += timepng
|
||||||
endif
|
endif
|
||||||
|
else
|
||||||
|
check_PROGRAMS=
|
||||||
|
endif
|
||||||
|
|
||||||
# Utilities - installed
|
# Utilities - installed
|
||||||
|
if ENABLE_TOOLS
|
||||||
bin_PROGRAMS= pngfix png-fix-itxt
|
bin_PROGRAMS= pngfix png-fix-itxt
|
||||||
|
else
|
||||||
|
bin_PROGRAMS=
|
||||||
|
endif
|
||||||
|
|
||||||
# This ensures that pnglibconf.h gets built at the start of 'make all' or
|
# This ensures that pnglibconf.h gets built at the start of 'make all' or
|
||||||
# 'make check', but it does not add dependencies to the individual programs,
|
# 'make check', but it does not add dependencies to the individual programs,
|
||||||
@@ -30,6 +38,7 @@ bin_PROGRAMS= pngfix png-fix-itxt
|
|||||||
# always wrong and always very confusing.
|
# always wrong and always very confusing.
|
||||||
BUILT_SOURCES = pnglibconf.h
|
BUILT_SOURCES = pnglibconf.h
|
||||||
|
|
||||||
|
if ENABLE_TESTS
|
||||||
pngtest_SOURCES = pngtest.c
|
pngtest_SOURCES = pngtest.c
|
||||||
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
|
||||||
@@ -48,18 +57,22 @@ pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
|||||||
timepng_SOURCES = contrib/libtests/timepng.c
|
timepng_SOURCES = contrib/libtests/timepng.c
|
||||||
timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
|
||||||
|
pngcp_SOURCES = contrib/tools/pngcp.c
|
||||||
|
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ENABLE_TOOLS
|
||||||
pngfix_SOURCES = contrib/tools/pngfix.c
|
pngfix_SOURCES = contrib/tools/pngfix.c
|
||||||
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||||
|
|
||||||
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||||
|
endif
|
||||||
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
|
# Generally these are single line shell scripts to run a test with a particular
|
||||||
# set of parameters:
|
# set of parameters:
|
||||||
|
if ENABLE_TESTS
|
||||||
TESTS =\
|
TESTS =\
|
||||||
tests/pngtest\
|
tests/pngtest-all\
|
||||||
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
|
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
|
||||||
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
|
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
|
||||||
tests/pngvalid-gamma-expand16-background\
|
tests/pngvalid-gamma-expand16-background\
|
||||||
@@ -75,6 +88,7 @@ TESTS =\
|
|||||||
tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
|
tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
|
||||||
tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
|
tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
|
||||||
tests/pngimage-quick tests/pngimage-full
|
tests/pngimage-quick tests/pngimage-full
|
||||||
|
endif
|
||||||
|
|
||||||
# man pages
|
# man pages
|
||||||
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
||||||
@@ -94,7 +108,8 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
|
|||||||
|
|
||||||
if PNG_ARM_NEON
|
if PNG_ARM_NEON
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
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
|
endif
|
||||||
|
|
||||||
if PNG_MIPS_MSA
|
if PNG_MIPS_MSA
|
||||||
@@ -102,6 +117,32 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
|
|||||||
mips/filter_msa_intrinsics.c
|
mips/filter_msa_intrinsics.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if PNG_MIPS_MMI
|
||||||
|
if !PNG_MIPS_MSA
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c
|
||||||
|
endif
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/filter_mmi_inline_assembly.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
|
||||||
|
|
||||||
|
if PNG_LOONGARCH_LSX
|
||||||
|
noinst_LTLIBRARIES= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_SOURCES = loongarch/loongarch_lsx_init.c\
|
||||||
|
loongarch/filter_lsx_intrinsics.c
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS = -mlsx
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
|
||||||
|
# libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
|
||||||
|
endif
|
||||||
|
|
||||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
|
||||||
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||||
@@ -122,6 +163,10 @@ else
|
|||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if PNG_LOONGARCH_LSX
|
||||||
|
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES += libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
|
||||||
|
endif
|
||||||
|
|
||||||
#distribute headers in /usr/include/libpng/*
|
#distribute headers in /usr/include/libpng/*
|
||||||
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
||||||
pkginclude_HEADERS= png.h pngconf.h
|
pkginclude_HEADERS= png.h pngconf.h
|
||||||
@@ -136,9 +181,9 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
|||||||
# from those directories being included. This only works if the configure is
|
# from those directories being included. This only works if the configure is
|
||||||
# not done in the source directory!
|
# not done in the source directory!
|
||||||
EXTRA_DIST= \
|
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 \
|
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||||
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
${srcdir}/ci ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||||
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
||||||
CMakeLists.txt example.c libpng-manual.txt
|
CMakeLists.txt example.c libpng-manual.txt
|
||||||
|
|
||||||
|
|||||||
2550
Makefile.in
Normal file
278
README
@@ -1,56 +1,88 @@
|
|||||||
README for libpng version 1.6.26 - October 20, 2016 (shared library 16.0)
|
README for libpng version 1.6.41
|
||||||
See the note about version numbers near the top of png.h
|
================================
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
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 comes in several distribution formats. Get `libpng-*.tar.gz`
|
||||||
libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
|
or `libpng-*.tar.xz` if you want UNIX-style line endings in the text
|
||||||
or lpng*.7z or lpng*.zip if you want DOS-style line endings.
|
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
|
For a detailed description on using libpng, read `libpng-manual.txt`.
|
||||||
fact that it's the first release fool you. The libpng library has been in
|
For examples of libpng in a program, see `example.c` and `pngtest.c`.
|
||||||
extensive use and testing since mid-1995. By late 1997 it had
|
For usage information and restrictions (what little they are) on libpng,
|
||||||
finally gotten to the stage where there hadn't been significant
|
see `png.h`. For a description on using zlib (the compression library
|
||||||
changes to the API in some time, and people have a bad feeling about
|
used by libpng) and zlib's restrictions, see `zlib.h`.
|
||||||
libraries with versions < 1.0. Version 1.0.0 was released in
|
|
||||||
March 1998.
|
|
||||||
|
|
||||||
****
|
You should use zlib 1.0.4 or later to run this, but it _may_ work with
|
||||||
Note that some of the changes to the png_info structure render this
|
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 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/pngdocs.html .
|
||||||
|
|
||||||
|
This code is currently being archived at https://libpng.sourceforge.io
|
||||||
|
in the download area, and at http://libpng.download/src .
|
||||||
|
|
||||||
|
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 and commendations to `png-mng-implement`
|
||||||
|
at `lists.sourceforge.net`. (Subscription is required; visit
|
||||||
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
|
to subscribe.)
|
||||||
|
|
||||||
|
Send general questions about the PNG specification to `png-mng-misc`
|
||||||
|
at `lists.sourceforge.net`. (Subscription is required; visit
|
||||||
|
https://lists.sourceforge.net/lists/listinfo/png-mng-misc
|
||||||
|
to subscribe.)
|
||||||
|
|
||||||
|
Historical notes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
The libpng library has been in extensive use and testing since mid-1995.
|
||||||
|
Version 0.89, published a year later, was the first official release.
|
||||||
|
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 below 1.0. Version 1.0.0 was
|
||||||
|
released in March 1998.
|
||||||
|
|
||||||
|
Note that some of the changes to the `png_info` structure render this
|
||||||
version of the library binary incompatible with libpng-0.89 or
|
version of the library binary incompatible with libpng-0.89 or
|
||||||
earlier versions if you are using a shared library. The type of the
|
earlier versions if you are using a shared library. The type of the
|
||||||
"filler" parameter for png_set_filler() has changed from png_byte to
|
`filler` parameter for `png_set_filler()` has changed from `png_byte`
|
||||||
png_uint_32, which will affect shared-library applications that use
|
to `png_uint_32`, which will affect shared-library applications that
|
||||||
this function.
|
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 `info_struct`,
|
||||||
new APIs have been made available in 0.95 to avoid direct application
|
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
|
access to `info_ptr`. These functions are the `png_set_<chunk>` and
|
||||||
png_get_<chunk> functions. These functions should be used when
|
`png_get_<chunk>` functions. These functions should be used when
|
||||||
accessing/storing the info_struct data, rather than manipulating it
|
accessing/storing the `info_struct` data, rather than manipulating it
|
||||||
directly, to avoid such problems in the future.
|
directly, to avoid such problems in the future.
|
||||||
|
|
||||||
It is important to note that the APIs did not make current programs
|
It is important to note that the APIs did not make current programs
|
||||||
that access the info struct directly incompatible with the new
|
that access the info struct directly incompatible with the new
|
||||||
library, through libpng-1.2.x. In libpng-1.4.x, which was meant to
|
library, through libpng-1.2.x. In libpng-1.4.x, which was meant to
|
||||||
be a transitional release, members of the png_struct and the
|
be a transitional release, members of the `png_struct` and the
|
||||||
info_struct can still be accessed, but the compiler will issue a
|
`info_struct` can still be accessed, but the compiler will issue a
|
||||||
warning about deprecated usage. Since libpng-1.5.0, direct access
|
warning about deprecated usage. Since libpng-1.5.0, direct access
|
||||||
to these structs is not allowed, and the definitions of the structs
|
to these structs is not allowed, and the definitions of the structs
|
||||||
reside in private pngstruct.h and pnginfo.h header files that are not
|
reside in private `pngstruct.h` and `pnginfo.h` header files that are
|
||||||
accessible to applications. It is strongly suggested that new
|
not accessible to applications. It is strongly suggested that new
|
||||||
programs use the new APIs (as shown in example.c and pngtest.c), and
|
programs use the new APIs (as shown in `example.c` and `pngtest.c`),
|
||||||
older programs be converted to the new format, to facilitate upgrades
|
and older programs be converted to the new format, to facilitate
|
||||||
in the future.
|
upgrades in the future.
|
||||||
****
|
|
||||||
|
|
||||||
Additions since 0.90 include the ability to compile libpng as a
|
|
||||||
Windows DLL, and new APIs for accessing data in the info struct.
|
|
||||||
Experimental functions include the ability to set weighting and cost
|
|
||||||
factors for row filter selection, direct reads of integers from buffers
|
|
||||||
on big-endian processors that support misaligned data access, faster
|
|
||||||
methods of doing alpha composition, and more accurate 16->8 bit color
|
|
||||||
conversion.
|
|
||||||
|
|
||||||
The additions since 0.89 include the ability to read from a PNG stream
|
The additions since 0.89 include the ability to read from a PNG stream
|
||||||
which has had some (or all) of the signature bytes read by the calling
|
which has had some (or all) of the signature bytes read by the calling
|
||||||
@@ -60,99 +92,31 @@ 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
|
to set different actions based on whether the CRC error occurred in a
|
||||||
critical or an ancillary chunk.
|
critical or an ancillary chunk.
|
||||||
|
|
||||||
The changes made to the library, and bugs fixed are based on discussions
|
The additions since 0.90 include the ability to compile libpng as a
|
||||||
on the PNG-implement mailing list and not on material submitted
|
Windows DLL, and new APIs for accessing data in the `info_struct`.
|
||||||
privately to Guy, Andreas, or Glenn. They will forward any good
|
Experimental functions included the ability to set weighting and cost
|
||||||
suggestions to the list.
|
factors for row filter selection, direct reads of integers from buffers
|
||||||
|
on big-endian processors that support misaligned data access, faster
|
||||||
|
methods of doing alpha composition, and more accurate 16-to-8 bit color
|
||||||
|
conversion. Some of these experimental functions, such as the weighted
|
||||||
|
filter heuristics, have since been removed.
|
||||||
|
|
||||||
For a detailed description on using libpng, read libpng-manual.txt. For
|
Files included in this distribution
|
||||||
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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
zlib should be available at the same place that libpng is, or at 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/
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
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
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
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.
|
|
||||||
|
|
||||||
Files in this distribution:
|
|
||||||
|
|
||||||
ANNOUNCE => Announcement of this version, with recent changes
|
ANNOUNCE => Announcement of this version, with recent changes
|
||||||
|
AUTHORS => List of contributing authors
|
||||||
CHANGES => Description of changes between libpng versions
|
CHANGES => Description of changes between libpng versions
|
||||||
KNOWNBUG => List of known bugs and deficiencies
|
INSTALL => Instructions to install libpng
|
||||||
LICENSE => License to use and redistribute libpng
|
LICENSE => License to use and redistribute libpng
|
||||||
README => This file
|
README => This file
|
||||||
TODO => Things not implemented in the current library
|
TODO => Things not implemented in the current library
|
||||||
Y2KINFO => Statement of Y2K compliance
|
TRADEMARK => Trademark information
|
||||||
example.c => Example code for using libpng functions
|
example.c => Example code for using libpng functions
|
||||||
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
libpng.3 => Manual page for libpng (includes libpng-manual.txt)
|
||||||
libpng-manual.txt => Description of libpng and its functions
|
libpng-manual.txt => Description of libpng and its functions
|
||||||
libpngpf.3 => manual page for libpng's private functions
|
libpngpf.3 => Manual page for libpng's private functions (deprecated)
|
||||||
png.5 => manual page for the PNG format
|
png.5 => Manual page for the PNG format
|
||||||
png.c => Basic interface functions common to library
|
png.c => Basic interface functions common to library
|
||||||
png.h => Library function and interface declarations (public)
|
png.h => Library function and interface declarations (public)
|
||||||
pngpriv.h => Library function and interface declarations (private)
|
pngpriv.h => Library function and interface declarations (private)
|
||||||
@@ -178,41 +142,41 @@ Files in this distribution:
|
|||||||
pngwrite.c => High-level write functions
|
pngwrite.c => High-level write functions
|
||||||
pngwtran.c => Write data transformations
|
pngwtran.c => Write data transformations
|
||||||
pngwutil.c => Write utility functions
|
pngwutil.c => Write utility functions
|
||||||
arm => Contains optimized code for the ARM platform
|
arm/ => Optimized code for the ARM platform
|
||||||
contrib => Contributions
|
intel/ => Optimized code for the INTEL-SSE2 platform
|
||||||
arm-neon => Optimized code for ARM-NEON platform
|
mips/ => Optimized code for the MIPS platform
|
||||||
examples => Example programs
|
powerpc/ => Optimized code for the PowerPC platform
|
||||||
gregbook => source code for PNG reading and writing, from
|
ci/ => Scripts for continuous integration
|
||||||
Greg Roelofs' "PNG: The Definitive Guide",
|
contrib/ => External contributions
|
||||||
|
arm-neon/ => Optimized code for the ARM-NEON platform
|
||||||
|
mips-msa/ => Optimized code for the MIPS-MSA platform
|
||||||
|
powerpc-vsx/ => Optimized code for the POWERPC-VSX platform
|
||||||
|
examples/ => Examples of libpng usage
|
||||||
|
gregbook/ => Source code for PNG reading and writing, from
|
||||||
|
"PNG: The Definitive Guide" by Greg Roelofs,
|
||||||
O'Reilly, 1999
|
O'Reilly, 1999
|
||||||
intel => Optimized code for INTEL-SSE2 platform
|
libtests/ => Test programs
|
||||||
libtests => Test programs
|
oss-fuzz/ => Files used by the OSS-Fuzz project for fuzz-testing
|
||||||
pngminim => Minimal decoder, encoder, and progressive decoder
|
libpng
|
||||||
programs demonstrating use of pngusr.dfa
|
pngminim/ => Minimal decoder, encoder, and progressive decoder
|
||||||
pngminus => Simple pnm2png and png2pnm programs
|
programs demonstrating the use of pngusr.dfa
|
||||||
pngsuite => Test images
|
pngminus/ => Simple pnm2png and png2pnm programs
|
||||||
testpngs
|
pngsuite/ => Test images
|
||||||
tools => Various tools
|
testpngs/ => Test images
|
||||||
visupng => Contains a MSVC workspace for VisualPng
|
tools/ => Various tools
|
||||||
projects => Contains project files and workspaces for
|
visupng/ => VisualPng, a Windows viewer for PNG images
|
||||||
building a DLL
|
projects/ => Project files and workspaces for various IDEs
|
||||||
owatcom => Contains a WATCOM project for building libpng
|
owatcom/ => OpenWatcom project
|
||||||
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
visualc71/ => Microsoft Visual C++ 7.1 workspace
|
||||||
workspace for building libpng and zlib
|
vstudio/ => Microsoft Visual Studio workspace
|
||||||
vstudio => Contains a Microsoft Visual C++ (MSVC)
|
scripts/ => Scripts and makefiles for building libpng
|
||||||
workspace for building libpng and zlib
|
(see scripts/README.txt for the complete list)
|
||||||
scripts => Directory containing scripts for building libpng:
|
tests/ => Test scripts
|
||||||
(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)
|
* Cosmin Truta (current maintainer, since 2018)
|
||||||
Internet: glennrp at users.sourceforge.net
|
* Glenn Randers-Pehrson (former maintainer, 1998-2018)
|
||||||
|
* Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||||
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
* Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||||
Internet: adilger at enel.ucalgary.ca
|
(formerly of Group 42, Inc.)
|
||||||
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
|
|
||||||
|
|||||||
49
TODO
@@ -1,30 +1,23 @@
|
|||||||
/*
|
|
||||||
TODO - list of things to do for libpng:
|
TODO - list of things to do for libpng:
|
||||||
|
|
||||||
Final bug fixes.
|
* Fix all defects (duh!)
|
||||||
Better C++ wrapper/full C++ implementation?
|
* Better C++ wrapper / full C++ implementation (?)
|
||||||
Fix problem with C++ and EXTERN "C".
|
* Fix the problems with C++ and 'extern "C"'.
|
||||||
cHRM transformation.
|
* cHRM transformation.
|
||||||
Remove setjmp/longjmp usage in favor of returning error codes. As a start on
|
* Palette creation.
|
||||||
this, minimize the use of png_error(), replacing them with
|
* "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||||
png_warning(); return(0; or similar.
|
* Improved dithering.
|
||||||
Palette creation.
|
* Multi-lingual error and warning message support.
|
||||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
* Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
|
||||||
Improved dithering.
|
* Man pages for function calls.
|
||||||
Multi-lingual error and warning message support.
|
* Better documentation.
|
||||||
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
* Better filter selection
|
||||||
Man pages for function calls.
|
(e.g., counting huffman bits/precompression; filter inertia; filter costs).
|
||||||
Better documentation.
|
* Histogram creation.
|
||||||
Better filter selection
|
* Text conversion between different code pages (e.g., Latin-1 -> Mac).
|
||||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
* Avoid building gamma tables whenever possible.
|
||||||
Histogram creation.
|
* Greater precision in changing to linear gamma for compositing against
|
||||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
background, and in doing rgb-to-gray transformations.
|
||||||
Avoid building gamma tables whenever possible.
|
* Investigate pre-incremented loop counters and other loop constructions.
|
||||||
Use greater precision when changing to linear gamma for compositing against
|
* Interpolated method of handling interlacing.
|
||||||
background and doing rgb-to-gray transformation.
|
* More validations for libpng transformations.
|
||||||
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.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|||||||
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.
|
||||||
1211
aclocal.m4
vendored
Normal file
@@ -1,17 +1,16 @@
|
|||||||
|
|
||||||
/* arm_init.c - NEON optimised filter functions
|
/* arm_init.c - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2018-2022 Cosmin Truta
|
||||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||||
* Written by Mans Rullgard, 2011.
|
* Written by Mans Rullgard, 2011.
|
||||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
*/
|
*/
|
||||||
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
|
||||||
* called.
|
/* This module requires POSIX 1003.1 functions. */
|
||||||
*/
|
|
||||||
#define _POSIX_SOURCE 1
|
#define _POSIX_SOURCE 1
|
||||||
|
|
||||||
#include "../pngpriv.h"
|
#include "../pngpriv.h"
|
||||||
@@ -32,21 +31,26 @@
|
|||||||
* has partial support is contrib/arm-neon/linux.c - a generic Linux
|
* has partial support is contrib/arm-neon/linux.c - a generic Linux
|
||||||
* implementation which reads /proc/cpufino.
|
* implementation which reads /proc/cpufino.
|
||||||
*/
|
*/
|
||||||
|
#include <signal.h> /* for sig_atomic_t */
|
||||||
|
|
||||||
#ifndef PNG_ARM_NEON_FILE
|
#ifndef PNG_ARM_NEON_FILE
|
||||||
# ifdef __linux__
|
# if defined(__aarch64__) || defined(_M_ARM64)
|
||||||
|
/* ARM Neon is expected to be unconditionally available on ARM64. */
|
||||||
|
# error "PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on ARM64"
|
||||||
|
# elif defined(__ARM_NEON__) || defined(__ARM_NEON)
|
||||||
|
/* ARM Neon is expected to be available on the target CPU architecture. */
|
||||||
|
# error "PNG_ARM_NEON_CHECK_SUPPORTED must not be defined on this CPU arch"
|
||||||
|
# elif defined(__linux__)
|
||||||
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
|
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
|
||||||
|
# else
|
||||||
|
# error "No support for run-time ARM Neon checking; use compile-time options"
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_ARM_NEON_FILE
|
|
||||||
|
|
||||||
#include <signal.h> /* for sig_atomic_t */
|
|
||||||
static int png_have_neon(png_structp png_ptr);
|
static int png_have_neon(png_structp png_ptr);
|
||||||
#include PNG_ARM_NEON_FILE
|
#ifdef PNG_ARM_NEON_FILE
|
||||||
|
# include PNG_ARM_NEON_FILE
|
||||||
#else /* PNG_ARM_NEON_FILE */
|
#endif
|
||||||
# error "PNG_ARM_NEON_FILE undefined: no support for run-time ARM NEON checks"
|
|
||||||
#endif /* PNG_ARM_NEON_FILE */
|
|
||||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||||
|
|
||||||
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
|
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* filter_neon.S - NEON optimised filter functions
|
/* 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.
|
* Written by Mans Rullgard, 2011.
|
||||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
#define PNG_VERSION_INFO_ONLY
|
#define PNG_VERSION_INFO_ONLY
|
||||||
#include "../pngpriv.h"
|
#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 */
|
.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||||
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
||||||
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
@@ -19,7 +18,11 @@
|
|||||||
/* This code requires -mfpu=neon on the command line: */
|
/* This code requires -mfpu=neon on the command line: */
|
||||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||||
|
|
||||||
#include <arm_neon.h>
|
#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64)
|
||||||
|
# include <arm64_neon.h>
|
||||||
|
#else
|
||||||
|
# include <arm_neon.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
||||||
* however this code will only work with appropriate alignment. arm/arm_init.c
|
* 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
|
* '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
|
* warning; note that the code is safe because there never is an alias between
|
||||||
* the input and output pointers.
|
* 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)\
|
#define png_ldr(type,pointer)\
|
||||||
(temp_pointer = png_ptr(type,pointer), *temp_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 *vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||||
uint8x8x4_t vrp = *vrpt;
|
uint8x8x4_t vrp = *vrpt;
|
||||||
uint32x2x4_t *temp_pointer;
|
uint32x2x4_t *temp_pointer;
|
||||||
|
uint32x2x4_t vdest_val;
|
||||||
|
|
||||||
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
||||||
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
||||||
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
||||||
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
|
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)
|
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 *vrpt, *vppt;
|
||||||
uint8x8x4_t vrp, vpp;
|
uint8x8x4_t vrp, vpp;
|
||||||
uint32x2x4_t *temp_pointer;
|
uint32x2x4_t *temp_pointer;
|
||||||
|
uint32x2x4_t vdest_val;
|
||||||
|
|
||||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
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] = vhadd_u8(vdest.val[2], vpp.val[3]);
|
||||||
vdest.val[3] = vadd_u8(vdest.val[3], vrp.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 *vrpt, *vppt;
|
||||||
uint8x8x4_t vrp, vpp;
|
uint8x8x4_t vrp, vpp;
|
||||||
uint32x2x4_t *temp_pointer;
|
uint32x2x4_t *temp_pointer;
|
||||||
|
uint32x2x4_t vdest_val;
|
||||||
|
|
||||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
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];
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
151
arm/palette_neon_intrinsics.c
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
|
||||||
|
/* 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(__clang__) && 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;
|
||||||
|
|
||||||
|
/* Initially black, opaque. */
|
||||||
|
uint8x16x4_t w = {{
|
||||||
|
vdupq_n_u8(0x00),
|
||||||
|
vdupq_n_u8(0x00),
|
||||||
|
vdupq_n_u8(0x00),
|
||||||
|
vdupq_n_u8(0xff),
|
||||||
|
}};
|
||||||
|
|
||||||
|
png_debug(1, "in png_riffle_palette_neon");
|
||||||
|
|
||||||
|
/* 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_uint_32 pixels_per_chunk = 4;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
png_debug(1, "in png_do_expand_palette_rgba8_neon");
|
||||||
|
|
||||||
|
PNG_UNUSED(row)
|
||||||
|
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;
|
||||||
|
png_uint_32 i;
|
||||||
|
|
||||||
|
png_debug(1, "in png_do_expand_palette_rgb8_neon");
|
||||||
|
|
||||||
|
PNG_UNUSED(row)
|
||||||
|
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 */
|
||||||
@@ -77,13 +77,14 @@ libpng_autotools_files="Makefile.in aclocal.m4 config.guess config.h.in
|
|||||||
config.sub configure depcomp install-sh ltmain.sh missing\
|
config.sub configure depcomp install-sh ltmain.sh missing\
|
||||||
test-driver"
|
test-driver"
|
||||||
#
|
#
|
||||||
# Files generated by versions of configue >2.68 or automake >1.13 (i.e. later
|
# Files generated by versions of autoconf >2.68 or automake >1.13 (i.e. later
|
||||||
# versions than those required by configure.ac):
|
# versions than those required by configure.ac):
|
||||||
libpng_autotools_extra="compile config.h.in~"
|
libpng_autotools_extra="compile config.h.in~"
|
||||||
#
|
#
|
||||||
# These are separate because 'maintainer-clean' does not remove them.
|
# These are separate because 'maintainer-clean' does not remove them.
|
||||||
libpng_libtool_files="scripts/libtool.m4 scripts/ltoptions.m4\
|
libpng_libtool_files="scripts/autoconf/libtool.m4 scripts/autoconf/ltoptions.m4\
|
||||||
scripts/ltsugar.m4 scripts/ltversion.m4 scripts/lt~obsolete.m4"
|
scripts/autoconf/ltsugar.m4 scripts/autoconf/ltversion.m4\
|
||||||
|
scripts/autoconf/lt~obsolete.m4"
|
||||||
|
|
||||||
libpng_autotools_dirs="autom4te.cache" # not required
|
libpng_autotools_dirs="autom4te.cache" # not required
|
||||||
#
|
#
|
||||||
@@ -194,7 +195,7 @@ case "$mode" in
|
|||||||
if test -d .git
|
if test -d .git
|
||||||
then
|
then
|
||||||
exec >&2
|
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 " This is not necessary; it is only necessary to remake the"
|
||||||
echo " autotools generated files if Makefile.am or configure.ac"
|
echo " autotools generated files if Makefile.am or configure.ac"
|
||||||
echo " change and make does the right thing with:"
|
echo " change and make does the right thing with:"
|
||||||
|
|||||||
11
ci/.shellcheckrc
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Disable the "variable appears unused" warning caused by the use of getopts
|
||||||
|
# with an obligatory (but unused) variable name in the main function.
|
||||||
|
disable=SC2034
|
||||||
|
|
||||||
|
# Disable all the "quote to prevent globbing or word splitting" advice.
|
||||||
|
# We need word splitting for well-known variables like MAKEFLAGS and CFLAGS.
|
||||||
|
disable=SC2086,SC2206
|
||||||
|
|
||||||
|
# Disable the "possible misspelling" warnings that might be flagged, e.g.,
|
||||||
|
# inside function ci_trace_build.
|
||||||
|
disable=SC2153
|
||||||
19
ci/LICENSE_MIT.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
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 COPYRIGHT 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.
|
||||||
88
ci/ci_lint_ci.sh
Executable file
@@ -0,0 +1,88 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Copyright (c) 2019-2024 Cosmin Truta.
|
||||||
|
#
|
||||||
|
# Use, modification and distribution are subject to the MIT License.
|
||||||
|
# Please see the accompanying file LICENSE_MIT.txt
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
# shellcheck source="ci/lib/ci.lib.sh"
|
||||||
|
source "$(dirname "$0")/lib/ci.lib.sh"
|
||||||
|
cd "$CI_TOPLEVEL_DIR"
|
||||||
|
|
||||||
|
CI_SHELLCHECK="$(command -v shellcheck || true)"
|
||||||
|
CI_YAMLLINT="$(command -v yamllint || true)"
|
||||||
|
CI_LINT_COUNTER=0
|
||||||
|
|
||||||
|
function ci_lint_ci_config_files {
|
||||||
|
ci_info "linting: CI config files"
|
||||||
|
local MY_FILE
|
||||||
|
if [[ -x $CI_YAMLLINT ]]
|
||||||
|
then
|
||||||
|
ci_spawn "$CI_YAMLLINT" --version
|
||||||
|
for MY_FILE in "$CI_TOPLEVEL_DIR"/.*.yml
|
||||||
|
do
|
||||||
|
ci_spawn "$CI_YAMLLINT" --strict "$MY_FILE" ||
|
||||||
|
CI_LINT_COUNTER=$((CI_LINT_COUNTER + 1))
|
||||||
|
done
|
||||||
|
else
|
||||||
|
ci_warn "program not found: 'yamllint'; skipping checks"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_lint_ci_scripts {
|
||||||
|
ci_info "linting: CI scripts"
|
||||||
|
local MY_FILE
|
||||||
|
if [[ -x $CI_SHELLCHECK ]]
|
||||||
|
then
|
||||||
|
ci_spawn "$CI_SHELLCHECK" --version
|
||||||
|
for MY_FILE in "$CI_SCRIPT_DIR"/*.sh
|
||||||
|
do
|
||||||
|
ci_spawn "$CI_SHELLCHECK" -x "$MY_FILE" ||
|
||||||
|
CI_LINT_COUNTER=$((CI_LINT_COUNTER + 1))
|
||||||
|
done
|
||||||
|
else
|
||||||
|
ci_warn "program not found: 'shellcheck'; skipping checks"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_lint_ci_scripts_license {
|
||||||
|
ci_info "linting: CI scripts license"
|
||||||
|
ci_spawn grep -F "MIT License" ci/LICENSE_MIT.txt || {
|
||||||
|
ci_warn "bad or missing CI license file: '$CI_SCRIPT_DIR/LICENSE_MIT.txt'"
|
||||||
|
CI_LINT_COUNTER=$((CI_LINT_COUNTER + 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "usage: $CI_SCRIPT_NAME"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
local opt
|
||||||
|
while getopts ":" opt
|
||||||
|
do
|
||||||
|
# This ain't a while-loop. It only pretends to be.
|
||||||
|
[[ $1 == -[?h]* || $1 == --help ]] && usage
|
||||||
|
ci_err "unknown option: '$1'"
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
# And... go!
|
||||||
|
[[ $# -eq 0 ]] || ci_err "unexpected argument: '$1'"
|
||||||
|
ci_lint_ci_config_files
|
||||||
|
ci_lint_ci_scripts
|
||||||
|
ci_lint_ci_scripts_license
|
||||||
|
if [[ $CI_LINT_COUNTER -eq 0 ]]
|
||||||
|
then
|
||||||
|
ci_info "success!"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
ci_info "failed on $CI_LINT_COUNTER file(s)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
194
ci/ci_verify_cmake.sh
Executable file
@@ -0,0 +1,194 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Copyright (c) 2019-2024 Cosmin Truta.
|
||||||
|
#
|
||||||
|
# Use, modification and distribution are subject to the MIT License.
|
||||||
|
# Please see the accompanying file LICENSE_MIT.txt
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
# shellcheck source="ci/lib/ci.lib.sh"
|
||||||
|
source "$(dirname "$0")/lib/ci.lib.sh"
|
||||||
|
cd "$CI_TOPLEVEL_DIR"
|
||||||
|
|
||||||
|
CI_SRC_DIR="$CI_TOPLEVEL_DIR"
|
||||||
|
CI_OUT_DIR="$CI_TOPLEVEL_DIR/out"
|
||||||
|
CI_BUILD_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.build"
|
||||||
|
CI_INSTALL_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
|
||||||
|
|
||||||
|
# Keep the following relative paths in sync with the absolute paths.
|
||||||
|
# We use them for the benefit of native Windows tools that might be
|
||||||
|
# otherwise confused by the path encoding used by Bash-on-Windows.
|
||||||
|
CI_BUILD_TO_SRC_RELDIR="../.."
|
||||||
|
CI_BUILD_TO_INSTALL_RELDIR="../ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
|
||||||
|
|
||||||
|
function ci_init_build {
|
||||||
|
# Ensure that the mandatory variables are initialized.
|
||||||
|
CI_CMAKE="${CI_CMAKE:-cmake}"
|
||||||
|
CI_CTEST="${CI_CTEST:-ctest}"
|
||||||
|
CI_CMAKE_BUILD_TYPE="${CI_CMAKE_BUILD_TYPE:-Release}"
|
||||||
|
[[ -x $(command -v ninja) ]] &&
|
||||||
|
CI_CMAKE_GENERATOR="${CI_CMAKE_GENERATOR:-Ninja}"
|
||||||
|
if [[ $CI_CMAKE_GENERATOR == "Visual Studio"* ]]
|
||||||
|
then
|
||||||
|
# Clean up incidental mixtures of Windows and Bash-on-Windows
|
||||||
|
# environment variables, to avoid confusing MSBuild.
|
||||||
|
[[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP
|
||||||
|
[[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP
|
||||||
|
# Ensure that CI_CMAKE_GENERATOR_PLATFORM is initialized for this generator.
|
||||||
|
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] ||
|
||||||
|
ci_err_internal "missing \$CI_CMAKE_GENERATOR_PLATFORM"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_trace_build {
|
||||||
|
ci_info "## START OF CONFIGURATION ##"
|
||||||
|
ci_info "build arch: $CI_BUILD_ARCH"
|
||||||
|
ci_info "build system: $CI_BUILD_SYSTEM"
|
||||||
|
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] && {
|
||||||
|
ci_info "target arch: $CI_TARGET_ARCH"
|
||||||
|
ci_info "target system: $CI_TARGET_SYSTEM"
|
||||||
|
}
|
||||||
|
ci_info "source directory: $CI_SRC_DIR"
|
||||||
|
ci_info "build directory: $CI_BUILD_DIR"
|
||||||
|
ci_info "install directory: $CI_INSTALL_DIR"
|
||||||
|
ci_info "environment option: \$CI_CMAKE: '$CI_CMAKE'"
|
||||||
|
ci_info "environment option: \$CI_CMAKE_GENERATOR: '$CI_CMAKE_GENERATOR'"
|
||||||
|
ci_info "environment option: \$CI_CMAKE_GENERATOR_PLATFORM: '$CI_CMAKE_GENERATOR_PLATFORM'"
|
||||||
|
ci_info "environment option: \$CI_CMAKE_BUILD_TYPE: '$CI_CMAKE_BUILD_TYPE'"
|
||||||
|
ci_info "environment option: \$CI_CMAKE_BUILD_FLAGS: '$CI_CMAKE_BUILD_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_CMAKE_TOOLCHAIN_FILE: '$CI_CMAKE_TOOLCHAIN_FILE'"
|
||||||
|
ci_info "environment option: \$CI_CMAKE_VARS: '$CI_CMAKE_VARS'"
|
||||||
|
ci_info "environment option: \$CI_CTEST: '$CI_CTEST'"
|
||||||
|
ci_info "environment option: \$CI_CTEST_FLAGS: '$CI_CTEST_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_CC: '$CI_CC'"
|
||||||
|
ci_info "environment option: \$CI_CC_FLAGS: '$CI_CC_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_AR: '$CI_AR'"
|
||||||
|
ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'"
|
||||||
|
ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'"
|
||||||
|
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
|
||||||
|
ci_info "environment option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
|
||||||
|
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
|
||||||
|
ci_info "executable: \$CI_CMAKE: $(command -V "$CI_CMAKE")"
|
||||||
|
ci_info "executable: \$CI_CTEST: $(command -V "$CI_CTEST")"
|
||||||
|
[[ $CI_CC ]] &&
|
||||||
|
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
|
||||||
|
[[ $CI_AR ]] &&
|
||||||
|
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
|
||||||
|
[[ $CI_RANLIB ]] &&
|
||||||
|
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
|
||||||
|
ci_info "## END OF CONFIGURATION ##"
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_cleanup_old_build {
|
||||||
|
if [[ -e $CI_BUILD_DIR || -e $CI_INSTALL_DIR ]]
|
||||||
|
then
|
||||||
|
ci_info "## START OF PRE-BUILD CLEANUP ##"
|
||||||
|
ci_spawn rm -fr "$CI_BUILD_DIR"
|
||||||
|
ci_spawn rm -fr "$CI_INSTALL_DIR"
|
||||||
|
ci_info "## END OF PRE-BUILD CLEANUP ##"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_build {
|
||||||
|
ci_info "## START OF BUILD ##"
|
||||||
|
ci_spawn "$(command -v "$CI_CMAKE")" --version
|
||||||
|
ci_spawn "$(command -v "$CI_CTEST")" --version
|
||||||
|
[[ $CI_CMAKE_GENERATOR == *"Ninja"* ]] &&
|
||||||
|
ci_spawn "$(command -v ninja)" --version
|
||||||
|
# Initialize ALL_CC_FLAGS as a string.
|
||||||
|
local ALL_CC_FLAGS="$CI_CC_FLAGS"
|
||||||
|
[[ $CI_SANITIZERS ]] &&
|
||||||
|
ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_CC_FLAGS"
|
||||||
|
# Initialize ALL_CMAKE_VARS, ALL_CMAKE_BUILD_FLAGS and ALL_CTEST_FLAGS as arrays.
|
||||||
|
local ALL_CMAKE_VARS=()
|
||||||
|
[[ $CI_CMAKE_TOOLCHAIN_FILE ]] &&
|
||||||
|
ALL_CMAKE_VARS+=(-DCMAKE_TOOLCHAIN_FILE="$CI_CMAKE_TOOLCHAIN_FILE")
|
||||||
|
[[ $CI_CC ]] &&
|
||||||
|
ALL_CMAKE_VARS+=(-DCMAKE_C_COMPILER="$CI_CC")
|
||||||
|
[[ $ALL_CC_FLAGS ]] &&
|
||||||
|
ALL_CMAKE_VARS+=(-DCMAKE_C_FLAGS="$ALL_CC_FLAGS")
|
||||||
|
[[ $CI_AR ]] && {
|
||||||
|
# Use the full path of CI_AR to work around a CMake error.
|
||||||
|
ALL_CMAKE_VARS+=(-DCMAKE_AR="$(command -v "$CI_AR")")
|
||||||
|
}
|
||||||
|
[[ $CI_RANLIB ]] && {
|
||||||
|
# Use the full path of CI_RANLIB to work around a CMake error.
|
||||||
|
ALL_CMAKE_VARS+=(-DCMAKE_RANLIB="$(command -v "$CI_RANLIB")")
|
||||||
|
}
|
||||||
|
ALL_CMAKE_VARS+=(-DCMAKE_BUILD_TYPE="$CI_CMAKE_BUILD_TYPE")
|
||||||
|
ALL_CMAKE_VARS+=(-DCMAKE_VERBOSE_MAKEFILE=ON)
|
||||||
|
ALL_CMAKE_VARS+=($CI_CMAKE_VARS)
|
||||||
|
local ALL_CMAKE_BUILD_FLAGS=($CI_CMAKE_BUILD_FLAGS)
|
||||||
|
local ALL_CTEST_FLAGS=($CI_CTEST_FLAGS)
|
||||||
|
# Export the CMake environment variables.
|
||||||
|
[[ $CI_CMAKE_GENERATOR ]] &&
|
||||||
|
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
|
||||||
|
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
|
||||||
|
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
|
||||||
|
# Build!
|
||||||
|
# Use $CI_BUILD_TO_SRC_RELDIR and $CI_BUILD_TO_INSTALL_RELDIR
|
||||||
|
# instead of $CI_SRC_DIR and $CI_INSTALL_DIR from this point onwards.
|
||||||
|
ci_spawn mkdir -p "$CI_BUILD_DIR"
|
||||||
|
ci_spawn cd "$CI_BUILD_DIR"
|
||||||
|
[[ $CI_BUILD_TO_SRC_RELDIR -ef $CI_SRC_DIR ]] ||
|
||||||
|
ci_err_internal "bad or missing \$CI_BUILD_TO_SRC_RELDIR"
|
||||||
|
ci_spawn mkdir -p "$CI_INSTALL_DIR"
|
||||||
|
[[ $CI_BUILD_TO_INSTALL_RELDIR -ef $CI_INSTALL_DIR ]] ||
|
||||||
|
ci_err_internal "bad or missing \$CI_BUILD_TO_INSTALL_RELDIR"
|
||||||
|
# Spawn "cmake ...".
|
||||||
|
ci_spawn "$CI_CMAKE" -DCMAKE_INSTALL_PREFIX="$CI_BUILD_TO_INSTALL_RELDIR" \
|
||||||
|
"${ALL_CMAKE_VARS[@]}" \
|
||||||
|
"$CI_BUILD_TO_SRC_RELDIR"
|
||||||
|
# Spawn "cmake --build ...".
|
||||||
|
ci_spawn "$CI_CMAKE" --build . \
|
||||||
|
--config "$CI_CMAKE_BUILD_TYPE" \
|
||||||
|
"${ALL_CMAKE_BUILD_FLAGS[@]}"
|
||||||
|
ci_expr $((CI_NO_TEST)) || {
|
||||||
|
# Spawn "ctest" if testing is not disabled.
|
||||||
|
ci_spawn "$CI_CTEST" --build-config "$CI_CMAKE_BUILD_TYPE" \
|
||||||
|
"${ALL_CTEST_FLAGS[@]}"
|
||||||
|
}
|
||||||
|
ci_expr $((CI_NO_INSTALL)) || {
|
||||||
|
# Spawn "cmake --build ... --target install" if installation is not disabled.
|
||||||
|
ci_spawn "$CI_CMAKE" --build . \
|
||||||
|
--config "$CI_CMAKE_BUILD_TYPE" \
|
||||||
|
--target install \
|
||||||
|
"${ALL_CMAKE_BUILD_FLAGS[@]}"
|
||||||
|
}
|
||||||
|
ci_expr $((CI_NO_CLEAN)) || {
|
||||||
|
# Spawn "make --build ... --target clean" if cleaning is not disabled.
|
||||||
|
ci_spawn "$CI_CMAKE" --build . \
|
||||||
|
--config "$CI_CMAKE_BUILD_TYPE" \
|
||||||
|
--target clean \
|
||||||
|
"${ALL_CMAKE_BUILD_FLAGS[@]}"
|
||||||
|
}
|
||||||
|
ci_info "## END OF BUILD ##"
|
||||||
|
}
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "usage: $CI_SCRIPT_NAME"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
local opt
|
||||||
|
while getopts ":" opt
|
||||||
|
do
|
||||||
|
# This ain't a while-loop. It only pretends to be.
|
||||||
|
[[ $1 == -[?h]* || $1 == --help ]] && usage
|
||||||
|
ci_err "unknown option: '$1'"
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
ci_init_build
|
||||||
|
ci_trace_build
|
||||||
|
[[ $# -eq 0 ]] || {
|
||||||
|
ci_info "note: this program accepts environment options only"
|
||||||
|
ci_err "unexpected argument: '$1'"
|
||||||
|
}
|
||||||
|
ci_cleanup_old_build
|
||||||
|
ci_build
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
148
ci/ci_verify_configure.sh
Executable file
@@ -0,0 +1,148 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Copyright (c) 2019-2024 Cosmin Truta.
|
||||||
|
#
|
||||||
|
# Use, modification and distribution are subject to the MIT License.
|
||||||
|
# Please see the accompanying file LICENSE_MIT.txt
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
# shellcheck source="ci/lib/ci.lib.sh"
|
||||||
|
source "$(dirname "$0")/lib/ci.lib.sh"
|
||||||
|
cd "$CI_TOPLEVEL_DIR"
|
||||||
|
|
||||||
|
CI_SRC_DIR="$CI_TOPLEVEL_DIR"
|
||||||
|
CI_OUT_DIR="$CI_TOPLEVEL_DIR/out"
|
||||||
|
CI_BUILD_DIR="$CI_OUT_DIR/ci_verify_configure.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.build"
|
||||||
|
CI_INSTALL_DIR="$CI_OUT_DIR/ci_verify_configure.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
|
||||||
|
|
||||||
|
function ci_init_build {
|
||||||
|
# Ensure that the mandatory variables are initialized.
|
||||||
|
CI_MAKE="${CI_MAKE:-make}"
|
||||||
|
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] || {
|
||||||
|
# For native builds, set CI_CC to "cc" by default if the cc command is available.
|
||||||
|
# The configure script defaults CC to "gcc", which is not always a good idea.
|
||||||
|
[[ -x $(command -v cc) ]] && CI_CC="${CI_CC:-cc}"
|
||||||
|
}
|
||||||
|
# Ensure that the CI_ variables that cannot be customized reliably are not initialized.
|
||||||
|
[[ ! $CI_CONFIGURE_VARS ]] ||
|
||||||
|
ci_err "unsupported: \$CI_CONFIGURE_VARS='$CI_CONFIGURE_VARS'"
|
||||||
|
[[ ! $CI_MAKE_VARS ]] ||
|
||||||
|
ci_err "unsupported: \$CI_MAKE_VARS='$CI_MAKE_VARS'"
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_trace_build {
|
||||||
|
ci_info "## START OF CONFIGURATION ##"
|
||||||
|
ci_info "build arch: $CI_BUILD_ARCH"
|
||||||
|
ci_info "build system: $CI_BUILD_SYSTEM"
|
||||||
|
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] && {
|
||||||
|
ci_info "target arch: $CI_TARGET_ARCH"
|
||||||
|
ci_info "target system: $CI_TARGET_SYSTEM"
|
||||||
|
}
|
||||||
|
ci_info "source directory: $CI_SRC_DIR"
|
||||||
|
ci_info "build directory: $CI_BUILD_DIR"
|
||||||
|
ci_info "install directory: $CI_INSTALL_DIR"
|
||||||
|
ci_info "environment option: \$CI_CONFIGURE_FLAGS: '$CI_CONFIGURE_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_MAKE: '$CI_MAKE'"
|
||||||
|
ci_info "environment option: \$CI_MAKE_FLAGS: '$CI_MAKE_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_CC: '$CI_CC'"
|
||||||
|
ci_info "environment option: \$CI_CC_FLAGS: '$CI_CC_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_CPP: '$CI_CPP'"
|
||||||
|
ci_info "environment option: \$CI_CPP_FLAGS: '$CI_CPP_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_AR: '$CI_AR'"
|
||||||
|
ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'"
|
||||||
|
ci_info "environment option: \$CI_LD: '$CI_LD'"
|
||||||
|
ci_info "environment option: \$CI_LD_FLAGS: '$CI_LD_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'"
|
||||||
|
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
|
||||||
|
ci_info "environment option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
|
||||||
|
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
|
||||||
|
ci_info "executable: \$CI_MAKE: $(command -V "$CI_MAKE")"
|
||||||
|
[[ $CI_CC ]] &&
|
||||||
|
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
|
||||||
|
[[ $CI_CPP ]] &&
|
||||||
|
ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")"
|
||||||
|
[[ $CI_AR ]] &&
|
||||||
|
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
|
||||||
|
[[ $CI_RANLIB ]] &&
|
||||||
|
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
|
||||||
|
[[ $CI_LD ]] &&
|
||||||
|
ci_info "executable: \$CI_LD: $(command -V "$CI_LD")"
|
||||||
|
ci_info "## END OF CONFIGURATION ##"
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_cleanup_old_build {
|
||||||
|
if [[ -e $CI_BUILD_DIR || -e $CI_INSTALL_DIR ]]
|
||||||
|
then
|
||||||
|
ci_info "## START OF PRE-BUILD CLEANUP ##"
|
||||||
|
ci_spawn rm -fr "$CI_BUILD_DIR"
|
||||||
|
ci_spawn rm -fr "$CI_INSTALL_DIR"
|
||||||
|
ci_info "## END OF PRE-BUILD CLEANUP ##"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_build {
|
||||||
|
ci_info "## START OF BUILD ##"
|
||||||
|
# Export the configure build environment.
|
||||||
|
[[ $CI_CC ]] && ci_spawn export CC="$CI_CC"
|
||||||
|
[[ $CI_CC_FLAGS ]] && ci_spawn export CFLAGS="$CI_CC_FLAGS"
|
||||||
|
[[ $CI_CPP ]] && ci_spawn export CPP="$CI_CPP"
|
||||||
|
[[ $CI_CPP_FLAGS ]] && ci_spawn export CPPFLAGS="$CI_CPP_FLAGS"
|
||||||
|
[[ $CI_AR ]] && ci_spawn export AR="$CI_AR"
|
||||||
|
[[ $CI_RANLIB ]] && ci_spawn export RANLIB="$CI_RANLIB"
|
||||||
|
[[ $CI_LD ]] && ci_spawn export LD="$CI_LD"
|
||||||
|
[[ $CI_LD_FLAGS ]] && ci_spawn export LDFLAGS="$CI_LD_FLAGS"
|
||||||
|
[[ $CI_SANITIZERS ]] && {
|
||||||
|
ci_spawn export CFLAGS="-fsanitize=$CI_SANITIZERS ${CFLAGS:-"-O2"}"
|
||||||
|
ci_spawn export LDFLAGS="-fsanitize=$CI_SANITIZERS $LDFLAGS"
|
||||||
|
}
|
||||||
|
# Build!
|
||||||
|
ci_spawn mkdir -p "$CI_BUILD_DIR"
|
||||||
|
ci_spawn cd "$CI_BUILD_DIR"
|
||||||
|
# Spawn "configure".
|
||||||
|
ci_spawn "$CI_SRC_DIR/configure" --prefix="$CI_INSTALL_DIR" $CI_CONFIGURE_FLAGS
|
||||||
|
# Spawn "make".
|
||||||
|
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS
|
||||||
|
ci_expr $((CI_NO_TEST)) || {
|
||||||
|
# Spawn "make test" if testing is not disabled.
|
||||||
|
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS test
|
||||||
|
}
|
||||||
|
ci_expr $((CI_NO_INSTALL)) || {
|
||||||
|
# Spawn "make install" if installation is not disabled.
|
||||||
|
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS install
|
||||||
|
}
|
||||||
|
ci_expr $((CI_NO_CLEAN)) || {
|
||||||
|
# Spawn "make clean" and "make distclean" if cleaning is not disabled.
|
||||||
|
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS clean
|
||||||
|
ci_spawn "$CI_MAKE" $CI_MAKE_FLAGS distclean
|
||||||
|
}
|
||||||
|
ci_info "## END OF BUILD ##"
|
||||||
|
}
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "usage: $CI_SCRIPT_NAME"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
local opt
|
||||||
|
while getopts ":" opt
|
||||||
|
do
|
||||||
|
# This ain't a while-loop. It only pretends to be.
|
||||||
|
[[ $1 == -[?h]* || $1 == --help ]] && usage
|
||||||
|
ci_err "unknown option: '$1'"
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
# And... go!
|
||||||
|
ci_init_build
|
||||||
|
ci_trace_build
|
||||||
|
[[ $# -eq 0 ]] || {
|
||||||
|
ci_info "note: this program accepts environment options only"
|
||||||
|
ci_err "unexpected argument: '$1'"
|
||||||
|
}
|
||||||
|
ci_cleanup_old_build
|
||||||
|
ci_build
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
163
ci/ci_verify_makefiles.sh
Executable file
@@ -0,0 +1,163 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Copyright (c) 2019-2024 Cosmin Truta.
|
||||||
|
#
|
||||||
|
# Use, modification and distribution are subject to the MIT License.
|
||||||
|
# Please see the accompanying file LICENSE_MIT.txt
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
# shellcheck source="ci/lib/ci.lib.sh"
|
||||||
|
source "$(dirname "$0")/lib/ci.lib.sh"
|
||||||
|
cd "$CI_TOPLEVEL_DIR"
|
||||||
|
|
||||||
|
CI_SRC_DIR="$CI_TOPLEVEL_DIR"
|
||||||
|
|
||||||
|
function ci_init_build {
|
||||||
|
# Ensure that the mandatory variables are initialized.
|
||||||
|
CI_MAKE="${CI_MAKE:-make}"
|
||||||
|
case "$CI_CC" in
|
||||||
|
( *clang* )
|
||||||
|
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.clang"}" ;;
|
||||||
|
( *gcc* )
|
||||||
|
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.gcc"}" ;;
|
||||||
|
( * )
|
||||||
|
CI_MAKEFILES="${CI_MAKEFILES:-"scripts/makefile.std"}" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_trace_build {
|
||||||
|
ci_info "## START OF CONFIGURATION ##"
|
||||||
|
ci_info "build arch: $CI_BUILD_ARCH"
|
||||||
|
ci_info "build system: $CI_BUILD_SYSTEM"
|
||||||
|
[[ "$CI_TARGET_SYSTEM.$CI_TARGET_ARCH" != "$CI_BUILD_SYSTEM.$CI_BUILD_ARCH" ]] && {
|
||||||
|
ci_info "target arch: $CI_TARGET_ARCH"
|
||||||
|
ci_info "target system: $CI_TARGET_SYSTEM"
|
||||||
|
}
|
||||||
|
ci_info "source directory: $CI_SRC_DIR"
|
||||||
|
ci_info "environment option: \$CI_MAKEFILES: '$CI_MAKEFILES'"
|
||||||
|
ci_info "environment option: \$CI_MAKE: '$CI_MAKE'"
|
||||||
|
ci_info "environment option: \$CI_MAKE_FLAGS: '$CI_MAKE_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_MAKE_VARS: '$CI_MAKE_VARS'"
|
||||||
|
ci_info "environment option: \$CI_CC: '$CI_CC'"
|
||||||
|
ci_info "environment option: \$CI_CC_FLAGS: '$CI_CC_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_CPP: '$CI_CPP'"
|
||||||
|
ci_info "environment option: \$CI_CPP_FLAGS: '$CI_CPP_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_AR: '$CI_AR'"
|
||||||
|
ci_info "environment option: \$CI_RANLIB: '$CI_RANLIB'"
|
||||||
|
ci_info "environment option: \$CI_LD: '$CI_LD'"
|
||||||
|
ci_info "environment option: \$CI_LD_FLAGS: '$CI_LD_FLAGS'"
|
||||||
|
ci_info "environment option: \$CI_LIBS: '$CI_LIBS'"
|
||||||
|
ci_info "environment option: \$CI_SANITIZERS: '$CI_SANITIZERS'"
|
||||||
|
ci_info "environment option: \$CI_NO_TEST: '$CI_NO_TEST'"
|
||||||
|
ci_info "environment option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
|
||||||
|
ci_info "executable: \$CI_MAKE: $(command -V "$CI_MAKE")"
|
||||||
|
[[ $CI_CC ]] &&
|
||||||
|
ci_info "executable: \$CI_CC: $(command -V "$CI_CC")"
|
||||||
|
[[ $CI_CPP ]] &&
|
||||||
|
ci_info "executable: \$CI_CPP: $(command -V "$CI_CPP")"
|
||||||
|
[[ $CI_AR ]] &&
|
||||||
|
ci_info "executable: \$CI_AR: $(command -V "$CI_AR")"
|
||||||
|
[[ $CI_RANLIB ]] &&
|
||||||
|
ci_info "executable: \$CI_RANLIB: $(command -V "$CI_RANLIB")"
|
||||||
|
[[ $CI_LD ]] &&
|
||||||
|
ci_info "executable: \$CI_LD: $(command -V "$CI_LD")"
|
||||||
|
ci_info "## END OF CONFIGURATION ##"
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_cleanup_old_build {
|
||||||
|
# Any old makefile-based build will most likely leave a mess
|
||||||
|
# of object files behind if interrupted, e.g., via Ctrl+C.
|
||||||
|
# There may be other files behind, depending on what makefile
|
||||||
|
# had been used. We cannot easily enumerate all of those.
|
||||||
|
# Fortunately, for a clean makefiles-based build, it should be
|
||||||
|
# sufficient to remove the old object files only.
|
||||||
|
ci_info "## START OF PRE-BUILD CLEANUP ##"
|
||||||
|
local MY_FILE
|
||||||
|
find "$CI_SRC_DIR" -maxdepth 1 \( -iname "*.o" -o -iname "*.obj" \) |
|
||||||
|
while IFS="" read -r MY_FILE
|
||||||
|
do
|
||||||
|
ci_spawn rm -fr "$MY_FILE"
|
||||||
|
done
|
||||||
|
ci_info "## END OF PRE-BUILD CLEANUP ##"
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_build {
|
||||||
|
ci_info "## START OF BUILD ##"
|
||||||
|
# Initialize ALL_CC_FLAGS and ALL_LD_FLAGS as strings.
|
||||||
|
local ALL_CC_FLAGS="$CI_CC_FLAGS"
|
||||||
|
local ALL_LD_FLAGS="$CI_LD_FLAGS"
|
||||||
|
[[ $CI_SANITIZERS ]] && {
|
||||||
|
ALL_CC_FLAGS="-fsanitize=$CI_SANITIZERS ${ALL_CC_FLAGS:-"-O2"}"
|
||||||
|
ALL_LD_FLAGS="-fsanitize=$CI_SANITIZERS $ALL_LD_FLAGS"
|
||||||
|
}
|
||||||
|
# Initialize ALL_MAKE_FLAGS and ALL_MAKE_VARS as arrays.
|
||||||
|
local ALL_MAKE_FLAGS=($CI_MAKE_FLAGS)
|
||||||
|
local ALL_MAKE_VARS=()
|
||||||
|
[[ $CI_CC ]] && ALL_MAKE_VARS+=(CC="$CI_CC")
|
||||||
|
[[ $ALL_CC_FLAGS ]] && ALL_MAKE_VARS+=(CFLAGS="$ALL_CC_FLAGS")
|
||||||
|
[[ $CI_CPP ]] && ALL_MAKE_VARS+=(CPP="$CI_CPP")
|
||||||
|
[[ $CI_CPP_FLAGS ]] && ALL_MAKE_VARS+=(CPPFLAGS="$CI_CPP_FLAGS")
|
||||||
|
[[ $CI_AR ]] && ALL_MAKE_VARS+=(
|
||||||
|
AR="${CI_AR:-ar}"
|
||||||
|
AR_RC="${CI_AR:-ar} rc"
|
||||||
|
)
|
||||||
|
[[ $CI_RANLIB ]] && ALL_MAKE_VARS+=(RANLIB="$CI_RANLIB")
|
||||||
|
[[ $CI_LD ]] && ALL_MAKE_VARS+=(LD="$CI_LD")
|
||||||
|
[[ $ALL_LD_FLAGS ]] && ALL_MAKE_VARS+=(LDFLAGS="$ALL_LD_FLAGS")
|
||||||
|
[[ $CI_LIBS ]] && ALL_MAKE_VARS+=(LIBS="$CI_LIBS")
|
||||||
|
ALL_MAKE_VARS+=($CI_MAKE_VARS)
|
||||||
|
# Build!
|
||||||
|
local MY_MAKEFILE
|
||||||
|
for MY_MAKEFILE in $CI_MAKEFILES
|
||||||
|
do
|
||||||
|
ci_info "using makefile: $MY_MAKEFILE"
|
||||||
|
# Spawn "make".
|
||||||
|
ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \
|
||||||
|
"${ALL_MAKE_FLAGS[@]}" \
|
||||||
|
"${ALL_MAKE_VARS[@]}"
|
||||||
|
ci_expr $((CI_NO_TEST)) || {
|
||||||
|
# Spawn "make test" if testing is not disabled.
|
||||||
|
ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \
|
||||||
|
"${ALL_MAKE_FLAGS[@]}" \
|
||||||
|
"${ALL_MAKE_VARS[@]}" \
|
||||||
|
test
|
||||||
|
}
|
||||||
|
ci_expr $((CI_NO_CLEAN)) || {
|
||||||
|
# Spawn "make clean" if cleaning is not disabled.
|
||||||
|
ci_spawn "$CI_MAKE" -f "$MY_MAKEFILE" \
|
||||||
|
"${ALL_MAKE_FLAGS[@]}" \
|
||||||
|
"${ALL_MAKE_VARS[@]}" \
|
||||||
|
clean
|
||||||
|
}
|
||||||
|
done
|
||||||
|
ci_info "## END OF BUILD ##"
|
||||||
|
}
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
echo "usage: $CI_SCRIPT_NAME"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function main {
|
||||||
|
local opt
|
||||||
|
while getopts ":" opt
|
||||||
|
do
|
||||||
|
# This ain't a while-loop. It only pretends to be.
|
||||||
|
[[ $1 == -[?h]* || $1 == --help ]] && usage
|
||||||
|
ci_err "unknown option: '$1'"
|
||||||
|
done
|
||||||
|
shift $((OPTIND - 1))
|
||||||
|
# And... go!
|
||||||
|
ci_init_build
|
||||||
|
ci_trace_build
|
||||||
|
[[ $# -eq 0 ]] || {
|
||||||
|
ci_info "note: this program accepts environment options only"
|
||||||
|
ci_err "unexpected argument: '$1'"
|
||||||
|
}
|
||||||
|
ci_cleanup_old_build
|
||||||
|
ci_build
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
90
ci/lib/ci.lib.sh
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# Copyright (c) 2019-2024 Cosmin Truta.
|
||||||
|
#
|
||||||
|
# Use, modification and distribution are subject to the MIT License.
|
||||||
|
# Please see the accompanying file LICENSE_MIT.txt
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
test -f "$BASH_SOURCE" ||
|
||||||
|
echo >&2 "warning: this module requires Bash version 3 or newer"
|
||||||
|
test "${#BASH_SOURCE[@]}" -gt 1 ||
|
||||||
|
echo >&2 "warning: this module should be sourced from a Bash script"
|
||||||
|
|
||||||
|
# Reset the locale to avoid surprises from locale-dependent commands.
|
||||||
|
export LC_ALL=C
|
||||||
|
export LANG=C
|
||||||
|
export LANGUAGE=C
|
||||||
|
|
||||||
|
# Reset CDPATH to avoid surprises from the "cd" command.
|
||||||
|
export CDPATH=""
|
||||||
|
|
||||||
|
# Initialize the global constants CI_SCRIPT_{NAME,DIR} and CI_TOPLEVEL_DIR.
|
||||||
|
CI_SCRIPT_NAME="$(basename -- "$0")"
|
||||||
|
CI_SCRIPT_DIR="$(cd "$(dirname -- "$0")" && pwd)"
|
||||||
|
CI_TOPLEVEL_DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||||
|
|
||||||
|
# Initialize the global constants CI_BUILD_{...} for the host build platform.
|
||||||
|
CI_BUILD_ARCH="${CI_BUILD_ARCH:-"$(uname -m | tr 'A-Z/\.-' 'a-z____')"}"
|
||||||
|
CI_BUILD_SYSTEM="${CI_BUILD_SYSTEM:-"$(uname -s | tr 'A-Z/\.-' 'a-z____')"}"
|
||||||
|
|
||||||
|
# Initialize the global constants CI_TARGET_{...} for the target platform.
|
||||||
|
CI_TARGET_ARCH="${CI_TARGET_ARCH:-"$CI_BUILD_ARCH"}"
|
||||||
|
CI_TARGET_SYSTEM="${CI_TARGET_SYSTEM:-"$CI_BUILD_SYSTEM"}"
|
||||||
|
|
||||||
|
function ci_info {
|
||||||
|
printf >&2 "%s: %s\\n" "$CI_SCRIPT_NAME" "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_warn {
|
||||||
|
printf >&2 "%s: warning: %s\\n" "$CI_SCRIPT_NAME" "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_err {
|
||||||
|
printf >&2 "%s: error: %s\\n" "$CI_SCRIPT_NAME" "$*"
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_err_internal {
|
||||||
|
printf >&2 "%s: internal error: %s\\n" "$CI_SCRIPT_NAME" "$*"
|
||||||
|
printf >&2 "ABORTED\\n"
|
||||||
|
# Exit with the conventional SIGABRT code.
|
||||||
|
exit 134
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_expr {
|
||||||
|
if [[ ${*:-0} == [0-9] ]]
|
||||||
|
then
|
||||||
|
# This is the same as in the else-branch below, albeit much faster
|
||||||
|
# for our intended use cases.
|
||||||
|
return $((!$1))
|
||||||
|
else
|
||||||
|
# The funny-looking compound command "... && return $? || return $?"
|
||||||
|
# allows the execution to continue uninterrupted under "set -e".
|
||||||
|
expr >/dev/null "$@" && return $? || return $?
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function ci_spawn {
|
||||||
|
printf >&2 "%s: executing:" "$CI_SCRIPT_NAME"
|
||||||
|
printf >&2 " %q" "$@"
|
||||||
|
printf >&2 "\\n"
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure that the internal initialization is correct.
|
||||||
|
[[ $CI_TOPLEVEL_DIR/ci/lib/ci.lib.sh -ef ${BASH_SOURCE[0]} ]] ||
|
||||||
|
ci_err_internal "bad or missing \$CI_TOPLEVEL_DIR"
|
||||||
|
[[ $CI_SCRIPT_DIR/$CI_SCRIPT_NAME -ef $0 ]] ||
|
||||||
|
ci_err_internal "bad or missing \$CI_SCRIPT_DIR/\$CI_SCRIPT_NAME"
|
||||||
|
[[ $CI_BUILD_ARCH && $CI_BUILD_SYSTEM ]] ||
|
||||||
|
ci_err_internal "missing \$CI_BUILD_ARCH or \$CI_BUILD_SYSTEM"
|
||||||
|
[[ $CI_TARGET_ARCH && $CI_TARGET_SYSTEM ]] ||
|
||||||
|
ci_err_internal "missing \$CI_TARGET_ARCH or \$CI_TARGET_SYSTEM"
|
||||||
|
|
||||||
|
# Ensure that the user initialization is correct.
|
||||||
|
[[ ${CI_NO_TEST:-0} == [01] ]] ||
|
||||||
|
ci_err "bad boolean option: \$CI_NO_TEST: '$CI_NO_TEST'"
|
||||||
|
[[ ${CI_NO_INSTALL:-0} == [01] ]] ||
|
||||||
|
ci_err "bad boolean option: \$CI_NO_INSTALL: '$CI_NO_INSTALL'"
|
||||||
|
[[ ${CI_NO_CLEAN:-0} == [01] ]] ||
|
||||||
|
ci_err "bad boolean option: \$CI_NO_CLEAN: '$CI_NO_CLEAN'"
|
||||||
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-2021 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* | MSYS*)
|
||||||
|
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/* | msys/*)
|
||||||
|
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:
|
||||||
1807
config.guess
vendored
Executable file
135
config.h.in
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/* 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 '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 <stdio.h> header file. */
|
||||||
|
#undef HAVE_STDIO_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
|
||||||
|
|
||||||
|
/* Enable LOONGARCH LSX optimizations */
|
||||||
|
#undef PNG_LOONGARCH_LSX_OPT
|
||||||
|
|
||||||
|
/* Turn on MIPS MMI optimizations at run-time */
|
||||||
|
#undef PNG_MIPS_MMI_API_SUPPORTED
|
||||||
|
|
||||||
|
/* Check for MIPS MMI support at run-time */
|
||||||
|
#undef PNG_MIPS_MMI_CHECK_SUPPORTED
|
||||||
|
|
||||||
|
/* Enable MIPS MMI optimizations */
|
||||||
|
#undef PNG_MIPS_MMI_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 all of the C89 standard headers exist (not just the ones
|
||||||
|
required in a freestanding environment). This macro is provided for
|
||||||
|
backward compatibility; new code need not use it. */
|
||||||
|
#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 the equivalent of the C99 'restrict' keyword, or to
|
||||||
|
nothing if this is not supported. Do not define if restrict is
|
||||||
|
supported only directly. */
|
||||||
|
#undef restrict
|
||||||
|
/* Work around a bug in older versions of Sun C++, which did not
|
||||||
|
#define __restrict__ or support _Restrict or __restrict__
|
||||||
|
even though the corresponding Sun C compiler ended up with
|
||||||
|
"#define restrict _Restrict" or "#define restrict __restrict__"
|
||||||
|
in the previous line. This workaround can be removed once
|
||||||
|
we assume Oracle Developer Studio 12.5 (2016) or later. */
|
||||||
|
#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__
|
||||||
|
# define _Restrict
|
||||||
|
# define __restrict__
|
||||||
|
#endif
|
||||||
1960
config.sub
vendored
Executable file
342
configure.ac
@@ -1,7 +1,7 @@
|
|||||||
# configure.ac
|
# configure.ac
|
||||||
|
|
||||||
|
# Copyright (c) 2018-2024 Cosmin Truta
|
||||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||||
# Last changed in libpng 1.6.25 [October 20, 2016]
|
|
||||||
|
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
@@ -25,8 +25,8 @@ AC_PREREQ([2.68])
|
|||||||
|
|
||||||
dnl Version number stuff here:
|
dnl Version number stuff here:
|
||||||
|
|
||||||
AC_INIT([libpng],[1.6.26],[png-mng-implement@lists.sourceforge.net])
|
AC_INIT([libpng],[1.6.41],[png-mng-implement@lists.sourceforge.net])
|
||||||
AC_CONFIG_MACRO_DIR([scripts])
|
AC_CONFIG_MACRO_DIR([scripts/autoconf])
|
||||||
|
|
||||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||||
# color-tests requires automake 1.11 or later
|
# color-tests requires automake 1.11 or later
|
||||||
@@ -46,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
|
|||||||
dnl AM_PREREQ([1.11.2])
|
dnl AM_PREREQ([1.11.2])
|
||||||
dnl stop configure from automagically running automake
|
dnl stop configure from automagically running automake
|
||||||
|
|
||||||
PNGLIB_VERSION=1.6.26
|
PNGLIB_VERSION=1.6.41
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=6
|
PNGLIB_MINOR=6
|
||||||
PNGLIB_RELEASE=26
|
PNGLIB_RELEASE=41
|
||||||
|
|
||||||
dnl End of version number stuff
|
dnl End of version number stuff
|
||||||
|
|
||||||
@@ -89,9 +89,27 @@ fi
|
|||||||
DFNCPP="$CPP"
|
DFNCPP="$CPP"
|
||||||
AC_SUBST(DFNCPP)
|
AC_SUBST(DFNCPP)
|
||||||
|
|
||||||
# -Werror cannot be passed to GCC in CFLAGS because configure will fail (it
|
AC_ARG_ENABLE([tests],
|
||||||
# checks the compiler with a program that generates a warning), add the
|
AS_HELP_STRING([--disable-tests],
|
||||||
# following option to deal with this
|
[do not build the test programs (default is to build)]),
|
||||||
|
[enable_tests="$enableval"],
|
||||||
|
[enable_tests=yes])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([ENABLE_TESTS],
|
||||||
|
[test "$enable_tests" != "no"])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([tools],
|
||||||
|
AS_HELP_STRING([--disable-tools],
|
||||||
|
[do not build the auxiliary tools (default is to build)]),
|
||||||
|
[enable_tools="$enableval"],
|
||||||
|
[enable_tools=yes])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([ENABLE_TOOLS],
|
||||||
|
[test "$enable_tools" != "no"])
|
||||||
|
|
||||||
|
# -Werror cannot be passed to GCC in CFLAGS because configure will fail
|
||||||
|
# (it checks the compiler with a program that generates a warning).
|
||||||
|
# Add the following option to deal with this:
|
||||||
AC_ARG_VAR(PNG_COPTS,
|
AC_ARG_VAR(PNG_COPTS,
|
||||||
[additional flags for the C compiler, use this for options that would]
|
[additional flags for the C compiler, use this for options that would]
|
||||||
[cause configure itself to fail])
|
[cause configure itself to fail])
|
||||||
@@ -114,10 +132,10 @@ AC_ARG_ENABLE(werror,
|
|||||||
CFLAGS="$sav_CFLAGS"
|
CFLAGS="$sav_CFLAGS"
|
||||||
fi],)
|
fi],)
|
||||||
|
|
||||||
# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
|
# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89.
|
||||||
# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
|
# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining
|
||||||
# This is incompatible with the new default mode, so we test for that and force the
|
# _POSIX_SOURCE to 1. This is incompatible with the new default mode, so
|
||||||
# "-std=c89" compiler option:
|
# we test for that and force the "-std=c89" compiler option:
|
||||||
AC_MSG_CHECKING([if we need to force back C standard to C89])
|
AC_MSG_CHECKING([if we need to force back C standard to C89])
|
||||||
AC_COMPILE_IFELSE(
|
AC_COMPILE_IFELSE(
|
||||||
[AC_LANG_PROGRAM([
|
[AC_LANG_PROGRAM([
|
||||||
@@ -133,23 +151,17 @@ AC_COMPILE_IFELSE(
|
|||||||
CFLAGS="$CFLAGS -std=c89"
|
CFLAGS="$CFLAGS -std=c89"
|
||||||
])
|
])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for structures and compiler characteristics.
|
||||||
AC_HEADER_STDC
|
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
|
||||||
AC_C_CONST
|
|
||||||
AC_TYPE_SIZE_T
|
|
||||||
AC_STRUCT_TM
|
AC_STRUCT_TM
|
||||||
AC_C_RESTRICT
|
AC_C_RESTRICT
|
||||||
|
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_STRTOD
|
AC_CHECK_FUNCS([pow], ,
|
||||||
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
|
[AC_CHECK_LIB([m], [pow], , [AC_MSG_ERROR([cannot find pow])])])
|
||||||
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
|
# Some later POSIX 1003.1 functions are required for test programs, failure
|
||||||
# is soft (the corresponding test program is not built).
|
# here is soft (the corresponding test program is not built).
|
||||||
AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])])
|
AC_CHECK_FUNC([clock_gettime], , [AC_MSG_WARN([not building timepng])])
|
||||||
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
|
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
|
||||||
|
|
||||||
AC_ARG_WITH(zlib-prefix,
|
AC_ARG_WITH(zlib-prefix,
|
||||||
@@ -157,8 +169,9 @@ AC_ARG_WITH(zlib-prefix,
|
|||||||
[prefix that may have been used in installed zlib]),
|
[prefix that may have been used in installed zlib]),
|
||||||
[ZPREFIX=${withval}],
|
[ZPREFIX=${withval}],
|
||||||
[ZPREFIX='z_'])
|
[ZPREFIX='z_'])
|
||||||
AC_CHECK_LIB(z, zlibVersion, ,
|
AC_CHECK_LIB([z], [zlibVersion], ,
|
||||||
AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed)))
|
[AC_CHECK_LIB([z], [${ZPREFIX}zlibVersion], ,
|
||||||
|
[AC_MSG_ERROR([zlib not installed])])])
|
||||||
|
|
||||||
# The following is for pngvalid, to ensure it catches FP errors even on
|
# The following is for pngvalid, to ensure it catches FP errors even on
|
||||||
# platforms that don't enable FP exceptions, the function appears in the math
|
# platforms that don't enable FP exceptions, the function appears in the math
|
||||||
@@ -297,9 +310,72 @@ AC_ARG_ENABLE([unversioned-libpng-config],
|
|||||||
AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
|
AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
|
||||||
[test "$enable_unversioned_libpng_config" != "no"])
|
[test "$enable_unversioned_libpng_config" != "no"])
|
||||||
|
|
||||||
# HOST SPECIFIC OPTIONS
|
# 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_mips_mmi=no
|
||||||
|
AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
|
||||||
|
[Disable MIPS_MMI 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])
|
||||||
|
enable_loongarch_lsx=no
|
||||||
|
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [0],
|
||||||
|
[Disable LOONGARCH_LSX optimizations])
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# allow enabling hardware optimization on any system:
|
||||||
|
case "$host_cpu" in
|
||||||
|
arm*|aarch64*)
|
||||||
|
enable_arm_neon=yes
|
||||||
|
AC_DEFINE([PNG_ARM_NEON_OPT], [2],
|
||||||
|
[Enable ARM_NEON optimizations])
|
||||||
|
;;
|
||||||
|
mipsel*|mips64el*)
|
||||||
|
enable_mips_mmi=yes
|
||||||
|
enable_mips_msa=yes
|
||||||
|
AC_DEFINE([PNG_MIPS_MMI_OPT], [1],
|
||||||
|
[Enable MIPS_MMI optimizations])
|
||||||
|
AC_DEFINE([PNG_MIPS_MSA_OPT], [2],
|
||||||
|
[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])
|
||||||
|
;;
|
||||||
|
loongarch*)
|
||||||
|
enable_loongarch_lsx=yes
|
||||||
|
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
|
||||||
|
[Enable LOONGARCH_LSX optimizations])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac])
|
||||||
|
|
||||||
# ARM
|
# ARM
|
||||||
# ===
|
# ===
|
||||||
#
|
#
|
||||||
@@ -318,7 +394,7 @@ AC_ARG_ENABLE([arm-neon],
|
|||||||
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
||||||
[Disable ARM Neon optimizations])
|
[Disable ARM Neon optimizations])
|
||||||
# Prevent inclusion of the assembler files below:
|
# Prevent inclusion of the assembler files below:
|
||||||
enable_arm_neon=no;;
|
enable_arm_neon=no ;;
|
||||||
check)
|
check)
|
||||||
AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
|
AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
|
||||||
[Check for ARM Neon support at run-time]);;
|
[Check for ARM Neon support at run-time]);;
|
||||||
@@ -335,19 +411,19 @@ AC_ARG_ENABLE([arm-neon],
|
|||||||
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value])
|
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value])
|
||||||
esac])
|
esac])
|
||||||
|
|
||||||
# Add ARM specific files to all builds where the host_cpu is arm ('arm*') or
|
# Add ARM-specific files to all builds where $host_cpu is arm ('arm*') or
|
||||||
# where ARM optimizations were explicitly requested (this allows a fallback if a
|
# where ARM optimizations were explicitly requested (this allows a fallback
|
||||||
# future host CPU does not match 'arm*')
|
# if a future host CPU does not match 'arm*')
|
||||||
|
|
||||||
AM_CONDITIONAL([PNG_ARM_NEON],
|
AM_CONDITIONAL([PNG_ARM_NEON],
|
||||||
[test "$enable_arm_neon" != 'no' &&
|
[test "$enable_arm_neon" != 'no' &&
|
||||||
case "$host_cpu" in
|
case "$host_cpu" in
|
||||||
arm*|aarch64*) :;;
|
arm*|aarch64*) : ;;
|
||||||
*) test "$enable_arm_neon" != '';;
|
*) test "$enable_arm_neon" != '' ;;
|
||||||
esac])
|
esac])
|
||||||
|
|
||||||
# MIPS
|
# MIPS
|
||||||
# ===
|
# ====
|
||||||
#
|
#
|
||||||
# MIPS MSA (SIMD) support.
|
# MIPS MSA (SIMD) support.
|
||||||
|
|
||||||
@@ -364,7 +440,7 @@ AC_ARG_ENABLE([mips-msa],
|
|||||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||||
[Disable MIPS MSA optimizations])
|
[Disable MIPS MSA optimizations])
|
||||||
# Prevent inclusion of the assembler files below:
|
# Prevent inclusion of the assembler files below:
|
||||||
enable_mips_msa=no;;
|
enable_mips_msa=no ;;
|
||||||
check)
|
check)
|
||||||
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
|
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
|
||||||
[Check for MIPS MSA support at run-time]);;
|
[Check for MIPS MSA support at run-time]);;
|
||||||
@@ -381,16 +457,206 @@ AC_ARG_ENABLE([mips-msa],
|
|||||||
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
|
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
|
||||||
esac])
|
esac])
|
||||||
|
|
||||||
# Add MIPS specific files to all builds where the host_cpu is mips ('mips*') or
|
# Add MIPS-specific files to all builds where $host_cpu is mips ('mips*') or
|
||||||
# where MIPS optimizations were explicitly requested (this allows a fallback if a
|
# where MIPS optimizations were explicitly requested (this allows a fallback
|
||||||
# future host CPU does not match 'mips*')
|
# if a future host CPU does not match 'mips*')
|
||||||
|
|
||||||
AM_CONDITIONAL([PNG_MIPS_MSA],
|
AM_CONDITIONAL([PNG_MIPS_MSA],
|
||||||
[test "$enable_mips_msa" != 'no' &&
|
[test "$enable_mips_msa" != 'no' &&
|
||||||
|
case "$host_cpu" in
|
||||||
|
mipsel*|mips64el*) : ;;
|
||||||
|
esac])
|
||||||
|
|
||||||
|
# MIPS
|
||||||
|
# ===
|
||||||
|
#
|
||||||
|
# MIPS MMI (SIMD) support.
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([mips-mmi],
|
||||||
|
AS_HELP_STRING([[[--enable-mips-mmi]]],
|
||||||
|
[Enable MIPS MMI 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_mmi systems:
|
||||||
|
AC_DEFINE([PNG_MIPS_MMI_OPT], [0],
|
||||||
|
[Disable MIPS MMI optimizations])
|
||||||
|
# Prevent inclusion of the assembler files below:
|
||||||
|
enable_mips_mmi=no;;
|
||||||
|
check)
|
||||||
|
AC_DEFINE([PNG_MIPS_MMI_CHECK_SUPPORTED], [],
|
||||||
|
[Check for MIPS MMI support at run-time]);;
|
||||||
|
api)
|
||||||
|
AC_DEFINE([PNG_MIPS_MMI_API_SUPPORTED], [],
|
||||||
|
[Turn on MIPS MMI optimizations at run-time]);;
|
||||||
|
yes|on)
|
||||||
|
AC_DEFINE([PNG_MIPS_MMI_OPT], [1],
|
||||||
|
[Enable MIPS MMI optimizations])
|
||||||
|
AC_MSG_WARN([--enable-mips-mmi: please specify 'check' or 'api', if]
|
||||||
|
[you want the optimizations unconditionally pass '-mloongson-mmi -march=loongson3a']
|
||||||
|
[to the compiler.]);;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR([--enable-mips-mmi=${enable_mips_mmi}: 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_MMI],
|
||||||
|
[test "$enable_mips_mmi" != 'no' &&
|
||||||
case "$host_cpu" in
|
case "$host_cpu" in
|
||||||
mipsel*|mips64el*) :;;
|
mipsel*|mips64el*) :;;
|
||||||
esac])
|
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 $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 $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])
|
||||||
|
|
||||||
|
# LOONGARCH
|
||||||
|
# ===
|
||||||
|
#
|
||||||
|
# LOONGARCH LSX (SIMD) support
|
||||||
|
|
||||||
|
if test "$LSX_CFLAGS" = ''; then
|
||||||
|
LSX_CFLAGS="-mlsx"
|
||||||
|
fi
|
||||||
|
|
||||||
|
compiler_support_loongarch_lsx=no
|
||||||
|
AC_MSG_CHECKING(whether to use loongarch LSX intrinsics)
|
||||||
|
save_CFLAGS=$CFLAGS
|
||||||
|
CFLAGS="$CFLAGS $LSX_CFLAGS"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||||
|
#include<lsxintrin.h>
|
||||||
|
int main(){
|
||||||
|
__m128i a, b, c;
|
||||||
|
a = __lsx_vadd_w(b, c);
|
||||||
|
return 0;
|
||||||
|
}]])],compiler_support_loongarch_lsx=yes)
|
||||||
|
CFLAGS=$save_CFLAGS
|
||||||
|
AC_MSG_RESULT($compiler_support_loongarch_lsx)
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([loongarch-lsx],
|
||||||
|
AS_HELP_STRING([[[--enable-loongarch-lsx]]],
|
||||||
|
[Enable LOONGARCH LSX optimizations: =no/off, yes/on:]
|
||||||
|
[no/off: disable the optimizations;]
|
||||||
|
[yes/on: turn on unconditionally.]
|
||||||
|
[If not specified: determined by the compiler.]),
|
||||||
|
[case "$enableval" in
|
||||||
|
no|off)
|
||||||
|
# disable the default enabling on __loongarch_simd systems:
|
||||||
|
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [0],
|
||||||
|
[Disable LOONGARCH LSX optimizations])
|
||||||
|
# Prevent inclusion of the assembler files below:
|
||||||
|
enable_loongarch_lsx=no;;
|
||||||
|
yes|on)
|
||||||
|
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1],
|
||||||
|
[Enable LOONGARCH LSX optimizations])
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR([--enable-loongarch-lsx=${enable_loongarch_lsx}: invalid value])
|
||||||
|
esac])
|
||||||
|
|
||||||
|
if test "$enable_loongarch_lsx" != 'no'; then
|
||||||
|
if test $compiler_support_loongarch_lsx = yes; then
|
||||||
|
AC_DEFINE([PNG_LOONGARCH_LSX_OPT], [1], [Enable LOONGARCH LSX optimizations])
|
||||||
|
else
|
||||||
|
AC_MSG_WARN([Compiler does not support loongarch LSX.])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add LOONGARCH specific files to all builds where the host_cpu is loongarch ('loongarch*') or
|
||||||
|
# where LOONGARCH optimizations were explicitly requested (this allows a fallback if a
|
||||||
|
# future host CPU does not match 'loongarch*')
|
||||||
|
|
||||||
|
AM_CONDITIONAL([PNG_LOONGARCH_LSX],
|
||||||
|
[test "$enable_loongarch_lsx" != 'no' && test $compiler_support_loongarch_lsx = yes &&
|
||||||
|
case "$host_cpu" in
|
||||||
|
loongarch*) :;;
|
||||||
|
*) test "$enable_loongarch_lsx" != '';;
|
||||||
|
esac])
|
||||||
|
|
||||||
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
|
||||||
|
|
||||||
# Config files, substituting as above
|
# Config files, substituting as above
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||||
* Written by John Bowler, 2014.
|
* Written by John Bowler, 2014.
|
||||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@@ -17,13 +16,14 @@
|
|||||||
*
|
*
|
||||||
* Documentation:
|
* Documentation:
|
||||||
* http://www.kandroid.org/ndk/docs/CPU-ARM-NEON.html
|
* 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
|
* 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
|
* with an implementation of the Android ARM 'cpu-features' library. The code
|
||||||
* has been compiled only, not linked: no version of the library has been found,
|
* has been compiled only, not linked: no version of the library has been found,
|
||||||
* only the header files exist in the NDK.
|
* only the header files exist in the NDK.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cpu-features.h>
|
#include <cpu-features.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||||
* Written by Mans Rullgard, 2011.
|
* Written by Mans Rullgard, 2011.
|
||||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@@ -22,6 +21,7 @@
|
|||||||
* This generic __linux__ implementation requires reading /proc/self/auxv and
|
* This generic __linux__ implementation requires reading /proc/self/auxv and
|
||||||
* looking at each element for one that records NEON capabilities.
|
* looking at each element for one that records NEON capabilities.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h> /* for POSIX 1003.1 */
|
#include <unistd.h> /* for POSIX 1003.1 */
|
||||||
#include <errno.h> /* for EINTR */
|
#include <errno.h> /* for EINTR */
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
/* contrib/arm-neon/linux.c
|
/* contrib/arm-neon/linux.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
* Copyright (c) 2014, 2017 Glenn Randers-Pehrson
|
||||||
* Written by John Bowler, 2014.
|
* Written by John Bowler, 2014, 2017.
|
||||||
* Last changed in libpng 1.6.16 [December 22, 2014]
|
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@@ -19,6 +18,7 @@
|
|||||||
* This code is strict ANSI-C and is probably moderately portable; it does
|
* 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.
|
* however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -62,7 +62,7 @@ png_have_neon(png_structp png_ptr)
|
|||||||
|
|
||||||
counter=0;
|
counter=0;
|
||||||
state = Feature;
|
state = Feature;
|
||||||
/* FALL THROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case Feature:
|
case Feature:
|
||||||
/* Match 'FEATURE', ASCII case insensitive. */
|
/* Match 'FEATURE', ASCII case insensitive. */
|
||||||
@@ -75,7 +75,7 @@ png_have_neon(png_structp png_ptr)
|
|||||||
|
|
||||||
/* did not match 'feature' */
|
/* did not match 'feature' */
|
||||||
state = SkipLine;
|
state = SkipLine;
|
||||||
/* FALL THROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case SkipLine:
|
case SkipLine:
|
||||||
skipLine:
|
skipLine:
|
||||||
@@ -110,7 +110,7 @@ png_have_neon(png_structp png_ptr)
|
|||||||
|
|
||||||
state = Neon;
|
state = Neon;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
/* FALL THROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case Neon:
|
case Neon:
|
||||||
/* Look for 'neon' tag */
|
/* Look for 'neon' tag */
|
||||||
@@ -122,7 +122,7 @@ png_have_neon(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
state = SkipTag;
|
state = SkipTag;
|
||||||
/* FALL THROUGH */
|
/* FALLTHROUGH */
|
||||||
|
|
||||||
case SkipTag:
|
case SkipTag:
|
||||||
/* Skip non-space characters */
|
/* Skip non-space characters */
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ option WRITE_16BIT on
|
|||||||
option WRITE_FILTER on
|
option WRITE_FILTER on
|
||||||
|
|
||||||
# pngcp needs this to preserve unknown chunks, switching all these on means that
|
# pngcp needs this to preserve unknown chunks, switching all these on means that
|
||||||
# pngcp can work without explicit known chunk reading suppport
|
# pngcp can work without explicit known chunk reading support
|
||||||
option UNKNOWN_CHUNKS on
|
option UNKNOWN_CHUNKS on
|
||||||
option SET_UNKNOWN_CHUNKS on
|
option SET_UNKNOWN_CHUNKS on
|
||||||
option HANDLE_AS_UNKNOWN on
|
option HANDLE_AS_UNKNOWN on
|
||||||
@@ -52,6 +52,6 @@ option TEXT on
|
|||||||
option USER_LIMITS on
|
option USER_LIMITS on
|
||||||
option SET_USER_LIMITS on
|
option SET_USER_LIMITS on
|
||||||
|
|
||||||
# these are are just required for specific customizations
|
# these are just required for specific customizations
|
||||||
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
|
option WRITE_CUSTOMIZE_ZTXT_COMPRESSION on
|
||||||
option WRITE_CUSTOMIZE_COMPRESSION on
|
option WRITE_CUSTOMIZE_COMPRESSION on
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
* without processing the image. Notice that some header information may occur
|
* without processing the image. Notice that some header information may occur
|
||||||
* after the image data. Textual data and comments are an example; the approach
|
* 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
|
* 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
|
* Compile and link against libpng and zlib, plus anything else required on the
|
||||||
* system you use.
|
* 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_hi = bit_depth * ((x >> 6) * channels);
|
||||||
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
|
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;
|
row += bit_offset_lo >> 3;
|
||||||
bit_offset_lo &= 0x07;
|
bit_offset_lo &= 0x07;
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ static void
|
|||||||
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||||
png_uint_32 x)
|
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))
|
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:
|
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;
|
png_colorp palette = NULL;
|
||||||
int num_palette = 0;
|
int num_palette = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*- pngtopng
|
/*- 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
|
* 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:
|
* related or neighboring rights to this work. This work is published from:
|
||||||
* United States.
|
* United States.
|
||||||
@@ -59,28 +59,29 @@ int main(int argc, const char **argv)
|
|||||||
else
|
else
|
||||||
fprintf(stderr, "pngtopng: write %s: %s\n", argv[2],
|
fprintf(stderr, "pngtopng: write %s: %s\n", argv[2],
|
||||||
image.message);
|
image.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
fprintf(stderr, "pngtopng: read %s: %s\n", argv[1],
|
||||||
|
image.message);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "pngtopng: read %s: %s\n", argv[1],
|
fprintf(stderr, "pngtopng: out of memory: %lu bytes\n",
|
||||||
image.message);
|
(unsigned long)PNG_IMAGE_SIZE(image));
|
||||||
|
|
||||||
/* This is the only place where a 'free' is required; libpng does
|
/* 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
|
* the cleanup on error and success, but in this case we couldn't
|
||||||
* complete the read because of running out of memory.
|
* 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);
|
png_image_free(&image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
|
||||||
fprintf(stderr, "pngtopng: out of memory: %lu bytes\n",
|
|
||||||
(unsigned long)PNG_IMAGE_SIZE(image));
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
/* Failed to read the first argument: */
|
/* Failed to read the first argument: */
|
||||||
fprintf(stderr, "pngtopng: %s: %s\n", argv[1], image.message);
|
fprintf(stderr, "pngtopng: %s: %s\n", argv[1], image.message);
|
||||||
|
|||||||
@@ -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.
|
13-15 of the book for detailed discussion of the three programs.
|
||||||
|
|
||||||
Greg Roelofs
|
Greg Roelofs
|
||||||
http://pobox.com/~newt/greg_contact.html
|
https://pobox.com/~newt/greg_contact.html
|
||||||
16 March 2008
|
16 March 2008
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ BUILD INSTRUCTIONS
|
|||||||
|
|
||||||
- Prerequisites (in order of compilation):
|
- Prerequisites (in order of compilation):
|
||||||
|
|
||||||
- zlib http://zlib.net/
|
- zlib https://zlib.net/
|
||||||
- libpng http://www.libpng.org/pub/png/libpng.html
|
- libpng http://www.libpng.org/pub/png/libpng.html
|
||||||
- pngbook http://www.libpng.org/pub/png/book/sources.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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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);
|
*pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||||
*pChannels = (int)png_get_channels(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) {
|
if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) {
|
||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
Changelog:
|
Changelog:
|
||||||
2015-11-12 - Check return value of png_get_bKGD() (Glenn R-P)
|
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
|
/* These byte strings were copied from png.h. If a future version
|
||||||
* of readpng2.c recognizes more chunks, add them to this list.
|
* 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 */
|
98, 75, 71, 68, '\0', /* bKGD */
|
||||||
103, 65, 77, 65, '\0', /* gAMA */
|
103, 65, 77, 65, '\0', /* gAMA */
|
||||||
115, 82, 71, 66, '\0', /* sRGB */
|
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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;
|
*pRowbytes = rowbytes = channels*width;
|
||||||
*pChannels = channels;
|
*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;
|
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 */
|
/* 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)
|
- 1.10: enabled "message window"/console (thanks to David Geldreich)
|
||||||
- 2.00: dual-licensed (added GNU GPL)
|
- 2.00: dual-licensed (added GNU GPL)
|
||||||
- 2.01: fixed improper display of usage screen on PNG error(s)
|
- 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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -496,6 +497,12 @@ static int rpng_win_create_window(HINSTANCE hInst, int showmode)
|
|||||||
|
|
||||||
wimage_rowbytes = ((3*image_width + 3L) >> 2) << 2;
|
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) +
|
if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
|
||||||
wimage_rowbytes*image_height)))
|
wimage_rowbytes*image_height)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,10 +28,11 @@
|
|||||||
- 2.01: fixed improper display of usage screen on PNG error(s)
|
- 2.01: fixed improper display of usage screen on PNG error(s)
|
||||||
- 2.02: Added "void(argc);" statement to quiet pedantic compiler warnings
|
- 2.02: Added "void(argc);" statement to quiet pedantic compiler warnings
|
||||||
about unused variable (GR-P)
|
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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
|
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
|
||||||
unexpected-EOF and file-read-error cases
|
unexpected-EOF and file-read-error cases
|
||||||
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
|
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
|
||||||
- 2.04:
|
- 2.04: check for integer overflow (Glenn R-P)
|
||||||
(GR-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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -650,6 +649,13 @@ static void rpng2_win_init()
|
|||||||
Trace((stderr, " width = %ld\n", rpng2_info.width))
|
Trace((stderr, " width = %ld\n", rpng2_info.width))
|
||||||
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
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);
|
rpng2_info.image_data = (uch *)malloc(rowbytes * rpng2_info.height);
|
||||||
if (!rpng2_info.image_data) {
|
if (!rpng2_info.image_data) {
|
||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
|
|||||||
@@ -44,9 +44,11 @@
|
|||||||
- 2.04: Added "void(foo);" statements to quiet pedantic compiler warnings
|
- 2.04: Added "void(foo);" statements to quiet pedantic compiler warnings
|
||||||
about unused variables (GR-P)
|
about unused variables (GR-P)
|
||||||
- 2.05: Use nanosleep() instead of usleep(), which is deprecated (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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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, " width = %ld\n", rpng2_info.width))
|
||||||
Trace((stderr, " height = %ld\n", rpng2_info.height))
|
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);
|
rpng2_info.image_data = (uch *)malloc(rowbytes * rpng2_info.height);
|
||||||
if (!rpng2_info.image_data) {
|
if (!rpng2_info.image_data) {
|
||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
- 1.04: fixed DOS/OS2/Win32 detection, including partial Cygwin fix
|
- 1.04: fixed DOS/OS2/Win32 detection, including partial Cygwin fix
|
||||||
(see http://home.att.net/~perlspinr/diffs/GregBook_cygwin.diff)
|
(see http://home.att.net/~perlspinr/diffs/GregBook_cygwin.diff)
|
||||||
- 2.00: dual-licensed (added GNU GPL)
|
- 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
|
[REPORTED BUG (win32 only): "contrib/gregbook/wpng.c - cmd line
|
||||||
dose not work! In order to do something useful I needed to redirect
|
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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) {
|
if (wpng_info.interlaced) {
|
||||||
long i;
|
long i;
|
||||||
ulg bytes;
|
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.image_data = (uch *)malloc(image_bytes);
|
||||||
wpng_info.row_pointers = (uch **)malloc(wpng_info.height*sizeof(uch *));
|
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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
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,190 +0,0 @@
|
|||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
--- a/configure.ac 2016-08-29 11:46:27.000000000 -0400
|
|
||||||
+++ b/configure.ac 2016-08-29 16:57:03.866355018 -0400
|
|
||||||
@@ -386,16 +386,51 @@ AC_ARG_ENABLE([mips-msa],
|
|
||||||
# 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])
|
|
||||||
+
|
|
||||||
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-08-29 11:46:27.000000000 -0400
|
|
||||||
+++ b/Makefile.am 2016-08-29 16:57:45.955528215 -0400
|
|
||||||
@@ -97,16 +97,21 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SO
|
|
||||||
arm/filter_neon.S arm/filter_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 += 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
|
|
||||||
--- debug16/pngpriv.h 2016-08-30 10:46:36.000000000 -0400
|
|
||||||
+++ libpng16/pngpriv.h 2016-08-30 11:57:25.672280202 -0400
|
|
||||||
@@ -185,16 +185,52 @@
|
|
||||||
#ifndef PNG_MIPS_MSA_OPT
|
|
||||||
# if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
|
||||||
# define PNG_MIPS_MSA_OPT 2
|
|
||||||
# else
|
|
||||||
# define PNG_MIPS_MSA_OPT 0
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#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
|
|
||||||
+
|
|
||||||
#if PNG_MIPS_MSA_OPT > 0
|
|
||||||
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
|
|
||||||
# ifndef PNG_MIPS_MSA_IMPLEMENTATION
|
|
||||||
# if defined(__mips_msa)
|
|
||||||
# if defined(__clang__)
|
|
||||||
# elif defined(__GNUC__)
|
|
||||||
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
|
|
||||||
# define PNG_MIPS_MSA_IMPLEMENTATION 2
|
|
||||||
@@ -1251,16 +1287,31 @@ PNG_INTERNAL_FUNCTION(void,png_read_filt
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_msa,(png_row_infop
|
|
||||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_msa,(png_row_infop
|
|
||||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
|
|
||||||
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#if PNG_INTEL_SSE_IMPLEMENTATION > 0
|
|
||||||
+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);
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
/* 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
|
|
||||||
@@ -1986,16 +2037,21 @@ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_O
|
|
||||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
|
||||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if PNG_MIPS_MSA_OPT > 0
|
|
||||||
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
|
|
||||||
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
+
|
|
||||||
+# if PNG_INTEL_SSE_IMPLEMENTATION > 0
|
|
||||||
+PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
|
|
||||||
+ (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
|
||||||
+# endif
|
|
||||||
#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"
|
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2013 John Cunningham Bowler
|
# Copyright (c) 2013 John Cunningham Bowler
|
||||||
#
|
#
|
||||||
# Last changed in libpng 1.6.0 [February 14, 2013]
|
|
||||||
#
|
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
# For conditions of distribution and use, see the disclaimer
|
# For conditions of distribution and use, see the disclaimer
|
||||||
# and license in png.h
|
# and license in png.h
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
/* Copyright: */
|
/* Copyright: */
|
||||||
#define COPYRIGHT "\251 2013,2015 John Cunningham Bowler"
|
#define COPYRIGHT "\251 2013,2015 John Cunningham Bowler"
|
||||||
/*
|
/*
|
||||||
* Last changed in libpng 1.6.20 [November 24, 2015]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
@@ -299,7 +297,9 @@ generate_palette(png_colorp palette, png_bytep trans, int bit_depth,
|
|||||||
unsigned int x, y;
|
unsigned int x, y;
|
||||||
volatile unsigned int ip = 0;
|
volatile unsigned int ip = 0;
|
||||||
|
|
||||||
for (x=0; x<size; ++x) for (y=0; y<size; ++y)
|
for (x=0; x<size; ++x)
|
||||||
|
{
|
||||||
|
for (y=0; y<size; ++y)
|
||||||
{
|
{
|
||||||
ip = x + (size * y);
|
ip = x + (size * y);
|
||||||
|
|
||||||
@@ -319,6 +319,7 @@ generate_palette(png_colorp palette, png_bytep trans, int bit_depth,
|
|||||||
xyinterp(x, y, 0, 102, 204, 255),
|
xyinterp(x, y, 0, 102, 204, 255),
|
||||||
gamma_table);
|
gamma_table);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ip+1;
|
return ip+1;
|
||||||
}
|
}
|
||||||
@@ -396,7 +397,7 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
|||||||
image_size_of_type(color_type, bit_depth, colors, small)-1;
|
image_size_of_type(color_type, bit_depth, colors, small)-1;
|
||||||
png_uint_32 depth_max = (1U << bit_depth)-1; /* up to 65536 */
|
png_uint_32 depth_max = (1U << bit_depth)-1; /* up to 65536 */
|
||||||
|
|
||||||
if (colors[0] == 0) if (small)
|
if (colors[0] == 0 && small)
|
||||||
{
|
{
|
||||||
unsigned int pixel_depth = pixel_depth_of_type(color_type, bit_depth);
|
unsigned int pixel_depth = pixel_depth_of_type(color_type, bit_depth);
|
||||||
|
|
||||||
@@ -495,7 +496,7 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
|||||||
case 32:
|
case 32:
|
||||||
case 48:
|
case 48:
|
||||||
case 64:
|
case 64:
|
||||||
/* The rows are filled by an alogorithm similar to the above, in the
|
/* The rows are filled by an algorithm similar to the above, in the
|
||||||
* first row pixel bytes are all equal, increasing from 0 by 1 for
|
* first row pixel bytes are all equal, increasing from 0 by 1 for
|
||||||
* each pixel. In the second row the bytes within a pixel are
|
* each pixel. In the second row the bytes within a pixel are
|
||||||
* incremented 1,3,5,7,... from the previous row byte. Using an odd
|
* incremented 1,3,5,7,... from the previous row byte. Using an odd
|
||||||
@@ -661,7 +662,7 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
|||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const png_uint_32 luma = colors[1];
|
png_uint_32 luma = colors[1];
|
||||||
png_uint_32 x;
|
png_uint_32 x;
|
||||||
|
|
||||||
for (x=0; x<=size_max; ++x)
|
for (x=0; x<=size_max; ++x)
|
||||||
@@ -672,8 +673,8 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
|||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
const png_uint_32 luma = colors[1];
|
png_uint_32 luma = colors[1];
|
||||||
const png_uint_32 alpha = colors[2];
|
png_uint_32 alpha = colors[2];
|
||||||
png_uint_32 x;
|
png_uint_32 x;
|
||||||
|
|
||||||
for (x=0; x<size_max; ++x)
|
for (x=0; x<size_max; ++x)
|
||||||
@@ -688,9 +689,9 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
|||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
const png_uint_32 red = colors[1];
|
png_uint_32 red = colors[1];
|
||||||
const png_uint_32 green = colors[2];
|
png_uint_32 green = colors[2];
|
||||||
const png_uint_32 blue = colors[3];
|
png_uint_32 blue = colors[3];
|
||||||
png_uint_32 x;
|
png_uint_32 x;
|
||||||
|
|
||||||
for (x=0; x<=size_max; ++x)
|
for (x=0; x<=size_max; ++x)
|
||||||
@@ -707,10 +708,10 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
|||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
const png_uint_32 red = colors[1];
|
png_uint_32 red = colors[1];
|
||||||
const png_uint_32 green = colors[2];
|
png_uint_32 green = colors[2];
|
||||||
const png_uint_32 blue = colors[3];
|
png_uint_32 blue = colors[3];
|
||||||
const png_uint_32 alpha = colors[4];
|
png_uint_32 alpha = colors[4];
|
||||||
png_uint_32 x;
|
png_uint_32 x;
|
||||||
|
|
||||||
for (x=0; x<=size_max; ++x)
|
for (x=0; x<=size_max; ++x)
|
||||||
@@ -812,7 +813,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
|||||||
png_error(png_ptr, "OOM allocating info structure");
|
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);
|
image_size_of_type(color_type, bit_depth, colors, small);
|
||||||
unsigned int ysize;
|
unsigned int ysize;
|
||||||
png_fixed_point real_gamma = 45455; /* For sRGB */
|
png_fixed_point real_gamma = 45455; /* For sRGB */
|
||||||
@@ -824,7 +825,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
|||||||
*/
|
*/
|
||||||
if (small)
|
if (small)
|
||||||
{
|
{
|
||||||
const unsigned int pixel_depth =
|
unsigned int pixel_depth =
|
||||||
pixel_depth_of_type(color_type, bit_depth);
|
pixel_depth_of_type(color_type, bit_depth);
|
||||||
|
|
||||||
if (pixel_depth <= 8U)
|
if (pixel_depth <= 8U)
|
||||||
@@ -858,11 +859,14 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (real_gamma == 45455) for (i=0; i<256; ++i)
|
if (real_gamma == 45455)
|
||||||
|
{
|
||||||
|
for (i=0; i<256; ++i)
|
||||||
{
|
{
|
||||||
gamma_table[i] = (png_byte)i;
|
gamma_table[i] = (png_byte)i;
|
||||||
conv = 1.;
|
conv = 1.;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -950,7 +954,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
|||||||
int passes = 1;
|
int passes = 1;
|
||||||
# endif /* !WRITE_INTERLACING */
|
# endif /* !WRITE_INTERLACING */
|
||||||
int pass;
|
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);
|
row = malloc(rowbytes);
|
||||||
|
|
||||||
@@ -1094,7 +1098,7 @@ load_file(png_const_charp name, png_bytepp result)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static png_size_t
|
static size_t
|
||||||
load_fake(png_charp param, png_bytepp profile)
|
load_fake(png_charp param, png_bytepp profile)
|
||||||
{
|
{
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
@@ -1164,7 +1168,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
|||||||
{
|
{
|
||||||
case '<':
|
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 */
|
if (filelen > 0xfffffffc) /* Maximum profile length */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n",
|
fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n",
|
||||||
@@ -1179,7 +1183,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
|||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
case '5': case '6': case '7': case '8': case '9':
|
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 */
|
if (fake_len > 0) /* else a simple parameter */
|
||||||
{
|
{
|
||||||
@@ -1274,7 +1278,7 @@ set_text(png_structp png_ptr, png_infop info_ptr, png_textp text,
|
|||||||
case '5': case '6': case '7': case '8': case '9':
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
{
|
{
|
||||||
png_bytep data = NULL;
|
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 */
|
if (fake_len > 0) /* else a simple parameter */
|
||||||
{
|
{
|
||||||
@@ -1378,10 +1382,10 @@ static void
|
|||||||
insert_sBIT(png_structp png_ptr, png_infop info_ptr, int nparams,
|
insert_sBIT(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||||
png_charpp params)
|
png_charpp params)
|
||||||
{
|
{
|
||||||
const int ct = png_get_color_type(png_ptr, info_ptr);
|
int ct = png_get_color_type(png_ptr, info_ptr);
|
||||||
const int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
|
int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
|
||||||
(ct & PNG_COLOR_MASK_ALPHA ? 1 : 0);
|
(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);
|
ct & PNG_COLOR_MASK_PALETTE ? 8U : png_get_bit_depth(png_ptr, info_ptr);
|
||||||
png_color_8 sBIT;
|
png_color_8 sBIT;
|
||||||
|
|
||||||
@@ -1430,12 +1434,15 @@ find_parameters(png_const_charp what, png_charp param, png_charp *list,
|
|||||||
for (i=0; *param && i<nparams; ++i)
|
for (i=0; *param && i<nparams; ++i)
|
||||||
{
|
{
|
||||||
list[i] = param;
|
list[i] = param;
|
||||||
while (*++param) if (*param == '\n' || *param == ':')
|
while (*++param)
|
||||||
|
{
|
||||||
|
if (*param == '\n' || *param == ':')
|
||||||
{
|
{
|
||||||
*param++ = 0; /* Terminate last parameter */
|
*param++ = 0; /* Terminate last parameter */
|
||||||
break; /* And start a new one. */
|
break; /* And start a new one. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (*param)
|
if (*param)
|
||||||
{
|
{
|
||||||
@@ -1856,7 +1863,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Check the colors */
|
/* 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);
|
(1U<<bit_depth)-1);
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@@ -1869,7 +1876,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* small and colors are incomparible (will probably crash if both are used at
|
/* small and colors are incompatible (will probably crash if both are used at
|
||||||
* the same time!)
|
* the same time!)
|
||||||
*/
|
*/
|
||||||
if (small && colors[0] != 0)
|
if (small && colors[0] != 0)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngimage.c
|
/* pngimage.c
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2021 Cosmin Truta
|
||||||
* Copyright (c) 2015,2016 John Cunningham Bowler
|
* Copyright (c) 2015,2016 John Cunningham Bowler
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
* using png_read_png and then write with png_write_png. Test all possible
|
* using png_read_png and then write with png_write_png. Test all possible
|
||||||
* transforms.
|
* transforms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -317,11 +318,10 @@ transform_name(int t)
|
|||||||
|
|
||||||
t &= -t; /* first set bit */
|
t &= -t; /* first set bit */
|
||||||
|
|
||||||
for (i=0; i<TTABLE_SIZE; ++i) if (transform_info[i].name != NULL)
|
for (i=0; i<TTABLE_SIZE; ++i)
|
||||||
{
|
if (transform_info[i].name != NULL)
|
||||||
if ((transform_info[i].transform & t) != 0)
|
if ((transform_info[i].transform & t) != 0)
|
||||||
return transform_info[i].name;
|
return transform_info[i].name;
|
||||||
}
|
|
||||||
|
|
||||||
return "invalid transform";
|
return "invalid transform";
|
||||||
}
|
}
|
||||||
@@ -338,7 +338,9 @@ validate_T(void)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0; i<TTABLE_SIZE; ++i) if (transform_info[i].name != NULL)
|
for (i=0; i<TTABLE_SIZE; ++i)
|
||||||
|
{
|
||||||
|
if (transform_info[i].name != NULL)
|
||||||
{
|
{
|
||||||
if (transform_info[i].when & TRANSFORM_R)
|
if (transform_info[i].when & TRANSFORM_R)
|
||||||
read_transforms |= transform_info[i].transform;
|
read_transforms |= transform_info[i].transform;
|
||||||
@@ -346,6 +348,7 @@ validate_T(void)
|
|||||||
if (transform_info[i].when & TRANSFORM_W)
|
if (transform_info[i].when & TRANSFORM_W)
|
||||||
write_transforms |= transform_info[i].transform;
|
write_transforms |= transform_info[i].transform;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Reversible transforms are those which are supported on both read and
|
/* Reversible transforms are those which are supported on both read and
|
||||||
* write.
|
* write.
|
||||||
@@ -551,7 +554,7 @@ struct display
|
|||||||
png_structp original_pp; /* used on the original read */
|
png_structp original_pp; /* used on the original read */
|
||||||
png_infop original_ip; /* set by 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 */
|
png_bytepp original_rows; /* from the original read */
|
||||||
|
|
||||||
/* Original chunks valid */
|
/* Original chunks valid */
|
||||||
@@ -807,7 +810,7 @@ display_cache_file(struct display *dp, const char *filename)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
||||||
png_size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct buffer_list *last = bp->current;
|
struct buffer_list *last = bp->current;
|
||||||
size_t read_count = bp->read_count;
|
size_t read_count = bp->read_count;
|
||||||
@@ -855,7 +858,7 @@ buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void PNGCBAPI
|
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);
|
buffer_read(get_dp(pp), get_buffer(pp), data, size);
|
||||||
}
|
}
|
||||||
@@ -927,7 +930,7 @@ update_display(struct display *dp)
|
|||||||
png_structp pp;
|
png_structp pp;
|
||||||
png_infop ip;
|
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*/);
|
read_png(dp, &dp->original_file, "original read", 0/*no transform*/);
|
||||||
|
|
||||||
/* Move the result to the 'original' fields */
|
/* Move the result to the 'original' fields */
|
||||||
@@ -962,7 +965,9 @@ update_display(struct display *dp)
|
|||||||
int bd = dp->bit_depth;
|
int bd = dp->bit_depth;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0; i<TTABLE_SIZE; ++i) if (transform_info[i].name != NULL)
|
for (i=0; i<TTABLE_SIZE; ++i)
|
||||||
|
{
|
||||||
|
if (transform_info[i].name != NULL)
|
||||||
{
|
{
|
||||||
int transform = transform_info[i].transform;
|
int transform = transform_info[i].transform;
|
||||||
|
|
||||||
@@ -978,6 +983,7 @@ update_display(struct display *dp)
|
|||||||
else if ((transform_info[i].when & TRANSFORM_R) != 0)
|
else if ((transform_info[i].when & TRANSFORM_R) != 0)
|
||||||
inactive |= transform;
|
inactive |= transform;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Some transforms appear multiple times in the table; the 'active' status
|
/* Some transforms appear multiple times in the table; the 'active' status
|
||||||
* is the logical OR of these and the inactive status must be adjusted to
|
* is the logical OR of these and the inactive status must be adjusted to
|
||||||
@@ -1000,8 +1006,9 @@ compare_read(struct display *dp, int applied_transforms)
|
|||||||
int interlace_method, compression_method, filter_method;
|
int interlace_method, compression_method, filter_method;
|
||||||
const char *e = NULL;
|
const char *e = NULL;
|
||||||
|
|
||||||
png_get_IHDR(dp->read_pp, dp->read_ip, &width, &height, &bit_depth,
|
if (!png_get_IHDR(dp->read_pp, dp->read_ip, &width, &height, &bit_depth,
|
||||||
&color_type, &interlace_method, &compression_method, &filter_method);
|
&color_type, &interlace_method, &compression_method, &filter_method))
|
||||||
|
display_log(dp, LIBPNG_BUG, "png_get_IHDR failed");
|
||||||
|
|
||||||
# define C(item) if (item != dp->item) \
|
# define C(item) if (item != dp->item) \
|
||||||
display_log(dp, APP_WARNING, "IHDR " #item "(%lu) changed to %lu",\
|
display_log(dp, APP_WARNING, "IHDR " #item "(%lu) changed to %lu",\
|
||||||
@@ -1081,7 +1088,8 @@ compare_read(struct display *dp, int applied_transforms)
|
|||||||
size_t x;
|
size_t x;
|
||||||
|
|
||||||
/* Find the first error */
|
/* Find the first error */
|
||||||
for (x=0; x<rowbytes-1; ++x) if (row[x] != orig[x])
|
for (x=0; x<rowbytes-1; ++x)
|
||||||
|
if (row[x] != orig[x])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
display_log(dp, APP_FAIL,
|
display_log(dp, APP_FAIL,
|
||||||
@@ -1137,6 +1145,7 @@ compare_read(struct display *dp, int applied_transforms)
|
|||||||
display_log(dp, LIBPNG_ERROR, "invalid colour type %d",
|
display_log(dp, LIBPNG_ERROR, "invalid colour type %d",
|
||||||
color_type);
|
color_type);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
memset(sig_bits, 0, sizeof(sig_bits));
|
||||||
bpp = 0;
|
bpp = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1198,7 +1207,7 @@ compare_read(struct display *dp, int applied_transforms)
|
|||||||
sig_bits[0] = (png_byte)b;
|
sig_bits[0] = (png_byte)b;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: /* Relicate twice */
|
case 4: /* Replicate twice */
|
||||||
/* Value is 1, 2, 3 or 4 */
|
/* Value is 1, 2, 3 or 4 */
|
||||||
b = 0xf & ((0xf << 4) >> sig_bits[0]);
|
b = 0xf & ((0xf << 4) >> sig_bits[0]);
|
||||||
b |= b << 4;
|
b |= b << 4;
|
||||||
@@ -1267,7 +1276,7 @@ compare_read(struct display *dp, int applied_transforms)
|
|||||||
#ifdef PNG_WRITE_PNG_SUPPORTED
|
#ifdef PNG_WRITE_PNG_SUPPORTED
|
||||||
static void
|
static void
|
||||||
buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
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
|
/* Generic write function used both from the write callback provided to
|
||||||
* libpng and from the generic read code.
|
* libpng and from the generic read code.
|
||||||
*/
|
*/
|
||||||
@@ -1311,7 +1320,7 @@ buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void PNGCBAPI
|
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);
|
buffer_write(get_dp(pp), get_buffer(pp), data, size);
|
||||||
}
|
}
|
||||||
@@ -1446,7 +1455,7 @@ test_one_file(struct display *dp, const char *filename)
|
|||||||
* unsigned, because some transforms are negative on a 16-bit system.
|
* unsigned, because some transforms are negative on a 16-bit system.
|
||||||
*/
|
*/
|
||||||
unsigned int active = dp->active_transforms;
|
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 current = first_transform(active);
|
||||||
unsigned int bad_transforms = 0;
|
unsigned int bad_transforms = 0;
|
||||||
unsigned int bad_combo = ~0U; /* bitwise AND of failing transforms */
|
unsigned int bad_combo = ~0U; /* bitwise AND of failing transforms */
|
||||||
@@ -1572,7 +1581,7 @@ do_test(struct display *dp, const char *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
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 */
|
/* For each file on the command line test it with a range of transforms */
|
||||||
int option_end, ilog = 0;
|
int option_end, ilog = 0;
|
||||||
@@ -1674,7 +1683,7 @@ main(const int argc, const char * const * const argv)
|
|||||||
/* Here on any return, including failures, except user/internal issues
|
/* 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);
|
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
|
||||||
|
|
||||||
if (!pass)
|
if (!pass)
|
||||||
@@ -1686,7 +1695,8 @@ main(const int argc, const char * const * const argv)
|
|||||||
|
|
||||||
printf("%s: pngimage ", pass ? "PASS" : "FAIL");
|
printf("%s: pngimage ", pass ? "PASS" : "FAIL");
|
||||||
|
|
||||||
for (j=1; j<option_end; ++j) if (j != ilog)
|
for (j=1; j<option_end; ++j)
|
||||||
|
if (j != ilog)
|
||||||
printf("%s ", argv[j]);
|
printf("%s ", argv[j]);
|
||||||
|
|
||||||
printf("%s\n", d.filename);
|
printf("%s\n", d.filename);
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
/*-
|
|
||||||
* pngstest.c
|
/* pngstest.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2016 John Cunningham Bowler
|
* Copyright (c) 2021 Cosmin Truta
|
||||||
*
|
* Copyright (c) 2013-2017 John Cunningham Bowler
|
||||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
@@ -11,8 +10,9 @@
|
|||||||
*
|
*
|
||||||
* Test for the PNG 'simplified' APIs.
|
* Test for the PNG 'simplified' APIs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _ISOC90_SOURCE 1
|
#define _ISOC90_SOURCE 1
|
||||||
#define MALLOC_CHECK_ 2/*glibc facility: turn on debugging*/
|
#define MALLOC_CHECK_ 2 /*glibc facility: turn on debugging*/
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -373,7 +373,7 @@ print_opts(png_uint_32 opts)
|
|||||||
*/
|
*/
|
||||||
#define FORMAT_COUNT 64
|
#define FORMAT_COUNT 64
|
||||||
#define FORMAT_MASK 0x3f
|
#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",
|
||||||
"sRGB-gray+alpha",
|
"sRGB-gray+alpha",
|
||||||
@@ -579,11 +579,11 @@ typedef struct
|
|||||||
int stride_extra;
|
int stride_extra;
|
||||||
FILE *input_file;
|
FILE *input_file;
|
||||||
png_voidp input_memory;
|
png_voidp input_memory;
|
||||||
png_size_t input_memory_size;
|
size_t input_memory_size;
|
||||||
png_bytep buffer;
|
png_bytep buffer;
|
||||||
ptrdiff_t stride;
|
ptrdiff_t stride;
|
||||||
png_size_t bufsize;
|
size_t bufsize;
|
||||||
png_size_t allocsize;
|
size_t allocsize;
|
||||||
char tmpfile_name[32];
|
char tmpfile_name[32];
|
||||||
png_uint_16 colormap[256*4];
|
png_uint_16 colormap[256*4];
|
||||||
}
|
}
|
||||||
@@ -666,7 +666,7 @@ static void initimage(Image *image, png_uint_32 opts, const char *file_name,
|
|||||||
static void
|
static void
|
||||||
allocbuffer(Image *image)
|
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)
|
if (size+32 > image->bufsize)
|
||||||
{
|
{
|
||||||
@@ -1143,7 +1143,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:
|
* component ordering changes leaving three basic changes:
|
||||||
*
|
*
|
||||||
* 1) Remove an alpha channel by pre-multiplication or compositing on a
|
* 1) Remove an alpha channel by pre-multiplication or compositing on a
|
||||||
@@ -1151,7 +1151,7 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
|
|||||||
*
|
*
|
||||||
* 2) Remove color by mapping to grayscale. (Grayscale to color is a no-op.)
|
* 2) Remove color by mapping to grayscale. (Grayscale to color is a no-op.)
|
||||||
*
|
*
|
||||||
* 3) Convert between 8-bit and 16-bit components. (Both directtions are
|
* 3) Convert between 8-bit and 16-bit components. (Both directions are
|
||||||
* relevant.)
|
* relevant.)
|
||||||
*
|
*
|
||||||
* This gives the following base format conversion matrix:
|
* This gives the following base format conversion matrix:
|
||||||
@@ -2037,7 +2037,7 @@ typedef struct
|
|||||||
/* Precalculated values: */
|
/* Precalculated values: */
|
||||||
int in_opaque; /* Value of input alpha that is opaque */
|
int in_opaque; /* Value of input alpha that is opaque */
|
||||||
int is_palette; /* Sample values come from the palette */
|
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) */
|
int output_8bit; /* Output is 8-bit (else 16-bit) */
|
||||||
|
|
||||||
void (*in_gp)(Pixel*, png_const_voidp);
|
void (*in_gp)(Pixel*, png_const_voidp);
|
||||||
@@ -2347,8 +2347,8 @@ static int
|
|||||||
logpixel(const Transform *transform, png_uint_32 x, png_uint_32 y,
|
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 Pixel *in, const Pixel *calc, const Pixel *out, const char *reason)
|
||||||
{
|
{
|
||||||
const png_uint_32 in_format = transform->in_image->image.format;
|
png_uint_32 in_format = transform->in_image->image.format;
|
||||||
const png_uint_32 out_format = transform->out_image->image.format;
|
png_uint_32 out_format = transform->out_image->image.format;
|
||||||
|
|
||||||
png_uint_32 back_format = out_format & ~PNG_FORMAT_FLAG_ALPHA;
|
png_uint_32 back_format = out_format & ~PNG_FORMAT_FLAG_ALPHA;
|
||||||
const char *via_linear = "";
|
const char *via_linear = "";
|
||||||
@@ -2603,17 +2603,17 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
|||||||
ptrdiff_t strideb = b->stride;
|
ptrdiff_t strideb = b->stride;
|
||||||
png_const_bytep rowa = a->buffer+16;
|
png_const_bytep rowa = a->buffer+16;
|
||||||
png_const_bytep rowb = b->buffer+16;
|
png_const_bytep rowb = b->buffer+16;
|
||||||
const png_uint_32 width = a->image.width;
|
png_uint_32 width = a->image.width;
|
||||||
const png_uint_32 height = a->image.height;
|
png_uint_32 height = a->image.height;
|
||||||
const png_uint_32 formata = a->image.format;
|
png_uint_32 formata = a->image.format;
|
||||||
const png_uint_32 formatb = b->image.format;
|
png_uint_32 formatb = b->image.format;
|
||||||
const unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
|
unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
|
||||||
const unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
|
unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
|
||||||
int alpha_added, alpha_removed;
|
int alpha_added, alpha_removed;
|
||||||
int bchannels;
|
int bchannels;
|
||||||
int btoa[4];
|
|
||||||
png_uint_32 y;
|
png_uint_32 y;
|
||||||
Transform tr;
|
Transform tr;
|
||||||
|
int btoa[4]={0,0,0,0};
|
||||||
|
|
||||||
/* This should never happen: */
|
/* This should never happen: */
|
||||||
if (width != b->image.width || height != b->image.height)
|
if (width != b->image.width || height != b->image.height)
|
||||||
@@ -2702,7 +2702,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
|||||||
{
|
{
|
||||||
if ((a->opts & ACCUMULATE) == 0)
|
if ((a->opts & ACCUMULATE) == 0)
|
||||||
{
|
{
|
||||||
char pindex[9];
|
char pindex[16];
|
||||||
sprintf(pindex, "%lu[%lu]", (unsigned long)y,
|
sprintf(pindex, "%lu[%lu]", (unsigned long)y,
|
||||||
(unsigned long)a->image.colormap_entries);
|
(unsigned long)a->image.colormap_entries);
|
||||||
logerror(a, a->file_name, ": bad pixel index: ", pindex);
|
logerror(a, a->file_name, ": bad pixel index: ", pindex);
|
||||||
@@ -2714,7 +2714,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
|||||||
{
|
{
|
||||||
if ((b->opts & ACCUMULATE) == 0)
|
if ((b->opts & ACCUMULATE) == 0)
|
||||||
{
|
{
|
||||||
char pindex[9];
|
char pindex[16];
|
||||||
sprintf(pindex, "%lu[%lu]", (unsigned long)y,
|
sprintf(pindex, "%lu[%lu]", (unsigned long)y,
|
||||||
(unsigned long)b->image.colormap_entries);
|
(unsigned long)b->image.colormap_entries);
|
||||||
logerror(b, b->file_name, ": bad pixel index: ", pindex);
|
logerror(b, b->file_name, ": bad pixel index: ", pindex);
|
||||||
@@ -2727,7 +2727,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
|||||||
result = 0;
|
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)
|
if (a->opts & ACCUMULATE)
|
||||||
{
|
{
|
||||||
tr.error_ptr[0] = tr.error[0];
|
tr.error_ptr[0] = tr.error[0];
|
||||||
@@ -2746,22 +2746,27 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
|||||||
*/
|
*/
|
||||||
else if ((a->opts & ACCUMULATE) == 0)
|
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,
|
/* Check the original image first,
|
||||||
* TODO: deal with input images with bad pixel values?
|
* TODO: deal with input images with bad pixel values?
|
||||||
*/
|
*/
|
||||||
if (amax >= a->image.colormap_entries)
|
if (amax >= a->image.colormap_entries)
|
||||||
{
|
{
|
||||||
char pindex[9];
|
char pindex[3+2*BYTE_CHARS];
|
||||||
sprintf(pindex, "%d[%lu]", amax,
|
sprintf(pindex, "%d[%u]", amax,
|
||||||
(unsigned long)a->image.colormap_entries);
|
(png_byte)/*SAFE*/a->image.colormap_entries);
|
||||||
return logerror(a, a->file_name, ": bad pixel index: ", pindex);
|
return logerror(a, a->file_name, ": bad pixel index: ", pindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (bmax >= b->image.colormap_entries)
|
else if (bmax >= b->image.colormap_entries)
|
||||||
{
|
{
|
||||||
char pindex[9];
|
char pindex[3+2*BYTE_CHARS];
|
||||||
sprintf(pindex, "%d[%lu]", bmax,
|
sprintf(pindex, "%d[%u]", bmax,
|
||||||
(unsigned long)b->image.colormap_entries);
|
(png_byte)/*SAFE*/b->image.colormap_entries);
|
||||||
return logerror(b, b->file_name, ": bad pixel index: ", pindex);
|
return logerror(b, b->file_name, ": bad pixel index: ", pindex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2786,8 +2791,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
|||||||
(formata & (formatb ^ PNG_FORMAT_FLAG_COLOR) & PNG_FORMAT_FLAG_COLOR)))
|
(formata & (formatb ^ PNG_FORMAT_FLAG_COLOR) & PNG_FORMAT_FLAG_COLOR)))
|
||||||
{
|
{
|
||||||
/* Was an alpha channel changed? */
|
/* Was an alpha channel changed? */
|
||||||
const png_uint_32 alpha_changed = (formata ^ formatb) &
|
png_uint_32 alpha_changed = (formata ^ formatb) & PNG_FORMAT_FLAG_ALPHA;
|
||||||
PNG_FORMAT_FLAG_ALPHA;
|
|
||||||
|
|
||||||
/* Was an alpha channel removed? (The third test.) If so the direct
|
/* Was an alpha channel removed? (The third test.) If so the direct
|
||||||
* comparison is only possible if the input alpha is opaque.
|
* comparison is only possible if the input alpha is opaque.
|
||||||
@@ -2817,8 +2821,11 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
|||||||
bchannels = component_loc(bloc, formatb);
|
bchannels = component_loc(bloc, formatb);
|
||||||
|
|
||||||
/* Hence the btoa array. */
|
/* Hence the btoa array. */
|
||||||
for (i=0; i<4; ++i) if (bloc[i] < 4)
|
for (i=0; i<4; ++i)
|
||||||
|
{
|
||||||
|
if (bloc[i] < 4)
|
||||||
btoa[bloc[i]] = aloc[i]; /* may be '4' for alpha */
|
btoa[bloc[i]] = aloc[i]; /* may be '4' for alpha */
|
||||||
|
}
|
||||||
|
|
||||||
if (alpha_added)
|
if (alpha_added)
|
||||||
alpha_added = bloc[0]; /* location of alpha channel in image b */
|
alpha_added = bloc[0]; /* location of alpha channel in image b */
|
||||||
@@ -2881,10 +2888,13 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
|||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
if (pua[btoa[3]] != pub[3]) break;
|
if (pua[btoa[3]] != pub[3]) break;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case 3:
|
case 3:
|
||||||
if (pua[btoa[2]] != pub[2]) break;
|
if (pua[btoa[2]] != pub[2]) break;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case 2:
|
case 2:
|
||||||
if (pua[btoa[1]] != pub[1]) break;
|
if (pua[btoa[1]] != pub[1]) break;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case 1:
|
case 1:
|
||||||
if (pua[btoa[0]] != pub[0]) break;
|
if (pua[btoa[0]] != pub[0]) break;
|
||||||
if (alpha_added != 4 && pub[alpha_added] != 65535) break;
|
if (alpha_added != 4 && pub[alpha_added] != 65535) break;
|
||||||
@@ -2900,10 +2910,13 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
|||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
if (psa[btoa[3]] != psb[3]) break;
|
if (psa[btoa[3]] != psb[3]) break;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case 3:
|
case 3:
|
||||||
if (psa[btoa[2]] != psb[2]) break;
|
if (psa[btoa[2]] != psb[2]) break;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case 2:
|
case 2:
|
||||||
if (psa[btoa[1]] != psb[1]) break;
|
if (psa[btoa[1]] != psb[1]) break;
|
||||||
|
/* FALLTHROUGH */
|
||||||
case 1:
|
case 1:
|
||||||
if (psa[btoa[0]] != psb[0]) break;
|
if (psa[btoa[0]] != psb[0]) break;
|
||||||
if (alpha_added != 4 && psb[alpha_added] != 255) break;
|
if (alpha_added != 4 && psb[alpha_added] != 255) break;
|
||||||
@@ -2922,7 +2935,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)
|
if (a->opts & ACCUMULATE)
|
||||||
{
|
{
|
||||||
tr.error_ptr[0] = tr.error[0];
|
tr.error_ptr[0] = tr.error[0];
|
||||||
@@ -3200,10 +3213,10 @@ write_one_file(Image *output, Image *image, int convert_to_8bit)
|
|||||||
else if (image->opts & USE_FILE)
|
else if (image->opts & USE_FILE)
|
||||||
{
|
{
|
||||||
#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
|
#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
|
||||||
static int counter = 0;
|
static unsigned int counter = 0;
|
||||||
char name[32];
|
char name[32];
|
||||||
|
|
||||||
sprintf(name, "%s%d.png", tmpf, ++counter);
|
sprintf(name, "%s%u.png", tmpf, ++counter);
|
||||||
|
|
||||||
if (png_image_write_to_file(&image->image, name, convert_to_8bit,
|
if (png_image_write_to_file(&image->image, name, convert_to_8bit,
|
||||||
image->buffer+16, (png_int_32)image->stride, image->colormap))
|
image->buffer+16, (png_int_32)image->stride, image->colormap))
|
||||||
@@ -3617,7 +3630,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if (arg[0] == '-')
|
if (arg[0] == '-')
|
||||||
{
|
{
|
||||||
const int term = (arg[1] == '0' ? 0 : '\n');
|
int term = (arg[1] == '0' ? 0 : '\n');
|
||||||
unsigned int ich = 0;
|
unsigned int ich = 0;
|
||||||
|
|
||||||
/* Loop reading files, use a static buffer to simplify this and just
|
/* 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
|
/* pngunknown.c - test the read side unknown chunk handling
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
* Copyright (c) 2021 Cosmin Truta
|
||||||
* Copyright (c) 2015,2016 Glenn Randers-Pehrson
|
* Copyright (c) 2015,2017 Glenn Randers-Pehrson
|
||||||
* Written by John Cunningham Bowler
|
* Written by John Cunningham Bowler
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
defined(PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED)
|
defined(PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
|
|
||||||
#if PNG_LIBPNG_VER < 10500
|
#if PNG_LIBPNG_VER < 10500
|
||||||
/* This deliberately lacks the PNG_CONST. */
|
/* This deliberately lacks the const. */
|
||||||
typedef png_byte *png_const_bytep;
|
typedef png_byte *png_const_bytep;
|
||||||
|
|
||||||
/* This is copied from 1.5.1 png.h: */
|
/* 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_WRITE_16BIT_SUPPORTED
|
||||||
#define PNG_READ_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_FP_1 100000
|
||||||
#define PNG_GAMMA_THRESHOLD_FIXED\
|
#define PNG_GAMMA_THRESHOLD_FIXED\
|
||||||
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
((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_PLTE PNG_U32( 80, 76, 84, 69)
|
||||||
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
||||||
#define png_cHRM PNG_U32( 99, 72, 82, 77)
|
#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_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
|
||||||
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
||||||
#define png_gIFg PNG_U32(103, 73, 70, 103)
|
#define png_gIFg PNG_U32(103, 73, 70, 103)
|
||||||
@@ -210,6 +211,13 @@ static struct
|
|||||||
1,
|
1,
|
||||||
# endif
|
# endif
|
||||||
1, START, 0 },
|
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,
|
{ "gAMA", PNG_INFO_gAMA, png_gAMA,
|
||||||
# ifdef PNG_READ_gAMA_SUPPORTED
|
# ifdef PNG_READ_gAMA_SUPPORTED
|
||||||
0,
|
0,
|
||||||
@@ -362,7 +370,9 @@ find_by_flag(png_uint_32 flag)
|
|||||||
{
|
{
|
||||||
int i = NINFO;
|
int i = NINFO;
|
||||||
|
|
||||||
while (--i >= 0) if (chunk_info[i].flag == flag) return i;
|
while (--i >= 0)
|
||||||
|
if (chunk_info[i].flag == flag)
|
||||||
|
return i;
|
||||||
|
|
||||||
fprintf(stderr, "pngunknown: internal error\n");
|
fprintf(stderr, "pngunknown: internal error\n");
|
||||||
exit(4);
|
exit(4);
|
||||||
@@ -539,19 +549,21 @@ read_callback(png_structp pp, png_unknown_chunkp pc)
|
|||||||
|
|
||||||
case PNG_HANDLE_CHUNK_AS_DEFAULT:
|
case PNG_HANDLE_CHUNK_AS_DEFAULT:
|
||||||
case PNG_HANDLE_CHUNK_NEVER:
|
case PNG_HANDLE_CHUNK_NEVER:
|
||||||
discard = 1/*handled; discard*/;
|
discard = 1; /*handled; discard*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PNG_HANDLE_CHUNK_IF_SAFE:
|
case PNG_HANDLE_CHUNK_IF_SAFE:
|
||||||
case PNG_HANDLE_CHUNK_ALWAYS:
|
case PNG_HANDLE_CHUNK_ALWAYS:
|
||||||
discard = 0/*not handled; keep*/;
|
discard = 0; /*not handled; keep*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Also store information about this chunk in the display, the relevant flag
|
/* Also store information about this chunk in the display, the relevant flag
|
||||||
* is set if the chunk is to be kept ('not handled'.)
|
* is set if the chunk is to be kept ('not handled'.)
|
||||||
*/
|
*/
|
||||||
if (chunk >= 0) if (!discard) /* stupidity to stop a GCC warning */
|
if (chunk >= 0)
|
||||||
|
{
|
||||||
|
if (!discard) /* stupidity to stop a GCC warning */
|
||||||
{
|
{
|
||||||
png_uint_32 flag = chunk_info[chunk].flag;
|
png_uint_32 flag = chunk_info[chunk].flag;
|
||||||
|
|
||||||
@@ -561,6 +573,7 @@ read_callback(png_structp pp, png_unknown_chunkp pc)
|
|||||||
else
|
else
|
||||||
d->before_IDAT |= flag;
|
d->before_IDAT |= flag;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* However if there is no support to store unknown chunks don't ask libpng to
|
/* However if there is no support to store unknown chunks don't ask libpng to
|
||||||
* do it; there will be an png_error.
|
* do it; there will be an png_error.
|
||||||
@@ -614,7 +627,7 @@ get_unknown(display *d, png_infop info_ptr, int after_IDAT)
|
|||||||
++(d->error_count);
|
++(d->error_count);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* FALL THROUGH (safe) */
|
/* FALLTHROUGH */ /* (safe) */
|
||||||
case PNG_HANDLE_CHUNK_ALWAYS:
|
case PNG_HANDLE_CHUNK_ALWAYS:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -833,7 +846,8 @@ check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/,
|
|||||||
{
|
{
|
||||||
png_uint_32 y;
|
png_uint_32 y;
|
||||||
|
|
||||||
for (y=0; y<height; ++y) if (PNG_ROW_IN_INTERLACE_PASS(y, ipass))
|
for (y=0; y<height; ++y)
|
||||||
|
if (PNG_ROW_IN_INTERLACE_PASS(y, ipass))
|
||||||
png_read_row(d->png_ptr, NULL, NULL);
|
png_read_row(d->png_ptr, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1083,15 +1097,15 @@ perform_one_test_safe(FILE *fp, int argc, const char **argv,
|
|||||||
|
|
||||||
static const char *standard_tests[] =
|
static const char *standard_tests[] =
|
||||||
{
|
{
|
||||||
"discard", "default=discard", 0,
|
"discard", "default=discard", NULL,
|
||||||
"save", "default=save", 0,
|
"save", "default=save", NULL,
|
||||||
"if-safe", "default=if-safe", 0,
|
"if-safe", "default=if-safe", NULL,
|
||||||
"vpAg", "vpAg=if-safe", 0,
|
"vpAg", "vpAg=if-safe", NULL,
|
||||||
"sTER", "sTER=if-safe", 0,
|
"sTER", "sTER=if-safe", NULL,
|
||||||
"IDAT", "default=discard", "IDAT=save", 0,
|
"IDAT", "default=discard", "IDAT=save", NULL,
|
||||||
"sAPI", "bKGD=save", "cHRM=save", "gAMA=save", "all=discard", "iCCP=save",
|
"sAPI", "bKGD=save", "cHRM=save", "gAMA=save", "all=discard", "iCCP=save",
|
||||||
"sBIT=save", "sRGB=save", 0,
|
"sBIT=save", "sRGB=save", "eXIf=save", NULL,
|
||||||
0/*end*/
|
NULL /*end*/
|
||||||
};
|
};
|
||||||
|
|
||||||
static PNG_NORETURN void
|
static PNG_NORETURN void
|
||||||
@@ -1107,7 +1121,7 @@ int
|
|||||||
main(int argc, const char **argv)
|
main(int argc, const char **argv)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
png_uint_32 default_flags[4/*valid,unknown{before,after}*/];
|
png_uint_32 default_flags[4]; /*valid,unknown{before,after}*/
|
||||||
int strict = 0, default_tests = 0;
|
int strict = 0, default_tests = 0;
|
||||||
const char *count_argv = "default=save";
|
const char *count_argv = "default=save";
|
||||||
const char *touch_file = NULL;
|
const char *touch_file = NULL;
|
||||||
@@ -1145,7 +1159,8 @@ main(int argc, const char **argv)
|
|||||||
/* GCC BUG: if (default_tests && argc != 1) triggers some weird GCC argc
|
/* GCC BUG: if (default_tests && argc != 1) triggers some weird GCC argc
|
||||||
* optimization which causes warnings with -Wstrict-overflow!
|
* optimization which causes warnings with -Wstrict-overflow!
|
||||||
*/
|
*/
|
||||||
else if (default_tests) if (argc != 1)
|
else if (default_tests)
|
||||||
|
if (argc != 1)
|
||||||
usage(d.program, "extra arguments");
|
usage(d.program, "extra arguments");
|
||||||
|
|
||||||
/* The name of the test file is the last argument; remove it. */
|
/* The name of the test file is the last argument; remove it. */
|
||||||
@@ -1208,7 +1223,11 @@ main(int argc, const char **argv)
|
|||||||
const char *result;
|
const char *result;
|
||||||
int arg_count = 0;
|
int arg_count = 0;
|
||||||
|
|
||||||
while (*next) ++next, ++arg_count;
|
while (*next != NULL)
|
||||||
|
{
|
||||||
|
++next;
|
||||||
|
++arg_count;
|
||||||
|
}
|
||||||
|
|
||||||
perform_one_test_safe(fp, arg_count, test, default_flags, &d,
|
perform_one_test_safe(fp, arg_count, test, default_flags, &d,
|
||||||
this_test);
|
this_test);
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
|
|
||||||
/* readpng.c
|
/* readpng.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 John Cunningham Bowler
|
* Copyright (c) 2013 John Cunningham Bowler
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
@@ -60,7 +59,7 @@ read_png(FILE *fp)
|
|||||||
png_read_info(png_ptr, 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);
|
||||||
|
|
||||||
/* Failure to initialize these is harmless */
|
/* Failure to initialize these is harmless */
|
||||||
row = malloc(rowbytes);
|
row = malloc(rowbytes);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
/* tarith.c
|
/* tarith.c
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2021 Cosmin Truta
|
||||||
* Copyright (c) 2011-2013 John Cunningham Bowler
|
* Copyright (c) 2011-2013 John Cunningham Bowler
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
@@ -88,6 +87,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
|||||||
int minorarith = 0;
|
int minorarith = 0;
|
||||||
|
|
||||||
while (--argc > 0)
|
while (--argc > 0)
|
||||||
|
{
|
||||||
if (strcmp(*++argv, "-a") == 0)
|
if (strcmp(*++argv, "-a") == 0)
|
||||||
showall = 1;
|
showall = 1;
|
||||||
else if (strcmp(*argv, "-e") == 0 && argc > 0)
|
else if (strcmp(*argv, "-e") == 0 && argc > 0)
|
||||||
@@ -105,10 +105,11 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
|||||||
fprintf(stderr, "unknown argument %s\n", *argv);
|
fprintf(stderr, "unknown argument %s\n", *argv);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
png_size_t index;
|
size_t index;
|
||||||
int state, failed = 0;
|
int state, failed = 0;
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
|
|
||||||
@@ -130,8 +131,8 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (buffer[precision+7] != 71)
|
if (buffer[precision+7] != 71)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%g[%d] -> '%s'[%lu] buffer overflow\n", test,
|
fprintf(stderr, "%g[%d] -> '%s'[%lu] buffer overflow\n",
|
||||||
precision, buffer, (unsigned long)strlen(buffer));
|
test, precision, buffer, (unsigned long)strlen(buffer));
|
||||||
failed = 1;
|
failed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,16 +147,16 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
|||||||
if (test >= 0 && strcmp(buffer, "inf") ||
|
if (test >= 0 && strcmp(buffer, "inf") ||
|
||||||
test < 0 && strcmp(buffer, "-inf"))
|
test < 0 && strcmp(buffer, "-inf"))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%g[%d] -> '%s' but expected 'inf'\n", test,
|
fprintf(stderr, "%g[%d] -> '%s' but expected 'inf'\n",
|
||||||
precision, buffer);
|
test, precision, buffer);
|
||||||
failed = 1;
|
failed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!png_check_fp_number(buffer, precision+10, &state, &index) ||
|
else if (!png_check_fp_number(buffer, precision+10, &state, &index) ||
|
||||||
buffer[index] != 0)
|
buffer[index] != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%g[%d] -> '%s' but has bad format ('%c')\n", test,
|
fprintf(stderr, "%g[%d] -> '%s' but has bad format ('%c')\n",
|
||||||
precision, buffer, buffer[index]);
|
test, precision, buffer, buffer[index]);
|
||||||
failed = 1;
|
failed = 1;
|
||||||
}
|
}
|
||||||
else if (PNG_FP_IS_NEGATIVE(state) && !(test < 0))
|
else if (PNG_FP_IS_NEGATIVE(state) && !(test < 0))
|
||||||
@@ -176,7 +177,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
else if (PNG_FP_IS_POSITIVE(state) && !(test > 0))
|
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);
|
test, precision, buffer);
|
||||||
failed = 1;
|
failed = 1;
|
||||||
assert(!PNG_FP_IS_NEGATIVE(state));
|
assert(!PNG_FP_IS_NEGATIVE(state));
|
||||||
@@ -187,7 +188,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
|||||||
/* Check the result against the original. */
|
/* Check the result against the original. */
|
||||||
double out = atof(buffer);
|
double out = atof(buffer);
|
||||||
double change = fabs((out - test)/test);
|
double change = fabs((out - test)/test);
|
||||||
double allow = .5/pow(10,
|
double allow = .5 / pow(10,
|
||||||
(precision >= DBL_DIG) ? DBL_DIG-1 : precision-1);
|
(precision >= DBL_DIG) ? DBL_DIG-1 : precision-1);
|
||||||
|
|
||||||
/* NOTE: if you hit this error case are you compiling with gcc
|
/* NOTE: if you hit this error case are you compiling with gcc
|
||||||
@@ -257,8 +258,9 @@ skip:
|
|||||||
}
|
}
|
||||||
while (--count);
|
while (--count);
|
||||||
|
|
||||||
printf("Tested %d finite values, %d non-finite, %d OK (%d failed) %d minor "
|
printf("Tested %d finite values, %d non-finite, %d OK (%d failed) "
|
||||||
"arithmetic errors\n", finite, nonfinite, ok, failcount, minorarith);
|
"%d minor arithmetic errors\n",
|
||||||
|
finite, nonfinite, ok, failcount, minorarith);
|
||||||
printf(" Error with >=%d digit precision %.2f%%\n", DBL_DIG, max_abs);
|
printf(" Error with >=%d digit precision %.2f%%\n", DBL_DIG, max_abs);
|
||||||
printf(" Error with < %d digit precision %.2f%%\n", DBL_DIG, max);
|
printf(" Error with < %d digit precision %.2f%%\n", DBL_DIG, max);
|
||||||
|
|
||||||
@@ -329,10 +331,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.
|
/* 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 char test = (char)ch;
|
||||||
const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
||||||
const int character_accepted = (index == 1);
|
int character_accepted = (index == 1);
|
||||||
|
|
||||||
if (c.check_state != exponent && isdigit(ch) && ch != '0')
|
if (c.check_state != exponent && isdigit(ch) && ch != '0')
|
||||||
c.is_zero = 0;
|
c.is_zero = 0;
|
||||||
@@ -371,8 +373,8 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
|
|||||||
/* This should never fail (it's a serious bug if it does): */
|
/* This should never fail (it's a serious bug if it does): */
|
||||||
if (index != 0 && index != 1)
|
if (index != 0 && index != 1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: read beyond end of string (%lu)\n", co->number,
|
fprintf(stderr, "%s: read beyond end of string (%lu)\n",
|
||||||
(unsigned long)index);
|
co->number, (unsigned long)index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,8 +505,8 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
|
|||||||
if (number_is_valid != c.number_was_valid)
|
if (number_is_valid != c.number_was_valid)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: character '%c' [0x%.2x] changed number validity\n", co->number,
|
"%s: character '%c' [0x%.2x] changed number validity\n",
|
||||||
ch, ch);
|
co->number, ch, ch);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,11 +523,14 @@ static int check_all_characters(checkfp_command *co, checkfp_control c)
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
if (c.cnumber+4 < sizeof co->number) for (ch=0; ch<256; ++ch)
|
if (c.cnumber+4 < sizeof co->number)
|
||||||
|
{
|
||||||
|
for (ch=0; ch<256; ++ch)
|
||||||
{
|
{
|
||||||
if (!check_one_character(co, c, ch))
|
if (!check_one_character(co, c, ch))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -539,11 +544,14 @@ static int check_some_characters(checkfp_command *co, checkfp_control c,
|
|||||||
|
|
||||||
if (c.cnumber+4 < sizeof co->number && c.limit >= 0)
|
if (c.cnumber+4 < sizeof co->number && c.limit >= 0)
|
||||||
{
|
{
|
||||||
if (c.limit > 0) for (i=0; tests[i]; ++i)
|
if (c.limit > 0)
|
||||||
|
{
|
||||||
|
for (i=0; tests[i]; ++i)
|
||||||
{
|
{
|
||||||
if (!check_one_character(co, c, tests[i]))
|
if (!check_one_character(co, c, tests[i]))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* At the end check all the characters. */
|
/* At the end check all the characters. */
|
||||||
else
|
else
|
||||||
@@ -687,25 +695,25 @@ int validation_muldiv(int count, int argc, char **argv)
|
|||||||
ok = 0, ++overflow, fpround = fp/*misleading*/;
|
ok = 0, ++overflow, fpround = fp/*misleading*/;
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "TEST %d * %d / %d -> %lld (%s)\n", a, times, div,
|
fprintf(stderr, "TEST %d * %d / %d -> %lld (%s)\n",
|
||||||
fp, ok ? "ok" : "overflow");
|
a, times, div, fp, ok ? "ok" : "overflow");
|
||||||
|
|
||||||
++tested;
|
++tested;
|
||||||
if (png_muldiv(&result, a, times, div) != ok)
|
if (png_muldiv(&result, a, times, div) != ok)
|
||||||
{
|
{
|
||||||
++error;
|
++error;
|
||||||
if (ok)
|
if (ok)
|
||||||
fprintf(stderr, "%d * %d / %d -> overflow (expected %lld)\n", a,
|
fprintf(stderr, "%d * %d / %d -> overflow (expected %lld)\n",
|
||||||
times, div, fp);
|
a, times, div, fp);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "%d * %d / %d -> %d (expected overflow %lld)\n", a,
|
fprintf(stderr, "%d * %d / %d -> %d (expected overflow %lld)\n",
|
||||||
times, div, result, fp);
|
a, times, div, result, fp);
|
||||||
}
|
}
|
||||||
else if (ok && result != fpround)
|
else if (ok && result != fpround)
|
||||||
{
|
{
|
||||||
++error;
|
++error;
|
||||||
fprintf(stderr, "%d * %d / %d -> %d not %lld\n", a, times, div, result,
|
fprintf(stderr, "%d * %d / %d -> %d not %lld\n",
|
||||||
fp);
|
a, times, div, result, fp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++passed;
|
++passed;
|
||||||
@@ -721,8 +729,8 @@ int validation_muldiv(int count, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
while (--count > 0);
|
while (--count > 0);
|
||||||
|
|
||||||
printf("%d tests including %d overflows, %d passed, %d failed (%d 64-bit "
|
printf("%d tests including %d overflows, %d passed, %d failed "
|
||||||
"errors)\n", tested, overflow, passed, error, error64);
|
"(%d 64-bit errors)\n", tested, overflow, passed, error, error64);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -821,8 +829,9 @@ int validation_gamma(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (error > .68) /* By experiment error is less than .68 */
|
if (error > .68) /* By experiment error is less than .68 */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "16-bit log error: %d: got %u, expected %f"
|
fprintf(stderr,
|
||||||
" error: %f\n", i, png_log16bit(i), correct, error);
|
"16-bit log error: %d: got %u, expected %f error: %f\n",
|
||||||
|
i, png_log16bit(i), correct, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -841,8 +850,9 @@ int validation_gamma(int argc, char **argv)
|
|||||||
maxerr = fabs(error);
|
maxerr = fabs(error);
|
||||||
if (fabs(error) > 1883) /* By experiment. */
|
if (fabs(error) > 1883) /* By experiment. */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "32-bit exp error: %d: got %u, expected %f"
|
fprintf(stderr,
|
||||||
" error: %f\n", i, png_exp(i), correct, error);
|
"32-bit exp error: %d: got %u, expected %f error: %f\n",
|
||||||
|
i, png_exp(i), correct, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -859,8 +869,9 @@ int validation_gamma(int argc, char **argv)
|
|||||||
maxerr = fabs(error);
|
maxerr = fabs(error);
|
||||||
if (fabs(error) > .50002) /* By experiment */
|
if (fabs(error) > .50002) /* By experiment */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "8-bit exp error: %d: got %u, expected %f"
|
fprintf(stderr,
|
||||||
" error: %f\n", i, png_exp8bit(i), correct, error);
|
"8-bit exp error: %d: got %u, expected %f error: %f\n",
|
||||||
|
i, png_exp8bit(i), correct, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,8 +888,9 @@ int validation_gamma(int argc, char **argv)
|
|||||||
maxerr = fabs(error);
|
maxerr = fabs(error);
|
||||||
if (fabs(error) > .524) /* By experiment */
|
if (fabs(error) > .524) /* By experiment */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "16-bit exp error: %d: got %u, expected %f"
|
fprintf(stderr,
|
||||||
" error: %f\n", i, png_exp16bit(i), correct, error);
|
"16-bit exp error: %d: got %u, expected %f error: %f\n",
|
||||||
|
i, png_exp16bit(i), correct, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -940,7 +952,7 @@ int validation_gamma(int argc, char **argv)
|
|||||||
|
|
||||||
/**************************** VALIDATION TESTS ********************************/
|
/**************************** VALIDATION TESTS ********************************/
|
||||||
/* Various validation routines are included herein, they require some
|
/* Various validation routines are included herein, they require some
|
||||||
* definition for png_warning and png_error, seetings of VALIDATION:
|
* definition for png_warning and png_error, settings of VALIDATION:
|
||||||
*
|
*
|
||||||
* 1: validates the ASCII to floating point conversions
|
* 1: validates the ASCII to floating point conversions
|
||||||
* 2: validates png_muldiv
|
* 2: validates png_muldiv
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
|
|
||||||
/* timepng.c
|
/* timepng.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013,2016 John Cunningham Bowler
|
* Copyright (c) 2013,2016 John Cunningham Bowler
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
@@ -65,7 +64,7 @@ typedef struct
|
|||||||
} io_data;
|
} io_data;
|
||||||
|
|
||||||
static PNG_CALLBACK(void, read_and_copy,
|
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);
|
io_data *io = (io_data*)png_get_io_ptr(png_ptr);
|
||||||
|
|
||||||
@@ -100,7 +99,7 @@ static void read_by_row(png_structp png_ptr, png_infop info_ptr,
|
|||||||
png_read_info(png_ptr, 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));
|
row = voidcast(png_bytep,malloc(rowbytes));
|
||||||
display = voidcast(png_bytep,malloc(rowbytes));
|
display = voidcast(png_bytep,malloc(rowbytes));
|
||||||
@@ -528,7 +527,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (nfiles == 0) /* Read from stdin withoout --dissemble */
|
else if (nfiles == 0) /* Read from stdin without --dissemble */
|
||||||
{
|
{
|
||||||
char filename[FILENAME_MAX+1];
|
char filename[FILENAME_MAX+1];
|
||||||
|
|
||||||
|
|||||||
142
contrib/mips-mmi/linux.c
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
|
||||||
|
/* contrib/mips-mmi/linux.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 Cosmin Truta
|
||||||
|
* Written by guxiwei, 2023
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
* For conditions of distribution and use, see the disclaimer
|
||||||
|
* and license in png.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/auxv.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* parse_r var, r - Helper assembler macro for parsing register names.
|
||||||
|
*
|
||||||
|
* This converts the register name in $n form provided in \r to the
|
||||||
|
* corresponding register number, which is assigned to the variable \var. It is
|
||||||
|
* needed to allow explicit encoding of instructions in inline assembly where
|
||||||
|
* registers are chosen by the compiler in $n form, allowing us to avoid using
|
||||||
|
* fixed register numbers.
|
||||||
|
*
|
||||||
|
* It also allows newer instructions (not implemented by the assembler) to be
|
||||||
|
* transparently implemented using assembler macros, instead of needing separate
|
||||||
|
* cases depending on toolchain support.
|
||||||
|
*
|
||||||
|
* Simple usage example:
|
||||||
|
* __asm__ __volatile__("parse_r __rt, %0\n\t"
|
||||||
|
* ".insn\n\t"
|
||||||
|
* "# di %0\n\t"
|
||||||
|
* ".word (0x41606000 | (__rt << 16))"
|
||||||
|
* : "=r" (status);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Match an individual register number and assign to \var */
|
||||||
|
#define _IFC_REG(n) \
|
||||||
|
".ifc \\r, $" #n "\n\t" \
|
||||||
|
"\\var = " #n "\n\t" \
|
||||||
|
".endif\n\t"
|
||||||
|
|
||||||
|
__asm__(".macro parse_r var r\n\t"
|
||||||
|
"\\var = -1\n\t"
|
||||||
|
_IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3)
|
||||||
|
_IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7)
|
||||||
|
_IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11)
|
||||||
|
_IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15)
|
||||||
|
_IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19)
|
||||||
|
_IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23)
|
||||||
|
_IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27)
|
||||||
|
_IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31)
|
||||||
|
".iflt \\var\n\t"
|
||||||
|
".error \"Unable to parse register name \\r\"\n\t"
|
||||||
|
".endif\n\t"
|
||||||
|
".endm");
|
||||||
|
|
||||||
|
#define HWCAP_LOONGSON_CPUCFG (1 << 14)
|
||||||
|
|
||||||
|
static int cpucfg_available(void)
|
||||||
|
{
|
||||||
|
return getauxval(AT_HWCAP) & HWCAP_LOONGSON_CPUCFG;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int strstart(const char *str, const char *pfx, const char **ptr)
|
||||||
|
{
|
||||||
|
while (*pfx && *pfx == *str) {
|
||||||
|
pfx++;
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
if (!*pfx && ptr)
|
||||||
|
*ptr = str;
|
||||||
|
return !*pfx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Most toolchains have no CPUCFG support yet */
|
||||||
|
static uint32_t read_cpucfg(uint32_t reg)
|
||||||
|
{
|
||||||
|
uint32_t __res;
|
||||||
|
|
||||||
|
__asm__ __volatile__(
|
||||||
|
"parse_r __res,%0\n\t"
|
||||||
|
"parse_r reg,%1\n\t"
|
||||||
|
".insn \n\t"
|
||||||
|
".word (0xc8080118 | (reg << 21) | (__res << 11))\n\t"
|
||||||
|
:"=r"(__res)
|
||||||
|
:"r"(reg)
|
||||||
|
:
|
||||||
|
);
|
||||||
|
return __res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define LOONGSON_CFG1 0x1
|
||||||
|
|
||||||
|
#define LOONGSON_CFG1_MMI (1 << 4)
|
||||||
|
|
||||||
|
static int cpu_flags_cpucfg(void)
|
||||||
|
{
|
||||||
|
int flags = 0;
|
||||||
|
uint32_t cfg1 = read_cpucfg(LOONGSON_CFG1);
|
||||||
|
|
||||||
|
if (cfg1 & LOONGSON_CFG1_MMI)
|
||||||
|
flags = 1;
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cpu_flags_cpuinfo(void)
|
||||||
|
{
|
||||||
|
FILE *f = fopen("/proc/cpuinfo", "r");
|
||||||
|
char buf[200];
|
||||||
|
int flags = 0;
|
||||||
|
|
||||||
|
if (!f)
|
||||||
|
return flags;
|
||||||
|
|
||||||
|
while (fgets(buf, sizeof(buf), f)) {
|
||||||
|
/* Legacy kernel may not export MMI in ASEs implemented */
|
||||||
|
if (strstart(buf, "cpu model", NULL)) {
|
||||||
|
if (strstr(buf, "Loongson-3 "))
|
||||||
|
flags = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (strstart(buf, "ASEs implemented", NULL)) {
|
||||||
|
if (strstr(buf, " loongson-mmi"))
|
||||||
|
flags = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int png_have_mmi()
|
||||||
|
{
|
||||||
|
if (cpucfg_available())
|
||||||
|
return cpu_flags_cpucfg();
|
||||||
|
else
|
||||||
|
return cpu_flags_cpuinfo();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,64 +1,55 @@
|
|||||||
|
|
||||||
/* contrib/mips-msa/linux.c
|
/* contrib/mips-msa/linux.c
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2020-2023 Cosmin Truta
|
||||||
* Copyright (c) 2016 Glenn Randers-Pehrson
|
* Copyright (c) 2016 Glenn Randers-Pehrson
|
||||||
* Written by Mandar Sahastrabuddhe, 2016.
|
* Written by Mandar Sahastrabuddhe, 2016.
|
||||||
* Last changed in libpng 1.6.25beta03 [August 29, 2016]
|
* Updated by Sui Jingfeng, 2021.
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
*
|
*
|
||||||
* SEE contrib/mips-msa/README before reporting bugs
|
* On Linux, png_have_msa is implemented by reading the pseudo-file
|
||||||
|
* "/proc/self/auxv".
|
||||||
|
*
|
||||||
|
* See contrib/mips-msa/README before reporting bugs.
|
||||||
*
|
*
|
||||||
* STATUS: SUPPORTED
|
* STATUS: SUPPORTED
|
||||||
* BUG REPORTS: png-mng-implement@sourceforge.net
|
* 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 <elf.h>
|
||||||
#include <string.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
static int
|
static int
|
||||||
png_have_msa(png_structp png_ptr)
|
png_have_msa(png_structp png_ptr)
|
||||||
{
|
{
|
||||||
FILE *f = fopen("/proc/cpuinfo", "rb");
|
Elf64_auxv_t aux;
|
||||||
|
int fd;
|
||||||
|
int has_msa = 0;
|
||||||
|
|
||||||
char *string = "msa";
|
fd = open("/proc/self/auxv", O_RDONLY);
|
||||||
char word[10];
|
if (fd >= 0)
|
||||||
|
{
|
||||||
|
while (read(fd, &aux, sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t))
|
||||||
|
{
|
||||||
|
if (aux.a_type == AT_HWCAP)
|
||||||
|
{
|
||||||
|
uint64_t hwcap = aux.a_un.a_val;
|
||||||
|
|
||||||
if (f != NULL)
|
has_msa = (hwcap >> 1) & 1;
|
||||||
{
|
break;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
close(fd);
|
||||||
fclose(f);
|
|
||||||
}
|
}
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
else
|
else
|
||||||
png_warning(png_ptr, "/proc/cpuinfo open failed");
|
png_warning(png_ptr, "/proc/self/auxv open failed");
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
|
||||||
|
return has_msa;
|
||||||
}
|
}
|
||||||
|
|||||||
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
|
||||||
36
contrib/oss-fuzz/README.txt
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
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.
|
||||||
50
contrib/oss-fuzz/build.sh
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
#!/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.
|
||||||
|
#
|
||||||
|
# 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/
|
||||||
208
contrib/oss-fuzz/libpng_read_fuzzer.cc
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
// 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 <stdlib.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* limited_malloc(png_structp, png_alloc_size_t size) {
|
||||||
|
// libpng may allocate large amounts of memory that the fuzzer reports as
|
||||||
|
// an error. In order to silence these errors, make libpng fail when trying
|
||||||
|
// to allocate a large amount. This allocator used to be in the Chromium
|
||||||
|
// version of this fuzzer.
|
||||||
|
// This number is chosen to match the default png_user_chunk_malloc_max.
|
||||||
|
if (size > 8000000)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void default_free(png_structp, png_voidp ptr) {
|
||||||
|
return free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use a custom allocator that fails for large allocations to avoid OOM.
|
||||||
|
png_set_mem_fn(png_handler.png_ptr, nullptr, limited_malloc, default_free);
|
||||||
|
|
||||||
|
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"
|
||||||
11
contrib/pngminus/.gitignore
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Compiled executables
|
||||||
|
png2pnm
|
||||||
|
png2pnm.exe
|
||||||
|
png2pnm-static*
|
||||||
|
pnm2png
|
||||||
|
pnm2png.exe
|
||||||
|
pnm2png-static*
|
||||||
|
|
||||||
|
# Test artifacts
|
||||||
|
*.png
|
||||||
|
*.p[abgnp]m
|
||||||
14
contrib/pngminus/CHANGES.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
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 - Fix memory 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)
|
||||||
|
1.8 - 2024.01.09 - Fix, improve, modernize (Cosmin Truta)
|
||||||
41
contrib/pngminus/CMakeLists.txt
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Copyright (c) 2018-2024 Cosmin Truta
|
||||||
|
#
|
||||||
|
# This software is released under the MIT license. For conditions of
|
||||||
|
# distribution and use, see the LICENSE file part of this package.
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
project(PNGMINUS C)
|
||||||
|
|
||||||
|
option(PNGMINUS_USE_SYSTEM_PNG
|
||||||
|
"Use the libpng build found in the system" OFF)
|
||||||
|
|
||||||
|
add_executable(png2pnm png2pnm.c)
|
||||||
|
add_executable(pnm2png pnm2png.c)
|
||||||
|
|
||||||
|
if(PNGMINUS_USE_SYSTEM_PNG)
|
||||||
|
# Use the system libpng.
|
||||||
|
find_package(PNG REQUIRED)
|
||||||
|
target_link_libraries(png2pnm PRIVATE PNG::PNG)
|
||||||
|
target_link_libraries(pnm2png PRIVATE PNG::PNG)
|
||||||
|
else()
|
||||||
|
# Build and use the internal libpng.
|
||||||
|
# Configure libpng for static linking, to produce single-file executables.
|
||||||
|
set(PNG_STATIC ON
|
||||||
|
CACHE STRING "Build the internal libpng as a static library" FORCE)
|
||||||
|
set(PNG_SHARED OFF
|
||||||
|
CACHE STRING "Build the internal libpng as a shared library" FORCE)
|
||||||
|
set(PNG_FRAMEWORK OFF
|
||||||
|
CACHE STRING "Build the internal libpng as a framework bundle" FORCE)
|
||||||
|
add_subdirectory(../.. libpng)
|
||||||
|
target_include_directories(png2pnm PRIVATE
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../..>"
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/libpng>"
|
||||||
|
)
|
||||||
|
target_include_directories(pnm2png PRIVATE
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../..>"
|
||||||
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/libpng>"
|
||||||
|
)
|
||||||
|
target_link_libraries(png2pnm PRIVATE png_static)
|
||||||
|
target_link_libraries(pnm2png PRIVATE png_static)
|
||||||
|
endif()
|
||||||
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 copyright 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
|
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
|
Some history
|
||||||
------------
|
------------
|
||||||
Soon after the creation of PNG in 1995, the need was felt for a set of
|
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
|
(Willem van Schaik) started such a project. Luckily we discovered this
|
||||||
and merged the two together into pnmtopng.tar.gz, which is available
|
and merged the two, which later became part of NetPBM, available from
|
||||||
from a/o ftp://ftp.simplesystems.org/pub/libpng/png/.
|
SourceForge.
|
||||||
|
|
||||||
These two utilities have many, many options and make use of most of the
|
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
|
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.
|
features of pnmtopng.
|
||||||
|
|
||||||
|
|
||||||
What now
|
What now (1999)
|
||||||
--------
|
---------------
|
||||||
At this moment libpng is in a very stable state and can do much of the
|
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
|
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
|
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
|
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
|
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
|
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,
|
software developments. By now there are of course a couple of programs,
|
||||||
like Greg Roelofs' rpng/wpng, that can be used just as good.)
|
like Greg Roelofs' rpng/wpng, that can be used just as good.
|
||||||
|
|
||||||
|
|
||||||
Can and can not
|
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,
|
avoided the use the netpbm library, which requires DOS extenders. Again,
|
||||||
another reason to call it PngMinus (minus netpbm :-). So, part of the
|
another reason to call it PngMinus (minus netpbm :-). So, part of the
|
||||||
program are some elementary routines to read / write pgm- and ppm-files.
|
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
|
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
|
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
|
Just like Scandinavian furniture
|
||||||
--------------------------------
|
--------------------------------
|
||||||
You have to put it together yourself. I did test the software under
|
You have to put it together yourself. I developed the software on MS-DOS
|
||||||
MS-DOS with Turbo-C 3.0 and under RedHat Linux 4.2 with gcc. In both
|
with Turbo-C 3.0 and RedHat Linux 4.2 with gcc. In both cases I used
|
||||||
cases I used libpng-1.0.4 and zlib-1.1.3. Later versions should be OK,
|
libpng-1.0.4 and zlib-1.1.3. By now (2019) it is twenty years later and
|
||||||
however some older libpng versions have a bug in pngmem.c when using
|
more current versions are OK.
|
||||||
Turbo-C 3.0 (see below).
|
|
||||||
|
|
||||||
You can build it using one of the two makefiles (make -f makefile.###)
|
The makefile assumes that the libpng libraries can be found in ../.. and
|
||||||
or use the batch/script files pngminus.bat / pngminus.sh. This assumes
|
libz in ../../../zlib. But you can change this to for example ../libpng
|
||||||
that you have built the libraries in ../libpng and ../zlib. Using Linux,
|
and ../zlib. The makefile creates two versions of each program, one with
|
||||||
make sure that you have built libpng with makefile.std and not
|
static library support and the other using shared libraries.
|
||||||
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.
|
|
||||||
|
|
||||||
If you create a ../pngsuite directory and then store the basn####.png
|
If you create a ../pngsuite directory and then store the basn####.png
|
||||||
files from PngSuite (http://www.schaik.com/pngsuite/) in there, you can
|
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
|
test the proper functioning of PngMinus by running pngminus.sh.
|
||||||
pnm2png.bat (or the .sh versions).
|
|
||||||
|
|
||||||
|
|
||||||
Warranty
|
Warranty
|
||||||
-------
|
-------
|
||||||
Please, remember that this was just a small experiment to learn a few
|
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
|
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
|
it when you are in need for something simple or when you want a starting
|
||||||
developing your own stuff.
|
point for 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;
|
|
||||||
**
|
|
||||||
|
|
||||||
|
|
||||||
The end
|
The end
|
||||||
-------
|
-------
|
||||||
Willem van Schaik
|
Willem van Schaik
|
||||||
mailto:willem at schaik.com
|
mailto:willem at schaik dot com
|
||||||
http://www.schaik.com/png/
|
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
|
|
||||||
@@ -1,72 +1,52 @@
|
|||||||
/*
|
/*
|
||||||
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
|
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
|
||||||
* copyright (C) 1999 by Willem van Schaik <willem at schaik.com>
|
* copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||||
*
|
*
|
||||||
* version 1.0 - 1999.10.15 - First version.
|
* This software is released under the MIT license. For conditions of
|
||||||
*
|
* distribution and use, see the LICENSE file part of this package.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef __TURBOC__
|
|
||||||
#include <mem.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
#ifndef BOOL
|
#ifndef BOOL
|
||||||
#define BOOL unsigned char
|
#define BOOL unsigned char
|
||||||
#endif
|
#endif
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE (BOOL) 1
|
#define TRUE ((BOOL) 1)
|
||||||
#endif
|
#endif
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
#define FALSE (BOOL) 0
|
#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) */
|
|
||||||
#ifndef PNG_DEBUG
|
|
||||||
#define PNG_DEBUG 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "png.h"
|
#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 */
|
/* function prototypes */
|
||||||
|
|
||||||
int main (int argc, char *argv[]);
|
int main (int argc, char *argv[]);
|
||||||
void usage ();
|
void usage ();
|
||||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw,
|
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
BOOL alpha);
|
BOOL raw, BOOL alpha);
|
||||||
|
BOOL do_png2pnm (png_struct *png_ptr, png_info *info_ptr,
|
||||||
|
FILE *pnm_file, FILE *alpha_file,
|
||||||
|
BOOL raw, BOOL alpha);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main
|
* main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FILE *fp_rd = stdin;
|
FILE *fp_rd = stdin;
|
||||||
FILE *fp_wr = stdout;
|
FILE *fp_wr = stdout;
|
||||||
FILE *fp_al = NULL;
|
FILE *fp_al = NULL;
|
||||||
|
const char *fname_wr = NULL;
|
||||||
|
const char *fname_al = NULL;
|
||||||
BOOL raw = TRUE;
|
BOOL raw = TRUE;
|
||||||
BOOL alpha = FALSE;
|
BOOL alpha = FALSE;
|
||||||
int argi;
|
int argi;
|
||||||
|
int ret;
|
||||||
|
|
||||||
for (argi = 1; argi < argc; argi++)
|
for (argi = 1; argi < argc; argi++)
|
||||||
{
|
{
|
||||||
@@ -85,22 +65,23 @@ int main(int argc, char *argv[])
|
|||||||
argi++;
|
argi++;
|
||||||
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
|
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
|
||||||
{
|
{
|
||||||
|
fname_al = argv[argi];
|
||||||
fprintf (stderr, "PNM2PNG\n");
|
fprintf (stderr, "PNM2PNG\n");
|
||||||
fprintf (stderr, "Error: can not create alpha-channel file %s\n",
|
fprintf (stderr, "Error: cannot create alpha-channel file %s\n",
|
||||||
argv[argi]);
|
argv[argi]);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage ();
|
||||||
exit(0);
|
exit (0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "PNG2PNM\n");
|
fprintf (stderr, "PNG2PNM\n");
|
||||||
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
|
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
|
||||||
usage();
|
usage ();
|
||||||
exit(1);
|
exit (1);
|
||||||
break;
|
break;
|
||||||
} /* end switch */
|
} /* end switch */
|
||||||
}
|
}
|
||||||
@@ -115,10 +96,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (fp_wr == stdout)
|
else if (fp_wr == stdout)
|
||||||
{
|
{
|
||||||
|
fname_wr = argv[argi];
|
||||||
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
|
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNG2PNM\n");
|
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);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,30 +108,21 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
fprintf (stderr, "PNG2PNM\n");
|
fprintf (stderr, "PNG2PNM\n");
|
||||||
fprintf (stderr, "Error: too many parameters\n");
|
fprintf (stderr, "Error: too many parameters\n");
|
||||||
usage();
|
usage ();
|
||||||
exit(1);
|
exit (1);
|
||||||
}
|
}
|
||||||
} /* end for */
|
} /* end for */
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||||
/* set stdin/stdout if required to binary */
|
/* set stdin/stdout if required to binary */
|
||||||
if (fp_rd == stdin)
|
if (fp_rd == stdin)
|
||||||
{
|
setmode (fileno (stdin), O_BINARY);
|
||||||
setmode (STDIN, O_BINARY);
|
|
||||||
}
|
|
||||||
if ((raw) && (fp_wr == stdout))
|
if ((raw) && (fp_wr == stdout))
|
||||||
{
|
setmode (fileno (stdout), O_BINARY);
|
||||||
setmode (STDOUT, O_BINARY);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* call the conversion program itself */
|
/* call the conversion program itself */
|
||||||
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
|
ret = png2pnm (fp_rd, fp_wr, fp_al, raw, alpha);
|
||||||
{
|
|
||||||
fprintf (stderr, "PNG2PNM\n");
|
|
||||||
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* close input file */
|
/* close input file */
|
||||||
fclose (fp_rd);
|
fclose (fp_rd);
|
||||||
@@ -159,6 +132,17 @@ int main(int argc, char *argv[])
|
|||||||
if (alpha)
|
if (alpha)
|
||||||
fclose (fp_al);
|
fclose (fp_al);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "PNG2PNM\n");
|
||||||
|
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
|
||||||
|
if (fname_wr)
|
||||||
|
remove (fname_wr); /* no broken output file shall remain behind */
|
||||||
|
if (fname_al)
|
||||||
|
remove (fname_al); /* ditto */
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,15 +150,10 @@ int main(int argc, char *argv[])
|
|||||||
* usage
|
* usage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void usage()
|
void usage ()
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNG2PNM\n");
|
fprintf (stderr, "PNG2PNM\n");
|
||||||
fprintf (stderr, " by Willem van Schaik, 1999\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, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
|
||||||
fprintf (stderr, " or: ... | png2pnm [options]\n");
|
fprintf (stderr, " or: ... | png2pnm [options]\n");
|
||||||
fprintf (stderr, "Options:\n");
|
fprintf (stderr, "Options:\n");
|
||||||
@@ -191,37 +170,13 @@ void usage()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
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_struct *png_ptr;
|
||||||
png_info *info_ptr = NULL;
|
png_info *info_ptr;
|
||||||
png_byte buf[8];
|
BOOL ret;
|
||||||
png_byte *png_pixels = NULL;
|
|
||||||
png_byte **row_pointers = NULL;
|
|
||||||
png_byte *pix_ptr = NULL;
|
|
||||||
png_uint_32 row_bytes;
|
|
||||||
|
|
||||||
png_uint_32 width;
|
/* initialize the libpng context for reading from png_file */
|
||||||
png_uint_32 height;
|
|
||||||
int bit_depth;
|
|
||||||
int channels;
|
|
||||||
int color_type;
|
|
||||||
int alpha_present;
|
|
||||||
int row, col;
|
|
||||||
int ret;
|
|
||||||
int i;
|
|
||||||
long dep_16;
|
|
||||||
|
|
||||||
/* read and check signature in PNG file */
|
|
||||||
ret = fread (buf, 1, 8, png_file);
|
|
||||||
if (ret != 8)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
ret = png_sig_cmp (buf, 0, 8);
|
|
||||||
if (ret)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* create png and info structures */
|
|
||||||
|
|
||||||
png_ptr = png_create_read_struct (png_get_libpng_ver(NULL),
|
png_ptr = png_create_read_struct (png_get_libpng_ver(NULL),
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
@@ -235,36 +190,51 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
|||||||
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);
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
return FALSE;
|
return FALSE; /* generic libpng error */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up the input control for C streams */
|
|
||||||
png_init_io (png_ptr, png_file);
|
png_init_io (png_ptr, png_file);
|
||||||
png_set_sig_bytes (png_ptr, 8); /* we already read the 8 signature bytes */
|
|
||||||
|
|
||||||
/* read the file information */
|
/* do the actual conversion */
|
||||||
png_read_info (png_ptr, info_ptr);
|
ret = do_png2pnm (png_ptr, info_ptr, pnm_file, alpha_file, raw, alpha);
|
||||||
|
|
||||||
/* get size and bit-depth of the PNG-image */
|
/* clean up the libpng structures and their internally-managed data */
|
||||||
png_get_IHDR (png_ptr, info_ptr,
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
&width, &height, &bit_depth, &color_type,
|
|
||||||
NULL, NULL, NULL);
|
|
||||||
|
|
||||||
/* set-up the transformations */
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* transform paletted images into full-color rgb */
|
/*
|
||||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
* do_png2pnm - does the conversion in a fully-initialized libpng context
|
||||||
png_set_expand (png_ptr);
|
*/
|
||||||
/* expand images to bit-depth 8 (only applicable for grayscale images) */
|
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
BOOL do_png2pnm (png_struct *png_ptr, png_info *info_ptr,
|
||||||
png_set_expand (png_ptr);
|
FILE *pnm_file, FILE *alpha_file,
|
||||||
/* transform transparency maps into full alpha-channel */
|
BOOL raw, BOOL alpha)
|
||||||
if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
|
{
|
||||||
|
png_byte **row_pointers;
|
||||||
|
png_byte *pix_ptr;
|
||||||
|
png_uint_32 width;
|
||||||
|
png_uint_32 height;
|
||||||
|
int bit_depth;
|
||||||
|
int channels;
|
||||||
|
int color_type;
|
||||||
|
int alpha_present;
|
||||||
|
png_uint_32 row, col, i;
|
||||||
|
long dep_16;
|
||||||
|
|
||||||
|
/* set up the image transformations that are necessary for the PNM format */
|
||||||
|
|
||||||
|
/* set up (if applicable) the expansion of paletted images to full-color rgb,
|
||||||
|
* and the expansion of transparency maps to full alpha-channel */
|
||||||
png_set_expand (png_ptr);
|
png_set_expand (png_ptr);
|
||||||
|
|
||||||
|
/* set up (if applicable) the expansion of grayscale images to bit-depth 8 */
|
||||||
|
png_set_expand_gray_1_2_4_to_8 (png_ptr);
|
||||||
|
|
||||||
#ifdef NJET
|
#ifdef NJET
|
||||||
/* downgrade 16-bit images to 8-bit */
|
/* downgrade 16-bit images to 8-bit */
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
@@ -273,30 +243,22 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
|||||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
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);
|
png_set_gray_to_rgb (png_ptr);
|
||||||
/* only if file has a file gamma, we do a correction */
|
/* if the PNG image has a gAMA chunk then gamma-correct the output image */
|
||||||
|
{
|
||||||
|
double file_gamma;
|
||||||
if (png_get_gAMA (png_ptr, info_ptr, &file_gamma))
|
if (png_get_gAMA (png_ptr, info_ptr, &file_gamma))
|
||||||
png_set_gamma (png_ptr, (double) 2.2, file_gamma);
|
png_set_gamma (png_ptr, (double) 2.2, file_gamma);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* all transformations have been registered; now update info_ptr data,
|
/* read the image file, with all of the above image transforms applied */
|
||||||
* get rowbytes and channels, and allocate image memory */
|
png_read_png (png_ptr, info_ptr, 0, NULL);
|
||||||
|
|
||||||
png_read_update_info (png_ptr, info_ptr);
|
/* get the image size, bit-depth and color-type */
|
||||||
|
|
||||||
/* get the new color-type and bit-depth (after expansion/stripping) */
|
|
||||||
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
/* check for 16-bit files */
|
/* calculate the number of channels and store alpha-presence */
|
||||||
if (bit_depth == 16)
|
|
||||||
{
|
|
||||||
raw = FALSE;
|
|
||||||
#ifdef __TURBOC__
|
|
||||||
pnm_file->flags &= ~((unsigned) _F_BIN);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* calculate new number of channels and store alpha-presence */
|
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY)
|
if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||||
channels = 1;
|
channels = 1;
|
||||||
else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
@@ -313,40 +275,12 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
|||||||
if (alpha && !alpha_present)
|
if (alpha && !alpha_present)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNG2PNM\n");
|
fprintf (stderr, "PNG2PNM\n");
|
||||||
fprintf (stderr, "Error: PNG-file doesn't contain alpha channel\n");
|
fprintf (stderr, "Warning: no alpha channel in PNG file\n");
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
|
||||||
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
|
|
||||||
|
|
||||||
if ((png_pixels = (png_byte *)
|
|
||||||
malloc (row_bytes * height * sizeof (png_byte))) == NULL) {
|
|
||||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((row_pointers = (png_byte **)
|
/* get address of internally-allocated image data */
|
||||||
malloc (height * sizeof (png_bytep))) == NULL)
|
row_pointers = png_get_rows (png_ptr, info_ptr);
|
||||||
{
|
|
||||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
|
||||||
free (png_pixels);
|
|
||||||
png_pixels = NULL;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set the individual row_pointers to point at the correct offsets */
|
|
||||||
for (i = 0; i < ((int) height); i++)
|
|
||||||
row_pointers[i] = png_pixels + i * row_bytes;
|
|
||||||
|
|
||||||
/* now we can go ahead and just read the whole image */
|
|
||||||
png_read_image (png_ptr, row_pointers);
|
|
||||||
|
|
||||||
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
|
|
||||||
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);
|
|
||||||
|
|
||||||
/* write header of PNM file */
|
/* write header of PNM file */
|
||||||
|
|
||||||
@@ -377,45 +311,67 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* write data to PNM file */
|
/* write data to PNM file */
|
||||||
pix_ptr = png_pixels;
|
|
||||||
|
|
||||||
for (row = 0; row < (int) height; row++)
|
for (row = 0; row < height; row++)
|
||||||
{
|
{
|
||||||
for (col = 0; col < (int) width; col++)
|
pix_ptr = row_pointers[row];
|
||||||
|
for (col = 0; col < width; col++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (channels - alpha_present); i++)
|
for (i = 0; i < (png_uint_32) (channels - alpha_present); i++)
|
||||||
{
|
{
|
||||||
if (raw)
|
if (raw)
|
||||||
fputc ((int) *pix_ptr++ , pnm_file);
|
{
|
||||||
else
|
fputc ((int) *pix_ptr++, pnm_file);
|
||||||
if (bit_depth == 16){
|
if (bit_depth == 16)
|
||||||
dep_16 = (long) *pix_ptr++;
|
fputc ((int) *pix_ptr++, pnm_file);
|
||||||
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (bit_depth == 16)
|
||||||
|
{
|
||||||
|
dep_16 = ((long) *pix_ptr++) << 8;
|
||||||
|
dep_16 += ((long) *pix_ptr++);
|
||||||
|
fprintf (pnm_file, "%ld ", dep_16);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fprintf (pnm_file, "%ld ", (long) *pix_ptr++);
|
fprintf (pnm_file, "%ld ", (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (alpha_present)
|
if (alpha_present)
|
||||||
{
|
{
|
||||||
if (!alpha)
|
if (!alpha)
|
||||||
{
|
{
|
||||||
pix_ptr++; /* alpha */
|
/* skip the alpha-channel */
|
||||||
|
pix_ptr++;
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
pix_ptr++;
|
pix_ptr++;
|
||||||
}
|
}
|
||||||
else /* output alpha-channel as pgm file */
|
|
||||||
{
|
|
||||||
if (raw)
|
|
||||||
fputc ((int) *pix_ptr++ , alpha_file);
|
|
||||||
else
|
else
|
||||||
if (bit_depth == 16){
|
{
|
||||||
dep_16 = (long) *pix_ptr++;
|
/* output the alpha-channel as pgm file */
|
||||||
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
if (raw)
|
||||||
|
{
|
||||||
|
fputc ((int) *pix_ptr++, alpha_file);
|
||||||
|
if (bit_depth == 16)
|
||||||
|
fputc ((int) *pix_ptr++, alpha_file);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (bit_depth == 16)
|
||||||
|
{
|
||||||
|
dep_16 = ((long) *pix_ptr++) << 8;
|
||||||
|
dep_16 += ((long) *pix_ptr++);
|
||||||
|
fprintf (alpha_file, "%ld ", dep_16);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
} /* if alpha_present */
|
}
|
||||||
|
}
|
||||||
|
} /* end if alpha_present */
|
||||||
|
|
||||||
if (!raw)
|
if (!raw)
|
||||||
if (col % 4 == 3)
|
if (col % 4 == 3)
|
||||||
@@ -427,12 +383,5 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
|||||||
fprintf (pnm_file, "\n");
|
fprintf (pnm_file, "\n");
|
||||||
} /* end for row */
|
} /* end for row */
|
||||||
|
|
||||||
if (row_pointers != (unsigned char**) NULL)
|
|
||||||
free (row_pointers);
|
|
||||||
if (png_pixels != (unsigned char*) NULL)
|
|
||||||
free (png_pixels);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} /* end of source */
|
} /* end of source */
|
||||||
|
|
||||||
|
|||||||
@@ -1,74 +1,57 @@
|
|||||||
/*
|
/*
|
||||||
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
|
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
|
||||||
* copyright (C) 1999 by Willem van Schaik <willem at schaik.com>
|
* copyright (C) 1999-2019 by Willem van Schaik <willem at schaik dot com>
|
||||||
*
|
*
|
||||||
* version 1.0 - 1999.10.15 - First version.
|
* This software is released under the MIT license. For conditions of
|
||||||
* version 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
|
* distribution and use, see the LICENSE file part of this package.
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef __TURBOC__
|
|
||||||
#include <mem.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
#ifndef BOOL
|
#ifndef BOOL
|
||||||
#define BOOL unsigned char
|
#define BOOL unsigned char
|
||||||
#endif
|
#endif
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE (BOOL) 1
|
#define TRUE ((BOOL) 1)
|
||||||
#endif
|
#endif
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
#define FALSE (BOOL) 0
|
#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) */
|
|
||||||
#ifndef PNG_DEBUG
|
|
||||||
#define PNG_DEBUG 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "png.h"
|
#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 */
|
/* function prototypes */
|
||||||
|
|
||||||
int main (int argc, char *argv[]);
|
int main (int argc, char *argv[]);
|
||||||
void usage ();
|
void usage ();
|
||||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
|
||||||
BOOL alpha);
|
BOOL interlace, BOOL alpha);
|
||||||
void get_token(FILE *pnm_file, char *token);
|
BOOL do_pnm2png (png_struct *png_ptr, png_info *info_ptr,
|
||||||
png_uint_32 get_data (FILE *pnm_file, int depth);
|
FILE *pnm_file, FILE *alpha_file,
|
||||||
png_uint_32 get_value (FILE *pnm_file, int depth);
|
BOOL interlace, BOOL alpha);
|
||||||
|
int fscan_pnm_magic (FILE *pnm_file, char *magic_buf, size_t magic_buf_size);
|
||||||
|
int fscan_pnm_token (FILE *pnm_file, char *token_buf, size_t token_buf_size);
|
||||||
|
int fscan_pnm_uint_32 (FILE *pnm_file, png_uint_32 *num_ptr);
|
||||||
|
png_uint_32 get_pnm_data (FILE *pnm_file, int depth);
|
||||||
|
png_uint_32 get_pnm_value (FILE *pnm_file, int depth);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main
|
* main
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FILE *fp_rd = stdin;
|
FILE *fp_rd = stdin;
|
||||||
FILE *fp_al = NULL;
|
FILE *fp_al = NULL;
|
||||||
FILE *fp_wr = stdout;
|
FILE *fp_wr = stdout;
|
||||||
|
const char *fname_wr = NULL;
|
||||||
BOOL interlace = FALSE;
|
BOOL interlace = FALSE;
|
||||||
BOOL alpha = FALSE;
|
BOOL alpha = FALSE;
|
||||||
int argi;
|
int argi;
|
||||||
|
int ret;
|
||||||
|
|
||||||
for (argi = 1; argi < argc; argi++)
|
for (argi = 1; argi < argc; argi++)
|
||||||
{
|
{
|
||||||
@@ -92,14 +75,14 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage ();
|
||||||
exit(0);
|
exit (0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "PNM2PNG\n");
|
fprintf (stderr, "PNM2PNG\n");
|
||||||
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
|
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
|
||||||
usage();
|
usage ();
|
||||||
exit(1);
|
exit (1);
|
||||||
break;
|
break;
|
||||||
} /* end switch */
|
} /* end switch */
|
||||||
}
|
}
|
||||||
@@ -114,10 +97,11 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else if (fp_wr == stdout)
|
else if (fp_wr == stdout)
|
||||||
{
|
{
|
||||||
|
fname_wr = argv[argi];
|
||||||
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
|
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNM2PNG\n");
|
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);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,30 +109,23 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
fprintf (stderr, "PNM2PNG\n");
|
fprintf (stderr, "PNM2PNG\n");
|
||||||
fprintf (stderr, "Error: too many parameters\n");
|
fprintf (stderr, "Error: too many parameters\n");
|
||||||
usage();
|
usage ();
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
} /* end for */
|
} /* end for */
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||||
/* set stdin/stdout to binary, we're reading the PNM always! in binary format */
|
/* set stdin/stdout to binary,
|
||||||
|
* we're reading the PNM always! in binary format
|
||||||
|
*/
|
||||||
if (fp_rd == stdin)
|
if (fp_rd == stdin)
|
||||||
{
|
setmode (fileno (stdin), O_BINARY);
|
||||||
setmode (STDIN, O_BINARY);
|
|
||||||
}
|
|
||||||
if (fp_wr == stdout)
|
if (fp_wr == stdout)
|
||||||
{
|
setmode (fileno (stdout), O_BINARY);
|
||||||
setmode (STDOUT, O_BINARY);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* call the conversion program itself */
|
/* call the conversion program itself */
|
||||||
if (pnm2png (fp_rd, fp_wr, fp_al, interlace, alpha) == FALSE)
|
ret = pnm2png (fp_rd, fp_wr, fp_al, interlace, alpha);
|
||||||
{
|
|
||||||
fprintf (stderr, "PNM2PNG\n");
|
|
||||||
fprintf (stderr, "Error: unsuccessful converting to PNG-image\n");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* close input file */
|
/* close input file */
|
||||||
fclose (fp_rd);
|
fclose (fp_rd);
|
||||||
@@ -158,6 +135,15 @@ int main(int argc, char *argv[])
|
|||||||
if (alpha)
|
if (alpha)
|
||||||
fclose (fp_al);
|
fclose (fp_al);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "PNM2PNG\n");
|
||||||
|
fprintf (stderr, "Error: unsuccessful converting to PNG-image\n");
|
||||||
|
if (fname_wr)
|
||||||
|
remove (fname_wr); /* no broken output file shall remain behind */
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,15 +151,10 @@ int main(int argc, char *argv[])
|
|||||||
* usage
|
* usage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void usage()
|
void usage ()
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNM2PNG\n");
|
fprintf (stderr, "PNM2PNG\n");
|
||||||
fprintf (stderr, " by Willem van Schaik, 1999\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, "Usage: pnm2png [options] <file>.<pnm> [<file>.png]\n");
|
||||||
fprintf (stderr, " or: ... | pnm2png [options]\n");
|
fprintf (stderr, " or: ... | pnm2png [options]\n");
|
||||||
fprintf (stderr, "Options:\n");
|
fprintf (stderr, "Options:\n");
|
||||||
@@ -187,103 +168,120 @@ void usage()
|
|||||||
* pnm2png
|
* pnm2png
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
|
||||||
BOOL alpha)
|
BOOL interlace, BOOL alpha)
|
||||||
{
|
{
|
||||||
png_struct *png_ptr = NULL;
|
png_struct *png_ptr;
|
||||||
png_info *info_ptr = NULL;
|
png_info *info_ptr;
|
||||||
png_byte *png_pixels = NULL;
|
BOOL ret;
|
||||||
png_byte **row_pointers = NULL;
|
|
||||||
png_byte *pix_ptr = NULL;
|
|
||||||
volatile png_uint_32 row_bytes;
|
|
||||||
|
|
||||||
char type_token[16];
|
/* initialize the libpng context for writing to png_file */
|
||||||
char width_token[16];
|
|
||||||
char height_token[16];
|
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL),
|
||||||
char maxval_token[16];
|
NULL, NULL, NULL);
|
||||||
volatile int color_type=1;
|
if (!png_ptr)
|
||||||
unsigned long ul_width=0, ul_alpha_width=0;
|
return FALSE; /* out of memory */
|
||||||
unsigned long ul_height=0, ul_alpha_height=0;
|
|
||||||
unsigned long ul_maxval=0;
|
info_ptr = png_create_info_struct (png_ptr);
|
||||||
volatile png_uint_32 width=0, height=0;
|
if (!info_ptr)
|
||||||
volatile png_uint_32 alpha_width=0, alpha_height=0;
|
{
|
||||||
png_uint_32 maxval;
|
png_destroy_write_struct (&png_ptr, NULL);
|
||||||
volatile int bit_depth = 0;
|
return FALSE; /* out of memory */
|
||||||
int channels=0;
|
}
|
||||||
int alpha_depth = 0;
|
|
||||||
int alpha_present=0;
|
if (setjmp (png_jmpbuf (png_ptr)))
|
||||||
int row, col;
|
{
|
||||||
BOOL raw, alpha_raw = FALSE;
|
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
return FALSE; /* generic libpng error */
|
||||||
|
}
|
||||||
|
|
||||||
|
png_init_io (png_ptr, png_file);
|
||||||
|
|
||||||
|
/* do the actual conversion */
|
||||||
|
ret = do_pnm2png (png_ptr, info_ptr, pnm_file, alpha_file, interlace, alpha);
|
||||||
|
|
||||||
|
/* clean up the libpng structures and their internally-managed data */
|
||||||
|
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* do_pnm2png - does the conversion in a fully-initialized libpng context
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOL do_pnm2png (png_struct *png_ptr, png_info *info_ptr,
|
||||||
|
FILE *pnm_file, FILE *alpha_file,
|
||||||
|
BOOL interlace, BOOL alpha)
|
||||||
|
{
|
||||||
|
png_byte **row_pointers;
|
||||||
|
png_byte *pix_ptr;
|
||||||
|
int bit_depth;
|
||||||
|
int color_type;
|
||||||
|
int channels;
|
||||||
|
char magic_token[4];
|
||||||
|
BOOL raw;
|
||||||
|
png_uint_32 width, height, maxval;
|
||||||
|
png_uint_32 row_bytes;
|
||||||
|
png_uint_32 row, col;
|
||||||
|
png_uint_32 val16, i;
|
||||||
|
png_uint_32 alpha_width = 0, alpha_height = 0;
|
||||||
|
int alpha_depth = 0, alpha_present = 0;
|
||||||
|
BOOL alpha_raw = FALSE;
|
||||||
BOOL packed_bitmap = FALSE;
|
BOOL packed_bitmap = FALSE;
|
||||||
#endif
|
|
||||||
png_uint_32 tmp16;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* read header of PNM file */
|
/* read header of PNM file */
|
||||||
|
|
||||||
get_token(pnm_file, type_token);
|
if (fscan_pnm_magic (pnm_file, magic_token, sizeof (magic_token)) != 1)
|
||||||
if (type_token[0] != 'P')
|
return FALSE; /* not a PNM file */
|
||||||
|
|
||||||
|
if ((magic_token[1] == '1') || (magic_token[1] == '4'))
|
||||||
{
|
{
|
||||||
|
if ((fscan_pnm_uint_32 (pnm_file, &width) != 1) ||
|
||||||
|
(fscan_pnm_uint_32 (pnm_file, &height) != 1))
|
||||||
|
return FALSE; /* bad PBM file header */
|
||||||
|
} else if ((magic_token[1] == '2') || (magic_token[1] == '5') ||
|
||||||
|
(magic_token[1] == '3') || (magic_token[1] == '6'))
|
||||||
|
{
|
||||||
|
if ((fscan_pnm_uint_32 (pnm_file, &width) != 1) ||
|
||||||
|
(fscan_pnm_uint_32 (pnm_file, &height) != 1) ||
|
||||||
|
(fscan_pnm_uint_32 (pnm_file, &maxval) != 1))
|
||||||
|
return FALSE; /* bad PGM/PPM file header */
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((magic_token[1] == '1') || (magic_token[1] == '4'))
|
||||||
|
{
|
||||||
|
raw = (magic_token[1] == '4');
|
||||||
|
bit_depth = 1;
|
||||||
|
color_type = PNG_COLOR_TYPE_GRAY;
|
||||||
|
packed_bitmap = TRUE;
|
||||||
|
}
|
||||||
|
else if ((magic_token[1] == '2') || (magic_token[1] == '5'))
|
||||||
|
{
|
||||||
|
raw = (magic_token[1] == '5');
|
||||||
|
color_type = PNG_COLOR_TYPE_GRAY;
|
||||||
|
if (maxval == 0)
|
||||||
|
return FALSE;
|
||||||
|
else if (maxval == 1)
|
||||||
|
bit_depth = 1;
|
||||||
|
else if (maxval <= 3)
|
||||||
|
bit_depth = 2;
|
||||||
|
else if (maxval <= 15)
|
||||||
|
bit_depth = 4;
|
||||||
|
else if (maxval <= 255)
|
||||||
|
bit_depth = 8;
|
||||||
|
else if (maxval <= 65535U)
|
||||||
|
bit_depth = 16;
|
||||||
|
else /* maxval > 65535U */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else if ((type_token[1] == '1') || (type_token[1] == '4'))
|
else if ((magic_token[1] == '3') || (magic_token[1] == '6'))
|
||||||
{
|
{
|
||||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
raw = (magic_token[1] == '6');
|
||||||
raw = (type_token[1] == '4');
|
|
||||||
color_type = PNG_COLOR_TYPE_GRAY;
|
|
||||||
get_token(pnm_file, width_token);
|
|
||||||
sscanf (width_token, "%lu", &ul_width);
|
|
||||||
width = (png_uint_32) ul_width;
|
|
||||||
get_token(pnm_file, 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, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
|
|
||||||
#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);
|
|
||||||
sscanf (width_token, "%lu", &ul_width);
|
|
||||||
width = (png_uint_32) ul_width;
|
|
||||||
get_token(pnm_file, height_token);
|
|
||||||
sscanf (height_token, "%lu", &ul_height);
|
|
||||||
height = (png_uint_32) ul_height;
|
|
||||||
get_token(pnm_file, maxval_token);
|
|
||||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
|
||||||
maxval = (png_uint_32) ul_maxval;
|
|
||||||
|
|
||||||
if (maxval <= 1)
|
|
||||||
bit_depth = 1;
|
|
||||||
else if (maxval <= 3)
|
|
||||||
bit_depth = 2;
|
|
||||||
else if (maxval <= 15)
|
|
||||||
bit_depth = 4;
|
|
||||||
else if (maxval <= 255)
|
|
||||||
bit_depth = 8;
|
|
||||||
else /* if (maxval <= 65535) */
|
|
||||||
bit_depth = 16;
|
|
||||||
}
|
|
||||||
else if ((type_token[1] == '3') || (type_token[1] == '6'))
|
|
||||||
{
|
|
||||||
raw = (type_token[1] == '6');
|
|
||||||
color_type = PNG_COLOR_TYPE_RGB;
|
color_type = PNG_COLOR_TYPE_RGB;
|
||||||
get_token(pnm_file, width_token);
|
if (maxval == 0)
|
||||||
sscanf (width_token, "%lu", &ul_width);
|
return FALSE;
|
||||||
width = (png_uint_32) ul_width;
|
else if (maxval == 1)
|
||||||
get_token(pnm_file, height_token);
|
|
||||||
sscanf (height_token, "%lu", &ul_height);
|
|
||||||
height = (png_uint_32) ul_height;
|
|
||||||
get_token(pnm_file, maxval_token);
|
|
||||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
|
||||||
maxval = (png_uint_32) ul_maxval;
|
|
||||||
if (maxval <= 1)
|
|
||||||
bit_depth = 1;
|
bit_depth = 1;
|
||||||
else if (maxval <= 3)
|
else if (maxval <= 3)
|
||||||
bit_depth = 2;
|
bit_depth = 2;
|
||||||
@@ -291,8 +289,15 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
bit_depth = 4;
|
bit_depth = 4;
|
||||||
else if (maxval <= 255)
|
else if (maxval <= 255)
|
||||||
bit_depth = 8;
|
bit_depth = 8;
|
||||||
else /* if (maxval <= 65535) */
|
else if (maxval <= 65535U)
|
||||||
bit_depth = 16;
|
bit_depth = 16;
|
||||||
|
else /* maxval > 65535U */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else if (magic_token[1] == '7')
|
||||||
|
{
|
||||||
|
fprintf (stderr, "PNM2PNG can't read PAM (P7) files\n");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -303,33 +308,23 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
|
|
||||||
if (alpha)
|
if (alpha)
|
||||||
{
|
{
|
||||||
if (color_type == PNG_COLOR_TYPE_GRAY)
|
if ((fscan_pnm_magic (alpha_file, magic_token, sizeof (magic_token)) != 1)
|
||||||
color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
|
|| ((magic_token[1] != '2') && (magic_token[1] != '5')))
|
||||||
if (color_type == PNG_COLOR_TYPE_RGB)
|
return FALSE; /* not a PGM file */
|
||||||
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
|
||||||
|
|
||||||
get_token(alpha_file, type_token);
|
if ((fscan_pnm_uint_32 (alpha_file, &alpha_width) != 1) ||
|
||||||
if (type_token[0] != 'P')
|
(fscan_pnm_uint_32 (alpha_file, &alpha_height) != 1) ||
|
||||||
{
|
(fscan_pnm_uint_32 (alpha_file, &maxval) != 1))
|
||||||
|
return FALSE; /* bad PGM file header */
|
||||||
|
|
||||||
|
if ((alpha_width != width) || (alpha_height != height))
|
||||||
|
return FALSE; /* mismatched PGM dimensions */
|
||||||
|
|
||||||
|
alpha_raw = (magic_token[1] == '5');
|
||||||
|
color_type |= PNG_COLOR_MASK_ALPHA;
|
||||||
|
if (maxval == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
else if (maxval == 1)
|
||||||
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
|
||||||
{
|
|
||||||
alpha_raw = (type_token[1] == '5');
|
|
||||||
get_token(alpha_file, width_token);
|
|
||||||
sscanf (width_token, "%lu", &ul_alpha_width);
|
|
||||||
alpha_width=(png_uint_32) ul_alpha_width;
|
|
||||||
if (alpha_width != width)
|
|
||||||
return FALSE;
|
|
||||||
get_token(alpha_file, 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);
|
|
||||||
sscanf (maxval_token, "%lu", &ul_maxval);
|
|
||||||
maxval = (png_uint_32) ul_maxval;
|
|
||||||
if (maxval <= 1)
|
|
||||||
alpha_depth = 1;
|
alpha_depth = 1;
|
||||||
else if (maxval <= 3)
|
else if (maxval <= 3)
|
||||||
alpha_depth = 2;
|
alpha_depth = 2;
|
||||||
@@ -337,15 +332,12 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
alpha_depth = 4;
|
alpha_depth = 4;
|
||||||
else if (maxval <= 255)
|
else if (maxval <= 255)
|
||||||
alpha_depth = 8;
|
alpha_depth = 8;
|
||||||
else /* if (maxval <= 65535) */
|
else if (maxval <= 65535U)
|
||||||
alpha_depth = 16;
|
alpha_depth = 16;
|
||||||
|
else /* maxval > 65535U */
|
||||||
|
return FALSE;
|
||||||
if (alpha_depth != bit_depth)
|
if (alpha_depth != bit_depth)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
} /* end if alpha */
|
} /* end if alpha */
|
||||||
|
|
||||||
/* calculate the number of channels and store alpha-presence */
|
/* calculate the number of channels and store alpha-presence */
|
||||||
@@ -357,210 +349,259 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
channels = 3;
|
channels = 3;
|
||||||
else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
channels = 4;
|
channels = 4;
|
||||||
#if 0
|
|
||||||
else
|
else
|
||||||
channels = 0; /* cannot happen */
|
return FALSE; /* NOTREACHED */
|
||||||
#endif
|
|
||||||
|
|
||||||
alpha_present = (channels - 1) % 2;
|
alpha_present = (channels - 1) % 2;
|
||||||
|
|
||||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
|
||||||
if (packed_bitmap)
|
if (packed_bitmap)
|
||||||
|
{
|
||||||
/* row data is as many bytes as can fit width x channels x bit_depth */
|
/* row data is as many bytes as can fit width x channels x bit_depth */
|
||||||
row_bytes = (width * channels * bit_depth + 7) / 8;
|
row_bytes = (width * channels * bit_depth + 7) / 8;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
#endif
|
{
|
||||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||||
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
||||||
|
}
|
||||||
|
|
||||||
if ((png_pixels = (png_byte *)
|
if ((row_bytes == 0) ||
|
||||||
malloc (row_bytes * height * sizeof (png_byte))) == NULL)
|
((size_t) height > (size_t) (-1) / (size_t) row_bytes))
|
||||||
|
{
|
||||||
|
/* too big */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* read data from PNM file */
|
/* allocate the rows using the same memory layout as libpng, and transfer
|
||||||
pix_ptr = png_pixels;
|
* their ownership to libpng, with the responsibility to clean everything up;
|
||||||
|
* please note the use of png_calloc instead of png_malloc */
|
||||||
for (row = 0; row < (int) height; row++)
|
row_pointers = (png_byte **)
|
||||||
|
png_calloc (png_ptr, height * sizeof (png_byte *));
|
||||||
|
png_set_rows (png_ptr, info_ptr, row_pointers);
|
||||||
|
png_data_freer (png_ptr, info_ptr, PNG_DESTROY_WILL_FREE_DATA, PNG_FREE_ALL);
|
||||||
|
for (row = 0; row < height; row++)
|
||||||
|
{
|
||||||
|
/* the individual rows should only be allocated after all the previous
|
||||||
|
* steps completed successfully, because libpng must handle correctly
|
||||||
|
* any image allocation left incomplete after an out-of-memory error */
|
||||||
|
row_pointers[row] = (png_byte *) png_malloc (png_ptr, row_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* read the data from PNM file */
|
||||||
|
|
||||||
|
for (row = 0; row < height; row++)
|
||||||
|
{
|
||||||
|
pix_ptr = row_pointers[row];
|
||||||
|
if (packed_bitmap)
|
||||||
|
{
|
||||||
|
for (i = 0; i < row_bytes; i++)
|
||||||
{
|
{
|
||||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
|
||||||
if (packed_bitmap) {
|
|
||||||
for (i = 0; i < (int) row_bytes; i++)
|
|
||||||
/* png supports this format natively so no conversion is needed */
|
/* png supports this format natively so no conversion is needed */
|
||||||
*pix_ptr++ = get_data (pnm_file, 8);
|
*pix_ptr++ = get_pnm_data (pnm_file, 8);
|
||||||
} else
|
}
|
||||||
#endif
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
for (col = 0; col < (int) width; col++)
|
for (col = 0; col < width; col++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (channels - alpha_present); i++)
|
for (i = 0; i < (png_uint_32) (channels - alpha_present); i++)
|
||||||
{
|
{
|
||||||
if (raw)
|
if (raw)
|
||||||
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
{
|
||||||
else
|
*pix_ptr++ = get_pnm_data (pnm_file, bit_depth);
|
||||||
if (bit_depth <= 8)
|
if (bit_depth == 16)
|
||||||
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
*pix_ptr++ = get_pnm_data (pnm_file, bit_depth);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp16 = get_value (pnm_file, bit_depth);
|
if (bit_depth <= 8)
|
||||||
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
|
{
|
||||||
|
*pix_ptr++ = get_pnm_value (pnm_file, bit_depth);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
val16 = get_pnm_value (pnm_file, bit_depth);
|
||||||
|
*pix_ptr = (png_byte) ((val16 >> 8) & 0xFF);
|
||||||
pix_ptr++;
|
pix_ptr++;
|
||||||
*pix_ptr = (png_byte) (tmp16 & 0xFF);
|
*pix_ptr = (png_byte) (val16 & 0xFF);
|
||||||
pix_ptr++;
|
pix_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (alpha) /* read alpha-channel from pgm file */
|
if (alpha) /* read alpha-channel from pgm file */
|
||||||
{
|
{
|
||||||
if (alpha_raw)
|
if (alpha_raw)
|
||||||
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
{
|
||||||
else
|
*pix_ptr++ = get_pnm_data (alpha_file, alpha_depth);
|
||||||
if (alpha_depth <= 8)
|
if (alpha_depth == 16)
|
||||||
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
*pix_ptr++ = get_pnm_data (alpha_file, alpha_depth);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp16 = get_value (alpha_file, bit_depth);
|
if (alpha_depth <= 8)
|
||||||
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
{
|
||||||
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
*pix_ptr++ = get_pnm_value (alpha_file, bit_depth);
|
||||||
}
|
}
|
||||||
} /* if alpha */
|
else
|
||||||
} /* if packed_bitmap */
|
{
|
||||||
|
val16 = get_pnm_value (alpha_file, bit_depth);
|
||||||
|
*pix_ptr++ = (png_byte) ((val16 >> 8) & 0xFF);
|
||||||
|
*pix_ptr++ = (png_byte) (val16 & 0xFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* end if alpha */
|
||||||
|
} /* end if packed_bitmap */
|
||||||
} /* end for col */
|
} /* end for col */
|
||||||
} /* end for row */
|
} /* end for row */
|
||||||
|
|
||||||
/* prepare the standard PNG structures */
|
|
||||||
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);
|
|
||||||
free (png_pixels);
|
|
||||||
png_pixels = NULL;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
|
||||||
if (packed_bitmap == TRUE)
|
|
||||||
{
|
|
||||||
png_set_packing (png_ptr);
|
|
||||||
png_set_invert_mono (png_ptr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* setjmp() must be called in every function that calls a PNG-reading libpng function */
|
|
||||||
if (setjmp (png_jmpbuf(png_ptr)))
|
|
||||||
{
|
|
||||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
|
||||||
free (png_pixels);
|
|
||||||
png_pixels = NULL;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize the png structure */
|
|
||||||
png_init_io (png_ptr, png_file);
|
|
||||||
|
|
||||||
/* we're going to write more or less the same PNG as the input file */
|
/* 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,
|
png_set_IHDR (png_ptr, info_ptr, width, height, bit_depth, color_type,
|
||||||
(!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7,
|
(!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7,
|
||||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
|
if (packed_bitmap == TRUE)
|
||||||
|
{
|
||||||
|
png_set_packing (png_ptr);
|
||||||
|
png_set_invert_mono (png_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
/* write the file header information */
|
/* write the file header information */
|
||||||
png_write_info (png_ptr, info_ptr);
|
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 = (png_byte **)
|
|
||||||
malloc (height * sizeof (png_bytep))) == NULL)
|
|
||||||
{
|
|
||||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
|
||||||
free (png_pixels);
|
|
||||||
png_pixels = NULL;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set the individual row_pointers to point at the correct offsets */
|
|
||||||
for (i = 0; i < (int) height; i++)
|
|
||||||
row_pointers[i] = png_pixels + i * row_bytes;
|
|
||||||
|
|
||||||
/* write out the entire image data in one call */
|
/* write out the entire image data in one call */
|
||||||
png_write_image (png_ptr, row_pointers);
|
png_write_image (png_ptr, row_pointers);
|
||||||
|
|
||||||
/* write the additional chunks to the PNG file (not really needed) */
|
/* write the additional chunks to the PNG file (not really needed) */
|
||||||
png_write_end (png_ptr, info_ptr);
|
png_write_end (png_ptr, info_ptr);
|
||||||
|
|
||||||
/* clean up after the write, and free any memory allocated */
|
|
||||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
|
||||||
|
|
||||||
if (row_pointers != (unsigned char**) NULL)
|
|
||||||
free (row_pointers);
|
|
||||||
if (png_pixels != (unsigned char*) NULL)
|
|
||||||
free (png_pixels);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} /* end of pnm2png */
|
} /* end of pnm2png */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_token() - gets the first string after whitespace
|
* fscan_pnm_magic - like fscan_pnm_token below, but expects the magic string
|
||||||
|
* to start immediately, without any comment or whitespace,
|
||||||
|
* and to match the regex /^P[1-9]$/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void get_token(FILE *pnm_file, char *token)
|
int fscan_pnm_magic (FILE *pnm_file, char *magic_buf, size_t magic_buf_size)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int ret;
|
||||||
|
|
||||||
|
ret = fgetc (pnm_file);
|
||||||
|
if (ret == EOF) return 0;
|
||||||
|
ungetc (ret, pnm_file);
|
||||||
|
if (ret != 'P') return 0;
|
||||||
|
|
||||||
|
/* the string buffer must be at least four bytes long, i.e., the capacity
|
||||||
|
* required for strings of at least three characters long, i.e., the minimum
|
||||||
|
* required for ensuring that our magic string is exactly two characters long
|
||||||
|
*/
|
||||||
|
if (magic_buf_size < 4) return -1;
|
||||||
|
|
||||||
|
ret = fscan_pnm_token (pnm_file, magic_buf, magic_buf_size);
|
||||||
|
if (ret < 1) return ret;
|
||||||
|
|
||||||
|
if ((magic_buf[1] < '1') || (magic_buf[1] > '9')) return 0;
|
||||||
|
if (magic_buf[2] != '\0') return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* fscan_pnm_token - extracts the first string token after whitespace,
|
||||||
|
* and (like fscanf) returns the number of successful
|
||||||
|
* extractions, which can be either 0 or 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
int fscan_pnm_token (FILE *pnm_file, char *token_buf, size_t token_buf_size)
|
||||||
|
{
|
||||||
|
size_t i = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* remove white-space and comment lines */
|
/* remove white-space and comment lines */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = fgetc(pnm_file);
|
ret = fgetc (pnm_file);
|
||||||
if (ret == '#') {
|
if (ret == '#')
|
||||||
|
{
|
||||||
/* the rest of this line is a comment */
|
/* the rest of this line is a comment */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = fgetc(pnm_file);
|
ret = fgetc (pnm_file);
|
||||||
}
|
}
|
||||||
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
|
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
|
||||||
}
|
}
|
||||||
if (ret == EOF) break;
|
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 */
|
/* read string */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = fgetc(pnm_file);
|
ret = fgetc (pnm_file);
|
||||||
if (ret == EOF) break;
|
if (ret == EOF) break;
|
||||||
i++;
|
if (ret == '0')
|
||||||
token[i] = (unsigned char) ret;
|
{
|
||||||
|
/* avoid storing more than one leading '0' in the token buffer,
|
||||||
|
* to ensure that all valid (in-range) numeric inputs can fit in. */
|
||||||
|
if ((i == 0) && (token_buf[i] == '0')) continue;
|
||||||
}
|
}
|
||||||
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
|
if (++i == token_buf_size - 1) break;
|
||||||
|
token_buf[i] = (char) ret;
|
||||||
|
}
|
||||||
|
while ((ret != '\n') && (ret != '\r') && (ret != ' '));
|
||||||
|
|
||||||
token[i] = '\0';
|
token_buf[i] = '\0';
|
||||||
|
return (i > 0) ? 1 : 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_data() - takes first byte and converts into next pixel value,
|
* fscan_pnm_uint_32 - like fscan_token above, but expects the extracted token
|
||||||
* taking as much bits as defined by bit-depth and
|
* to be numeric, and converts it to an unsigned 32-bit int
|
||||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
png_uint_32 get_data (FILE *pnm_file, int depth)
|
int fscan_pnm_uint_32 (FILE *pnm_file, png_uint_32 *num_ptr)
|
||||||
|
{
|
||||||
|
char token[16];
|
||||||
|
unsigned long token_value;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = fscan_pnm_token (pnm_file, token, sizeof (token));
|
||||||
|
if (ret < 1) return ret;
|
||||||
|
|
||||||
|
if ((token[0] < '0') && (token[0] > '9'))
|
||||||
|
return 0; /* the token starts with junk, or a +/- sign, which is invalid */
|
||||||
|
|
||||||
|
ret = sscanf (token, "%lu%*c", &token_value);
|
||||||
|
if (ret != 1)
|
||||||
|
return 0; /* the token ends with junk */
|
||||||
|
|
||||||
|
*num_ptr = (png_uint_32) token_value;
|
||||||
|
|
||||||
|
#if ULONG_MAX > 0xFFFFFFFFUL
|
||||||
|
/* saturate the converted number, following the fscanf convention */
|
||||||
|
if (token_value > 0xFFFFFFFFUL)
|
||||||
|
*num_ptr = 0xFFFFFFFFUL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get_pnm_data - takes first byte and converts into next pixel value,
|
||||||
|
* taking as many bits as defined by bit-depth and
|
||||||
|
* using the bit-depth to fill up a byte (0x0A -> 0xAA)
|
||||||
|
*/
|
||||||
|
|
||||||
|
png_uint_32 get_pnm_data (FILE *pnm_file, int depth)
|
||||||
{
|
{
|
||||||
static int bits_left = 0;
|
static int bits_left = 0;
|
||||||
static int old_value = 0;
|
static int old_value = 0;
|
||||||
static int mask = 0;
|
static int mask = 0;
|
||||||
int i;
|
|
||||||
png_uint_32 ret_value;
|
png_uint_32 ret_value;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (mask == 0)
|
if (mask == 0)
|
||||||
for (i = 0; i < depth; i++)
|
for (i = 0; i < depth; i++)
|
||||||
@@ -568,7 +609,11 @@ png_uint_32 get_data (FILE *pnm_file, int depth)
|
|||||||
|
|
||||||
if (bits_left <= 0)
|
if (bits_left <= 0)
|
||||||
{
|
{
|
||||||
|
/* FIXME:
|
||||||
|
* signal the premature end of file, instead of pretending to read zeroes
|
||||||
|
*/
|
||||||
old_value = fgetc (pnm_file);
|
old_value = fgetc (pnm_file);
|
||||||
|
if (old_value == EOF) return 0;
|
||||||
bits_left = 8;
|
bits_left = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,25 +628,28 @@ png_uint_32 get_data (FILE *pnm_file, int depth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_value() - takes first (numeric) string and converts into number,
|
* get_pnm_value - takes first (numeric) string and converts into number,
|
||||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
* using the bit-depth to fill up a byte (0x0A -> 0xAA)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
png_uint_32 get_value (FILE *pnm_file, int depth)
|
png_uint_32 get_pnm_value (FILE *pnm_file, int depth)
|
||||||
{
|
{
|
||||||
static png_uint_32 mask = 0;
|
static png_uint_32 mask = 0;
|
||||||
png_byte token[16];
|
|
||||||
unsigned long ul_ret_value;
|
|
||||||
png_uint_32 ret_value;
|
png_uint_32 ret_value;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
if (mask == 0)
|
if (mask == 0)
|
||||||
for (i = 0; i < depth; i++)
|
for (i = 0; i < depth; i++)
|
||||||
mask = (mask << 1) | 0x01;
|
mask = (mask << 1) | 0x01;
|
||||||
|
|
||||||
get_token (pnm_file, (char *) token);
|
if (fscan_pnm_uint_32 (pnm_file, &ret_value) != 1)
|
||||||
sscanf ((const char *) token, "%lu", &ul_ret_value);
|
{
|
||||||
ret_value = (png_uint_32) ul_ret_value;
|
/* FIXME:
|
||||||
|
* signal the invalid numeric tokens or the premature end of file,
|
||||||
|
* instead of pretending to read zeroes
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ret_value &= mask;
|
ret_value &= mask;
|
||||||
|
|
||||||
@@ -613,4 +661,3 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* end of source */
|
/* end of source */
|
||||||
|
|
||||||
|
|||||||
4
contrib/pngminus/png2pnm.bat → contrib/pngminus/test_png2pnm.bat
Executable file → Normal file
@@ -7,7 +7,7 @@ png2pnm.exe -noraw ..\pngsuite\basn0g16.png basn0g16.pgm
|
|||||||
REM -- full-color
|
REM -- full-color
|
||||||
png2pnm.exe -noraw ..\pngsuite\basn2c08.png basn2c08.ppm
|
png2pnm.exe -noraw ..\pngsuite\basn2c08.png basn2c08.ppm
|
||||||
png2pnm.exe -noraw ..\pngsuite\basn2c16.png basn2c16.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\basn3p01.png basn3p01.ppm
|
||||||
png2pnm.exe -noraw ..\pngsuite\basn3p02.png basn3p02.ppm
|
png2pnm.exe -noraw ..\pngsuite\basn3p02.png basn3p02.ppm
|
||||||
png2pnm.exe -noraw ..\pngsuite\basn3p04.png basn3p04.ppm
|
png2pnm.exe -noraw ..\pngsuite\basn3p04.png basn3p04.ppm
|
||||||
@@ -27,7 +27,7 @@ png2pnm.exe -raw ..\pngsuite\basn0g16.png rawn0g16.pgm
|
|||||||
REM -- full-color
|
REM -- full-color
|
||||||
png2pnm.exe -raw ..\pngsuite\basn2c08.png rawn2c08.ppm
|
png2pnm.exe -raw ..\pngsuite\basn2c08.png rawn2c08.ppm
|
||||||
png2pnm.exe -raw ..\pngsuite\basn2c16.png rawn2c16.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\basn3p01.png rawn3p01.ppm
|
||||||
png2pnm.exe -raw ..\pngsuite\basn3p02.png rawn3p02.ppm
|
png2pnm.exe -raw ..\pngsuite\basn3p02.png rawn3p02.ppm
|
||||||
png2pnm.exe -raw ..\pngsuite\basn3p04.png rawn3p04.ppm
|
png2pnm.exe -raw ..\pngsuite\basn3p04.png rawn3p04.ppm
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
# -- full-color
|
# -- full-color
|
||||||
./png2pnm -noraw ../pngsuite/basn2c08.png basn2c08.ppm
|
./png2pnm -noraw ../pngsuite/basn2c08.png basn2c08.ppm
|
||||||
./png2pnm -noraw ../pngsuite/basn2c16.png basn2c16.ppm
|
./png2pnm -noraw ../pngsuite/basn2c16.png basn2c16.ppm
|
||||||
# -- palletted
|
# -- paletted
|
||||||
./png2pnm -noraw ../pngsuite/basn3p01.png basn3p01.ppm
|
./png2pnm -noraw ../pngsuite/basn3p01.png basn3p01.ppm
|
||||||
./png2pnm -noraw ../pngsuite/basn3p02.png basn3p02.ppm
|
./png2pnm -noraw ../pngsuite/basn3p02.png basn3p02.ppm
|
||||||
./png2pnm -noraw ../pngsuite/basn3p04.png basn3p04.ppm
|
./png2pnm -noraw ../pngsuite/basn3p04.png basn3p04.ppm
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
# -- full-color
|
# -- full-color
|
||||||
./png2pnm -raw ../pngsuite/basn2c08.png rawn2c08.ppm
|
./png2pnm -raw ../pngsuite/basn2c08.png rawn2c08.ppm
|
||||||
./png2pnm -raw ../pngsuite/basn2c16.png rawn2c16.ppm
|
./png2pnm -raw ../pngsuite/basn2c16.png rawn2c16.ppm
|
||||||
# -- palletted
|
# -- paletted
|
||||||
./png2pnm -raw ../pngsuite/basn3p01.png rawn3p01.ppm
|
./png2pnm -raw ../pngsuite/basn3p01.png rawn3p01.ppm
|
||||||
./png2pnm -raw ../pngsuite/basn3p02.png rawn3p02.ppm
|
./png2pnm -raw ../pngsuite/basn3p02.png rawn3p02.ppm
|
||||||
./png2pnm -raw ../pngsuite/basn3p04.png rawn3p04.ppm
|
./png2pnm -raw ../pngsuite/basn3p04.png rawn3p04.ppm
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
make -f makefile.tc3
|
make
|
||||||
call png2pnm.bat
|
call png2pnm.bat
|
||||||
call pnm2png.bat
|
call pnm2png.bat
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
make -f makefile.std
|
make
|
||||||
sh png2pnm.sh
|
sh png2pnm.sh
|
||||||
sh pnm2png.sh
|
sh pnm2png.sh
|
||||||
|
|
||||||
4
contrib/pngminus/pnm2png.bat → contrib/pngminus/test_pnm2png.bat
Executable file → Normal file
@@ -7,7 +7,7 @@ pnm2png.exe basn0g16.pgm basn0g16.png
|
|||||||
REM -- full-color
|
REM -- full-color
|
||||||
pnm2png.exe basn2c08.ppm basn2c08.png
|
pnm2png.exe basn2c08.ppm basn2c08.png
|
||||||
pnm2png.exe basn2c16.ppm basn2c16.png
|
pnm2png.exe basn2c16.ppm basn2c16.png
|
||||||
REM -- palletted
|
REM -- paletted
|
||||||
pnm2png.exe basn3p01.ppm basn3p01.png
|
pnm2png.exe basn3p01.ppm basn3p01.png
|
||||||
pnm2png.exe basn3p02.ppm basn3p02.png
|
pnm2png.exe basn3p02.ppm basn3p02.png
|
||||||
pnm2png.exe basn3p04.ppm basn3p04.png
|
pnm2png.exe basn3p04.ppm basn3p04.png
|
||||||
@@ -27,7 +27,7 @@ pnm2png.exe rawn0g16.pgm rawn0g16.png
|
|||||||
REM -- full-color
|
REM -- full-color
|
||||||
pnm2png.exe rawn2c08.ppm rawn2c08.png
|
pnm2png.exe rawn2c08.ppm rawn2c08.png
|
||||||
pnm2png.exe rawn2c16.ppm rawn2c16.png
|
pnm2png.exe rawn2c16.ppm rawn2c16.png
|
||||||
REM -- palletted
|
REM -- paletted
|
||||||
pnm2png.exe rawn3p01.ppm rawn3p01.png
|
pnm2png.exe rawn3p01.ppm rawn3p01.png
|
||||||
pnm2png.exe rawn3p02.ppm rawn3p02.png
|
pnm2png.exe rawn3p02.ppm rawn3p02.png
|
||||||
pnm2png.exe rawn3p04.ppm rawn3p04.png
|
pnm2png.exe rawn3p04.ppm rawn3p04.png
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
# -- full-color
|
# -- full-color
|
||||||
./pnm2png basn2c08.ppm basn2c08.png
|
./pnm2png basn2c08.ppm basn2c08.png
|
||||||
./pnm2png basn2c16.ppm basn2c16.png
|
./pnm2png basn2c16.ppm basn2c16.png
|
||||||
# -- palletted
|
# -- paletted
|
||||||
./pnm2png basn3p01.ppm basn3p01.png
|
./pnm2png basn3p01.ppm basn3p01.png
|
||||||
./pnm2png basn3p02.ppm basn3p02.png
|
./pnm2png basn3p02.ppm basn3p02.png
|
||||||
./pnm2png basn3p04.ppm basn3p04.png
|
./pnm2png basn3p04.ppm basn3p04.png
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
# -- full-color
|
# -- full-color
|
||||||
./pnm2png rawn2c08.ppm rawn2c08.png
|
./pnm2png rawn2c08.ppm rawn2c08.png
|
||||||
./pnm2png rawn2c16.ppm rawn2c16.png
|
./pnm2png rawn2c16.ppm rawn2c16.png
|
||||||
# -- palletted
|
# -- paletted
|
||||||
./pnm2png rawn3p01.ppm rawn3p01.png
|
./pnm2png rawn3p01.ppm rawn3p01.png
|
||||||
./pnm2png rawn3p02.ppm rawn3p02.png
|
./pnm2png rawn3p02.ppm rawn3p02.png
|
||||||
./pnm2png rawn3p04.ppm rawn3p04.png
|
./pnm2png rawn3p04.ppm rawn3p04.png
|
||||||
@@ -16,6 +16,8 @@ chunks, etc.
|
|||||||
The "ft*.png" images are "free/libre" replacements for the transparent
|
The "ft*.png" images are "free/libre" replacements for the transparent
|
||||||
corresponding t*.png images in the PngSuite.
|
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:
|
The images in this directory represent the basic PNG color-types:
|
||||||
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
||||||
(1-8 bit) and grayscale or color images with alpha channel. You
|
(1-8 bit) and grayscale or color images with alpha channel. You
|
||||||
|
|||||||
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 |