Compare commits
1051 Commits
| 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 | ||
|
|
7292c861b1 | ||
|
|
c1effe1bbf | ||
|
|
f8110669f0 | ||
|
|
fbff8986e7 | ||
|
|
8c552ddf5b | ||
|
|
b363e01e6b | ||
|
|
0a181e1665 | ||
|
|
e4b59e5583 | ||
|
|
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
|
||||
82
ANNOUNCE
@@ -1,48 +1,66 @@
|
||||
Libpng 1.6.35 - July 15, 2018
|
||||
libpng 1.6.41 - January 24, 2024
|
||||
================================
|
||||
|
||||
This is a public release of libpng, intended for use in production code.
|
||||
|
||||
Files available for download:
|
||||
|
||||
Files available for download
|
||||
----------------------------
|
||||
|
||||
Source files with LF line endings (for Unix/Linux):
|
||||
|
||||
libpng-1.6.35.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.35.tar.gz
|
||||
* libpng-1.6.41.tar.xz (LZMA-compressed, recommended)
|
||||
* libpng-1.6.41.tar.gz (deflate-compressed)
|
||||
|
||||
Source files with CRLF line endings (for Windows):
|
||||
|
||||
lp1635.7z (LZMA-compressed, recommended)
|
||||
lp1635.zip
|
||||
* lpng1641.7z (LZMA-compressed, recommended)
|
||||
* lpng1641.zip (deflate-compressed)
|
||||
|
||||
Other information:
|
||||
|
||||
libpng-1.6.35-README.txt
|
||||
libpng-1.6.35-LICENSE.txt
|
||||
* README.md
|
||||
* LICENSE.md
|
||||
* AUTHORS.md
|
||||
* TRADEMARK.md
|
||||
|
||||
Changes since the last public release (1.6.34):
|
||||
|
||||
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.
|
||||
Make png_get_iCCP consistent with man page (allow compression-type argument
|
||||
to be NULL, bug report by Lenard Szolnoki).
|
||||
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)
|
||||
Changes from version 1.6.40 to version 1.6.41
|
||||
---------------------------------------------
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
* 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).
|
||||
|
||||
Glenn R-P
|
||||
to subscribe.
|
||||
|
||||
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.
|
||||
130
CHANGES
@@ -204,7 +204,7 @@ Version 0.97 [January, 1998]
|
||||
Added simple sRGB support (Glenn R-P)
|
||||
Easier conditional compiling, e.g.,
|
||||
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)
|
||||
Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P)
|
||||
Added more conditions for png_do_background, to avoid changing
|
||||
@@ -942,7 +942,7 @@ Version 1.0.8 [July 24, 2000]
|
||||
Version 1.0.9beta1 [November 10, 2000]
|
||||
Fixed typo in scripts/makefile.hpux
|
||||
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"
|
||||
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().
|
||||
@@ -2295,7 +2295,7 @@ Version 1.4.0beta58 [May 14, 2009]
|
||||
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
|
||||
|
||||
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)
|
||||
Added sections about the git repository and our coding style to the
|
||||
documentation
|
||||
@@ -2661,7 +2661,7 @@ Version 1.4.1beta06 [January 28, 2010]
|
||||
|
||||
Version 1.4.1beta07 [February 6, 2010]
|
||||
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.
|
||||
Eliminated use of png_ptr->irowbytes and reused the slot in png_ptr as
|
||||
png_ptr->png_user_chunk_malloc_max.
|
||||
@@ -3886,7 +3886,7 @@ Version 1.6.0beta06 [January 24, 2012]
|
||||
Version 1.6.0beta07 [January 28, 2012]
|
||||
Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
|
||||
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.
|
||||
Updated configure.ac from autoupdate: added --enable-werror option.
|
||||
Also some layout regularization and removal of introduced tab characters
|
||||
@@ -3919,7 +3919,7 @@ Version 1.6.0beta08 [February 1, 2012]
|
||||
version checking to configure.ac
|
||||
Improved pngstest speed by not doing redundant tests and add const to
|
||||
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.
|
||||
Cleaned up pngpriv.h to consistently declare all functions and data.
|
||||
Also eliminated PNG_CONST_DATA, which is apparently not needed but we
|
||||
@@ -4052,7 +4052,7 @@ Version 1.6.0beta16 [March 6, 2012]
|
||||
(in fact this is harmless, but the PNG data produced may be sub-optimal).
|
||||
|
||||
Version 1.6.0beta17 [March 10, 2012]
|
||||
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
|
||||
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
|
||||
Reject all iCCP chunks after the first, even if the first one is invalid.
|
||||
Deflate/inflate was reworked to move common zlib calls into single
|
||||
functions [rw]util.c. A new shared keyword check routine was also added
|
||||
@@ -4962,7 +4962,7 @@ Version 1.6.13beta01 [July 4, 2014]
|
||||
Changed "if defined(__ARM_NEON__)" to
|
||||
"if (defined(__ARM_NEON__) || defined(__ARM_NEON))" (James Wu).
|
||||
Fixed clang no-warning builds: png_digit was defined but never used.
|
||||
|
||||
|
||||
Version 1.6.13beta02 [July 21, 2014]
|
||||
Fixed an incorrect separator ("/" should be "\") in scripts/makefile.vcwin32
|
||||
(bug report from Wolfgang S. Kechel). Bug was introduced in libpng-1.6.11.
|
||||
@@ -5453,7 +5453,7 @@ Version 1.6.21beta01 [December 11, 2015]
|
||||
Version 1.6.21beta02 [December 14, 2015]
|
||||
Moved png_check_keyword() from pngwutil.c to pngset.c
|
||||
Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
|
||||
in the BigEndian tests by not testing it, making the BE code the same
|
||||
in the BigEndian tests by not testing it, making the BE code the same
|
||||
as the LE version.
|
||||
Fixes to pngvalid for various reduced build configurations (eliminate unused
|
||||
statics) and a fix for the case in rgb_to_gray when the digitize option
|
||||
@@ -5517,7 +5517,7 @@ Version 1.6.22beta03 [March 9, 2016]
|
||||
Added a common-law trademark notice and export control information
|
||||
to the LICENSE file, png.h, and the man page.
|
||||
Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
|
||||
were accidentally removed from libpng-1.6.17.
|
||||
were accidentally removed from libpng-1.6.17.
|
||||
Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
|
||||
(Robert C. Seacord).
|
||||
Removed dubious "#if INT_MAX" test from png.h that was added to
|
||||
@@ -5927,7 +5927,7 @@ Version 1.6.32beta03 [August 2, 2017]
|
||||
(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().
|
||||
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]
|
||||
@@ -5950,7 +5950,7 @@ 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).
|
||||
@@ -6063,9 +6063,105 @@ Version 1.6.35 [July 15, 2018]
|
||||
Added missing parentheses to a macro definition
|
||||
(suggested by "irwir" in GitHub issue #216)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe).
|
||||
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.
|
||||
|
||||
Glenn R-P
|
||||
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.
|
||||
|
||||
1294
CMakeLists.txt
87
INSTALL
@@ -128,16 +128,18 @@ Your directory structure should look like this:
|
||||
README
|
||||
*.h, *.c => libpng source files
|
||||
CMakeLists.txt => "cmake" script
|
||||
ci
|
||||
ci_*.sh
|
||||
configuration files:
|
||||
configure.ac, configure, Makefile.am, Makefile.in,
|
||||
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
|
||||
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
|
||||
arm-neon, conftest, examples, gregbook, libtests, pngminim,
|
||||
pngminus, pngsuite, tools, visupng
|
||||
projects
|
||||
cbuilder5, owatcom, visualc71, vstudio, xcode
|
||||
owatcom, visualc71, vstudio
|
||||
scripts
|
||||
makefile.*
|
||||
*.def (module definition files)
|
||||
@@ -145,7 +147,7 @@ Your directory structure should look like this:
|
||||
pngtest.png
|
||||
etc.
|
||||
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
|
||||
distribution of libpng. It is available in both tar.gz (UNIX style line
|
||||
@@ -153,28 +155,27 @@ endings) and zip (DOS style line endings) formats.
|
||||
|
||||
VI. Building with project files
|
||||
|
||||
If you are building libpng with MSVC, you can enter the
|
||||
libpng projects\visualc71 or vstudio directory and follow the instructions
|
||||
in README.txt.
|
||||
If you are building libpng with Microsoft Visual Studio, you can enter
|
||||
the directory projects\visualc71 or projects\vstudio and follow the
|
||||
instructions in README.txt.
|
||||
|
||||
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
||||
then come back here and run "configure" or choose the appropriate
|
||||
makefile.sys in the scripts directory.
|
||||
Otherwise, enter the zlib directory and follow the instructions in
|
||||
zlib/README, then come back here and run "configure" or choose the
|
||||
appropriate makefile in the scripts directory.
|
||||
|
||||
VII. Building with makefiles
|
||||
|
||||
Copy the file (or files) that you need from the
|
||||
scripts directory into this directory, for example
|
||||
|
||||
MSDOS example:
|
||||
|
||||
copy scripts\makefile.msc makefile
|
||||
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
|
||||
|
||||
UNIX example:
|
||||
|
||||
cp scripts/makefile.std makefile
|
||||
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
||||
cp scripts/makefile.std Makefile
|
||||
make
|
||||
|
||||
Windows example:
|
||||
|
||||
nmake -f scripts\makefile.vcwin32
|
||||
|
||||
Read the makefile to see if you need to change any source or
|
||||
target directories to match your preferences.
|
||||
@@ -191,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
|
||||
your output with the result shown in contrib/pngsuite/README.
|
||||
|
||||
Most of the makefiles will allow you to run "make install" to
|
||||
put the library in its final resting place (if you want to
|
||||
do that, run "make install" in the zlib directory first if necessary).
|
||||
Some also allow you to run "make test-installed" after you have
|
||||
run "make install".
|
||||
Most of the makefiles used to allow you to run "make install" to put
|
||||
the library in its final resting place, but that feature is no longer
|
||||
supported. The only tested and supported manners to install libpng are
|
||||
the conventional build and install procedures driven by the configure
|
||||
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
|
||||
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
|
||||
Officially, the support for 16-bit platforms has been removed.
|
||||
|
||||
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()
|
||||
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
|
||||
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
|
||||
defined, and FAR gets defined to far in pngconf.h, and you should be
|
||||
all set. Everything in the library (except for zlib's structure) is
|
||||
expecting far data. You must use the typedefs with the p or pp on
|
||||
the end for pointers (or at least look at them and be careful). Make
|
||||
note that the rows of data are defined as png_bytepp, which is
|
||||
an "unsigned char far * far *".
|
||||
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() call.
|
||||
You will also have to look into zconf.h to tell zlib (and thus libpng)
|
||||
that it cannot allocate more than 64K at a time. Even if you can, the
|
||||
memory won't be accessible. Therefore, you should limit zlib and libpng
|
||||
to 64K by defining MAXSEG_64K.
|
||||
|
||||
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
|
||||
"configure" script) to prefix all exported symbols by means of the
|
||||
@@ -231,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
|
||||
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
|
||||
or delete an include, this is the place to do it.
|
||||
@@ -243,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
|
||||
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
|
||||
libpng are compiled. All the defines end in _SUPPORTED. If you are
|
||||
@@ -282,7 +280,7 @@ library to fail if they call functions not available in your library.
|
||||
The size of the library itself should not be an issue, because only
|
||||
those sections that are actually used will be loaded into memory.
|
||||
|
||||
XIV. Enabling or disabling hardware optimizations
|
||||
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
|
||||
@@ -332,7 +330,7 @@ or disable them all at once with
|
||||
|
||||
cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
|
||||
|
||||
XV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||
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
|
||||
file and in the GIT repository logs. These will be of no concern to the vast
|
||||
@@ -423,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
|
||||
that were used to build libpng.
|
||||
|
||||
XVI. Setjmp/longjmp issues
|
||||
XIV. Setjmp/longjmp issues
|
||||
|
||||
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
|
||||
is known to be not thread-safe on some platforms and we don't know of
|
||||
@@ -441,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
|
||||
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
|
||||
|
||||
XVII. Common linking failures
|
||||
XV. Common linking failures
|
||||
|
||||
If your application fails to find libpng or zlib entries while linking:
|
||||
|
||||
@@ -453,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
|
||||
project/vstudio/README.txt.
|
||||
|
||||
XVIII. 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
|
||||
files, in the individual makefiles, in png.h, and the manual pages
|
||||
libpng.3 and png.5.
|
||||
|
||||
Copyright (c) 2022 Cosmin Truta
|
||||
Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
|
||||
This document is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
|
||||
175
LICENSE
@@ -1,53 +1,82 @@
|
||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
||||
=========================================
|
||||
|
||||
This copy of the libpng notices is provided for your convenience. In case of
|
||||
any discrepancy between this copy and the notices in the file png.h that is
|
||||
included in the libpng distribution, the latter shall prevail.
|
||||
PNG Reference Library License version 2
|
||||
---------------------------------------
|
||||
|
||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
* Copyright (c) 1995-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
|
||||
this sentence.
|
||||
The software is supplied "as is", without warranty of any kind,
|
||||
express or implied, including, without limitation, the warranties
|
||||
of merchantability, fitness for a particular purpose, title, and
|
||||
non-infringement. In no event shall the Copyright owners, or
|
||||
anyone distributing the software, be liable for any damages or
|
||||
other liability, whether in contract, tort or otherwise, arising
|
||||
from, out of, or in connection with the software, or the use or
|
||||
other dealings in the software, even if advised of the possibility
|
||||
of such damage.
|
||||
|
||||
This code is released under the libpng license.
|
||||
Permission is hereby granted to use, copy, modify, and distribute
|
||||
this software, or portions hereof, for any purpose, without fee,
|
||||
subject to the following restrictions:
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you
|
||||
use this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated, but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
|
||||
|
||||
PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
|
||||
derived from libpng-1.0.6, and are distributed according to the same
|
||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
added to the list of Contributing Authors:
|
||||
|
||||
Simon-Pierre Cadieux
|
||||
Eric S. Raymond
|
||||
Mans Rullgard
|
||||
Cosmin Truta
|
||||
Gilles Vollant
|
||||
James Yu
|
||||
Mandar Sahastrabuddhe
|
||||
Google Inc.
|
||||
Vadim Barkov
|
||||
Simon-Pierre Cadieux
|
||||
Eric S. Raymond
|
||||
Mans Rullgard
|
||||
Cosmin Truta
|
||||
Gilles Vollant
|
||||
James Yu
|
||||
Mandar Sahastrabuddhe
|
||||
Google Inc.
|
||||
Vadim Barkov
|
||||
|
||||
and with the following additions to the disclaimer:
|
||||
|
||||
There is no warranty against interference with your enjoyment of the
|
||||
library or against infringement. There is no warranty that our
|
||||
efforts or the library will fulfill any of your particular purposes
|
||||
or needs. This library is provided with all faults, and the entire
|
||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||
the user.
|
||||
There is no warranty against interference with your enjoyment of
|
||||
the library or against infringement. There is no warranty that our
|
||||
efforts or the library will fulfill any of your particular purposes
|
||||
or needs. This library is provided with all faults, and the entire
|
||||
risk of satisfactory quality, performance, accuracy, and effort is
|
||||
with the user.
|
||||
|
||||
Some files in the "contrib" directory and some configure-generated
|
||||
files that are distributed with libpng have other copyright owners and
|
||||
files that are distributed with libpng have other copyright owners, and
|
||||
are released under other open source licenses.
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||
libpng-0.96, and are distributed according to the same disclaimer and
|
||||
license as libpng-0.96, with the following individuals added to the list
|
||||
of Contributing Authors:
|
||||
license as libpng-0.96, with the following individuals added to the
|
||||
list of Contributing Authors:
|
||||
|
||||
Tom Lane
|
||||
Glenn Randers-Pehrson
|
||||
Willem van Schaik
|
||||
Tom Lane
|
||||
Glenn Randers-Pehrson
|
||||
Willem van Schaik
|
||||
|
||||
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
||||
@@ -55,14 +84,14 @@ and are distributed according to the same disclaimer and license as
|
||||
libpng-0.88, with the following individuals added to the list of
|
||||
Contributing Authors:
|
||||
|
||||
John Bowler
|
||||
Kevin Bracey
|
||||
Sam Bushell
|
||||
Magnus Holmgren
|
||||
Greg Roelofs
|
||||
Tom Tanner
|
||||
John Bowler
|
||||
Kevin Bracey
|
||||
Sam Bushell
|
||||
Magnus Holmgren
|
||||
Greg Roelofs
|
||||
Tom Tanner
|
||||
|
||||
Some files in the "scripts" directory have other copyright owners
|
||||
Some files in the "scripts" directory have other copyright owners,
|
||||
but are released under this license.
|
||||
|
||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||
@@ -71,63 +100,35 @@ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
For the purposes of this copyright and license, "Contributing Authors"
|
||||
is defined as the following set of individuals:
|
||||
|
||||
Andreas Dilger
|
||||
Dave Martindale
|
||||
Guy Eric Schalnat
|
||||
Paul Schmidt
|
||||
Tim Wegner
|
||||
Andreas Dilger
|
||||
Dave Martindale
|
||||
Guy Eric Schalnat
|
||||
Paul Schmidt
|
||||
Tim Wegner
|
||||
|
||||
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||
including, without limitation, the warranties of merchantability and of
|
||||
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||
assume no liability for direct, indirect, incidental, special, exemplary,
|
||||
or consequential damages, which may result from the use of the PNG
|
||||
Reference Library, even if advised of the possibility of such damage.
|
||||
The PNG Reference Library is supplied "AS IS". The Contributing
|
||||
Authors and Group 42, Inc. disclaim all warranties, expressed or
|
||||
implied, including, without limitation, the warranties of
|
||||
merchantability and of fitness for any purpose. The Contributing
|
||||
Authors and Group 42, Inc. assume no liability for direct, indirect,
|
||||
incidental, special, exemplary, or consequential damages, which may
|
||||
result from the use of the PNG Reference Library, even if advised of
|
||||
the possibility of such damage.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
source code, or portions hereof, for any purpose, without fee, subject
|
||||
to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented.
|
||||
1. The origin of this source code must not be misrepresented.
|
||||
|
||||
2. Altered versions must be plainly marked as such and must not
|
||||
be misrepresented as being the original source.
|
||||
2. Altered versions must be plainly marked as such and must not
|
||||
be misrepresented as being the original source.
|
||||
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
|
||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||
fee, and encourage the use of this source code as a component to
|
||||
supporting the PNG file format in commercial products. If you use this
|
||||
source code in a product, acknowledgment is not required but would be
|
||||
appreciated.
|
||||
|
||||
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||
|
||||
TRADEMARK:
|
||||
|
||||
The name "libpng" has not been registered by the Copyright owner
|
||||
as a trademark in any jurisdiction. However, because libpng has
|
||||
been distributed and maintained world-wide, continually since 1995,
|
||||
the Copyright owner claims "common-law trademark protection" in any
|
||||
jurisdiction where common-law trademark is recognized.
|
||||
|
||||
OSI CERTIFICATION:
|
||||
|
||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
||||
a certification mark of the Open Source Initiative. OSI has not addressed
|
||||
the additional disclaimers inserted at version 1.0.7.
|
||||
|
||||
EXPORT CONTROL:
|
||||
|
||||
The Copyright owner believes that the Export Control Classification
|
||||
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||
controls or International Traffic in Arms Regulations (ITAR) because
|
||||
it is open source, publicly available software, that does not contain
|
||||
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||
734.7(b).
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
July 15, 2018
|
||||
The Contributing Authors and Group 42, Inc. specifically permit,
|
||||
without fee, and encourage the use of this source code as a component
|
||||
to supporting the PNG file format in commercial products. If you use
|
||||
this source code in a product, acknowledgment is not required but would
|
||||
be appreciated.
|
||||
|
||||
54
Makefile.am
@@ -1,7 +1,7 @@
|
||||
# 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
|
||||
# Last changed in libpng 1.6.25 [September 1, 2016]
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -9,16 +9,24 @@
|
||||
|
||||
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I scripts
|
||||
ACLOCAL_AMFLAGS = -I scripts/autoconf
|
||||
|
||||
# test programs - run on make check, make distcheck
|
||||
if ENABLE_TESTS
|
||||
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
|
||||
if HAVE_CLOCK_GETTIME
|
||||
check_PROGRAMS += timepng
|
||||
endif
|
||||
else
|
||||
check_PROGRAMS=
|
||||
endif
|
||||
|
||||
# Utilities - installed
|
||||
if ENABLE_TOOLS
|
||||
bin_PROGRAMS= pngfix png-fix-itxt
|
||||
else
|
||||
bin_PROGRAMS=
|
||||
endif
|
||||
|
||||
# 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,
|
||||
@@ -30,6 +38,7 @@ bin_PROGRAMS= pngfix png-fix-itxt
|
||||
# always wrong and always very confusing.
|
||||
BUILT_SOURCES = pnglibconf.h
|
||||
|
||||
if ENABLE_TESTS
|
||||
pngtest_SOURCES = pngtest.c
|
||||
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
@@ -48,19 +57,22 @@ pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
timepng_SOURCES = contrib/libtests/timepng.c
|
||||
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_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
|
||||
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||
|
||||
pngcp_SOURCES = contrib/tools/pngcp.c
|
||||
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
endif
|
||||
|
||||
# Generally these are single line shell scripts to run a test with a particular
|
||||
# set of parameters:
|
||||
if ENABLE_TESTS
|
||||
TESTS =\
|
||||
tests/pngtest\
|
||||
tests/pngtest-badpngs\
|
||||
tests/pngtest-all\
|
||||
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
|
||||
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
|
||||
tests/pngvalid-gamma-expand16-background\
|
||||
@@ -76,6 +88,7 @@ TESTS =\
|
||||
tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
|
||||
tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
|
||||
tests/pngimage-quick tests/pngimage-full
|
||||
endif
|
||||
|
||||
# man pages
|
||||
dist_man_MANS= libpng.3 libpngpf.3 png.5
|
||||
@@ -95,7 +108,8 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
|
||||
|
||||
if PNG_ARM_NEON
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
|
||||
arm/filter_neon.S arm/filter_neon_intrinsics.c
|
||||
arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
||||
arm/palette_neon_intrinsics.c
|
||||
endif
|
||||
|
||||
if PNG_MIPS_MSA
|
||||
@@ -103,6 +117,13 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
|
||||
mips/filter_msa_intrinsics.c
|
||||
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
|
||||
@@ -113,6 +134,15 @@ 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
|
||||
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
|
||||
@@ -133,6 +163,10 @@ else
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
||||
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/*
|
||||
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
|
||||
pkginclude_HEADERS= png.h pngconf.h
|
||||
@@ -147,9 +181,9 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
||||
# from those directories being included. This only works if the configure is
|
||||
# not done in the source directory!
|
||||
EXTRA_DIST= \
|
||||
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
|
||||
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
|
||||
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||
${srcdir}/ci ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
||||
CMakeLists.txt example.c libpng-manual.txt
|
||||
|
||||
|
||||
379
Makefile.in
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
# 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
|
||||
# Last changed in libpng 1.6.25 [September 1, 2016]
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -100,37 +100,43 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
check_PROGRAMS = pngtest$(EXEEXT) pngunknown$(EXEEXT) \
|
||||
pngstest$(EXEEXT) pngvalid$(EXEEXT) pngimage$(EXEEXT) \
|
||||
pngcp$(EXEEXT) $(am__EXEEXT_1)
|
||||
@HAVE_CLOCK_GETTIME_TRUE@am__append_1 = timepng
|
||||
bin_PROGRAMS = pngfix$(EXEEXT) png-fix-itxt$(EXEEXT)
|
||||
@ENABLE_TESTS_TRUE@check_PROGRAMS = pngtest$(EXEEXT) \
|
||||
@ENABLE_TESTS_TRUE@ pngunknown$(EXEEXT) pngstest$(EXEEXT) \
|
||||
@ENABLE_TESTS_TRUE@ pngvalid$(EXEEXT) pngimage$(EXEEXT) \
|
||||
@ENABLE_TESTS_TRUE@ pngcp$(EXEEXT) $(am__EXEEXT_1)
|
||||
@ENABLE_TESTS_TRUE@@HAVE_CLOCK_GETTIME_TRUE@am__append_1 = timepng
|
||||
@ENABLE_TOOLS_TRUE@bin_PROGRAMS = pngfix$(EXEEXT) \
|
||||
@ENABLE_TOOLS_TRUE@ png-fix-itxt$(EXEEXT)
|
||||
@PNG_ARM_NEON_TRUE@am__append_2 = arm/arm_init.c\
|
||||
@PNG_ARM_NEON_TRUE@ arm/filter_neon.S arm/filter_neon_intrinsics.c
|
||||
@PNG_ARM_NEON_TRUE@ arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
||||
@PNG_ARM_NEON_TRUE@ arm/palette_neon_intrinsics.c
|
||||
|
||||
@PNG_MIPS_MSA_TRUE@am__append_3 = mips/mips_init.c\
|
||||
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.c
|
||||
|
||||
@PNG_INTEL_SSE_TRUE@am__append_4 = intel/intel_init.c\
|
||||
@PNG_MIPS_MMI_TRUE@@PNG_MIPS_MSA_FALSE@am__append_4 = mips/mips_init.c
|
||||
@PNG_MIPS_MMI_TRUE@am__append_5 = mips/filter_mmi_inline_assembly.c
|
||||
@PNG_INTEL_SSE_TRUE@am__append_6 = intel/intel_init.c\
|
||||
@PNG_INTEL_SSE_TRUE@ intel/filter_sse2_intrinsics.c
|
||||
|
||||
@PNG_POWERPC_VSX_TRUE@am__append_5 = powerpc/powerpc_init.c\
|
||||
@PNG_POWERPC_VSX_TRUE@am__append_7 = powerpc/powerpc_init.c\
|
||||
@PNG_POWERPC_VSX_TRUE@ powerpc/filter_vsx_intrinsics.c
|
||||
|
||||
|
||||
# Versioned symbols and restricted exports
|
||||
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_TRUE@am__append_6 = -Wl,-M -Wl,libpng.vers
|
||||
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_FALSE@am__append_7 = -Wl,--version-script=libpng.vers
|
||||
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_TRUE@am__append_8 = -Wl,-M -Wl,libpng.vers
|
||||
@HAVE_LD_VERSION_SCRIPT_TRUE@@HAVE_SOLARIS_LD_FALSE@am__append_9 = -Wl,--version-script=libpng.vers
|
||||
# Only restricted exports when possible
|
||||
@HAVE_LD_VERSION_SCRIPT_FALSE@am__append_8 = -export-symbols libpng.sym
|
||||
@DO_PNG_PREFIX_TRUE@am__append_9 = -DPNG_PREFIX='@PNG_PREFIX@'
|
||||
@HAVE_LD_VERSION_SCRIPT_FALSE@am__append_10 = -export-symbols libpng.sym
|
||||
@PNG_LOONGARCH_LSX_TRUE@am__append_11 = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
|
||||
@DO_PNG_PREFIX_TRUE@am__append_12 = -DPNG_PREFIX='@PNG_PREFIX@'
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/scripts/libtool.m4 \
|
||||
$(top_srcdir)/scripts/ltoptions.m4 \
|
||||
$(top_srcdir)/scripts/ltsugar.m4 \
|
||||
$(top_srcdir)/scripts/ltversion.m4 \
|
||||
$(top_srcdir)/scripts/lt~obsolete.m4 \
|
||||
am__aclocal_m4_deps = $(top_srcdir)/scripts/autoconf/libtool.m4 \
|
||||
$(top_srcdir)/scripts/autoconf/ltoptions.m4 \
|
||||
$(top_srcdir)/scripts/autoconf/ltsugar.m4 \
|
||||
$(top_srcdir)/scripts/autoconf/ltversion.m4 \
|
||||
$(top_srcdir)/scripts/autoconf/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
@@ -146,7 +152,8 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \
|
||||
"$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" \
|
||||
"$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" \
|
||||
"$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"
|
||||
@HAVE_CLOCK_GETTIME_TRUE@am__EXEEXT_1 = timepng$(EXEEXT)
|
||||
@ENABLE_TESTS_TRUE@@HAVE_CLOCK_GETTIME_TRUE@am__EXEEXT_1 = \
|
||||
@ENABLE_TESTS_TRUE@@HAVE_CLOCK_GETTIME_TRUE@ timepng$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
@@ -175,31 +182,36 @@ am__uninstall_files_from_dir = { \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD =
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
|
||||
am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST = png.c \
|
||||
pngerror.c pngget.c pngmem.c pngpread.c pngread.c pngrio.c \
|
||||
pngrtran.c pngrutil.c pngset.c pngtrans.c pngwio.c pngwrite.c \
|
||||
pngwtran.c pngwutil.c png.h pngconf.h pngdebug.h pnginfo.h \
|
||||
pngpriv.h pngstruct.h pngusr.dfa arm/arm_init.c \
|
||||
arm/filter_neon.S arm/filter_neon_intrinsics.c \
|
||||
mips/mips_init.c mips/filter_msa_intrinsics.c \
|
||||
arm/palette_neon_intrinsics.c mips/mips_init.c \
|
||||
mips/filter_msa_intrinsics.c mips/filter_mmi_inline_assembly.c \
|
||||
intel/intel_init.c intel/filter_sse2_intrinsics.c \
|
||||
powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c
|
||||
am__dirstamp = $(am__leading_dot)dirstamp
|
||||
@PNG_ARM_NEON_TRUE@am__objects_1 = arm/arm_init.lo arm/filter_neon.lo \
|
||||
@PNG_ARM_NEON_TRUE@ arm/filter_neon_intrinsics.lo
|
||||
@PNG_ARM_NEON_TRUE@ arm/filter_neon_intrinsics.lo \
|
||||
@PNG_ARM_NEON_TRUE@ arm/palette_neon_intrinsics.lo
|
||||
@PNG_MIPS_MSA_TRUE@am__objects_2 = mips/mips_init.lo \
|
||||
@PNG_MIPS_MSA_TRUE@ mips/filter_msa_intrinsics.lo
|
||||
@PNG_INTEL_SSE_TRUE@am__objects_3 = intel/intel_init.lo \
|
||||
@PNG_MIPS_MMI_TRUE@@PNG_MIPS_MSA_FALSE@am__objects_3 = \
|
||||
@PNG_MIPS_MMI_TRUE@@PNG_MIPS_MSA_FALSE@ mips/mips_init.lo
|
||||
@PNG_MIPS_MMI_TRUE@am__objects_4 = mips/filter_mmi_inline_assembly.lo
|
||||
@PNG_INTEL_SSE_TRUE@am__objects_5 = intel/intel_init.lo \
|
||||
@PNG_INTEL_SSE_TRUE@ intel/filter_sse2_intrinsics.lo
|
||||
@PNG_POWERPC_VSX_TRUE@am__objects_4 = powerpc/powerpc_init.lo \
|
||||
@PNG_POWERPC_VSX_TRUE@am__objects_6 = powerpc/powerpc_init.lo \
|
||||
@PNG_POWERPC_VSX_TRUE@ powerpc/filter_vsx_intrinsics.lo
|
||||
am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = png.lo pngerror.lo \
|
||||
pngget.lo pngmem.lo pngpread.lo pngread.lo pngrio.lo \
|
||||
pngrtran.lo pngrutil.lo pngset.lo pngtrans.lo pngwio.lo \
|
||||
pngwrite.lo pngwtran.lo pngwutil.lo $(am__objects_1) \
|
||||
$(am__objects_2) $(am__objects_3) $(am__objects_4)
|
||||
$(am__objects_2) $(am__objects_3) $(am__objects_4) \
|
||||
$(am__objects_5) $(am__objects_6)
|
||||
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS =
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS = \
|
||||
$(am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) \
|
||||
@@ -213,33 +225,69 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK = $(LIBTOOL) $(AM_V_lt) \
|
||||
$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS) $(LDFLAGS) -o \
|
||||
$@
|
||||
am_png_fix_itxt_OBJECTS = contrib/tools/png-fix-itxt.$(OBJEXT)
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_LIBADD =
|
||||
am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_SOURCES_DIST = \
|
||||
loongarch/loongarch_lsx_init.c \
|
||||
loongarch/filter_lsx_intrinsics.c
|
||||
@PNG_LOONGARCH_LSX_TRUE@am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_OBJECTS = loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.lo \
|
||||
@PNG_LOONGARCH_LSX_TRUE@ loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.lo
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_OBJECTS = \
|
||||
$(am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_OBJECTS)
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_LINK = $(LIBTOOL) $(AM_V_lt) \
|
||||
--tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
|
||||
$(CCLD) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS) \
|
||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
@PNG_LOONGARCH_LSX_TRUE@am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_rpath =
|
||||
am__png_fix_itxt_SOURCES_DIST = contrib/tools/png-fix-itxt.c
|
||||
@ENABLE_TOOLS_TRUE@am_png_fix_itxt_OBJECTS = \
|
||||
@ENABLE_TOOLS_TRUE@ contrib/tools/png-fix-itxt.$(OBJEXT)
|
||||
png_fix_itxt_OBJECTS = $(am_png_fix_itxt_OBJECTS)
|
||||
png_fix_itxt_LDADD = $(LDADD)
|
||||
am_pngcp_OBJECTS = contrib/tools/pngcp.$(OBJEXT)
|
||||
am__pngcp_SOURCES_DIST = contrib/tools/pngcp.c
|
||||
@ENABLE_TESTS_TRUE@am_pngcp_OBJECTS = contrib/tools/pngcp.$(OBJEXT)
|
||||
pngcp_OBJECTS = $(am_pngcp_OBJECTS)
|
||||
pngcp_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am_pngfix_OBJECTS = contrib/tools/pngfix.$(OBJEXT)
|
||||
@ENABLE_TESTS_TRUE@pngcp_DEPENDENCIES = \
|
||||
@ENABLE_TESTS_TRUE@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am__pngfix_SOURCES_DIST = contrib/tools/pngfix.c
|
||||
@ENABLE_TOOLS_TRUE@am_pngfix_OBJECTS = contrib/tools/pngfix.$(OBJEXT)
|
||||
pngfix_OBJECTS = $(am_pngfix_OBJECTS)
|
||||
pngfix_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am_pngimage_OBJECTS = contrib/libtests/pngimage.$(OBJEXT)
|
||||
@ENABLE_TOOLS_TRUE@pngfix_DEPENDENCIES = \
|
||||
@ENABLE_TOOLS_TRUE@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am__pngimage_SOURCES_DIST = contrib/libtests/pngimage.c
|
||||
@ENABLE_TESTS_TRUE@am_pngimage_OBJECTS = \
|
||||
@ENABLE_TESTS_TRUE@ contrib/libtests/pngimage.$(OBJEXT)
|
||||
pngimage_OBJECTS = $(am_pngimage_OBJECTS)
|
||||
pngimage_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am_pngstest_OBJECTS = contrib/libtests/pngstest.$(OBJEXT)
|
||||
@ENABLE_TESTS_TRUE@pngimage_DEPENDENCIES = \
|
||||
@ENABLE_TESTS_TRUE@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am__pngstest_SOURCES_DIST = contrib/libtests/pngstest.c
|
||||
@ENABLE_TESTS_TRUE@am_pngstest_OBJECTS = \
|
||||
@ENABLE_TESTS_TRUE@ contrib/libtests/pngstest.$(OBJEXT)
|
||||
pngstest_OBJECTS = $(am_pngstest_OBJECTS)
|
||||
pngstest_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am_pngtest_OBJECTS = pngtest.$(OBJEXT)
|
||||
@ENABLE_TESTS_TRUE@pngstest_DEPENDENCIES = \
|
||||
@ENABLE_TESTS_TRUE@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am__pngtest_SOURCES_DIST = pngtest.c
|
||||
@ENABLE_TESTS_TRUE@am_pngtest_OBJECTS = pngtest.$(OBJEXT)
|
||||
pngtest_OBJECTS = $(am_pngtest_OBJECTS)
|
||||
pngtest_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am_pngunknown_OBJECTS = contrib/libtests/pngunknown.$(OBJEXT)
|
||||
@ENABLE_TESTS_TRUE@pngtest_DEPENDENCIES = \
|
||||
@ENABLE_TESTS_TRUE@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am__pngunknown_SOURCES_DIST = contrib/libtests/pngunknown.c
|
||||
@ENABLE_TESTS_TRUE@am_pngunknown_OBJECTS = \
|
||||
@ENABLE_TESTS_TRUE@ contrib/libtests/pngunknown.$(OBJEXT)
|
||||
pngunknown_OBJECTS = $(am_pngunknown_OBJECTS)
|
||||
pngunknown_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am_pngvalid_OBJECTS = contrib/libtests/pngvalid.$(OBJEXT)
|
||||
@ENABLE_TESTS_TRUE@pngunknown_DEPENDENCIES = \
|
||||
@ENABLE_TESTS_TRUE@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am__pngvalid_SOURCES_DIST = contrib/libtests/pngvalid.c
|
||||
@ENABLE_TESTS_TRUE@am_pngvalid_OBJECTS = \
|
||||
@ENABLE_TESTS_TRUE@ contrib/libtests/pngvalid.$(OBJEXT)
|
||||
pngvalid_OBJECTS = $(am_pngvalid_OBJECTS)
|
||||
pngvalid_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am_timepng_OBJECTS = contrib/libtests/timepng.$(OBJEXT)
|
||||
@ENABLE_TESTS_TRUE@pngvalid_DEPENDENCIES = \
|
||||
@ENABLE_TESTS_TRUE@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
am__timepng_SOURCES_DIST = contrib/libtests/timepng.c
|
||||
@ENABLE_TESTS_TRUE@am_timepng_OBJECTS = \
|
||||
@ENABLE_TESTS_TRUE@ contrib/libtests/timepng.$(OBJEXT)
|
||||
timepng_OBJECTS = $(am_timepng_OBJECTS)
|
||||
timepng_DEPENDENCIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TESTS_TRUE@timepng_DEPENDENCIES = \
|
||||
@ENABLE_TESTS_TRUE@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
SCRIPTS = $(bin_SCRIPTS)
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
@@ -266,6 +314,7 @@ am__depfiles_remade = ./$(DEPDIR)/png.Plo ./$(DEPDIR)/pngerror.Plo \
|
||||
./$(DEPDIR)/pngwtran.Plo ./$(DEPDIR)/pngwutil.Plo \
|
||||
arm/$(DEPDIR)/arm_init.Plo arm/$(DEPDIR)/filter_neon.Plo \
|
||||
arm/$(DEPDIR)/filter_neon_intrinsics.Plo \
|
||||
arm/$(DEPDIR)/palette_neon_intrinsics.Plo \
|
||||
contrib/libtests/$(DEPDIR)/pngimage.Po \
|
||||
contrib/libtests/$(DEPDIR)/pngstest.Po \
|
||||
contrib/libtests/$(DEPDIR)/pngunknown.Po \
|
||||
@@ -276,6 +325,9 @@ am__depfiles_remade = ./$(DEPDIR)/png.Plo ./$(DEPDIR)/pngerror.Plo \
|
||||
contrib/tools/$(DEPDIR)/pngfix.Po \
|
||||
intel/$(DEPDIR)/filter_sse2_intrinsics.Plo \
|
||||
intel/$(DEPDIR)/intel_init.Plo \
|
||||
loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.Plo \
|
||||
loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.Plo \
|
||||
mips/$(DEPDIR)/filter_mmi_inline_assembly.Plo \
|
||||
mips/$(DEPDIR)/filter_msa_intrinsics.Plo \
|
||||
mips/$(DEPDIR)/mips_init.Plo \
|
||||
powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo \
|
||||
@@ -311,14 +363,18 @@ am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
|
||||
$(nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES) \
|
||||
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_SOURCES) \
|
||||
$(png_fix_itxt_SOURCES) $(pngcp_SOURCES) $(pngfix_SOURCES) \
|
||||
$(pngimage_SOURCES) $(pngstest_SOURCES) $(pngtest_SOURCES) \
|
||||
$(pngunknown_SOURCES) $(pngvalid_SOURCES) $(timepng_SOURCES)
|
||||
DIST_SOURCES = \
|
||||
$(am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES_DIST) \
|
||||
$(png_fix_itxt_SOURCES) $(pngcp_SOURCES) $(pngfix_SOURCES) \
|
||||
$(pngimage_SOURCES) $(pngstest_SOURCES) $(pngtest_SOURCES) \
|
||||
$(pngunknown_SOURCES) $(pngvalid_SOURCES) $(timepng_SOURCES)
|
||||
$(am__libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_SOURCES_DIST) \
|
||||
$(am__png_fix_itxt_SOURCES_DIST) $(am__pngcp_SOURCES_DIST) \
|
||||
$(am__pngfix_SOURCES_DIST) $(am__pngimage_SOURCES_DIST) \
|
||||
$(am__pngstest_SOURCES_DIST) $(am__pngtest_SOURCES_DIST) \
|
||||
$(am__pngunknown_SOURCES_DIST) $(am__pngvalid_SOURCES_DIST) \
|
||||
$(am__timepng_SOURCES_DIST)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
@@ -330,8 +386,8 @@ NROFF = nroff
|
||||
MANS = $(dist_man_MANS)
|
||||
DATA = $(pkgconfig_DATA)
|
||||
HEADERS = $(nodist_pkginclude_HEADERS) $(pkginclude_HEADERS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
|
||||
$(LISP)config.h.in
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
|
||||
config.h.in
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
@@ -348,9 +404,6 @@ am__define_uniq_tagged_files = \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
AM_RECURSIVE_TARGETS = cscope check recheck
|
||||
am__tty_colors_dummy = \
|
||||
mgn= red= grn= lgn= blu= brg= std=; \
|
||||
@@ -507,6 +560,7 @@ am__set_TESTS_bases = \
|
||||
bases='$(TEST_LOGS)'; \
|
||||
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
|
||||
bases=`echo $$bases`
|
||||
AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)'
|
||||
RECHECK_LOGS = $(TEST_LOGS)
|
||||
TEST_SUITE_LOG = test-suite.log
|
||||
TEST_EXTENSIONS = @EXEEXT@ .test
|
||||
@@ -530,7 +584,7 @@ TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
|
||||
$(TEST_LOG_FLAGS)
|
||||
am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \
|
||||
$(srcdir)/config.h.in $(srcdir)/libpng-config.in \
|
||||
$(srcdir)/libpng.pc.in INSTALL README TODO compile \
|
||||
$(srcdir)/libpng.pc.in AUTHORS INSTALL README TODO compile \
|
||||
config.guess config.sub depcomp install-sh ltmain.sh missing \
|
||||
test-driver
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@@ -546,6 +600,8 @@ am__post_remove_distdir = $(am__remove_distdir)
|
||||
DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz
|
||||
GZIP_ENV = --best
|
||||
DIST_TARGETS = dist-xz dist-gzip
|
||||
# Exists only to be overridden by the user if desired.
|
||||
AM_DISTCHECK_DVI_TARGET = dvi
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
@@ -570,6 +626,8 @@ CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
CTAGS = @CTAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
@@ -587,8 +645,10 @@ ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
FILECMD = @FILECMD@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
@@ -632,7 +692,6 @@ PNGLIB_VERSION = @PNGLIB_VERSION@
|
||||
# AM_CFLAGS)
|
||||
PNG_COPTS = @PNG_COPTS@
|
||||
PNG_PREFIX = @PNG_PREFIX@
|
||||
POW_LIB = @POW_LIB@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
@@ -691,6 +750,7 @@ pkgconfigdir = @pkgconfigdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
@@ -700,7 +760,7 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
PNGLIB_BASENAME = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
|
||||
ACLOCAL_AMFLAGS = -I scripts
|
||||
ACLOCAL_AMFLAGS = -I scripts/autoconf
|
||||
|
||||
# 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,
|
||||
@@ -711,44 +771,43 @@ ACLOCAL_AMFLAGS = -I scripts
|
||||
# result in the installed (system) pnglibconf.h being used and the result is
|
||||
# always wrong and always very confusing.
|
||||
BUILT_SOURCES = pnglibconf.h
|
||||
pngtest_SOURCES = pngtest.c
|
||||
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
pngvalid_SOURCES = contrib/libtests/pngvalid.c
|
||||
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
pngstest_SOURCES = contrib/libtests/pngstest.c
|
||||
pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
pngunknown_SOURCES = contrib/libtests/pngunknown.c
|
||||
pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
pngimage_SOURCES = contrib/libtests/pngimage.c
|
||||
pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
timepng_SOURCES = contrib/libtests/timepng.c
|
||||
timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
pngfix_SOURCES = contrib/tools/pngfix.c
|
||||
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||
pngcp_SOURCES = contrib/tools/pngcp.c
|
||||
pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TESTS_TRUE@pngtest_SOURCES = pngtest.c
|
||||
@ENABLE_TESTS_TRUE@pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TESTS_TRUE@pngvalid_SOURCES = contrib/libtests/pngvalid.c
|
||||
@ENABLE_TESTS_TRUE@pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TESTS_TRUE@pngstest_SOURCES = contrib/libtests/pngstest.c
|
||||
@ENABLE_TESTS_TRUE@pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TESTS_TRUE@pngunknown_SOURCES = contrib/libtests/pngunknown.c
|
||||
@ENABLE_TESTS_TRUE@pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TESTS_TRUE@pngimage_SOURCES = contrib/libtests/pngimage.c
|
||||
@ENABLE_TESTS_TRUE@pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TESTS_TRUE@timepng_SOURCES = contrib/libtests/timepng.c
|
||||
@ENABLE_TESTS_TRUE@timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TESTS_TRUE@pngcp_SOURCES = contrib/tools/pngcp.c
|
||||
@ENABLE_TESTS_TRUE@pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TOOLS_TRUE@pngfix_SOURCES = contrib/tools/pngfix.c
|
||||
@ENABLE_TOOLS_TRUE@pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
|
||||
@ENABLE_TOOLS_TRUE@png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
|
||||
|
||||
# Generally these are single line shell scripts to run a test with a particular
|
||||
# set of parameters:
|
||||
TESTS = \
|
||||
tests/pngtest\
|
||||
tests/pngtest-badpngs\
|
||||
tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
|
||||
tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
|
||||
tests/pngvalid-gamma-expand16-background\
|
||||
tests/pngvalid-gamma-expand16-transform tests/pngvalid-gamma-sbit\
|
||||
tests/pngvalid-gamma-threshold tests/pngvalid-gamma-transform\
|
||||
tests/pngvalid-progressive-size\
|
||||
tests/pngvalid-progressive-interlace-standard\
|
||||
tests/pngvalid-transform\
|
||||
tests/pngvalid-progressive-standard tests/pngvalid-standard\
|
||||
tests/pngstest-1.8 tests/pngstest-1.8-alpha tests/pngstest-linear\
|
||||
tests/pngstest-linear-alpha tests/pngstest-none tests/pngstest-none-alpha\
|
||||
tests/pngstest-sRGB tests/pngstest-sRGB-alpha tests/pngunknown-IDAT\
|
||||
tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
|
||||
tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
|
||||
tests/pngimage-quick tests/pngimage-full
|
||||
@ENABLE_TESTS_TRUE@TESTS = \
|
||||
@ENABLE_TESTS_TRUE@ tests/pngtest-all\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngvalid-gamma-expand16-background\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngvalid-gamma-expand16-transform tests/pngvalid-gamma-sbit\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngvalid-gamma-threshold tests/pngvalid-gamma-transform\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngvalid-progressive-size\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngvalid-progressive-interlace-standard\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngvalid-transform\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngvalid-progressive-standard tests/pngvalid-standard\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngstest-1.8 tests/pngstest-1.8-alpha tests/pngstest-linear\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngstest-linear-alpha tests/pngstest-none tests/pngstest-none-alpha\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngstest-sRGB tests/pngstest-sRGB-alpha tests/pngunknown-IDAT\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
|
||||
@ENABLE_TESTS_TRUE@ tests/pngimage-quick tests/pngimage-full
|
||||
|
||||
|
||||
# man pages
|
||||
@@ -764,14 +823,24 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c \
|
||||
pngrutil.c pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c \
|
||||
pngwutil.c png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h \
|
||||
pngstruct.h pngusr.dfa $(am__append_2) $(am__append_3) \
|
||||
$(am__append_4) $(am__append_5)
|
||||
$(am__append_4) $(am__append_5) $(am__append_6) \
|
||||
$(am__append_7)
|
||||
@PNG_LOONGARCH_LSX_TRUE@noinst_LTLIBRARIES = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la
|
||||
@PNG_LOONGARCH_LSX_TRUE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_SOURCES = loongarch/loongarch_lsx_init.c\
|
||||
@PNG_LOONGARCH_LSX_TRUE@ loongarch/filter_lsx_intrinsics.c
|
||||
|
||||
@PNG_LOONGARCH_LSX_TRUE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS = -mlsx
|
||||
@PNG_LOONGARCH_LSX_TRUE@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
|
||||
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 \
|
||||
$(am__append_6) $(am__append_7) $(am__append_8)
|
||||
@HAVE_LD_VERSION_SCRIPT_FALSE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
|
||||
@HAVE_LD_VERSION_SCRIPT_TRUE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
|
||||
$(am__append_8) $(am__append_9) $(am__append_10)
|
||||
@HAVE_LD_VERSION_SCRIPT_FALSE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = \
|
||||
@HAVE_LD_VERSION_SCRIPT_FALSE@ libpng.sym $(am__append_11)
|
||||
@HAVE_LD_VERSION_SCRIPT_TRUE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = \
|
||||
@HAVE_LD_VERSION_SCRIPT_TRUE@ libpng.vers $(am__append_11)
|
||||
pkginclude_HEADERS = png.h pngconf.h
|
||||
nodist_pkginclude_HEADERS = pnglibconf.h
|
||||
pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
||||
@@ -780,9 +849,9 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
|
||||
# from those directories being included. This only works if the configure is
|
||||
# not done in the source directory!
|
||||
EXTRA_DIST = \
|
||||
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
|
||||
ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
|
||||
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
|
||||
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||
${srcdir}/ci ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
|
||||
$(TESTS) $(XFAIL_TESTS) tests/pngstest \
|
||||
CMakeLists.txt example.c libpng-manual.txt
|
||||
|
||||
@@ -805,7 +874,7 @@ SUFFIXES = .chk .out
|
||||
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0' \
|
||||
-DPNGLIB_VERSION='@PNGLIB_VERSION@' \
|
||||
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)' -DPNG_NO_USE_READ_MACROS \
|
||||
-DPNG_BUILDING_SYMBOL_TABLE $(am__append_9)
|
||||
-DPNG_BUILDING_SYMBOL_TABLE $(am__append_12)
|
||||
|
||||
# EXT_LIST is a list of the possibly library directory extensions, this exists
|
||||
# because we can't find a good way of discovering the file extensions that are
|
||||
@@ -962,6 +1031,17 @@ clean-libLTLIBRARIES:
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
arm/$(am__dirstamp):
|
||||
@$(MKDIR_P) arm
|
||||
@: > arm/$(am__dirstamp)
|
||||
@@ -972,6 +1052,8 @@ arm/arm_init.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
|
||||
arm/filter_neon.lo: arm/$(am__dirstamp) arm/$(DEPDIR)/$(am__dirstamp)
|
||||
arm/filter_neon_intrinsics.lo: arm/$(am__dirstamp) \
|
||||
arm/$(DEPDIR)/$(am__dirstamp)
|
||||
arm/palette_neon_intrinsics.lo: arm/$(am__dirstamp) \
|
||||
arm/$(DEPDIR)/$(am__dirstamp)
|
||||
mips/$(am__dirstamp):
|
||||
@$(MKDIR_P) mips
|
||||
@: > mips/$(am__dirstamp)
|
||||
@@ -981,6 +1063,8 @@ mips/$(DEPDIR)/$(am__dirstamp):
|
||||
mips/mips_init.lo: mips/$(am__dirstamp) mips/$(DEPDIR)/$(am__dirstamp)
|
||||
mips/filter_msa_intrinsics.lo: mips/$(am__dirstamp) \
|
||||
mips/$(DEPDIR)/$(am__dirstamp)
|
||||
mips/filter_mmi_inline_assembly.lo: mips/$(am__dirstamp) \
|
||||
mips/$(DEPDIR)/$(am__dirstamp)
|
||||
intel/$(am__dirstamp):
|
||||
@$(MKDIR_P) intel
|
||||
@: > intel/$(am__dirstamp)
|
||||
@@ -1004,6 +1088,19 @@ powerpc/filter_vsx_intrinsics.lo: powerpc/$(am__dirstamp) \
|
||||
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la: $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES) $(EXTRA_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LINK) -rpath $(libdir) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LIBADD) $(LIBS)
|
||||
loongarch/$(am__dirstamp):
|
||||
@$(MKDIR_P) loongarch
|
||||
@: > loongarch/$(am__dirstamp)
|
||||
loongarch/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) loongarch/$(DEPDIR)
|
||||
@: > loongarch/$(DEPDIR)/$(am__dirstamp)
|
||||
loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.lo: \
|
||||
loongarch/$(am__dirstamp) loongarch/$(DEPDIR)/$(am__dirstamp)
|
||||
loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.lo: \
|
||||
loongarch/$(am__dirstamp) loongarch/$(DEPDIR)/$(am__dirstamp)
|
||||
|
||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx.la: $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_DEPENDENCIES) $(EXTRA_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_LINK) $(am_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_rpath) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_OBJECTS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_LIBADD) $(LIBS)
|
||||
contrib/tools/$(am__dirstamp):
|
||||
@$(MKDIR_P) contrib/tools
|
||||
@: > contrib/tools/$(am__dirstamp)
|
||||
@@ -1113,6 +1210,8 @@ mostlyclean-compile:
|
||||
-rm -f contrib/tools/*.$(OBJEXT)
|
||||
-rm -f intel/*.$(OBJEXT)
|
||||
-rm -f intel/*.lo
|
||||
-rm -f loongarch/*.$(OBJEXT)
|
||||
-rm -f loongarch/*.lo
|
||||
-rm -f mips/*.$(OBJEXT)
|
||||
-rm -f mips/*.lo
|
||||
-rm -f powerpc/*.$(OBJEXT)
|
||||
@@ -1140,6 +1239,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/arm_init.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/filter_neon_intrinsics.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@arm/$(DEPDIR)/palette_neon_intrinsics.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngimage.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngstest.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/libtests/$(DEPDIR)/pngunknown.Po@am__quote@ # am--include-marker
|
||||
@@ -1150,6 +1250,9 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@contrib/tools/$(DEPDIR)/pngfix.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/filter_sse2_intrinsics.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@intel/$(DEPDIR)/intel_init.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/filter_mmi_inline_assembly.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/filter_msa_intrinsics.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@mips/$(DEPDIR)/mips_init.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo@am__quote@ # am--include-marker
|
||||
@@ -1209,6 +1312,20 @@ am--depfiles: $(am__depfiles_remade)
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.lo: loongarch/loongarch_lsx_init.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS) $(CFLAGS) -MT loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.lo -MD -MP -MF loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.Tpo -c -o loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.lo `test -f 'loongarch/loongarch_lsx_init.c' || echo '$(srcdir)/'`loongarch/loongarch_lsx_init.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.Tpo loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='loongarch/loongarch_lsx_init.c' object='loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS) $(CFLAGS) -c -o loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.lo `test -f 'loongarch/loongarch_lsx_init.c' || echo '$(srcdir)/'`loongarch/loongarch_lsx_init.c
|
||||
|
||||
loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.lo: loongarch/filter_lsx_intrinsics.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS) $(CFLAGS) -MT loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.lo -MD -MP -MF loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.Tpo -c -o loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.lo `test -f 'loongarch/filter_lsx_intrinsics.c' || echo '$(srcdir)/'`loongarch/filter_lsx_intrinsics.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.Tpo loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='loongarch/filter_lsx_intrinsics.c' object='loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la_CFLAGS) $(CFLAGS) -c -o loongarch/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.lo `test -f 'loongarch/filter_lsx_intrinsics.c' || echo '$(srcdir)/'`loongarch/filter_lsx_intrinsics.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
@@ -1216,6 +1333,7 @@ clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
-rm -rf arm/.libs arm/_libs
|
||||
-rm -rf intel/.libs intel/_libs
|
||||
-rm -rf loongarch/.libs loongarch/_libs
|
||||
-rm -rf mips/.libs mips/_libs
|
||||
-rm -rf powerpc/.libs powerpc/_libs
|
||||
|
||||
@@ -1537,7 +1655,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
|
||||
test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
|
||||
fi; \
|
||||
echo "$${col}$$br$${std}"; \
|
||||
echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
|
||||
echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \
|
||||
echo "$${col}$$br$${std}"; \
|
||||
create_testsuite_report --maybe-color; \
|
||||
echo "$$col$$br$$std"; \
|
||||
@@ -1571,16 +1689,9 @@ recheck: all $(check_PROGRAMS)
|
||||
am__force_recheck=am--force-recheck \
|
||||
TEST_LOGS="$$log_list"; \
|
||||
exit $$?
|
||||
tests/pngtest.log: tests/pngtest
|
||||
@p='tests/pngtest'; \
|
||||
b='tests/pngtest'; \
|
||||
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
||||
--log-file $$b.log --trs-file $$b.trs \
|
||||
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
||||
"$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||
tests/pngtest-badpngs.log: tests/pngtest-badpngs
|
||||
@p='tests/pngtest-badpngs'; \
|
||||
b='tests/pngtest-badpngs'; \
|
||||
tests/pngtest-all.log: tests/pngtest-all
|
||||
@p='tests/pngtest-all'; \
|
||||
b='tests/pngtest-all'; \
|
||||
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
|
||||
--log-file $$b.log --trs-file $$b.trs \
|
||||
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
|
||||
@@ -1816,7 +1927,6 @@ tests/pngimage-full.log: tests/pngimage-full
|
||||
@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
|
||||
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
|
||||
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
@@ -1877,6 +1987,10 @@ dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-zstd: distdir
|
||||
tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@@ -1919,6 +2033,8 @@ distcheck: dist
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
*.tar.zst*) \
|
||||
zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
@@ -1934,7 +2050,7 @@ distcheck: dist
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
--srcdir=../.. --prefix="$$dc_install_base" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
@@ -1994,13 +2110,16 @@ all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(SCRIPTS) $(MANS) $(DATA) \
|
||||
$(HEADERS) config.h
|
||||
install-binPROGRAMS: install-libLTLIBRARIES
|
||||
|
||||
install-checkPROGRAMS: install-libLTLIBRARIES
|
||||
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-am
|
||||
install-exec: install-exec-am
|
||||
install-exec: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
@@ -2037,6 +2156,8 @@ distclean-generic:
|
||||
-rm -f contrib/tools/$(am__dirstamp)
|
||||
-rm -f intel/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f intel/$(am__dirstamp)
|
||||
-rm -f loongarch/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f loongarch/$(am__dirstamp)
|
||||
-rm -f mips/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f mips/$(am__dirstamp)
|
||||
-rm -f powerpc/$(DEPDIR)/$(am__dirstamp)
|
||||
@@ -2053,7 +2174,8 @@ maintainer-clean-generic:
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool mostlyclean-am
|
||||
clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
@@ -2076,6 +2198,7 @@ distclean: distclean-am
|
||||
-rm -f arm/$(DEPDIR)/arm_init.Plo
|
||||
-rm -f arm/$(DEPDIR)/filter_neon.Plo
|
||||
-rm -f arm/$(DEPDIR)/filter_neon_intrinsics.Plo
|
||||
-rm -f arm/$(DEPDIR)/palette_neon_intrinsics.Plo
|
||||
-rm -f contrib/libtests/$(DEPDIR)/pngimage.Po
|
||||
-rm -f contrib/libtests/$(DEPDIR)/pngstest.Po
|
||||
-rm -f contrib/libtests/$(DEPDIR)/pngunknown.Po
|
||||
@@ -2086,6 +2209,9 @@ distclean: distclean-am
|
||||
-rm -f contrib/tools/$(DEPDIR)/pngfix.Po
|
||||
-rm -f intel/$(DEPDIR)/filter_sse2_intrinsics.Plo
|
||||
-rm -f intel/$(DEPDIR)/intel_init.Plo
|
||||
-rm -f loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.Plo
|
||||
-rm -f loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.Plo
|
||||
-rm -f mips/$(DEPDIR)/filter_mmi_inline_assembly.Plo
|
||||
-rm -f mips/$(DEPDIR)/filter_msa_intrinsics.Plo
|
||||
-rm -f mips/$(DEPDIR)/mips_init.Plo
|
||||
-rm -f powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo
|
||||
@@ -2160,6 +2286,7 @@ maintainer-clean: maintainer-clean-am
|
||||
-rm -f arm/$(DEPDIR)/arm_init.Plo
|
||||
-rm -f arm/$(DEPDIR)/filter_neon.Plo
|
||||
-rm -f arm/$(DEPDIR)/filter_neon_intrinsics.Plo
|
||||
-rm -f arm/$(DEPDIR)/palette_neon_intrinsics.Plo
|
||||
-rm -f contrib/libtests/$(DEPDIR)/pngimage.Po
|
||||
-rm -f contrib/libtests/$(DEPDIR)/pngstest.Po
|
||||
-rm -f contrib/libtests/$(DEPDIR)/pngunknown.Po
|
||||
@@ -2170,6 +2297,9 @@ maintainer-clean: maintainer-clean-am
|
||||
-rm -f contrib/tools/$(DEPDIR)/pngfix.Po
|
||||
-rm -f intel/$(DEPDIR)/filter_sse2_intrinsics.Plo
|
||||
-rm -f intel/$(DEPDIR)/intel_init.Plo
|
||||
-rm -f loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-filter_lsx_intrinsics.Plo
|
||||
-rm -f loongarch/$(DEPDIR)/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@lsx_la-loongarch_lsx_init.Plo
|
||||
-rm -f mips/$(DEPDIR)/filter_mmi_inline_assembly.Plo
|
||||
-rm -f mips/$(DEPDIR)/filter_msa_intrinsics.Plo
|
||||
-rm -f mips/$(DEPDIR)/mips_init.Plo
|
||||
-rm -f powerpc/$(DEPDIR)/filter_vsx_intrinsics.Plo
|
||||
@@ -2199,21 +2329,22 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
|
||||
uninstall-man: uninstall-man3 uninstall-man5
|
||||
|
||||
.MAKE: all check check-am install install-am install-data-am \
|
||||
install-exec-am install-strip uninstall-am
|
||||
install-exec install-exec-am install-strip uninstall-am
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles am--refresh check \
|
||||
check-TESTS check-am clean clean-binPROGRAMS \
|
||||
clean-checkPROGRAMS clean-cscope clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool cscope cscopelist-am ctags \
|
||||
ctags-am dist dist-all dist-bzip2 dist-gzip dist-hook \
|
||||
dist-lzip dist-shar dist-tarZ dist-xz dist-zip distcheck \
|
||||
distclean distclean-compile distclean-generic distclean-hdr \
|
||||
distclean-libtool distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
||||
install install-am install-binPROGRAMS install-binSCRIPTS \
|
||||
install-data install-data-am install-data-hook install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-exec-hook \
|
||||
install-html install-html-am install-info install-info-am \
|
||||
clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
|
||||
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \
|
||||
dist-zip dist-zstd distcheck distclean distclean-compile \
|
||||
distclean-generic distclean-hdr distclean-libtool \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-binPROGRAMS install-binSCRIPTS install-data \
|
||||
install-data-am install-data-hook install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-exec-hook install-html \
|
||||
install-html-am install-info install-info-am \
|
||||
install-libLTLIBRARIES install-man install-man3 install-man5 \
|
||||
install-nodist_pkgincludeHEADERS install-pdf install-pdf-am \
|
||||
install-pkgconfigDATA install-pkgincludeHEADERS install-ps \
|
||||
|
||||
348
README
@@ -1,56 +1,88 @@
|
||||
README for libpng version 1.6.35 - July 15, 2018 (shared library 16.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
README for libpng version 1.6.41
|
||||
================================
|
||||
|
||||
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-*.tar.xz or if you want UNIX-style line endings in the text files,
|
||||
or lpng*.7z or lpng*.zip if you want DOS-style line endings.
|
||||
Libpng comes in several distribution formats. Get `libpng-*.tar.gz`
|
||||
or `libpng-*.tar.xz` if you want UNIX-style line endings in the text
|
||||
files, or `lpng*.7z` or `lpng*.zip` if you want DOS-style line endings.
|
||||
|
||||
Version 0.89 was the first official release of libpng. Don't let the
|
||||
fact that it's the first release fool you. The libpng library has been in
|
||||
extensive use and testing since mid-1995. By late 1997 it had
|
||||
finally gotten to the stage where there hadn't been significant
|
||||
changes to the API in some time, and people have a bad feeling about
|
||||
libraries with versions < 1.0. Version 1.0.0 was released in
|
||||
March 1998.
|
||||
For a detailed description on using libpng, read `libpng-manual.txt`.
|
||||
For examples of libpng in a program, see `example.c` and `pngtest.c`.
|
||||
For usage information and restrictions (what little they are) on libpng,
|
||||
see `png.h`. For a description on using zlib (the compression library
|
||||
used by libpng) and zlib's restrictions, see `zlib.h`.
|
||||
|
||||
****
|
||||
Note that some of the changes to the png_info structure render this
|
||||
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 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
|
||||
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
|
||||
png_uint_32, which will affect shared-library applications that use
|
||||
this function.
|
||||
`filler` parameter for `png_set_filler()` has changed from `png_byte`
|
||||
to `png_uint_32`, which will affect shared-library applications that
|
||||
use this function.
|
||||
|
||||
To avoid problems with changes to the internals of the 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
|
||||
access to info_ptr. These functions are the png_set_<chunk> and
|
||||
png_get_<chunk> functions. These functions should be used when
|
||||
accessing/storing the info_struct data, rather than manipulating it
|
||||
access to `info_ptr`. These functions are the `png_set_<chunk>` and
|
||||
`png_get_<chunk>` functions. These functions should be used when
|
||||
accessing/storing the `info_struct` data, rather than manipulating it
|
||||
directly, to avoid such problems in the future.
|
||||
|
||||
It is important to note that the APIs did not make current programs
|
||||
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
|
||||
be a transitional release, members of the png_struct and the
|
||||
info_struct can still be accessed, but the compiler will issue a
|
||||
be a transitional release, members of the `png_struct` and the
|
||||
`info_struct` can still be accessed, but the compiler will issue a
|
||||
warning about deprecated usage. Since libpng-1.5.0, direct access
|
||||
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
|
||||
accessible to applications. It is strongly suggested that new
|
||||
programs use the new APIs (as shown in example.c and pngtest.c), and
|
||||
older programs be converted to the new format, to facilitate 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.
|
||||
reside in private `pngstruct.h` and `pnginfo.h` header files that are
|
||||
not accessible to applications. It is strongly suggested that new
|
||||
programs use the new APIs (as shown in `example.c` and `pngtest.c`),
|
||||
and older programs be converted to the new format, to facilitate
|
||||
upgrades in the future.
|
||||
|
||||
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
|
||||
@@ -60,163 +92,91 @@ the library action on the detection of chunk CRC errors. It is possible
|
||||
to set different actions based on whether the CRC error occurred in a
|
||||
critical or an ancillary chunk.
|
||||
|
||||
The changes made to the library, and bugs fixed are based on discussions
|
||||
on the PNG-implement mailing list and not on material submitted
|
||||
privately to Guy, Andreas, or Glenn. They will forward any good
|
||||
suggestions to the list.
|
||||
The 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 included 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-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
|
||||
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
|
||||
Files included in this distribution
|
||||
-----------------------------------
|
||||
|
||||
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.
|
||||
ANNOUNCE => Announcement of this version, with recent changes
|
||||
AUTHORS => List of contributing authors
|
||||
CHANGES => Description of changes between libpng versions
|
||||
INSTALL => Instructions to install libpng
|
||||
LICENSE => License to use and redistribute libpng
|
||||
README => This file
|
||||
TODO => Things not implemented in the current library
|
||||
TRADEMARK => Trademark information
|
||||
example.c => Example code for using libpng functions
|
||||
libpng.3 => Manual page for libpng (includes libpng-manual.txt)
|
||||
libpng-manual.txt => Description of libpng and its functions
|
||||
libpngpf.3 => Manual page for libpng's private functions (deprecated)
|
||||
png.5 => Manual page for the PNG format
|
||||
png.c => Basic interface functions common to library
|
||||
png.h => Library function and interface declarations (public)
|
||||
pngpriv.h => Library function and interface declarations (private)
|
||||
pngconf.h => System specific library configuration (public)
|
||||
pngstruct.h => png_struct declaration (private)
|
||||
pnginfo.h => png_info struct declaration (private)
|
||||
pngdebug.h => debugging macros (private)
|
||||
pngerror.c => Error/warning message I/O functions
|
||||
pngget.c => Functions for retrieving info from struct
|
||||
pngmem.c => Memory handling functions
|
||||
pngbar.png => PNG logo, 88x31
|
||||
pngnow.png => PNG logo, 98x31
|
||||
pngpread.c => Progressive reading functions
|
||||
pngread.c => Read data/helper high-level functions
|
||||
pngrio.c => Lowest-level data read I/O functions
|
||||
pngrtran.c => Read data transformation functions
|
||||
pngrutil.c => Read data utility functions
|
||||
pngset.c => Functions for storing data into the info_struct
|
||||
pngtest.c => Library test program
|
||||
pngtest.png => Library test sample image
|
||||
pngtrans.c => Common data transformation functions
|
||||
pngwio.c => Lowest-level write I/O functions
|
||||
pngwrite.c => High-level write functions
|
||||
pngwtran.c => Write data transformations
|
||||
pngwutil.c => Write utility functions
|
||||
arm/ => Optimized code for the ARM platform
|
||||
intel/ => Optimized code for the INTEL-SSE2 platform
|
||||
mips/ => Optimized code for the MIPS platform
|
||||
powerpc/ => Optimized code for the PowerPC platform
|
||||
ci/ => Scripts for continuous integration
|
||||
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
|
||||
libtests/ => Test programs
|
||||
oss-fuzz/ => Files used by the OSS-Fuzz project for fuzz-testing
|
||||
libpng
|
||||
pngminim/ => Minimal decoder, encoder, and progressive decoder
|
||||
programs demonstrating the use of pngusr.dfa
|
||||
pngminus/ => Simple pnm2png and png2pnm programs
|
||||
pngsuite/ => Test images
|
||||
testpngs/ => Test images
|
||||
tools/ => Various tools
|
||||
visupng/ => VisualPng, a Windows viewer for PNG images
|
||||
projects/ => Project files and workspaces for various IDEs
|
||||
owatcom/ => OpenWatcom project
|
||||
visualc71/ => Microsoft Visual C++ 7.1 workspace
|
||||
vstudio/ => Microsoft Visual Studio workspace
|
||||
scripts/ => Scripts and makefiles for building libpng
|
||||
(see scripts/README.txt for the complete list)
|
||||
tests/ => Test scripts
|
||||
|
||||
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.
|
||||
Good luck, and happy coding!
|
||||
|
||||
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/pngdocs.html .
|
||||
|
||||
This code is currently being archived at libpng.sourceforge.io in the
|
||||
[DOWNLOAD] area, and at http://libpng.download/src . 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).
|
||||
|
||||
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
|
||||
CHANGES => Description of changes between libpng versions
|
||||
KNOWNBUG => List of known bugs and deficiencies
|
||||
LICENSE => License to use and redistribute libpng
|
||||
README => This file
|
||||
TODO => Things not implemented in the current library
|
||||
Y2KINFO => Statement of Y2K compliance
|
||||
example.c => Example code for using libpng functions
|
||||
libpng.3 => manual page for libpng (includes libpng-manual.txt)
|
||||
libpng-manual.txt => Description of libpng and its functions
|
||||
libpngpf.3 => manual page for libpng's private functions
|
||||
png.5 => manual page for the PNG format
|
||||
png.c => Basic interface functions common to library
|
||||
png.h => Library function and interface declarations (public)
|
||||
pngpriv.h => Library function and interface declarations (private)
|
||||
pngconf.h => System specific library configuration (public)
|
||||
pngstruct.h => png_struct declaration (private)
|
||||
pnginfo.h => png_info struct declaration (private)
|
||||
pngdebug.h => debugging macros (private)
|
||||
pngerror.c => Error/warning message I/O functions
|
||||
pngget.c => Functions for retrieving info from struct
|
||||
pngmem.c => Memory handling functions
|
||||
pngbar.png => PNG logo, 88x31
|
||||
pngnow.png => PNG logo, 98x31
|
||||
pngpread.c => Progressive reading functions
|
||||
pngread.c => Read data/helper high-level functions
|
||||
pngrio.c => Lowest-level data read I/O functions
|
||||
pngrtran.c => Read data transformation functions
|
||||
pngrutil.c => Read data utility functions
|
||||
pngset.c => Functions for storing data into the info_struct
|
||||
pngtest.c => Library test program
|
||||
pngtest.png => Library test sample image
|
||||
pngtrans.c => Common data transformation functions
|
||||
pngwio.c => Lowest-level write I/O functions
|
||||
pngwrite.c => High-level write functions
|
||||
pngwtran.c => Write data transformations
|
||||
pngwutil.c => Write utility functions
|
||||
arm => Contains optimized code for the ARM platform
|
||||
powerpc => Contains optimized code for the PowerPC platform
|
||||
contrib => Contributions
|
||||
arm-neon => Optimized code for ARM-NEON platform
|
||||
powerpc-vsx => Optimized code for POWERPC-VSX platform
|
||||
examples => Example programs
|
||||
gregbook => source code for PNG reading and writing, from
|
||||
Greg Roelofs' "PNG: The Definitive Guide",
|
||||
O'Reilly, 1999
|
||||
libtests => Test programs
|
||||
mips-msa => Optimized code for MIPS-MSA platform
|
||||
pngminim => Minimal decoder, encoder, and progressive decoder
|
||||
programs demonstrating use of pngusr.dfa
|
||||
pngminus => Simple pnm2png and png2pnm programs
|
||||
pngsuite => Test images
|
||||
testpngs
|
||||
tools => Various tools
|
||||
visupng => Contains a MSVC workspace for VisualPng
|
||||
intel => Optimized code for INTEL-SSE2 platform
|
||||
mips => Optimized code for MIPS platform
|
||||
projects => Contains project files and workspaces for
|
||||
building a DLL
|
||||
owatcom => Contains a WATCOM project for building libpng
|
||||
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
vstudio => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
scripts => Directory containing scripts for building libpng:
|
||||
(see scripts/README.txt for the list of scripts)
|
||||
|
||||
Good luck, and happy coding.
|
||||
|
||||
-Glenn Randers-Pehrson (current maintainer, since 1998)
|
||||
Internet: glennrp at users.sourceforge.net
|
||||
|
||||
-Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||
Internet: adilger at enel.ucalgary.ca
|
||||
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
|
||||
|
||||
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||
(formerly of Group 42, Inc)
|
||||
Internet: gschal at infinet.com
|
||||
* Cosmin Truta (current maintainer, since 2018)
|
||||
* Glenn Randers-Pehrson (former maintainer, 1998-2018)
|
||||
* Andreas Eric Dilger (former maintainer, 1996-1997)
|
||||
* Guy Eric Schalnat (original author and former maintainer, 1995-1996)
|
||||
(formerly of Group 42, Inc.)
|
||||
|
||||
49
TODO
@@ -1,30 +1,23 @@
|
||||
/*
|
||||
TODO - list of things to do for libpng:
|
||||
|
||||
Final bug fixes.
|
||||
Better C++ wrapper/full C++ implementation?
|
||||
Fix problem with C++ and EXTERN "C".
|
||||
cHRM transformation.
|
||||
Remove setjmp/longjmp usage in favor of returning error codes. As a start on
|
||||
this, minimize the use of png_error(), replacing them with
|
||||
png_warning(); return(0); or similar.
|
||||
Palette creation.
|
||||
Add "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||
Improved dithering.
|
||||
Multi-lingual error and warning message support.
|
||||
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
||||
Man pages for function calls.
|
||||
Better documentation.
|
||||
Better filter selection
|
||||
(counting huffman bits/precompression? filter inertia? filter costs?).
|
||||
Histogram creation.
|
||||
Text conversion between different code pages (Latin-1 -> Mac and DOS).
|
||||
Avoid building gamma tables whenever possible.
|
||||
Use greater precision when changing to linear gamma for compositing against
|
||||
background and doing rgb-to-gray transformation.
|
||||
Investigate pre-incremented loop counters and other loop constructions.
|
||||
Add interpolated method of handling interlacing.
|
||||
Extend pngvalid.c to validate more of the libpng transformations.
|
||||
Refactor preprocessor conditionals to compile entire statements
|
||||
|
||||
*/
|
||||
* Fix all defects (duh!)
|
||||
* Better C++ wrapper / full C++ implementation (?)
|
||||
* Fix the problems with C++ and 'extern "C"'.
|
||||
* cHRM transformation.
|
||||
* Palette creation.
|
||||
* "grayscale->palette" transformation and "palette->grayscale" detection.
|
||||
* Improved dithering.
|
||||
* Multi-lingual error and warning message support.
|
||||
* Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
|
||||
* Man pages for function calls.
|
||||
* Better documentation.
|
||||
* Better filter selection
|
||||
(e.g., counting huffman bits/precompression; filter inertia; filter costs).
|
||||
* Histogram creation.
|
||||
* Text conversion between different code pages (e.g., Latin-1 -> Mac).
|
||||
* Avoid building gamma tables whenever possible.
|
||||
* Greater precision in changing to linear gamma for compositing against
|
||||
background, and in doing rgb-to-gray transformations.
|
||||
* Investigate pre-incremented loop counters and other loop constructions.
|
||||
* Interpolated method of handling interlacing.
|
||||
* More validations for libpng transformations.
|
||||
|
||||
8
TRADEMARK
Normal file
@@ -0,0 +1,8 @@
|
||||
TRADEMARK
|
||||
=========
|
||||
|
||||
The name "libpng" has not been registered by the Copyright owners
|
||||
as a trademark in any jurisdiction. However, because libpng has
|
||||
been distributed and maintained world-wide, continually since 1995,
|
||||
the Copyright owners claim "common-law trademark protection" in any
|
||||
jurisdiction where common-law trademark is recognized.
|
||||
93
aclocal.m4
vendored
@@ -1,6 +1,6 @@
|
||||
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -14,13 +14,13 @@
|
||||
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
|
||||
[m4_warning([this file was generated for autoconf 2.69.
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
|
||||
[m4_warning([this file was generated for autoconf 2.72.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.16'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.16.1], [],
|
||||
m4_if([$1], [1.16.5], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.16.1])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.16.5])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# Figure out how to run the assembler. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -78,7 +78,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -130,7 +130,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -161,7 +161,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -352,7 +352,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -391,7 +391,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
done
|
||||
if test $am_rc -ne 0; then
|
||||
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
|
||||
for automatic dependency tracking. Try re-running configure with the
|
||||
for automatic dependency tracking. If GNU make was not used, consider
|
||||
re-running the configure script with MAKE="gmake" (or whatever is
|
||||
necessary). You can also try re-running configure with the
|
||||
'--disable-dependency-tracking' option to at least be able to build
|
||||
the package (albeit without support for automatic dependency tracking).])
|
||||
fi
|
||||
@@ -418,7 +420,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -446,6 +448,10 @@ m4_defn([AC_PROG_CC])
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.65])dnl
|
||||
m4_ifdef([_$0_ALREADY_INIT],
|
||||
[m4_fatal([$0 expanded multiple times
|
||||
]m4_defn([_$0_ALREADY_INIT]))],
|
||||
[m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
@@ -482,7 +488,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
|
||||
m4_if(
|
||||
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
|
||||
m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
|
||||
[ok:ok],,
|
||||
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
@@ -534,6 +540,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
|
||||
[m4_define([AC_PROG_OBJCXX],
|
||||
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
|
||||
])
|
||||
# Variables for tags utilities; see am/tags.am
|
||||
if test -z "$CTAGS"; then
|
||||
CTAGS=ctags
|
||||
fi
|
||||
AC_SUBST([CTAGS])
|
||||
if test -z "$ETAGS"; then
|
||||
ETAGS=etags
|
||||
fi
|
||||
AC_SUBST([ETAGS])
|
||||
if test -z "$CSCOPE"; then
|
||||
CSCOPE=cscope
|
||||
fi
|
||||
AC_SUBST([CSCOPE])
|
||||
|
||||
AC_REQUIRE([AM_SILENT_RULES])dnl
|
||||
dnl The testsuite driver may need to know about EXEEXT, so add the
|
||||
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
|
||||
@@ -615,7 +635,7 @@ for _am_header in $config_headers :; do
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -636,7 +656,7 @@ if test x"${install_sh+set}" != xset; then
|
||||
fi
|
||||
AC_SUBST([install_sh])])
|
||||
|
||||
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -658,7 +678,7 @@ AC_SUBST([am__leading_dot])])
|
||||
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
||||
# From Jim Meyering
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -693,7 +713,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -736,7 +756,7 @@ AC_SUBST([am__quote])])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -757,12 +777,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([missing])dnl
|
||||
if test x"${MISSING+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
|
||||
*)
|
||||
MISSING="\${SHELL} $am_aux_dir/missing" ;;
|
||||
esac
|
||||
MISSING="\${SHELL} '$am_aux_dir/missing'"
|
||||
fi
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --is-lightweight"; then
|
||||
@@ -775,7 +790,7 @@ fi
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -804,7 +819,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -851,7 +866,7 @@ AC_LANG_POP([C])])
|
||||
# For backward compatibility.
|
||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -870,7 +885,7 @@ AC_DEFUN([AM_RUN_LOG],
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -951,7 +966,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
rm -f conftest.file
|
||||
])
|
||||
|
||||
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -1011,7 +1026,7 @@ AC_SUBST([AM_BACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -1039,7 +1054,7 @@ fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -1058,7 +1073,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -1189,8 +1204,8 @@ AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([scripts/libtool.m4])
|
||||
m4_include([scripts/ltoptions.m4])
|
||||
m4_include([scripts/ltsugar.m4])
|
||||
m4_include([scripts/ltversion.m4])
|
||||
m4_include([scripts/lt~obsolete.m4])
|
||||
m4_include([scripts/autoconf/libtool.m4])
|
||||
m4_include([scripts/autoconf/ltoptions.m4])
|
||||
m4_include([scripts/autoconf/ltsugar.m4])
|
||||
m4_include([scripts/autoconf/ltversion.m4])
|
||||
m4_include([scripts/autoconf/lt~obsolete.m4])
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
|
||||
/* arm_init.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018-2022 Cosmin Truta
|
||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*/
|
||||
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
||||
* called.
|
||||
*/
|
||||
|
||||
/* This module requires POSIX 1003.1 functions. */
|
||||
#define _POSIX_SOURCE 1
|
||||
|
||||
#include "../pngpriv.h"
|
||||
@@ -32,21 +31,26 @@
|
||||
* has partial support is contrib/arm-neon/linux.c - a generic Linux
|
||||
* implementation which reads /proc/cpufino.
|
||||
*/
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
|
||||
#ifndef PNG_ARM_NEON_FILE
|
||||
# ifdef __linux__
|
||||
# define PNG_ARM_NEON_FILE "contrib/arm-neon/linux.c"
|
||||
# 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"
|
||||
# else
|
||||
# error "No support for run-time ARM Neon checking; use compile-time options"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_ARM_NEON_FILE
|
||||
|
||||
#include <signal.h> /* for sig_atomic_t */
|
||||
static int png_have_neon(png_structp png_ptr);
|
||||
#include PNG_ARM_NEON_FILE
|
||||
|
||||
#else /* PNG_ARM_NEON_FILE */
|
||||
# error "PNG_ARM_NEON_FILE undefined: no support for run-time ARM NEON checks"
|
||||
#endif /* PNG_ARM_NEON_FILE */
|
||||
#ifdef PNG_ARM_NEON_FILE
|
||||
# include PNG_ARM_NEON_FILE
|
||||
#endif
|
||||
#endif /* PNG_ARM_NEON_CHECK_SUPPORTED */
|
||||
|
||||
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
/* filter_neon.S - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2017 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
|
||||
/* filter_neon_intrinsics.c - NEON optimised filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2014,2016 Glenn Randers-Pehrson
|
||||
* Written by James Yu <james.yu at linaro.org>, October 2013.
|
||||
* Based on filter_neon.S, written by Mans Rullgard, 2011.
|
||||
*
|
||||
* Last changed in libpng 1.6.22 [May 26, 2016]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
@@ -19,7 +18,11 @@
|
||||
/* This code requires -mfpu=neon on the command line: */
|
||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
||||
|
||||
#include <arm_neon.h>
|
||||
#if defined(_MSC_VER) && !defined(__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,
|
||||
* however this code will only work with appropriate alignment. arm/arm_init.c
|
||||
@@ -33,6 +36,11 @@
|
||||
* 'type'. This is written this way just to hide the GCC strict aliasing
|
||||
* warning; note that the code is safe because there never is an alias between
|
||||
* the input and output pointers.
|
||||
*
|
||||
* When compiling with MSVC ARM64, the png_ldr macro can't be passed directly
|
||||
* to vst4_lane_u32, because of an internal compiler error inside MSVC.
|
||||
* To avoid this compiler bug, we use a temporary variable (vdest_val) to store
|
||||
* the result of png_ldr.
|
||||
*/
|
||||
#define png_ldr(type,pointer)\
|
||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
||||
@@ -125,12 +133,15 @@ png_read_filter_row_sub4_neon(png_row_infop row_info, png_bytep row,
|
||||
uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
uint8x8x4_t vrp = *vrpt;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
uint32x2x4_t vdest_val;
|
||||
|
||||
vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]);
|
||||
vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]);
|
||||
vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||
|
||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||
}
|
||||
|
||||
PNG_UNUSED(prev_row)
|
||||
@@ -223,6 +234,7 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
||||
uint8x8x4_t *vrpt, *vppt;
|
||||
uint8x8x4_t vrp, vpp;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
uint32x2x4_t vdest_val;
|
||||
|
||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
@@ -240,7 +252,8 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
|
||||
vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]);
|
||||
vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]);
|
||||
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,6 +372,7 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
||||
uint8x8x4_t *vrpt, *vppt;
|
||||
uint8x8x4_t vrp, vpp;
|
||||
uint32x2x4_t *temp_pointer;
|
||||
uint32x2x4_t vdest_val;
|
||||
|
||||
vtmp = vld4_u32(png_ptr(uint32_t,rp));
|
||||
vrpt = png_ptr(uint8x8x4_t,&vtmp);
|
||||
@@ -378,7 +392,8 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
|
||||
|
||||
vlast = vpp.val[3];
|
||||
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2x4_t,&vdest), 0);
|
||||
vdest_val = png_ldr(uint32x2x4_t, &vdest);
|
||||
vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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\
|
||||
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):
|
||||
libpng_autotools_extra="compile config.h.in~"
|
||||
#
|
||||
# These are separate because 'maintainer-clean' does not remove them.
|
||||
libpng_libtool_files="scripts/libtool.m4 scripts/ltoptions.m4\
|
||||
scripts/ltsugar.m4 scripts/ltversion.m4 scripts/lt~obsolete.m4"
|
||||
libpng_libtool_files="scripts/autoconf/libtool.m4 scripts/autoconf/ltoptions.m4\
|
||||
scripts/autoconf/ltsugar.m4 scripts/autoconf/ltversion.m4\
|
||||
scripts/autoconf/lt~obsolete.m4"
|
||||
|
||||
libpng_autotools_dirs="autom4te.cache" # not required
|
||||
#
|
||||
|
||||
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'"
|
||||
6
compile
@@ -3,7 +3,7 @@
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# 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
|
||||
@@ -53,7 +53,7 @@ func_file_conv ()
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
CYGWIN* | MSYS*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
@@ -67,7 +67,7 @@ func_file_conv ()
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
cygwin/* | msys/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
|
||||
1567
config.guess
vendored
56
config.h.in
@@ -3,30 +3,27 @@
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `feenableexcept' function. */
|
||||
/* 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). */
|
||||
/* Define to 1 if you have the 'm' library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
/* Define to 1 if you have the 'z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the `pow' function. */
|
||||
/* 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
|
||||
|
||||
@@ -81,6 +78,18 @@
|
||||
/* 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
|
||||
|
||||
@@ -99,31 +108,28 @@
|
||||
/* Enable POWERPC VSX optimizations */
|
||||
#undef PNG_POWERPC_VSX_OPT
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
/* 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'. */
|
||||
/* Define to 1 if your <sys/time.h> declares 'struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported directly. */
|
||||
supported only directly. */
|
||||
#undef restrict
|
||||
/* Work around a bug in Sun C++: it does not support _Restrict or
|
||||
__restrict__, even though the corresponding Sun C compiler ends up with
|
||||
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
||||
previous line. Perhaps some future version of Sun C++ will work with
|
||||
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
||||
#if defined __SUNPRO_CC && !defined __RESTRICT
|
||||
/* 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
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
2807
config.sub
vendored
240
configure.ac
@@ -1,7 +1,7 @@
|
||||
# configure.ac
|
||||
|
||||
# Copyright (c) 2018-2024 Cosmin Truta
|
||||
# Copyright (c) 2004-2016 Glenn Randers-Pehrson
|
||||
# Last changed in libpng 1.6.25 [September 1, 2016]
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@@ -25,8 +25,8 @@ AC_PREREQ([2.68])
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng],[1.6.35],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts])
|
||||
AC_INIT([libpng],[1.6.41],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts/autoconf])
|
||||
|
||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||
# 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 stop configure from automagically running automake
|
||||
|
||||
PNGLIB_VERSION=1.6.35
|
||||
PNGLIB_VERSION=1.6.41
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=6
|
||||
PNGLIB_RELEASE=35
|
||||
PNGLIB_RELEASE=41
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
@@ -89,9 +89,27 @@ fi
|
||||
DFNCPP="$CPP"
|
||||
AC_SUBST(DFNCPP)
|
||||
|
||||
# -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_ENABLE([tests],
|
||||
AS_HELP_STRING([--disable-tests],
|
||||
[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,
|
||||
[additional flags for the C compiler, use this for options that would]
|
||||
[cause configure itself to fail])
|
||||
@@ -114,10 +132,10 @@ AC_ARG_ENABLE(werror,
|
||||
CFLAGS="$sav_CFLAGS"
|
||||
fi],)
|
||||
|
||||
# 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
|
||||
# This is incompatible with the new default mode, so we test for that and force the
|
||||
# "-std=c89" compiler option:
|
||||
# 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. This is incompatible with the new default mode, so
|
||||
# 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_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
@@ -133,23 +151,17 @@ AC_COMPILE_IFELSE(
|
||||
CFLAGS="$CFLAGS -std=c89"
|
||||
])
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_SIZE_T
|
||||
# Checks for structures and compiler characteristics.
|
||||
AC_STRUCT_TM
|
||||
AC_C_RESTRICT
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_STRTOD
|
||||
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
|
||||
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
|
||||
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
|
||||
# is soft (the corresponding test program is not built).
|
||||
AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])])
|
||||
# Some later POSIX 1003.1 functions are required for test programs, failure
|
||||
# here is soft (the corresponding test program is not built).
|
||||
AC_CHECK_FUNC([clock_gettime], , [AC_MSG_WARN([not building timepng])])
|
||||
AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
|
||||
|
||||
AC_ARG_WITH(zlib-prefix,
|
||||
@@ -157,8 +169,9 @@ AC_ARG_WITH(zlib-prefix,
|
||||
[prefix that may have been used in installed zlib]),
|
||||
[ZPREFIX=${withval}],
|
||||
[ZPREFIX='z_'])
|
||||
AC_CHECK_LIB(z, zlibVersion, ,
|
||||
AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, , AC_MSG_ERROR(zlib not installed)))
|
||||
AC_CHECK_LIB([z], [zlibVersion], ,
|
||||
[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
|
||||
# platforms that don't enable FP exceptions, the function appears in the math
|
||||
@@ -297,7 +310,7 @@ AC_ARG_ENABLE([unversioned-libpng-config],
|
||||
AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG],
|
||||
[test "$enable_unversioned_libpng_config" != "no"])
|
||||
|
||||
# HOST SPECIFIC OPTIONS
|
||||
# HOST-SPECIFIC OPTIONS
|
||||
# =====================
|
||||
#
|
||||
# DEFAULT
|
||||
@@ -315,24 +328,33 @@ AC_ARG_ENABLE([hardware-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], [0],
|
||||
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_MSA_OPT], [0],
|
||||
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)
|
||||
@@ -345,6 +367,11 @@ AC_ARG_ENABLE([hardware-optimizations],
|
||||
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])
|
||||
@@ -367,7 +394,7 @@ AC_ARG_ENABLE([arm-neon],
|
||||
AC_DEFINE([PNG_ARM_NEON_OPT], [0],
|
||||
[Disable ARM Neon optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_arm_neon=no;;
|
||||
enable_arm_neon=no ;;
|
||||
check)
|
||||
AC_DEFINE([PNG_ARM_NEON_CHECK_SUPPORTED], [],
|
||||
[Check for ARM Neon support at run-time]);;
|
||||
@@ -384,19 +411,19 @@ AC_ARG_ENABLE([arm-neon],
|
||||
AC_MSG_ERROR([--enable-arm-neon=${enable_arm_neon}: invalid value])
|
||||
esac])
|
||||
|
||||
# Add ARM specific files to all builds where the host_cpu is arm ('arm*') or
|
||||
# where ARM optimizations were explicitly requested (this allows a fallback if a
|
||||
# future host CPU does not match 'arm*')
|
||||
# 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 future host CPU does not match 'arm*')
|
||||
|
||||
AM_CONDITIONAL([PNG_ARM_NEON],
|
||||
[test "$enable_arm_neon" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
arm*|aarch64*) :;;
|
||||
*) test "$enable_arm_neon" != '';;
|
||||
arm*|aarch64*) : ;;
|
||||
*) test "$enable_arm_neon" != '' ;;
|
||||
esac])
|
||||
|
||||
# MIPS
|
||||
# ===
|
||||
# ====
|
||||
#
|
||||
# MIPS MSA (SIMD) support.
|
||||
|
||||
@@ -413,7 +440,7 @@ AC_ARG_ENABLE([mips-msa],
|
||||
AC_DEFINE([PNG_MIPS_MSA_OPT], [0],
|
||||
[Disable MIPS MSA optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_mips_msa=no;;
|
||||
enable_mips_msa=no ;;
|
||||
check)
|
||||
AC_DEFINE([PNG_MIPS_MSA_CHECK_SUPPORTED], [],
|
||||
[Check for MIPS MSA support at run-time]);;
|
||||
@@ -430,12 +457,57 @@ AC_ARG_ENABLE([mips-msa],
|
||||
AC_MSG_ERROR([--enable-mips-msa=${enable_mips_msa}: invalid value])
|
||||
esac])
|
||||
|
||||
# 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 future host CPU does not match 'mips*')
|
||||
|
||||
AM_CONDITIONAL([PNG_MIPS_MSA],
|
||||
[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_MSA],
|
||||
[test "$enable_mips_msa" != 'no' &&
|
||||
AM_CONDITIONAL([PNG_MIPS_MMI],
|
||||
[test "$enable_mips_mmi" != 'no' &&
|
||||
case "$host_cpu" in
|
||||
mipsel*|mips64el*) :;;
|
||||
esac])
|
||||
@@ -457,7 +529,7 @@ AC_ARG_ENABLE([intel-sse],
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
|
||||
[Disable Intel SSE optimizations])
|
||||
# Prevent inclusion of the assembler files below:
|
||||
enable_intel_sse=no;;
|
||||
enable_intel_sse=no ;;
|
||||
yes|on)
|
||||
AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
|
||||
[Enable Intel SSE optimizations]);;
|
||||
@@ -465,18 +537,18 @@ AC_ARG_ENABLE([intel-sse],
|
||||
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*')
|
||||
# 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" != '';;
|
||||
i?86|x86_64) : ;;
|
||||
*) test "$enable_intel_sse" != '' ;;
|
||||
esac])
|
||||
|
||||
# PowerPC
|
||||
# ===
|
||||
# =======
|
||||
#
|
||||
# PowerPC VSX (SIMD) support.
|
||||
|
||||
@@ -492,8 +564,8 @@ AS_HELP_STRING([[[--enable-powerpc-vsx]]],
|
||||
# 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;;
|
||||
# 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])
|
||||
@@ -507,21 +579,83 @@ AS_HELP_STRING([[[--enable-powerpc-vsx]]],
|
||||
[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.]);;
|
||||
[or '-mcpu=power8' to the compiler.]);;
|
||||
*)
|
||||
AC_MSG_ERROR([--enable-powerpc-vsx=${enable_powerpc_vsx}: invalid value])
|
||||
esac])
|
||||
|
||||
# Add PowerPC specific files to all builds where the host_cpu is powerpc('powerpc*') or
|
||||
# where POWERPC optimizations were explicitly requested (this allows a fallback if a
|
||||
# future host CPU does not match 'powerpc*')
|
||||
# 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*) :;;
|
||||
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]])
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by John Bowler, 2014.
|
||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -24,6 +23,7 @@
|
||||
* has been compiled only, not linked: no version of the library has been found,
|
||||
* only the header files exist in the NDK.
|
||||
*/
|
||||
|
||||
#include <cpu-features.h>
|
||||
|
||||
static int
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
*
|
||||
* Copyright (c) 2014 Glenn Randers-Pehrson
|
||||
* Written by Mans Rullgard, 2011.
|
||||
* Last changed in libpng 1.6.10 [March 6, 2014]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -22,6 +21,7 @@
|
||||
* This generic __linux__ implementation requires reading /proc/self/auxv and
|
||||
* looking at each element for one that records NEON capabilities.
|
||||
*/
|
||||
|
||||
#include <unistd.h> /* for POSIX 1003.1 */
|
||||
#include <errno.h> /* for EINTR */
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* contrib/arm-neon/linux.c
|
||||
*
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2014, 2017 Glenn Randers-Pehrson
|
||||
* Written by John Bowler, 2014, 2017.
|
||||
*
|
||||
@@ -19,6 +18,7 @@
|
||||
* 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>
|
||||
|
||||
static int
|
||||
|
||||
@@ -52,6 +52,6 @@ option TEXT on
|
||||
option 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_COMPRESSION on
|
||||
|
||||
@@ -42,7 +42,7 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
|
||||
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
|
||||
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
|
||||
|
||||
row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi);
|
||||
row = (png_const_bytep)(((const png_byte (*)[8])row) + bit_offset_hi);
|
||||
row += bit_offset_lo >> 3;
|
||||
bit_offset_lo &= 0x07;
|
||||
|
||||
@@ -73,7 +73,7 @@ static void
|
||||
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||
png_uint_32 x)
|
||||
{
|
||||
PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
||||
unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
|
||||
|
||||
switch (png_get_color_type(png_ptr, info_ptr))
|
||||
{
|
||||
@@ -87,7 +87,7 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
|
||||
*/
|
||||
case PNG_COLOR_TYPE_PALETTE:
|
||||
{
|
||||
PNG_CONST int index = component(row, x, 0, bit_depth, 1);
|
||||
int index = component(row, x, 0, bit_depth, 1);
|
||||
png_colorp palette = NULL;
|
||||
int num_palette = 0;
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
* related or neighboring rights to this work. This work is published from:
|
||||
* United States.
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
*
|
||||
* Read a PNG and write it out in a fixed format, using the 'simplified API'
|
||||
* that was introduced in libpng-1.6.0.
|
||||
*
|
||||
|
||||
@@ -146,7 +146,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
|
||||
/* These byte strings were copied from png.h. If a future version
|
||||
* of readpng2.c recognizes more chunks, add them to this list.
|
||||
*/
|
||||
static PNG_CONST png_byte chunks_to_process[] = {
|
||||
static const png_byte chunks_to_process[] = {
|
||||
98, 75, 71, 68, '\0', /* bKGD */
|
||||
103, 65, 77, 65, '\0', /* gAMA */
|
||||
115, 82, 71, 66, '\0', /* sRGB */
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
#
|
||||
# Copyright (c) 2013 John Cunningham Bowler
|
||||
#
|
||||
# Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
#
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
/* Copyright: */
|
||||
#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.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
@@ -299,25 +297,28 @@ generate_palette(png_colorp palette, png_bytep trans, int bit_depth,
|
||||
unsigned int x, y;
|
||||
volatile unsigned int ip = 0;
|
||||
|
||||
for (x=0; x<size; ++x) for (y=0; y<size; ++y)
|
||||
for (x=0; x<size; ++x)
|
||||
{
|
||||
ip = x + (size * y);
|
||||
for (y=0; y<size; ++y)
|
||||
{
|
||||
ip = x + (size * y);
|
||||
|
||||
/* size is at most 16, so the scaled value below fits in 16 bits
|
||||
*/
|
||||
# define interp(pos, c1, c2) ((pos * c1) + ((size-pos) * c2))
|
||||
# define xyinterp(x, y, c1, c2, c3, c4) (((size * size / 2) +\
|
||||
(interp(x, c1, c2) * y + (size-y) * interp(x, c3, c4))) /\
|
||||
(size*size))
|
||||
/* size is at most 16, so the scaled value below fits in 16 bits
|
||||
*/
|
||||
# define interp(pos, c1, c2) ((pos * c1) + ((size-pos) * c2))
|
||||
# define xyinterp(x, y, c1, c2, c3, c4) (((size * size / 2) +\
|
||||
(interp(x, c1, c2) * y + (size-y) * interp(x, c3, c4))) /\
|
||||
(size*size))
|
||||
|
||||
set_color(palette+ip, trans+ip,
|
||||
/* color: green, red,blue,white */
|
||||
xyinterp(x, y, 0, 255, 0, 255),
|
||||
xyinterp(x, y, 255, 0, 0, 255),
|
||||
xyinterp(x, y, 0, 0, 255, 255),
|
||||
/* alpha: 0, 102, 204, 255) */
|
||||
xyinterp(x, y, 0, 102, 204, 255),
|
||||
gamma_table);
|
||||
set_color(palette+ip, trans+ip,
|
||||
/* color: green, red,blue,white */
|
||||
xyinterp(x, y, 0, 255, 0, 255),
|
||||
xyinterp(x, y, 255, 0, 0, 255),
|
||||
xyinterp(x, y, 0, 0, 255, 255),
|
||||
/* alpha: 0, 102, 204, 255) */
|
||||
xyinterp(x, y, 0, 102, 204, 255),
|
||||
gamma_table);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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);
|
||||
|
||||
@@ -495,7 +496,7 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||
case 32:
|
||||
case 48:
|
||||
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
|
||||
* 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
|
||||
@@ -661,7 +662,7 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
const png_uint_32 luma = colors[1];
|
||||
png_uint_32 luma = colors[1];
|
||||
png_uint_32 x;
|
||||
|
||||
for (x=0; x<=size_max; ++x)
|
||||
@@ -672,8 +673,8 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||
|
||||
case 2:
|
||||
{
|
||||
const png_uint_32 luma = colors[1];
|
||||
const png_uint_32 alpha = colors[2];
|
||||
png_uint_32 luma = colors[1];
|
||||
png_uint_32 alpha = colors[2];
|
||||
png_uint_32 x;
|
||||
|
||||
for (x=0; x<size_max; ++x)
|
||||
@@ -688,9 +689,9 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||
|
||||
case 3:
|
||||
{
|
||||
const png_uint_32 red = colors[1];
|
||||
const png_uint_32 green = colors[2];
|
||||
const png_uint_32 blue = colors[3];
|
||||
png_uint_32 red = colors[1];
|
||||
png_uint_32 green = colors[2];
|
||||
png_uint_32 blue = colors[3];
|
||||
png_uint_32 x;
|
||||
|
||||
for (x=0; x<=size_max; ++x)
|
||||
@@ -707,10 +708,10 @@ generate_row(png_bytep row, size_t rowbytes, unsigned int y, int color_type,
|
||||
|
||||
case 4:
|
||||
{
|
||||
const png_uint_32 red = colors[1];
|
||||
const png_uint_32 green = colors[2];
|
||||
const png_uint_32 blue = colors[3];
|
||||
const png_uint_32 alpha = colors[4];
|
||||
png_uint_32 red = colors[1];
|
||||
png_uint_32 green = colors[2];
|
||||
png_uint_32 blue = colors[3];
|
||||
png_uint_32 alpha = colors[4];
|
||||
png_uint_32 x;
|
||||
|
||||
for (x=0; x<=size_max; ++x)
|
||||
@@ -812,7 +813,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||
png_error(png_ptr, "OOM allocating info structure");
|
||||
|
||||
{
|
||||
const unsigned int size =
|
||||
unsigned int size =
|
||||
image_size_of_type(color_type, bit_depth, colors, small);
|
||||
unsigned int ysize;
|
||||
png_fixed_point real_gamma = 45455; /* For sRGB */
|
||||
@@ -824,7 +825,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||
*/
|
||||
if (small)
|
||||
{
|
||||
const unsigned int pixel_depth =
|
||||
unsigned int pixel_depth =
|
||||
pixel_depth_of_type(color_type, bit_depth);
|
||||
|
||||
if (pixel_depth <= 8U)
|
||||
@@ -858,10 +859,13 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (real_gamma == 45455) for (i=0; i<256; ++i)
|
||||
if (real_gamma == 45455)
|
||||
{
|
||||
gamma_table[i] = (png_byte)i;
|
||||
conv = 1.;
|
||||
for (i=0; i<256; ++i)
|
||||
{
|
||||
gamma_table[i] = (png_byte)i;
|
||||
conv = 1.;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
@@ -1378,10 +1382,10 @@ static void
|
||||
insert_sBIT(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||
png_charpp params)
|
||||
{
|
||||
const int ct = png_get_color_type(png_ptr, info_ptr);
|
||||
const int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
|
||||
int ct = png_get_color_type(png_ptr, info_ptr);
|
||||
int c = (ct & PNG_COLOR_MASK_COLOR ? 3 : 1) +
|
||||
(ct & PNG_COLOR_MASK_ALPHA ? 1 : 0);
|
||||
const unsigned int maxval =
|
||||
unsigned int maxval =
|
||||
ct & PNG_COLOR_MASK_PALETTE ? 8U : png_get_bit_depth(png_ptr, info_ptr);
|
||||
png_color_8 sBIT;
|
||||
|
||||
@@ -1430,10 +1434,13 @@ find_parameters(png_const_charp what, png_charp param, png_charp *list,
|
||||
for (i=0; *param && i<nparams; ++i)
|
||||
{
|
||||
list[i] = param;
|
||||
while (*++param) if (*param == '\n' || *param == ':')
|
||||
while (*++param)
|
||||
{
|
||||
*param++ = 0; /* Terminate last parameter */
|
||||
break; /* And start a new one. */
|
||||
if (*param == '\n' || *param == ':')
|
||||
{
|
||||
*param++ = 0; /* Terminate last parameter */
|
||||
break; /* And start a new one. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1856,7 +1863,7 @@ main(int argc, char **argv)
|
||||
|
||||
/* Check the colors */
|
||||
{
|
||||
const unsigned int lim = (color_type == PNG_COLOR_TYPE_PALETTE ? 255U :
|
||||
unsigned int lim = (color_type == PNG_COLOR_TYPE_PALETTE ? 255U :
|
||||
(1U<<bit_depth)-1);
|
||||
unsigned int i;
|
||||
|
||||
@@ -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!)
|
||||
*/
|
||||
if (small && colors[0] != 0)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngimage.c
|
||||
*
|
||||
* Copyright (c) 2021 Cosmin Truta
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
@@ -12,6 +12,7 @@
|
||||
* using png_read_png and then write with png_write_png. Test all possible
|
||||
* transforms.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -317,11 +318,10 @@ transform_name(int t)
|
||||
|
||||
t &= -t; /* first set bit */
|
||||
|
||||
for (i=0; i<TTABLE_SIZE; ++i) if (transform_info[i].name != NULL)
|
||||
{
|
||||
if ((transform_info[i].transform & t) != 0)
|
||||
return transform_info[i].name;
|
||||
}
|
||||
for (i=0; i<TTABLE_SIZE; ++i)
|
||||
if (transform_info[i].name != NULL)
|
||||
if ((transform_info[i].transform & t) != 0)
|
||||
return transform_info[i].name;
|
||||
|
||||
return "invalid transform";
|
||||
}
|
||||
@@ -338,13 +338,16 @@ validate_T(void)
|
||||
{
|
||||
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].when & TRANSFORM_R)
|
||||
read_transforms |= transform_info[i].transform;
|
||||
if (transform_info[i].name != NULL)
|
||||
{
|
||||
if (transform_info[i].when & TRANSFORM_R)
|
||||
read_transforms |= transform_info[i].transform;
|
||||
|
||||
if (transform_info[i].when & TRANSFORM_W)
|
||||
write_transforms |= transform_info[i].transform;
|
||||
if (transform_info[i].when & TRANSFORM_W)
|
||||
write_transforms |= transform_info[i].transform;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reversible transforms are those which are supported on both read and
|
||||
@@ -962,21 +965,24 @@ update_display(struct display *dp)
|
||||
int bd = dp->bit_depth;
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; i<TTABLE_SIZE; ++i) if (transform_info[i].name != NULL)
|
||||
for (i=0; i<TTABLE_SIZE; ++i)
|
||||
{
|
||||
int transform = transform_info[i].transform;
|
||||
if (transform_info[i].name != NULL)
|
||||
{
|
||||
int transform = transform_info[i].transform;
|
||||
|
||||
if ((transform_info[i].valid_chunks == 0 ||
|
||||
(transform_info[i].valid_chunks & chunks) != 0) &&
|
||||
(transform_info[i].color_mask_required & ct) ==
|
||||
transform_info[i].color_mask_required &&
|
||||
(transform_info[i].color_mask_absent & ct) == 0 &&
|
||||
(transform_info[i].bit_depths & bd) != 0 &&
|
||||
(transform_info[i].when & TRANSFORM_R) != 0)
|
||||
active |= transform;
|
||||
if ((transform_info[i].valid_chunks == 0 ||
|
||||
(transform_info[i].valid_chunks & chunks) != 0) &&
|
||||
(transform_info[i].color_mask_required & ct) ==
|
||||
transform_info[i].color_mask_required &&
|
||||
(transform_info[i].color_mask_absent & ct) == 0 &&
|
||||
(transform_info[i].bit_depths & bd) != 0 &&
|
||||
(transform_info[i].when & TRANSFORM_R) != 0)
|
||||
active |= transform;
|
||||
|
||||
else if ((transform_info[i].when & TRANSFORM_R) != 0)
|
||||
inactive |= transform;
|
||||
else if ((transform_info[i].when & TRANSFORM_R) != 0)
|
||||
inactive |= transform;
|
||||
}
|
||||
}
|
||||
|
||||
/* Some transforms appear multiple times in the table; the 'active' status
|
||||
@@ -1000,8 +1006,9 @@ compare_read(struct display *dp, int applied_transforms)
|
||||
int interlace_method, compression_method, filter_method;
|
||||
const char *e = NULL;
|
||||
|
||||
png_get_IHDR(dp->read_pp, dp->read_ip, &width, &height, &bit_depth,
|
||||
&color_type, &interlace_method, &compression_method, &filter_method);
|
||||
if (!png_get_IHDR(dp->read_pp, dp->read_ip, &width, &height, &bit_depth,
|
||||
&color_type, &interlace_method, &compression_method, &filter_method))
|
||||
display_log(dp, LIBPNG_BUG, "png_get_IHDR failed");
|
||||
|
||||
# define C(item) if (item != dp->item) \
|
||||
display_log(dp, APP_WARNING, "IHDR " #item "(%lu) changed to %lu",\
|
||||
@@ -1081,8 +1088,9 @@ compare_read(struct display *dp, int applied_transforms)
|
||||
size_t x;
|
||||
|
||||
/* Find the first error */
|
||||
for (x=0; x<rowbytes-1; ++x) if (row[x] != orig[x])
|
||||
break;
|
||||
for (x=0; x<rowbytes-1; ++x)
|
||||
if (row[x] != orig[x])
|
||||
break;
|
||||
|
||||
display_log(dp, APP_FAIL,
|
||||
"byte(%lu,%lu) changed 0x%.2x -> 0x%.2x",
|
||||
@@ -1137,6 +1145,7 @@ compare_read(struct display *dp, int applied_transforms)
|
||||
display_log(dp, LIBPNG_ERROR, "invalid colour type %d",
|
||||
color_type);
|
||||
/*NOTREACHED*/
|
||||
memset(sig_bits, 0, sizeof(sig_bits));
|
||||
bpp = 0;
|
||||
break;
|
||||
}
|
||||
@@ -1198,7 +1207,7 @@ compare_read(struct display *dp, int applied_transforms)
|
||||
sig_bits[0] = (png_byte)b;
|
||||
break;
|
||||
|
||||
case 4: /* Relicate twice */
|
||||
case 4: /* Replicate twice */
|
||||
/* Value is 1, 2, 3 or 4 */
|
||||
b = 0xf & ((0xf << 4) >> sig_bits[0]);
|
||||
b |= b << 4;
|
||||
@@ -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 int active = dp->active_transforms;
|
||||
const int exhaustive = (dp->options & EXHAUSTIVE) != 0;
|
||||
int exhaustive = (dp->options & EXHAUSTIVE) != 0;
|
||||
unsigned int current = first_transform(active);
|
||||
unsigned int bad_transforms = 0;
|
||||
unsigned int bad_combo = ~0U; /* bitwise AND of failing transforms */
|
||||
@@ -1572,7 +1581,7 @@ do_test(struct display *dp, const char *file)
|
||||
}
|
||||
|
||||
int
|
||||
main(const int argc, const char * const * const argv)
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
/* For each file on the command line test it with a range of transforms */
|
||||
int option_end, ilog = 0;
|
||||
@@ -1674,7 +1683,7 @@ main(const int argc, const char * const * const argv)
|
||||
/* Here on any return, including failures, except user/internal issues
|
||||
*/
|
||||
{
|
||||
const int pass = (d.options & STRICT) ?
|
||||
int pass = (d.options & STRICT) ?
|
||||
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
|
||||
|
||||
if (!pass)
|
||||
@@ -1686,8 +1695,9 @@ main(const int argc, const char * const * const argv)
|
||||
|
||||
printf("%s: pngimage ", pass ? "PASS" : "FAIL");
|
||||
|
||||
for (j=1; j<option_end; ++j) if (j != ilog)
|
||||
printf("%s ", argv[j]);
|
||||
for (j=1; j<option_end; ++j)
|
||||
if (j != ilog)
|
||||
printf("%s ", argv[j]);
|
||||
|
||||
printf("%s\n", d.filename);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*-
|
||||
* pngstest.c
|
||||
|
||||
/* pngstest.c
|
||||
*
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2021 Cosmin Truta
|
||||
* Copyright (c) 2013-2017 John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
@@ -10,8 +10,9 @@
|
||||
*
|
||||
* Test for the PNG 'simplified' APIs.
|
||||
*/
|
||||
|
||||
#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 <stdlib.h>
|
||||
@@ -372,7 +373,7 @@ print_opts(png_uint_32 opts)
|
||||
*/
|
||||
#define FORMAT_COUNT 64
|
||||
#define FORMAT_MASK 0x3f
|
||||
static PNG_CONST char * PNG_CONST format_names[FORMAT_COUNT] =
|
||||
static const char * const format_names[FORMAT_COUNT] =
|
||||
{
|
||||
"sRGB-gray",
|
||||
"sRGB-gray+alpha",
|
||||
@@ -1150,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.)
|
||||
*
|
||||
* 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.)
|
||||
*
|
||||
* This gives the following base format conversion matrix:
|
||||
@@ -2346,8 +2347,8 @@ static int
|
||||
logpixel(const Transform *transform, png_uint_32 x, png_uint_32 y,
|
||||
const Pixel *in, const Pixel *calc, const Pixel *out, const char *reason)
|
||||
{
|
||||
const png_uint_32 in_format = transform->in_image->image.format;
|
||||
const png_uint_32 out_format = transform->out_image->image.format;
|
||||
png_uint_32 in_format = transform->in_image->image.format;
|
||||
png_uint_32 out_format = transform->out_image->image.format;
|
||||
|
||||
png_uint_32 back_format = out_format & ~PNG_FORMAT_FLAG_ALPHA;
|
||||
const char *via_linear = "";
|
||||
@@ -2602,12 +2603,12 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
ptrdiff_t strideb = b->stride;
|
||||
png_const_bytep rowa = a->buffer+16;
|
||||
png_const_bytep rowb = b->buffer+16;
|
||||
const png_uint_32 width = a->image.width;
|
||||
const png_uint_32 height = a->image.height;
|
||||
const png_uint_32 formata = a->image.format;
|
||||
const png_uint_32 formatb = b->image.format;
|
||||
const unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
|
||||
const unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
|
||||
png_uint_32 width = a->image.width;
|
||||
png_uint_32 height = a->image.height;
|
||||
png_uint_32 formata = a->image.format;
|
||||
png_uint_32 formatb = b->image.format;
|
||||
unsigned int a_sample = PNG_IMAGE_SAMPLE_SIZE(formata);
|
||||
unsigned int b_sample = PNG_IMAGE_SAMPLE_SIZE(formatb);
|
||||
int alpha_added, alpha_removed;
|
||||
int bchannels;
|
||||
png_uint_32 y;
|
||||
@@ -2701,7 +2702,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
{
|
||||
if ((a->opts & ACCUMULATE) == 0)
|
||||
{
|
||||
char pindex[9];
|
||||
char pindex[16];
|
||||
sprintf(pindex, "%lu[%lu]", (unsigned long)y,
|
||||
(unsigned long)a->image.colormap_entries);
|
||||
logerror(a, a->file_name, ": bad pixel index: ", pindex);
|
||||
@@ -2712,12 +2713,12 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
else if (y >= b->image.colormap_entries)
|
||||
{
|
||||
if ((b->opts & ACCUMULATE) == 0)
|
||||
{
|
||||
char pindex[9];
|
||||
{
|
||||
char pindex[16];
|
||||
sprintf(pindex, "%lu[%lu]", (unsigned long)y,
|
||||
(unsigned long)b->image.colormap_entries);
|
||||
logerror(b, b->file_name, ": bad pixel index: ", pindex);
|
||||
}
|
||||
}
|
||||
result = 0;
|
||||
}
|
||||
|
||||
@@ -2726,7 +2727,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
result = 0;
|
||||
}
|
||||
|
||||
/* If reqested copy the error values back from the Transform. */
|
||||
/* If requested, copy the error values back from the Transform. */
|
||||
if (a->opts & ACCUMULATE)
|
||||
{
|
||||
tr.error_ptr[0] = tr.error[0];
|
||||
@@ -2790,8 +2791,7 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
(formata & (formatb ^ PNG_FORMAT_FLAG_COLOR) & PNG_FORMAT_FLAG_COLOR)))
|
||||
{
|
||||
/* Was an alpha channel changed? */
|
||||
const png_uint_32 alpha_changed = (formata ^ formatb) &
|
||||
PNG_FORMAT_FLAG_ALPHA;
|
||||
png_uint_32 alpha_changed = (formata ^ formatb) & PNG_FORMAT_FLAG_ALPHA;
|
||||
|
||||
/* Was an alpha channel removed? (The third test.) If so the direct
|
||||
* comparison is only possible if the input alpha is opaque.
|
||||
@@ -2821,8 +2821,11 @@ compare_two_images(Image *a, Image *b, int via_linear,
|
||||
bchannels = component_loc(bloc, formatb);
|
||||
|
||||
/* Hence the btoa array. */
|
||||
for (i=0; i<4; ++i) if (bloc[i] < 4)
|
||||
btoa[bloc[i]] = aloc[i]; /* may be '4' for alpha */
|
||||
for (i=0; i<4; ++i)
|
||||
{
|
||||
if (bloc[i] < 4)
|
||||
btoa[bloc[i]] = aloc[i]; /* may be '4' for alpha */
|
||||
}
|
||||
|
||||
if (alpha_added)
|
||||
alpha_added = bloc[0]; /* location of alpha channel in image b */
|
||||
@@ -2932,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)
|
||||
{
|
||||
tr.error_ptr[0] = tr.error[0];
|
||||
@@ -3210,10 +3213,10 @@ write_one_file(Image *output, Image *image, int convert_to_8bit)
|
||||
else if (image->opts & USE_FILE)
|
||||
{
|
||||
#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
|
||||
static int counter = 0;
|
||||
static unsigned int counter = 0;
|
||||
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,
|
||||
image->buffer+16, (png_int_32)image->stride, image->colormap))
|
||||
@@ -3627,7 +3630,7 @@ main(int argc, char **argv)
|
||||
|
||||
if (arg[0] == '-')
|
||||
{
|
||||
const int term = (arg[1] == '0' ? 0 : '\n');
|
||||
int term = (arg[1] == '0' ? 0 : '\n');
|
||||
unsigned int ich = 0;
|
||||
|
||||
/* Loop reading files, use a static buffer to simplify this and just
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngunknown.c - test the read side unknown chunk handling
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 2021 Cosmin Truta
|
||||
* Copyright (c) 2015,2017 Glenn Randers-Pehrson
|
||||
* Written by John Cunningham Bowler
|
||||
*
|
||||
@@ -56,7 +56,7 @@
|
||||
defined(PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
|
||||
#if PNG_LIBPNG_VER < 10500
|
||||
/* This deliberately lacks the PNG_CONST. */
|
||||
/* This deliberately lacks the const. */
|
||||
typedef png_byte *png_const_bytep;
|
||||
|
||||
/* This is copied from 1.5.1 png.h: */
|
||||
@@ -370,7 +370,9 @@ find_by_flag(png_uint_32 flag)
|
||||
{
|
||||
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");
|
||||
exit(4);
|
||||
@@ -547,27 +549,30 @@ read_callback(png_structp pp, png_unknown_chunkp pc)
|
||||
|
||||
case PNG_HANDLE_CHUNK_AS_DEFAULT:
|
||||
case PNG_HANDLE_CHUNK_NEVER:
|
||||
discard = 1/*handled; discard*/;
|
||||
discard = 1; /*handled; discard*/
|
||||
break;
|
||||
|
||||
case PNG_HANDLE_CHUNK_IF_SAFE:
|
||||
case PNG_HANDLE_CHUNK_ALWAYS:
|
||||
discard = 0/*not handled; keep*/;
|
||||
discard = 0; /*not handled; keep*/
|
||||
break;
|
||||
}
|
||||
|
||||
/* Also store information about this chunk in the display, the relevant flag
|
||||
* 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)
|
||||
{
|
||||
png_uint_32 flag = chunk_info[chunk].flag;
|
||||
if (!discard) /* stupidity to stop a GCC warning */
|
||||
{
|
||||
png_uint_32 flag = chunk_info[chunk].flag;
|
||||
|
||||
if (pc->location & PNG_AFTER_IDAT)
|
||||
d->after_IDAT |= flag;
|
||||
if (pc->location & PNG_AFTER_IDAT)
|
||||
d->after_IDAT |= flag;
|
||||
|
||||
else
|
||||
d->before_IDAT |= flag;
|
||||
else
|
||||
d->before_IDAT |= flag;
|
||||
}
|
||||
}
|
||||
|
||||
/* However if there is no support to store unknown chunks don't ask libpng to
|
||||
@@ -841,8 +846,9 @@ check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/,
|
||||
{
|
||||
png_uint_32 y;
|
||||
|
||||
for (y=0; y<height; ++y) if (PNG_ROW_IN_INTERLACE_PASS(y, ipass))
|
||||
png_read_row(d->png_ptr, NULL, NULL);
|
||||
for (y=0; y<height; ++y)
|
||||
if (PNG_ROW_IN_INTERLACE_PASS(y, ipass))
|
||||
png_read_row(d->png_ptr, NULL, NULL);
|
||||
}
|
||||
}
|
||||
} /* interlaced */
|
||||
@@ -1091,15 +1097,15 @@ perform_one_test_safe(FILE *fp, int argc, const char **argv,
|
||||
|
||||
static const char *standard_tests[] =
|
||||
{
|
||||
"discard", "default=discard", 0,
|
||||
"save", "default=save", 0,
|
||||
"if-safe", "default=if-safe", 0,
|
||||
"vpAg", "vpAg=if-safe", 0,
|
||||
"sTER", "sTER=if-safe", 0,
|
||||
"IDAT", "default=discard", "IDAT=save", 0,
|
||||
"sAPI", "bKGD=save", "cHRM=save", "gAMA=save", "all=discard", "iCCP=save",
|
||||
"sBIT=save", "sRGB=save", "eXIf=save", 0,
|
||||
0/*end*/
|
||||
"discard", "default=discard", NULL,
|
||||
"save", "default=save", NULL,
|
||||
"if-safe", "default=if-safe", NULL,
|
||||
"vpAg", "vpAg=if-safe", NULL,
|
||||
"sTER", "sTER=if-safe", NULL,
|
||||
"IDAT", "default=discard", "IDAT=save", NULL,
|
||||
"sAPI", "bKGD=save", "cHRM=save", "gAMA=save", "all=discard", "iCCP=save",
|
||||
"sBIT=save", "sRGB=save", "eXIf=save", NULL,
|
||||
NULL /*end*/
|
||||
};
|
||||
|
||||
static PNG_NORETURN void
|
||||
@@ -1115,7 +1121,7 @@ int
|
||||
main(int argc, const char **argv)
|
||||
{
|
||||
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;
|
||||
const char *count_argv = "default=save";
|
||||
const char *touch_file = NULL;
|
||||
@@ -1153,8 +1159,9 @@ main(int argc, const char **argv)
|
||||
/* GCC BUG: if (default_tests && argc != 1) triggers some weird GCC argc
|
||||
* optimization which causes warnings with -Wstrict-overflow!
|
||||
*/
|
||||
else if (default_tests) if (argc != 1)
|
||||
usage(d.program, "extra arguments");
|
||||
else if (default_tests)
|
||||
if (argc != 1)
|
||||
usage(d.program, "extra arguments");
|
||||
|
||||
/* The name of the test file is the last argument; remove it. */
|
||||
d.file = argv[--argc];
|
||||
@@ -1216,7 +1223,11 @@ main(int argc, const char **argv)
|
||||
const char *result;
|
||||
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,
|
||||
this_test);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngvalid.c - validate libpng by constructing then reading png files.
|
||||
*
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2021 Cosmin Truta
|
||||
* Copyright (c) 2014-2017 John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
@@ -21,6 +21,8 @@
|
||||
#define _POSIX_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1 /* For floating point */
|
||||
#define _GNU_SOURCE 1 /* For the floating point exception extension */
|
||||
#define _BSD_SOURCE 1 /* For the floating point exception extension */
|
||||
#define _DEFAULT_SOURCE 1 /* For the floating point exception extension */
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
@@ -961,7 +963,7 @@ bits_of(png_uint_32 num)
|
||||
return b; /* 0..32 */
|
||||
}
|
||||
|
||||
/* Main interface to file storeage, after writing a new PNG file (see the API
|
||||
/* Main interface to file storage, after writing a new PNG file (see the API
|
||||
* below) call store_storefile to store the result with the given name and id.
|
||||
*/
|
||||
static void
|
||||
@@ -2589,7 +2591,7 @@ static double digitize(double value, int depth, int do_round)
|
||||
* rounding and 'do_round' should be 1, if it is 0 the digitized value will
|
||||
* be truncated.
|
||||
*/
|
||||
const unsigned int digitization_factor = (1U << depth) -1;
|
||||
unsigned int digitization_factor = (1U << depth) - 1;
|
||||
|
||||
/* Limiting the range is done as a convenience to the caller - it's easier to
|
||||
* do it once here than every time at the call site.
|
||||
@@ -3687,8 +3689,8 @@ init_standard_palette(png_store *ps, png_structp pp, png_infop pi, int npalette,
|
||||
|
||||
#ifdef PNG_WRITE_tRNS_SUPPORTED
|
||||
static void
|
||||
set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
|
||||
const int bit_depth)
|
||||
set_random_tRNS(png_structp pp, png_infop pi, png_byte colour_type,
|
||||
int bit_depth)
|
||||
{
|
||||
/* To make this useful the tRNS color needs to match at least one pixel.
|
||||
* Random values are fine for gray, including the 16-bit case where we know
|
||||
@@ -3696,7 +3698,7 @@ set_random_tRNS(png_structp pp, png_infop pi, const png_byte colour_type,
|
||||
* method as only 65536 different RGB values are generated.
|
||||
*/
|
||||
png_color_16 tRNS;
|
||||
const png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
|
||||
png_uint_16 mask = (png_uint_16)((1U << bit_depth)-1);
|
||||
|
||||
R8(tRNS); /* makes unset fields random */
|
||||
|
||||
@@ -4337,7 +4339,7 @@ make_size_image(png_store* const ps, png_byte const colour_type,
|
||||
|
||||
/* Make a name and get an appropriate id for the store: */
|
||||
char name[FILE_NAME_SIZE];
|
||||
const png_uint_32 id = FILEID(colour_type, bit_depth, 0/*palette*/,
|
||||
png_uint_32 id = FILEID(colour_type, bit_depth, 0/*palette*/,
|
||||
interlace_type, w, h, do_interlace);
|
||||
|
||||
standard_name_from_id(name, sizeof name, 0, id);
|
||||
@@ -4413,7 +4415,7 @@ make_size_image(png_store* const ps, png_byte const colour_type,
|
||||
for (pass=0; pass<npasses; ++pass)
|
||||
{
|
||||
/* The following two are for checking the macros: */
|
||||
const png_uint_32 wPass = PNG_PASS_COLS(w, pass);
|
||||
png_uint_32 wPass = PNG_PASS_COLS(w, pass);
|
||||
|
||||
/* If do_interlace is set we don't call png_write_row for every
|
||||
* row because some of them are empty. In fact, for a 1x1 image,
|
||||
@@ -4645,7 +4647,7 @@ make_error(png_store* const ps, png_byte const colour_type,
|
||||
Try
|
||||
{
|
||||
png_infop pi;
|
||||
const png_structp pp = set_store_for_write(ps, &pi, name);
|
||||
png_structp pp = set_store_for_write(ps, &pi, name);
|
||||
png_uint_32 w, h;
|
||||
gnu_volatile(pp)
|
||||
|
||||
@@ -4705,7 +4707,7 @@ make_error(png_store* const ps, png_byte const colour_type,
|
||||
else
|
||||
{
|
||||
/* Now write the whole image, just to make sure that the detected, or
|
||||
* undetected, errro has not created problems inside libpng. This
|
||||
* undetected, error has not created problems inside libpng. This
|
||||
* doesn't work if there was a png_error in png_write_info because that
|
||||
* can abort before PLTE was written.
|
||||
*/
|
||||
@@ -5468,14 +5470,14 @@ progressive_row(png_structp ppIn, png_bytep new_row, png_uint_32 y, int pass)
|
||||
|
||||
static void
|
||||
sequential_row(standard_display *dp, png_structp pp, png_infop pi,
|
||||
const int iImage, const int iDisplay)
|
||||
int iImage, int iDisplay)
|
||||
{
|
||||
const int npasses = dp->npasses;
|
||||
const int do_interlace = dp->do_interlace &&
|
||||
int npasses = dp->npasses;
|
||||
int do_interlace = dp->do_interlace &&
|
||||
dp->interlace_type == PNG_INTERLACE_ADAM7;
|
||||
const png_uint_32 height = standard_height(pp, dp->id);
|
||||
const png_uint_32 width = standard_width(pp, dp->id);
|
||||
const png_store* ps = dp->ps;
|
||||
png_uint_32 height = standard_height(pp, dp->id);
|
||||
png_uint_32 width = standard_width(pp, dp->id);
|
||||
const png_store* ps = dp->ps;
|
||||
int pass;
|
||||
|
||||
for (pass=0; pass<npasses; ++pass)
|
||||
@@ -5821,8 +5823,9 @@ test_standard(png_modifier* const pm, png_byte const colour_type,
|
||||
for (interlace_type = PNG_INTERLACE_NONE;
|
||||
interlace_type < INTERLACE_LAST; ++interlace_type)
|
||||
{
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
interlace_type, 0, 0, 0), do_read_interlace, pm->use_update_info);
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo),
|
||||
0/*palette*/, interlace_type, 0, 0, 0), do_read_interlace,
|
||||
pm->use_update_info);
|
||||
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
@@ -5869,53 +5872,56 @@ test_size(png_modifier* const pm, png_byte const colour_type,
|
||||
*/
|
||||
static const png_byte hinc[] = {1, 3, 11, 1, 5};
|
||||
static const png_byte winc[] = {1, 9, 5, 7, 1};
|
||||
const int save_bdlo = bdlo;
|
||||
int save_bdlo = bdlo;
|
||||
|
||||
for (; bdlo <= bdhi; ++bdlo)
|
||||
{
|
||||
png_uint_32 h, w;
|
||||
|
||||
for (h=1; h<=16; h+=hinc[bdlo]) for (w=1; w<=16; w+=winc[bdlo])
|
||||
for (h=1; h<=16; h+=hinc[bdlo])
|
||||
{
|
||||
/* First test all the 'size' images against the sequential
|
||||
* reader using libpng to deinterlace (where required.) This
|
||||
* validates the write side of libpng. There are four possibilities
|
||||
* to validate.
|
||||
*/
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
PNG_INTERLACE_NONE, w, h, 0), 0/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
for (w=1; w<=16; w+=winc[bdlo])
|
||||
{
|
||||
/* First test all the 'size' images against the sequential
|
||||
* reader using libpng to deinterlace (where required.) This
|
||||
* validates the write side of libpng. There are four possibilities
|
||||
* to validate.
|
||||
*/
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo),
|
||||
0/*palette*/, PNG_INTERLACE_NONE, w, h, 0), 0/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
PNG_INTERLACE_NONE, w, h, 1), 0/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo),
|
||||
0/*palette*/, PNG_INTERLACE_NONE, w, h, 1), 0/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
|
||||
/* Now validate the interlaced read side - do_interlace true,
|
||||
* in the progressive case this does actually make a difference
|
||||
* to the code used in the non-interlaced case too.
|
||||
*/
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
PNG_INTERLACE_NONE, w, h, 0), 1/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
/* Now validate the interlaced read side - do_interlace true,
|
||||
* in the progressive case this does actually make a difference
|
||||
* to the code used in the non-interlaced case too.
|
||||
*/
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo),
|
||||
0/*palette*/, PNG_INTERLACE_NONE, w, h, 0), 1/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
|
||||
# if CAN_WRITE_INTERLACE
|
||||
/* Validate the pngvalid code itself: */
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
PNG_INTERLACE_ADAM7, w, h, 1), 1/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
# if CAN_WRITE_INTERLACE
|
||||
/* Validate the pngvalid code itself: */
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo),
|
||||
0/*palette*/, PNG_INTERLACE_ADAM7, w, h, 1), 1/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5926,45 +5932,48 @@ test_size(png_modifier* const pm, png_byte const colour_type,
|
||||
{
|
||||
png_uint_32 h, w;
|
||||
|
||||
for (h=1; h<=16; h+=hinc[bdlo]) for (w=1; w<=16; w+=winc[bdlo])
|
||||
for (h=1; h<=16; h+=hinc[bdlo])
|
||||
{
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Test with pngvalid generated interlaced images first; we have
|
||||
* already verify these are ok (unless pngvalid has self-consistent
|
||||
* read/write errors, which is unlikely), so this detects errors in the
|
||||
* read side first:
|
||||
*/
|
||||
# if CAN_WRITE_INTERLACE
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
PNG_INTERLACE_ADAM7, w, h, 1), 0/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
for (w=1; w<=16; w+=winc[bdlo])
|
||||
{
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Test with pngvalid generated interlaced images first; we have
|
||||
* already verify these are ok (unless pngvalid has self-consistent
|
||||
* read/write errors, which is unlikely), so this detects errors in
|
||||
* the read side first:
|
||||
*/
|
||||
# if CAN_WRITE_INTERLACE
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo),
|
||||
0/*palette*/, PNG_INTERLACE_ADAM7, w, h, 1), 0/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
# endif /* READ_INTERLACING */
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
# endif /* READ_INTERLACING */
|
||||
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Test the libpng write side against the pngvalid read side: */
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
PNG_INTERLACE_ADAM7, w, h, 0), 1/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Test the libpng write side against the pngvalid read side: */
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo),
|
||||
0/*palette*/, PNG_INTERLACE_ADAM7, w, h, 0), 1/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Test both together: */
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
PNG_INTERLACE_ADAM7, w, h, 0), 0/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Test both together: */
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo),
|
||||
0/*palette*/, PNG_INTERLACE_ADAM7, w, h, 0), 0/*do_interlace*/,
|
||||
pm->use_update_info);
|
||||
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
# endif /* READ_INTERLACING */
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
# endif /* READ_INTERLACING */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6077,12 +6086,12 @@ image_pixel_init(image_pixel *this, png_const_bytep row, png_byte colour_type,
|
||||
png_byte bit_depth, png_uint_32 x, store_palette palette,
|
||||
const image_pixel *format /*from pngvalid transform of input*/)
|
||||
{
|
||||
const png_byte sample_depth = (png_byte)(colour_type ==
|
||||
PNG_COLOR_TYPE_PALETTE ? 8 : bit_depth);
|
||||
const unsigned int max = (1U<<sample_depth)-1;
|
||||
const int swap16 = (format != 0 && format->swap16);
|
||||
const int littleendian = (format != 0 && format->littleendian);
|
||||
const int sig_bits = (format != 0 && format->sig_bits);
|
||||
png_byte sample_depth =
|
||||
(png_byte)(colour_type == PNG_COLOR_TYPE_PALETTE ? 8 : bit_depth);
|
||||
unsigned int max = (1U<<sample_depth)-1;
|
||||
int swap16 = (format != 0 && format->swap16);
|
||||
int littleendian = (format != 0 && format->littleendian);
|
||||
int sig_bits = (format != 0 && format->sig_bits);
|
||||
|
||||
/* Initially just set everything to the same number and the alpha to opaque.
|
||||
* Note that this currently assumes a simple palette where entry x has colour
|
||||
@@ -6100,7 +6109,7 @@ image_pixel_init(image_pixel *this, png_const_bytep row, png_byte colour_type,
|
||||
/* This permits the caller to default to the sample value. */
|
||||
if (palette != 0)
|
||||
{
|
||||
const unsigned int i = this->palette_index;
|
||||
unsigned int i = this->palette_index;
|
||||
|
||||
this->red = palette[i].red;
|
||||
this->green = palette[i].green;
|
||||
@@ -6431,8 +6440,8 @@ static void
|
||||
image_transform_mod_end(const image_transform *this, image_pixel *that,
|
||||
png_const_structp pp, const transform_display *display)
|
||||
{
|
||||
const unsigned int scale = (1U<<that->sample_depth)-1;
|
||||
const int sig_bits = that->sig_bits;
|
||||
unsigned int scale = (1U<<that->sample_depth)-1;
|
||||
int sig_bits = that->sig_bits;
|
||||
|
||||
UNUSED(this)
|
||||
UNUSED(pp)
|
||||
@@ -6710,7 +6719,7 @@ transform_range_check(png_const_structp pp, unsigned int r, unsigned int g,
|
||||
unsigned int out, png_byte sample_depth, double err, double limit,
|
||||
const char *name, double digitization_error)
|
||||
{
|
||||
/* Compare the scaled, digitzed, values of our local calculation (in+-err)
|
||||
/* Compare the scaled, digitized, values of our local calculation (in+-err)
|
||||
* with the digitized values libpng produced; 'sample_depth' is the actual
|
||||
* digitization depth of the libpng output colors (the bit depth except for
|
||||
* palette images where it is always 8.) The check on 'err' is to detect
|
||||
@@ -6755,19 +6764,19 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
|
||||
{
|
||||
/* Constants for the loop below: */
|
||||
const png_store* const ps = dp->this.ps;
|
||||
const png_byte in_ct = dp->this.colour_type;
|
||||
const png_byte in_bd = dp->this.bit_depth;
|
||||
const png_uint_32 w = dp->this.w;
|
||||
const png_uint_32 h = dp->this.h;
|
||||
const png_byte out_ct = dp->output_colour_type;
|
||||
const png_byte out_bd = dp->output_bit_depth;
|
||||
const png_byte sample_depth = (png_byte)(out_ct ==
|
||||
PNG_COLOR_TYPE_PALETTE ? 8 : out_bd);
|
||||
const png_byte red_sBIT = dp->this.red_sBIT;
|
||||
const png_byte green_sBIT = dp->this.green_sBIT;
|
||||
const png_byte blue_sBIT = dp->this.blue_sBIT;
|
||||
const png_byte alpha_sBIT = dp->this.alpha_sBIT;
|
||||
const int have_tRNS = dp->this.is_transparent;
|
||||
png_byte in_ct = dp->this.colour_type;
|
||||
png_byte in_bd = dp->this.bit_depth;
|
||||
png_uint_32 w = dp->this.w;
|
||||
png_uint_32 h = dp->this.h;
|
||||
png_byte out_ct = dp->output_colour_type;
|
||||
png_byte out_bd = dp->output_bit_depth;
|
||||
png_byte sample_depth =
|
||||
(png_byte)(out_ct == PNG_COLOR_TYPE_PALETTE ? 8 : out_bd);
|
||||
png_byte red_sBIT = dp->this.red_sBIT;
|
||||
png_byte green_sBIT = dp->this.green_sBIT;
|
||||
png_byte blue_sBIT = dp->this.blue_sBIT;
|
||||
png_byte alpha_sBIT = dp->this.alpha_sBIT;
|
||||
int have_tRNS = dp->this.is_transparent;
|
||||
double digitization_error;
|
||||
|
||||
store_palette out_palette;
|
||||
@@ -6928,7 +6937,7 @@ transform_end(png_structp ppIn, png_infop pi)
|
||||
|
||||
/* A single test run. */
|
||||
static void
|
||||
transform_test(png_modifier *pmIn, const png_uint_32 idIn,
|
||||
transform_test(png_modifier *pmIn, png_uint_32 idIn,
|
||||
const image_transform* transform_listIn, const char * const name)
|
||||
{
|
||||
transform_display d;
|
||||
@@ -7634,7 +7643,7 @@ image_transform_png_set_rgb_to_gray_ini(const image_transform *this,
|
||||
|
||||
else
|
||||
{
|
||||
/* The default (built in) coeffcients, as above: */
|
||||
/* The default (built in) coefficients, as above: */
|
||||
# if PNG_LIBPNG_VER < 10700
|
||||
data.red_coefficient = 6968 / 32768.;
|
||||
data.green_coefficient = 23434 / 32768.;
|
||||
@@ -7763,7 +7772,7 @@ static void
|
||||
image_transform_png_set_rgb_to_gray_set(const image_transform *this,
|
||||
transform_display *that, png_structp pp, png_infop pi)
|
||||
{
|
||||
const int error_action = 1; /* no error, no defines in png.h */
|
||||
int error_action = 1; /* no error, no defines in png.h */
|
||||
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
png_set_rgb_to_gray(pp, error_action, data.red_to_set, data.green_to_set);
|
||||
@@ -7904,10 +7913,10 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
# if DIGITIZE
|
||||
{
|
||||
png_modifier *pm = display->pm;
|
||||
const unsigned int sample_depth = that->sample_depth;
|
||||
const unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
|
||||
unsigned int sample_depth = that->sample_depth;
|
||||
unsigned int calc_depth = (pm->assume_16_bit_calculations ? 16 :
|
||||
sample_depth);
|
||||
const unsigned int gamma_depth =
|
||||
unsigned int gamma_depth =
|
||||
(sample_depth == 16 ?
|
||||
display->max_gamma_8 :
|
||||
(pm->assume_16_bit_calculations ?
|
||||
@@ -8001,7 +8010,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
b * data.blue_coefficient;
|
||||
|
||||
{
|
||||
const int do_round = data.gamma != 1 || calc_depth == 16;
|
||||
int do_round = data.gamma != 1 || calc_depth == 16;
|
||||
const double ce = 2. / 32768;
|
||||
|
||||
graylo = DD(rlo * (data.red_coefficient-ce) +
|
||||
@@ -8625,7 +8634,7 @@ image_transform_png_set_filler_mod(const image_transform *this,
|
||||
(that->colour_type == PNG_COLOR_TYPE_RGB ||
|
||||
that->colour_type == PNG_COLOR_TYPE_GRAY))
|
||||
{
|
||||
const unsigned int max = (1U << that->bit_depth)-1;
|
||||
unsigned int max = (1U << that->bit_depth)-1;
|
||||
that->alpha = data.filler & max;
|
||||
that->alphaf = ((double)that->alpha) / max;
|
||||
that->alphae = 0;
|
||||
@@ -8692,7 +8701,7 @@ image_transform_png_set_add_alpha_mod(const image_transform *this,
|
||||
(that->colour_type == PNG_COLOR_TYPE_RGB ||
|
||||
that->colour_type == PNG_COLOR_TYPE_GRAY))
|
||||
{
|
||||
const unsigned int max = (1U << that->bit_depth)-1;
|
||||
unsigned int max = (1U << that->bit_depth)-1;
|
||||
that->alpha = data.filler & max;
|
||||
that->alphaf = ((double)that->alpha) / max;
|
||||
that->alphae = 0;
|
||||
@@ -8883,7 +8892,7 @@ image_transform_png_set_shift_set(const image_transform *this,
|
||||
* field is randomized independently. This acts as a check that
|
||||
* libpng does use the correct field.
|
||||
*/
|
||||
const unsigned int depth = that->this.bit_depth;
|
||||
unsigned int depth = that->this.bit_depth;
|
||||
|
||||
data.red = (png_byte)/*SAFE*/(random_mod(depth)+1);
|
||||
data.green = (png_byte)/*SAFE*/(random_mod(depth)+1);
|
||||
@@ -9056,7 +9065,7 @@ image_transform_reset_count(void)
|
||||
static int
|
||||
image_transform_test_counter(png_uint_32 counter, unsigned int max)
|
||||
{
|
||||
/* Test the list to see if there is any point contining, given a current
|
||||
/* Test the list to see if there is any point continuing, given a current
|
||||
* counter and a 'max' value.
|
||||
*/
|
||||
image_transform *next = image_transform_first;
|
||||
@@ -9298,12 +9307,12 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
|
||||
int mode = dp->do_background - ALPHA_MODE_OFFSET;
|
||||
|
||||
/* The gamma value is the output gamma, and is in the standard,
|
||||
* non-inverted, represenation. It provides a default for the PNG file
|
||||
* non-inverted, representation. It provides a default for the PNG file
|
||||
* gamma, but since the file has a gAMA chunk this does not matter.
|
||||
*/
|
||||
const double sg = dp->screen_gamma;
|
||||
# ifndef PNG_FLOATING_POINT_SUPPORTED
|
||||
const png_fixed_point g = fix(sg);
|
||||
png_fixed_point g = fix(sg);
|
||||
# endif
|
||||
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
@@ -9351,7 +9360,7 @@ gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
|
||||
*/
|
||||
const double bg = dp->background_gamma;
|
||||
# ifndef PNG_FLOATING_POINT_SUPPORTED
|
||||
const png_fixed_point g = fix(bg);
|
||||
png_fixed_point g = fix(bg);
|
||||
# endif
|
||||
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
@@ -9425,7 +9434,7 @@ static void
|
||||
init_validate_info(validate_info *vi, gamma_display *dp, png_const_structp pp,
|
||||
int in_depth, int out_depth)
|
||||
{
|
||||
const unsigned int outmax = (1U<<out_depth)-1;
|
||||
unsigned int outmax = (1U<<out_depth)-1;
|
||||
|
||||
vi->pp = pp;
|
||||
vi->dp = dp;
|
||||
@@ -9587,14 +9596,14 @@ gamma_component_compose(int do_background, double input_sample, double alpha,
|
||||
/* This API returns the encoded *input* component, in the range 0..1 */
|
||||
static double
|
||||
gamma_component_validate(const char *name, const validate_info *vi,
|
||||
const unsigned int id, const unsigned int od,
|
||||
unsigned int id, unsigned int od,
|
||||
const double alpha /* <0 for the alpha channel itself */,
|
||||
const double background /* component background value */)
|
||||
{
|
||||
const unsigned int isbit = id >> vi->isbit_shift;
|
||||
const unsigned int sbit_max = vi->sbit_max;
|
||||
const unsigned int outmax = vi->outmax;
|
||||
const int do_background = vi->do_background;
|
||||
unsigned int isbit = id >> vi->isbit_shift;
|
||||
unsigned int sbit_max = vi->sbit_max;
|
||||
unsigned int outmax = vi->outmax;
|
||||
int do_background = vi->do_background;
|
||||
|
||||
double i;
|
||||
|
||||
@@ -10160,13 +10169,13 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
{
|
||||
/* Get some constants derived from the input and output file formats: */
|
||||
const png_store* const ps = dp->this.ps;
|
||||
const png_byte in_ct = dp->this.colour_type;
|
||||
const png_byte in_bd = dp->this.bit_depth;
|
||||
const png_uint_32 w = dp->this.w;
|
||||
const png_uint_32 h = dp->this.h;
|
||||
png_byte in_ct = dp->this.colour_type;
|
||||
png_byte in_bd = dp->this.bit_depth;
|
||||
png_uint_32 w = dp->this.w;
|
||||
png_uint_32 h = dp->this.h;
|
||||
const size_t cbRow = dp->this.cbRow;
|
||||
const png_byte out_ct = png_get_color_type(pp, pi);
|
||||
const png_byte out_bd = png_get_bit_depth(pp, pi);
|
||||
png_byte out_ct = png_get_color_type(pp, pi);
|
||||
png_byte out_bd = png_get_bit_depth(pp, pi);
|
||||
|
||||
/* There are three sources of error, firstly the quantization in the
|
||||
* file encoding, determined by sbit and/or the file depth, secondly
|
||||
@@ -10207,11 +10216,11 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
* The basic tests below do not do this, however if 'use_input_precision'
|
||||
* is set a subsequent test is performed above.
|
||||
*/
|
||||
const unsigned int samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
|
||||
unsigned int samples_per_pixel = (out_ct & 2U) ? 3U : 1U;
|
||||
int processing;
|
||||
png_uint_32 y;
|
||||
const store_palette_entry *in_palette = dp->this.palette;
|
||||
const int in_is_transparent = dp->this.is_transparent;
|
||||
int in_is_transparent = dp->this.is_transparent;
|
||||
int process_tRNS;
|
||||
int out_npalette = -1;
|
||||
int out_is_transparent = 0; /* Just refers to the palette case */
|
||||
@@ -10259,9 +10268,9 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
double alpha = 1; /* serves as a flag value */
|
||||
|
||||
/* Record the palette index for index images. */
|
||||
const unsigned int in_index =
|
||||
unsigned int in_index =
|
||||
in_ct == 3 ? sample(std, 3, in_bd, x, 0, 0, 0) : 256;
|
||||
const unsigned int out_index =
|
||||
unsigned int out_index =
|
||||
out_ct == 3 ? sample(std, 3, out_bd, x, 0, 0, 0) : 256;
|
||||
|
||||
/* Handle input alpha - png_set_background will cause the output
|
||||
@@ -10270,7 +10279,7 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
if ((in_ct & PNG_COLOR_MASK_ALPHA) != 0 ||
|
||||
(in_ct == 3 && in_is_transparent))
|
||||
{
|
||||
const unsigned int input_alpha = in_ct == 3 ?
|
||||
unsigned int input_alpha = in_ct == 3 ?
|
||||
dp->this.palette[in_index].alpha :
|
||||
sample(std, in_ct, in_bd, x, samples_per_pixel, 0, 0);
|
||||
|
||||
@@ -10395,14 +10404,14 @@ gamma_end(png_structp ppIn, png_infop pi)
|
||||
* maxpc: maximum percentage error (as a percentage)
|
||||
*/
|
||||
static void
|
||||
gamma_test(png_modifier *pmIn, const png_byte colour_typeIn,
|
||||
const png_byte bit_depthIn, const int palette_numberIn,
|
||||
const int interlace_typeIn,
|
||||
gamma_test(png_modifier *pmIn, png_byte colour_typeIn,
|
||||
png_byte bit_depthIn, int palette_numberIn,
|
||||
int interlace_typeIn,
|
||||
const double file_gammaIn, const double screen_gammaIn,
|
||||
const png_byte sbitIn, const int threshold_testIn,
|
||||
png_byte sbitIn, int threshold_testIn,
|
||||
const char *name,
|
||||
const int use_input_precisionIn, const int scale16In,
|
||||
const int expand16In, const int do_backgroundIn,
|
||||
int use_input_precisionIn, int scale16In,
|
||||
int expand16In, int do_backgroundIn,
|
||||
const png_color_16 *bkgd_colorIn, double bkgd_gammaIn)
|
||||
{
|
||||
gamma_display d;
|
||||
@@ -10606,11 +10615,11 @@ perform_gamma_threshold_tests(png_modifier *pm)
|
||||
}
|
||||
|
||||
static void gamma_transform_test(png_modifier *pm,
|
||||
const png_byte colour_type, const png_byte bit_depth,
|
||||
const int palette_number,
|
||||
const int interlace_type, const double file_gamma,
|
||||
const double screen_gamma, const png_byte sbit,
|
||||
const int use_input_precision, const int scale16)
|
||||
png_byte colour_type, png_byte bit_depth,
|
||||
int palette_number,
|
||||
int interlace_type, const double file_gamma,
|
||||
const double screen_gamma, png_byte sbit,
|
||||
int use_input_precision, int scale16)
|
||||
{
|
||||
size_t pos = 0;
|
||||
char name[64];
|
||||
@@ -10648,16 +10657,21 @@ static void perform_gamma_transform_tests(png_modifier *pm)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
for (i=0; i<pm->ngamma_tests; ++i) for (j=0; j<pm->ngamma_tests; ++j)
|
||||
if (i != j)
|
||||
for (i=0; i<pm->ngamma_tests; ++i)
|
||||
{
|
||||
for (j=0; j<pm->ngamma_tests; ++j)
|
||||
{
|
||||
gamma_transform_test(pm, colour_type, bit_depth, palette_number,
|
||||
pm->interlace_type, 1/pm->gammas[i], pm->gammas[j], 0/*sBIT*/,
|
||||
pm->use_input_precision, 0 /*do not scale16*/);
|
||||
if (i != j)
|
||||
{
|
||||
gamma_transform_test(pm, colour_type, bit_depth, palette_number,
|
||||
pm->interlace_type, 1/pm->gammas[i], pm->gammas[j],
|
||||
0/*sBIT*/, pm->use_input_precision, 0/*do not scale16*/);
|
||||
|
||||
if (fail(pm))
|
||||
return;
|
||||
if (fail(pm))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10686,14 +10700,17 @@ static void perform_gamma_sbit_tests(png_modifier *pm)
|
||||
{
|
||||
unsigned int j;
|
||||
|
||||
for (j=0; j<pm->ngamma_tests; ++j) if (i != j)
|
||||
for (j=0; j<pm->ngamma_tests; ++j)
|
||||
{
|
||||
gamma_transform_test(pm, colour_type, bit_depth, npalette,
|
||||
pm->interlace_type, 1/pm->gammas[i], pm->gammas[j],
|
||||
sbit, pm->use_input_precision_sbit, 0 /*scale16*/);
|
||||
if (i != j)
|
||||
{
|
||||
gamma_transform_test(pm, colour_type, bit_depth, npalette,
|
||||
pm->interlace_type, 1/pm->gammas[i], pm->gammas[j],
|
||||
sbit, pm->use_input_precision_sbit, 0 /*scale16*/);
|
||||
|
||||
if (fail(pm))
|
||||
return;
|
||||
if (fail(pm))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10767,12 +10784,12 @@ static void perform_gamma_scale16_tests(png_modifier *pm)
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
static void gamma_composition_test(png_modifier *pm,
|
||||
const png_byte colour_type, const png_byte bit_depth,
|
||||
const int palette_number,
|
||||
const int interlace_type, const double file_gamma,
|
||||
png_byte colour_type, png_byte bit_depth,
|
||||
int palette_number,
|
||||
int interlace_type, const double file_gamma,
|
||||
const double screen_gamma,
|
||||
const int use_input_precision, const int do_background,
|
||||
const int expand_16)
|
||||
int use_input_precision, int do_background,
|
||||
int expand_16)
|
||||
{
|
||||
size_t pos = 0;
|
||||
png_const_charp base;
|
||||
@@ -10945,14 +10962,17 @@ perform_gamma_composition_tests(png_modifier *pm, int do_background,
|
||||
unsigned int i, j;
|
||||
|
||||
/* Don't skip the i==j case here - it's relevant. */
|
||||
for (i=0; i<pm->ngamma_tests; ++i) for (j=0; j<pm->ngamma_tests; ++j)
|
||||
for (i=0; i<pm->ngamma_tests; ++i)
|
||||
{
|
||||
gamma_composition_test(pm, colour_type, bit_depth, palette_number,
|
||||
pm->interlace_type, 1/pm->gammas[i], pm->gammas[j],
|
||||
pm->use_input_precision, do_background, expand_16);
|
||||
for (j=0; j<pm->ngamma_tests; ++j)
|
||||
{
|
||||
gamma_composition_test(pm, colour_type, bit_depth, palette_number,
|
||||
pm->interlace_type, 1/pm->gammas[i], pm->gammas[j],
|
||||
pm->use_input_precision, do_background, expand_16);
|
||||
|
||||
if (fail(pm))
|
||||
return;
|
||||
if (fail(pm))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11055,7 +11075,7 @@ perform_gamma_test(png_modifier *pm, int summary)
|
||||
pm->calculations_use_input_precision = 0;
|
||||
|
||||
if (summary)
|
||||
summarize_gamma_errors(pm, 0/*who*/, 1/*low bit depth*/, 1/*indexed*/);
|
||||
summarize_gamma_errors(pm, NULL/*who*/, 1/*low bit depth*/, 1/*indexed*/);
|
||||
|
||||
if (fail(pm))
|
||||
return;
|
||||
@@ -11181,8 +11201,10 @@ png_pass_start_row(int pass)
|
||||
{
|
||||
int x, y;
|
||||
++pass;
|
||||
for (y=0; y<8; ++y) for (x=0; x<8; ++x) if (adam7[y][x] == pass)
|
||||
return y;
|
||||
for (y=0; y<8; ++y)
|
||||
for (x=0; x<8; ++x)
|
||||
if (adam7[y][x] == pass)
|
||||
return y;
|
||||
return 0xf;
|
||||
}
|
||||
|
||||
@@ -11191,8 +11213,10 @@ png_pass_start_col(int pass)
|
||||
{
|
||||
int x, y;
|
||||
++pass;
|
||||
for (x=0; x<8; ++x) for (y=0; y<8; ++y) if (adam7[y][x] == pass)
|
||||
return x;
|
||||
for (x=0; x<8; ++x)
|
||||
for (y=0; y<8; ++y)
|
||||
if (adam7[y][x] == pass)
|
||||
return x;
|
||||
return 0xf;
|
||||
}
|
||||
|
||||
@@ -11201,18 +11225,24 @@ png_pass_row_shift(int pass)
|
||||
{
|
||||
int x, y, base=(-1), inc=8;
|
||||
++pass;
|
||||
for (y=0; y<8; ++y) for (x=0; x<8; ++x) if (adam7[y][x] == pass)
|
||||
for (y=0; y<8; ++y)
|
||||
{
|
||||
if (base == (-1))
|
||||
base = y;
|
||||
else if (base == y)
|
||||
{}
|
||||
else if (inc == y-base)
|
||||
base=y;
|
||||
else if (inc == 8)
|
||||
inc = y-base, base=y;
|
||||
else if (inc != y-base)
|
||||
return 0xff; /* error - more than one 'inc' value! */
|
||||
for (x=0; x<8; ++x)
|
||||
{
|
||||
if (adam7[y][x] == pass)
|
||||
{
|
||||
if (base == (-1))
|
||||
base = y;
|
||||
else if (base == y)
|
||||
{}
|
||||
else if (inc == y-base)
|
||||
base=y;
|
||||
else if (inc == 8)
|
||||
inc = y-base, base=y;
|
||||
else if (inc != y-base)
|
||||
return 0xff; /* error - more than one 'inc' value! */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (base == (-1)) return 0xfe; /* error - no row in pass! */
|
||||
@@ -11235,18 +11265,24 @@ png_pass_col_shift(int pass)
|
||||
{
|
||||
int x, y, base=(-1), inc=8;
|
||||
++pass;
|
||||
for (x=0; x<8; ++x) for (y=0; y<8; ++y) if (adam7[y][x] == pass)
|
||||
for (x=0; x<8; ++x)
|
||||
{
|
||||
if (base == (-1))
|
||||
base = x;
|
||||
else if (base == x)
|
||||
{}
|
||||
else if (inc == x-base)
|
||||
base=x;
|
||||
else if (inc == 8)
|
||||
inc = x-base, base=x;
|
||||
else if (inc != x-base)
|
||||
return 0xff; /* error - more than one 'inc' value! */
|
||||
for (y=0; y<8; ++y)
|
||||
{
|
||||
if (adam7[y][x] == pass)
|
||||
{
|
||||
if (base == (-1))
|
||||
base = x;
|
||||
else if (base == x)
|
||||
{}
|
||||
else if (inc == x-base)
|
||||
base=x;
|
||||
else if (inc == 8)
|
||||
inc = x-base, base=x;
|
||||
else if (inc != x-base)
|
||||
return 0xff; /* error - more than one 'inc' value! */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (base == (-1)) return 0xfe; /* error - no row in pass! */
|
||||
@@ -11310,8 +11346,9 @@ png_row_in_interlace_pass(png_uint_32 y, int pass)
|
||||
int x;
|
||||
y &= 7;
|
||||
++pass;
|
||||
for (x=0; x<8; ++x) if (adam7[y][x] == pass)
|
||||
return 1;
|
||||
for (x=0; x<8; ++x)
|
||||
if (adam7[y][x] == pass)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -11323,8 +11360,9 @@ png_col_in_interlace_pass(png_uint_32 x, int pass)
|
||||
int y;
|
||||
x &= 7;
|
||||
++pass;
|
||||
for (y=0; y<8; ++y) if (adam7[y][x] == pass)
|
||||
return 1;
|
||||
for (y=0; y<8; ++y)
|
||||
if (adam7[y][x] == pass)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -11338,11 +11376,17 @@ png_pass_rows(png_uint_32 height, int pass)
|
||||
|
||||
height &= 7;
|
||||
++pass;
|
||||
for (y=0; y<8; ++y) for (x=0; x<8; ++x) if (adam7[y][x] == pass)
|
||||
for (y=0; y<8; ++y)
|
||||
{
|
||||
rows += tiles;
|
||||
if (y < height) ++rows;
|
||||
break; /* i.e. break the 'x', column, loop. */
|
||||
for (x=0; x<8; ++x)
|
||||
{
|
||||
if (adam7[y][x] == pass)
|
||||
{
|
||||
rows += tiles;
|
||||
if (y < height) ++rows;
|
||||
break; /* i.e. break the 'x', column, loop. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rows;
|
||||
@@ -11357,11 +11401,17 @@ png_pass_cols(png_uint_32 width, int pass)
|
||||
|
||||
width &= 7;
|
||||
++pass;
|
||||
for (x=0; x<8; ++x) for (y=0; y<8; ++y) if (adam7[y][x] == pass)
|
||||
for (x=0; x<8; ++x)
|
||||
{
|
||||
cols += tiles;
|
||||
if (x < width) ++cols;
|
||||
break; /* i.e. break the 'y', row, loop. */
|
||||
for (y=0; y<8; ++y)
|
||||
{
|
||||
if (adam7[y][x] == pass)
|
||||
{
|
||||
cols += tiles;
|
||||
if (x < width) ++cols;
|
||||
break; /* i.e. break the 'y', row, loop. */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cols;
|
||||
@@ -11718,7 +11768,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* The following allows results to pass if they correspond to anything in the
|
||||
* transformed range [input-.5,input+.5]; this is is required because of the
|
||||
* way libpng treates the 16_TO_8 flag when building the gamma tables in
|
||||
* way libpng treats the 16_TO_8 flag when building the gamma tables in
|
||||
* releases up to 1.6.0.
|
||||
*
|
||||
* TODO: review this
|
||||
@@ -11809,21 +11859,21 @@ int main(int argc, char **argv)
|
||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||
else if (strncmp(*argv, "--transform-disable=",
|
||||
sizeof "--transform-disable") == 0)
|
||||
{
|
||||
{
|
||||
pm.test_transform = 1;
|
||||
transform_disable(*argv + sizeof "--transform-disable");
|
||||
}
|
||||
}
|
||||
|
||||
else if (strncmp(*argv, "--transform-enable=",
|
||||
sizeof "--transform-enable") == 0)
|
||||
{
|
||||
{
|
||||
pm.test_transform = 1;
|
||||
transform_enable(*argv + sizeof "--transform-enable");
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
|
||||
|
||||
else if (strcmp(*argv, "--gamma") == 0)
|
||||
{
|
||||
{
|
||||
/* Just do two gamma tests here (2.2 and linear) for speed: */
|
||||
pm.ngamma_tests = 2U;
|
||||
pm.test_gamma_threshold = 1;
|
||||
@@ -11832,7 +11882,7 @@ int main(int argc, char **argv)
|
||||
pm.test_gamma_scale16 = 1;
|
||||
pm.test_gamma_background = 1; /* composition */
|
||||
pm.test_gamma_alpha_mode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
else if (strcmp(*argv, "--nogamma") == 0)
|
||||
pm.ngamma_tests = 0;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
/* readpng.c
|
||||
*
|
||||
* Copyright (c) 2013 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
|
||||
/* tarith.c
|
||||
*
|
||||
* Copyright (c) 2021 Cosmin Truta
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
@@ -88,6 +87,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
int minorarith = 0;
|
||||
|
||||
while (--argc > 0)
|
||||
{
|
||||
if (strcmp(*++argv, "-a") == 0)
|
||||
showall = 1;
|
||||
else if (strcmp(*argv, "-e") == 0 && argc > 0)
|
||||
@@ -105,6 +105,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
fprintf(stderr, "unknown argument %s\n", *argv);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
@@ -130,8 +131,8 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
*/
|
||||
if (buffer[precision+7] != 71)
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s'[%lu] buffer overflow\n", test,
|
||||
precision, buffer, (unsigned long)strlen(buffer));
|
||||
fprintf(stderr, "%g[%d] -> '%s'[%lu] buffer overflow\n",
|
||||
test, precision, buffer, (unsigned long)strlen(buffer));
|
||||
failed = 1;
|
||||
}
|
||||
|
||||
@@ -146,16 +147,16 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
if (test >= 0 && strcmp(buffer, "inf") ||
|
||||
test < 0 && strcmp(buffer, "-inf"))
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s' but expected 'inf'\n", test,
|
||||
precision, buffer);
|
||||
fprintf(stderr, "%g[%d] -> '%s' but expected 'inf'\n",
|
||||
test, precision, buffer);
|
||||
failed = 1;
|
||||
}
|
||||
}
|
||||
else if (!png_check_fp_number(buffer, precision+10, &state, &index) ||
|
||||
buffer[index] != 0)
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s' but has bad format ('%c')\n", test,
|
||||
precision, buffer, buffer[index]);
|
||||
fprintf(stderr, "%g[%d] -> '%s' but has bad format ('%c')\n",
|
||||
test, precision, buffer, buffer[index]);
|
||||
failed = 1;
|
||||
}
|
||||
else if (PNG_FP_IS_NEGATIVE(state) && !(test < 0))
|
||||
@@ -187,7 +188,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
/* Check the result against the original. */
|
||||
double out = atof(buffer);
|
||||
double change = fabs((out - test)/test);
|
||||
double allow = .5/pow(10,
|
||||
double allow = .5 / pow(10,
|
||||
(precision >= DBL_DIG) ? DBL_DIG-1 : precision-1);
|
||||
|
||||
/* NOTE: if you hit this error case are you compiling with gcc
|
||||
@@ -257,8 +258,9 @@ skip:
|
||||
}
|
||||
while (--count);
|
||||
|
||||
printf("Tested %d finite values, %d non-finite, %d OK (%d failed) %d minor "
|
||||
"arithmetic errors\n", finite, nonfinite, ok, failcount, minorarith);
|
||||
printf("Tested %d finite values, %d non-finite, %d OK (%d failed) "
|
||||
"%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);
|
||||
|
||||
@@ -331,8 +333,8 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
|
||||
*/
|
||||
size_t index = 0;
|
||||
const char test = (char)ch;
|
||||
const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
||||
const int character_accepted = (index == 1);
|
||||
int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
||||
int character_accepted = (index == 1);
|
||||
|
||||
if (c.check_state != exponent && isdigit(ch) && ch != '0')
|
||||
c.is_zero = 0;
|
||||
@@ -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): */
|
||||
if (index != 0 && index != 1)
|
||||
{
|
||||
fprintf(stderr, "%s: read beyond end of string (%lu)\n", co->number,
|
||||
(unsigned long)index);
|
||||
fprintf(stderr, "%s: read beyond end of string (%lu)\n",
|
||||
co->number, (unsigned long)index);
|
||||
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)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: character '%c' [0x%.2x] changed number validity\n", co->number,
|
||||
ch, ch);
|
||||
"%s: character '%c' [0x%.2x] changed number validity\n",
|
||||
co->number, ch, ch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -521,10 +523,13 @@ static int check_all_characters(checkfp_command *co, checkfp_control c)
|
||||
{
|
||||
int ch;
|
||||
|
||||
if (c.cnumber+4 < sizeof co->number) for (ch=0; ch<256; ++ch)
|
||||
if (c.cnumber+4 < sizeof co->number)
|
||||
{
|
||||
if (!check_one_character(co, c, ch))
|
||||
return 0;
|
||||
for (ch=0; ch<256; ++ch)
|
||||
{
|
||||
if (!check_one_character(co, c, ch))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -539,10 +544,13 @@ static int check_some_characters(checkfp_command *co, checkfp_control c,
|
||||
|
||||
if (c.cnumber+4 < sizeof co->number && c.limit >= 0)
|
||||
{
|
||||
if (c.limit > 0) for (i=0; tests[i]; ++i)
|
||||
if (c.limit > 0)
|
||||
{
|
||||
if (!check_one_character(co, c, tests[i]))
|
||||
return 0;
|
||||
for (i=0; tests[i]; ++i)
|
||||
{
|
||||
if (!check_one_character(co, c, tests[i]))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* At the end check all the characters. */
|
||||
@@ -616,10 +624,10 @@ int validation_muldiv(int count, int argc, char **argv)
|
||||
png_int_32 times, div;
|
||||
|
||||
while (--argc > 0)
|
||||
{
|
||||
fprintf(stderr, "unknown argument %s\n", *++argv);
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
fprintf(stderr, "unknown argument %s\n", *++argv);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Find out about the random number generator. */
|
||||
randbuffer = RAND_MAX;
|
||||
@@ -687,25 +695,25 @@ int validation_muldiv(int count, int argc, char **argv)
|
||||
ok = 0, ++overflow, fpround = fp/*misleading*/;
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "TEST %d * %d / %d -> %lld (%s)\n", a, times, div,
|
||||
fp, ok ? "ok" : "overflow");
|
||||
fprintf(stderr, "TEST %d * %d / %d -> %lld (%s)\n",
|
||||
a, times, div, fp, ok ? "ok" : "overflow");
|
||||
|
||||
++tested;
|
||||
if (png_muldiv(&result, a, times, div) != ok)
|
||||
{
|
||||
++error;
|
||||
if (ok)
|
||||
fprintf(stderr, "%d * %d / %d -> overflow (expected %lld)\n", a,
|
||||
times, div, fp);
|
||||
fprintf(stderr, "%d * %d / %d -> overflow (expected %lld)\n",
|
||||
a, times, div, fp);
|
||||
else
|
||||
fprintf(stderr, "%d * %d / %d -> %d (expected overflow %lld)\n", a,
|
||||
times, div, result, fp);
|
||||
fprintf(stderr, "%d * %d / %d -> %d (expected overflow %lld)\n",
|
||||
a, times, div, result, fp);
|
||||
}
|
||||
else if (ok && result != fpround)
|
||||
{
|
||||
++error;
|
||||
fprintf(stderr, "%d * %d / %d -> %d not %lld\n", a, times, div, result,
|
||||
fp);
|
||||
fprintf(stderr, "%d * %d / %d -> %d not %lld\n",
|
||||
a, times, div, result, fp);
|
||||
}
|
||||
else
|
||||
++passed;
|
||||
@@ -721,8 +729,8 @@ int validation_muldiv(int count, int argc, char **argv)
|
||||
}
|
||||
while (--count > 0);
|
||||
|
||||
printf("%d tests including %d overflows, %d passed, %d failed (%d 64-bit "
|
||||
"errors)\n", tested, overflow, passed, error, error64);
|
||||
printf("%d tests including %d overflows, %d passed, %d failed "
|
||||
"(%d 64-bit errors)\n", tested, overflow, passed, error, error64);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -821,8 +829,9 @@ int validation_gamma(int argc, char **argv)
|
||||
{
|
||||
if (error > .68) /* By experiment error is less than .68 */
|
||||
{
|
||||
fprintf(stderr, "16-bit log error: %d: got %u, expected %f"
|
||||
" error: %f\n", i, png_log16bit(i), correct, error);
|
||||
fprintf(stderr,
|
||||
"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);
|
||||
if (fabs(error) > 1883) /* By experiment. */
|
||||
{
|
||||
fprintf(stderr, "32-bit exp error: %d: got %u, expected %f"
|
||||
" error: %f\n", i, png_exp(i), correct, error);
|
||||
fprintf(stderr,
|
||||
"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);
|
||||
if (fabs(error) > .50002) /* By experiment */
|
||||
{
|
||||
fprintf(stderr, "8-bit exp error: %d: got %u, expected %f"
|
||||
" error: %f\n", i, png_exp8bit(i), correct, error);
|
||||
fprintf(stderr,
|
||||
"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);
|
||||
if (fabs(error) > .524) /* By experiment */
|
||||
{
|
||||
fprintf(stderr, "16-bit exp error: %d: got %u, expected %f"
|
||||
" error: %f\n", i, png_exp16bit(i), correct, error);
|
||||
fprintf(stderr,
|
||||
"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 ********************************/
|
||||
/* 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
|
||||
* 2: validates png_muldiv
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
|
||||
/* timepng.c
|
||||
*
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
@@ -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];
|
||||
|
||||
|
||||
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
|
||||
*
|
||||
* Copyright (c) 2020-2023 Cosmin Truta
|
||||
* Copyright (c) 2016 Glenn Randers-Pehrson
|
||||
* 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.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* 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
|
||||
* BUG REPORTS: png-mng-implement@sourceforge.net
|
||||
*
|
||||
* png_have_msa implemented for Linux by reading the widely available
|
||||
* pseudo-file /proc/cpuinfo.
|
||||
*
|
||||
* This code is strict ANSI-C and is probably moderately portable; it does
|
||||
* however use <stdio.h> and it assumes that /proc/cpuinfo is never localized.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <elf.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int
|
||||
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";
|
||||
char word[10];
|
||||
|
||||
if (f != NULL)
|
||||
fd = open("/proc/self/auxv", O_RDONLY);
|
||||
if (fd >= 0)
|
||||
{
|
||||
while(!feof(f))
|
||||
while (read(fd, &aux, sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t))
|
||||
{
|
||||
int ch = fgetc(f);
|
||||
static int i = 0;
|
||||
|
||||
while(!(ch <= 32))
|
||||
if (aux.a_type == AT_HWCAP)
|
||||
{
|
||||
word[i++] = ch;
|
||||
ch = fgetc(f);
|
||||
uint64_t hwcap = aux.a_un.a_val;
|
||||
|
||||
has_msa = (hwcap >> 1) & 1;
|
||||
break;
|
||||
}
|
||||
|
||||
int val = strcmp(string, word);
|
||||
|
||||
if (val == 0)
|
||||
return 1;
|
||||
|
||||
i = 0;
|
||||
memset(word, 0, 10);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
close(fd);
|
||||
}
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
else
|
||||
png_warning(png_ptr, "/proc/cpuinfo open failed");
|
||||
png_warning(png_ptr, "/proc/self/auxv open failed");
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
return has_msa;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
Copyright (c) 2017 Glenn Randers-Pehrson
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
# Copyright 2017-2018 Glenn Randers-Pehrson
|
||||
# Copyright 2016 Google Inc.
|
||||
#
|
||||
@@ -14,8 +15,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
#
|
||||
# Revisions by Glenn Randers-Pehrson, 2017:
|
||||
# 1. Build only the library, not the tools (changed "make -j$(nproc) all" to
|
||||
# "make -j$(nproc) libpng16.la").
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that may
|
||||
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
|
||||
|
||||
// Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
|
||||
// The modifications in 2017 by Glenn Randers-Pehrson include
|
||||
// 1. addition of a PNG_CLEANUP macro,
|
||||
// 2. setting the option to ignore ADLER32 checksums,
|
||||
@@ -17,6 +15,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <vector>
|
||||
@@ -60,7 +59,7 @@ struct PngObjectHandler {
|
||||
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)
|
||||
else if (info_ptr)
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||
else
|
||||
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
|
||||
@@ -78,6 +77,22 @@ void user_read_data(png_structp png_ptr, png_bytep data, size_t 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.
|
||||
@@ -118,6 +133,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
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);
|
||||
|
||||
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
|
||||
--------
|
||||
(copyright Willem van Schaik, 1999)
|
||||
(copyright Willem van Schaik, 1999-2019)
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and
|
||||
that both that copyright notice and this permission notice appear in
|
||||
supporting documentation. This software is provided "as is" without
|
||||
express or implied warranty.
|
||||
|
||||
|
||||
Some history
|
||||
------------
|
||||
Soon after the creation of PNG in 1995, the need was felt for a set of
|
||||
pnmtopng / pngtopnm utilities. Independently Alexander Lehmann and I
|
||||
(Willem van Schaik) started such a project. Luckily we discovered this
|
||||
and merged the two together into pnmtopng.tar.gz, which is available
|
||||
from a/o ftp://ftp.simplesystems.org/pub/libpng/png/.
|
||||
and merged the two, which later became part of NetPBM, available from
|
||||
SourceForge.
|
||||
|
||||
These two utilities have many, many options and make use of most of the
|
||||
features of PNG, like gamma, alpha, sbit, text-chunks, etc. This makes
|
||||
@@ -35,8 +25,8 @@ makes the whole setup a bit bulky. But that's unavoidable given the many
|
||||
features of pnmtopng.
|
||||
|
||||
|
||||
What now
|
||||
--------
|
||||
What now (1999)
|
||||
---------------
|
||||
At this moment libpng is in a very stable state and can do much of the
|
||||
work done in pnmtopng. Also, pnmtopng needs to be upgraded to the new
|
||||
interface of libpng. Hence, it is time for a rewrite from the ground up
|
||||
@@ -49,8 +39,8 @@ a small prototype that contains only the basic functionality. It doesn't
|
||||
have any of the options to read or write special chunks and it will do
|
||||
no gamma correction. But this makes it also a simple program that is
|
||||
quite easy to understand and can serve well as a template for other
|
||||
software developments. (By now there are of course a couple of programs,
|
||||
like Greg Roelofs' rpng/wpng, that can be used just as good.)
|
||||
software developments. By now there are of course a couple of programs,
|
||||
like Greg Roelofs' rpng/wpng, that can be used just as good.
|
||||
|
||||
|
||||
Can and can not
|
||||
@@ -60,7 +50,8 @@ PngMinus. Because I started this development in good-old Turbo-C, I
|
||||
avoided the use the netpbm library, which requires DOS extenders. Again,
|
||||
another reason to call it PngMinus (minus netpbm :-). So, part of the
|
||||
program are some elementary routines to read / write pgm- and ppm-files.
|
||||
It does not read b&w pbm-files.
|
||||
It does not handle B&W pbm-files, but instead you could do pgm with bit-
|
||||
depth 1.
|
||||
|
||||
The downside of this approach is that you can not use them on images
|
||||
that require blocks of memory bigger than 64k (the DOS version). For
|
||||
@@ -96,58 +87,34 @@ To list the options type "png2pnm -h" or "pnm2png -h".
|
||||
|
||||
Just like Scandinavian furniture
|
||||
--------------------------------
|
||||
You have to put it together yourself. I did test the software under
|
||||
MS-DOS with Turbo-C 3.0 and under RedHat Linux 4.2 with gcc. In both
|
||||
cases I used libpng-1.0.4 and zlib-1.1.3. Later versions should be OK,
|
||||
however some older libpng versions have a bug in pngmem.c when using
|
||||
Turbo-C 3.0 (see below).
|
||||
You have to put it together yourself. I developed the software on MS-DOS
|
||||
with Turbo-C 3.0 and RedHat Linux 4.2 with gcc. In both cases I used
|
||||
libpng-1.0.4 and zlib-1.1.3. By now (2019) it is twenty years later and
|
||||
more current versions are OK.
|
||||
|
||||
You can build it using one of the two makefiles (make -f makefile.###)
|
||||
or use the batch/script files pngminus.bat / pngminus.sh. This assumes
|
||||
that you have built the libraries in ../libpng and ../zlib. Using Linux,
|
||||
make sure that you have built libpng with makefile.std and not
|
||||
makefile.linux (also called .lnx in earlier versions of libpng). The
|
||||
latter creates a .so shared-library, while the PngMinus makefile assumes
|
||||
a normal .a static library.
|
||||
The makefile assumes that the libpng libraries can be found in ../.. and
|
||||
libz in ../../../zlib. But you can change this to for example ../libpng
|
||||
and ../zlib. The makefile creates two versions of each program, one with
|
||||
static library support and the other using shared libraries.
|
||||
|
||||
If you create a ../pngsuite directory and then store the basn####.png
|
||||
files from PngSuite (http://www.schaik.com/pngsuite/) in there, you can
|
||||
test in one go the proper functioning of PngMinus, see png2pnm.bat and
|
||||
pnm2png.bat (or the .sh versions).
|
||||
test the proper functioning of PngMinus by running pngminus.sh.
|
||||
|
||||
|
||||
Warranty
|
||||
-------
|
||||
Please, remember that this was just a small experiment to learn a few
|
||||
things. It will have many unforeseen features <vbg>. Who said bugs? Use
|
||||
it when you are in need for something simple or when you want to start
|
||||
developing your own stuff.
|
||||
|
||||
|
||||
The Turbo bug
|
||||
-------------
|
||||
** pngmem.old
|
||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
||||
hptr += 16L;
|
||||
** pngmem.c
|
||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
||||
hptr = hptr + 16L;
|
||||
**
|
||||
|
||||
** pngmem.old
|
||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
||||
hptr += (png_uint_32)65536L;
|
||||
** pngmem.c
|
||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
||||
hptr = hptr + 65536L;
|
||||
**
|
||||
things. It will have many unforeseen features <vbg> ... who said bugs? Use
|
||||
it when you are in need for something simple or when you want a starting
|
||||
point for developing your own stuff.
|
||||
|
||||
|
||||
The end
|
||||
-------
|
||||
Willem van Schaik
|
||||
mailto:willem at schaik.com
|
||||
mailto:willem at schaik dot com
|
||||
http://www.schaik.com/png/
|
||||
-------
|
||||
Oct 1999
|
||||
|
||||
Oct 1999, Jan 2019
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
||||
# Linux / Unix
|
||||
|
||||
#CC=cc
|
||||
CC=gcc
|
||||
LD=$(CC)
|
||||
|
||||
RM=rm -f
|
||||
|
||||
#PNGPATH = /usr/local
|
||||
#PNGINC = -I$(PNGPATH)/include/libpng16
|
||||
#PNGLIB = -L$(PNGPATH)/lib -lpng16
|
||||
#PNGLIBS = $(PNGPATH)/lib/libpng16.a
|
||||
PNGINC = -I../..
|
||||
PNGLIB = -L../.. -lpng
|
||||
PNGLIBS = ../../libpng.a
|
||||
|
||||
#ZPATH = /usr/local
|
||||
#ZINC = -I$(ZPATH)/include
|
||||
#ZLIB = -L$(ZPATH)/lib -lz
|
||||
#ZLIBS = $(ZPATH)/lib/libz.a
|
||||
ZINC = -I../../../zlib
|
||||
ZLIB = -L../../../zlib -lz
|
||||
ZLIBS = ../../../zlib/libz.a
|
||||
|
||||
CPPFLAGS=$(PNGINC) $(ZINC)
|
||||
CFLAGS=
|
||||
LDLIBS=$(PNGLIB) $(ZLIB)
|
||||
LDLIBSS=$(PNGLIBS) $(ZLIBS)
|
||||
C=.c
|
||||
O=.o
|
||||
L=.a
|
||||
E=
|
||||
|
||||
# dependencies
|
||||
|
||||
#all: png2pnm$(E) pnm2png$(E)
|
||||
all: png2pnm$(E) pnm2png$(E) png2pnm-static$(E) pnm2png-static$(E)
|
||||
|
||||
png2pnm$(O): png2pnm$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
|
||||
|
||||
png2pnm$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
|
||||
|
||||
png2pnm-static$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
|
||||
|
||||
pnm2png$(O): pnm2png$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
|
||||
|
||||
pnm2png$(E): pnm2png$(O)
|
||||
$(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
|
||||
|
||||
pnm2png-static$(E): pnm2png$(O)
|
||||
$(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
|
||||
|
||||
clean:
|
||||
$(RM) png2pnm$(O)
|
||||
$(RM) pnm2png$(O)
|
||||
$(RM) png2pnm$(E)
|
||||
$(RM) pnm2png$(E)
|
||||
$(RM) png2pnm-static$(E)
|
||||
$(RM) pnm2png-static$(E)
|
||||
|
||||
# End of makefile for png2pnm / pnm2png
|
||||
@@ -1,38 +0,0 @@
|
||||
# Makefile for PngMinus (png2pnm and pnm2png)
|
||||
# TurboC++ 3.0
|
||||
|
||||
CC=tcc -Ic:\tc3\inc
|
||||
LD=tcc -Lc:\tc3\lib
|
||||
LB=tlib
|
||||
RM=del
|
||||
CP=copy
|
||||
MODEL=l
|
||||
CPPFLAGS=-I..\libpng -I..\zlib
|
||||
CFLAGS=-O -m$(MODEL)
|
||||
LDFLAGS=-m$(MODEL) -L..\libpng -L..\zlib
|
||||
C=.c
|
||||
O=.obj
|
||||
L=.lib
|
||||
E=.exe
|
||||
|
||||
# dependencies
|
||||
|
||||
all: png2pnm$(E) pnm2png$(E)
|
||||
|
||||
png2pnm$(O): png2pnm$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) png2pnm$(C)
|
||||
|
||||
png2pnm$(E): png2pnm$(O)
|
||||
$(LD) $(LDFLAGS) png2pnm$(O) libpng$(L) zlib$(L)
|
||||
|
||||
pnm2png$(O): pnm2png$(C)
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) pnm2png$(C)
|
||||
|
||||
pnm2png$(E): pnm2png$(O)
|
||||
$(LD) $(LDFLAGS) pnm2png$(O) libpng$(L) zlib$(L)
|
||||
|
||||
clean:
|
||||
$(RM) *$(O)
|
||||
$(RM) *$(E)
|
||||
|
||||
# End of makefile for png2pnm / pnm2png
|
||||
@@ -1,85 +1,52 @@
|
||||
/*
|
||||
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
|
||||
* copyright (C) 1999,2017 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.
|
||||
* 1.1 - 2017.04.22 - Add buffer-size check (Glenn Randers-Pehrson)
|
||||
* 1.2 - 2017.08.24 - Fix potential overflow in buffer-size check
|
||||
* (Glenn Randers-Pehrson)
|
||||
* 1.3 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear in
|
||||
* supporting documentation. This software is provided "as is" without
|
||||
* express or implied warranty.
|
||||
* This software is released under the MIT license. For conditions of
|
||||
* distribution and use, see the LICENSE file part of this package.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __TURBOC__
|
||||
#include <mem.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL unsigned char
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE (BOOL) 1
|
||||
#define TRUE ((BOOL) 1)
|
||||
#endif
|
||||
#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
|
||||
|
||||
|
||||
#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
|
||||
|
||||
#ifndef PNGMINUS_UNUSED
|
||||
/* Unused formal parameter warnings are silenced using the following macro
|
||||
* which is expected to have no bad effects on performance (optimizing
|
||||
* compilers will probably remove it entirely).
|
||||
*/
|
||||
# define PNGMINUS_UNUSED(param) (void)param
|
||||
#endif
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
int main (int argc, char *argv[]);
|
||||
int main (int argc, char *argv[]);
|
||||
void usage ();
|
||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw,
|
||||
BOOL alpha);
|
||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
BOOL raw, BOOL alpha);
|
||||
BOOL do_png2pnm (png_struct *png_ptr, png_info *info_ptr,
|
||||
FILE *pnm_file, FILE *alpha_file,
|
||||
BOOL raw, BOOL alpha);
|
||||
|
||||
/*
|
||||
* main
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
FILE *fp_rd = stdin;
|
||||
FILE *fp_wr = stdout;
|
||||
FILE *fp_al = NULL;
|
||||
const char *fname_wr = NULL;
|
||||
const char *fname_al = NULL;
|
||||
BOOL raw = TRUE;
|
||||
BOOL alpha = FALSE;
|
||||
int argi;
|
||||
int ret;
|
||||
|
||||
for (argi = 1; argi < argc; argi++)
|
||||
{
|
||||
@@ -98,22 +65,23 @@ int main(int argc, char *argv[])
|
||||
argi++;
|
||||
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
|
||||
{
|
||||
fname_al = argv[argi];
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: can not create alpha-channel file %s\n",
|
||||
argv[argi]);
|
||||
fprintf (stderr, "Error: cannot create alpha-channel file %s\n",
|
||||
argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
usage();
|
||||
exit(0);
|
||||
usage ();
|
||||
exit (0);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
|
||||
usage();
|
||||
exit(1);
|
||||
usage ();
|
||||
exit (1);
|
||||
break;
|
||||
} /* end switch */
|
||||
}
|
||||
@@ -121,17 +89,18 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if ((fp_rd = fopen (argv[argi], "rb")) == NULL)
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: file %s does not exist\n", argv[argi]);
|
||||
exit (1);
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: file %s does not exist\n", argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
else if (fp_wr == stdout)
|
||||
{
|
||||
fname_wr = argv[argi];
|
||||
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: can not create file %s\n", argv[argi]);
|
||||
fprintf (stderr, "Error: cannot create file %s\n", argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
@@ -139,30 +108,21 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: too many parameters\n");
|
||||
usage();
|
||||
exit(1);
|
||||
usage ();
|
||||
exit (1);
|
||||
}
|
||||
} /* end for */
|
||||
|
||||
#ifdef __TURBOC__
|
||||
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||
/* set stdin/stdout if required to binary */
|
||||
if (fp_rd == stdin)
|
||||
{
|
||||
setmode (STDIN, O_BINARY);
|
||||
}
|
||||
setmode (fileno (stdin), O_BINARY);
|
||||
if ((raw) && (fp_wr == stdout))
|
||||
{
|
||||
setmode (STDOUT, O_BINARY);
|
||||
}
|
||||
setmode (fileno (stdout), O_BINARY);
|
||||
#endif
|
||||
|
||||
/* call the conversion program itself */
|
||||
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
|
||||
exit(1);
|
||||
}
|
||||
ret = png2pnm (fp_rd, fp_wr, fp_al, raw, alpha);
|
||||
|
||||
/* close input file */
|
||||
fclose (fp_rd);
|
||||
@@ -172,6 +132,17 @@ int main(int argc, char *argv[])
|
||||
if (alpha)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -179,23 +150,18 @@ int main(int argc, char *argv[])
|
||||
* usage
|
||||
*/
|
||||
|
||||
void usage()
|
||||
void usage ()
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, " by Willem van Schaik, 1999\n");
|
||||
#ifdef __TURBOC__
|
||||
fprintf (stderr, " for Turbo-C and Borland-C compilers\n");
|
||||
#else
|
||||
fprintf (stderr, " for Linux (and Unix) compilers\n");
|
||||
#endif
|
||||
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
|
||||
fprintf (stderr, " or: ... | png2pnm [options]\n");
|
||||
fprintf (stderr, "Options:\n");
|
||||
fprintf (stderr,
|
||||
" -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
|
||||
" -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
|
||||
fprintf (stderr, " -n[oraw] write pnm-file in ascii format (P1/P2/P3)\n");
|
||||
fprintf (stderr,
|
||||
" -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
|
||||
" -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
|
||||
fprintf (stderr, " -h | -? print this help-information\n");
|
||||
}
|
||||
|
||||
@@ -204,79 +170,70 @@ void usage()
|
||||
*/
|
||||
|
||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
volatile BOOL raw, BOOL alpha)
|
||||
BOOL raw, BOOL alpha)
|
||||
{
|
||||
png_struct *png_ptr = NULL;
|
||||
png_info *info_ptr = NULL;
|
||||
png_byte buf[8];
|
||||
png_byte *png_pixels = NULL;
|
||||
png_byte **row_pointers = NULL;
|
||||
png_byte *pix_ptr = NULL;
|
||||
png_uint_32 row_bytes;
|
||||
png_struct *png_ptr;
|
||||
png_info *info_ptr;
|
||||
BOOL ret;
|
||||
|
||||
/* initialize the libpng context for reading from png_file */
|
||||
|
||||
png_ptr = png_create_read_struct (png_get_libpng_ver(NULL),
|
||||
NULL, NULL, NULL);
|
||||
if (!png_ptr)
|
||||
return FALSE; /* out of memory */
|
||||
|
||||
info_ptr = png_create_info_struct (png_ptr);
|
||||
if (!info_ptr)
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, NULL, NULL);
|
||||
return FALSE; /* out of memory */
|
||||
}
|
||||
|
||||
if (setjmp (png_jmpbuf (png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
return FALSE; /* generic libpng error */
|
||||
}
|
||||
|
||||
png_init_io (png_ptr, png_file);
|
||||
|
||||
/* do the actual conversion */
|
||||
ret = do_png2pnm (png_ptr, info_ptr, pnm_file, alpha_file, raw, alpha);
|
||||
|
||||
/* clean up the libpng structures and their internally-managed data */
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* do_png2pnm - does the conversion in a fully-initialized libpng context
|
||||
*/
|
||||
|
||||
BOOL do_png2pnm (png_struct *png_ptr, png_info *info_ptr,
|
||||
FILE *pnm_file, FILE *alpha_file,
|
||||
BOOL raw, BOOL alpha)
|
||||
{
|
||||
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;
|
||||
int row, col;
|
||||
int ret;
|
||||
int i;
|
||||
png_uint_32 row, col, i;
|
||||
long dep_16;
|
||||
|
||||
/* read and check signature in PNG file */
|
||||
ret = fread (buf, 1, 8, png_file);
|
||||
if (ret != 8)
|
||||
return FALSE;
|
||||
/* set up the image transformations that are necessary for the PNM format */
|
||||
|
||||
ret = png_sig_cmp (buf, 0, 8);
|
||||
if (ret)
|
||||
return FALSE;
|
||||
/* 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);
|
||||
|
||||
/* create png and info structures */
|
||||
|
||||
png_ptr = png_create_read_struct (png_get_libpng_ver(NULL),
|
||||
NULL, NULL, NULL);
|
||||
if (!png_ptr)
|
||||
return FALSE; /* out of memory */
|
||||
|
||||
info_ptr = png_create_info_struct (png_ptr);
|
||||
if (!info_ptr)
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, NULL, NULL);
|
||||
return FALSE; /* out of memory */
|
||||
}
|
||||
|
||||
if (setjmp (png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* set up the input control for C streams */
|
||||
png_init_io (png_ptr, png_file);
|
||||
png_set_sig_bytes (png_ptr, 8); /* we already read the 8 signature bytes */
|
||||
|
||||
/* read the file information */
|
||||
png_read_info (png_ptr, info_ptr);
|
||||
|
||||
/* get size and bit-depth of the PNG-image */
|
||||
png_get_IHDR (png_ptr, info_ptr,
|
||||
&width, &height, &bit_depth, &color_type,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
/* set-up the transformations */
|
||||
|
||||
/* transform paletted images into full-color rgb */
|
||||
if (color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
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)
|
||||
png_set_expand (png_ptr);
|
||||
/* transform transparency maps into full alpha-channel */
|
||||
if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
|
||||
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
|
||||
/* downgrade 16-bit images to 8-bit */
|
||||
@@ -284,32 +241,24 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
png_set_strip_16 (png_ptr);
|
||||
/* transform grayscale images into full-color */
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb (png_ptr);
|
||||
/* only if file has a file gamma, we do a correction */
|
||||
if (png_get_gAMA (png_ptr, info_ptr, &file_gamma))
|
||||
png_set_gamma (png_ptr, (double) 2.2, file_gamma);
|
||||
#endif
|
||||
|
||||
/* all transformations have been registered; now update info_ptr data,
|
||||
* get rowbytes and channels, and allocate image memory */
|
||||
|
||||
png_read_update_info (png_ptr, info_ptr);
|
||||
|
||||
/* get the new color-type and bit-depth (after expansion/stripping) */
|
||||
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
/* check for 16-bit files */
|
||||
if (bit_depth == 16)
|
||||
/* if the PNG image has a gAMA chunk then gamma-correct the output image */
|
||||
{
|
||||
raw = FALSE;
|
||||
#ifdef __TURBOC__
|
||||
pnm_file->flags &= ~((unsigned) _F_BIN);
|
||||
#endif
|
||||
double file_gamma;
|
||||
if (png_get_gAMA (png_ptr, info_ptr, &file_gamma))
|
||||
png_set_gamma (png_ptr, (double) 2.2, file_gamma);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* calculate new number of channels and store alpha-presence */
|
||||
/* read the image file, with all of the above image transforms applied */
|
||||
png_read_png (png_ptr, info_ptr, 0, NULL);
|
||||
|
||||
/* get the image size, bit-depth and color-type */
|
||||
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
/* calculate the number of channels and store alpha-presence */
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||
channels = 1;
|
||||
else if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
@@ -326,47 +275,12 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
if (alpha && !alpha_present)
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: PNG-file doesn't contain alpha channel\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 ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes))
|
||||
{
|
||||
/* too big */
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
if ((png_pixels = (png_byte *)
|
||||
malloc ((size_t)row_bytes * (size_t)height * sizeof (png_byte))) == NULL)
|
||||
{
|
||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||
fprintf (stderr, "Warning: no alpha channel in PNG file\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((row_pointers = (png_byte **)
|
||||
malloc ((size_t)height * sizeof (png_bytep))) == NULL)
|
||||
{
|
||||
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);
|
||||
/* get address of internally-allocated image data */
|
||||
row_pointers = png_get_rows (png_ptr, info_ptr);
|
||||
|
||||
/* write header of PNM file */
|
||||
|
||||
@@ -397,46 +311,67 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_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)
|
||||
fputc ((int) *pix_ptr++ , pnm_file);
|
||||
{
|
||||
fputc ((int) *pix_ptr++, pnm_file);
|
||||
if (bit_depth == 16)
|
||||
fputc ((int) *pix_ptr++, pnm_file);
|
||||
}
|
||||
else
|
||||
if (bit_depth == 16){
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
||||
{
|
||||
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++);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (alpha_present)
|
||||
{
|
||||
if (!alpha)
|
||||
{
|
||||
pix_ptr++; /* alpha */
|
||||
/* skip the alpha-channel */
|
||||
pix_ptr++;
|
||||
if (bit_depth == 16)
|
||||
pix_ptr++;
|
||||
}
|
||||
else /* output alpha-channel as pgm file */
|
||||
else
|
||||
{
|
||||
/* output the alpha-channel as pgm file */
|
||||
if (raw)
|
||||
fputc ((int) *pix_ptr++ , alpha_file);
|
||||
{
|
||||
fputc ((int) *pix_ptr++, alpha_file);
|
||||
if (bit_depth == 16)
|
||||
fputc ((int) *pix_ptr++, alpha_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bit_depth == 16)
|
||||
{
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
||||
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++);
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* if alpha_present */
|
||||
} /* end if alpha_present */
|
||||
|
||||
if (!raw)
|
||||
if (col % 4 == 3)
|
||||
@@ -448,13 +383,5 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||
fprintf (pnm_file, "\n");
|
||||
} /* end for row */
|
||||
|
||||
if (row_pointers != (unsigned char**) NULL)
|
||||
free (row_pointers);
|
||||
if (png_pixels != (unsigned char*) NULL)
|
||||
free (png_pixels);
|
||||
|
||||
PNGMINUS_UNUSED(raw); /* to quiet a Coverity defect */
|
||||
return TRUE;
|
||||
|
||||
} /* end of source */
|
||||
|
||||
|
||||
@@ -1,87 +1,57 @@
|
||||
/*
|
||||
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
|
||||
* copyright (C) 1999,2015,2017 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.
|
||||
* version 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
|
||||
* version 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)
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear in
|
||||
* supporting documentation. This software is provided "as is" without
|
||||
* express or implied warranty.
|
||||
* This software is released under the MIT license. For conditions of
|
||||
* distribution and use, see the LICENSE file part of this package.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __TURBOC__
|
||||
#include <mem.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL unsigned char
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE (BOOL) 1
|
||||
#define TRUE ((BOOL) 1)
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#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
|
||||
#define FALSE ((BOOL) 0)
|
||||
#endif
|
||||
|
||||
#include "png.h"
|
||||
|
||||
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
|
||||
#ifndef png_jmpbuf
|
||||
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
||||
#endif
|
||||
|
||||
#ifndef PNGMINUS_UNUSED
|
||||
/* Unused formal parameter warnings are silenced using the following macro
|
||||
* which is expected to have no bad effects on performance (optimizing
|
||||
* compilers will probably remove it entirely).
|
||||
*/
|
||||
# define PNGMINUS_UNUSED(param) (void)param
|
||||
#endif
|
||||
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
int main (int argc, char *argv[]);
|
||||
int main (int argc, char *argv[]);
|
||||
void usage ();
|
||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
BOOL alpha);
|
||||
void get_token(FILE *pnm_file, char *token);
|
||||
png_uint_32 get_data (FILE *pnm_file, int depth);
|
||||
png_uint_32 get_value (FILE *pnm_file, int depth);
|
||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
|
||||
BOOL interlace, BOOL alpha);
|
||||
BOOL do_pnm2png (png_struct *png_ptr, png_info *info_ptr,
|
||||
FILE *pnm_file, FILE *alpha_file,
|
||||
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
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
FILE *fp_rd = stdin;
|
||||
FILE *fp_al = NULL;
|
||||
FILE *fp_wr = stdout;
|
||||
const char *fname_wr = NULL;
|
||||
BOOL interlace = FALSE;
|
||||
BOOL alpha = FALSE;
|
||||
int argi;
|
||||
int ret;
|
||||
|
||||
for (argi = 1; argi < argc; argi++)
|
||||
{
|
||||
@@ -99,20 +69,20 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: alpha-channel file %s does not exist\n",
|
||||
argv[argi]);
|
||||
argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
break;
|
||||
case 'h':
|
||||
case '?':
|
||||
usage();
|
||||
exit(0);
|
||||
usage ();
|
||||
exit (0);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: unknown option %s\n", argv[argi]);
|
||||
usage();
|
||||
exit(1);
|
||||
usage ();
|
||||
exit (1);
|
||||
break;
|
||||
} /* end switch */
|
||||
}
|
||||
@@ -127,10 +97,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (fp_wr == stdout)
|
||||
{
|
||||
fname_wr = argv[argi];
|
||||
if ((fp_wr = fopen (argv[argi], "wb")) == NULL)
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: can not create PNG-file %s\n", argv[argi]);
|
||||
fprintf (stderr, "Error: cannot create PNG-file %s\n", argv[argi]);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
@@ -138,30 +109,23 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: too many parameters\n");
|
||||
usage();
|
||||
usage ();
|
||||
exit (1);
|
||||
}
|
||||
} /* end for */
|
||||
|
||||
#ifdef __TURBOC__
|
||||
/* set stdin/stdout to binary, we're reading the PNM always! in binary format */
|
||||
#if defined(O_BINARY) && (O_BINARY != 0)
|
||||
/* set stdin/stdout to binary,
|
||||
* we're reading the PNM always! in binary format
|
||||
*/
|
||||
if (fp_rd == stdin)
|
||||
{
|
||||
setmode (STDIN, O_BINARY);
|
||||
}
|
||||
setmode (fileno (stdin), O_BINARY);
|
||||
if (fp_wr == stdout)
|
||||
{
|
||||
setmode (STDOUT, O_BINARY);
|
||||
}
|
||||
setmode (fileno (stdout), O_BINARY);
|
||||
#endif
|
||||
|
||||
/* call the conversion program itself */
|
||||
if (pnm2png (fp_rd, fp_wr, fp_al, interlace, alpha) == FALSE)
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, "Error: unsuccessful converting to PNG-image\n");
|
||||
exit (1);
|
||||
}
|
||||
ret = pnm2png (fp_rd, fp_wr, fp_al, interlace, alpha);
|
||||
|
||||
/* close input file */
|
||||
fclose (fp_rd);
|
||||
@@ -171,6 +135,15 @@ int main(int argc, char *argv[])
|
||||
if (alpha)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -178,15 +151,10 @@ int main(int argc, char *argv[])
|
||||
* usage
|
||||
*/
|
||||
|
||||
void usage()
|
||||
void usage ()
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG\n");
|
||||
fprintf (stderr, " by Willem van Schaik, 1999\n");
|
||||
#ifdef __TURBOC__
|
||||
fprintf (stderr, " for Turbo-C and Borland-C compilers\n");
|
||||
#else
|
||||
fprintf (stderr, " for Linux (and Unix) compilers\n");
|
||||
#endif
|
||||
fprintf (stderr, "Usage: pnm2png [options] <file>.<pnm> [<file>.png]\n");
|
||||
fprintf (stderr, " or: ... | pnm2png [options]\n");
|
||||
fprintf (stderr, "Options:\n");
|
||||
@@ -200,103 +168,101 @@ void usage()
|
||||
* pnm2png
|
||||
*/
|
||||
|
||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
BOOL alpha)
|
||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file,
|
||||
BOOL interlace, BOOL alpha)
|
||||
{
|
||||
png_struct *png_ptr = NULL;
|
||||
png_info *info_ptr = NULL;
|
||||
png_byte *png_pixels = NULL;
|
||||
png_byte **row_pointers = NULL;
|
||||
png_byte *pix_ptr = NULL;
|
||||
volatile png_uint_32 row_bytes;
|
||||
png_struct *png_ptr;
|
||||
png_info *info_ptr;
|
||||
BOOL ret;
|
||||
|
||||
char type_token[16];
|
||||
char width_token[16];
|
||||
char height_token[16];
|
||||
char maxval_token[16];
|
||||
volatile int color_type=1;
|
||||
unsigned long ul_width=0, ul_alpha_width=0;
|
||||
unsigned long ul_height=0, ul_alpha_height=0;
|
||||
unsigned long ul_maxval=0;
|
||||
volatile png_uint_32 width=0, height=0;
|
||||
volatile png_uint_32 alpha_width=0, alpha_height=0;
|
||||
png_uint_32 maxval;
|
||||
volatile int bit_depth = 0;
|
||||
int channels=0;
|
||||
int alpha_depth = 0;
|
||||
int alpha_present=0;
|
||||
int row, col;
|
||||
BOOL raw, alpha_raw = FALSE;
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
/* initialize the libpng context for writing to png_file */
|
||||
|
||||
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL),
|
||||
NULL, NULL, NULL);
|
||||
if (!png_ptr)
|
||||
return FALSE; /* out of memory */
|
||||
|
||||
info_ptr = png_create_info_struct (png_ptr);
|
||||
if (!info_ptr)
|
||||
{
|
||||
png_destroy_write_struct (&png_ptr, NULL);
|
||||
return FALSE; /* out of memory */
|
||||
}
|
||||
|
||||
if (setjmp (png_jmpbuf (png_ptr)))
|
||||
{
|
||||
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||
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;
|
||||
#endif
|
||||
png_uint_32 tmp16;
|
||||
int i;
|
||||
|
||||
/* read header of PNM file */
|
||||
|
||||
get_token(pnm_file, type_token);
|
||||
if (type_token[0] != 'P')
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else if ((type_token[1] == '1') || (type_token[1] == '4'))
|
||||
{
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
raw = (type_token[1] == '4');
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
get_token(pnm_file, width_token);
|
||||
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 (fscan_pnm_magic (pnm_file, magic_token, sizeof (magic_token)) != 1)
|
||||
return FALSE; /* not a PNM file */
|
||||
|
||||
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'))
|
||||
if ((magic_token[1] == '1') || (magic_token[1] == '4'))
|
||||
{
|
||||
raw = (type_token[1] == '6');
|
||||
color_type = PNG_COLOR_TYPE_RGB;
|
||||
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)
|
||||
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;
|
||||
@@ -304,8 +270,34 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
bit_depth = 4;
|
||||
else if (maxval <= 255)
|
||||
bit_depth = 8;
|
||||
else /* if (maxval <= 65535) */
|
||||
else if (maxval <= 65535U)
|
||||
bit_depth = 16;
|
||||
else /* maxval > 65535U */
|
||||
return FALSE;
|
||||
}
|
||||
else if ((magic_token[1] == '3') || (magic_token[1] == '6'))
|
||||
{
|
||||
raw = (magic_token[1] == '6');
|
||||
color_type = PNG_COLOR_TYPE_RGB;
|
||||
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;
|
||||
}
|
||||
else if (magic_token[1] == '7')
|
||||
{
|
||||
fprintf (stderr, "PNM2PNG can't read PAM (P7) files\n");
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -316,49 +308,36 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
|
||||
if (alpha)
|
||||
{
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY)
|
||||
color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
|
||||
if (color_type == PNG_COLOR_TYPE_RGB)
|
||||
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||
if ((fscan_pnm_magic (alpha_file, magic_token, sizeof (magic_token)) != 1)
|
||||
|| ((magic_token[1] != '2') && (magic_token[1] != '5')))
|
||||
return FALSE; /* not a PGM file */
|
||||
|
||||
get_token(alpha_file, type_token);
|
||||
if (type_token[0] != 'P')
|
||||
{
|
||||
if ((fscan_pnm_uint_32 (alpha_file, &alpha_width) != 1) ||
|
||||
(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;
|
||||
}
|
||||
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;
|
||||
else if (maxval <= 3)
|
||||
alpha_depth = 2;
|
||||
else if (maxval <= 15)
|
||||
alpha_depth = 4;
|
||||
else if (maxval <= 255)
|
||||
alpha_depth = 8;
|
||||
else /* if (maxval <= 65535) */
|
||||
alpha_depth = 16;
|
||||
if (alpha_depth != bit_depth)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
else if (maxval == 1)
|
||||
alpha_depth = 1;
|
||||
else if (maxval <= 3)
|
||||
alpha_depth = 2;
|
||||
else if (maxval <= 15)
|
||||
alpha_depth = 4;
|
||||
else if (maxval <= 255)
|
||||
alpha_depth = 8;
|
||||
else if (maxval <= 65535U)
|
||||
alpha_depth = 16;
|
||||
else /* maxval > 65535U */
|
||||
return FALSE;
|
||||
if (alpha_depth != bit_depth)
|
||||
return FALSE;
|
||||
}
|
||||
} /* end if alpha */
|
||||
|
||||
/* calculate the number of channels and store alpha-presence */
|
||||
@@ -370,219 +349,259 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
channels = 3;
|
||||
else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
channels = 4;
|
||||
#if 0
|
||||
else
|
||||
channels = 0; /* cannot happen */
|
||||
#endif
|
||||
return FALSE; /* NOTREACHED */
|
||||
|
||||
alpha_present = (channels - 1) % 2;
|
||||
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
if (packed_bitmap)
|
||||
{
|
||||
/* row data is as many bytes as can fit width x channels x bit_depth */
|
||||
row_bytes = (width * channels * bit_depth + 7) / 8;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
||||
|
||||
if ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes))
|
||||
{
|
||||
/* too big */
|
||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
||||
}
|
||||
|
||||
if ((row_bytes == 0) ||
|
||||
((size_t) height > (size_t) (-1) / (size_t) row_bytes))
|
||||
{
|
||||
/* too big */
|
||||
return FALSE;
|
||||
}
|
||||
if ((png_pixels = (png_byte *)
|
||||
malloc ((size_t)row_bytes * (size_t)height * sizeof (png_byte))) == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* read data from PNM file */
|
||||
pix_ptr = png_pixels;
|
||||
|
||||
for (row = 0; row < (int) height; row++)
|
||||
/* allocate the rows using the same memory layout as libpng, and transfer
|
||||
* their ownership to libpng, with the responsibility to clean everything up;
|
||||
* please note the use of png_calloc instead of png_malloc */
|
||||
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++)
|
||||
{
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
/* 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 < (int) row_bytes; i++)
|
||||
/* png supports this format natively so no conversion is needed */
|
||||
*pix_ptr++ = get_data (pnm_file, 8);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
for (col = 0; col < (int) width; col++)
|
||||
for (i = 0; i < row_bytes; i++)
|
||||
{
|
||||
for (i = 0; i < (channels - alpha_present); i++)
|
||||
/* png supports this format natively so no conversion is needed */
|
||||
*pix_ptr++ = get_pnm_data (pnm_file, 8);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (col = 0; col < width; col++)
|
||||
{
|
||||
for (i = 0; i < (png_uint_32) (channels - alpha_present); i++)
|
||||
{
|
||||
if (raw)
|
||||
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
||||
{
|
||||
*pix_ptr++ = get_pnm_data (pnm_file, bit_depth);
|
||||
if (bit_depth == 16)
|
||||
*pix_ptr++ = get_pnm_data (pnm_file, bit_depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bit_depth <= 8)
|
||||
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
||||
{
|
||||
*pix_ptr++ = get_pnm_value (pnm_file, bit_depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (pnm_file, bit_depth);
|
||||
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
val16 = get_pnm_value (pnm_file, bit_depth);
|
||||
*pix_ptr = (png_byte) ((val16 >> 8) & 0xFF);
|
||||
pix_ptr++;
|
||||
*pix_ptr = (png_byte) (tmp16 & 0xFF);
|
||||
*pix_ptr = (png_byte) (val16 & 0xFF);
|
||||
pix_ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (alpha) /* read alpha-channel from pgm file */
|
||||
{
|
||||
if (alpha_raw)
|
||||
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
||||
{
|
||||
*pix_ptr++ = get_pnm_data (alpha_file, alpha_depth);
|
||||
if (alpha_depth == 16)
|
||||
*pix_ptr++ = get_pnm_data (alpha_file, alpha_depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (alpha_depth <= 8)
|
||||
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
||||
{
|
||||
*pix_ptr++ = get_pnm_value (alpha_file, bit_depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (alpha_file, bit_depth);
|
||||
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
||||
val16 = get_pnm_value (alpha_file, bit_depth);
|
||||
*pix_ptr++ = (png_byte) ((val16 >> 8) & 0xFF);
|
||||
*pix_ptr++ = (png_byte) (val16 & 0xFF);
|
||||
}
|
||||
} /* if alpha */
|
||||
} /* if packed_bitmap */
|
||||
}
|
||||
} /* end if alpha */
|
||||
} /* end if packed_bitmap */
|
||||
} /* end for col */
|
||||
} /* end for row */
|
||||
|
||||
/* prepare the standard PNG structures */
|
||||
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL), NULL, NULL,
|
||||
NULL);
|
||||
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;
|
||||
}
|
||||
/* we're going to write more or less the same PNG as the input file */
|
||||
png_set_IHDR (png_ptr, info_ptr, width, height, bit_depth, color_type,
|
||||
(!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
#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 */
|
||||
png_set_IHDR (png_ptr, info_ptr, width, height, bit_depth, color_type,
|
||||
(!interlace) ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
/* write the file header information */
|
||||
png_write_info (png_ptr, info_ptr);
|
||||
|
||||
/* if needed we will allocate memory for an new array of row-pointers */
|
||||
if (row_pointers == (unsigned char**) NULL)
|
||||
{
|
||||
if ((row_pointers = (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 */
|
||||
png_write_image (png_ptr, row_pointers);
|
||||
|
||||
/* write the additional chunks to the PNG file (not really needed) */
|
||||
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);
|
||||
|
||||
PNGMINUS_UNUSED(raw); /* Quiet a Coverity defect */
|
||||
|
||||
return TRUE;
|
||||
} /* 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;
|
||||
|
||||
/* remove white-space and comment lines */
|
||||
do
|
||||
{
|
||||
ret = fgetc(pnm_file);
|
||||
ret = fgetc (pnm_file);
|
||||
if (ret == '#')
|
||||
{
|
||||
/* the rest of this line is a comment */
|
||||
do
|
||||
{
|
||||
ret = fgetc(pnm_file);
|
||||
ret = fgetc (pnm_file);
|
||||
}
|
||||
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
|
||||
}
|
||||
if (ret == EOF) break;
|
||||
token[i] = (unsigned char) ret;
|
||||
token_buf[i] = (char) ret;
|
||||
}
|
||||
while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' '));
|
||||
while ((ret == '\n') || (ret == '\r') || (ret == ' '));
|
||||
|
||||
/* read string */
|
||||
do
|
||||
{
|
||||
ret = fgetc(pnm_file);
|
||||
ret = fgetc (pnm_file);
|
||||
if (ret == EOF) break;
|
||||
i++;
|
||||
token[i] = (unsigned char) ret;
|
||||
if (ret == '0')
|
||||
{
|
||||
/* 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;
|
||||
}
|
||||
if (++i == token_buf_size - 1) break;
|
||||
token_buf[i] = (char) ret;
|
||||
}
|
||||
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
|
||||
while ((ret != '\n') && (ret != '\r') && (ret != ' '));
|
||||
|
||||
token[i] = '\0';
|
||||
|
||||
return;
|
||||
token_buf[i] = '\0';
|
||||
return (i > 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_data() - takes first byte and converts into next pixel value,
|
||||
* taking as much bits as defined by bit-depth and
|
||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
||||
* fscan_pnm_uint_32 - like fscan_token above, but expects the extracted token
|
||||
* to be numeric, and converts it to an unsigned 32-bit int
|
||||
*/
|
||||
|
||||
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 old_value = 0;
|
||||
static int mask = 0;
|
||||
int i;
|
||||
png_uint_32 ret_value;
|
||||
int i;
|
||||
|
||||
if (mask == 0)
|
||||
for (i = 0; i < depth; i++)
|
||||
@@ -590,7 +609,11 @@ png_uint_32 get_data (FILE *pnm_file, int depth)
|
||||
|
||||
if (bits_left <= 0)
|
||||
{
|
||||
/* FIXME:
|
||||
* signal the premature end of file, instead of pretending to read zeroes
|
||||
*/
|
||||
old_value = fgetc (pnm_file);
|
||||
if (old_value == EOF) return 0;
|
||||
bits_left = 8;
|
||||
}
|
||||
|
||||
@@ -605,25 +628,28 @@ png_uint_32 get_data (FILE *pnm_file, int depth)
|
||||
}
|
||||
|
||||
/*
|
||||
* get_value() - takes first (numeric) string and converts into number,
|
||||
* using the bit-depth to fill up a byte (0Ah -> AAh)
|
||||
* get_pnm_value - takes first (numeric) string and converts into number,
|
||||
* 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;
|
||||
png_byte token[16];
|
||||
unsigned long ul_ret_value;
|
||||
png_uint_32 ret_value;
|
||||
int i = 0;
|
||||
int i;
|
||||
|
||||
if (mask == 0)
|
||||
for (i = 0; i < depth; i++)
|
||||
mask = (mask << 1) | 0x01;
|
||||
|
||||
get_token (pnm_file, (char *) token);
|
||||
sscanf ((const char *) token, "%lu", &ul_ret_value);
|
||||
ret_value = (png_uint_32) ul_ret_value;
|
||||
if (fscan_pnm_uint_32 (pnm_file, &ret_value) != 1)
|
||||
{
|
||||
/* FIXME:
|
||||
* signal the invalid numeric tokens or the premature end of file,
|
||||
* instead of pretending to read zeroes
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret_value &= mask;
|
||||
|
||||
@@ -635,4 +661,3 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||
}
|
||||
|
||||
/* end of source */
|
||||
|
||||
|
||||
0
contrib/pngminus/png2pnm.bat → contrib/pngminus/test_png2pnm.bat
Executable file → Normal file
@@ -1,4 +1,4 @@
|
||||
make -f makefile.tc3
|
||||
make
|
||||
call png2pnm.bat
|
||||
call pnm2png.bat
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
make -f makefile.std
|
||||
make
|
||||
sh png2pnm.sh
|
||||
sh pnm2png.sh
|
||||
|
||||
0
contrib/pngminus/pnm2png.bat → contrib/pngminus/test_pnm2png.bat
Executable file → Normal file
@@ -2,7 +2,6 @@
|
||||
*
|
||||
* Copyright (c) 2017 Glenn Randers-Pehrson
|
||||
* Written by Vadim Barkov, 2017.
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -12,7 +11,7 @@
|
||||
* BUG REPORTS: png-mng-implement@sourceforge.net
|
||||
*
|
||||
* png_have_vsx implemented for Linux by reading the widely available
|
||||
* pseudo-file /proc/cpuinfo.
|
||||
* 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.
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
*
|
||||
* Copyright (c) 2017 Glenn Randers-Pehrson
|
||||
* Written by Vadim Barkov, 2017.
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -23,14 +22,12 @@
|
||||
static int
|
||||
png_have_vsx(png_structp png_ptr)
|
||||
{
|
||||
|
||||
const unsigned long auxv = getauxval( AT_HWCAP );
|
||||
unsigned long auxv = getauxval(AT_HWCAP);
|
||||
|
||||
PNG_UNUSED(png_ptr)
|
||||
|
||||
if(auxv & (PPC_FEATURE_HAS_ALTIVEC|PPC_FEATURE_HAS_VSX ))
|
||||
if(auxv & (PPC_FEATURE_HAS_ALTIVEC|PPC_FEATURE_HAS_VSX))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BIN
contrib/testpngs/badpal/regression-palette-8.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
contrib/testpngs/badpal/small-palette-1.png
Normal file
|
After Width: | Height: | Size: 271 B |
BIN
contrib/testpngs/badpal/small-palette-2.png
Normal file
|
After Width: | Height: | Size: 277 B |
BIN
contrib/testpngs/badpal/small-palette-4.png
Normal file
|
After Width: | Height: | Size: 315 B |
BIN
contrib/testpngs/badpal/small-palette-8.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
contrib/testpngs/badpal/test-palette-1.png
Normal file
|
After Width: | Height: | Size: 432 B |
BIN
contrib/testpngs/badpal/test-palette-2.png
Normal file
|
After Width: | Height: | Size: 499 B |
BIN
contrib/testpngs/badpal/test-palette-4.png
Normal file
|
After Width: | Height: | Size: 591 B |
BIN
contrib/testpngs/badpal/test-palette-8.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
@@ -1,12 +1,10 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Make a set of test PNG files, MAKEPNG is the name of the makepng executable
|
||||
# built from contrib/libtests/makepng.c
|
||||
|
||||
# Copyright (c) 2015 John Cunningham Bowler
|
||||
|
||||
# Last changed in libpng 1.6.20 [December 3, 2015]
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
# and license in png.h
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
*
|
||||
* Copyright (c) 2013 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
@@ -11,8 +9,8 @@
|
||||
* Generate crc32 and adler32 checksums of the given input files, used to
|
||||
* generate check-codes for use when matching ICC profiles within libpng.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <zlib.h>
|
||||
|
||||
static int
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# chkfmt
|
||||
# chkfmt.sh
|
||||
#
|
||||
# COPYRIGHT: Written by John Cunningham Bowler, 2010.
|
||||
# COPYRIGHT:
|
||||
# Written by John Cunningham Bowler, 2010.
|
||||
# Revised by Cosmin Truta, 2022.
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
# related or neighboring rights to this work. The author published this work
|
||||
# from the United States.
|
||||
#
|
||||
# Check the format of the source files in the current directory - checks for a
|
||||
# line length of 80 characters max and no tab characters.
|
||||
# Check the format of the source files in the current directory:
|
||||
#
|
||||
# * The lines should not exceed a predefined maximum length.
|
||||
# * Tab characters should appear only where necessary (e.g. in makefiles).
|
||||
#
|
||||
# Optionally arguments are files or directories to check.
|
||||
#
|
||||
# -v: output the long lines (makes fixing them easier)
|
||||
# -e: spawn an editor for each file that needs a change ($EDITOR must be
|
||||
# defined). When using -e the script MUST be run from an interactive
|
||||
# command line.
|
||||
# -v: output the long lines (makes fixing them easier)
|
||||
# -e: spawn an editor for each file that needs a change ($EDITOR must be
|
||||
# defined). When using -e the script MUST be run from an interactive
|
||||
# command line.
|
||||
|
||||
script_name=`basename "$0"`
|
||||
|
||||
verbose=
|
||||
edit=
|
||||
vers=
|
||||
@@ -32,14 +39,14 @@ test "$1" = "-e" && {
|
||||
# Copy the standard streams for the editor
|
||||
exec 3>&0 4>&1 5>&2
|
||||
else
|
||||
echo "chkfmt -e: EDITOR must be defined" >&2
|
||||
echo "$script_name -e: EDITOR must be defined" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to edit a single file - if the file isn't changed ask the user
|
||||
# whether or not to continue. This stuff only works if the script is run from
|
||||
# the command line (otherwise, don't specify -e or you will be sorry).
|
||||
# whether or not to continue. This stuff only works if the script is run
|
||||
# from the command line (otherwise, don't specify -e or you will be sorry).
|
||||
doed(){
|
||||
cp "$file" "$file".orig
|
||||
"$EDITOR" "$file" 0>&3 1>&4 2>&5 3>&- 4>&- 5>&- || exit 1
|
||||
@@ -53,19 +60,22 @@ doed(){
|
||||
return 0
|
||||
}
|
||||
|
||||
# In beta versions the version string which appears in files can be a little
|
||||
# long and cause spuriously overlong lines. To avoid this substitute the version
|
||||
# string with a 'standard' version a.b.cc before checking for long lines.
|
||||
# In beta versions, the version string which appears in files can be a little
|
||||
# long and cause spuriously overlong lines. To avoid this, substitute the
|
||||
# version string with a placeholder string "a.b.cc" before checking for long
|
||||
# lines.
|
||||
# (Starting from libpng version 1.6.36, we switched to a conventional Git
|
||||
# workflow, and we are no longer publishing beta versions.)
|
||||
if test -r png.h
|
||||
then
|
||||
vers="`sed -n -e \
|
||||
's/^#define PNG_LIBPNG_VER_STRING .\([0-9]\.[0-9]\.[0-9][0-9a-z]*\).$/\1/p' \
|
||||
png.h`"
|
||||
echo "chkfmt: checking version $vers"
|
||||
echo "$script_name: checking version $vers"
|
||||
fi
|
||||
if test -z "$vers"
|
||||
then
|
||||
echo "chkfmt: png.h not found, ignoring version number" >&2
|
||||
echo "$script_name: png.h not found, ignoring version number" >&2
|
||||
fi
|
||||
|
||||
test -n "$1" || set -- .
|
||||
@@ -89,13 +99,16 @@ find "$@" \( -type d \( -name '.git' -o -name '.libs' -o -name 'projects' \) \
|
||||
check_tabs=
|
||||
line_length=100;;
|
||||
*.awk)
|
||||
# Includes literal tabs
|
||||
# Allow literal tabs.
|
||||
check_tabs=
|
||||
# The following is arbitrary
|
||||
# Mainframe line printer, anyone?
|
||||
line_length=132;;
|
||||
*/ci_*.sh)
|
||||
check_tabs=yes
|
||||
line_length=100;;
|
||||
*contrib/*/*.[ch])
|
||||
check_tabs=yes
|
||||
line_length=96;;
|
||||
line_length=100;;
|
||||
*)
|
||||
check_tabs=yes
|
||||
line_length=80;;
|
||||
@@ -1,7 +1,4 @@
|
||||
/*-
|
||||
* convert.c
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
/* convert.c
|
||||
*
|
||||
* COPYRIGHT: Written by John Cunningham Bowler, 2013.
|
||||
* To the extent possible under law, the author has waived all copyright and
|
||||
@@ -10,6 +7,7 @@
|
||||
*
|
||||
* Convert 8-bit sRGB or 16-bit linear values to another format.
|
||||
*/
|
||||
|
||||
#define _ISOC99_SOURCE 1
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*- genpng
|
||||
/* genpng
|
||||
*
|
||||
* COPYRIGHT: Written by John Cunningham Bowler, 2015.
|
||||
* Revised by Glenn Randers-Pehrson, 2017, to add buffer-size check.
|
||||
@@ -69,6 +69,7 @@
|
||||
* joins are mitres; the outside of the lines are continued to the point of
|
||||
* intersection.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -453,7 +454,7 @@ check_square(const struct arg *arg, double x, double y)
|
||||
* { inside_circle_filled, check_circle_filled },
|
||||
* { inside_circle, check_circle }
|
||||
*
|
||||
* The functions here are analoguous to the square ones; however, they check
|
||||
* The functions here are analogous to the square ones; however, they check
|
||||
* the corresponding ellipse as opposed to the rectangle.
|
||||
*/
|
||||
static int
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
# intgamma.sh
|
||||
#
|
||||
# Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
#
|
||||
# COPYRIGHT: Written by John Cunningham Bowler, 2013.
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
# related or neighboring rights to this work. The author published this work
|
||||
# from the United States.
|
||||
#
|
||||
# Shell script to generate png.c 8-bit and 16-bit log tables (see the code in
|
||||
# png.c for details).
|
||||
@@ -17,11 +15,11 @@
|
||||
# (0..255) value and a similar table for the exponent calculation.
|
||||
#
|
||||
# "bc" must be on the path when the script is executed, and the math library
|
||||
# (-lm) must be available
|
||||
#
|
||||
# function to print out a list of numbers as integers; the function truncates
|
||||
# the integers which must be one-per-line
|
||||
function print(){
|
||||
# (-lm) must be available.
|
||||
|
||||
# Function to print out a list of numbers as integers; the function truncates
|
||||
# the integers which must be one-per-line.
|
||||
print(){
|
||||
awk 'BEGIN{
|
||||
str = ""
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/* makesRGB.c -- build sRGB-to-linear and linear-to-sRGB conversion tables
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
*
|
||||
* COPYRIGHT: Written by John Cunningham Bowler, 2013.
|
||||
* To the extent possible under law, the author has waived all copyright and
|
||||
@@ -14,6 +12,7 @@
|
||||
* approximation to the 8-bit sRGB encoded value. Calculate the error in these
|
||||
* tables and display it.
|
||||
*/
|
||||
|
||||
#define _C99_SOURCE 1
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
@@ -388,7 +387,7 @@ main(int argc, char **argv)
|
||||
|
||||
if (!test_only)
|
||||
{
|
||||
printf("PNG_CONST png_uint_16 png_sRGB_table[256] =\n{\n ");
|
||||
printf("const png_uint_16 png_sRGB_table[256] =\n{\n ");
|
||||
for (i=0; i<255; )
|
||||
{
|
||||
do
|
||||
@@ -401,7 +400,7 @@ main(int argc, char **argv)
|
||||
printf("%d\n};\n\n", png_sRGB_table[i]);
|
||||
|
||||
|
||||
printf("PNG_CONST png_uint_16 png_sRGB_base[512] =\n{\n ");
|
||||
printf("const png_uint_16 png_sRGB_base[512] =\n{\n ");
|
||||
for (i=0; i<511; )
|
||||
{
|
||||
do
|
||||
@@ -413,7 +412,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
printf("%d\n};\n\n", png_sRGB_base[i]);
|
||||
|
||||
printf("PNG_CONST png_byte png_sRGB_delta[512] =\n{\n ");
|
||||
printf("const png_byte png_sRGB_delta[512] =\n{\n ");
|
||||
for (i=0; i<511; )
|
||||
{
|
||||
do
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
|
||||
/* png-fix-itxt version 1.0.0
|
||||
/* png-fix-itxt
|
||||
*
|
||||
* Copyright 2015 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.18 [July 23, 2015]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -10,7 +8,7 @@
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* png-fix-itxt.exe < bad.png > good.png
|
||||
* png-fix-itxt < bad.png > good.png
|
||||
*
|
||||
* Fixes a PNG file written with libpng-1.6.0 or 1.6.1 that has one or more
|
||||
* uncompressed iTXt chunks. Assumes that the actual length is greater
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* pngcp.c
|
||||
*
|
||||
* Copyright (c) 2016 John Cunningham Bowler
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Copyright (c) 2016,2022,2024 John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -14,7 +12,12 @@
|
||||
*
|
||||
* For a more extensive example that uses the transforms see
|
||||
* contrib/libtests/pngimage.c in the libpng distribution.
|
||||
*
|
||||
* This code is not intended for installation in a release system; the command
|
||||
* line options are not documented and most of the behavior is intended for
|
||||
* testing libpng performance, both speed and compression.
|
||||
*/
|
||||
|
||||
#include "pnglibconf.h" /* To find how libpng was configured. */
|
||||
|
||||
#ifdef PNG_PNGCP_TIMING_SUPPORTED
|
||||
@@ -85,16 +88,6 @@
|
||||
# define voidcast(type, value) (value)
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* Many versions of GCC erroneously report that local variables unmodified
|
||||
* within the scope of a setjmp may be clobbered. This hacks round the
|
||||
* problem (sometimes) without harming other compilers.
|
||||
*/
|
||||
# define gv volatile
|
||||
#else
|
||||
# define gv
|
||||
#endif
|
||||
|
||||
/* 'CLOCK_PROCESS_CPUTIME_ID' is one of the clock timers for clock_gettime. It
|
||||
* need not be supported even when clock_gettime is available. It returns the
|
||||
* 'CPU' time the process has consumed. 'CPU' time is assumed to include time
|
||||
@@ -336,7 +329,7 @@ static const option options[] =
|
||||
# define VLC(name) VLCIDAT(name) VLCiCCP(name) VLCzTXt(name)
|
||||
|
||||
# ifdef PNG_SW_COMPRESS_png_level
|
||||
/* The libpng compression level isn't searched because it justs sets the
|
||||
/* The libpng compression level isn't searched because it just sets the
|
||||
* other things that are searched!
|
||||
*/
|
||||
VLO("compression", compression, 0)
|
||||
@@ -392,6 +385,7 @@ struct display
|
||||
{
|
||||
jmp_buf error_return; /* Where to go to on error */
|
||||
unsigned int errset; /* error_return is set */
|
||||
int errlevel; /* error level from longjmp */
|
||||
|
||||
const char *operation; /* What is happening */
|
||||
const char *filename; /* The name of the original file */
|
||||
@@ -503,10 +497,10 @@ display_init(struct display *dp)
|
||||
}
|
||||
|
||||
static void
|
||||
display_clean_read(struct display *dp)
|
||||
display_clean_read(struct display *dp, int freeinfo)
|
||||
{
|
||||
if (dp->read_pp != NULL)
|
||||
png_destroy_read_struct(&dp->read_pp, NULL, NULL);
|
||||
png_destroy_read_struct(&dp->read_pp, freeinfo ? &dp->ip : NULL, NULL);
|
||||
|
||||
if (dp->fp != NULL)
|
||||
{
|
||||
@@ -517,7 +511,7 @@ display_clean_read(struct display *dp)
|
||||
}
|
||||
|
||||
static void
|
||||
display_clean_write(struct display *dp)
|
||||
display_clean_write(struct display *dp, int freeinfo)
|
||||
{
|
||||
if (dp->fp != NULL)
|
||||
{
|
||||
@@ -527,14 +521,14 @@ display_clean_write(struct display *dp)
|
||||
}
|
||||
|
||||
if (dp->write_pp != NULL)
|
||||
png_destroy_write_struct(&dp->write_pp, dp->tsp > 0 ? NULL : &dp->ip);
|
||||
png_destroy_write_struct(&dp->write_pp, freeinfo ? &dp->ip : NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
display_clean(struct display *dp)
|
||||
{
|
||||
display_clean_read(dp);
|
||||
display_clean_write(dp);
|
||||
display_clean_read(dp, 1/*freeinfo*/);
|
||||
display_clean_write(dp, 1/*freeinfo*/);
|
||||
dp->output_file = NULL;
|
||||
|
||||
# if PNG_LIBPNG_VER < 10700 && defined PNG_TEXT_SUPPORTED
|
||||
@@ -631,7 +625,10 @@ display_log(struct display *dp, error_level level, const char *fmt, ...)
|
||||
if (level > APP_FAIL || (level > ERRORS && !(dp->options & CONTINUE)))
|
||||
{
|
||||
if (dp->errset)
|
||||
{
|
||||
dp->errlevel = level;
|
||||
longjmp(dp->error_return, level);
|
||||
}
|
||||
|
||||
else
|
||||
exit(99);
|
||||
@@ -735,7 +732,7 @@ option_index(struct display *dp, const char *opt, size_t len)
|
||||
static int
|
||||
get_option(struct display *dp, const char *opt, int *value)
|
||||
{
|
||||
const png_byte i = option_index(dp, opt, strlen(opt));
|
||||
png_byte i = option_index(dp, opt, strlen(opt));
|
||||
|
||||
if (dp->entry[i]) /* option was set on command line */
|
||||
{
|
||||
@@ -778,7 +775,7 @@ static void
|
||||
set_opt_string(struct display *dp, unsigned int sp)
|
||||
/* Add the appropriate option string to dp->curr. */
|
||||
{
|
||||
dp->stack[sp].opt_string_end = set_opt_string_(dp, sp, dp->stack[sp].opt,
|
||||
dp->stack[sp].opt_string_end = set_opt_string_(dp, sp, dp->stack[sp].opt,
|
||||
options[dp->stack[sp].opt].values[dp->stack[sp].entry].name);
|
||||
}
|
||||
|
||||
@@ -789,7 +786,7 @@ record_opt(struct display *dp, png_byte opt, const char *entry_name)
|
||||
* numerical value.
|
||||
*/
|
||||
{
|
||||
const unsigned int sp = dp->csp; /* stack entry of next searched option */
|
||||
unsigned int sp = dp->csp; /* stack entry of next searched option */
|
||||
|
||||
if (sp >= dp->tsp)
|
||||
{
|
||||
@@ -797,7 +794,7 @@ record_opt(struct display *dp, png_byte opt, const char *entry_name)
|
||||
* searched entry or the start of the dp->curr buffer if there is nothing
|
||||
* on the stack yet (sp == 0).
|
||||
*/
|
||||
const int offset = set_opt_string_(dp, sp, opt, entry_name);
|
||||
int offset = set_opt_string_(dp, sp, opt, entry_name);
|
||||
|
||||
if (sp > 0)
|
||||
dp->stack[sp-1].opt_string_end = offset;
|
||||
@@ -1222,7 +1219,7 @@ advance_opt(struct display *dp, png_byte opt, int search)
|
||||
}
|
||||
|
||||
static int
|
||||
getallopts_(struct display *dp, const png_byte opt, int *value, int record)
|
||||
getallopts_(struct display *dp, png_byte opt, int *value, int record)
|
||||
/* Like getop but iterate over all the values if the option was set to "all".
|
||||
*/
|
||||
{
|
||||
@@ -1259,7 +1256,7 @@ getsearchopts(struct display *dp, const char *opt_str, int *value)
|
||||
/* As above except that if the option was not set try a search */
|
||||
{
|
||||
png_byte istrat;
|
||||
const png_byte opt = option_index(dp, opt_str, strlen(opt_str));
|
||||
png_byte opt = option_index(dp, opt_str, strlen(opt_str));
|
||||
int record = options[opt].search;
|
||||
const char *entry_name;
|
||||
|
||||
@@ -1745,7 +1742,17 @@ read_function(png_structp pp, png_bytep data, size_t size)
|
||||
static void
|
||||
read_png(struct display *dp, const char *filename)
|
||||
{
|
||||
display_clean_read(dp); /* safety */
|
||||
/* This is an assumption of the code; it may happen if a previous write fails
|
||||
* and there is a bug in the cleanup handling below (look for setjmp).
|
||||
* Passing freeinfo==1 to display_clean_read below avoids a second error
|
||||
* on dp->ip != NULL below.
|
||||
*/
|
||||
if (dp->read_pp != NULL)
|
||||
{
|
||||
display_log(dp, APP_FAIL, "unexpected png_read_struct");
|
||||
display_clean_read(dp, 1/*freeinfo*/); /* recovery */
|
||||
}
|
||||
|
||||
display_start_read(dp, filename);
|
||||
|
||||
dp->read_pp = png_create_read_struct(PNG_LIBPNG_VER_STRING, dp,
|
||||
@@ -1769,6 +1776,13 @@ read_png(struct display *dp, const char *filename)
|
||||
png_set_check_for_invalid_index(dp->read_pp, -1/*off completely*/);
|
||||
# endif /* IGNORE_INDEX */
|
||||
|
||||
if (dp->ip != NULL)
|
||||
{
|
||||
/* UNEXPECTED: some problem in the display_clean function calls! */
|
||||
display_log(dp, APP_FAIL, "read_png: freeing old info struct");
|
||||
png_destroy_info_struct(dp->read_pp, &dp->ip);
|
||||
}
|
||||
|
||||
/* The png_read_png API requires us to make the info struct, but it does the
|
||||
* call to png_read_info.
|
||||
*/
|
||||
@@ -1848,7 +1862,14 @@ read_png(struct display *dp, const char *filename)
|
||||
}
|
||||
#endif /* FIX_INDEX */
|
||||
|
||||
display_clean_read(dp);
|
||||
/* NOTE: dp->ip is where all the information about the PNG that was just read
|
||||
* is stored. It can be used to write and write again a single PNG file,
|
||||
* however be aware that prior to libpng 1.7 text chunks could only be
|
||||
* written once; this is a bug which would require a significant code rewrite
|
||||
* to fix, it has been there in several versions of libpng (it was introduced
|
||||
* to fix another bug involving duplicate writes of the text chunks.)
|
||||
*/
|
||||
display_clean_read(dp, 0/*freeiinfo*/);
|
||||
dp->operation = "none";
|
||||
}
|
||||
|
||||
@@ -1975,7 +1996,21 @@ set_text_compression(struct display *dp)
|
||||
static void
|
||||
write_png(struct display *dp, const char *destname)
|
||||
{
|
||||
display_clean_write(dp); /* safety */
|
||||
/* If this test fails png_write_png would fail *silently* below; this
|
||||
* is not helpful, so catch the problem now and give up:
|
||||
*/
|
||||
if (dp->ip == NULL)
|
||||
display_log(dp, INTERNAL_ERROR, "missing png_info");
|
||||
|
||||
/* This is an assumption of the code; it may happen if a previous
|
||||
* write fails and there is a bug in the cleanup handling below.
|
||||
*/
|
||||
if (dp->write_pp != NULL)
|
||||
{
|
||||
display_log(dp, APP_FAIL, "unexpected png_write_struct");
|
||||
display_clean_write(dp, 0/*!freeinfo*/);
|
||||
}
|
||||
|
||||
display_start_write(dp, destname);
|
||||
|
||||
dp->write_pp = png_create_write_struct(PNG_LIBPNG_VER_STRING, dp,
|
||||
@@ -2073,10 +2108,6 @@ write_png(struct display *dp, const char *destname)
|
||||
destname == NULL ? "stdout" : destname, strerror(errno));
|
||||
}
|
||||
|
||||
/* Clean it on the way out - if control returns to the caller then the
|
||||
* written_file contains the required data.
|
||||
*/
|
||||
display_clean_write(dp);
|
||||
dp->operation = "none";
|
||||
}
|
||||
|
||||
@@ -2220,7 +2251,7 @@ cp_one_file(struct display *dp, const char *filename, const char *destname)
|
||||
strcpy(dp->best, dp->curr);
|
||||
dp->best_size = dp->write_size;
|
||||
|
||||
if (dp->nsp > 0) /* interating over lists */
|
||||
if (dp->nsp > 0) /* iterating over lists */
|
||||
{
|
||||
char *tmpname, tmpbuf[(sizeof dp->namebuf) + 4];
|
||||
assert(dp->curr[0] == ' ' && dp->tsp > 0);
|
||||
@@ -2243,6 +2274,10 @@ cp_one_file(struct display *dp, const char *filename, const char *destname)
|
||||
/* Loop to find the best option. */
|
||||
do
|
||||
{
|
||||
/* Clean before each write_png; this just removes *dp->write_pp which
|
||||
* cannot be reused.
|
||||
*/
|
||||
display_clean_write(dp, 0/*!freeinfo*/);
|
||||
write_png(dp, tmpname);
|
||||
|
||||
/* And compare the sizes (the write function makes sure write_size
|
||||
@@ -2272,17 +2307,14 @@ cp_one_file(struct display *dp, const char *filename, const char *destname)
|
||||
/* Do this for the 'sizes' option so that it reports the correct size. */
|
||||
dp->write_size = dp->best_size;
|
||||
}
|
||||
|
||||
display_clean_write(dp, 1/*freeinfo*/);
|
||||
}
|
||||
|
||||
static int
|
||||
cppng(struct display *dp, const char *file, const char *gv dest)
|
||||
/* Exists solely to isolate the setjmp clobbers which some versions of GCC
|
||||
* erroneously generate.
|
||||
*/
|
||||
cppng(struct display *dp, const char *file, const char *dest)
|
||||
{
|
||||
int ret = setjmp(dp->error_return);
|
||||
|
||||
if (ret == 0)
|
||||
if (setjmp(dp->error_return) == 0)
|
||||
{
|
||||
dp->errset = 1;
|
||||
cp_one_file(dp, file, dest);
|
||||
@@ -2294,15 +2326,16 @@ cppng(struct display *dp, const char *file, const char *gv dest)
|
||||
{
|
||||
dp->errset = 0;
|
||||
|
||||
if (ret < ERRORS) /* shouldn't longjmp on warnings */
|
||||
display_log(dp, INTERNAL_ERROR, "unexpected return code %d", ret);
|
||||
if (dp->errlevel < ERRORS) /* shouldn't longjmp on warnings */
|
||||
display_log(dp, INTERNAL_ERROR, "unexpected return code %d",
|
||||
dp->errlevel);
|
||||
|
||||
return ret;
|
||||
return dp->errlevel;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(const int argc, const char * const * const argv)
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
/* For each file on the command line test it with a range of transforms */
|
||||
int option_end;
|
||||
@@ -2379,7 +2412,7 @@ main(const int argc, const char * const * const argv)
|
||||
/* Here on any return, including failures, except user/internal issues
|
||||
*/
|
||||
{
|
||||
const int pass = (d.options & STRICT) ?
|
||||
int pass = (d.options & STRICT) ?
|
||||
RESULT_STRICT(d.results) : RESULT_RELAXED(d.results);
|
||||
|
||||
if (!pass)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* pngfix.c
|
||||
*
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 2014-2017 John Cunningham Bowler
|
||||
* Copyright (c) 2014-2017,2024 John Cunningham Bowler
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
@@ -10,6 +9,7 @@
|
||||
* Tool to check and fix the zlib inflate 'too far back' problem.
|
||||
* See the usage message for more information.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -20,19 +20,6 @@
|
||||
|
||||
#define implies(x,y) assert(!(x) || (y))
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* This is used to fix the error:
|
||||
*
|
||||
* pngfix.c:
|
||||
* In function 'zlib_advance':
|
||||
* pngfix.c:181:13: error: assuming signed overflow does not
|
||||
* occur when simplifying conditional to constant [-Werror=strict-overflow]
|
||||
*/
|
||||
# define FIX_GCC volatile
|
||||
#else
|
||||
# define FIX_GCC
|
||||
#endif
|
||||
|
||||
#define PROGRAM_NAME "pngfix"
|
||||
|
||||
/* Define the following to use this program against your installed libpng,
|
||||
@@ -218,7 +205,7 @@ uarb_inc(uarb num, int in_digits, png_int_32 add)
|
||||
* in_digits+1 if add is known to be in the range -65535..65535.
|
||||
*/
|
||||
{
|
||||
FIX_GCC int out_digits = 0;
|
||||
int out_digits = 0;
|
||||
|
||||
while (out_digits < in_digits)
|
||||
{
|
||||
@@ -263,7 +250,7 @@ uarb_add32(uarb num, int in_digits, png_uint_32 add)
|
||||
}
|
||||
|
||||
static int
|
||||
uarb_mult_digit(uarb acc, int a_digits, uarb num, FIX_GCC int n_digits,
|
||||
uarb_mult_digit(uarb acc, int a_digits, uarb num, int n_digits,
|
||||
png_uint_16 val)
|
||||
/* Primitive one-digit multiply - 'val' must be 0..65535. Note that this
|
||||
* primitive is a multiply and accumulate - the result of *num * val is added
|
||||
@@ -336,7 +323,7 @@ uarb_shift(uarb inout, int ndigits, unsigned int right_shift)
|
||||
* 1..15
|
||||
*/
|
||||
{
|
||||
FIX_GCC int i = ndigits;
|
||||
int i = ndigits;
|
||||
png_uint_16 carry = 0;
|
||||
|
||||
assert(right_shift >= 1 && right_shift <= 15);
|
||||
@@ -351,7 +338,7 @@ uarb_shift(uarb inout, int ndigits, unsigned int right_shift)
|
||||
inout[i] = temp;
|
||||
|
||||
/* The shift may reduce ndigits */
|
||||
if (i == ndigits-1 && temp == 0)
|
||||
if (i+1 == ndigits && temp == 0)
|
||||
ndigits = i;
|
||||
}
|
||||
|
||||
@@ -772,7 +759,7 @@ skip_chunk_type(const struct global *global, png_uint_32 type)
|
||||
return 0;
|
||||
|
||||
/* Chunks that specify gamma encoding which should therefore only be
|
||||
* removed the the user insists:
|
||||
* removed if the user insists:
|
||||
*/
|
||||
case png_gAMA: case png_sRGB:
|
||||
if (global->skip >= SKIP_ALL)
|
||||
@@ -867,7 +854,7 @@ struct file
|
||||
* signature (in length,type).
|
||||
*
|
||||
* When a chunk control structure is instantiated these values are copied
|
||||
* into the structure and can then be overritten with the data for the next
|
||||
* into the structure and can then be overwritten with the data for the next
|
||||
* chunk.
|
||||
*/
|
||||
fpos_t data_pos; /* Position of first byte of chunk data */
|
||||
@@ -1005,10 +992,18 @@ file_end(struct file *file)
|
||||
|
||||
if (file->out != NULL)
|
||||
{
|
||||
/* NOTE: this is bitwise |, all the following functions must execute and
|
||||
* must succeed.
|
||||
/* On some systems 'fclose' deletes the FILE struct (making it
|
||||
* inaccessbile). There is no guarantee that fclose returns an error
|
||||
* code from fflush or, indeed, from the FILE error indicator. There is
|
||||
* also no explicit (or clear) guarantee in the standard that anything
|
||||
* other than a read or write operation sets the error indicator; fflush
|
||||
* is not a read or write operation, so both conditions must be checked
|
||||
* to ensure the close succeeded and in ANSI-C conformant code they must
|
||||
* be checked before the fclose call.
|
||||
*/
|
||||
if (ferror(file->out) | fflush(file->out) | fclose(file->out))
|
||||
const int err = fflush(file->out) || ferror(file->out);
|
||||
|
||||
if (fclose(file->out) || err)
|
||||
{
|
||||
perror(file->out_name);
|
||||
emit_error(file, READ_ERROR_CODE, "output write error");
|
||||
@@ -1598,7 +1593,7 @@ chunk_init(struct chunk * const chunk, struct file * const file)
|
||||
chunk->chunk_length = file->length;
|
||||
chunk->chunk_type = file->type;
|
||||
|
||||
/* Compresssed/uncompressed size information (from the zlib control structure
|
||||
/* Compressed/uncompressed size information (from the zlib control structure
|
||||
* that is used to check the compressed data in a chunk.)
|
||||
*/
|
||||
chunk->uncompressed_digits = 0;
|
||||
@@ -2514,7 +2509,7 @@ zlib_run(struct zlib *zlib)
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
const unsigned int count = list->count;
|
||||
unsigned int count = list->count;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i<count; ++i)
|
||||
@@ -2791,7 +2786,7 @@ process_chunk(struct file *file, png_uint_32 file_crc, png_uint_32 next_length,
|
||||
* to read_chunk.
|
||||
*/
|
||||
{
|
||||
const png_uint_32 type = file->type;
|
||||
png_uint_32 type = file->type;
|
||||
|
||||
if (file->global->verbose > 1)
|
||||
{
|
||||
@@ -2929,7 +2924,7 @@ process_chunk(struct file *file, png_uint_32 file_crc, png_uint_32 next_length,
|
||||
}
|
||||
|
||||
/* Control reaches this point if the chunk must be skipped. For chunks other
|
||||
* than IDAT this means that the zlib compressed data is fatally damanged and
|
||||
* than IDAT this means that the zlib compressed data is fatally damaged and
|
||||
* the chunk will not be passed to libpng. For IDAT it means that the end of
|
||||
* the IDAT stream has not yet been reached and we must handle the next
|
||||
* (IDAT) chunk. If the LZ data in an IDAT stream cannot be read 'stop' must
|
||||
@@ -3152,7 +3147,7 @@ read_chunk(struct file *file)
|
||||
}
|
||||
}
|
||||
|
||||
/* Control gets to here if the the stream seems invalid or damaged in some
|
||||
/* Control gets to here if the stream seems invalid or damaged in some
|
||||
* way. Either there was a problem reading all the expected data (this
|
||||
* chunk's data, its CRC and the length and type of the next chunk) or the
|
||||
* next chunk length/type are invalid. Notice that the cases that end up
|
||||
@@ -3710,7 +3705,7 @@ usage(const char *prog)
|
||||
" practice most programs will ignore it.",
|
||||
" bKGD [transform]: This is used by libpng transforms."
|
||||
" --max=<number>:",
|
||||
" Use IDAT chunks sized <number>. If no number is given the the IDAT",
|
||||
" Use IDAT chunks sized <number>. If no number is given the IDAT",
|
||||
" chunks will be the maximum size permitted; 2^31-1 bytes. If the option",
|
||||
" is omitted the original chunk sizes will not be changed. When the",
|
||||
" option is given --strip=unsafe is set automatically. This may be",
|
||||
@@ -3961,6 +3956,14 @@ main(int argc, const char **argv)
|
||||
{
|
||||
size_t outlen = strlen(*argv);
|
||||
|
||||
if (outlen > FILENAME_MAX)
|
||||
{
|
||||
fprintf(stderr, "%s: output file name too long: %s%s%s\n",
|
||||
prog, prefix, *argv, suffix ? suffix : "");
|
||||
global.status_code |= WRITE_ERROR;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (outfile == NULL) /* else this takes precedence */
|
||||
{
|
||||
/* Consider the prefix/suffix options */
|
||||
@@ -4046,4 +4049,4 @@ main(void)
|
||||
return 77;
|
||||
}
|
||||
#endif /* PNG_SETJMP_SUPPORTED */
|
||||
|
||||
/* vi: set textwidth=80 shiftwidth=3 softtabstop=-1 expandtab: */
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# reindent a libpng C source
|
||||
|
||||
# COPYRIGHT: Written by Glenn Randers-Pehrson, 2016.
|
||||
# To the extent possible under law, the author has waived all copyright and
|
||||
# related or neighboring rights to this work. This work is published from:
|
||||
# United States.
|
||||
|
||||
# Usage:
|
||||
# reindent inputtabsize outputtabsize inputcontinuestring outputcontinuestring
|
||||
#
|
||||
# Assumes that continued lines begin with indentation plus one space, and
|
||||
# that continued comments begin with indentation plus " *".
|
||||
#
|
||||
# eg, to change libpng coding style from 3-space indentation with 4-space
|
||||
# continuations to 4-space indentation with 2-space continuations:
|
||||
#
|
||||
# reindent 3 4 "\t " " " < example.c > example.c_4_2
|
||||
# and to restore the file back to libpng coding style
|
||||
# reindent 4 3 " " " " < example.c_4_2 > example.c_3_4
|
||||
|
||||
unexpand --first-only --t $1 | \
|
||||
sed -e "/^ *$3[^\*]/{s/$3/$4/}" | \
|
||||
expand -t $2
|
||||
@@ -1,7 +1,4 @@
|
||||
/*-
|
||||
* sRGB.h
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
/* sRGB.h
|
||||
*
|
||||
* COPYRIGHT: Written by John Cunningham Bowler, 2013.
|
||||
* To the extent possible under law, the author has waived all copyright and
|
||||
@@ -16,6 +13,7 @@
|
||||
* (in fact the source of the numbers is the wikipedia article at
|
||||
* https://en.wikipedia.org/wiki/SRGB).
|
||||
*/
|
||||
|
||||
static double
|
||||
sRGB_from_linear(double l)
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if filename given on commandline, store it */
|
||||
/* if filename given on command line, store it */
|
||||
if ((szCmdLine != NULL) && (*szCmdLine != '\0'))
|
||||
if (szCmdLine[0] == '"')
|
||||
strncpy (szCmdFileName, szCmdLine + 1, strlen(szCmdLine) - 2);
|
||||
|
||||
2
depcomp
@@ -3,7 +3,7 @@
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
|
||||
# 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
|
||||
|
||||
159
install-sh
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2018-03-11.20; # UTC
|
||||
scriptversion=2023-11-23.18; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
@@ -69,6 +69,11 @@ posix_mkdir=
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
# Create dirs (including intermediate dirs) using mode 755.
|
||||
# This is like GNU 'install' as of coreutils 8.32 (2020).
|
||||
mkdir_umask=22
|
||||
|
||||
backupsuffix=
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
@@ -99,19 +104,29 @@ Options:
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-C install only if different (preserve data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-p pass -p to $cpprog.
|
||||
-s $stripprog installed files.
|
||||
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
By default, rm is invoked with -f; when overridden with RMPROG,
|
||||
it's up to you to specify -f if you want it.
|
||||
|
||||
If -S is not specified, no backups are attempted.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
GNU Automake home page: <https://www.gnu.org/software/automake/>.
|
||||
General help using GNU software: <https://www.gnu.org/gethelp/>."
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
@@ -137,8 +152,13 @@ while test $# -ne 0; do
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-p) cpprog="$cpprog -p";;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-S) backupsuffix="$2"
|
||||
shift;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
@@ -255,6 +275,10 @@ do
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
# Don't chown directories that already exist.
|
||||
if test $dstdir_status = 0; then
|
||||
chowncmd=""
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
@@ -301,22 +325,6 @@ do
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
@@ -326,52 +334,49 @@ do
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
# Note that $RANDOM variable is not portable (e.g. dash); Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
# The $RANDOM variable is not portable (e.g., dash). Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
trap '
|
||||
ret=$?
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
|
||||
exit $ret
|
||||
' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p' feature.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p'.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac
|
||||
|
||||
if
|
||||
@@ -382,7 +387,7 @@ do
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
@@ -411,7 +416,7 @@ do
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
(umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
@@ -451,7 +456,18 @@ do
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
(umask $cp_umask &&
|
||||
{ test -z "$stripcmd" || {
|
||||
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
||||
# which would cause strip to fail.
|
||||
if test -z "$doit"; then
|
||||
: >"$dsttmp" # No need to fork-exec 'touch'.
|
||||
else
|
||||
$doit touch "$dsttmp"
|
||||
fi
|
||||
}
|
||||
} &&
|
||||
$doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
@@ -477,6 +493,13 @@ do
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# If $backupsuffix is set, and the file being installed
|
||||
# already exists, attempt a backup. Don't worry if it fails,
|
||||
# e.g., if mv doesn't support -f.
|
||||
if test -n "$backupsuffix" && test -f "$dst"; then
|
||||
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
@@ -491,9 +514,9 @@ do
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
$doit $rmcmd "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
|
||||
/* filter_sse2_intrinsics.c - SSE2 optimized filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2016-2017 Glenn Randers-Pehrson
|
||||
* Written by Mike Klein and Matt Sarett
|
||||
* Derived from arm/filter_neon_intrinsics.c
|
||||
*
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
@@ -29,39 +28,25 @@
|
||||
*/
|
||||
|
||||
static __m128i load4(const void* p) {
|
||||
return _mm_cvtsi32_si128(*(const int*)p);
|
||||
int tmp;
|
||||
memcpy(&tmp, p, sizeof(tmp));
|
||||
return _mm_cvtsi32_si128(tmp);
|
||||
}
|
||||
|
||||
static void store4(void* p, __m128i v) {
|
||||
*(int*)p = _mm_cvtsi128_si32(v);
|
||||
int tmp = _mm_cvtsi128_si32(v);
|
||||
memcpy(p, &tmp, sizeof(int));
|
||||
}
|
||||
|
||||
static __m128i load3(const void* p) {
|
||||
/* We'll load 2 bytes, then 1 byte,
|
||||
* then mask them together, and finally load into SSE.
|
||||
*/
|
||||
const png_uint_16* p01 = (png_const_uint_16p)p;
|
||||
const png_byte* p2 = (const png_byte*)(p01+1);
|
||||
|
||||
png_uint_32 v012 = (png_uint_32)(*p01)
|
||||
| (png_uint_32)(*p2) << 16;
|
||||
return load4(&v012);
|
||||
png_uint_32 tmp = 0;
|
||||
memcpy(&tmp, p, 3);
|
||||
return _mm_cvtsi32_si128(tmp);
|
||||
}
|
||||
|
||||
static void store3(void* p, __m128i v) {
|
||||
/* We'll pull from SSE as a 32-bit int, then write
|
||||
* its bottom two bytes, then its third byte.
|
||||
*/
|
||||
png_uint_32 v012;
|
||||
png_uint_16* p01;
|
||||
png_byte* p2;
|
||||
|
||||
store4(&v012, v);
|
||||
|
||||
p01 = (png_uint_16p)p;
|
||||
p2 = (png_byte*)(p01+1);
|
||||
*p01 = (png_uint_16)v012;
|
||||
*p2 = (png_byte)(v012 >> 16);
|
||||
int tmp = _mm_cvtsi128_si32(v);
|
||||
memcpy(p, &tmp, 3);
|
||||
}
|
||||
|
||||
void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
|
||||
@@ -274,7 +259,7 @@ void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row,
|
||||
a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
|
||||
|
||||
/* (p-a) == (a+b-c - a) == (b-c) */
|
||||
|
||||
|
||||
pa = _mm_sub_epi16(b,c);
|
||||
|
||||
/* (p-b) == (a+b-c - b) == (a-c) */
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
|
||||
/* intel_init.c - SSE2 optimized filter functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2016-2017 Glenn Randers-Pehrson
|
||||
* Written by Mike Klein and Matt Sarett, Google, Inc.
|
||||
* Derived from arm/arm_init.c
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
|
||||