forked from external-repos/squoosh
Compare commits
914 Commits
kosamari-p
...
urls-bug
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
886d8d632b | ||
|
|
e2d1adf5e9 | ||
|
|
223da087b2 | ||
|
|
765402404a | ||
|
|
397193a5f5 | ||
|
|
c260f3e280 | ||
|
|
45187c4932 | ||
|
|
9b8d3b1bd8 | ||
|
|
a811b6cf41 | ||
|
|
ba0df8e2ff | ||
|
|
f91c7a267d | ||
|
|
99f2286a73 | ||
|
|
f414092ea9 | ||
|
|
c683dfaaed | ||
|
|
12fb647fde | ||
|
|
2ee1dfa867 | ||
|
|
fa331586d7 | ||
|
|
4192c607f1 | ||
|
|
128096afd9 | ||
|
|
58661078e2 | ||
|
|
cbfa503fcb | ||
|
|
96b6dc8e6e | ||
|
|
4033d1c965 | ||
|
|
f779e13bc8 | ||
|
|
2f00fe2b1b | ||
|
|
118885cd26 | ||
|
|
af80643809 | ||
|
|
1aba7b51ee | ||
|
|
b0a7b21b0b | ||
|
|
8dfe35aa77 | ||
|
|
1a891072c0 | ||
|
|
720cb98872 | ||
|
|
4e1dcb819c | ||
|
|
c36f4bebb8 | ||
|
|
c04bb54f0d | ||
|
|
4890c56abb | ||
|
|
392aced394 | ||
|
|
8bcaeb2f78 | ||
|
|
c417bd0a7a | ||
|
|
eb8204d69b | ||
|
|
25754b91b7 | ||
|
|
875c24525b | ||
|
|
50ed5febd3 | ||
|
|
10c5082499 | ||
|
|
f0fb891498 | ||
|
|
b9b6e57581 | ||
|
|
ff9dea465f | ||
|
|
912c1fac08 | ||
|
|
ad0d46de3e | ||
|
|
efc89efba5 | ||
|
|
8ed50d8f0c | ||
|
|
b50402e3b3 | ||
|
|
df65f1a112 | ||
|
|
58c09ff740 | ||
|
|
33c0c3b034 | ||
|
|
e900d33092 | ||
|
|
650c662ffa | ||
|
|
2bf0b904cd | ||
|
|
9d890a8fd6 | ||
|
|
914bff41c6 | ||
|
|
86c4271844 | ||
|
|
56beb6786a | ||
|
|
ef77da9e96 | ||
|
|
42cfbe11a1 | ||
|
|
0874a3ba52 | ||
|
|
7f6ee3204f | ||
|
|
37d778e4da | ||
|
|
8f24c9b5ce | ||
|
|
9d3401762e | ||
|
|
a783de618d | ||
|
|
659d2b8277 | ||
|
|
934ab9065a | ||
|
|
029c2ebb83 | ||
|
|
dc40f84a65 | ||
|
|
2c0dd363d4 | ||
|
|
e6916575b7 | ||
|
|
1c7486056d | ||
|
|
8e8b75684d | ||
|
|
92ade727aa | ||
|
|
6117c9dd26 | ||
|
|
a3be343959 | ||
|
|
39c6be41df | ||
|
|
5603f2d6e7 | ||
|
|
0d72f652c5 | ||
|
|
7ce0c8a4fc | ||
|
|
30528c2330 | ||
|
|
b4329c5bed | ||
|
|
5845e566da | ||
|
|
5d0c856fa0 | ||
|
|
ff25dd81f8 | ||
|
|
c7d156e8d7 | ||
|
|
02532b5a31 | ||
|
|
c5c95254f0 | ||
|
|
dfa7695a97 | ||
|
|
7095ed2f7a | ||
|
|
61a66c4ed4 | ||
|
|
c6188c8846 | ||
|
|
ae583f7581 | ||
|
|
22a948267c | ||
|
|
35f5ad6e2b | ||
|
|
34d3c13b5d | ||
|
|
dba8f097d3 | ||
|
|
36293d756b | ||
|
|
ad07584730 | ||
|
|
e260994600 | ||
|
|
f55e4cf9a8 | ||
|
|
a1ea6223ac | ||
|
|
e7e205c326 | ||
|
|
990a43b733 | ||
|
|
1a40c57876 | ||
|
|
e8afe408f1 | ||
|
|
9352569852 | ||
|
|
10d648c28d | ||
|
|
1e64e52298 | ||
|
|
733b470f1f | ||
|
|
e72dcd6c6e | ||
|
|
62b4d39128 | ||
|
|
d338e8a048 | ||
|
|
f2a947df9e | ||
|
|
3ec55b0a03 | ||
|
|
3338808f17 | ||
|
|
5bdba43b33 | ||
|
|
c63120d4ce | ||
|
|
405dd1cdfa | ||
|
|
b958d46086 | ||
|
|
c3d05e0e2d | ||
|
|
0c848a33ad | ||
|
|
57357f5c8d | ||
|
|
6bfd1f2c29 | ||
|
|
8b20aa5f14 | ||
|
|
81e171e684 | ||
|
|
7b4dbbfe2d | ||
|
|
a972dfdeed | ||
|
|
f190ca6069 | ||
|
|
adb2f7ed50 | ||
|
|
d6de741ddc | ||
|
|
b5f708a1e6 | ||
|
|
15248bf85a | ||
|
|
5d691af8a1 | ||
|
|
722f1c806c | ||
|
|
522449adc1 | ||
|
|
07b4e53718 | ||
|
|
c6e6042726 | ||
|
|
94b9d08719 | ||
|
|
064b152e2a | ||
|
|
9de95f74fe | ||
|
|
21a8f62dcc | ||
|
|
9062a75541 | ||
|
|
fec826b106 | ||
|
|
12889d9d50 | ||
|
|
a19e97b2ed | ||
|
|
5765ea5aa4 | ||
|
|
c11e99c811 | ||
|
|
76d8a636af | ||
|
|
5758e5db9a | ||
|
|
4e4778397f | ||
|
|
aff137218d | ||
|
|
fa5bd3d1c6 | ||
|
|
d1533d66a2 | ||
|
|
83b52cabc1 | ||
|
|
c832287fa6 | ||
|
|
ed55660c88 | ||
|
|
33d60658cd | ||
|
|
5af8810e0b | ||
|
|
33c3fd3278 | ||
|
|
f5be882b10 | ||
|
|
2a8a2f2952 | ||
|
|
200e01132c | ||
|
|
fe6cc5c503 | ||
|
|
d25d01c705 | ||
|
|
7699f75b45 | ||
|
|
4976ad8481 | ||
|
|
60cef4cb3a | ||
|
|
6b8d2e058c | ||
|
|
004e18036b | ||
|
|
f051dcb07c | ||
|
|
4e5bb64565 | ||
|
|
89508c9385 | ||
|
|
951e0dc93a | ||
|
|
c35c285273 | ||
|
|
45fe4d2917 | ||
|
|
ef31e5cbd1 | ||
|
|
d8bd12fc6a | ||
|
|
3abc770053 | ||
|
|
a3b341f813 | ||
|
|
58a6abffbb | ||
|
|
869d3f7732 | ||
|
|
618a4d777b | ||
|
|
7266c94f52 | ||
|
|
d15dba7d20 | ||
|
|
0ded493489 | ||
|
|
990018f758 | ||
|
|
4f4eaf01b7 | ||
|
|
19fab33d3c | ||
|
|
6f19d027b4 | ||
|
|
73499d4a27 | ||
|
|
8581785869 | ||
|
|
198ad0fb1b | ||
|
|
f0d341aefa | ||
|
|
69e62339e6 | ||
|
|
195762f64f | ||
|
|
a951096aaa | ||
|
|
24d241564e | ||
|
|
3d1ecc1215 | ||
|
|
25fb1a9c80 | ||
|
|
3ae1cf86f5 | ||
|
|
a699a5c4dc | ||
|
|
613401c541 | ||
|
|
f450373e3f | ||
|
|
750872aca6 | ||
|
|
beaabe47dc | ||
|
|
8f7369068c | ||
|
|
10bfd60e20 | ||
|
|
7f08348509 | ||
|
|
f77ddac652 | ||
|
|
13631f1cfc | ||
|
|
f11e692d58 | ||
|
|
f0221b626d | ||
|
|
10c5ed0495 | ||
|
|
d945c79796 | ||
|
|
30b628c1b9 | ||
|
|
6ebf94d1b6 | ||
|
|
a229662bed | ||
|
|
e995b445ef | ||
|
|
6da590c7d0 | ||
|
|
56e10b3aa2 | ||
|
|
fd87ae7d2a | ||
|
|
67df305594 | ||
|
|
106d733fec | ||
|
|
67c64d4df3 | ||
|
|
75d571cb6c | ||
|
|
af954bd9e0 | ||
|
|
5df7dd7590 | ||
|
|
013946b137 | ||
|
|
81c183b0d6 | ||
|
|
f523db6403 | ||
|
|
cc6ea9e11c | ||
|
|
bd4b67037b | ||
|
|
8c5c97e106 | ||
|
|
a9d3bd71b5 | ||
|
|
0d0a9b4cdf | ||
|
|
f583770696 | ||
|
|
bae243ccdb | ||
|
|
02c113a68f | ||
|
|
600eead007 | ||
|
|
05416768d5 | ||
|
|
35d31f2324 | ||
|
|
82fadac70e | ||
|
|
47f9d22dd8 | ||
|
|
9420dba3bc | ||
|
|
e462875807 | ||
|
|
0747d2c419 | ||
|
|
4c658b79ef | ||
|
|
685558847f | ||
|
|
612cee0011 | ||
|
|
911ca32c35 | ||
|
|
49cb8b268c | ||
|
|
4946268ae2 | ||
|
|
4487da9e9e | ||
|
|
09f65d0cd7 | ||
|
|
63ac34a662 | ||
|
|
261b3ad013 | ||
|
|
1b886aa4e2 | ||
|
|
1d5fd98a3e | ||
|
|
588d5ad44e | ||
|
|
139b635eed | ||
|
|
516c0aa8e7 | ||
|
|
273b4211c9 | ||
|
|
ef920ac6ba | ||
|
|
f445a5dcbe | ||
|
|
42f9e4aed2 | ||
|
|
e14790f0b9 | ||
|
|
dfee848a39 | ||
|
|
c8dc88f8a1 | ||
|
|
a437afdf2b | ||
|
|
1d7b6ab13e | ||
|
|
1e700cd7c3 | ||
|
|
01c04d4a72 | ||
|
|
df45b996d1 | ||
|
|
c9a271f57a | ||
|
|
c37f798565 | ||
|
|
e9b9993189 | ||
|
|
96b1ec2356 | ||
|
|
e5d254ad80 | ||
|
|
b1b3c8c461 | ||
|
|
1f2f5d1c61 | ||
|
|
12a719f05a | ||
|
|
28c7b7aa94 | ||
|
|
6e3e6af70e | ||
|
|
31118daa18 | ||
|
|
47fb7f9f71 | ||
|
|
3b07862efb | ||
|
|
f0eb79f2f1 | ||
|
|
ebdb00f50d | ||
|
|
4b6334a212 | ||
|
|
483daa0493 | ||
|
|
4768bc17ba | ||
|
|
0934c6c00f | ||
|
|
9d81a9cd57 | ||
|
|
239ffeb7a7 | ||
|
|
95570c8b3c | ||
|
|
6e52ac2a73 | ||
|
|
fd5c557065 | ||
|
|
0abb6f18ba | ||
|
|
4e5a810770 | ||
|
|
8a81792bd5 | ||
|
|
3f57f9fef1 | ||
|
|
549e1fc50a | ||
|
|
f3749a4e24 | ||
|
|
e316b0d667 | ||
|
|
8f2dcb5f48 | ||
|
|
0b4a673b13 | ||
|
|
8c56d16aea | ||
|
|
5715fb7b1b | ||
|
|
cd33a2f759 | ||
|
|
ee561bb00e | ||
|
|
773208d76e | ||
|
|
75275a5596 | ||
|
|
8cd811cafd | ||
|
|
4e090ea2f8 | ||
|
|
6b007a0235 | ||
|
|
c23d1091e7 | ||
|
|
d4f8b7f38b | ||
|
|
2c923e5239 | ||
|
|
fe52c9b307 | ||
|
|
3745a3fff1 | ||
|
|
d89e846896 | ||
|
|
db6dea846a | ||
|
|
8036579a3c | ||
|
|
0807fa4b9a | ||
|
|
3cda8285a1 | ||
|
|
0218d0aac5 | ||
|
|
cfba6e7bd5 | ||
|
|
c6015e2e8d | ||
|
|
94a2a7b32f | ||
|
|
03f33847a3 | ||
|
|
563b558204 | ||
|
|
3c92f2d531 | ||
|
|
f5ab9a9a59 | ||
|
|
7893660679 | ||
|
|
15dac42a7f | ||
|
|
53298a23ad | ||
|
|
7ffa45ba86 | ||
|
|
ee99cf6e0b | ||
|
|
2edb8cbd7e | ||
|
|
0ac3d17969 | ||
|
|
1baa823d77 | ||
|
|
368ad9505e | ||
|
|
08c267a98b | ||
|
|
0c3ef3fdf5 | ||
|
|
17dcc9c7d4 | ||
|
|
ac9a7767d2 | ||
|
|
c29006d593 | ||
|
|
e1ab43b76f | ||
|
|
409df481db | ||
|
|
02807aab32 | ||
|
|
34cb55978f | ||
|
|
d0f5d5a644 | ||
|
|
37f09245a6 | ||
|
|
c43f75f1f2 | ||
|
|
227d32be7b | ||
|
|
87955ab9a0 | ||
|
|
ecb0b15cdc | ||
|
|
ed451e4dfa | ||
|
|
1a26057452 | ||
|
|
98b930abde | ||
|
|
ddbeaa0870 | ||
|
|
b69dc4c7f4 | ||
|
|
ed6b8b89c6 | ||
|
|
2580f1e292 | ||
|
|
2ac684f98f | ||
|
|
b8d921ec16 | ||
|
|
9c0a375f01 | ||
|
|
d1cff7d84e | ||
|
|
9c2b582986 | ||
|
|
e342766cbf | ||
|
|
f1cd6a87da | ||
|
|
39e5741cb2 | ||
|
|
93cbe557cd | ||
|
|
97931bad22 | ||
|
|
1f35c40d3f | ||
|
|
c39383333f | ||
|
|
4fc18de5f9 | ||
|
|
aac30e6fd3 | ||
|
|
45785bcca3 | ||
|
|
f36cb5d3ef | ||
|
|
b7f7a5ac0a | ||
|
|
dd895f026b | ||
|
|
548c126521 | ||
|
|
ca00a22303 | ||
|
|
1ce6dd73d8 | ||
|
|
ff7dc2c4cf | ||
|
|
117b87132e | ||
|
|
42e7a7e165 | ||
|
|
796324ad71 | ||
|
|
cf1a718534 | ||
|
|
718427badb | ||
|
|
c5c520a71d | ||
|
|
17ffa57a8b | ||
|
|
005d5180b4 | ||
|
|
ce9b96994c | ||
|
|
a1fb445b06 | ||
|
|
8a516131ea | ||
|
|
9816be83ab | ||
|
|
63f607a3ea | ||
|
|
57418034c4 | ||
|
|
3892490023 | ||
|
|
5bedff583b | ||
|
|
d94835402f | ||
|
|
b7e45ab843 | ||
|
|
8313246fd1 | ||
|
|
2b3cafb1f4 | ||
|
|
d52698f005 | ||
|
|
6ad28c0b5c | ||
|
|
c76dabf063 | ||
|
|
e6d8bac9c5 | ||
|
|
42e43730c8 | ||
|
|
5c17fba349 | ||
|
|
85eb94b725 | ||
|
|
4fa73be842 | ||
|
|
7c89d09139 | ||
|
|
079e56f1e1 | ||
|
|
6065ceabfe | ||
|
|
265e6db2bd | ||
|
|
3a5c0aa30c | ||
|
|
f0c3ec9d51 | ||
|
|
1ae93b527c | ||
|
|
a95cb740bf | ||
|
|
de543b3206 | ||
|
|
1542bfb7fd | ||
|
|
f95954a9f1 | ||
|
|
bc8d75128f | ||
|
|
d3252bb1bb | ||
|
|
83d9d2c764 | ||
|
|
476268fe19 | ||
|
|
74492af675 | ||
|
|
bd4179aff2 | ||
|
|
27ae47117e | ||
|
|
7da3f07333 | ||
|
|
eeb3d3562a | ||
|
|
2d73c24e09 | ||
|
|
ed666dd381 | ||
|
|
6f18f08a8e | ||
|
|
eae808cb6f | ||
|
|
0ae99c9228 | ||
|
|
f4a16022ef | ||
|
|
12153c72dc | ||
|
|
ae7782031d | ||
|
|
7cd6487a28 | ||
|
|
62c53c9fed | ||
|
|
53a38b2ba1 | ||
|
|
f3dfcae3f0 | ||
|
|
3f7274a6ac | ||
|
|
f5bc715bc0 | ||
|
|
22b7e36c01 | ||
|
|
a0e6a377cd | ||
|
|
22b04c159d | ||
|
|
5b496ad85f | ||
|
|
92249ac711 | ||
|
|
629d64326d | ||
|
|
4621cbcae9 | ||
|
|
164191d746 | ||
|
|
b22adc9957 | ||
|
|
6b0a675469 | ||
|
|
d7fb0d9b40 | ||
|
|
bc1bf8542c | ||
|
|
309947a08f | ||
|
|
6aeaae6160 | ||
|
|
71b3c7dda2 | ||
|
|
48c06e86fa | ||
|
|
e8f4e82cf8 | ||
|
|
1b7d3fa394 | ||
|
|
650db99818 | ||
|
|
7638bb795e | ||
|
|
570e604be0 | ||
|
|
a056d1c363 | ||
|
|
fce61c8c89 | ||
|
|
d60d0ae47d | ||
|
|
9a838f1d55 | ||
|
|
8bf741ed4e | ||
|
|
9f660e5178 | ||
|
|
ef2318bcc1 | ||
|
|
364a5db5d5 | ||
|
|
4a01d0d548 | ||
|
|
4a9c28f89f | ||
|
|
3aed873467 | ||
|
|
2b7f059b8f | ||
|
|
33726e9c68 | ||
|
|
3d29f486e7 | ||
|
|
79e8a26f06 | ||
|
|
e8efd54766 | ||
|
|
edcc774c16 | ||
|
|
746b33a590 | ||
|
|
8a264efc67 | ||
|
|
f0af6e97a0 | ||
|
|
043107c101 | ||
|
|
e9e3b923e0 | ||
|
|
aea6e91b1d | ||
|
|
9c4717a13d | ||
|
|
559cabce9e | ||
|
|
7f6a3de7ca | ||
|
|
f3adc87f52 | ||
|
|
6499e9f63d | ||
|
|
ac1f104e49 | ||
|
|
87f89e6b2f | ||
|
|
7f6404d5a8 | ||
|
|
8e857cd393 | ||
|
|
b8f801333d | ||
|
|
499956e216 | ||
|
|
3932ee2c00 | ||
|
|
68177b7590 | ||
|
|
0a2a4122dc | ||
|
|
e6299569d0 | ||
|
|
578ad8c291 | ||
|
|
eaa294b689 | ||
|
|
6e97cfb8d5 | ||
|
|
80a68c48b2 | ||
|
|
98865f8141 | ||
|
|
78da9fd144 | ||
|
|
94c50a989b | ||
|
|
3e525e767c | ||
|
|
dfcc1e24e4 | ||
|
|
f3aa8edfca | ||
|
|
ffd7ee6013 | ||
|
|
64bb09dbc5 | ||
|
|
35fcbc40ed | ||
|
|
1b55a48680 | ||
|
|
88fbb19d29 | ||
|
|
3dc1501ff7 | ||
|
|
b7576c559a | ||
|
|
69ed2e1d56 | ||
|
|
55f7f3d72a | ||
|
|
055d0b4ea1 | ||
|
|
7735346ed0 | ||
|
|
2a06fdbbe0 | ||
|
|
19169199e9 | ||
|
|
76f3c39b78 | ||
|
|
8da52acc4c | ||
|
|
9253522a3a | ||
|
|
cf39a3e5a5 | ||
|
|
a08877f0ac | ||
|
|
2f0dc1c067 | ||
|
|
535d8c9142 | ||
|
|
6dc2ba3bef | ||
|
|
93cfdc8f98 | ||
|
|
671544349e | ||
|
|
d3c1939692 | ||
|
|
99642aef96 | ||
|
|
ac4942b640 | ||
|
|
23cb004a86 | ||
|
|
4b6de60978 | ||
|
|
de204aa56a | ||
|
|
976f811b36 | ||
|
|
855fc9e602 | ||
|
|
a8848e717c | ||
|
|
90b99faf8b | ||
|
|
d3cfffbbcf | ||
|
|
fade7f9be8 | ||
|
|
b10dd055d3 | ||
|
|
7532f01222 | ||
|
|
2df09efdee | ||
|
|
bed4f49a12 | ||
|
|
2b7fefff8b | ||
|
|
bdcf2519ce | ||
|
|
3f8afb72a6 | ||
|
|
2f834db224 | ||
|
|
3541ce7492 | ||
|
|
b6fae0eb4c | ||
|
|
fbaa282f07 | ||
|
|
6136ae7411 | ||
|
|
f024747299 | ||
|
|
66feffcc49 | ||
|
|
24254df7db | ||
|
|
cae73f1f1b | ||
|
|
073a52213e | ||
|
|
0d34485a00 | ||
|
|
65519d539e | ||
|
|
ec44a8e817 | ||
|
|
920f225cb0 | ||
|
|
d5d4bd61ff | ||
|
|
5656d10b67 | ||
|
|
adb4b6468b | ||
|
|
0a293d7f63 | ||
|
|
27cb5afd5b | ||
|
|
5e58fc6b04 | ||
|
|
e820adfc96 | ||
|
|
5a8a114dcb | ||
|
|
a1c685e820 | ||
|
|
377dcfcc1b | ||
|
|
913e67ca93 | ||
|
|
fb1a97c7d4 | ||
|
|
42eef6945d | ||
|
|
d04b08d640 | ||
|
|
c547dd10d3 | ||
|
|
f4579da9c9 | ||
|
|
37dc585d80 | ||
|
|
bc0a425a0f | ||
|
|
b696f246a1 | ||
|
|
e6e197e140 | ||
|
|
1c0e8a1fd3 | ||
|
|
e3e154fa1a | ||
|
|
73b7c437f9 | ||
|
|
719168be77 | ||
|
|
a2021b175c | ||
|
|
9a388fbd13 | ||
|
|
1ba0452540 | ||
|
|
73df9f18f0 | ||
|
|
0e7521877b | ||
|
|
120b37c192 | ||
|
|
5f3502b838 | ||
|
|
33f99432c5 | ||
|
|
85756ff5df | ||
|
|
84e567ad6a | ||
|
|
39281331fa | ||
|
|
438ce2ce63 | ||
|
|
a13e17e256 | ||
|
|
cd6db2d776 | ||
|
|
a08662b617 | ||
|
|
003ec9de35 | ||
|
|
e7f76ca0b8 | ||
|
|
21111e2927 | ||
|
|
445c3ef32c | ||
|
|
9df5542ee1 | ||
|
|
fffc4a0cd1 | ||
|
|
50a8743be3 | ||
|
|
8480bc7dbd | ||
|
|
72e4546922 | ||
|
|
11be5babca | ||
|
|
17e5db2427 | ||
|
|
465093eb07 | ||
|
|
b430ac1041 | ||
|
|
ea96847c1e | ||
|
|
3b5106a61d | ||
|
|
9f611b0b52 | ||
|
|
18a6b3c3e5 | ||
|
|
d9ed4e18ea | ||
|
|
9e757aa896 | ||
|
|
89b58bb446 | ||
|
|
e80ca583cc | ||
|
|
2ecc81b34f | ||
|
|
60e98ee34f | ||
|
|
538ea89ea9 | ||
|
|
3990e11e0a | ||
|
|
0251f88fe5 | ||
|
|
bbcb959b11 | ||
|
|
b5e928bac9 | ||
|
|
6592dee4a9 | ||
|
|
9b3d72191e | ||
|
|
a92e5b48ff | ||
|
|
e355764ab0 | ||
|
|
c5efd5a8bf | ||
|
|
385461944b | ||
|
|
8385ba3274 | ||
|
|
6ca6a77595 | ||
|
|
14c837e894 | ||
|
|
33346d7cb6 | ||
|
|
05d4f531e2 | ||
|
|
ede2c49b12 | ||
|
|
16acd32c68 | ||
|
|
cc90192860 | ||
|
|
3607005fa8 | ||
|
|
7646a64f94 | ||
|
|
c8ce6ce27b | ||
|
|
1240474c4b | ||
|
|
f5e84441c0 | ||
|
|
6bc19d78bc | ||
|
|
a4437d2873 | ||
|
|
cd19650748 | ||
|
|
253315b3b1 | ||
|
|
4203ad9a13 | ||
|
|
6958202f9d | ||
|
|
386fef063f | ||
|
|
d7246ca427 | ||
|
|
fd024853b6 | ||
|
|
bd53d17876 | ||
|
|
3f87f571f4 | ||
|
|
1c69a6f1b7 | ||
|
|
82419cbb6e | ||
|
|
db65630c8d | ||
|
|
b8e54b947f | ||
|
|
f23897108d | ||
|
|
1efe5b21f0 | ||
|
|
fc71b4d249 | ||
|
|
dc81d46556 | ||
|
|
56c2080f43 | ||
|
|
4cc50fcaa5 | ||
|
|
2d67562576 | ||
|
|
76f2d7afa7 | ||
|
|
80fa9c4f21 | ||
|
|
8f215a5b4b | ||
|
|
bffd9cb52a | ||
|
|
74b1ff5b10 | ||
|
|
3c0079fea0 | ||
|
|
c0a9723d20 | ||
|
|
a4f0a76200 | ||
|
|
eb57b0130b | ||
|
|
f8c37c7abc | ||
|
|
72373f8812 | ||
|
|
b285e99e7d | ||
|
|
f9a6b88bb6 | ||
|
|
4a65d506f2 | ||
|
|
3bc03c90fd | ||
|
|
c35dfa4ac5 | ||
|
|
1d2a9a9dde | ||
|
|
925220bb13 | ||
|
|
16d088bfe3 | ||
|
|
b8e22ee435 | ||
|
|
60dea4b932 | ||
|
|
8ae1a42e4b | ||
|
|
cfdc7a46e6 | ||
|
|
afb23adcbf | ||
|
|
3b84a474b8 | ||
|
|
e96bb04e88 | ||
|
|
2e3b8507b2 | ||
|
|
e12c69f1a6 | ||
|
|
d049a23469 | ||
|
|
2633f427c8 | ||
|
|
ff920f1d7b | ||
|
|
fd69560025 | ||
|
|
ba51e47e05 | ||
|
|
409f552274 | ||
|
|
69a7c184bd | ||
|
|
3039c84738 | ||
|
|
bfa5cd085d | ||
|
|
7c282b30b1 | ||
|
|
06fa3c541e | ||
|
|
c9e31ac1f7 | ||
|
|
e248486d3d | ||
|
|
b32a52d236 | ||
|
|
a24b4d6d4d | ||
|
|
b831aa0075 | ||
|
|
bf4d4b78cb | ||
|
|
496896e36e | ||
|
|
6b88ec1f8a | ||
|
|
3af5f3a96d | ||
|
|
ddc5564515 | ||
|
|
bc5da7ef06 | ||
|
|
45221c0b03 | ||
|
|
d29cf2ffa7 | ||
|
|
f6c0b89d1f | ||
|
|
ecd9e06665 | ||
|
|
9e5b66d5f4 | ||
|
|
8c35c3cdaa | ||
|
|
828a6240fe | ||
|
|
eaad0eaee0 | ||
|
|
db76d4417c | ||
|
|
7a6c6ec210 | ||
|
|
8e034f183b | ||
|
|
5a01b34cce | ||
|
|
1399a9bffe | ||
|
|
653c6ed85a | ||
|
|
ebbb7b58cb | ||
|
|
7164e4e315 | ||
|
|
23398d07f9 | ||
|
|
ec2bc3efa2 | ||
|
|
86d78763c1 | ||
|
|
fb5ae36d7e | ||
|
|
51f812625b | ||
|
|
479bfee647 | ||
|
|
a3501a56cd | ||
|
|
c353e286b0 | ||
|
|
8ed01e8a87 | ||
|
|
36ed21b9f4 | ||
|
|
cca41bb449 | ||
|
|
8f787ad0e6 | ||
|
|
9c1170f100 | ||
|
|
5432be4a3f | ||
|
|
7cae821db5 | ||
|
|
19ebb24f03 | ||
|
|
d07512566e | ||
|
|
61929666f3 | ||
|
|
792ffbfcd7 | ||
|
|
9685271bb4 | ||
|
|
5b1a6cc95e | ||
|
|
bf34075e6a | ||
|
|
f1859eeef2 | ||
|
|
fa12b37e53 | ||
|
|
520a5dc9f2 | ||
|
|
7af949b5a5 | ||
|
|
300612b09b | ||
|
|
6f00e9825c | ||
|
|
6ca9c5300e | ||
|
|
cdeb31051b | ||
|
|
ba90517ad7 | ||
|
|
7aff949f47 | ||
|
|
0e8c0da3dd | ||
|
|
3132a207e1 | ||
|
|
88dd0e06c5 | ||
|
|
f507a2464f | ||
|
|
14baa6ebf8 | ||
|
|
5d32126565 | ||
|
|
484ff7ab4c | ||
|
|
36f86385a2 | ||
|
|
436faa17af | ||
|
|
d205ae206f | ||
|
|
6baa5900fc | ||
|
|
fadb53f075 | ||
|
|
1a63387408 | ||
|
|
a316120b69 | ||
|
|
0d1e5ef119 | ||
|
|
b49cfca39d | ||
|
|
ab58df4c2c | ||
|
|
db20f10bd2 | ||
|
|
444cc5a193 | ||
|
|
6c253bc9b4 | ||
|
|
2fd28e174e | ||
|
|
a188692c88 | ||
|
|
b263419e08 | ||
|
|
826e06c727 | ||
|
|
dfcdfb105f | ||
|
|
0508bbb16f | ||
|
|
dfbfa85fd3 | ||
|
|
b99ad4bdc3 | ||
|
|
e801170496 | ||
|
|
91e7c9c5ad | ||
|
|
ca5162ed32 | ||
|
|
0bf87d0c87 | ||
|
|
ce91eb5bae | ||
|
|
8d68056bca | ||
|
|
d0de8e444a | ||
|
|
dfef1f21cc | ||
|
|
2440ac4e87 | ||
|
|
e90db78697 | ||
|
|
5ae15d429c | ||
|
|
89d6b46f3e | ||
|
|
e086f64779 | ||
|
|
9ed3b4f11e | ||
|
|
ece3fa12b4 | ||
|
|
9a35224535 | ||
|
|
ef3faa58bc | ||
|
|
b6a8f7eeba | ||
|
|
d1203d9c42 | ||
|
|
a834b6ae38 | ||
|
|
e7982a73ad | ||
|
|
717342c80c | ||
|
|
075f0e62fd | ||
|
|
bcca31fbed | ||
|
|
007891fc11 | ||
|
|
f8e41952d1 | ||
|
|
e4d64f8a79 | ||
|
|
1654f69ec1 | ||
|
|
cb16fb5437 | ||
|
|
36f5fa2c47 | ||
|
|
51ad22e72c | ||
|
|
1a355c0c16 | ||
|
|
fe5ba08963 | ||
|
|
7fc994d4af | ||
|
|
a0a8285e02 | ||
|
|
da2e35f613 | ||
|
|
09bdc25352 | ||
|
|
ad263a9c36 | ||
|
|
c8d8d4e43d | ||
|
|
94249b8a93 | ||
|
|
edd2c51eb6 | ||
|
|
1d24e9399f | ||
|
|
3a0062276d | ||
|
|
1993cf3f6c | ||
|
|
c97aac31c6 | ||
|
|
507921cbe8 | ||
|
|
887db675c8 | ||
|
|
3917618e4e | ||
|
|
3c42d2e6a4 | ||
|
|
db8777b7f7 | ||
|
|
18c2cddee2 | ||
|
|
3ff9d3a1fa | ||
|
|
6503667c78 | ||
|
|
0fa95f84d4 | ||
|
|
cf91a90270 | ||
|
|
690052f989 | ||
|
|
b3e935f7e4 | ||
|
|
17314ebd29 | ||
|
|
adc437cd51 | ||
|
|
0e97b74510 | ||
|
|
9ffb475cac | ||
|
|
faa2b030c5 | ||
|
|
e3b3b10e2a | ||
|
|
b569cf268c | ||
|
|
b154b77556 | ||
|
|
84c0f30a7c | ||
|
|
16463ff76d | ||
|
|
8314e9e24b | ||
|
|
a33c557818 | ||
|
|
6fbdc65ad0 | ||
|
|
9c9b6c4711 | ||
|
|
46278d04c3 | ||
|
|
c1c16508b5 | ||
|
|
ed1b983711 | ||
|
|
ec23e28eda | ||
|
|
d48b49e8e4 | ||
|
|
14308970c6 | ||
|
|
38e86e1012 | ||
|
|
e9a33af831 | ||
|
|
6a63e5dbb2 | ||
|
|
1e1892a3d5 | ||
|
|
8bff9a2973 | ||
|
|
cbe753dd29 | ||
|
|
b047845b43 | ||
|
|
1bebc75381 | ||
|
|
93c46bfc8d | ||
|
|
a3d0f5963e | ||
|
|
006b82bf05 | ||
|
|
c36e37ac6b | ||
|
|
3cf6d7385a | ||
|
|
9045b2fa97 | ||
|
|
be6f3b9c6d | ||
|
|
5a699b7ce9 | ||
|
|
f366a78e87 | ||
|
|
c63c7ead51 | ||
|
|
ecfa5902cd | ||
|
|
444027b496 | ||
|
|
9c5dcb93c7 | ||
|
|
9594221271 | ||
|
|
01823d3b75 | ||
|
|
db07a90139 |
2
.clang-format
Normal file
2
.clang-format
Normal file
@@ -0,0 +1,2 @@
|
||||
BasedOnStyle: Chromium
|
||||
ColumnLimit: 100
|
||||
@@ -7,3 +7,6 @@ end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/codecs/**/*.js linguist-generated=true
|
||||
/codecs/*/pkg*/*.d.ts linguist-generated=true
|
||||
22
.github/workflows/node.js.yml
vendored
Normal file
22
.github/workflows/node.js.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Node.js CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- id: nvmrc
|
||||
uses: browniebroke/read-nvmrc-action@v1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '${{ steps.nvmrc.outputs.node_version }}'
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,6 +1,12 @@
|
||||
.tmp
|
||||
node_modules
|
||||
/build
|
||||
/*.log
|
||||
*.scss.d.ts
|
||||
*.css.d.ts
|
||||
build
|
||||
*.o
|
||||
.DS_Store
|
||||
|
||||
# Auto-generated by lib/feature-plugin.js
|
||||
src/features-worker/index.ts
|
||||
src/client/lazy-app/worker-bridge/meta.ts
|
||||
src/client/lazy-app/feature-meta/index.ts
|
||||
|
||||
12
.prettierignore
Normal file
12
.prettierignore
Normal file
@@ -0,0 +1,12 @@
|
||||
codecs
|
||||
.tmp
|
||||
node_modules
|
||||
*.scss.d.ts
|
||||
*.css.d.ts
|
||||
build
|
||||
*.o
|
||||
|
||||
# Auto-generated by lib/feature-plugin.js
|
||||
src/features-worker/index.ts
|
||||
src/client/lazy-app/worker-bridge/meta.ts
|
||||
src/client/lazy-app/feature-meta/index.ts
|
||||
4
.prettierrc.json
Normal file
4
.prettierrc.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- node
|
||||
- 10
|
||||
- 8
|
||||
cache: npm
|
||||
script: npm run build
|
||||
13
README.md
13
README.md
@@ -3,13 +3,18 @@
|
||||
[Squoosh] is an image compression web app that allows you to dive into the advanced options provided
|
||||
by various image compressors.
|
||||
|
||||
# API & CLI
|
||||
|
||||
Squoosh now has [an API](https://github.com/GoogleChromeLabs/squoosh/tree/dev/libsquoosh) and [a CLI](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli) that allows you to compress many images at once.
|
||||
|
||||
# Privacy
|
||||
|
||||
Google Analytics is used to record the following:
|
||||
|
||||
* [Basic visit data](https://support.google.com/analytics/answer/6004245?ref_topic=2919631).
|
||||
* Before and after image size once an image is downloaded. These values are rounded to the nearest
|
||||
- [Basic visit data](https://support.google.com/analytics/answer/6004245?ref_topic=2919631).
|
||||
- Before and after image size once an image is downloaded. These values are rounded to the nearest
|
||||
kilobyte.
|
||||
- If install is available, when Squoosh is installed, and what method was used to install Squoosh.
|
||||
|
||||
Image compression is handled locally; no additional data is sent to the server.
|
||||
|
||||
@@ -25,7 +30,7 @@ npm run build
|
||||
You can run the development server with:
|
||||
|
||||
```sh
|
||||
npm start
|
||||
npm run dev
|
||||
```
|
||||
|
||||
[Squoosh]: https://squoosh.app
|
||||
[squoosh]: https://squoosh.app
|
||||
|
||||
18
_headers.ejs
18
_headers.ejs
@@ -1,18 +0,0 @@
|
||||
# Long-term cache by default.
|
||||
/*
|
||||
Cache-Control: max-age=31536000
|
||||
|
||||
# And here are the exceptions:
|
||||
/
|
||||
Cache-Control: no-cache
|
||||
|
||||
/serviceworker.js
|
||||
Cache-Control: no-cache
|
||||
|
||||
/manifest.json
|
||||
Cache-Control: must-revalidate, max-age=3600
|
||||
|
||||
# URLs in /assets do not include a hash and are mutable.
|
||||
# But it isn't a big deal if the user gets an old version.
|
||||
/assets/*
|
||||
Cache-Control: must-revalidate, max-age=3600
|
||||
@@ -1,2 +0,0 @@
|
||||
/index.html / 301
|
||||
/* /index.html 301
|
||||
3
cli/.gitignore
vendored
Normal file
3
cli/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
build
|
||||
.DS_Store
|
||||
1
cli/.npmignore
Normal file
1
cli/.npmignore
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
0
cli/.npmrc
Normal file
0
cli/.npmrc
Normal file
59
cli/README.md
Normal file
59
cli/README.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Squoosh CLI
|
||||
|
||||
Squoosh CLI is an _experimental_ way to run all the codecs you know from the [Squoosh] web app on your command line using WebAssembly. The Squoosh CLI uses a worker pool to parallelize processing images. This way you can apply the same codec to many images at once.
|
||||
|
||||
Squoosh CLI is currently not the fastest image compression tool in town and doesn’t aim to be. It is, however, fast enough to compress many images sufficiently quick at once.
|
||||
|
||||
## Installation
|
||||
|
||||
The Squoosh CLI can be used straight from the command line without installing using `npx`:
|
||||
|
||||
```
|
||||
$ npx @squoosh/cli <options...>
|
||||
```
|
||||
|
||||
Of course, you can also install the Squoosh CLI:
|
||||
|
||||
```
|
||||
$ npm i -g @squoosh/cli
|
||||
$ squoosh-cli <options...>
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
Usage: squoosh-cli [options] <files...>
|
||||
|
||||
Options:
|
||||
-V, --version output the version number
|
||||
-d, --output-dir <dir> Output directory (default: ".")
|
||||
-s, --suffix <suffix> Append suffix to output files (default: "")
|
||||
--max-optimizer-rounds <rounds> Maximum number of compressions to use for auto optimizations (default: "6")
|
||||
--optimizer-butteraugli-target <butteraugli distance> Target Butteraugli distance for auto optimizer (default: "1.4")
|
||||
--resize [config] Resize the image before compressing
|
||||
--quant [config] Reduce the number of colors used (aka. paletting)
|
||||
--rotate [config] Rotate image
|
||||
--mozjpeg [config] Use MozJPEG to generate a .jpg file with the given configuration
|
||||
--webp [config] Use WebP to generate a .webp file with the given configuration
|
||||
--avif [config] Use AVIF to generate a .avif file with the given configuration
|
||||
--jxl [config] Use JPEG-XL to generate a .jxl file with the given configuration
|
||||
--wp2 [config] Use WebP2 to generate a .wp2 file with the given configuration
|
||||
--oxipng [config] Use OxiPNG to generate a .png file with the given configuration
|
||||
-h, --help display help for command
|
||||
```
|
||||
|
||||
The default values for each `config` option can be found in the [`codecs.js`][codecs.js] file under `defaultEncoderOptions`. Every unspecified value will use the default value specified here. _Better documentation is needed here._
|
||||
|
||||
## Auto optimizer
|
||||
|
||||
Squoosh CLI has an _experimental_ auto optimizer that compresses an image as much as possible, trying to hit a specific [Butteraugli] target value. The higher the Butteraugli target value, the more artifacts can be introduced.
|
||||
|
||||
You can make use of the auto optimizer by using “auto” as the config object.
|
||||
|
||||
```
|
||||
$ npx @squoosh/cli --wp2 auto test.png
|
||||
```
|
||||
|
||||
[squoosh]: https://squoosh.app
|
||||
[codecs.js]: https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.js
|
||||
[butteraugli]: https://github.com/google/butteraugli
|
||||
595
cli/package-lock.json
generated
Normal file
595
cli/package-lock.json
generated
Normal file
@@ -0,0 +1,595 @@
|
||||
{
|
||||
"name": "@squoosh/cli",
|
||||
"version": "0.7.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@squoosh/cli",
|
||||
"version": "0.7.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@squoosh/lib": "^0.2.0",
|
||||
"commander": "^7.2.0",
|
||||
"json5": "^2.2.0",
|
||||
"kleur": "^4.1.4",
|
||||
"ora": "^5.4.0"
|
||||
},
|
||||
"bin": {
|
||||
"cli": "src/index.js",
|
||||
"squoosh-cli": "src/index.js"
|
||||
}
|
||||
},
|
||||
"node_modules/@squoosh/lib": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@squoosh/lib/-/lib-0.2.0.tgz",
|
||||
"integrity": "sha512-zKId9h/LzEnCdoOGnIgjzvqbk5g2aHgfEqgKQ+S+r5K3TasgD/DAsT6r7v6gXft1ao0f/00CTcwIp1KviWTQbw==",
|
||||
"dependencies": {
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
||||
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"node_modules/bl": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||
"dependencies": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
"readable-stream": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"node_modules/chalk": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
|
||||
"integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/cli-cursor": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
|
||||
"integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
|
||||
"dependencies": {
|
||||
"restore-cursor": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/cli-spinners": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz",
|
||||
"integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/clone": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
||||
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
|
||||
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
}
|
||||
},
|
||||
"node_modules/defaults": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
||||
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
|
||||
"dependencies": {
|
||||
"clone": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/is-interactive": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",
|
||||
"integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/is-unicode-supported": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
|
||||
"integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/json5": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz",
|
||||
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5"
|
||||
},
|
||||
"bin": {
|
||||
"json5": "lib/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/kleur": {
|
||||
"version": "4.1.4",
|
||||
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz",
|
||||
"integrity": "sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/log-symbols": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
|
||||
"integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
|
||||
"dependencies": {
|
||||
"chalk": "^4.1.0",
|
||||
"is-unicode-supported": "^0.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/mimic-fn": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
},
|
||||
"node_modules/onetime": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
||||
"dependencies": {
|
||||
"mimic-fn": "^2.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/ora": {
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ora/-/ora-5.4.0.tgz",
|
||||
"integrity": "sha512-1StwyXQGoU6gdjYkyVcqOLnVlbKj+6yPNNOxJVgpt9t4eksKjiriiHuxktLYkgllwk+D6MbC4ihH84L1udRXPg==",
|
||||
"dependencies": {
|
||||
"bl": "^4.1.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cli-cursor": "^3.1.0",
|
||||
"cli-spinners": "^2.5.0",
|
||||
"is-interactive": "^1.0.0",
|
||||
"is-unicode-supported": "^0.1.0",
|
||||
"log-symbols": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"wcwidth": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/restore-cursor": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
|
||||
"integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
|
||||
"dependencies": {
|
||||
"onetime": "^5.1.0",
|
||||
"signal-exit": "^3.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
||||
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
|
||||
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"dependencies": {
|
||||
"has-flag": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"node_modules/wcwidth": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
||||
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
|
||||
"dependencies": {
|
||||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/web-streams-polyfill": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.0.3.tgz",
|
||||
"integrity": "sha512-d2H/t0eqRNM4w2WvmTdoeIvzAUSpK7JmATB8Nr2lb7nQ9BTIJVjbQ/TRFVEh2gUH1HwclPdoPtfMoFfetXaZnA==",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@squoosh/lib": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@squoosh/lib/-/lib-0.2.0.tgz",
|
||||
"integrity": "sha512-zKId9h/LzEnCdoOGnIgjzvqbk5g2aHgfEqgKQ+S+r5K3TasgD/DAsT6r7v6gXft1ao0f/00CTcwIp1KviWTQbw==",
|
||||
"requires": {
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
||||
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
|
||||
},
|
||||
"ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"requires": {
|
||||
"color-convert": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"bl": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||
"requires": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
"readable-stream": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"requires": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
|
||||
"integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
|
||||
"requires": {
|
||||
"ansi-styles": "^4.1.0",
|
||||
"supports-color": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"cli-cursor": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
|
||||
"integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
|
||||
"requires": {
|
||||
"restore-cursor": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"cli-spinners": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz",
|
||||
"integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q=="
|
||||
},
|
||||
"clone": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
||||
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4="
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"requires": {
|
||||
"color-name": "~1.1.4"
|
||||
}
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"commander": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
|
||||
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="
|
||||
},
|
||||
"defaults": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
||||
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
|
||||
"requires": {
|
||||
"clone": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
||||
},
|
||||
"ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"is-interactive": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",
|
||||
"integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w=="
|
||||
},
|
||||
"is-unicode-supported": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
|
||||
"integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="
|
||||
},
|
||||
"json5": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz",
|
||||
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
|
||||
"requires": {
|
||||
"minimist": "^1.2.5"
|
||||
}
|
||||
},
|
||||
"kleur": {
|
||||
"version": "4.1.4",
|
||||
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz",
|
||||
"integrity": "sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA=="
|
||||
},
|
||||
"log-symbols": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
|
||||
"integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
|
||||
"requires": {
|
||||
"chalk": "^4.1.0",
|
||||
"is-unicode-supported": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"mimic-fn": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
},
|
||||
"onetime": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
||||
"requires": {
|
||||
"mimic-fn": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"ora": {
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ora/-/ora-5.4.0.tgz",
|
||||
"integrity": "sha512-1StwyXQGoU6gdjYkyVcqOLnVlbKj+6yPNNOxJVgpt9t4eksKjiriiHuxktLYkgllwk+D6MbC4ihH84L1udRXPg==",
|
||||
"requires": {
|
||||
"bl": "^4.1.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cli-cursor": "^3.1.0",
|
||||
"cli-spinners": "^2.5.0",
|
||||
"is-interactive": "^1.0.0",
|
||||
"is-unicode-supported": "^0.1.0",
|
||||
"log-symbols": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"wcwidth": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
||||
"requires": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"restore-cursor": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
|
||||
"integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
|
||||
"requires": {
|
||||
"onetime": "^5.1.0",
|
||||
"signal-exit": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
||||
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
|
||||
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
|
||||
"requires": {
|
||||
"ansi-regex": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||
"requires": {
|
||||
"has-flag": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"wcwidth": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
||||
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
|
||||
"requires": {
|
||||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"web-streams-polyfill": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.0.3.tgz",
|
||||
"integrity": "sha512-d2H/t0eqRNM4w2WvmTdoeIvzAUSpK7JmATB8Nr2lb7nQ9BTIJVjbQ/TRFVEh2gUH1HwclPdoPtfMoFfetXaZnA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
24
cli/package.json
Normal file
24
cli/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "@squoosh/cli",
|
||||
"version": "0.7.0",
|
||||
"description": "A CLI for Squoosh",
|
||||
"public": true,
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"squoosh-cli": "src/index.js",
|
||||
"@squoosh/cli": "src/index.js"
|
||||
},
|
||||
"files": [
|
||||
"/src/index.js"
|
||||
],
|
||||
"keywords": [],
|
||||
"author": "Google Chrome Developers <chromium-dev@google.com>",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@squoosh/lib": "^0.2.0",
|
||||
"commander": "^7.2.0",
|
||||
"json5": "^2.2.0",
|
||||
"kleur": "^4.1.4",
|
||||
"ora": "^5.4.0"
|
||||
}
|
||||
}
|
||||
232
cli/src/index.js
Executable file
232
cli/src/index.js
Executable file
@@ -0,0 +1,232 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { program } from 'commander/esm.mjs';
|
||||
import JSON5 from 'json5';
|
||||
import path from 'path';
|
||||
import { promises as fsp } from 'fs';
|
||||
import ora from 'ora';
|
||||
import kleur from 'kleur';
|
||||
|
||||
import { ImagePool, preprocessors, encoders } from '@squoosh/lib';
|
||||
|
||||
function clamp(v, min, max) {
|
||||
if (v < min) return min;
|
||||
if (v > max) return max;
|
||||
return v;
|
||||
}
|
||||
|
||||
const suffix = ['B', 'KB', 'MB'];
|
||||
function prettyPrintSize(size) {
|
||||
const base = Math.floor(Math.log2(size) / 10);
|
||||
const index = clamp(base, 0, 2);
|
||||
return (size / 2 ** (10 * index)).toFixed(2) + suffix[index];
|
||||
}
|
||||
|
||||
function progressTracker(results) {
|
||||
const spinner = ora();
|
||||
const tracker = {};
|
||||
tracker.spinner = spinner;
|
||||
tracker.progressOffset = 0;
|
||||
tracker.totalOffset = 0;
|
||||
let status = '';
|
||||
tracker.setStatus = (text) => {
|
||||
status = text || '';
|
||||
update();
|
||||
};
|
||||
let progress = '';
|
||||
tracker.setProgress = (done, total) => {
|
||||
spinner.prefixText = kleur.dim(`${done}/${total}`);
|
||||
const completeness =
|
||||
(tracker.progressOffset + done) / (tracker.totalOffset + total);
|
||||
progress = kleur.cyan(
|
||||
`▐${'▨'.repeat((completeness * 10) | 0).padEnd(10, '╌')}▌ `,
|
||||
);
|
||||
update();
|
||||
};
|
||||
function update() {
|
||||
spinner.text = progress + kleur.bold(status) + getResultsText();
|
||||
}
|
||||
tracker.finish = (text) => {
|
||||
spinner.succeed(kleur.bold(text) + getResultsText());
|
||||
};
|
||||
function getResultsText() {
|
||||
let out = '';
|
||||
for (const result of results.values()) {
|
||||
out += `\n ${kleur.cyan(result.file)}: ${prettyPrintSize(result.size)}`;
|
||||
for (const { outputFile, size: outputSize, infoText } of result.outputs) {
|
||||
out += `\n ${kleur.dim('└')} ${kleur.cyan(
|
||||
outputFile.padEnd(5),
|
||||
)} → ${prettyPrintSize(outputSize)}`;
|
||||
const percent = ((outputSize / result.size) * 100).toPrecision(3);
|
||||
out += ` (${kleur[outputSize > result.size ? 'red' : 'green'](
|
||||
percent + '%',
|
||||
)})`;
|
||||
if (infoText) out += kleur.yellow(infoText);
|
||||
}
|
||||
}
|
||||
return out || '\n';
|
||||
}
|
||||
spinner.start();
|
||||
return tracker;
|
||||
}
|
||||
|
||||
async function getInputFiles(paths) {
|
||||
const validFiles = [];
|
||||
|
||||
for (const inputPath of paths) {
|
||||
const files = (await fsp.lstat(inputPath)).isDirectory()
|
||||
? (await fsp.readdir(inputPath, {withFileTypes: true})).filter(dirent => dirent.isFile()).map(dirent => path.join(inputPath, dirent.name))
|
||||
: [inputPath];
|
||||
for (const file of files) {
|
||||
try {
|
||||
await fsp.stat(file);
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
console.warn(
|
||||
`Warning: Input file does not exist: ${path.resolve(file)}`,
|
||||
);
|
||||
continue;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
validFiles.push(file);
|
||||
}
|
||||
}
|
||||
|
||||
return validFiles;
|
||||
}
|
||||
|
||||
async function processFiles(files) {
|
||||
files = await getInputFiles(files);
|
||||
|
||||
const imagePool = new ImagePool();
|
||||
|
||||
const results = new Map();
|
||||
const progress = progressTracker(results);
|
||||
|
||||
progress.setStatus('Decoding...');
|
||||
progress.totalOffset = files.length;
|
||||
progress.setProgress(0, files.length);
|
||||
|
||||
// Create output directory
|
||||
await fsp.mkdir(program.opts().outputDir, { recursive: true });
|
||||
|
||||
let decoded = 0;
|
||||
let decodedFiles = await Promise.all(
|
||||
files.map(async (file) => {
|
||||
const image = imagePool.ingestImage(file);
|
||||
await image.decoded;
|
||||
results.set(image, {
|
||||
file,
|
||||
size: (await image.decoded).size,
|
||||
outputs: [],
|
||||
});
|
||||
progress.setProgress(++decoded, files.length);
|
||||
return image;
|
||||
}),
|
||||
);
|
||||
|
||||
const preprocessOptions = {};
|
||||
|
||||
for (const preprocessorName of Object.keys(preprocessors)) {
|
||||
if (!program.opts()[preprocessorName]) {
|
||||
continue;
|
||||
}
|
||||
preprocessOptions[preprocessorName] = JSON5.parse(
|
||||
program.opts()[preprocessorName],
|
||||
);
|
||||
}
|
||||
|
||||
for (const image of decodedFiles) {
|
||||
image.preprocess(preprocessOptions);
|
||||
}
|
||||
|
||||
await Promise.all(decodedFiles.map((image) => image.decoded));
|
||||
|
||||
progress.progressOffset = decoded;
|
||||
progress.setStatus(
|
||||
'Encoding ' + kleur.dim(`(${imagePool.workerPool.numWorkers} threads)`),
|
||||
);
|
||||
progress.setProgress(0, files.length);
|
||||
|
||||
const jobs = [];
|
||||
let jobsStarted = 0;
|
||||
let jobsFinished = 0;
|
||||
for (const image of decodedFiles) {
|
||||
const originalFile = results.get(image).file;
|
||||
|
||||
const encodeOptions = {
|
||||
optimizerButteraugliTarget: Number(
|
||||
program.opts().optimizerButteraugliTarget,
|
||||
),
|
||||
maxOptimizerRounds: Number(program.opts().maxOptimizerRounds),
|
||||
};
|
||||
for (const encName of Object.keys(encoders)) {
|
||||
if (!program.opts()[encName]) {
|
||||
continue;
|
||||
}
|
||||
const encParam = program.opts()[encName];
|
||||
const encConfig =
|
||||
encParam.toLowerCase() === 'auto' ? 'auto' : JSON5.parse(encParam);
|
||||
encodeOptions[encName] = encConfig;
|
||||
}
|
||||
jobsStarted++;
|
||||
const job = image.encode(encodeOptions).then(async () => {
|
||||
jobsFinished++;
|
||||
const outputPath = path.join(
|
||||
program.opts().outputDir,
|
||||
program.opts().suffix +
|
||||
path.basename(originalFile, path.extname(originalFile)),
|
||||
);
|
||||
for (const output of Object.values(image.encodedWith)) {
|
||||
const outputFile = `${outputPath}.${(await output).extension}`;
|
||||
await fsp.writeFile(outputFile, (await output).binary);
|
||||
results
|
||||
.get(image)
|
||||
.outputs.push(Object.assign(await output, { outputFile }));
|
||||
}
|
||||
progress.setProgress(jobsFinished, jobsStarted);
|
||||
});
|
||||
jobs.push(job);
|
||||
}
|
||||
|
||||
// update the progress to account for multi-format
|
||||
progress.setProgress(jobsFinished, jobsStarted);
|
||||
// Wait for all jobs to finish
|
||||
await Promise.all(jobs);
|
||||
await imagePool.close();
|
||||
progress.finish('Squoosh results:');
|
||||
}
|
||||
|
||||
program
|
||||
.name('squoosh-cli')
|
||||
.arguments('<files...>')
|
||||
.option('-d, --output-dir <dir>', 'Output directory', '.')
|
||||
.option('-s, --suffix <suffix>', 'Append suffix to output files', '')
|
||||
.option(
|
||||
'--max-optimizer-rounds <rounds>',
|
||||
'Maximum number of compressions to use for auto optimizations',
|
||||
'6',
|
||||
)
|
||||
.option(
|
||||
'--optimizer-butteraugli-target <butteraugli distance>',
|
||||
'Target Butteraugli distance for auto optimizer',
|
||||
'1.4',
|
||||
)
|
||||
.action(processFiles);
|
||||
|
||||
// Create a CLI option for each supported preprocessor
|
||||
for (const [key, value] of Object.entries(preprocessors)) {
|
||||
program.option(`--${key} [config]`, value.description);
|
||||
}
|
||||
// Create a CLI option for each supported encoder
|
||||
for (const [key, value] of Object.entries(encoders)) {
|
||||
program.option(
|
||||
`--${key} [config]`,
|
||||
`Use ${value.name} to generate a .${value.extension} file with the given configuration`,
|
||||
);
|
||||
}
|
||||
|
||||
program.parse(process.argv);
|
||||
19
client-tsconfig.json
Normal file
19
client-tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"extends": "./generic-tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["esnext", "dom", "dom.iterable"],
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"src/features/**/client/**/*",
|
||||
"src/features/**/shared/**/*",
|
||||
"src/features/client-utils/**/*",
|
||||
"src/shared/**/*",
|
||||
"src/client/**/*",
|
||||
// Not really clean, but we need these to access the type of the functions
|
||||
// for comlink
|
||||
"src/features/**/worker/**/*",
|
||||
"src/features-worker/**/*",
|
||||
"src/features/worker-utils/**/*"
|
||||
]
|
||||
}
|
||||
89
codecs/avif/Makefile
Normal file
89
codecs/avif/Makefile
Normal file
@@ -0,0 +1,89 @@
|
||||
# libavif and libaom versions are from
|
||||
# https://docs.google.com/document/d/1wEEA5rRU7wT54k41u3qyZIZHDCJArIMzLuzsrLAwaK8/edit
|
||||
CODEC_URL = https://github.com/AOMediaCodec/libavif/archive/1c39e772c2c0d687691dd4b589a12c323f5f767d.tar.gz
|
||||
CODEC_PACKAGE = node_modules/libavif.tar.gz
|
||||
|
||||
LIBAOM_URL = https://aomedia.googlesource.com/aom/+archive/v3.1.0.tar.gz
|
||||
LIBAOM_PACKAGE = node_modules/libaom.tar.gz
|
||||
|
||||
export CODEC_DIR = node_modules/libavif
|
||||
export BUILD_DIR = node_modules/build
|
||||
export LIBAOM_DIR = node_modules/libaom
|
||||
|
||||
OUT_ENC_JS = enc/avif_enc.js
|
||||
OUT_NODE_ENC_JS = enc/avif_node_enc.js
|
||||
OUT_ENC_MT_JS = enc/avif_enc_mt.js
|
||||
OUT_DEC_JS = dec/avif_dec.js
|
||||
OUT_NODE_DEC_JS = dec/avif_node_dec.js
|
||||
|
||||
OUT_ENC_CPP = enc/avif_enc.cpp
|
||||
OUT_ENC_CPP = enc/avif_enc.cpp
|
||||
OUT_DEC_CPP = dec/avif_dec.cpp
|
||||
ENVIRONMENT = worker
|
||||
|
||||
HELPER_MAKEFLAGS := -f helper.Makefile
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(OUT_ENC_JS) $(OUT_DEC_JS) $(OUT_ENC_MT_JS) $(OUT_NODE_ENC_JS) $(OUT_NODE_DEC_JS)
|
||||
|
||||
$(OUT_NODE_ENC_JS): ENVIRONMENT=node
|
||||
$(OUT_NODE_ENC_JS) $(OUT_ENC_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||
$(MAKE) \
|
||||
$(HELPER_MAKEFLAGS) \
|
||||
OUT_JS=$@ \
|
||||
OUT_CPP=$< \
|
||||
LIBAOM_FLAGS="\
|
||||
-DCONFIG_AV1_DECODER=0 \
|
||||
-DCONFIG_MULTITHREAD=0 \
|
||||
-DCONFIG_AV1_HIGHBITDEPTH=0 \
|
||||
" \
|
||||
ENVIRONMENT=$(ENVIRONMENT) \
|
||||
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0"
|
||||
|
||||
$(OUT_ENC_MT_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||
$(MAKE) \
|
||||
$(HELPER_MAKEFLAGS) \
|
||||
OUT_JS=$@ \
|
||||
OUT_CPP=$< \
|
||||
LIBAOM_FLAGS="\
|
||||
-DCONFIG_AV1_DECODER=0 \
|
||||
-DCONFIG_AV1_HIGHBITDEPTH=0 \
|
||||
" \
|
||||
ENVIRONMENT=$(ENVIRONMENT) \
|
||||
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0" \
|
||||
OUT_FLAGS="-pthread"
|
||||
|
||||
$(OUT_NODE_DEC_JS): ENVIRONMENT=node
|
||||
$(OUT_NODE_DEC_JS) $(OUT_DEC_JS): $(OUT_DEC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||
$(MAKE) \
|
||||
$(HELPER_MAKEFLAGS) \
|
||||
OUT_JS=$@ \
|
||||
OUT_CPP=$< \
|
||||
LIBAOM_FLAGS="\
|
||||
-DCONFIG_AV1_ENCODER=0 \
|
||||
-DCONFIG_MULTITHREAD=0 \
|
||||
" \
|
||||
ENVIRONMENT=$(ENVIRONMENT) \
|
||||
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_ENCODE=0"
|
||||
|
||||
$(CODEC_PACKAGE):
|
||||
mkdir -p $(@D)
|
||||
curl -sL $(CODEC_URL) -o $@
|
||||
|
||||
$(LIBAOM_PACKAGE):
|
||||
mkdir -p $(@D)
|
||||
curl -sL $(LIBAOM_URL) -o $@
|
||||
|
||||
$(CODEC_DIR)/CMakeLists.txt: $(CODEC_PACKAGE)
|
||||
mkdir -p $(@D)
|
||||
tar xzm --strip 1 -C $(@D) -f $(CODEC_PACKAGE)
|
||||
|
||||
$(LIBAOM_DIR)/CMakeLists.txt: $(LIBAOM_PACKAGE)
|
||||
mkdir -p $(@D)
|
||||
tar xzm -C $(@D) -f $(LIBAOM_PACKAGE)
|
||||
|
||||
clean:
|
||||
$(MAKE) $(HELPER_MAKEFLAGS) OUT_JS=$(OUT_ENC_JS) clean
|
||||
$(MAKE) $(HELPER_MAKEFLAGS) OUT_JS=$(OUT_ENC_MT_JS) clean
|
||||
$(MAKE) $(HELPER_MAKEFLAGS) OUT_JS=$(OUT_DEC_JS) clean
|
||||
14
codecs/avif/dec/README.md
Normal file
14
codecs/avif/dec/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# AVIF decoder
|
||||
|
||||
- Source: <https://github.com/AOMediaCodec/libavif>
|
||||
- Version: v0.5.4
|
||||
|
||||
## Example
|
||||
|
||||
See `example.html`
|
||||
|
||||
## API
|
||||
|
||||
### `RawImage decode(std::string buffer)`
|
||||
|
||||
Decodes the given avif buffer into raw RGBA. `RawImage` is a class with 3 fields: `buffer`, `width`, and `height`.
|
||||
48
codecs/avif/dec/avif_dec.cpp
Normal file
48
codecs/avif/dec/avif_dec.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#include <emscripten/bind.h>
|
||||
#include <emscripten/val.h>
|
||||
#include "avif/avif.h"
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
|
||||
thread_local const val ImageData = val::global("ImageData");
|
||||
|
||||
val decode(std::string avifimage) {
|
||||
avifImage* image = avifImageCreateEmpty();
|
||||
avifDecoder* decoder = avifDecoderCreate();
|
||||
avifResult decodeResult =
|
||||
avifDecoderReadMemory(decoder, image, (uint8_t*)avifimage.c_str(), avifimage.length());
|
||||
// image is an independent copy of decoded data, decoder may be destroyed here
|
||||
avifDecoderDestroy(decoder);
|
||||
|
||||
val result = val::null();
|
||||
|
||||
if (decodeResult == AVIF_RESULT_OK) {
|
||||
// Convert to interleaved RGB(A)/BGR(A) using a libavif-allocated buffer.
|
||||
avifRGBImage rgb;
|
||||
avifRGBImageSetDefaults(&rgb,
|
||||
image); // Defaults to AVIF_RGB_FORMAT_RGBA which is what we want.
|
||||
rgb.depth = 8; // Does not need to match image->depth. We always want 8-bit pixels.
|
||||
|
||||
avifRGBImageAllocatePixels(&rgb);
|
||||
avifImageYUVToRGB(image, &rgb);
|
||||
|
||||
// We want to create a *copy* of the decoded data to be owned by the JavaScript side.
|
||||
// For that, we perform `new Uint8Array(wasmMemBuffer, wasmPtr, wasmSize).slice()`:
|
||||
result = ImageData.new_(
|
||||
Uint8ClampedArray.new_(typed_memory_view(rgb.rowBytes * rgb.height, rgb.pixels)), rgb.width,
|
||||
rgb.height);
|
||||
|
||||
// Now we can safely free the RGB pixels:
|
||||
avifRGBImageFreePixels(&rgb);
|
||||
}
|
||||
|
||||
// Image has been converted to RGB, we don't need the original anymore.
|
||||
avifImageDestroy(image);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
EMSCRIPTEN_BINDINGS(my_module) {
|
||||
function("decode", &decode);
|
||||
}
|
||||
7
codecs/avif/dec/avif_dec.d.ts
vendored
Normal file
7
codecs/avif/dec/avif_dec.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export interface AVIFModule extends EmscriptenWasm.Module {
|
||||
decode(data: BufferSource): ImageData | null;
|
||||
}
|
||||
|
||||
declare var moduleFactory: EmscriptenWasm.ModuleFactory<AVIFModule>;
|
||||
|
||||
export default moduleFactory;
|
||||
57
codecs/avif/dec/avif_dec.js
generated
Normal file
57
codecs/avif/dec/avif_dec.js
generated
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var e;e||(e=typeof Module !== 'undefined' ? Module : {});var aa,r;e.ready=new Promise(function(a,b){aa=a;r=b});var t={},u;for(u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);var v="",ba;v=self.location.href;_scriptDir&&(v=_scriptDir);0!==v.indexOf("blob:")?v=v.substr(0,v.lastIndexOf("/")+1):v="";ba=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};var ca=e.print||console.log.bind(console),w=e.printErr||console.warn.bind(console);
|
||||
for(u in t)t.hasOwnProperty(u)&&(e[u]=t[u]);t=null;var da=0,y;e.wasmBinary&&(y=e.wasmBinary);var noExitRuntime=e.noExitRuntime||!0;"object"!==typeof WebAssembly&&z("no native wasm support detected");var ea,fa=!1,ha=new TextDecoder("utf8");
|
||||
function ia(a,b,c){var d=A;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var ja=new TextDecoder("utf-16le");
|
||||
function ka(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&B[c];)++c;return ja.decode(A.subarray(a,c<<1))}function la(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)D[b>>1]=a.charCodeAt(f),b+=2;D[b>>1]=0;return b-d}function ma(a){return 2*a.length}function na(a,b){for(var c=0,d="";!(c>=b/4);){var f=E[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
|
||||
function oa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023}E[b>>2]=g;b+=4;if(b+4>c)break}E[b>>2]=0;return b-d}function pa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var qa,ra,A,D,B,E,F,sa,ta;
|
||||
function ua(){var a=ea.buffer;qa=a;e.HEAP8=ra=new Int8Array(a);e.HEAP16=D=new Int16Array(a);e.HEAP32=E=new Int32Array(a);e.HEAPU8=A=new Uint8Array(a);e.HEAPU16=B=new Uint16Array(a);e.HEAPU32=F=new Uint32Array(a);e.HEAPF32=sa=new Float32Array(a);e.HEAPF64=ta=new Float64Array(a)}var G,va=[],wa=[],xa=[];function ya(){var a=e.preRun.shift();va.unshift(a)}var H=0,za=null,J=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function z(a){if(e.onAbort)e.onAbort(a);w(a);fa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");r(a);throw a;}var K=(new URL("avif_dec.wasm",import.meta.url)).toString();function Aa(){try{if(K==K&&y)return new Uint8Array(y);if(ba)return ba(K);throw"both async and sync fetching of the wasm failed";}catch(a){z(a)}}
|
||||
function Ba(){return y||"function"!==typeof fetch?Promise.resolve().then(function(){return Aa()}):fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Aa()})}function Ca(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.V;"number"===typeof c?void 0===b.R?G.get(c)():G.get(c)(b.R):c(void 0===b.R?null:b.R)}}}
|
||||
function Da(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ea=void 0;function M(a){for(var b="";A[a];)b+=Ea[A[a++]];return b}var N={},O={},P={};function Fa(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||
function Ga(a,b){a=Fa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ha(a){var b=Error,c=Ga(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||
var Ia=void 0;function Q(a){throw new Ia(a);}var Ja=void 0;function Ka(a,b){function c(h){h=b(h);if(h.length!==d.length)throw new Ja("Mismatched type converter count");for(var n=0;n<d.length;++n)R(d[n],h[n])}var d=[];d.forEach(function(h){P[h]=a});var f=Array(a.length),g=[],k=0;a.forEach(function(h,n){O.hasOwnProperty(h)?f[n]=O[h]:(g.push(h),N.hasOwnProperty(h)||(N[h]=[]),N[h].push(function(){f[n]=O[h];++k;k===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||
function R(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||Q('type "'+d+'" must have a positive integer typeid pointer');if(O.hasOwnProperty(a)){if(c.U)return;Q("Cannot register type '"+d+"' twice")}O[a]=b;delete P[a];N.hasOwnProperty(a)&&(b=N[a],delete N[a],b.forEach(function(f){f()}))}var Na=[],S=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Oa(a){4<a&&0===--S[a].S&&(S[a]=void 0,Na.push(a))}function T(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Na.length?Na.pop():S.length;S[b]={S:1,value:a};return b}}function Pa(a){return this.fromWireType(F[a>>2])}function Qa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Ra(a,b){switch(b){case 2:return function(c){return this.fromWireType(sa[c>>2])};case 3:return function(c){return this.fromWireType(ta[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Sa(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ga(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Ta(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ua(a,b){var c=e;if(void 0===c[a].O){var d=c[a];c[a]=function(){c[a].O.hasOwnProperty(arguments.length)||Q("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].O+")!");return c[a].O[arguments.length].apply(this,arguments)};c[a].O=[];c[a].O[d.T]=d}}
|
||||
function Va(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].O&&void 0!==e[a].O[c])&&Q("Cannot register public name '"+a+"' twice"),Ua(a,a),e.hasOwnProperty(c)&&Q("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].O[c]=b):(e[a]=b,void 0!==c&&(e[a].X=c))}function Wa(a,b){for(var c=[],d=0;d<a;d++)c.push(E[(b>>2)+d]);return c}
|
||||
function Xa(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=e["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=G.get(b).apply(null,c);return d}}function Ya(a,b){a=M(a);var c=a.includes("j")?Xa(a,b):G.get(b);"function"!==typeof c&&Q("unknown function pointer with signature "+a+": "+b);return c}var Za=void 0;function $a(a){a=ab(a);var b=M(a);U(a);return b}
|
||||
function bb(a,b){function c(g){f[g]||O[g]||(P[g]?P[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Za(a+": "+d.map($a).join([", "]));}function cb(a,b,c){switch(b){case 0:return c?function(d){return ra[d]}:function(d){return A[d]};case 1:return c?function(d){return D[d>>1]}:function(d){return B[d>>1]};case 2:return c?function(d){return E[d>>2]}:function(d){return F[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var db={};
|
||||
function eb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function fb(a,b){var c=O[a];void 0===c&&Q(b+" has unknown type "+$a(a));return c}for(var gb={},hb=[null,[],[]],ib=Array(256),V=0;256>V;++V)ib[V]=String.fromCharCode(V);Ea=ib;Ia=e.BindingError=Ha("BindingError");Ja=e.InternalError=Ha("InternalError");e.count_emval_handles=function(){for(var a=0,b=5;b<S.length;++b)void 0!==S[b]&&++a;return a};
|
||||
e.get_first_emval=function(){for(var a=5;a<S.length;++a)if(void 0!==S[a])return S[a];return null};Za=e.UnboundTypeError=Ha("UnboundTypeError");
|
||||
var ob={j:function(){},v:function(){},r:function(a,b,c,d,f){var g=Da(c);b=M(b);R(a,{name:b,fromWireType:function(k){return!!k},toWireType:function(k,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(k){if(1===c)var h=ra;else if(2===c)h=D;else if(4===c)h=E;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[k>>g])},P:null})},B:function(a,b){b=M(b);R(a,{name:b,fromWireType:function(c){var d=S[c].value;Oa(c);return d},toWireType:function(c,d){return T(d)},
|
||||
argPackAdvance:8,readValueFromPointer:Pa,P:null})},q:function(a,b,c){c=Da(c);b=M(b);R(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Qa(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Ra(b,c),P:null})},t:function(a,b,c,d,f,g){var k=Wa(b,c);a=M(a);f=Ya(d,f);Va(a,function(){bb("Cannot call "+a+" due to unbound types",k)},b-1);Ka(k,function(h){var n=a,l=a;h=[h[0],null].concat(h.slice(1));
|
||||
var m=f,q=h.length;2>q&&Q("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==h[1]&&!1,C=!1,p=1;p<h.length;++p)if(null!==h[p]&&void 0===h[p].P){C=!0;break}var La="void"!==h[0].name,I="",L="";for(p=0;p<q-2;++p)I+=(0!==p?", ":"")+"arg"+p,L+=(0!==p?", ":"")+"arg"+p+"Wired";l="return function "+Fa(l)+"("+I+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+l+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";
|
||||
C&&(l+="var destructors = [];\n");var Ma=C?"destructors":"null";I="throwBindingError invoker fn runDestructors retType classParam".split(" ");m=[Q,m,g,Ta,h[0],h[1]];x&&(l+="var thisWired = classParam.toWireType("+Ma+", this);\n");for(p=0;p<q-2;++p)l+="var arg"+p+"Wired = argType"+p+".toWireType("+Ma+", arg"+p+"); // "+h[p+2].name+"\n",I.push("argType"+p),m.push(h[p+2]);x&&(L="thisWired"+(0<L.length?", ":"")+L);l+=(La?"var rv = ":"")+"invoker(fn"+(0<L.length?", ":"")+L+");\n";if(C)l+="runDestructors(destructors);\n";
|
||||
else for(p=x?1:2;p<h.length;++p)q=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==h[p].P&&(l+=q+"_dtor("+q+"); // "+h[p].name+"\n",I.push(q+"_dtor"),m.push(h[p].P));La&&(l+="var ret = retType.fromWireType(rv);\nreturn ret;\n");I.push(l+"}\n");h=Sa(I).apply(null,m);p=b-1;if(!e.hasOwnProperty(n))throw new Ja("Replacing nonexistant public symbol");void 0!==e[n].O&&void 0!==p?e[n].O[p]=h:(e[n]=h,e[n].T=p);return[]})},e:function(a,b,c,d,f){function g(l){return l}b=M(b);-1===f&&(f=4294967295);var k=Da(c);
|
||||
if(0===d){var h=32-8*c;g=function(l){return l<<h>>>h}}var n=b.includes("unsigned");R(a,{name:b,fromWireType:g,toWireType:function(l,m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+Qa(m)+'" to '+this.name);if(m<d||m>f)throw new TypeError('Passing a number "'+Qa(m)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return n?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:cb(b,k,0!==d),P:null})},d:function(a,
|
||||
b,c){function d(g){g>>=2;var k=F;return new f(qa,k[g+1],k[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=M(c);R(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{U:!0})},m:function(a,b){b=M(b);var c="std::string"===b;R(a,{name:b,fromWireType:function(d){var f=F[d>>2];if(c)for(var g=d+4,k=0;k<=f;++k){var h=d+4+k;if(k==f||0==A[h]){if(g){for(var n=g+(h-g),l=g;!(l>=n)&&A[l];)++l;g=ha.decode(A.subarray(g,l))}else g="";if(void 0===
|
||||
m)var m=g;else m+=String.fromCharCode(0),m+=g;g=h+1}}else{m=Array(f);for(k=0;k<f;++k)m[k]=String.fromCharCode(A[d+4+k]);m=m.join("")}U(d);return m},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||Q("Cannot pass non-string to std::string");var k=(c&&g?function(){for(var l=0,m=0;m<f.length;++m){var q=f.charCodeAt(m);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++m)&
|
||||
1023);127>=q?++l:l=2047>=q?l+2:65535>=q?l+3:l+4}return l}:function(){return f.length})(),h=jb(4+k+1);F[h>>2]=k;if(c&&g)ia(f,h+4,k+1);else if(g)for(g=0;g<k;++g){var n=f.charCodeAt(g);255<n&&(U(h),Q("String has UTF-16 code units that do not fit in 8 bits"));A[h+4+g]=n}else for(g=0;g<k;++g)A[h+4+g]=f[g];null!==d&&d.push(U,h);return h},argPackAdvance:8,readValueFromPointer:Pa,P:function(d){U(d)}})},l:function(a,b,c){c=M(c);if(2===b){var d=ka;var f=la;var g=ma;var k=function(){return B};var h=1}else 4===
|
||||
b&&(d=na,f=oa,g=pa,k=function(){return F},h=2);R(a,{name:c,fromWireType:function(n){for(var l=F[n>>2],m=k(),q,x=n+4,C=0;C<=l;++C){var p=n+4+C*b;if(C==l||0==m[p>>h])x=d(x,p-x),void 0===q?q=x:(q+=String.fromCharCode(0),q+=x),x=p+b}U(n);return q},toWireType:function(n,l){"string"!==typeof l&&Q("Cannot pass non-string to C++ string type "+c);var m=g(l),q=jb(4+m+b);F[q>>2]=m>>h;f(l,q+4,m+b);null!==n&&n.push(U,q);return q},argPackAdvance:8,readValueFromPointer:Pa,P:function(n){U(n)}})},s:function(a,b){b=
|
||||
M(b);R(a,{W:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},h:Oa,i:function(a){if(0===a)return T(eb());var b=db[a];a=void 0===b?M(a):b;return T(eb()[a])},n:function(a){4<a&&(S[a].S+=1)},o:function(a,b,c,d){a||Q("Cannot use deleted val. handle = "+a);a=S[a].value;var f=gb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var k="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)k+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",k+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(fb,e,T);gb[b]=f}return f(a,c,d)},a:function(){z()},g:function(a,b){W(a,b||1);throw"longjmp";},y:function(a,b,c){A.copyWithin(a,b,b+c)},k:function(a){var b=A.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+
|
||||
.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{ea.grow(Math.min(2147483648,d)-qa.byteLength+65535>>>16);ua();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},z:function(){return 0},u:function(){},A:function(a,b,c,d){for(var f=0,g=0;g<c;g++){for(var k=E[b+8*g>>2],h=E[b+(8*g+4)>>2],n=0;n<h;n++){var l=A[k+n],m=hb[a];if(0===l||10===l){for(l=0;m[l]&&!(NaN<=l);)++l;l=ha.decode(m.subarray?m.subarray(0,l):new Uint8Array(m.slice(0,l)));(1===a?ca:w)(l);m.length=
|
||||
0}else m.push(l)}f+=h}E[d>>2]=f;return 0},b:function(){return da},f:kb,w:lb,p:mb,x:nb,c:function(a){da=a}};
|
||||
(function(){function a(f){e.asm=f.exports;ea=e.asm.C;ua();G=e.asm.L;wa.unshift(e.asm.D);H--;e.monitorRunDependencies&&e.monitorRunDependencies(H);0==H&&(null!==za&&(clearInterval(za),za=null),J&&(f=J,J=null,f()))}function b(f){a(f.instance)}function c(f){return Ba().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){w("failed to asynchronously prepare wasm: "+g);z(g)})}var d={a:ob};H++;e.monitorRunDependencies&&e.monitorRunDependencies(H);if(e.instantiateWasm)try{return e.instantiateWasm(d,
|
||||
a)}catch(f){return w("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return y||"function"!==typeof WebAssembly.instantiateStreaming||K.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(K,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){w("wasm streaming compile failed: "+g);w("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(r);return{}})();
|
||||
e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.D).apply(null,arguments)};var jb=e._malloc=function(){return(jb=e._malloc=e.asm.E).apply(null,arguments)},U=e._free=function(){return(U=e._free=e.asm.F).apply(null,arguments)},ab=e.___getTypeName=function(){return(ab=e.___getTypeName=e.asm.G).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.H).apply(null,arguments)};
|
||||
var X=e.stackSave=function(){return(X=e.stackSave=e.asm.I).apply(null,arguments)},Y=e.stackRestore=function(){return(Y=e.stackRestore=e.asm.J).apply(null,arguments)},W=e._setThrew=function(){return(W=e._setThrew=e.asm.K).apply(null,arguments)};e.dynCall_iiijii=function(){return(e.dynCall_iiijii=e.asm.M).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.N).apply(null,arguments)};
|
||||
function nb(a,b,c,d,f,g,k,h){var n=X();try{G.get(a)(b,c,d,f,g,k,h)}catch(l){Y(n);if(l!==l+0&&"longjmp"!==l)throw l;W(1,0)}}function mb(a,b,c,d,f){var g=X();try{G.get(a)(b,c,d,f)}catch(k){Y(g);if(k!==k+0&&"longjmp"!==k)throw k;W(1,0)}}function kb(a,b,c){var d=X();try{return G.get(a)(b,c)}catch(f){Y(d);if(f!==f+0&&"longjmp"!==f)throw f;W(1,0)}}function lb(a,b,c,d,f){var g=X();try{return G.get(a)(b,c,d,f)}catch(k){Y(g);if(k!==k+0&&"longjmp"!==k)throw k;W(1,0)}}var Z;J=function pb(){Z||qb();Z||(J=pb)};
|
||||
function qb(){function a(){if(!Z&&(Z=!0,e.calledRun=!0,!fa)){Ca(wa);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();xa.unshift(b)}Ca(xa)}}if(!(0<H)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)ya();Ca(va);0<H||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=qb;
|
||||
if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();qb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/avif/dec/avif_dec.wasm
Executable file
BIN
codecs/avif/dec/avif_dec.wasm
Executable file
Binary file not shown.
57
codecs/avif/dec/avif_node_dec.js
generated
Normal file
57
codecs/avif/dec/avif_node_dec.js
generated
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var e;e||(e=typeof Module !== 'undefined' ? Module : {});var aa,r;e.ready=new Promise(function(a,b){aa=a;r=b});var t={},u;for(u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);var ba,v,ca,da;ba=function(a){ca||(ca=require("fs"));da||(da=require("path"));a=da.normalize(a);return ca.readFileSync(a,null)};v=function(a){a=ba(a);a.buffer||(a=new Uint8Array(a));a.buffer||w("Assertion failed: undefined");return a};1<process.argv.length&&process.argv[1].replace(/\\/g,"/");process.argv.slice(2);
|
||||
process.on("uncaughtException",function(a){throw a;});process.on("unhandledRejection",w);e.inspect=function(){return"[Emscripten Module object]"};var ea=e.print||console.log.bind(console),y=e.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(e[u]=t[u]);t=null;var fa=0,z;e.wasmBinary&&(z=e.wasmBinary);var noExitRuntime=e.noExitRuntime||!0;"object"!==typeof WebAssembly&&w("no native wasm support detected");var ha,ia=!1,ja=new TextDecoder("utf8");
|
||||
function ka(a,b,c){var d=A;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var la=new TextDecoder("utf-16le");
|
||||
function ma(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&B[c];)++c;return la.decode(A.subarray(a,c<<1))}function na(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)D[b>>1]=a.charCodeAt(f),b+=2;D[b>>1]=0;return b-d}function oa(a){return 2*a.length}function pa(a,b){for(var c=0,d="";!(c>=b/4);){var f=E[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
|
||||
function qa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}E[b>>2]=g;b+=4;if(b+4>c)break}E[b>>2]=0;return b-d}function ra(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var sa,ta,A,D,B,E,F,ua,va;
|
||||
function wa(){var a=ha.buffer;sa=a;e.HEAP8=ta=new Int8Array(a);e.HEAP16=D=new Int16Array(a);e.HEAP32=E=new Int32Array(a);e.HEAPU8=A=new Uint8Array(a);e.HEAPU16=B=new Uint16Array(a);e.HEAPU32=F=new Uint32Array(a);e.HEAPF32=ua=new Float32Array(a);e.HEAPF64=va=new Float64Array(a)}var H,xa=[],ya=[],za=[];function Aa(){var a=e.preRun.shift();xa.unshift(a)}var I=0,Ba=null,J=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function w(a){if(e.onAbort)e.onAbort(a);y(a);ia=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");r(a);throw a;}var L=(new URL("avif_node_dec.wasm",import.meta.url)).toString();function Ca(){return Promise.resolve().then(function(){a:{try{if(L==L&&z){var a=new Uint8Array(z);break a}if(v){a=v(L);break a}throw"both async and sync fetching of the wasm failed";}catch(b){w(b)}a=void 0}return a})}
|
||||
function Da(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.V;"number"===typeof c?void 0===b.R?H.get(c)():H.get(c)(b.R):c(void 0===b.R?null:b.R)}}}function Ea(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Fa=void 0;function M(a){for(var b="";A[a];)b+=Fa[A[a++]];return b}var N={},O={},P={};
|
||||
function Ga(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ha(a,b){a=Ga(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function Ia(a){var b=Error,c=Ha(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Ja=void 0;function Q(a){throw new Ja(a);}var Ka=void 0;
|
||||
function La(a,b){function c(k){k=b(k);if(k.length!==d.length)throw new Ka("Mismatched type converter count");for(var l=0;l<d.length;++l)R(d[l],k[l])}var d=[];d.forEach(function(k){P[k]=a});var f=Array(a.length),g=[],h=0;a.forEach(function(k,l){O.hasOwnProperty(k)?f[l]=O[k]:(g.push(k),N.hasOwnProperty(k)||(N[k]=[]),N[k].push(function(){f[l]=O[k];++h;h===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||
function R(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||Q('type "'+d+'" must have a positive integer typeid pointer');if(O.hasOwnProperty(a)){if(c.U)return;Q("Cannot register type '"+d+"' twice")}O[a]=b;delete P[a];N.hasOwnProperty(a)&&(b=N[a],delete N[a],b.forEach(function(f){f()}))}var Oa=[],S=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Pa(a){4<a&&0===--S[a].S&&(S[a]=void 0,Oa.push(a))}function T(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Oa.length?Oa.pop():S.length;S[b]={S:1,value:a};return b}}function Qa(a){return this.fromWireType(F[a>>2])}function Ra(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Sa(a,b){switch(b){case 2:return function(c){return this.fromWireType(ua[c>>2])};case 3:return function(c){return this.fromWireType(va[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Ta(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ha(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Ua(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Va(a,b){var c=e;if(void 0===c[a].O){var d=c[a];c[a]=function(){c[a].O.hasOwnProperty(arguments.length)||Q("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].O+")!");return c[a].O[arguments.length].apply(this,arguments)};c[a].O=[];c[a].O[d.T]=d}}
|
||||
function Wa(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].O&&void 0!==e[a].O[c])&&Q("Cannot register public name '"+a+"' twice"),Va(a,a),e.hasOwnProperty(c)&&Q("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].O[c]=b):(e[a]=b,void 0!==c&&(e[a].X=c))}function Xa(a,b){for(var c=[],d=0;d<a;d++)c.push(E[(b>>2)+d]);return c}
|
||||
function Ya(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=e["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=H.get(b).apply(null,c);return d}}function Za(a,b){a=M(a);var c=a.includes("j")?Ya(a,b):H.get(b);"function"!==typeof c&&Q("unknown function pointer with signature "+a+": "+b);return c}var $a=void 0;function ab(a){a=bb(a);var b=M(a);U(a);return b}
|
||||
function cb(a,b){function c(g){f[g]||O[g]||(P[g]?P[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new $a(a+": "+d.map(ab).join([", "]));}function db(a,b,c){switch(b){case 0:return c?function(d){return ta[d]}:function(d){return A[d]};case 1:return c?function(d){return D[d>>1]}:function(d){return B[d>>1]};case 2:return c?function(d){return E[d>>2]}:function(d){return F[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var eb={};
|
||||
function fb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function gb(a,b){var c=O[a];void 0===c&&Q(b+" has unknown type "+ab(a));return c}for(var hb={},ib=[null,[],[]],jb=Array(256),V=0;256>V;++V)jb[V]=String.fromCharCode(V);Fa=jb;Ja=e.BindingError=Ia("BindingError");Ka=e.InternalError=Ia("InternalError");e.count_emval_handles=function(){for(var a=0,b=5;b<S.length;++b)void 0!==S[b]&&++a;return a};
|
||||
e.get_first_emval=function(){for(var a=5;a<S.length;++a)if(void 0!==S[a])return S[a];return null};$a=e.UnboundTypeError=Ia("UnboundTypeError");
|
||||
var pb={j:function(){},v:function(){},r:function(a,b,c,d,f){var g=Ea(c);b=M(b);R(a,{name:b,fromWireType:function(h){return!!h},toWireType:function(h,k){return k?d:f},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var k=ta;else if(2===c)k=D;else if(4===c)k=E;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[h>>g])},P:null})},B:function(a,b){b=M(b);R(a,{name:b,fromWireType:function(c){var d=S[c].value;Pa(c);return d},toWireType:function(c,d){return T(d)},
|
||||
argPackAdvance:8,readValueFromPointer:Qa,P:null})},q:function(a,b,c){c=Ea(c);b=M(b);R(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Ra(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Sa(b,c),P:null})},t:function(a,b,c,d,f,g){var h=Xa(b,c);a=M(a);f=Za(d,f);Wa(a,function(){cb("Cannot call "+a+" due to unbound types",h)},b-1);La(h,function(k){var l=[k[0],null].concat(k.slice(1)),
|
||||
m=k=a,n=f,p=l.length;2>p&&Q("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==l[1]&&!1,C=!1,q=1;q<l.length;++q)if(null!==l[q]&&void 0===l[q].P){C=!0;break}var Ma="void"!==l[0].name,G="",K="";for(q=0;q<p-2;++q)G+=(0!==q?", ":"")+"arg"+q,K+=(0!==q?", ":"")+"arg"+q+"Wired";m="return function "+Ga(m)+"("+G+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";
|
||||
C&&(m+="var destructors = [];\n");var Na=C?"destructors":"null";G="throwBindingError invoker fn runDestructors retType classParam".split(" ");n=[Q,n,g,Ua,l[0],l[1]];x&&(m+="var thisWired = classParam.toWireType("+Na+", this);\n");for(q=0;q<p-2;++q)m+="var arg"+q+"Wired = argType"+q+".toWireType("+Na+", arg"+q+"); // "+l[q+2].name+"\n",G.push("argType"+q),n.push(l[q+2]);x&&(K="thisWired"+(0<K.length?", ":"")+K);m+=(Ma?"var rv = ":"")+"invoker(fn"+(0<K.length?", ":"")+K+");\n";if(C)m+="runDestructors(destructors);\n";
|
||||
else for(q=x?1:2;q<l.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==l[q].P&&(m+=p+"_dtor("+p+"); // "+l[q].name+"\n",G.push(p+"_dtor"),n.push(l[q].P));Ma&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");G.push(m+"}\n");l=Ta(G).apply(null,n);q=b-1;if(!e.hasOwnProperty(k))throw new Ka("Replacing nonexistant public symbol");void 0!==e[k].O&&void 0!==q?e[k].O[q]=l:(e[k]=l,e[k].T=q);return[]})},e:function(a,b,c,d,f){function g(m){return m}b=M(b);-1===f&&(f=4294967295);var h=Ea(c);
|
||||
if(0===d){var k=32-8*c;g=function(m){return m<<k>>>k}}var l=b.includes("unsigned");R(a,{name:b,fromWireType:g,toWireType:function(m,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+Ra(n)+'" to '+this.name);if(n<d||n>f)throw new TypeError('Passing a number "'+Ra(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return l?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:db(b,h,0!==d),P:null})},d:function(a,
|
||||
b,c){function d(g){g>>=2;var h=F;return new f(sa,h[g+1],h[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=M(c);R(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{U:!0})},m:function(a,b){b=M(b);var c="std::string"===b;R(a,{name:b,fromWireType:function(d){var f=F[d>>2];if(c)for(var g=d+4,h=0;h<=f;++h){var k=d+4+h;if(h==f||0==A[k]){if(g){for(var l=g+(k-g),m=g;!(m>=l)&&A[m];)++m;g=ja.decode(A.subarray(g,m))}else g="";if(void 0===
|
||||
n)var n=g;else n+=String.fromCharCode(0),n+=g;g=k+1}}else{n=Array(f);for(h=0;h<f;++h)n[h]=String.fromCharCode(A[d+4+h]);n=n.join("")}U(d);return n},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||Q("Cannot pass non-string to std::string");var h=(c&&g?function(){for(var m=0,n=0;n<f.length;++n){var p=f.charCodeAt(n);55296<=p&&57343>=p&&(p=65536+((p&1023)<<10)|f.charCodeAt(++n)&
|
||||
1023);127>=p?++m:m=2047>=p?m+2:65535>=p?m+3:m+4}return m}:function(){return f.length})(),k=kb(4+h+1);F[k>>2]=h;if(c&&g)ka(f,k+4,h+1);else if(g)for(g=0;g<h;++g){var l=f.charCodeAt(g);255<l&&(U(k),Q("String has UTF-16 code units that do not fit in 8 bits"));A[k+4+g]=l}else for(g=0;g<h;++g)A[k+4+g]=f[g];null!==d&&d.push(U,k);return k},argPackAdvance:8,readValueFromPointer:Qa,P:function(d){U(d)}})},l:function(a,b,c){c=M(c);if(2===b){var d=ma;var f=na;var g=oa;var h=function(){return B};var k=1}else 4===
|
||||
b&&(d=pa,f=qa,g=ra,h=function(){return F},k=2);R(a,{name:c,fromWireType:function(l){for(var m=F[l>>2],n=h(),p,x=l+4,C=0;C<=m;++C){var q=l+4+C*b;if(C==m||0==n[q>>k])x=d(x,q-x),void 0===p?p=x:(p+=String.fromCharCode(0),p+=x),x=q+b}U(l);return p},toWireType:function(l,m){"string"!==typeof m&&Q("Cannot pass non-string to C++ string type "+c);var n=g(m),p=kb(4+n+b);F[p>>2]=n>>k;f(m,p+4,n+b);null!==l&&l.push(U,p);return p},argPackAdvance:8,readValueFromPointer:Qa,P:function(l){U(l)}})},s:function(a,b){b=
|
||||
M(b);R(a,{W:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},h:Pa,i:function(a){if(0===a)return T(fb());var b=eb[a];a=void 0===b?M(a):b;return T(fb()[a])},n:function(a){4<a&&(S[a].S+=1)},o:function(a,b,c,d){a||Q("Cannot use deleted val. handle = "+a);a=S[a].value;var f=hb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var h="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)h+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(gb,e,T);hb[b]=f}return f(a,c,d)},a:function(){w()},g:function(a,b){W(a,b||1);throw"longjmp";},y:function(a,b,c){A.copyWithin(a,b,b+c)},k:function(a){var b=A.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+
|
||||
.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{ha.grow(Math.min(2147483648,d)-sa.byteLength+65535>>>16);wa();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},z:function(){return 0},u:function(){},A:function(a,b,c,d){for(var f=0,g=0;g<c;g++){for(var h=E[b+8*g>>2],k=E[b+(8*g+4)>>2],l=0;l<k;l++){var m=A[h+l],n=ib[a];if(0===m||10===m){m=1===a?ea:y;var p;for(p=0;n[p]&&!(NaN<=p);)++p;p=ja.decode(n.subarray?n.subarray(0,p):new Uint8Array(n.slice(0,p)));m(p);
|
||||
n.length=0}else n.push(m)}f+=k}E[d>>2]=f;return 0},b:function(){return fa},f:lb,w:mb,p:nb,x:ob,c:function(a){fa=a}};
|
||||
(function(){function a(f){e.asm=f.exports;ha=e.asm.C;wa();H=e.asm.L;ya.unshift(e.asm.D);I--;e.monitorRunDependencies&&e.monitorRunDependencies(I);0==I&&(null!==Ba&&(clearInterval(Ba),Ba=null),J&&(f=J,J=null,f()))}function b(f){a(f.instance)}function c(f){return Ca().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){y("failed to asynchronously prepare wasm: "+g);w(g)})}var d={a:pb};I++;e.monitorRunDependencies&&e.monitorRunDependencies(I);if(e.instantiateWasm)try{return e.instantiateWasm(d,
|
||||
a)}catch(f){return y("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return z||"function"!==typeof WebAssembly.instantiateStreaming||L.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(L,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){y("wasm streaming compile failed: "+g);y("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(r);return{}})();
|
||||
e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.D).apply(null,arguments)};var kb=e._malloc=function(){return(kb=e._malloc=e.asm.E).apply(null,arguments)},U=e._free=function(){return(U=e._free=e.asm.F).apply(null,arguments)},bb=e.___getTypeName=function(){return(bb=e.___getTypeName=e.asm.G).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.H).apply(null,arguments)};
|
||||
var X=e.stackSave=function(){return(X=e.stackSave=e.asm.I).apply(null,arguments)},Y=e.stackRestore=function(){return(Y=e.stackRestore=e.asm.J).apply(null,arguments)},W=e._setThrew=function(){return(W=e._setThrew=e.asm.K).apply(null,arguments)};e.dynCall_iiijii=function(){return(e.dynCall_iiijii=e.asm.M).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.N).apply(null,arguments)};
|
||||
function ob(a,b,c,d,f,g,h,k){var l=X();try{H.get(a)(b,c,d,f,g,h,k)}catch(m){Y(l);if(m!==m+0&&"longjmp"!==m)throw m;W(1,0)}}function nb(a,b,c,d,f){var g=X();try{H.get(a)(b,c,d,f)}catch(h){Y(g);if(h!==h+0&&"longjmp"!==h)throw h;W(1,0)}}function lb(a,b,c){var d=X();try{return H.get(a)(b,c)}catch(f){Y(d);if(f!==f+0&&"longjmp"!==f)throw f;W(1,0)}}function mb(a,b,c,d,f){var g=X();try{return H.get(a)(b,c,d,f)}catch(h){Y(g);if(h!==h+0&&"longjmp"!==h)throw h;W(1,0)}}var Z;J=function qb(){Z||rb();Z||(J=qb)};
|
||||
function rb(){function a(){if(!Z&&(Z=!0,e.calledRun=!0,!ia)){Da(ya);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();za.unshift(b)}Da(za)}}if(!(0<I)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)Aa();Da(xa);0<I||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=rb;
|
||||
if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();rb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/avif/dec/avif_node_dec.wasm
Executable file
BIN
codecs/avif/dec/avif_node_dec.wasm
Executable file
Binary file not shown.
37
codecs/avif/enc/README.md
Normal file
37
codecs/avif/enc/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# AVIF encoder
|
||||
|
||||
- Source: <https://github.com/AOMediaCodec/libavif>
|
||||
- Version: v0.5.4
|
||||
|
||||
## Example
|
||||
|
||||
Run example.js
|
||||
|
||||
## API
|
||||
|
||||
### `Uint8Array encode(std::string image_in, int image_width, int image_height, AvifOptions opts)`
|
||||
|
||||
Encodes the given image with given dimension to AVIF. Options looks like this:
|
||||
|
||||
```c++
|
||||
struct AvifOptions {
|
||||
// 0 = lossless
|
||||
// 63 = worst quality
|
||||
int minQuantizer;
|
||||
int maxQuantizer;
|
||||
|
||||
// [0 - 6]
|
||||
// Creates 2^n tiles in that dimension
|
||||
int tileRowsLog2;
|
||||
int tileColsLog2;
|
||||
|
||||
// 0 = slowest
|
||||
// 10 = fastest
|
||||
int speed;
|
||||
|
||||
// 0 = 4:2:0
|
||||
// 1 = 4:2:2
|
||||
// 2 = 4:4:4
|
||||
int subsample;
|
||||
};
|
||||
```
|
||||
146
codecs/avif/enc/avif_enc.cpp
Normal file
146
codecs/avif/enc/avif_enc.cpp
Normal file
@@ -0,0 +1,146 @@
|
||||
#include <emscripten/bind.h>
|
||||
#include <emscripten/threading.h>
|
||||
#include <emscripten/val.h>
|
||||
#include "avif/avif.h"
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
struct AvifOptions {
|
||||
// [0 - 63]
|
||||
// 0 = lossless
|
||||
// 63 = worst quality
|
||||
int cqLevel;
|
||||
// As above, but -1 means 'use cqLevel'
|
||||
int cqAlphaLevel;
|
||||
// [0 - 6]
|
||||
// Creates 2^n tiles in that dimension
|
||||
int tileRowsLog2;
|
||||
int tileColsLog2;
|
||||
// [0 - 10]
|
||||
// 0 = slowest
|
||||
// 10 = fastest
|
||||
int speed;
|
||||
// 0 = 4:0:0
|
||||
// 1 = 4:2:0
|
||||
// 2 = 4:2:2
|
||||
// 3 = 4:4:4
|
||||
int subsample;
|
||||
// Extra chroma compression
|
||||
bool chromaDeltaQ;
|
||||
// 0-7
|
||||
int sharpness;
|
||||
// 0 = auto
|
||||
// 1 = PSNR
|
||||
// 2 = SSIM
|
||||
int tune;
|
||||
// 0-50
|
||||
int denoiseLevel;
|
||||
};
|
||||
|
||||
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||
|
||||
val encode(std::string buffer, int width, int height, AvifOptions options) {
|
||||
avifRWData output = AVIF_DATA_EMPTY;
|
||||
int depth = 8;
|
||||
avifPixelFormat format;
|
||||
switch (options.subsample) {
|
||||
case 0:
|
||||
format = AVIF_PIXEL_FORMAT_YUV400;
|
||||
break;
|
||||
case 1:
|
||||
format = AVIF_PIXEL_FORMAT_YUV420;
|
||||
break;
|
||||
case 2:
|
||||
format = AVIF_PIXEL_FORMAT_YUV422;
|
||||
break;
|
||||
case 3:
|
||||
format = AVIF_PIXEL_FORMAT_YUV444;
|
||||
break;
|
||||
}
|
||||
|
||||
bool lossless = options.cqLevel == AVIF_QUANTIZER_LOSSLESS &&
|
||||
options.cqAlphaLevel <= AVIF_QUANTIZER_LOSSLESS &&
|
||||
format == AVIF_PIXEL_FORMAT_YUV444;
|
||||
|
||||
avifImage* image = avifImageCreate(width, height, depth, format);
|
||||
|
||||
if (lossless) {
|
||||
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_IDENTITY;
|
||||
} else {
|
||||
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_BT601;
|
||||
}
|
||||
|
||||
uint8_t* rgba = reinterpret_cast<uint8_t*>(const_cast<char*>(buffer.data()));
|
||||
|
||||
avifRGBImage srcRGB;
|
||||
avifRGBImageSetDefaults(&srcRGB, image);
|
||||
srcRGB.pixels = rgba;
|
||||
srcRGB.rowBytes = width * 4;
|
||||
avifImageRGBToYUV(image, &srcRGB);
|
||||
|
||||
avifEncoder* encoder = avifEncoderCreate();
|
||||
|
||||
if (lossless) {
|
||||
encoder->minQuantizer = AVIF_QUANTIZER_LOSSLESS;
|
||||
encoder->maxQuantizer = AVIF_QUANTIZER_LOSSLESS;
|
||||
encoder->minQuantizerAlpha = AVIF_QUANTIZER_LOSSLESS;
|
||||
encoder->maxQuantizerAlpha = AVIF_QUANTIZER_LOSSLESS;
|
||||
} else {
|
||||
encoder->minQuantizer = AVIF_QUANTIZER_BEST_QUALITY;
|
||||
encoder->maxQuantizer = AVIF_QUANTIZER_WORST_QUALITY;
|
||||
encoder->minQuantizerAlpha = AVIF_QUANTIZER_BEST_QUALITY;
|
||||
encoder->maxQuantizerAlpha = AVIF_QUANTIZER_WORST_QUALITY;
|
||||
avifEncoderSetCodecSpecificOption(encoder, "end-usage", "q");
|
||||
avifEncoderSetCodecSpecificOption(encoder, "cq-level", std::to_string(options.cqLevel).c_str());
|
||||
avifEncoderSetCodecSpecificOption(encoder, "sharpness",
|
||||
std::to_string(options.sharpness).c_str());
|
||||
|
||||
if (options.cqAlphaLevel != -1) {
|
||||
avifEncoderSetCodecSpecificOption(encoder, "alpha:cq-level",
|
||||
std::to_string(options.cqAlphaLevel).c_str());
|
||||
}
|
||||
|
||||
if (options.tune == 2 || (options.tune == 0 && options.cqLevel <= 32)) {
|
||||
avifEncoderSetCodecSpecificOption(encoder, "tune", "ssim");
|
||||
}
|
||||
|
||||
if (options.chromaDeltaQ) {
|
||||
avifEncoderSetCodecSpecificOption(encoder, "enable-chroma-deltaq", "1");
|
||||
}
|
||||
|
||||
avifEncoderSetCodecSpecificOption(encoder, "color:denoise-noise-level",
|
||||
std::to_string(options.denoiseLevel).c_str());
|
||||
}
|
||||
|
||||
encoder->maxThreads = emscripten_num_logical_cores();
|
||||
encoder->tileRowsLog2 = options.tileRowsLog2;
|
||||
encoder->tileColsLog2 = options.tileColsLog2;
|
||||
encoder->speed = options.speed;
|
||||
|
||||
avifResult encodeResult = avifEncoderWrite(encoder, image, &output);
|
||||
auto js_result = val::null();
|
||||
if (encodeResult == AVIF_RESULT_OK) {
|
||||
js_result = Uint8Array.new_(typed_memory_view(output.size, output.data));
|
||||
}
|
||||
|
||||
avifImageDestroy(image);
|
||||
avifEncoderDestroy(encoder);
|
||||
avifRWDataFree(&output);
|
||||
return js_result;
|
||||
}
|
||||
|
||||
EMSCRIPTEN_BINDINGS(my_module) {
|
||||
value_object<AvifOptions>("AvifOptions")
|
||||
.field("cqLevel", &AvifOptions::cqLevel)
|
||||
.field("cqAlphaLevel", &AvifOptions::cqAlphaLevel)
|
||||
.field("tileRowsLog2", &AvifOptions::tileRowsLog2)
|
||||
.field("tileColsLog2", &AvifOptions::tileColsLog2)
|
||||
.field("speed", &AvifOptions::speed)
|
||||
.field("chromaDeltaQ", &AvifOptions::chromaDeltaQ)
|
||||
.field("sharpness", &AvifOptions::sharpness)
|
||||
.field("tune", &AvifOptions::tune)
|
||||
.field("denoiseLevel", &AvifOptions::denoiseLevel)
|
||||
.field("subsample", &AvifOptions::subsample);
|
||||
|
||||
function("encode", &encode);
|
||||
}
|
||||
31
codecs/avif/enc/avif_enc.d.ts
vendored
Normal file
31
codecs/avif/enc/avif_enc.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
export const enum AVIFTune {
|
||||
auto,
|
||||
psnr,
|
||||
ssim,
|
||||
}
|
||||
|
||||
export interface EncodeOptions {
|
||||
cqLevel: number;
|
||||
denoiseLevel: number;
|
||||
cqAlphaLevel: number;
|
||||
tileRowsLog2: number;
|
||||
tileColsLog2: number;
|
||||
speed: number;
|
||||
subsample: number;
|
||||
chromaDeltaQ: boolean;
|
||||
sharpness: number;
|
||||
tune: AVIFTune;
|
||||
}
|
||||
|
||||
export interface AVIFModule extends EmscriptenWasm.Module {
|
||||
encode(
|
||||
data: BufferSource,
|
||||
width: number,
|
||||
height: number,
|
||||
options: EncodeOptions,
|
||||
): Uint8Array | null;
|
||||
}
|
||||
|
||||
declare var moduleFactory: EmscriptenWasm.ModuleFactory<AVIFModule>;
|
||||
|
||||
export default moduleFactory;
|
||||
63
codecs/avif/enc/avif_enc.js
generated
Normal file
63
codecs/avif/enc/avif_enc.js
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var e;e||(e=typeof Module !== 'undefined' ? Module : {});var aa,ba;e.ready=new Promise(function(a,b){aa=a;ba=b});var u={},v;for(v in e)e.hasOwnProperty(v)&&(u[v]=e[v]);var w="",da;w=self.location.href;_scriptDir&&(w=_scriptDir);0!==w.indexOf("blob:")?w=w.substr(0,w.lastIndexOf("/")+1):w="";da=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};var ea=e.print||console.log.bind(console),x=e.printErr||console.warn.bind(console);
|
||||
for(v in u)u.hasOwnProperty(v)&&(e[v]=u[v]);u=null;var fa=0,y;e.wasmBinary&&(y=e.wasmBinary);var noExitRuntime=e.noExitRuntime||!0;"object"!==typeof WebAssembly&&z("no native wasm support detected");var ha,ia=!1,ja=new TextDecoder("utf8");
|
||||
function ka(a,b,c){var d=B;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var la=new TextDecoder("utf-16le");
|
||||
function ma(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&C[c];)++c;return la.decode(B.subarray(a,c<<1))}function na(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)D[b>>1]=a.charCodeAt(f),b+=2;D[b>>1]=0;return b-d}function oa(a){return 2*a.length}function pa(a,b){for(var c=0,d="";!(c>=b/4);){var f=E[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
|
||||
function qa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023}E[b>>2]=g;b+=4;if(b+4>c)break}E[b>>2]=0;return b-d}function ra(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var sa,ta,B,D,C,E,F,ua,va;
|
||||
function wa(){var a=ha.buffer;sa=a;e.HEAP8=ta=new Int8Array(a);e.HEAP16=D=new Int16Array(a);e.HEAP32=E=new Int32Array(a);e.HEAPU8=B=new Uint8Array(a);e.HEAPU16=C=new Uint16Array(a);e.HEAPU32=F=new Uint32Array(a);e.HEAPF32=ua=new Float32Array(a);e.HEAPF64=va=new Float64Array(a)}var G,xa=[],ya=[],za=[];function Aa(){var a=e.preRun.shift();xa.unshift(a)}var H=0,Ba=null,J=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function z(a){if(e.onAbort)e.onAbort(a);x(a);ia=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}var K=(new URL("avif_enc.wasm",import.meta.url)).toString();function Ca(){try{if(K==K&&y)return new Uint8Array(y);if(da)return da(K);throw"both async and sync fetching of the wasm failed";}catch(a){z(a)}}
|
||||
function Da(){return y||"function"!==typeof fetch?Promise.resolve().then(function(){return Ca()}):fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Ca()})}function Ea(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.va;"number"===typeof c?void 0===b.ga?G.get(c)():G.get(c)(b.ga):c(void 0===b.ga?null:b.ga)}}}var Fa=[null,[],[]],Ga={},L={};
|
||||
function Ha(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function M(a){return this.fromWireType(F[a>>2])}var N={},O={},P={};function Ia(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ja(a,b){a=Ia(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function Ka(a){var b=Error,c=Ja(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var La=void 0;
|
||||
function Ma(a,b,c){function d(h){h=c(h);if(h.length!==a.length)throw new La("Mismatched type converter count");for(var n=0;n<a.length;++n)Q(a[n],h[n])}a.forEach(function(h){P[h]=b});var f=Array(b.length),g=[],k=0;b.forEach(function(h,n){O.hasOwnProperty(h)?f[n]=O[h]:(g.push(h),N.hasOwnProperty(h)||(N[h]=[]),N[h].push(function(){f[n]=O[h];++k;k===g.length&&d(f)}))});0===g.length&&d(f)}
|
||||
function Na(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Oa=void 0;function R(a){for(var b="";B[a];)b+=Oa[B[a++]];return b}var Pa=void 0;function S(a){throw new Pa(a);}
|
||||
function Q(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||S('type "'+d+'" must have a positive integer typeid pointer');if(O.hasOwnProperty(a)){if(c.oa)return;S("Cannot register type '"+d+"' twice")}O[a]=b;delete P[a];N.hasOwnProperty(a)&&(b=N[a],delete N[a],b.forEach(function(f){f()}))}var Qa=[],T=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Ra(a){4<a&&0===--T[a].ha&&(T[a]=void 0,Qa.push(a))}function Sa(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Qa.length?Qa.pop():T.length;T[b]={ha:1,value:a};return b}}function Ta(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Ua(a,b){switch(b){case 2:return function(c){return this.fromWireType(ua[c>>2])};case 3:return function(c){return this.fromWireType(va[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Va(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ja(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Wa(a,b){var c=e;if(void 0===c[a].ea){var d=c[a];c[a]=function(){c[a].ea.hasOwnProperty(arguments.length)||S("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].ea+")!");return c[a].ea[arguments.length].apply(this,arguments)};c[a].ea=[];c[a].ea[d.ja]=d}}
|
||||
function Xa(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].ea&&void 0!==e[a].ea[c])&&S("Cannot register public name '"+a+"' twice"),Wa(a,a),e.hasOwnProperty(c)&&S("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].ea[c]=b):(e[a]=b,void 0!==c&&(e[a].ya=c))}function Ya(a,b){for(var c=[],d=0;d<a;d++)c.push(E[(b>>2)+d]);return c}
|
||||
function Za(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=e["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=G.get(b).apply(null,c);return d}}function V(a,b){a=R(a);var c=a.includes("j")?Za(a,b):G.get(b);"function"!==typeof c&&S("unknown function pointer with signature "+a+": "+b);return c}var $a=void 0;function ab(a){a=bb(a);var b=R(a);W(a);return b}
|
||||
function cb(a,b){function c(g){f[g]||O[g]||(P[g]?P[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new $a(a+": "+d.map(ab).join([", "]));}function db(a,b,c){switch(b){case 0:return c?function(d){return ta[d]}:function(d){return B[d]};case 1:return c?function(d){return D[d>>1]}:function(d){return C[d>>1]};case 2:return c?function(d){return E[d>>2]}:function(d){return F[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var eb={};
|
||||
function fb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function gb(a,b){var c=O[a];void 0===c&&S(b+" has unknown type "+ab(a));return c}var hb={};La=e.InternalError=Ka("InternalError");for(var ib=Array(256),jb=0;256>jb;++jb)ib[jb]=String.fromCharCode(jb);Oa=ib;Pa=e.BindingError=Ka("BindingError");e.count_emval_handles=function(){for(var a=0,b=5;b<T.length;++b)void 0!==T[b]&&++a;return a};
|
||||
e.get_first_emval=function(){for(var a=5;a<T.length;++a)if(void 0!==T[a])return T[a];return null};$a=e.UnboundTypeError=Ka("UnboundTypeError");
|
||||
var ub={O:function(){},s:function(){return 0},G:function(){return 0},H:function(){},x:function(a){var b=L[a];delete L[a];var c=b.pa,d=b.qa,f=b.ia,g=f.map(function(k){return k.na}).concat(f.map(function(k){return k.sa}));Ma([a],g,function(k){var h={};f.forEach(function(n,l){var m=k[l],p=n.la,r=n.ma,t=k[l+f.length],q=n.ra,ca=n.ta;h[n.ka]={read:function(A){return m.fromWireType(p(r,A))},write:function(A,I){var U=[];q(ca,A,t.toWireType(U,I));Ha(U)}}});return[{name:b.name,fromWireType:function(n){var l=
|
||||
{},m;for(m in h)l[m]=h[m].read(n);d(n);return l},toWireType:function(n,l){for(var m in h)if(!(m in l))throw new TypeError('Missing field: "'+m+'"');var p=c();for(m in h)h[m].write(p,l[m]);null!==n&&n.push(d,p);return p},argPackAdvance:8,readValueFromPointer:M,fa:d}]})},B:function(){},K:function(a,b,c,d,f){var g=Na(c);b=R(b);Q(a,{name:b,fromWireType:function(k){return!!k},toWireType:function(k,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(k){if(1===c)var h=ta;else if(2===c)h=D;else if(4===
|
||||
c)h=E;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[k>>g])},fa:null})},J:function(a,b){b=R(b);Q(a,{name:b,fromWireType:function(c){var d=T[c].value;Ra(c);return d},toWireType:function(c,d){return Sa(d)},argPackAdvance:8,readValueFromPointer:M,fa:null})},t:function(a,b,c){c=Na(c);b=R(b);Q(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Ta(f)+'" to '+this.name);
|
||||
return f},argPackAdvance:8,readValueFromPointer:Ua(b,c),fa:null})},w:function(a,b,c,d,f,g){var k=Ya(b,c);a=R(a);f=V(d,f);Xa(a,function(){cb("Cannot call "+a+" due to unbound types",k)},b-1);Ma([],k,function(h){var n=a,l=a;h=[h[0],null].concat(h.slice(1));var m=f,p=h.length;2>p&&S("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var r=null!==h[1]&&!1,t=!1,q=1;q<h.length;++q)if(null!==h[q]&&void 0===h[q].fa){t=!0;break}var ca="void"!==h[0].name,A="",I="";for(q=0;q<
|
||||
p-2;++q)A+=(0!==q?", ":"")+"arg"+q,I+=(0!==q?", ":"")+"arg"+q+"Wired";l="return function "+Ia(l)+"("+A+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+l+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";t&&(l+="var destructors = [];\n");var U=t?"destructors":"null";A="throwBindingError invoker fn runDestructors retType classParam".split(" ");m=[S,m,g,Ha,h[0],h[1]];r&&(l+="var thisWired = classParam.toWireType("+U+", this);\n");for(q=0;q<
|
||||
p-2;++q)l+="var arg"+q+"Wired = argType"+q+".toWireType("+U+", arg"+q+"); // "+h[q+2].name+"\n",A.push("argType"+q),m.push(h[q+2]);r&&(I="thisWired"+(0<I.length?", ":"")+I);l+=(ca?"var rv = ":"")+"invoker(fn"+(0<I.length?", ":"")+I+");\n";if(t)l+="runDestructors(destructors);\n";else for(q=r?1:2;q<h.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==h[q].fa&&(l+=p+"_dtor("+p+"); // "+h[q].name+"\n",A.push(p+"_dtor"),m.push(h[q].fa));ca&&(l+="var ret = retType.fromWireType(rv);\nreturn ret;\n");
|
||||
A.push(l+"}\n");h=Va(A).apply(null,m);q=b-1;if(!e.hasOwnProperty(n))throw new La("Replacing nonexistant public symbol");void 0!==e[n].ea&&void 0!==q?e[n].ea[q]=h:(e[n]=h,e[n].ja=q);return[]})},i:function(a,b,c,d,f){function g(l){return l}b=R(b);-1===f&&(f=4294967295);var k=Na(c);if(0===d){var h=32-8*c;g=function(l){return l<<h>>>h}}var n=b.includes("unsigned");Q(a,{name:b,fromWireType:g,toWireType:function(l,m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+Ta(m)+
|
||||
'" to '+this.name);if(m<d||m>f)throw new TypeError('Passing a number "'+Ta(m)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return n?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:db(b,k,0!==d),fa:null})},e:function(a,b,c){function d(g){g>>=2;var k=F;return new f(sa,k[g+1],k[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=R(c);Q(a,{name:c,fromWireType:d,argPackAdvance:8,
|
||||
readValueFromPointer:d},{oa:!0})},u:function(a,b){b=R(b);var c="std::string"===b;Q(a,{name:b,fromWireType:function(d){var f=F[d>>2];if(c)for(var g=d+4,k=0;k<=f;++k){var h=d+4+k;if(k==f||0==B[h]){if(g){for(var n=g+(h-g),l=g;!(l>=n)&&B[l];)++l;g=ja.decode(B.subarray(g,l))}else g="";if(void 0===m)var m=g;else m+=String.fromCharCode(0),m+=g;g=h+1}}else{m=Array(f);for(k=0;k<f;++k)m[k]=String.fromCharCode(B[d+4+k]);m=m.join("")}W(d);return m},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));
|
||||
var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||S("Cannot pass non-string to std::string");var k=(c&&g?function(){for(var l=0,m=0;m<f.length;++m){var p=f.charCodeAt(m);55296<=p&&57343>=p&&(p=65536+((p&1023)<<10)|f.charCodeAt(++m)&1023);127>=p?++l:l=2047>=p?l+2:65535>=p?l+3:l+4}return l}:function(){return f.length})(),h=kb(4+k+1);F[h>>2]=k;if(c&&g)ka(f,h+4,k+1);else if(g)for(g=0;g<k;++g){var n=f.charCodeAt(g);255<n&&(W(h),S("String has UTF-16 code units that do not fit in 8 bits"));
|
||||
B[h+4+g]=n}else for(g=0;g<k;++g)B[h+4+g]=f[g];null!==d&&d.push(W,h);return h},argPackAdvance:8,readValueFromPointer:M,fa:function(d){W(d)}})},o:function(a,b,c){c=R(c);if(2===b){var d=ma;var f=na;var g=oa;var k=function(){return C};var h=1}else 4===b&&(d=pa,f=qa,g=ra,k=function(){return F},h=2);Q(a,{name:c,fromWireType:function(n){for(var l=F[n>>2],m=k(),p,r=n+4,t=0;t<=l;++t){var q=n+4+t*b;if(t==l||0==m[q>>h])r=d(r,q-r),void 0===p?p=r:(p+=String.fromCharCode(0),p+=r),r=q+b}W(n);return p},toWireType:function(n,
|
||||
l){"string"!==typeof l&&S("Cannot pass non-string to C++ string type "+c);var m=g(l),p=kb(4+m+b);F[p>>2]=m>>h;f(l,p+4,m+b);null!==n&&n.push(W,p);return p},argPackAdvance:8,readValueFromPointer:M,fa:function(n){W(n)}})},z:function(a,b,c,d,f,g){L[a]={name:R(b),pa:V(c,d),qa:V(f,g),ia:[]}},g:function(a,b,c,d,f,g,k,h,n,l){L[a].ia.push({ka:R(b),na:c,la:V(d,f),ma:g,sa:k,ra:V(h,n),ta:l})},L:function(a,b){b=R(b);Q(a,{xa:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},j:Ra,N:function(a){if(0===
|
||||
a)return Sa(fb());var b=eb[a];a=void 0===b?R(a):b;return Sa(fb()[a])},v:function(a){4<a&&(T[a].ha+=1)},D:function(a,b,c,d){a||S("Cannot use deleted val. handle = "+a);a=T[a].value;var f=hb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var k="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)k+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+
|
||||
g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",k+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(gb,e,Sa);hb[b]=f}return f(a,c,d)},f:function(){z()},d:function(a,b){X(a,b||1);throw"longjmp";},E:function(a,b,c){B.copyWithin(a,b,b+c)},n:function(a){var b=B.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{ha.grow(Math.min(2147483648,
|
||||
d)-sa.byteLength+65535>>>16);wa();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},r:function(){return 0},F:function(a,b,c,d){a=Ga.wa(a);b=Ga.ua(a,b,c);E[d>>2]=b;return 0},A:function(){},I:function(a,b,c,d){for(var f=0,g=0;g<c;g++){for(var k=E[b+8*g>>2],h=E[b+(8*g+4)>>2],n=0;n<h;n++){var l=B[k+n],m=Fa[a];if(0===l||10===l){for(l=0;m[l]&&!(NaN<=l);)++l;l=ja.decode(m.subarray?m.subarray(0,l):new Uint8Array(m.slice(0,l)));(1===a?ea:x)(l);m.length=0}else m.push(l)}f+=h}E[d>>2]=f;return 0},b:function(){return fa},
|
||||
l:lb,p:mb,q:nb,C:ob,y:pb,m:qb,h:rb,c:sb,k:tb,a:function(a){fa=a},M:function(a){var b=Date.now()/1E3|0;a&&(E[a>>2]=b);return b}};
|
||||
(function(){function a(f){e.asm=f.exports;ha=e.asm.P;wa();G=e.asm.Y;ya.unshift(e.asm.Q);H--;e.monitorRunDependencies&&e.monitorRunDependencies(H);0==H&&(null!==Ba&&(clearInterval(Ba),Ba=null),J&&(f=J,J=null,f()))}function b(f){a(f.instance)}function c(f){return Da().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){x("failed to asynchronously prepare wasm: "+g);z(g)})}var d={a:ub};H++;e.monitorRunDependencies&&e.monitorRunDependencies(H);if(e.instantiateWasm)try{return e.instantiateWasm(d,
|
||||
a)}catch(f){return x("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return y||"function"!==typeof WebAssembly.instantiateStreaming||K.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(K,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){x("wasm streaming compile failed: "+g);x("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();
|
||||
e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.Q).apply(null,arguments)};var kb=e._malloc=function(){return(kb=e._malloc=e.asm.R).apply(null,arguments)},W=e._free=function(){return(W=e._free=e.asm.S).apply(null,arguments)},bb=e.___getTypeName=function(){return(bb=e.___getTypeName=e.asm.T).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.U).apply(null,arguments)};
|
||||
var Y=e.stackSave=function(){return(Y=e.stackSave=e.asm.V).apply(null,arguments)},Z=e.stackRestore=function(){return(Z=e.stackRestore=e.asm.W).apply(null,arguments)},X=e._setThrew=function(){return(X=e._setThrew=e.asm.X).apply(null,arguments)};e.dynCall_jiiiiiiiii=function(){return(e.dynCall_jiiiiiiiii=e.asm.Z).apply(null,arguments)};var vb=e.dynCall_ijiii=function(){return(vb=e.dynCall_ijiii=e.asm._).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.$).apply(null,arguments)};
|
||||
e.dynCall_jiiiiiiii=function(){return(e.dynCall_jiiiiiiii=e.asm.aa).apply(null,arguments)};e.dynCall_jiiiiii=function(){return(e.dynCall_jiiiiii=e.asm.ba).apply(null,arguments)};e.dynCall_jiiiii=function(){return(e.dynCall_jiiiii=e.asm.ca).apply(null,arguments)};e.dynCall_iiijii=function(){return(e.dynCall_iiijii=e.asm.da).apply(null,arguments)};function qb(a,b){var c=Y();try{G.get(a)(b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}
|
||||
function sb(a,b,c,d,f){var g=Y();try{G.get(a)(b,c,d,f)}catch(k){Z(g);if(k!==k+0&&"longjmp"!==k)throw k;X(1,0)}}function rb(a,b,c){var d=Y();try{G.get(a)(b,c)}catch(f){Z(d);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}function nb(a,b,c,d,f,g,k,h,n,l){var m=Y();try{return G.get(a)(b,c,d,f,g,k,h,n,l)}catch(p){Z(m);if(p!==p+0&&"longjmp"!==p)throw p;X(1,0)}}function ob(a,b,c,d,f,g,k,h,n,l,m,p){var r=Y();try{return G.get(a)(b,c,d,f,g,k,h,n,l,m,p)}catch(t){Z(r);if(t!==t+0&&"longjmp"!==t)throw t;X(1,0)}}
|
||||
function lb(a,b,c,d,f){var g=Y();try{return G.get(a)(b,c,d,f)}catch(k){Z(g);if(k!==k+0&&"longjmp"!==k)throw k;X(1,0)}}function tb(a,b,c,d,f,g,k,h,n,l,m){var p=Y();try{G.get(a)(b,c,d,f,g,k,h,n,l,m)}catch(r){Z(p);if(r!==r+0&&"longjmp"!==r)throw r;X(1,0)}}function mb(a,b,c,d,f,g,k,h,n){var l=Y();try{return G.get(a)(b,c,d,f,g,k,h,n)}catch(m){Z(l);if(m!==m+0&&"longjmp"!==m)throw m;X(1,0)}}
|
||||
function pb(a,b,c,d,f,g){var k=Y();try{return vb(a,b,c,d,f,g)}catch(h){Z(k);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}var wb;J=function xb(){wb||yb();wb||(J=xb)};
|
||||
function yb(){function a(){if(!wb&&(wb=!0,e.calledRun=!0,!ia)){Ea(ya);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();za.unshift(b)}Ea(za)}}if(!(0<H)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)Aa();Ea(xa);0<H||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=yb;
|
||||
if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();yb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/avif/enc/avif_enc.wasm
Executable file
BIN
codecs/avif/enc/avif_enc.wasm
Executable file
Binary file not shown.
1
codecs/avif/enc/avif_enc_mt.d.ts
vendored
Normal file
1
codecs/avif/enc/avif_enc_mt.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './avif_enc';
|
||||
96
codecs/avif/enc/avif_enc_mt.js
generated
Normal file
96
codecs/avif/enc/avif_enc_mt.js
generated
Normal file
@@ -0,0 +1,96 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
function aa(){e.buffer!=l&&n(e.buffer);return ba}function r(){e.buffer!=l&&n(e.buffer);return ca}function u(){e.buffer!=l&&n(e.buffer);return da}function fa(){e.buffer!=l&&n(e.buffer);return ha}function w(){e.buffer!=l&&n(e.buffer);return ia}function x(){e.buffer!=l&&n(e.buffer);return ja}function ka(){e.buffer!=l&&n(e.buffer);return la}var y;y||(y=typeof Module !== 'undefined' ? Module : {});var ma,na;y.ready=new Promise(function(a,b){ma=a;na=b});var oa={},A;
|
||||
for(A in y)y.hasOwnProperty(A)&&(oa[A]=y[A]);function qa(a,b){throw b;}var B=y.ENVIRONMENT_IS_PTHREAD||!1,D="",ra;D=self.location.href;_scriptDir&&(D=_scriptDir);0!==D.indexOf("blob:")?D=D.substr(0,D.lastIndexOf("/")+1):D="";ra=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};var sa=y.print||console.log.bind(console),E=y.printErr||console.warn.bind(console);for(A in oa)oa.hasOwnProperty(A)&&(y[A]=oa[A]);oa=null;
|
||||
y.quit&&(qa=y.quit);var ta=0,ua;y.wasmBinary&&(ua=y.wasmBinary);var noExitRuntime=y.noExitRuntime||!0;"object"!==typeof WebAssembly&&F("no native wasm support detected");var e,va,wa=!1;
|
||||
function xa(a,b,c){c=b+c;for(var d="";!(b>=c);){var f=a[b++];if(!f)break;if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var h=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|h:(f&7)<<18|g<<12|h<<6|a[b++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function G(a,b){return a?xa(r(),a,b):""}
|
||||
function ya(a,b,c){var d=r();if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}
|
||||
function za(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function Aa(a,b){for(var c="",d=0;!(d>=b/2);++d){var f=u()[a+2*d>>1];if(0==f)break;c+=String.fromCharCode(f)}return c}function Ba(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f){var g=a.charCodeAt(f);u()[b>>1]=g;b+=2}u()[b>>1]=0;return b-d}
|
||||
function Ca(a){return 2*a.length}function Da(a,b){for(var c=0,d="";!(c>=b/4);){var f=w()[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}function Ea(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var h=a.charCodeAt(++f);g=65536+((g&1023)<<10)|h&1023}w()[b>>2]=g;b+=4;if(b+4>c)break}w()[b>>2]=0;return b-d}
|
||||
function Fa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var l,ba,ca,da,ha,ia,ja,Ga,la;B&&(l=y.buffer);function n(a){l=a;y.HEAP8=ba=new Int8Array(a);y.HEAP16=da=new Int16Array(a);y.HEAP32=ia=new Int32Array(a);y.HEAPU8=ca=new Uint8Array(a);y.HEAPU16=ha=new Uint16Array(a);y.HEAPU32=ja=new Uint32Array(a);y.HEAPF32=Ga=new Float32Array(a);y.HEAPF64=la=new Float64Array(a)}var Ha=y.INITIAL_MEMORY||16777216;
|
||||
if(B)e=y.wasmMemory,l=y.buffer;else if(y.wasmMemory)e=y.wasmMemory;else if(e=new WebAssembly.Memory({initial:Ha/65536,maximum:32768,shared:!0}),!(e.buffer instanceof SharedArrayBuffer))throw E("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),Error("bad memory");e&&(l=e.buffer);Ha=l.byteLength;n(l);var H,Ia=[],Ja=[],Ka=[];
|
||||
function La(){var a=y.preRun.shift();Ia.unshift(a)}var I=0,Ma=null,Na=null;y.preloadedImages={};y.preloadedAudios={};function F(a){if(y.onAbort)y.onAbort(a);B&&console.error("Pthread aborting at "+Error().stack);E(a);wa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");na(a);throw a;}var K=(new URL("avif_enc_mt.wasm",import.meta.url)).toString();
|
||||
function Oa(){try{if(K==K&&ua)return new Uint8Array(ua);if(ra)return ra(K);throw"both async and sync fetching of the wasm failed";}catch(a){F(a)}}function Pa(){return ua||"function"!==typeof fetch?Promise.resolve().then(function(){return Oa()}):fetch(K,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+K+"'";return a.arrayBuffer()}).catch(function(){return Oa()})}
|
||||
var Ra={601124:function(){throw"Canceled!";},601142:function(a,b){setTimeout(function(){Qa(a,b)},0)}};function Sa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(y);else{var c=b.Wb;"number"===typeof c?void 0===b.Ua?H.get(c)():H.get(c)(b.Ua):c(void 0===b.Ua?null:b.Ua)}}}
|
||||
function Ta(a,b){if(0>=a||a>aa().length||a&1||0>b)return-28;if(0==b)return 0;2147483647<=b&&(b=Infinity);var c=Atomics.load(w(),Ua>>2),d=0;if(c==a&&Atomics.compareExchange(w(),Ua>>2,c,0)==c&&(--b,d=1,0>=b))return 1;a=Atomics.notify(w(),a>>2,b);if(0<=a)return a+d;throw"Atomics.notify returned an unexpected value "+a;}y._emscripten_futex_wake=Ta;
|
||||
function Va(a){if(B)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!a)throw"Internal Error! Null pthread_ptr in cleanupThread!";var b=L.Oa[a];b&&(w()[a+12>>2]=0,L.$a(b.worker))}
|
||||
var L={Ma:[],Ra:[],fb:[],yb:function(){for(var a=navigator.hardwareConcurrency,b=0;b<a;++b)L.gb()},zb:function(){for(var a=M(228),b=0;57>b;++b)x()[a/4+b]=0;w()[a+12>>2]=a;b=a+152;w()[b>>2]=b;var c=M(512);for(b=0;128>b;++b)x()[c/4+b]=0;Atomics.store(x(),a+100>>2,c);Atomics.store(x(),a+40>>2,a);Wa(a,!1,1);Xa(a)},Ab:function(){L.receiveObjectTransfer=L.Eb;L.threadInit=L.Pb;L.threadCancel=L.Nb;L.threadExit=L.Ob;L.setExitStatus=L.Hb},Oa:{},ab:[],Fb:function(){for(;0<L.ab.length;)L.ab.pop()();B&&N()&&Ya()},
|
||||
nb:function(a,b){Atomics.store(x(),a+56>>2,1);Atomics.store(x(),a+60>>2,0);L.Fb();Atomics.store(x(),a+4>>2,b);Atomics.store(x(),a+0>>2,1);Ta(a+0,2147483647);Wa(0,0,0)},Hb:function(){},Ob:function(a){var b=N();b&&(L.nb(b,a),B&&postMessage({cmd:"exit"}))},Nb:function(){L.nb(N(),-1);postMessage({cmd:"cancelDone"})},Mb:function(){for(var a in L.Oa){var b=L.Oa[a];b&&b.worker&&L.$a(b.worker)}L.Oa={};for(a=0;a<L.Ma.length;++a){var c=L.Ma[a];c.terminate()}L.Ma=[];for(a=0;a<L.Ra.length;++a)c=L.Ra[a],b=c.La,
|
||||
L.cb(b),c.terminate();L.Ra=[]},cb:function(a){if(a){if(a.Pa){var b=w()[a.Pa+100>>2];w()[a.Pa+100>>2]=0;O(b);O(a.Pa)}a.Pa=0;a.bb&&a.Sa&&O(a.Sa);a.Sa=0;a.worker&&(a.worker.La=null)}},$a:function(a){L.Gb(function(){delete L.Oa[a.La.Pa];L.Ma.push(a);L.Ra.splice(L.Ra.indexOf(a),1);L.cb(a.La);a.La=void 0})},Gb:function(a){w()[Za>>2]=0;try{a()}finally{w()[Za>>2]=1}},Eb:function(){},Pb:function(){for(var a in L.fb)L.fb[a]()},lb:function(a,b){a.onmessage=function(c){var d=c.data,f=d.cmd;a.La&&(L.pb=a.La.Pa);
|
||||
if(d.targetThread&&d.targetThread!=N()){var g=L.Oa[d.ec];g?g.worker.postMessage(c.data,d.transferList):console.error('Internal error! Worker sent a message "'+f+'" to target pthread '+d.targetThread+", but that thread no longer exists!")}else if("processQueuedMainThreadWork"===f)$a();else if("spawnThread"===f)ab(c.data);else if("cleanupThread"===f)Va(d.thread);else if("killThread"===f){c=d.thread;if(B)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in killThread!";
|
||||
w()[c+12>>2]=0;c=L.Oa[c];c.worker.terminate();L.cb(c);L.Ra.splice(L.Ra.indexOf(c.worker),1);c.worker.La=void 0}else if("cancelThread"===f){c=d.thread;if(B)throw"Internal Error! cancelThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in cancelThread!";L.Oa[c].worker.postMessage({cmd:"cancel"})}else if("loaded"===f)a.loaded=!0,b&&b(a),a.Va&&(a.Va(),delete a.Va);else if("print"===f)sa("Thread "+d.threadId+": "+d.text);else if("printErr"===f)E("Thread "+
|
||||
d.threadId+": "+d.text);else if("alert"===f)alert("Thread "+d.threadId+": "+d.text);else if("exit"===f)a.La&&Atomics.load(x(),a.La.Pa+64>>2)&&L.$a(a);else if("exitProcess"===f)try{g=d.returnCode;if(B)throw postMessage({cmd:"exitProcess",returnCode:g}),new bb(g);if(!cb()){L.Mb();if(y.onExit)y.onExit(g);wa=!0}qa(g,new bb(g))}catch(h){if(h instanceof bb)return;throw h;}else"cancelDone"===f?L.$a(a):"objectTransfer"!==f&&("setimmediate"===c.data.target?a.postMessage(c.data):E("worker sent an unknown command "+
|
||||
f));L.pb=void 0};a.onerror=function(c){E("pthread sent an error! "+c.filename+":"+c.lineno+": "+c.message)};a.postMessage({cmd:"load",urlOrBlob:y.mainScriptUrlOrBlob,wasmMemory:e,wasmModule:va})},gb:function(){if(y.locateFile){var a=y.locateFile?y.locateFile("avif_enc_mt.worker.js",D):D+"avif_enc_mt.worker.js";L.Ma.push(new Worker(a))}else L.Ma.push(new Worker(new URL("avif_enc_mt.worker.js",import.meta.url)))},sb:function(){0==L.Ma.length&&(L.gb(),L.lb(L.Ma[0]));return L.Ma.pop()},Rb:function(a){for(a=
|
||||
performance.now()+a;performance.now()<a;);}};y.establishStackSpace=function(a,b){db(a,b);P(a)};y.invokeEntryPoint=function(a,b){return H.get(a)(b)};var eb=0;function cb(){return noExitRuntime||0<eb}y.keepRuntimeAlive=cb;var fb;fb=B?function(){return performance.now()-y.__performance_now_clock_drift}:function(){return performance.now()};function gb(a,b){L.ab.push(function(){H.get(a)(b)})}var hb=[null,[],[]],ib={};function jb(a,b,c){return B?Q(1,1,a,b,c):0}
|
||||
function kb(a,b,c){return B?Q(2,1,a,b,c):0}function lb(a,b,c){if(B)return Q(3,1,a,b,c)}var mb={};function nb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function ob(a){return this.fromWireType(x()[a>>2])}var R={},T={},pb={};function qb(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||
function rb(a,b){a=qb(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function sb(a){var b=Error,c=rb(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||
var tb=void 0;function ub(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new tb("Mismatched type converter count");for(var m=0;m<a.length;++m)U(a[m],k[m])}a.forEach(function(k){pb[k]=b});var f=Array(b.length),g=[],h=0;b.forEach(function(k,m){T.hasOwnProperty(k)?f[m]=T[k]:(g.push(k),R.hasOwnProperty(k)||(R[k]=[]),R[k].push(function(){f[m]=T[k];++h;h===g.length&&d(f)}))});0===g.length&&d(f)}
|
||||
function vb(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var wb=void 0;function V(a){for(var b="";r()[a];)b+=wb[r()[a++]];return b}var xb=void 0;function W(a){throw new xb(a);}
|
||||
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||W('type "'+d+'" must have a positive integer typeid pointer');if(T.hasOwnProperty(a)){if(c.wb)return;W("Cannot register type '"+d+"' twice")}T[a]=b;delete pb[a];R.hasOwnProperty(a)&&(b=R[a],delete R[a],b.forEach(function(f){f()}))}var yb=[],X=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function zb(a){4<a&&0===--X[a].eb&&(X[a]=void 0,yb.push(a))}function Ab(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=yb.length?yb.pop():X.length;X[b]={eb:1,value:a};return b}}function Bb(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Cb(a,b){switch(b){case 2:return function(c){var d=this.fromWireType;e.buffer!=l&&n(e.buffer);return d.call(this,Ga[c>>2])};case 3:return function(c){return this.fromWireType(ka()[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}
|
||||
function Db(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=rb(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Eb(a,b){var c=y;if(void 0===c[a].Na){var d=c[a];c[a]=function(){c[a].Na.hasOwnProperty(arguments.length)||W("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Na+")!");return c[a].Na[arguments.length].apply(this,arguments)};c[a].Na=[];c[a].Na[d.ob]=d}}
|
||||
function Fb(a,b,c){y.hasOwnProperty(a)?((void 0===c||void 0!==y[a].Na&&void 0!==y[a].Na[c])&&W("Cannot register public name '"+a+"' twice"),Eb(a,a),y.hasOwnProperty(c)&&W("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),y[a].Na[c]=b):(y[a]=b,void 0!==c&&(y[a].bc=c))}function Gb(a,b){for(var c=[],d=0;d<a;d++)c.push(w()[(b>>2)+d]);return c}
|
||||
function Hb(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=y["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=H.get(b).apply(null,c);return d}}function Ib(a,b){a=V(a);var c=a.includes("j")?Hb(a,b):H.get(b);"function"!==typeof c&&W("unknown function pointer with signature "+a+": "+b);return c}var Jb=void 0;function Kb(a){a=Lb(a);var b=V(a);O(a);return b}
|
||||
function Mb(a,b){function c(g){f[g]||T[g]||(pb[g]?pb[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Jb(a+": "+d.map(Kb).join([", "]));}function Nb(a,b,c){switch(b){case 0:return c?function(d){return aa()[d]}:function(d){return r()[d]};case 1:return c?function(d){return u()[d>>1]}:function(d){return fa()[d>>1]};case 2:return c?function(d){return w()[d>>2]}:function(d){return x()[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var Ob={};
|
||||
function Pb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function Qb(a,b){var c=T[a];void 0===c&&W(b+" has unknown type "+Kb(a));return c}var Rb={},Sb=[];function Tb(a,b,c){if(0>=a||a>aa().length||a&1)return-28;a=Atomics.wait(w(),a>>2,b,c);if("timed-out"===a)return-73;if("not-equal"===a)return-6;if("ok"===a)return 0;throw"Atomics.wait returned an unexpected value "+a;}
|
||||
function Q(a,b){for(var c=arguments.length-2,d=Y(),f=Ub(8*c),g=f>>3,h=0;h<c;h++){var k=arguments[2+h];ka()[g+h]=k}c=Vb(a,c,f,b);P(d);return c}var Wb=[],Xb=[0,"undefined"!==typeof document?document:0,"undefined"!==typeof window?window:0];function Yb(a){a=2<a?G(a):a;return Xb[a]||("undefined"!==typeof document?document.querySelector(a):void 0)}
|
||||
function Zb(a,b,c){var d=Yb(a);if(!d)return-4;d.Ya&&(w()[d.Ya>>2]=b,w()[d.Ya+4>>2]=c);if(d.mb||!d.Tb)d.mb&&(d=d.mb),a=!1,d.Xa&&d.Xa.Wa&&(a=d.Xa.Wa.getParameter(2978),a=0===a[0]&&0===a[1]&&a[2]===d.width&&a[3]===d.height),d.width=b,d.height=c,a&&d.Xa.Wa.viewport(0,0,b,c);else{if(d.Ya){d=w()[d.Ya+8>>2];a=a?G(a):"";var f=Y(),g=Ub(12),h=0;if(a){h=za(a)+1;var k=M(h);ya(a,k,h);h=k}w()[g>>2]=h;w()[g+4>>2]=b;w()[g+8>>2]=c;$b(0,d,657457152,0,h,g);P(f);return 1}return-4}return 0}
|
||||
function ac(a,b,c){return B?Q(4,1,a,b,c):Zb(a,b,c)}function bc(a){var b=a.getExtension("ANGLE_instanced_arrays");b&&(a.vertexAttribDivisor=function(c,d){b.vertexAttribDivisorANGLE(c,d)},a.drawArraysInstanced=function(c,d,f,g){b.drawArraysInstancedANGLE(c,d,f,g)},a.drawElementsInstanced=function(c,d,f,g,h){b.drawElementsInstancedANGLE(c,d,f,g,h)})}
|
||||
function cc(a){var b=a.getExtension("OES_vertex_array_object");b&&(a.createVertexArray=function(){return b.createVertexArrayOES()},a.deleteVertexArray=function(c){b.deleteVertexArrayOES(c)},a.bindVertexArray=function(c){b.bindVertexArrayOES(c)},a.isVertexArray=function(c){return b.isVertexArrayOES(c)})}function dc(a){var b=a.getExtension("WEBGL_draw_buffers");b&&(a.drawBuffers=function(c,d){b.drawBuffersWEBGL(c,d)})}
|
||||
function ec(a,b){a.kb||(a.kb=a.getContext,a.getContext=function(d,f){f=a.kb(d,f);return"webgl"==d==f instanceof WebGLRenderingContext?f:null});var c=a.getContext("webgl",b);return c?fc(c,b):0}function fc(a,b){var c=M(8);w()[c+4>>2]=N();var d={Yb:c,attributes:b,version:b.Bb,Wa:a};a.canvas&&(a.canvas.Xa=d);("undefined"===typeof b.ib||b.ib)&&gc(d);return c}
|
||||
function gc(a){a||(a=hc);if(!a.xb){a.xb=!0;var b=a.Wa;bc(b);cc(b);dc(b);b.Ub=b.getExtension("EXT_disjoint_timer_query");b.ac=b.getExtension("WEBGL_multi_draw");(b.getSupportedExtensions()||[]).forEach(function(c){c.includes("lose_context")||c.includes("debug")||b.getExtension(c)})}}var hc,ic=["default","low-power","high-performance"];function jc(a){return B?Q(5,1,a):0}function kc(a,b,c,d){if(B)return Q(6,1,a,b,c,d);a=ib.Xb(a);b=ib.Vb(a,b,c);w()[d>>2]=b;return 0}
|
||||
function lc(a,b,c,d,f){if(B)return Q(7,1,a,b,c,d,f)}function mc(a,b,c,d){if(B)return Q(8,1,a,b,c,d);for(var f=0,g=0;g<c;g++){for(var h=w()[b+8*g>>2],k=w()[b+(8*g+4)>>2],m=0;m<k;m++){var p=r()[h+m],q=hb[a];0===p||10===p?((1===a?sa:E)(xa(q,0)),q.length=0):q.push(p)}f+=k}w()[d>>2]=f;return 0}
|
||||
function ab(a){if(B)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var b=L.sb();if(!b)return 6;if(void 0!==b.La)throw"Internal error!";if(!a.Za)throw"Internal error, no pthread ptr!";L.Ra.push(b);for(var c=M(512),d=0;128>d;++d)w()[c+4*d>>2]=0;var f=a.Sa+a.Ta;d=L.Oa[a.Za]={worker:b,Sa:a.Sa,Ta:a.Ta,bb:a.bb,Pa:a.Za};var g=d.Pa>>2;Atomics.store(x(),g+16,a.hb);Atomics.store(x(),g+25,c);Atomics.store(x(),g+10,d.Pa);Atomics.store(x(),g+20,a.Ta);Atomics.store(x(),
|
||||
g+19,f);Atomics.store(x(),g+26,a.Ta);Atomics.store(x(),g+28,f);Atomics.store(x(),g+29,a.hb);c=nc()+40;Atomics.store(x(),g+43,c);b.La=d;var h={cmd:"run",start_routine:a.Lb,arg:a.Ua,threadInfoStruct:a.Za,stackBase:a.Sa,stackSize:a.Ta};b.Va=function(){h.time=performance.now();b.postMessage(h,a.Qb)};b.loaded&&(b.Va(),delete b.Va);return 0}
|
||||
function oc(a,b){if(!a)return E("pthread_join attempted on a null thread pointer!"),71;if(B&&N()==a)return E("PThread "+a+" is attempting to join to itself!"),16;if(!B&&pc()==a)return E("Main thread "+a+" is attempting to join to itself!"),16;if(w()[a+12>>2]!==a)return E("pthread_join attempted on thread "+a+", which does not point to a valid thread, or does not exist anymore!"),71;if(Atomics.load(x(),a+64>>2))return E("Attempted to join thread "+a+", which was already detached!"),28;for(;;){var c=
|
||||
Atomics.load(x(),a+0>>2);if(1==c)return c=Atomics.load(x(),a+4>>2),b&&(w()[b>>2]=c),Atomics.store(x(),a+64>>2,1),B?postMessage({cmd:"cleanupThread",thread:a}):Va(a),0;if(B){var d=N();if(d&&!Atomics.load(x(),d+56>>2)&&2==Atomics.load(x(),d+0>>2))throw"Canceled!";}B||$a();Tb(a+0,c,B?100:1)}}B||L.yb();tb=y.InternalError=sb("InternalError");for(var qc=Array(256),rc=0;256>rc;++rc)qc[rc]=String.fromCharCode(rc);wb=qc;xb=y.BindingError=sb("BindingError");
|
||||
y.count_emval_handles=function(){for(var a=0,b=5;b<X.length;++b)void 0!==X[b]&&++a;return a};y.get_first_emval=function(){for(var a=5;a<X.length;++a)if(void 0!==X[a])return X[a];return null};Jb=y.UnboundTypeError=sb("UnboundTypeError");
|
||||
var sc=[null,jb,kb,lb,ac,jc,kc,lc,mc],Dc={k:function(a,b,c,d){F("Assertion failed: "+G(a)+", at: "+[b?G(b):"unknown filename",c,d?G(d):"unknown function"])},C:function(a,b){return gb(a,b)},v:jb,Q:kb,R:lb,F:function(a){var b=mb[a];delete mb[a];var c=b.Cb,d=b.Db,f=b.jb,g=f.map(function(h){return h.vb}).concat(f.map(function(h){return h.Jb}));ub([a],g,function(h){var k={};f.forEach(function(m,p){var q=h[p],v=m.tb,C=m.ub,z=h[p+f.length],t=m.Ib,pa=m.Kb;k[m.rb]={read:function(J){return q.fromWireType(v(C,
|
||||
J))},write:function(J,S){var ea=[];t(pa,J,z.toWireType(ea,S));nb(ea)}}});return[{name:b.name,fromWireType:function(m){var p={},q;for(q in k)p[q]=k[q].read(m);d(m);return p},toWireType:function(m,p){for(var q in k)if(!(q in p))throw new TypeError('Missing field: "'+q+'"');var v=c();for(q in k)k[q].write(v,p[q]);null!==m&&m.push(d,v);return v},argPackAdvance:8,readValueFromPointer:ob,Qa:d}]})},I:function(){},aa:function(a,b,c,d,f){var g=vb(c);b=V(b);U(a,{name:b,fromWireType:function(h){return!!h},
|
||||
toWireType:function(h,k){return k?d:f},argPackAdvance:8,readValueFromPointer:function(h){if(1===c)var k=aa();else if(2===c)k=u();else if(4===c)k=w();else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[h>>g])},Qa:null})},$:function(a,b){b=V(b);U(a,{name:b,fromWireType:function(c){var d=X[c].value;zb(c);return d},toWireType:function(c,d){return Ab(d)},argPackAdvance:8,readValueFromPointer:ob,Qa:null})},z:function(a,b,c){c=vb(c);b=V(b);U(a,{name:b,fromWireType:function(d){return d},
|
||||
toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Bb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Cb(b,c),Qa:null})},E:function(a,b,c,d,f,g){var h=Gb(b,c);a=V(a);f=Ib(d,f);Fb(a,function(){Mb("Cannot call "+a+" due to unbound types",h)},b-1);ub([],h,function(k){var m=a,p=a;k=[k[0],null].concat(k.slice(1));var q=f,v=k.length;2>v&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var C=
|
||||
null!==k[1]&&!1,z=!1,t=1;t<k.length;++t)if(null!==k[t]&&void 0===k[t].Qa){z=!0;break}var pa="void"!==k[0].name,J="",S="";for(t=0;t<v-2;++t)J+=(0!==t?", ":"")+"arg"+t,S+=(0!==t?", ":"")+"arg"+t+"Wired";p="return function "+qb(p)+"("+J+") {\nif (arguments.length !== "+(v-2)+") {\nthrowBindingError('function "+p+" called with ' + arguments.length + ' arguments, expected "+(v-2)+" args!');\n}\n";z&&(p+="var destructors = [];\n");var ea=z?"destructors":"null";J="throwBindingError invoker fn runDestructors retType classParam".split(" ");
|
||||
q=[W,q,g,nb,k[0],k[1]];C&&(p+="var thisWired = classParam.toWireType("+ea+", this);\n");for(t=0;t<v-2;++t)p+="var arg"+t+"Wired = argType"+t+".toWireType("+ea+", arg"+t+"); // "+k[t+2].name+"\n",J.push("argType"+t),q.push(k[t+2]);C&&(S="thisWired"+(0<S.length?", ":"")+S);p+=(pa?"var rv = ":"")+"invoker(fn"+(0<S.length?", ":"")+S+");\n";if(z)p+="runDestructors(destructors);\n";else for(t=C?1:2;t<k.length;++t)v=1===t?"thisWired":"arg"+(t-2)+"Wired",null!==k[t].Qa&&(p+=v+"_dtor("+v+"); // "+k[t].name+
|
||||
"\n",J.push(v+"_dtor"),q.push(k[t].Qa));pa&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n");J.push(p+"}\n");k=Db(J).apply(null,q);t=b-1;if(!y.hasOwnProperty(m))throw new tb("Replacing nonexistant public symbol");void 0!==y[m].Na&&void 0!==t?y[m].Na[t]=k:(y[m]=k,y[m].ob=t);return[]})},j:function(a,b,c,d,f){function g(p){return p}b=V(b);-1===f&&(f=4294967295);var h=vb(c);if(0===d){var k=32-8*c;g=function(p){return p<<k>>>k}}var m=b.includes("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(p,
|
||||
q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+Bb(q)+'" to '+this.name);if(q<d||q>f)throw new TypeError('Passing a number "'+Bb(q)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return m?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:Nb(b,h,0!==d),Qa:null})},g:function(a,b,c){function d(g){g>>=2;var h=x();return new f(l,h[g+1],h[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,
|
||||
Uint32Array,Float32Array,Float64Array][b];c=V(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{wb:!0})},A:function(a,b){b=V(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=x()[d>>2];if(c)for(var g=d+4,h=0;h<=f;++h){var k=d+4+h;if(h==f||0==r()[k]){g=G(g,k-g);if(void 0===m)var m=g;else m+=String.fromCharCode(0),m+=g;g=k+1}}else{m=Array(f);for(h=0;h<f;++h)m[h]=String.fromCharCode(r()[d+4+h]);m=m.join("")}O(d);return m},toWireType:function(d,f){f instanceof
|
||||
ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||W("Cannot pass non-string to std::string");var h=(c&&g?function(){return za(f)}:function(){return f.length})(),k=M(4+h+1);x()[k>>2]=h;if(c&&g)ya(f,k+4,h+1);else if(g)for(g=0;g<h;++g){var m=f.charCodeAt(g);255<m&&(O(k),W("String has UTF-16 code units that do not fit in 8 bits"));r()[k+4+g]=m}else for(g=0;g<h;++g)r()[k+4+g]=f[g];null!==d&&d.push(O,k);return k},
|
||||
argPackAdvance:8,readValueFromPointer:ob,Qa:function(d){O(d)}})},r:function(a,b,c){c=V(c);if(2===b){var d=Aa;var f=Ba;var g=Ca;var h=function(){return fa()};var k=1}else 4===b&&(d=Da,f=Ea,g=Fa,h=function(){return x()},k=2);U(a,{name:c,fromWireType:function(m){for(var p=x()[m>>2],q=h(),v,C=m+4,z=0;z<=p;++z){var t=m+4+z*b;if(z==p||0==q[t>>k])C=d(C,t-C),void 0===v?v=C:(v+=String.fromCharCode(0),v+=C),C=t+b}O(m);return v},toWireType:function(m,p){"string"!==typeof p&&W("Cannot pass non-string to C++ string type "+
|
||||
c);var q=g(p),v=M(4+q+b);x()[v>>2]=q>>k;f(p,v+4,q+b);null!==m&&m.push(O,v);return v},argPackAdvance:8,readValueFromPointer:ob,Qa:function(m){O(m)}})},K:function(a,b,c,d,f,g){mb[a]={name:V(b),Cb:Ib(c,d),Db:Ib(f,g),jb:[]}},h:function(a,b,c,d,f,g,h,k,m,p){mb[a].jb.push({rb:V(b),vb:c,tb:Ib(d,f),ub:g,Jb:h,Ib:Ib(k,m),Kb:p})},ba:function(a,b){b=V(b);U(a,{Zb:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},X:function(a,b){if(a==b)postMessage({cmd:"processQueuedMainThreadWork"});
|
||||
else if(B)postMessage({targetThread:a,cmd:"processThreadQueue"});else{a=(a=L.Oa[a])&&a.worker;if(!a)return;a.postMessage({cmd:"processThreadQueue"})}return 1},o:zb,_:function(a){if(0===a)return Ab(Pb());var b=Ob[a];a=void 0===b?V(a):b;return Ab(Pb()[a])},D:function(a){4<a&&(X[a].eb+=1)},P:function(a,b,c,d){a||W("Cannot use deleted val. handle = "+a);a=X[a].value;var f=Rb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var h="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";
|
||||
for(g=0;g<b;++g)h+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",h+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(Qb,y,Ab);Rb[b]=f}return f(a,c,d)},i:function(){F()},y:function(a,b,c){Sb.length=0;var d;for(c>>=2;d=r()[b++];)(d=105>d)&&c&1&&c++,
|
||||
Sb.push(d?ka()[c++>>1]:w()[c]),++c;return Ra[a].apply(null,Sb)},T:function(){},x:function(){},l:Tb,m:Ta,p:fb,e:function(a,b){Z(a,b||1);throw"longjmp";},M:function(a,b,c){r().copyWithin(a,b,b+c)},ea:function(){return navigator.hardwareConcurrency},U:function(a,b,c){Wb.length=b;c>>=3;for(var d=0;d<b;d++)Wb[d]=ka()[c+d];return(0>a?Ra[-a-1]:sc[a]).apply(null,Wb)},N:function(a){var b=r().length;a>>>=0;if(a<=b||2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,
|
||||
d);0<d%65536&&(d+=65536-d%65536);a:{try{e.grow(Math.min(2147483648,d)-l.byteLength+65535>>>16);n(e.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},V:function(a,b,c){return Yb(a)?Zb(a,b,c):ac(a,b,c)},w:function(){},W:function(a,b){b>>=2;var c=w()[b+6];b={alpha:!!w()[b],depth:!!w()[b+1],stencil:!!w()[b+2],antialias:!!w()[b+3],premultipliedAlpha:!!w()[b+4],preserveDrawingBuffer:!!w()[b+5],powerPreference:ic[c],failIfMajorPerformanceCaveat:!!w()[b+7],Bb:w()[b+8],$b:w()[b+9],ib:w()[b+
|
||||
10],qb:w()[b+11],cc:w()[b+12],dc:w()[b+13]};a=Yb(a);return!a||b.qb?0:ec(a,b)},u:jc,O:kc,H:lc,S:mc,c:function(){return ta},L:function(){L.zb()},q:tc,s:uc,t:vc,J:wc,G:xc,n:yc,f:zc,d:Ac,a:e||y.wasmMemory,Y:function(a){var b=L.ab.pop();a&&b()},Z:gb,B:function(a,b,c,d){if("undefined"===typeof SharedArrayBuffer)return E("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!a)return E("pthread_create called with a null thread pointer!"),28;var f=[];if(B&&0===f.length)return Bc(687865856,
|
||||
a,b,c,d);var g=0,h=0;if(b&&-1!=b){var k=w()[b>>2];k+=81920;g=w()[b+8>>2];h=0!==w()[b+12>>2]}else k=2097152;(b=0==g)?g=Cc(16,k):(g-=k,0<g||F("Assertion failed: undefined"));for(var m=M(228),p=0;57>p;++p)x()[(m>>2)+p]=0;w()[a>>2]=m;w()[m+12>>2]=m;a=m+152;w()[a>>2]=a;c={Sa:g,Ta:k,bb:b,hb:h,Lb:c,Za:m,Ua:d,Qb:f};return B?(c.Sb="spawnThread",postMessage(c,f),0):ab(c)},ca:function(a,b){return oc(a,b)},b:function(a){ta=a},da:function(a){var b=Date.now()/1E3|0;a&&(w()[a>>2]=b);return b}};
|
||||
(function(){function a(f,g){y.asm=f.exports;H=y.asm.ja;Ja.unshift(y.asm.fa);L.fb.push(y.asm.ia);va=g;if(!B){var h=L.Ma.length;L.Ma.forEach(function(k){L.lb(k,function(){if(!--h&&(I--,y.monitorRunDependencies&&y.monitorRunDependencies(I),0==I&&(null!==Ma&&(clearInterval(Ma),Ma=null),Na))){var m=Na;Na=null;m()}})})}}function b(f){a(f.instance,f.module)}function c(f){return Pa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){E("failed to asynchronously prepare wasm: "+g);F(g)})}
|
||||
var d={a:Dc};B||(!B||F("Assertion failed: addRunDependency cannot be used in a pthread worker"),I++,y.monitorRunDependencies&&y.monitorRunDependencies(I));if(y.instantiateWasm)try{return y.instantiateWasm(d,a)}catch(f){return E("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return ua||"function"!==typeof WebAssembly.instantiateStreaming||K.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(K,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,
|
||||
d).then(b,function(g){E("wasm streaming compile failed: "+g);E("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(na);return{}})();y.___wasm_call_ctors=function(){return(y.___wasm_call_ctors=y.asm.fa).apply(null,arguments)};var M=y._malloc=function(){return(M=y._malloc=y.asm.ga).apply(null,arguments)},O=y._free=function(){return(O=y._free=y.asm.ha).apply(null,arguments)};y._emscripten_tls_init=function(){return(y._emscripten_tls_init=y.asm.ia).apply(null,arguments)};
|
||||
var Lb=y.___getTypeName=function(){return(Lb=y.___getTypeName=y.asm.ka).apply(null,arguments)};y.___embind_register_native_and_builtin_types=function(){return(y.___embind_register_native_and_builtin_types=y.asm.la).apply(null,arguments)};y._emscripten_current_thread_process_queued_calls=function(){return(y._emscripten_current_thread_process_queued_calls=y.asm.ma).apply(null,arguments)};
|
||||
var Xa=y._emscripten_register_main_browser_thread_id=function(){return(Xa=y._emscripten_register_main_browser_thread_id=y.asm.na).apply(null,arguments)},pc=y._emscripten_main_browser_thread_id=function(){return(pc=y._emscripten_main_browser_thread_id=y.asm.oa).apply(null,arguments)},Qa=y.__emscripten_do_dispatch_to_thread=function(){return(Qa=y.__emscripten_do_dispatch_to_thread=y.asm.pa).apply(null,arguments)},Bc=y._emscripten_sync_run_in_main_thread_4=function(){return(Bc=y._emscripten_sync_run_in_main_thread_4=
|
||||
y.asm.qa).apply(null,arguments)},$a=y._emscripten_main_thread_process_queued_calls=function(){return($a=y._emscripten_main_thread_process_queued_calls=y.asm.ra).apply(null,arguments)},Vb=y._emscripten_run_in_main_runtime_thread_js=function(){return(Vb=y._emscripten_run_in_main_runtime_thread_js=y.asm.sa).apply(null,arguments)},$b=y.__emscripten_call_on_thread=function(){return($b=y.__emscripten_call_on_thread=y.asm.ta).apply(null,arguments)},Wa=y.__emscripten_thread_init=function(){return(Wa=y.__emscripten_thread_init=
|
||||
y.asm.ua).apply(null,arguments)},N=y._pthread_self=function(){return(N=y._pthread_self=y.asm.va).apply(null,arguments)},Ya=y.___pthread_tsd_run_dtors=function(){return(Ya=y.___pthread_tsd_run_dtors=y.asm.wa).apply(null,arguments)},nc=y._emscripten_get_global_libc=function(){return(nc=y._emscripten_get_global_libc=y.asm.xa).apply(null,arguments)},Y=y.stackSave=function(){return(Y=y.stackSave=y.asm.ya).apply(null,arguments)},P=y.stackRestore=function(){return(P=y.stackRestore=y.asm.za).apply(null,arguments)},
|
||||
Ub=y.stackAlloc=function(){return(Ub=y.stackAlloc=y.asm.Aa).apply(null,arguments)},db=y._emscripten_stack_set_limits=function(){return(db=y._emscripten_stack_set_limits=y.asm.Ba).apply(null,arguments)},Z=y._setThrew=function(){return(Z=y._setThrew=y.asm.Ca).apply(null,arguments)},Cc=y._memalign=function(){return(Cc=y._memalign=y.asm.Da).apply(null,arguments)};y.dynCall_jiiiiiiiii=function(){return(y.dynCall_jiiiiiiiii=y.asm.Ea).apply(null,arguments)};
|
||||
var Ec=y.dynCall_ijiii=function(){return(Ec=y.dynCall_ijiii=y.asm.Fa).apply(null,arguments)};y.dynCall_jiji=function(){return(y.dynCall_jiji=y.asm.Ga).apply(null,arguments)};y.dynCall_jiiiiiiii=function(){return(y.dynCall_jiiiiiiii=y.asm.Ha).apply(null,arguments)};y.dynCall_jiiiiii=function(){return(y.dynCall_jiiiiii=y.asm.Ia).apply(null,arguments)};y.dynCall_jiiiii=function(){return(y.dynCall_jiiiii=y.asm.Ja).apply(null,arguments)};
|
||||
y.dynCall_iiijii=function(){return(y.dynCall_iiijii=y.asm.Ka).apply(null,arguments)};var Za=y.__emscripten_allow_main_runtime_queued_calls=600816,Ua=y.__emscripten_main_thread_futex=897292;function yc(a,b){var c=Y();try{H.get(a)(b)}catch(d){P(c);if(d!==d+0&&"longjmp"!==d)throw d;Z(1,0)}}function Ac(a,b,c,d,f){var g=Y();try{H.get(a)(b,c,d,f)}catch(h){P(g);if(h!==h+0&&"longjmp"!==h)throw h;Z(1,0)}}
|
||||
function zc(a,b,c){var d=Y();try{H.get(a)(b,c)}catch(f){P(d);if(f!==f+0&&"longjmp"!==f)throw f;Z(1,0)}}function vc(a,b,c,d,f,g,h,k,m,p){var q=Y();try{return H.get(a)(b,c,d,f,g,h,k,m,p)}catch(v){P(q);if(v!==v+0&&"longjmp"!==v)throw v;Z(1,0)}}function wc(a,b,c,d,f,g,h,k,m,p,q,v){var C=Y();try{return H.get(a)(b,c,d,f,g,h,k,m,p,q,v)}catch(z){P(C);if(z!==z+0&&"longjmp"!==z)throw z;Z(1,0)}}
|
||||
function tc(a,b,c,d,f){var g=Y();try{return H.get(a)(b,c,d,f)}catch(h){P(g);if(h!==h+0&&"longjmp"!==h)throw h;Z(1,0)}}function uc(a,b,c,d,f,g,h,k,m){var p=Y();try{return H.get(a)(b,c,d,f,g,h,k,m)}catch(q){P(p);if(q!==q+0&&"longjmp"!==q)throw q;Z(1,0)}}function xc(a,b,c,d,f,g){var h=Y();try{return Ec(a,b,c,d,f,g)}catch(k){P(h);if(k!==k+0&&"longjmp"!==k)throw k;Z(1,0)}}y.PThread=L;y.PThread=L;y.wasmMemory=e;y.ExitStatus=bb;var Fc;
|
||||
function bb(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}Na=function Gc(){Fc||Hc();Fc||(Na=Gc)};
|
||||
function Hc(){function a(){if(!Fc&&(Fc=!0,y.calledRun=!0,!wa)){B||Sa(Ja);ma(y);if(y.onRuntimeInitialized)y.onRuntimeInitialized();if(!B){if(y.postRun)for("function"==typeof y.postRun&&(y.postRun=[y.postRun]);y.postRun.length;){var b=y.postRun.shift();Ka.unshift(b)}Sa(Ka)}}}if(!(0<I))if(B)ma(y),B||Sa(Ja),postMessage({cmd:"loaded"});else{if(!B){if(y.preRun)for("function"==typeof y.preRun&&(y.preRun=[y.preRun]);y.preRun.length;)La();Sa(Ia)}0<I||(y.setStatus?(y.setStatus("Running..."),setTimeout(function(){setTimeout(function(){y.setStatus("")},
|
||||
1);a()},1)):a())}}y.run=Hc;if(y.preInit)for("function"==typeof y.preInit&&(y.preInit=[y.preInit]);0<y.preInit.length;)y.preInit.pop()();B&&(noExitRuntime=!1,L.Ab());Hc();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/avif/enc/avif_enc_mt.wasm
Executable file
BIN
codecs/avif/enc/avif_enc_mt.wasm
Executable file
Binary file not shown.
1
codecs/avif/enc/avif_enc_mt.worker.js
generated
Normal file
1
codecs/avif/enc/avif_enc_mt.worker.js
generated
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};function moduleLoaded(){}self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;(e.data.urlOrBlob?import(e.data.urlOrBlob):import("./avif_enc_mt.js")).then(function(exports){return exports.default(Module)}).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["PThread"].threadExit(result)}}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
||||
62
codecs/avif/enc/avif_node_enc.js
generated
Normal file
62
codecs/avif/enc/avif_node_enc.js
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var e;e||(e=typeof Module !== 'undefined' ? Module : {});var aa,ca;e.ready=new Promise(function(a,b){aa=a;ca=b});var u={},v;for(v in e)e.hasOwnProperty(v)&&(u[v]=e[v]);var da,ea,fa,ha;da=function(a){fa||(fa=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);return fa.readFileSync(a,null)};ea=function(a){a=da(a);a.buffer||(a=new Uint8Array(a));a.buffer||w("Assertion failed: undefined");return a};1<process.argv.length&&process.argv[1].replace(/\\/g,"/");process.argv.slice(2);
|
||||
process.on("uncaughtException",function(a){throw a;});process.on("unhandledRejection",w);e.inspect=function(){return"[Emscripten Module object]"};var ia=e.print||console.log.bind(console),x=e.printErr||console.warn.bind(console);for(v in u)u.hasOwnProperty(v)&&(e[v]=u[v]);u=null;var ja=0,y;e.wasmBinary&&(y=e.wasmBinary);var noExitRuntime=e.noExitRuntime||!0;"object"!==typeof WebAssembly&&w("no native wasm support detected");var ka,la=!1,ma=new TextDecoder("utf8");
|
||||
function na(a,b,c){var d=z;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var oa=new TextDecoder("utf-16le");
|
||||
function pa(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&B[c];)++c;return oa.decode(z.subarray(a,c<<1))}function qa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)C[b>>1]=a.charCodeAt(f),b+=2;C[b>>1]=0;return b-d}function ra(a){return 2*a.length}function sa(a,b){for(var c=0,d="";!(c>=b/4);){var f=D[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
|
||||
function ta(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023}D[b>>2]=g;b+=4;if(b+4>c)break}D[b>>2]=0;return b-d}function ua(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var va,wa,z,C,B,D,E,xa,ya;
|
||||
function za(){var a=ka.buffer;va=a;e.HEAP8=wa=new Int8Array(a);e.HEAP16=C=new Int16Array(a);e.HEAP32=D=new Int32Array(a);e.HEAPU8=z=new Uint8Array(a);e.HEAPU16=B=new Uint16Array(a);e.HEAPU32=E=new Uint32Array(a);e.HEAPF32=xa=new Float32Array(a);e.HEAPF64=ya=new Float64Array(a)}var F,Aa=[],Ba=[],Ca=[];function Da(){var a=e.preRun.shift();Aa.unshift(a)}var G=0,Ea=null,H=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function w(a){if(e.onAbort)e.onAbort(a);x(a);la=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ca(a);throw a;}var J=(new URL("avif_node_enc.wasm",import.meta.url)).toString();function Fa(){return Promise.resolve().then(function(){a:{try{if(J==J&&y){var a=new Uint8Array(y);break a}if(ea){a=ea(J);break a}throw"both async and sync fetching of the wasm failed";}catch(b){w(b)}a=void 0}return a})}
|
||||
function Ga(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.va;"number"===typeof c?void 0===b.ga?F.get(c)():F.get(c)(b.ga):c(void 0===b.ga?null:b.ga)}}}var Ha=[null,[],[]],Ia={},K={};function Ja(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function L(a){return this.fromWireType(E[a>>2])}var M={},N={},O={};function Ka(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||
function La(a,b){a=Ka(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ma(a){var b=Error,c=La(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||
var Na=void 0;function Oa(a,b,c){function d(h){h=c(h);if(h.length!==a.length)throw new Na("Mismatched type converter count");for(var l=0;l<a.length;++l)P(a[l],h[l])}a.forEach(function(h){O[h]=b});var f=Array(b.length),g=[],k=0;b.forEach(function(h,l){N.hasOwnProperty(h)?f[l]=N[h]:(g.push(h),M.hasOwnProperty(h)||(M[h]=[]),M[h].push(function(){f[l]=N[h];++k;k===g.length&&d(f)}))});0===g.length&&d(f)}
|
||||
function Pa(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Qa=void 0;function Q(a){for(var b="";z[a];)b+=Qa[z[a++]];return b}var Ra=void 0;function R(a){throw new Ra(a);}
|
||||
function P(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||R('type "'+d+'" must have a positive integer typeid pointer');if(N.hasOwnProperty(a)){if(c.oa)return;R("Cannot register type '"+d+"' twice")}N[a]=b;delete O[a];M.hasOwnProperty(a)&&(b=M[a],delete M[a],b.forEach(function(f){f()}))}var Sa=[],S=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Ta(a){4<a&&0===--S[a].ha&&(S[a]=void 0,Sa.push(a))}function U(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Sa.length?Sa.pop():S.length;S[b]={ha:1,value:a};return b}}function Ua(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Va(a,b){switch(b){case 2:return function(c){return this.fromWireType(xa[c>>2])};case 3:return function(c){return this.fromWireType(ya[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Wa(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=La(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Xa(a,b){var c=e;if(void 0===c[a].ea){var d=c[a];c[a]=function(){c[a].ea.hasOwnProperty(arguments.length)||R("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].ea+")!");return c[a].ea[arguments.length].apply(this,arguments)};c[a].ea=[];c[a].ea[d.ja]=d}}
|
||||
function Ya(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].ea&&void 0!==e[a].ea[c])&&R("Cannot register public name '"+a+"' twice"),Xa(a,a),e.hasOwnProperty(c)&&R("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].ea[c]=b):(e[a]=b,void 0!==c&&(e[a].ya=c))}function Za(a,b){for(var c=[],d=0;d<a;d++)c.push(D[(b>>2)+d]);return c}
|
||||
function $a(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=e["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=F.get(b).apply(null,c);return d}}function V(a,b){a=Q(a);var c=a.includes("j")?$a(a,b):F.get(b);"function"!==typeof c&&R("unknown function pointer with signature "+a+": "+b);return c}var ab=void 0;function bb(a){a=cb(a);var b=Q(a);W(a);return b}
|
||||
function db(a,b){function c(g){f[g]||N[g]||(O[g]?O[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new ab(a+": "+d.map(bb).join([", "]));}function eb(a,b,c){switch(b){case 0:return c?function(d){return wa[d]}:function(d){return z[d]};case 1:return c?function(d){return C[d>>1]}:function(d){return B[d>>1]};case 2:return c?function(d){return D[d>>2]}:function(d){return E[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var fb={};
|
||||
function gb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function hb(a,b){var c=N[a];void 0===c&&R(b+" has unknown type "+bb(a));return c}var ib={};Na=e.InternalError=Ma("InternalError");for(var jb=Array(256),kb=0;256>kb;++kb)jb[kb]=String.fromCharCode(kb);Qa=jb;Ra=e.BindingError=Ma("BindingError");e.count_emval_handles=function(){for(var a=0,b=5;b<S.length;++b)void 0!==S[b]&&++a;return a};
|
||||
e.get_first_emval=function(){for(var a=5;a<S.length;++a)if(void 0!==S[a])return S[a];return null};ab=e.UnboundTypeError=Ma("UnboundTypeError");
|
||||
var vb={O:function(){},s:function(){return 0},G:function(){return 0},H:function(){},x:function(a){var b=K[a];delete K[a];var c=b.pa,d=b.qa,f=b.ia,g=f.map(function(k){return k.na}).concat(f.map(function(k){return k.sa}));Oa([a],g,function(k){var h={};f.forEach(function(l,n){var m=k[n],p=l.la,r=l.ma,t=k[n+f.length],q=l.ra,ba=l.ta;h[l.ka]={read:function(A){return m.fromWireType(p(r,A))},write:function(A,I){var T=[];q(ba,A,t.toWireType(T,I));Ja(T)}}});return[{name:b.name,fromWireType:function(l){var n=
|
||||
{},m;for(m in h)n[m]=h[m].read(l);d(l);return n},toWireType:function(l,n){for(var m in h)if(!(m in n))throw new TypeError('Missing field: "'+m+'"');var p=c();for(m in h)h[m].write(p,n[m]);null!==l&&l.push(d,p);return p},argPackAdvance:8,readValueFromPointer:L,fa:d}]})},B:function(){},K:function(a,b,c,d,f){var g=Pa(c);b=Q(b);P(a,{name:b,fromWireType:function(k){return!!k},toWireType:function(k,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(k){if(1===c)var h=wa;else if(2===c)h=C;else if(4===
|
||||
c)h=D;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[k>>g])},fa:null})},J:function(a,b){b=Q(b);P(a,{name:b,fromWireType:function(c){var d=S[c].value;Ta(c);return d},toWireType:function(c,d){return U(d)},argPackAdvance:8,readValueFromPointer:L,fa:null})},t:function(a,b,c){c=Pa(c);b=Q(b);P(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Ua(f)+'" to '+this.name);
|
||||
return f},argPackAdvance:8,readValueFromPointer:Va(b,c),fa:null})},w:function(a,b,c,d,f,g){var k=Za(b,c);a=Q(a);f=V(d,f);Ya(a,function(){db("Cannot call "+a+" due to unbound types",k)},b-1);Oa([],k,function(h){var l=[h[0],null].concat(h.slice(1)),n=h=a,m=f,p=l.length;2>p&&R("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var r=null!==l[1]&&!1,t=!1,q=1;q<l.length;++q)if(null!==l[q]&&void 0===l[q].fa){t=!0;break}var ba="void"!==l[0].name,A="",I="";for(q=0;q<p-2;++q)A+=
|
||||
(0!==q?", ":"")+"arg"+q,I+=(0!==q?", ":"")+"arg"+q+"Wired";n="return function "+Ka(n)+"("+A+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+n+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";t&&(n+="var destructors = [];\n");var T=t?"destructors":"null";A="throwBindingError invoker fn runDestructors retType classParam".split(" ");m=[R,m,g,Ja,l[0],l[1]];r&&(n+="var thisWired = classParam.toWireType("+T+", this);\n");for(q=0;q<p-2;++q)n+=
|
||||
"var arg"+q+"Wired = argType"+q+".toWireType("+T+", arg"+q+"); // "+l[q+2].name+"\n",A.push("argType"+q),m.push(l[q+2]);r&&(I="thisWired"+(0<I.length?", ":"")+I);n+=(ba?"var rv = ":"")+"invoker(fn"+(0<I.length?", ":"")+I+");\n";if(t)n+="runDestructors(destructors);\n";else for(q=r?1:2;q<l.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==l[q].fa&&(n+=p+"_dtor("+p+"); // "+l[q].name+"\n",A.push(p+"_dtor"),m.push(l[q].fa));ba&&(n+="var ret = retType.fromWireType(rv);\nreturn ret;\n");A.push(n+
|
||||
"}\n");l=Wa(A).apply(null,m);q=b-1;if(!e.hasOwnProperty(h))throw new Na("Replacing nonexistant public symbol");void 0!==e[h].ea&&void 0!==q?e[h].ea[q]=l:(e[h]=l,e[h].ja=q);return[]})},i:function(a,b,c,d,f){function g(n){return n}b=Q(b);-1===f&&(f=4294967295);var k=Pa(c);if(0===d){var h=32-8*c;g=function(n){return n<<h>>>h}}var l=b.includes("unsigned");P(a,{name:b,fromWireType:g,toWireType:function(n,m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+Ua(m)+'" to '+
|
||||
this.name);if(m<d||m>f)throw new TypeError('Passing a number "'+Ua(m)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return l?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:eb(b,k,0!==d),fa:null})},e:function(a,b,c){function d(g){g>>=2;var k=E;return new f(va,k[g+1],k[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=Q(c);P(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},
|
||||
{oa:!0})},u:function(a,b){b=Q(b);var c="std::string"===b;P(a,{name:b,fromWireType:function(d){var f=E[d>>2];if(c)for(var g=d+4,k=0;k<=f;++k){var h=d+4+k;if(k==f||0==z[h]){if(g){for(var l=g+(h-g),n=g;!(n>=l)&&z[n];)++n;g=ma.decode(z.subarray(g,n))}else g="";if(void 0===m)var m=g;else m+=String.fromCharCode(0),m+=g;g=h+1}}else{m=Array(f);for(k=0;k<f;++k)m[k]=String.fromCharCode(z[d+4+k]);m=m.join("")}W(d);return m},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===
|
||||
typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||R("Cannot pass non-string to std::string");var k=(c&&g?function(){for(var n=0,m=0;m<f.length;++m){var p=f.charCodeAt(m);55296<=p&&57343>=p&&(p=65536+((p&1023)<<10)|f.charCodeAt(++m)&1023);127>=p?++n:n=2047>=p?n+2:65535>=p?n+3:n+4}return n}:function(){return f.length})(),h=lb(4+k+1);E[h>>2]=k;if(c&&g)na(f,h+4,k+1);else if(g)for(g=0;g<k;++g){var l=f.charCodeAt(g);255<l&&(W(h),R("String has UTF-16 code units that do not fit in 8 bits"));
|
||||
z[h+4+g]=l}else for(g=0;g<k;++g)z[h+4+g]=f[g];null!==d&&d.push(W,h);return h},argPackAdvance:8,readValueFromPointer:L,fa:function(d){W(d)}})},o:function(a,b,c){c=Q(c);if(2===b){var d=pa;var f=qa;var g=ra;var k=function(){return B};var h=1}else 4===b&&(d=sa,f=ta,g=ua,k=function(){return E},h=2);P(a,{name:c,fromWireType:function(l){for(var n=E[l>>2],m=k(),p,r=l+4,t=0;t<=n;++t){var q=l+4+t*b;if(t==n||0==m[q>>h])r=d(r,q-r),void 0===p?p=r:(p+=String.fromCharCode(0),p+=r),r=q+b}W(l);return p},toWireType:function(l,
|
||||
n){"string"!==typeof n&&R("Cannot pass non-string to C++ string type "+c);var m=g(n),p=lb(4+m+b);E[p>>2]=m>>h;f(n,p+4,m+b);null!==l&&l.push(W,p);return p},argPackAdvance:8,readValueFromPointer:L,fa:function(l){W(l)}})},z:function(a,b,c,d,f,g){K[a]={name:Q(b),pa:V(c,d),qa:V(f,g),ia:[]}},g:function(a,b,c,d,f,g,k,h,l,n){K[a].ia.push({ka:Q(b),na:c,la:V(d,f),ma:g,sa:k,ra:V(h,l),ta:n})},L:function(a,b){b=Q(b);P(a,{xa:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},j:Ta,N:function(a){if(0===
|
||||
a)return U(gb());var b=fb[a];a=void 0===b?Q(a):b;return U(gb()[a])},v:function(a){4<a&&(S[a].ha+=1)},D:function(a,b,c,d){a||R("Cannot use deleted val. handle = "+a);a=S[a].value;var f=ib[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var k="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)k+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+
|
||||
g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",k+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(hb,e,U);ib[b]=f}return f(a,c,d)},f:function(){w()},d:function(a,b){X(a,b||1);throw"longjmp";},E:function(a,b,c){z.copyWithin(a,b,b+c)},n:function(a){var b=z.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{ka.grow(Math.min(2147483648,
|
||||
d)-va.byteLength+65535>>>16);za();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},r:function(){return 0},F:function(a,b,c,d){a=Ia.wa(a);b=Ia.ua(a,b,c);D[d>>2]=b;return 0},A:function(){},I:function(a,b,c,d){for(var f=0,g=0;g<c;g++){for(var k=D[b+8*g>>2],h=D[b+(8*g+4)>>2],l=0;l<h;l++){var n=z[k+l],m=Ha[a];if(0===n||10===n){n=1===a?ia:x;var p;for(p=0;m[p]&&!(NaN<=p);)++p;p=ma.decode(m.subarray?m.subarray(0,p):new Uint8Array(m.slice(0,p)));n(p);m.length=0}else m.push(n)}f+=h}D[d>>2]=f;return 0},
|
||||
b:function(){return ja},l:mb,p:nb,q:ob,C:pb,y:qb,m:rb,h:sb,c:tb,k:ub,a:function(a){ja=a},M:function(a){var b=Date.now()/1E3|0;a&&(D[a>>2]=b);return b}};
|
||||
(function(){function a(f){e.asm=f.exports;ka=e.asm.P;za();F=e.asm.Y;Ba.unshift(e.asm.Q);G--;e.monitorRunDependencies&&e.monitorRunDependencies(G);0==G&&(null!==Ea&&(clearInterval(Ea),Ea=null),H&&(f=H,H=null,f()))}function b(f){a(f.instance)}function c(f){return Fa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){x("failed to asynchronously prepare wasm: "+g);w(g)})}var d={a:vb};G++;e.monitorRunDependencies&&e.monitorRunDependencies(G);if(e.instantiateWasm)try{return e.instantiateWasm(d,
|
||||
a)}catch(f){return x("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return y||"function"!==typeof WebAssembly.instantiateStreaming||J.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(J,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){x("wasm streaming compile failed: "+g);x("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ca);return{}})();
|
||||
e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.Q).apply(null,arguments)};var lb=e._malloc=function(){return(lb=e._malloc=e.asm.R).apply(null,arguments)},W=e._free=function(){return(W=e._free=e.asm.S).apply(null,arguments)},cb=e.___getTypeName=function(){return(cb=e.___getTypeName=e.asm.T).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.U).apply(null,arguments)};
|
||||
var Y=e.stackSave=function(){return(Y=e.stackSave=e.asm.V).apply(null,arguments)},Z=e.stackRestore=function(){return(Z=e.stackRestore=e.asm.W).apply(null,arguments)},X=e._setThrew=function(){return(X=e._setThrew=e.asm.X).apply(null,arguments)};e.dynCall_jiiiiiiiii=function(){return(e.dynCall_jiiiiiiiii=e.asm.Z).apply(null,arguments)};var wb=e.dynCall_ijiii=function(){return(wb=e.dynCall_ijiii=e.asm._).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.$).apply(null,arguments)};
|
||||
e.dynCall_jiiiiiiii=function(){return(e.dynCall_jiiiiiiii=e.asm.aa).apply(null,arguments)};e.dynCall_jiiiiii=function(){return(e.dynCall_jiiiiii=e.asm.ba).apply(null,arguments)};e.dynCall_jiiiii=function(){return(e.dynCall_jiiiii=e.asm.ca).apply(null,arguments)};e.dynCall_iiijii=function(){return(e.dynCall_iiijii=e.asm.da).apply(null,arguments)};function rb(a,b){var c=Y();try{F.get(a)(b)}catch(d){Z(c);if(d!==d+0&&"longjmp"!==d)throw d;X(1,0)}}
|
||||
function tb(a,b,c,d,f){var g=Y();try{F.get(a)(b,c,d,f)}catch(k){Z(g);if(k!==k+0&&"longjmp"!==k)throw k;X(1,0)}}function sb(a,b,c){var d=Y();try{F.get(a)(b,c)}catch(f){Z(d);if(f!==f+0&&"longjmp"!==f)throw f;X(1,0)}}function ob(a,b,c,d,f,g,k,h,l,n){var m=Y();try{return F.get(a)(b,c,d,f,g,k,h,l,n)}catch(p){Z(m);if(p!==p+0&&"longjmp"!==p)throw p;X(1,0)}}function pb(a,b,c,d,f,g,k,h,l,n,m,p){var r=Y();try{return F.get(a)(b,c,d,f,g,k,h,l,n,m,p)}catch(t){Z(r);if(t!==t+0&&"longjmp"!==t)throw t;X(1,0)}}
|
||||
function mb(a,b,c,d,f){var g=Y();try{return F.get(a)(b,c,d,f)}catch(k){Z(g);if(k!==k+0&&"longjmp"!==k)throw k;X(1,0)}}function ub(a,b,c,d,f,g,k,h,l,n,m){var p=Y();try{F.get(a)(b,c,d,f,g,k,h,l,n,m)}catch(r){Z(p);if(r!==r+0&&"longjmp"!==r)throw r;X(1,0)}}function nb(a,b,c,d,f,g,k,h,l){var n=Y();try{return F.get(a)(b,c,d,f,g,k,h,l)}catch(m){Z(n);if(m!==m+0&&"longjmp"!==m)throw m;X(1,0)}}
|
||||
function qb(a,b,c,d,f,g){var k=Y();try{return wb(a,b,c,d,f,g)}catch(h){Z(k);if(h!==h+0&&"longjmp"!==h)throw h;X(1,0)}}var xb;H=function yb(){xb||zb();xb||(H=yb)};
|
||||
function zb(){function a(){if(!xb&&(xb=!0,e.calledRun=!0,!la)){Ga(Ba);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();Ca.unshift(b)}Ga(Ca)}}if(!(0<G)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)Da();Ga(Aa);0<G||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=zb;
|
||||
if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();zb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/avif/enc/avif_node_enc.wasm
Executable file
BIN
codecs/avif/enc/avif_node_enc.wasm
Executable file
Binary file not shown.
73
codecs/avif/helper.Makefile
Normal file
73
codecs/avif/helper.Makefile
Normal file
@@ -0,0 +1,73 @@
|
||||
# This is a helper Makefile for building LibAVIF + LibAOM with given params.
|
||||
#
|
||||
# Params that must be supplied by the caller:
|
||||
# $(CODEC_DIR)
|
||||
# $(LIBAOM_DIR)
|
||||
# $(BUILD_DIR)
|
||||
# $(OUT_JS)
|
||||
# $(OUT_CPP)
|
||||
# $(LIBAOM_FLAGS)
|
||||
# $(LIBAVIF_FLAGS)
|
||||
# $(ENVIRONMENT)
|
||||
|
||||
OUT_BUILD_DIR := $(BUILD_DIR)/$(basename $(OUT_JS))
|
||||
|
||||
CODEC_BUILD_DIR := $(OUT_BUILD_DIR)/libavif
|
||||
CODEC_OUT := $(CODEC_BUILD_DIR)/libavif.a
|
||||
|
||||
LIBAOM_BUILD_DIR := $(OUT_BUILD_DIR)/libaom
|
||||
LIBAOM_OUT := $(LIBAOM_BUILD_DIR)/libaom.a
|
||||
|
||||
OUT_WASM = $(OUT_JS:.js=.wasm)
|
||||
OUT_WORKER=$(OUT_JS:.js=.worker.js)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(OUT_JS)
|
||||
|
||||
$(OUT_JS): $(OUT_CPP) $(LIBAOM_OUT) $(CODEC_OUT)
|
||||
$(CXX) \
|
||||
-I $(CODEC_DIR)/include \
|
||||
$(CXXFLAGS) \
|
||||
$(LDFLAGS) \
|
||||
$(OUT_FLAGS) \
|
||||
--bind \
|
||||
-s ENVIRONMENT=$(ENVIRONMENT) \
|
||||
-s EXPORT_ES6=1 \
|
||||
-o $@ \
|
||||
$+
|
||||
|
||||
$(CODEC_OUT): $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_OUT)
|
||||
emcmake cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBUILD_SHARED_LIBS=0 \
|
||||
-DAVIF_CODEC_AOM=1 \
|
||||
-DAOM_LIBRARY=$(LIBAOM_OUT) \
|
||||
-DAOM_INCLUDE_DIR=$(LIBAOM_DIR) \
|
||||
$(LIBAVIF_FLAGS) \
|
||||
-B $(CODEC_BUILD_DIR) \
|
||||
$(CODEC_DIR) && \
|
||||
$(MAKE) -C $(CODEC_BUILD_DIR)
|
||||
|
||||
$(LIBAOM_OUT): $(LIBAOM_DIR)/CMakeLists.txt
|
||||
emcmake cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_CCACHE=0 \
|
||||
-DAOM_TARGET_CPU=generic \
|
||||
-DENABLE_DOCS=0 \
|
||||
-DENABLE_TESTS=0 \
|
||||
-DENABLE_EXAMPLES=0 \
|
||||
-DENABLE_TOOLS=0 \
|
||||
-DCONFIG_ACCOUNTING=1 \
|
||||
-DCONFIG_INSPECTION=0 \
|
||||
-DCONFIG_RUNTIME_CPU_DETECT=0 \
|
||||
-DCONFIG_WEBM_IO=0 \
|
||||
$(LIBAOM_FLAGS) \
|
||||
-B $(LIBAOM_BUILD_DIR) \
|
||||
$(LIBAOM_DIR) && \
|
||||
$(MAKE) -C $(LIBAOM_BUILD_DIR)
|
||||
|
||||
clean:
|
||||
$(RM) $(OUT_JS) $(OUT_WASM) $(OUT_WORKER)
|
||||
$(MAKE) -C $(CODEC_BUILD_DIR) clean
|
||||
$(MAKE) -C $(LIBAOM_BUILD_DIR) clean
|
||||
6
codecs/avif/package.json
Normal file
6
codecs/avif/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "avif",
|
||||
"scripts": {
|
||||
"build": "../build-cpp.sh"
|
||||
}
|
||||
}
|
||||
3
codecs/build-cpp.sh
Executable file
3
codecs/build-cpp.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh -e
|
||||
docker build -t squoosh-cpp - < ../cpp.Dockerfile
|
||||
docker run -it --rm -v $PWD:/src squoosh-cpp "$@"
|
||||
10
codecs/build-rust.sh
Executable file
10
codecs/build-rust.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
set -e
|
||||
|
||||
if [ ! -z "$RUST_IMG" ]
|
||||
then
|
||||
# Get part after ":" (https://stackoverflow.com/a/15149278/439965).
|
||||
IMG_SUFFIX=-${RUST_IMG#*:}
|
||||
fi
|
||||
IMG_NAME=squoosh-rust$IMG_SUFFIX
|
||||
docker build -t $IMG_NAME --build-arg RUST_IMG - < ../rust.Dockerfile
|
||||
docker run -it --rm -v $PWD:/src $IMG_NAME "$@"
|
||||
17
codecs/cpp.Dockerfile
Normal file
17
codecs/cpp.Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM emscripten/emsdk:2.0.21
|
||||
RUN apt-get update && apt-get install -qqy autoconf libtool pkg-config
|
||||
ENV CFLAGS "-O3 -flto"
|
||||
ENV CXXFLAGS "${CFLAGS} -std=c++17"
|
||||
ENV LDFLAGS "${CFLAGS} \
|
||||
--closure 1 \
|
||||
-s FILESYSTEM=0 \
|
||||
-s PTHREAD_POOL_SIZE=navigator.hardwareConcurrency \
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s TEXTDECODER=2 \
|
||||
"
|
||||
# Build and cache standard libraries with these flags + Embind.
|
||||
RUN emcc ${CXXFLAGS} ${LDFLAGS} --bind -xc++ /dev/null -o /dev/null
|
||||
# And another set for the pthread variant.
|
||||
RUN emcc ${CXXFLAGS} ${LDFLAGS} --bind -pthread -xc++ /dev/null -o /dev/null
|
||||
WORKDIR /src
|
||||
CMD ["sh", "-c", "emmake make -j`nproc`"]
|
||||
1
codecs/hqx/.gitignore
vendored
Normal file
1
codecs/hqx/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
||||
292
codecs/hqx/Cargo.lock
generated
Normal file
292
codecs/hqx/Cargo.lock
generated
Normal file
@@ -0,0 +1,292 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "console_error_panic_hook"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.1.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
|
||||
|
||||
[[package]]
|
||||
name = "hqx"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/CryZe/wasmboy-rs?tag=v0.1.3#d7cbae67906796928c8e451b186f3c653924beb8"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memory_units"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||
dependencies = [
|
||||
"unicode-xid 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
||||
|
||||
[[package]]
|
||||
name = "squooshhqx"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"console_error_panic_hook",
|
||||
"hqx",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-test",
|
||||
"wee_alloc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.27",
|
||||
"quote 1.0.7",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"proc-macro2 1.0.27",
|
||||
"quote 1.0.7",
|
||||
"syn",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.3.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"futures",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
|
||||
dependencies = [
|
||||
"quote 1.0.7",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.27",
|
||||
"quote 1.0.7",
|
||||
"syn",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-test"
|
||||
version = "0.2.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2d9693b63a742d481c7f80587e057920e568317b2806988c59cd71618bc26c1"
|
||||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"futures",
|
||||
"js-sys",
|
||||
"scoped-tls",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-bindgen-test-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-test-macro"
|
||||
version = "0.2.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0789dac148a8840bbcf9efe13905463b733fa96543bfbf263790535c11af7ba5"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wee_alloc"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"memory_units",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
37
codecs/hqx/Cargo.toml
Normal file
37
codecs/hqx/Cargo.toml
Normal file
@@ -0,0 +1,37 @@
|
||||
[package]
|
||||
name = "squooshhqx"
|
||||
version = "0.1.0"
|
||||
authors = ["Surma <surma@surma.link>"]
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[features]
|
||||
default = ["console_error_panic_hook", "wee_alloc"]
|
||||
|
||||
[dependencies]
|
||||
cfg-if = "0.1.2"
|
||||
wasm-bindgen = "0.2.38"
|
||||
# lazy_static = "1.0.0"
|
||||
hqx = {git = "https://github.com/CryZe/wasmboy-rs", tag="v0.1.3"}
|
||||
|
||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
||||
# logging them with `console.error`. This is great for development, but requires
|
||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
||||
# code size when deploying.
|
||||
console_error_panic_hook = { version = "0.1.1", optional = true }
|
||||
|
||||
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
|
||||
# compared to the default allocator's ~10K. It is slower than the default
|
||||
# allocator, however.
|
||||
#
|
||||
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
|
||||
wee_alloc = { version = "0.4.2", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.2"
|
||||
|
||||
[profile.release]
|
||||
# Tell `rustc` to optimize for small code size.
|
||||
opt-level = "s"
|
||||
lto = true
|
||||
201
codecs/hqx/LICENSE.codec.md
Normal file
201
codecs/hqx/LICENSE.codec.md
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
5
codecs/hqx/README.md
Normal file
5
codecs/hqx/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# HQX
|
||||
|
||||
- Source: <https://github.com/CryZe/wasmboy-rs>
|
||||
- Version: v0.1.2
|
||||
- License: Apache 2.0
|
||||
4
codecs/hqx/package-lock.json
generated
Normal file
4
codecs/hqx/package-lock.json
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "hqx",
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
6
codecs/hqx/package.json
Normal file
6
codecs/hqx/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "hqx",
|
||||
"scripts": {
|
||||
"build": "../build-rust.sh"
|
||||
}
|
||||
}
|
||||
5
codecs/hqx/pkg/README.md
Normal file
5
codecs/hqx/pkg/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# HQX
|
||||
|
||||
- Source: <https://github.com/CryZe/wasmboy-rs>
|
||||
- Version: v0.1.2
|
||||
- License: Apache 2.0
|
||||
15
codecs/hqx/pkg/package.json
Normal file
15
codecs/hqx/pkg/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "squooshhqx",
|
||||
"collaborators": [
|
||||
"Surma <surma@surma.link>"
|
||||
],
|
||||
"version": "0.1.0",
|
||||
"files": [
|
||||
"squooshhqx_bg.wasm",
|
||||
"squooshhqx.js",
|
||||
"squooshhqx.d.ts"
|
||||
],
|
||||
"module": "squooshhqx.js",
|
||||
"types": "squooshhqx.d.ts",
|
||||
"sideEffects": false
|
||||
}
|
||||
30
codecs/hqx/pkg/squooshhqx.d.ts
generated
vendored
Normal file
30
codecs/hqx/pkg/squooshhqx.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* @param {Uint32Array} input_image
|
||||
* @param {number} input_width
|
||||
* @param {number} input_height
|
||||
* @param {number} factor
|
||||
* @returns {Uint32Array}
|
||||
*/
|
||||
export function resize(input_image: Uint32Array, input_width: number, input_height: number, factor: number): Uint32Array;
|
||||
|
||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||
|
||||
export interface InitOutput {
|
||||
readonly memory: WebAssembly.Memory;
|
||||
readonly resize: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
||||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
||||
readonly __wbindgen_malloc: (a: number) => number;
|
||||
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
||||
* for everything else, calls `WebAssembly.instantiate` directly.
|
||||
*
|
||||
* @param {InitInput | Promise<InitInput>} module_or_path
|
||||
*
|
||||
* @returns {Promise<InitOutput>}
|
||||
*/
|
||||
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
||||
108
codecs/hqx/pkg/squooshhqx.js
generated
Normal file
108
codecs/hqx/pkg/squooshhqx.js
generated
Normal file
@@ -0,0 +1,108 @@
|
||||
|
||||
let wasm;
|
||||
|
||||
let cachegetUint32Memory0 = null;
|
||||
function getUint32Memory0() {
|
||||
if (cachegetUint32Memory0 === null || cachegetUint32Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint32Memory0;
|
||||
}
|
||||
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
|
||||
function passArray32ToWasm0(arg, malloc) {
|
||||
const ptr = malloc(arg.length * 4);
|
||||
getUint32Memory0().set(arg, ptr / 4);
|
||||
WASM_VECTOR_LEN = arg.length;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
let cachegetInt32Memory0 = null;
|
||||
function getInt32Memory0() {
|
||||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetInt32Memory0;
|
||||
}
|
||||
|
||||
function getArrayU32FromWasm0(ptr, len) {
|
||||
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
||||
}
|
||||
/**
|
||||
* @param {Uint32Array} input_image
|
||||
* @param {number} input_width
|
||||
* @param {number} input_height
|
||||
* @param {number} factor
|
||||
* @returns {Uint32Array}
|
||||
*/
|
||||
export function resize(input_image, input_width, input_height, factor) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
var ptr0 = passArray32ToWasm0(input_image, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.resize(retptr, ptr0, len0, input_width, input_height, factor);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 4);
|
||||
return v1;
|
||||
} finally {
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
}
|
||||
}
|
||||
|
||||
async function load(module, imports) {
|
||||
if (typeof Response === 'function' && module instanceof Response) {
|
||||
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||
try {
|
||||
return await WebAssembly.instantiateStreaming(module, imports);
|
||||
|
||||
} catch (e) {
|
||||
if (module.headers.get('Content-Type') != 'application/wasm') {
|
||||
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
||||
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const bytes = await module.arrayBuffer();
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
|
||||
} else {
|
||||
const instance = await WebAssembly.instantiate(module, imports);
|
||||
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
return { instance, module };
|
||||
|
||||
} else {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function init(input) {
|
||||
if (typeof input === 'undefined') {
|
||||
input = new URL('squooshhqx_bg.wasm', import.meta.url);
|
||||
}
|
||||
const imports = {};
|
||||
|
||||
|
||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||
input = fetch(input);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const { instance, module } = await load(await input, imports);
|
||||
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
|
||||
return wasm;
|
||||
}
|
||||
|
||||
export default init;
|
||||
|
||||
BIN
codecs/hqx/pkg/squooshhqx_bg.wasm
Normal file
BIN
codecs/hqx/pkg/squooshhqx_bg.wasm
Normal file
Binary file not shown.
55
codecs/hqx/src/lib.rs
Normal file
55
codecs/hqx/src/lib.rs
Normal file
@@ -0,0 +1,55 @@
|
||||
extern crate cfg_if;
|
||||
extern crate hqx;
|
||||
extern crate wasm_bindgen;
|
||||
|
||||
mod utils;
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
cfg_if! {
|
||||
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
|
||||
// allocator.
|
||||
if #[cfg(feature = "wee_alloc")] {
|
||||
extern crate wee_alloc;
|
||||
#[global_allocator]
|
||||
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
#[no_mangle]
|
||||
pub fn resize(
|
||||
input_image: Vec<u32>,
|
||||
input_width: usize,
|
||||
input_height: usize,
|
||||
factor: usize,
|
||||
) -> Vec<u32> {
|
||||
let num_output_pixels = input_width * input_height * factor * factor;
|
||||
let mut output_image = Vec::<u32>::with_capacity(num_output_pixels * 4);
|
||||
output_image.resize(num_output_pixels, 0);
|
||||
|
||||
match factor {
|
||||
2 => hqx::hq2x(
|
||||
input_image.as_slice(),
|
||||
output_image.as_mut_slice(),
|
||||
input_width,
|
||||
input_height,
|
||||
),
|
||||
3 => hqx::hq3x(
|
||||
input_image.as_slice(),
|
||||
output_image.as_mut_slice(),
|
||||
input_width,
|
||||
input_height,
|
||||
),
|
||||
4 => hqx::hq4x(
|
||||
input_image.as_slice(),
|
||||
output_image.as_mut_slice(),
|
||||
input_width,
|
||||
input_height,
|
||||
),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
return output_image;
|
||||
}
|
||||
17
codecs/hqx/src/utils.rs
Normal file
17
codecs/hqx/src/utils.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
cfg_if! {
|
||||
// When the `console_error_panic_hook` feature is enabled, we can call the
|
||||
// `set_panic_hook` function at least once during initialization, and then
|
||||
// we will get better error messages if our code ever panics.
|
||||
//
|
||||
// For more details see
|
||||
// https://github.com/rustwasm/console_error_panic_hook#readme
|
||||
if #[cfg(feature = "console_error_panic_hook")] {
|
||||
extern crate console_error_panic_hook;
|
||||
pub use self::console_error_panic_hook::set_once as set_panic_hook;
|
||||
} else {
|
||||
#[inline]
|
||||
pub fn set_panic_hook() {}
|
||||
}
|
||||
}
|
||||
641
codecs/imagequant/LICENSE.codec.md
Normal file
641
codecs/imagequant/LICENSE.codec.md
Normal file
@@ -0,0 +1,641 @@
|
||||
|
||||
libimagequant is derived from code by Jef Poskanzer and Greg Roelofs
|
||||
licensed under pngquant's original license (at the end of this file),
|
||||
and contains extensive changes and additions by Kornel Lesiński
|
||||
licensed under GPL v3 or later.
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
libimagequant © 2009-2018 by Kornel Lesiński.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
© 1989, 1991 by Jef Poskanzer.
|
||||
© 1997, 2000, 2002 by Greg Roelofs.
|
||||
|
||||
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.
|
||||
41
codecs/imagequant/Makefile
Normal file
41
codecs/imagequant/Makefile
Normal file
@@ -0,0 +1,41 @@
|
||||
CODEC_URL := https://github.com/ImageOptim/libimagequant/archive/2.12.1.tar.gz
|
||||
CODEC_DIR := node_modules/libimagequant
|
||||
CODEC_OUT_RELATIVE := libimagequant.a
|
||||
CODEC_OUT := $(addprefix $(CODEC_DIR)/, $(CODEC_OUT_RELATIVE))
|
||||
OUT_JS := imagequant.js imagequant_node.js
|
||||
OUT_WASM := $(OUT_JS:.js=.wasm)
|
||||
ENVIRONMENT = worker
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(OUT_JS)
|
||||
|
||||
imagequant_node.js: ENVIRONMENT=node
|
||||
$(OUT_JS): $(CODEC_OUT)
|
||||
$(CXX) \
|
||||
-I $(CODEC_DIR) \
|
||||
${CXXFLAGS} \
|
||||
${LDFLAGS} \
|
||||
--bind \
|
||||
-s ENVIRONMENT=$(ENVIRONMENT) \
|
||||
-s EXPORT_ES6=1 \
|
||||
-o $@ \
|
||||
$+ \
|
||||
imagequant.cpp
|
||||
|
||||
$(CODEC_OUT): $(CODEC_DIR)/config.mk
|
||||
$(MAKE) -C $(CODEC_DIR) $(CODEC_OUT_RELATIVE)
|
||||
|
||||
$(CODEC_DIR)/config.mk: $(CODEC_DIR)/configure
|
||||
cd $(CODEC_DIR) && ./configure \
|
||||
--disable-sse
|
||||
|
||||
$(CODEC_DIR)/configure: $(CODEC_DIR)
|
||||
|
||||
$(CODEC_DIR):
|
||||
mkdir -p $@
|
||||
curl -sL $(CODEC_URL) | tar xz --strip 1 -C $@
|
||||
|
||||
clean:
|
||||
$(RM) $(OUT_JS) $(OUT_WASM)
|
||||
$(MAKE) -C $(CODEC_DIR) clean
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
- Source: <https://github.com/ImageOptim/libimagequant>
|
||||
- Version: v2.12.1
|
||||
- License: GPL3
|
||||
|
||||
## Dependencies
|
||||
|
||||
@@ -24,7 +25,3 @@ Quantizes the given images, using at most `numColors`, a value between 2 and 256
|
||||
### `RawImage zx_quantize(std::string buffer, int image_width, int image_height, float dithering)`
|
||||
|
||||
???
|
||||
|
||||
### `void free_result()`
|
||||
|
||||
Frees the result created by `quantize()`.
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
export OPTIMIZE="-Os"
|
||||
export LDFLAGS="${OPTIMIZE}"
|
||||
export CFLAGS="${OPTIMIZE}"
|
||||
export CPPFLAGS="${OPTIMIZE}"
|
||||
|
||||
echo "============================================="
|
||||
echo "Compiling libimagequant"
|
||||
echo "============================================="
|
||||
(
|
||||
emcc \
|
||||
--bind \
|
||||
${OPTIMIZE} \
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s MODULARIZE=1 \
|
||||
-s 'EXPORT_NAME="imagequant"' \
|
||||
-I node_modules/libimagequant \
|
||||
--std=c99 \
|
||||
-c \
|
||||
node_modules/libimagequant/{libimagequant,pam,mediancut,blur,mempool,kmeans,nearest}.c
|
||||
)
|
||||
echo "============================================="
|
||||
echo "Compiling wasm module"
|
||||
echo "============================================="
|
||||
(
|
||||
emcc \
|
||||
--bind \
|
||||
${OPTIMIZE} \
|
||||
-s ALLOW_MEMORY_GROWTH=1 \
|
||||
-s MODULARIZE=1 \
|
||||
-s 'EXPORT_NAME="imagequant"' \
|
||||
-I node_modules/libimagequant \
|
||||
-o ./imagequant.js \
|
||||
--std=c++11 *.o \
|
||||
-x c++ \
|
||||
imagequant.cpp
|
||||
)
|
||||
echo "============================================="
|
||||
echo "Compiling wasm module done"
|
||||
echo "============================================="
|
||||
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
echo "Did you update your docker image?"
|
||||
echo "Run \`docker pull trzeci/emscripten\`"
|
||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||
@@ -1,18 +1,17 @@
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<style>
|
||||
canvas {
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
</style>
|
||||
<script src='imagequant.js'></script>
|
||||
<script>
|
||||
const Module = imagequant();
|
||||
<script type="module">
|
||||
import imagequant from './imagequant.js';
|
||||
|
||||
async function loadImage(src) {
|
||||
// Load image
|
||||
const img = document.createElement('img');
|
||||
img.src = src;
|
||||
await new Promise(resolve => img.onload = resolve);
|
||||
await new Promise((resolve) => (img.onload = resolve));
|
||||
// Make canvas same size as image
|
||||
const canvas = document.createElement('canvas');
|
||||
[canvas.width, canvas.height] = [img.width, img.height];
|
||||
@@ -22,20 +21,32 @@
|
||||
return ctx.getImageData(0, 0, img.width, img.height);
|
||||
}
|
||||
|
||||
Module.onRuntimeInitialized = async _ => {
|
||||
console.log('Version:', Module.version().toString(16));
|
||||
const image = await loadImage('../example.png');
|
||||
// const rawImage = Module.quantize(image.data, image.width, image.height, 256, 1.0);
|
||||
const rawImage = Module.zx_quantize(image.data, image.width, image.height, 1.0);
|
||||
console.log('done');
|
||||
Module.free_result();
|
||||
async function main() {
|
||||
const module = await imagequant();
|
||||
|
||||
const imageData = new ImageData(new Uint8ClampedArray(rawImage.buffer), rawImage.width, rawImage.height);
|
||||
console.log('Version:', module.version().toString(16));
|
||||
const image = await loadImage('../example.png');
|
||||
const rawImage = module.quantize(
|
||||
image.data,
|
||||
image.width,
|
||||
image.height,
|
||||
256,
|
||||
1.0,
|
||||
);
|
||||
console.log('done');
|
||||
|
||||
const imageData = new ImageData(
|
||||
new Uint8ClampedArray(rawImage.buffer),
|
||||
image.width,
|
||||
image.height,
|
||||
);
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.putImageData(imageData, 0, 0);
|
||||
document.body.appendChild(canvas);
|
||||
};
|
||||
}
|
||||
|
||||
main();
|
||||
</script>
|
||||
|
||||
@@ -1,95 +1,87 @@
|
||||
#include "emscripten/bind.h"
|
||||
#include "emscripten/val.h"
|
||||
#include <stdlib.h>
|
||||
#include <emscripten/bind.h>
|
||||
#include <emscripten/val.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libimagequant.h"
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
int version() {
|
||||
return (((LIQ_VERSION/10000) % 100) << 16) |
|
||||
(((LIQ_VERSION/100 ) % 100) << 8) |
|
||||
(((LIQ_VERSION/1 ) % 100) << 0);
|
||||
return (((LIQ_VERSION / 10000) % 100) << 16) | (((LIQ_VERSION / 100) % 100) << 8) |
|
||||
(((LIQ_VERSION / 1) % 100) << 0);
|
||||
}
|
||||
|
||||
class RawImage {
|
||||
public:
|
||||
val buffer;
|
||||
int width;
|
||||
int height;
|
||||
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
|
||||
|
||||
RawImage(val b, int w, int h)
|
||||
: buffer(b), width(w), height(h) {}
|
||||
};
|
||||
#define liq_ptr(T) std::unique_ptr<T, std::integral_constant<decltype(&T##_destroy), T##_destroy>>
|
||||
|
||||
using liq_attr_ptr = liq_ptr(liq_attr);
|
||||
using liq_image_ptr = liq_ptr(liq_image);
|
||||
using liq_result_ptr = liq_ptr(liq_result);
|
||||
|
||||
liq_attr *attr;
|
||||
liq_image *image;
|
||||
liq_result *res;
|
||||
uint8_t* result;
|
||||
RawImage quantize(std::string rawimage, int image_width, int image_height, int num_colors, float dithering) {
|
||||
const uint8_t* image_buffer = (uint8_t*)rawimage.c_str();
|
||||
int size = image_width * image_height;
|
||||
attr = liq_attr_create();
|
||||
image = liq_image_create_rgba(attr, image_buffer, image_width, image_height, 0);
|
||||
liq_set_max_colors(attr, num_colors);
|
||||
liq_result_ptr liq_image_quantize(liq_image* image, liq_attr* attr) {
|
||||
liq_result* res = nullptr;
|
||||
liq_image_quantize(image, attr, &res);
|
||||
liq_set_dithering_level(res, dithering);
|
||||
uint8_t* image8bit = (uint8_t*) malloc(size);
|
||||
result = (uint8_t*) malloc(size * 4);
|
||||
liq_write_remapped_image(res, image, image8bit, size);
|
||||
const liq_palette *pal = liq_get_palette(res);
|
||||
return liq_result_ptr(res);
|
||||
}
|
||||
|
||||
val quantize(std::string rawimage,
|
||||
int image_width,
|
||||
int image_height,
|
||||
int num_colors,
|
||||
float dithering) {
|
||||
auto image_buffer = (const liq_color*)rawimage.c_str();
|
||||
int size = image_width * image_height;
|
||||
liq_attr_ptr attr(liq_attr_create());
|
||||
liq_image_ptr image(
|
||||
liq_image_create_rgba(attr.get(), image_buffer, image_width, image_height, 0));
|
||||
liq_set_max_colors(attr.get(), num_colors);
|
||||
auto res = liq_image_quantize(image.get(), attr.get());
|
||||
liq_set_dithering_level(res.get(), dithering);
|
||||
std::vector<uint8_t> image8bit(size);
|
||||
std::vector<liq_color> result(size);
|
||||
liq_write_remapped_image(res.get(), image.get(), image8bit.data(), image8bit.size());
|
||||
auto pal = liq_get_palette(res.get());
|
||||
// Turn palletted image back into an RGBA image
|
||||
for(int i = 0; i < size; i++) {
|
||||
result[i * 4 + 0] = pal->entries[image8bit[i]].r;
|
||||
result[i * 4 + 1] = pal->entries[image8bit[i]].g;
|
||||
result[i * 4 + 2] = pal->entries[image8bit[i]].b;
|
||||
result[i * 4 + 3] = pal->entries[image8bit[i]].a;
|
||||
for (int i = 0; i < size; i++) {
|
||||
result[i] = pal->entries[image8bit[i]];
|
||||
}
|
||||
free(image8bit);
|
||||
liq_result_destroy(res);
|
||||
liq_image_destroy(image);
|
||||
liq_attr_destroy(attr);
|
||||
return {
|
||||
val(typed_memory_view(image_width*image_height*4, result)),
|
||||
image_width,
|
||||
image_height
|
||||
};
|
||||
return Uint8ClampedArray.new_(
|
||||
typed_memory_view(result.size() * sizeof(liq_color), (const uint8_t*)result.data()));
|
||||
}
|
||||
|
||||
const liq_color zx_colors[] = {
|
||||
{.a = 255, .r = 0, .g = 0, .b = 0}, // regular black
|
||||
{.a = 255, .r = 0, .g = 0, .b = 215}, // regular blue
|
||||
{.a = 255, .r = 215, .g = 0, .b = 0}, // regular red
|
||||
{.a = 255, .r = 215, .g = 0, .b = 215}, // regular magenta
|
||||
{.a = 255, .r = 0, .g = 215, .b = 0}, // regular green
|
||||
{.a = 255, .r = 0, .g = 215, .b = 215}, // regular cyan
|
||||
{.a = 255, .r = 215, .g = 215, .b = 0}, // regular yellow
|
||||
{.a = 255, .r = 215, .g = 215, .b = 215}, // regular white
|
||||
{.a = 255, .r = 0, .g = 0, .b = 255}, // bright blue
|
||||
{.a = 255, .r = 255, .g = 0, .b = 0}, // bright red
|
||||
{.a = 255, .r = 255, .g = 0, .b = 255}, // bright magenta
|
||||
{.a = 255, .r = 0, .g = 255, .b = 0}, // bright green
|
||||
{.a = 255, .r = 0, .g = 255, .b = 255}, // bright cyan
|
||||
{.a = 255, .r = 255, .g = 255, .b = 0}, // bright yellow
|
||||
{.a = 255, .r = 255, .g = 255, .b = 255} // bright white
|
||||
{.r = 0, .g = 0, .b = 0, .a = 255}, // regular black
|
||||
{.r = 0, .g = 0, .b = 215, .a = 255}, // regular blue
|
||||
{.r = 215, .g = 0, .b = 0, .a = 255}, // regular red
|
||||
{.r = 215, .g = 0, .b = 215, .a = 255}, // regular magenta
|
||||
{.r = 0, .g = 215, .b = 0, .a = 255}, // regular green
|
||||
{.r = 0, .g = 215, .b = 215, .a = 255}, // regular cyan
|
||||
{.r = 215, .g = 215, .b = 0, .a = 255}, // regular yellow
|
||||
{.r = 215, .g = 215, .b = 215, .a = 255}, // regular white
|
||||
{.r = 0, .g = 0, .b = 255, .a = 255}, // bright blue
|
||||
{.r = 255, .g = 0, .b = 0, .a = 255}, // bright red
|
||||
{.r = 255, .g = 0, .b = 255, .a = 255}, // bright magenta
|
||||
{.r = 0, .g = 255, .b = 0, .a = 255}, // bright green
|
||||
{.r = 0, .g = 255, .b = 255, .a = 255}, // bright cyan
|
||||
{.r = 255, .g = 255, .b = 0, .a = 255}, // bright yellow
|
||||
{.r = 255, .g = 255, .b = 255, .a = 255} // bright white
|
||||
};
|
||||
|
||||
uint8_t block[8 * 8 * 4];
|
||||
|
||||
/**
|
||||
* The ZX has one bit per pixel, but can assign two colours to an 8x8 block. The two colours must
|
||||
* both be 'regular' or 'bright'. Black exists as both regular and bright.
|
||||
* The ZX has one bit per pixel, but can assign two colours to an 8x8 block. The
|
||||
* two colours must both be 'regular' or 'bright'. Black exists as both regular
|
||||
* and bright.
|
||||
*/
|
||||
RawImage zx_quantize(std::string rawimage, int image_width, int image_height, float dithering) {
|
||||
const uint8_t* image_buffer = (uint8_t*) rawimage.c_str();
|
||||
val zx_quantize(std::string rawimage, int image_width, int image_height, float dithering) {
|
||||
auto image_buffer = (const liq_color*)rawimage.c_str();
|
||||
int size = image_width * image_height;
|
||||
int bytes_per_pixel = 4;
|
||||
result = (uint8_t*) malloc(size * bytes_per_pixel);
|
||||
uint8_t* image8bit = (uint8_t*) malloc(8 * 8);
|
||||
liq_color block[8 * 8];
|
||||
uint8_t image8bit[8 * 8];
|
||||
std::vector<liq_color> result(size);
|
||||
|
||||
// For each 8x8 grid
|
||||
for (int block_start_y = 0; block_start_y < image_height; block_start_y += 8) {
|
||||
@@ -99,7 +91,8 @@ RawImage zx_quantize(std::string rawimage, int image_width, int image_height, fl
|
||||
int block_width = 8;
|
||||
int block_height = 8;
|
||||
|
||||
// If the block hangs off the right/bottom of the image dimensions, make it smaller to fit.
|
||||
// If the block hangs off the right/bottom of the image dimensions, make
|
||||
// it smaller to fit.
|
||||
if (block_start_y + block_height > image_height) {
|
||||
block_height = image_height - block_start_y;
|
||||
}
|
||||
@@ -111,26 +104,22 @@ RawImage zx_quantize(std::string rawimage, int image_width, int image_height, fl
|
||||
// For each pixel in that block:
|
||||
for (int y = block_start_y; y < block_start_y + block_height; y++) {
|
||||
for (int x = block_start_x; x < block_start_x + block_width; x++) {
|
||||
int pixel_start = (y * image_width * bytes_per_pixel) + (x * bytes_per_pixel);
|
||||
int pixel_start = (y * image_width) + x;
|
||||
int smallest_distance = INT_MAX;
|
||||
int winning_index = -1;
|
||||
|
||||
// Copy pixel data for quantizing later
|
||||
block[block_index++] = image_buffer[pixel_start];
|
||||
block[block_index++] = image_buffer[pixel_start + 1];
|
||||
block[block_index++] = image_buffer[pixel_start + 2];
|
||||
block[block_index++] = image_buffer[pixel_start + 3];
|
||||
|
||||
// Which zx color is this pixel closest to?
|
||||
for (int color_index = 0; color_index < 15; color_index++) {
|
||||
liq_color color = zx_colors[color_index];
|
||||
liq_color pixel = image_buffer[pixel_start];
|
||||
|
||||
// Using Euclidean distance. LibQuant has better methods, but it requires conversion to
|
||||
// LAB, so I don't think it's worth it.
|
||||
// Using Euclidean distance. LibQuant has better methods, but it
|
||||
// requires conversion to LAB, so I don't think it's worth it.
|
||||
int distance =
|
||||
pow(color.r - image_buffer[pixel_start + 0], 2) +
|
||||
pow(color.g - image_buffer[pixel_start + 1], 2) +
|
||||
pow(color.b - image_buffer[pixel_start + 2], 2);
|
||||
pow(color.r - pixel.r, 2) + pow(color.g - pixel.g, 2) + pow(color.b - pixel.b, 2);
|
||||
|
||||
if (distance < smallest_distance) {
|
||||
winning_index = color_index;
|
||||
@@ -151,7 +140,8 @@ RawImage zx_quantize(std::string rawimage, int image_width, int image_height, fl
|
||||
|
||||
for (int color_index = 0; color_index < 15; color_index++) {
|
||||
if (color_popularity[color_index] > highest_popularity) {
|
||||
// Store this as the most popular pixel, and demote the current values:
|
||||
// Store this as the most popular pixel, and demote the current
|
||||
// values:
|
||||
third_color_index = second_color_index;
|
||||
third_highest_popularity = second_highest_popularity;
|
||||
second_color_index = first_color_index;
|
||||
@@ -169,8 +159,8 @@ RawImage zx_quantize(std::string rawimage, int image_width, int image_height, fl
|
||||
}
|
||||
}
|
||||
|
||||
// ZX images can't mix bright and regular colours, except black which appears in both.
|
||||
// Resolve any conflict:
|
||||
// ZX images can't mix bright and regular colours, except black which
|
||||
// appears in both. Resolve any conflict:
|
||||
while (1) {
|
||||
// If either colour is black, there's no conflict to resolve.
|
||||
if (first_color_index != 0 && second_color_index != 0) {
|
||||
@@ -183,63 +173,44 @@ RawImage zx_quantize(std::string rawimage, int image_width, int image_height, fl
|
||||
}
|
||||
}
|
||||
|
||||
// If, during conflict resolving, we now have two of the same colour (because we initially
|
||||
// selected the bright & regular version of the same colour), retry again with the third
|
||||
// most popular colour.
|
||||
// If, during conflict resolving, we now have two of the same colour
|
||||
// (because we initially selected the bright & regular version of the
|
||||
// same colour), retry again with the third most popular colour.
|
||||
if (first_color_index == second_color_index) {
|
||||
second_color_index = third_color_index;
|
||||
} else break;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
// Quantize
|
||||
attr = liq_attr_create();
|
||||
image = liq_image_create_rgba(attr, block, block_width, block_height, 0);
|
||||
liq_set_max_colors(attr, 2);
|
||||
liq_image_add_fixed_color(image, zx_colors[first_color_index]);
|
||||
liq_image_add_fixed_color(image, zx_colors[second_color_index]);
|
||||
liq_image_quantize(image, attr, &res);
|
||||
liq_set_dithering_level(res, dithering);
|
||||
liq_write_remapped_image(res, image, image8bit, size);
|
||||
const liq_palette *pal = liq_get_palette(res);
|
||||
liq_attr_ptr attr(liq_attr_create());
|
||||
liq_image_ptr image(liq_image_create_rgba(attr.get(), block, block_width, block_height, 0));
|
||||
liq_set_max_colors(attr.get(), 2);
|
||||
liq_image_add_fixed_color(image.get(), zx_colors[first_color_index]);
|
||||
liq_image_add_fixed_color(image.get(), zx_colors[second_color_index]);
|
||||
auto res = liq_image_quantize(image.get(), attr.get());
|
||||
liq_set_dithering_level(res.get(), dithering);
|
||||
liq_write_remapped_image(res.get(), image.get(), image8bit, size);
|
||||
auto pal = liq_get_palette(res.get());
|
||||
|
||||
// Turn palletted image back into an RGBA image, and write it into the full size result image.
|
||||
for(int y = 0; y < block_height; y++) {
|
||||
for(int x = 0; x < block_width; x++) {
|
||||
// Turn palletted image back into an RGBA image, and write it into the
|
||||
// full size result image.
|
||||
for (int y = 0; y < block_height; y++) {
|
||||
for (int x = 0; x < block_width; x++) {
|
||||
int image8BitPos = y * block_width + x;
|
||||
int resultStartPos = ((block_start_y + y) * bytes_per_pixel * image_width) + ((block_start_x + x) * bytes_per_pixel);
|
||||
result[resultStartPos + 0] = pal->entries[image8bit[image8BitPos]].r;
|
||||
result[resultStartPos + 1] = pal->entries[image8bit[image8BitPos]].g;
|
||||
result[resultStartPos + 2] = pal->entries[image8bit[image8BitPos]].b;
|
||||
result[resultStartPos + 3] = pal->entries[image8bit[image8BitPos]].a;
|
||||
int resultStartPos = ((block_start_y + y) * image_width) + (block_start_x + x);
|
||||
result[resultStartPos] = pal->entries[image8bit[image8BitPos]];
|
||||
}
|
||||
}
|
||||
|
||||
liq_result_destroy(res);
|
||||
liq_image_destroy(image);
|
||||
liq_attr_destroy(attr);
|
||||
}
|
||||
}
|
||||
|
||||
free(image8bit);
|
||||
return {
|
||||
val(typed_memory_view(image_width*image_height*4, result)),
|
||||
image_width,
|
||||
image_height
|
||||
};
|
||||
}
|
||||
|
||||
void free_result() {
|
||||
free(result);
|
||||
return Uint8ClampedArray.new_(
|
||||
typed_memory_view(result.size() * sizeof(liq_color), (const uint8_t*)result.data()));
|
||||
}
|
||||
|
||||
EMSCRIPTEN_BINDINGS(my_module) {
|
||||
class_<RawImage>("RawImage")
|
||||
.property("buffer", &RawImage::buffer)
|
||||
.property("width", &RawImage::width)
|
||||
.property("height", &RawImage::height);
|
||||
|
||||
function("quantize", &quantize);
|
||||
function("zx_quantize", &zx_quantize);
|
||||
function("version", &version);
|
||||
function("free_result", &free_result);
|
||||
}
|
||||
|
||||
28
codecs/imagequant/imagequant.d.ts
vendored
28
codecs/imagequant/imagequant.d.ts
vendored
@@ -1,15 +1,19 @@
|
||||
interface RawImage {
|
||||
buffer: Uint8Array;
|
||||
width: number;
|
||||
height: number;
|
||||
export interface QuantizerModule extends EmscriptenWasm.Module {
|
||||
quantize(
|
||||
data: BufferSource,
|
||||
width: number,
|
||||
height: number,
|
||||
numColors: number,
|
||||
dither: number,
|
||||
): Uint8ClampedArray;
|
||||
zx_quantize(
|
||||
data: BufferSource,
|
||||
width: number,
|
||||
height: number,
|
||||
dither: number,
|
||||
): Uint8ClampedArray;
|
||||
}
|
||||
|
||||
interface QuantizerModule extends EmscriptenWasm.Module {
|
||||
quantize(data: BufferSource, width: number, height: number, numColors: number, dither: number): RawImage;
|
||||
zx_quantize(data: BufferSource, width: number, height: number, dither: number): RawImage;
|
||||
free_result(): void;
|
||||
}
|
||||
|
||||
export default function(opts: EmscriptenWasm.ModuleOpts): QuantizerModule;
|
||||
|
||||
declare var moduleFactory: EmscriptenWasm.ModuleFactory<QuantizerModule>;
|
||||
|
||||
export default moduleFactory;
|
||||
|
||||
61
codecs/imagequant/imagequant.js
generated
61
codecs/imagequant/imagequant.js
generated
File diff suppressed because one or more lines are too long
BIN
codecs/imagequant/imagequant.wasm
Normal file → Executable file
BIN
codecs/imagequant/imagequant.wasm
Normal file → Executable file
Binary file not shown.
55
codecs/imagequant/imagequant_node.js
generated
Normal file
55
codecs/imagequant/imagequant_node.js
generated
Normal file
@@ -0,0 +1,55 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var e;e||(e=typeof Module !== 'undefined' ? Module : {});var aa,r;e.ready=new Promise(function(a,b){aa=a;r=b});var t={},u;for(u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);var ba,v,w,y;ba=function(a){w||(w=require("fs"));y||(y=require("path"));a=y.normalize(a);return w.readFileSync(a,null)};v=function(a){a=ba(a);a.buffer||(a=new Uint8Array(a));a.buffer||z("Assertion failed: undefined");return a};1<process.argv.length&&process.argv[1].replace(/\\/g,"/");process.argv.slice(2);
|
||||
process.on("uncaughtException",function(a){throw a;});process.on("unhandledRejection",z);e.inspect=function(){return"[Emscripten Module object]"};var ca=e.print||console.log.bind(console),A=e.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(e[u]=t[u]);t=null;var C;e.wasmBinary&&(C=e.wasmBinary);var noExitRuntime=e.noExitRuntime||!0;"object"!==typeof WebAssembly&&z("no native wasm support detected");var D,da=!1,ea=new TextDecoder("utf8");
|
||||
function fa(a,b,c){var d=E;if(0<c){c=b+c-1;for(var g=0;g<a.length;++g){var f=a.charCodeAt(g);if(55296<=f&&57343>=f){var l=a.charCodeAt(++g);f=65536+((f&1023)<<10)|l&1023}if(127>=f){if(b>=c)break;d[b++]=f}else{if(2047>=f){if(b+1>=c)break;d[b++]=192|f>>6}else{if(65535>=f){if(b+2>=c)break;d[b++]=224|f>>12}else{if(b+3>=c)break;d[b++]=240|f>>18;d[b++]=128|f>>12&63}d[b++]=128|f>>6&63}d[b++]=128|f&63}}d[b]=0}}var ha=new TextDecoder("utf-16le");
|
||||
function ia(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&G[c];)++c;return ha.decode(E.subarray(a,c<<1))}function ja(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var g=0;g<c;++g)H[b>>1]=a.charCodeAt(g),b+=2;H[b>>1]=0;return b-d}function ka(a){return 2*a.length}function la(a,b){for(var c=0,d="";!(c>=b/4);){var g=I[a+4*c>>2];if(0==g)break;++c;65536<=g?(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023)):d+=String.fromCharCode(g)}return d}
|
||||
function ma(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var g=0;g<a.length;++g){var f=a.charCodeAt(g);if(55296<=f&&57343>=f){var l=a.charCodeAt(++g);f=65536+((f&1023)<<10)|l&1023}I[b>>2]=f;b+=4;if(b+4>c)break}I[b>>2]=0;return b-d}function na(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var oa,pa,E,H,G,I,K,qa,ra;
|
||||
function sa(){var a=D.buffer;oa=a;e.HEAP8=pa=new Int8Array(a);e.HEAP16=H=new Int16Array(a);e.HEAP32=I=new Int32Array(a);e.HEAPU8=E=new Uint8Array(a);e.HEAPU16=G=new Uint16Array(a);e.HEAPU32=K=new Uint32Array(a);e.HEAPF32=qa=new Float32Array(a);e.HEAPF64=ra=new Float64Array(a)}var L,ta=[],ua=[],va=[];function wa(){var a=e.preRun.shift();ta.unshift(a)}var M=0,xa=null,N=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function z(a){if(e.onAbort)e.onAbort(a);A(a);da=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");r(a);throw a;}var O=(new URL("imagequant_node.wasm",import.meta.url)).toString();function ya(){return Promise.resolve().then(function(){a:{try{if(O==O&&C){var a=new Uint8Array(C);break a}if(v){a=v(O);break a}throw"both async and sync fetching of the wasm failed";}catch(b){z(b)}a=void 0}return a})}
|
||||
function za(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.L;"number"===typeof c?void 0===b.H?L.get(c)():L.get(c)(b.H):c(void 0===b.H?null:b.H)}}}function Aa(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ba=void 0;function P(a){for(var b="";E[a];)b+=Ba[E[a++]];return b}var Q={},R={},S={};
|
||||
function Ca(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Da(a,b){a=Ca(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function Ea(a){var b=Error,c=Da(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Fa=void 0;function T(a){throw new Fa(a);}var Ga=void 0;
|
||||
function Ha(a,b){function c(h){h=b(h);if(h.length!==d.length)throw new Ga("Mismatched type converter count");for(var k=0;k<d.length;++k)U(d[k],h[k])}var d=[];d.forEach(function(h){S[h]=a});var g=Array(a.length),f=[],l=0;a.forEach(function(h,k){R.hasOwnProperty(h)?g[k]=R[h]:(f.push(h),Q.hasOwnProperty(h)||(Q[h]=[]),Q[h].push(function(){g[k]=R[h];++l;l===f.length&&c(g)}))});0===f.length&&c(g)}
|
||||
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||T('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.K)return;T("Cannot register type '"+d+"' twice")}R[a]=b;delete S[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(g){g()}))}var Ka=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function La(a){4<a&&0===--V[a].I&&(V[a]=void 0,Ka.push(a))}function W(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ka.length?Ka.pop():V.length;V[b]={I:1,value:a};return b}}function Ma(a){return this.fromWireType(K[a>>2])}function Na(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Oa(a,b){switch(b){case 2:return function(c){return this.fromWireType(qa[c>>2])};case 3:return function(c){return this.fromWireType(ra[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Pa(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Da(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Qa(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ra(a,b){var c=e;if(void 0===c[a].F){var d=c[a];c[a]=function(){c[a].F.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].F+")!");return c[a].F[arguments.length].apply(this,arguments)};c[a].F=[];c[a].F[d.J]=d}}
|
||||
function Sa(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].F&&void 0!==e[a].F[c])&&T("Cannot register public name '"+a+"' twice"),Ra(a,a),e.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].F[c]=b):(e[a]=b,void 0!==c&&(e[a].N=c))}function Ta(a,b){for(var c=[],d=0;d<a;d++)c.push(I[(b>>2)+d]);return c}
|
||||
function Ua(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=e["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=L.get(b).apply(null,c);return d}}function Va(a,b){a=P(a);var c=a.includes("j")?Ua(a,b):L.get(b);"function"!==typeof c&&T("unknown function pointer with signature "+a+": "+b);return c}var Wa=void 0;function Xa(a){a=Ya(a);var b=P(a);X(a);return b}
|
||||
function Za(a,b){function c(f){g[f]||R[f]||(S[f]?S[f].forEach(c):(d.push(f),g[f]=!0))}var d=[],g={};b.forEach(c);throw new Wa(a+": "+d.map(Xa).join([", "]));}function $a(a,b,c){switch(b){case 0:return c?function(d){return pa[d]}:function(d){return E[d]};case 1:return c?function(d){return H[d>>1]}:function(d){return G[d>>1]};case 2:return c?function(d){return I[d>>2]}:function(d){return K[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var ab={};
|
||||
function bb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function cb(a,b){var c=R[a];void 0===c&&T(b+" has unknown type "+Xa(a));return c}for(var db={},eb=[null,[],[]],fb=Array(256),Y=0;256>Y;++Y)fb[Y]=String.fromCharCode(Y);Ba=fb;Fa=e.BindingError=Ea("BindingError");Ga=e.InternalError=Ea("InternalError");e.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};
|
||||
e.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};Wa=e.UnboundTypeError=Ea("UnboundTypeError");
|
||||
var hb={m:function(){},q:function(){},n:function(a,b,c,d,g){var f=Aa(c);b=P(b);U(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,h){return h?d:g},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var h=pa;else if(2===c)h=H;else if(4===c)h=I;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[l>>f])},G:null})},v:function(a,b){b=P(b);U(a,{name:b,fromWireType:function(c){var d=V[c].value;La(c);return d},toWireType:function(c,d){return W(d)},
|
||||
argPackAdvance:8,readValueFromPointer:Ma,G:null})},l:function(a,b,c){c=Aa(c);b=P(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,g){if("number"!==typeof g&&"boolean"!==typeof g)throw new TypeError('Cannot convert "'+Na(g)+'" to '+this.name);return g},argPackAdvance:8,readValueFromPointer:Oa(b,c),G:null})},c:function(a,b,c,d,g,f){var l=Ta(b,c);a=P(a);g=Va(d,g);Sa(a,function(){Za("Cannot call "+a+" due to unbound types",l)},b-1);Ha(l,function(h){var k=[h[0],null].concat(h.slice(1)),
|
||||
m=h=a,n=g,p=k.length;2>p&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==k[1]&&!1,B=!1,q=1;q<k.length;++q)if(null!==k[q]&&void 0===k[q].G){B=!0;break}var Ia="void"!==k[0].name,F="",J="";for(q=0;q<p-2;++q)F+=(0!==q?", ":"")+"arg"+q,J+=(0!==q?", ":"")+"arg"+q+"Wired";m="return function "+Ca(m)+"("+F+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";
|
||||
B&&(m+="var destructors = [];\n");var Ja=B?"destructors":"null";F="throwBindingError invoker fn runDestructors retType classParam".split(" ");n=[T,n,f,Qa,k[0],k[1]];x&&(m+="var thisWired = classParam.toWireType("+Ja+", this);\n");for(q=0;q<p-2;++q)m+="var arg"+q+"Wired = argType"+q+".toWireType("+Ja+", arg"+q+"); // "+k[q+2].name+"\n",F.push("argType"+q),n.push(k[q+2]);x&&(J="thisWired"+(0<J.length?", ":"")+J);m+=(Ia?"var rv = ":"")+"invoker(fn"+(0<J.length?", ":"")+J+");\n";if(B)m+="runDestructors(destructors);\n";
|
||||
else for(q=x?1:2;q<k.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==k[q].G&&(m+=p+"_dtor("+p+"); // "+k[q].name+"\n",F.push(p+"_dtor"),n.push(k[q].G));Ia&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");F.push(m+"}\n");k=Pa(F).apply(null,n);q=b-1;if(!e.hasOwnProperty(h))throw new Ga("Replacing nonexistant public symbol");void 0!==e[h].F&&void 0!==q?e[h].F[q]=k:(e[h]=k,e[h].J=q);return[]})},b:function(a,b,c,d,g){function f(m){return m}b=P(b);-1===g&&(g=4294967295);var l=Aa(c);
|
||||
if(0===d){var h=32-8*c;f=function(m){return m<<h>>>h}}var k=b.includes("unsigned");U(a,{name:b,fromWireType:f,toWireType:function(m,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+Na(n)+'" to '+this.name);if(n<d||n>g)throw new TypeError('Passing a number "'+Na(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+g+"]!");return k?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:$a(b,l,0!==d),G:null})},a:function(a,
|
||||
b,c){function d(f){f>>=2;var l=K;return new g(oa,l[f+1],l[f])}var g=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=P(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{K:!0})},h:function(a,b){b=P(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var g=K[d>>2];if(c)for(var f=d+4,l=0;l<=g;++l){var h=d+4+l;if(l==g||0==E[h]){if(f){for(var k=f+(h-f),m=f;!(m>=k)&&E[m];)++m;f=ea.decode(E.subarray(f,m))}else f="";if(void 0===
|
||||
n)var n=f;else n+=String.fromCharCode(0),n+=f;f=h+1}}else{n=Array(g);for(l=0;l<g;++l)n[l]=String.fromCharCode(E[d+4+l]);n=n.join("")}X(d);return n},toWireType:function(d,g){g instanceof ArrayBuffer&&(g=new Uint8Array(g));var f="string"===typeof g;f||g instanceof Uint8Array||g instanceof Uint8ClampedArray||g instanceof Int8Array||T("Cannot pass non-string to std::string");var l=(c&&f?function(){for(var m=0,n=0;n<g.length;++n){var p=g.charCodeAt(n);55296<=p&&57343>=p&&(p=65536+((p&1023)<<10)|g.charCodeAt(++n)&
|
||||
1023);127>=p?++m:m=2047>=p?m+2:65535>=p?m+3:m+4}return m}:function(){return g.length})(),h=gb(4+l+1);K[h>>2]=l;if(c&&f)fa(g,h+4,l+1);else if(f)for(f=0;f<l;++f){var k=g.charCodeAt(f);255<k&&(X(h),T("String has UTF-16 code units that do not fit in 8 bits"));E[h+4+f]=k}else for(f=0;f<l;++f)E[h+4+f]=g[f];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:Ma,G:function(d){X(d)}})},f:function(a,b,c){c=P(c);if(2===b){var d=ia;var g=ja;var f=ka;var l=function(){return G};var h=1}else 4===
|
||||
b&&(d=la,g=ma,f=na,l=function(){return K},h=2);U(a,{name:c,fromWireType:function(k){for(var m=K[k>>2],n=l(),p,x=k+4,B=0;B<=m;++B){var q=k+4+B*b;if(B==m||0==n[q>>h])x=d(x,q-x),void 0===p?p=x:(p+=String.fromCharCode(0),p+=x),x=q+b}X(k);return p},toWireType:function(k,m){"string"!==typeof m&&T("Cannot pass non-string to C++ string type "+c);var n=f(m),p=gb(4+n+b);K[p>>2]=n>>h;g(m,p+4,n+b);null!==k&&k.push(X,p);return p},argPackAdvance:8,readValueFromPointer:Ma,G:function(k){X(k)}})},o:function(a,b){b=
|
||||
P(b);U(a,{M:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},d:La,k:function(a){if(0===a)return W(bb());var b=ab[a];a=void 0===b?P(a):b;return W(bb()[a])},i:function(a){4<a&&(V[a].I+=1)},j:function(a,b,c,d){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var g=db[b];if(!g){g="";for(var f=0;f<b;++f)g+=(0!==f?", ":"")+"arg"+f;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(f=0;f<b;++f)l+="var argType"+f+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||
f+'], "parameter '+f+'");\nvar arg'+f+" = argType"+f+".readValueFromPointer(args);\nargs += argType"+f+"['argPackAdvance'];\n";g=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+g+");\nreturn __emval_register(obj);\n}\n")))(cb,e,W);db[b]=g}return g(a,c,d)},g:function(){z()},s:function(a,b,c){E.copyWithin(a,b,b+c)},e:function(a){var b=E.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,
|
||||
d);0<d%65536&&(d+=65536-d%65536);a:{try{D.grow(Math.min(2147483648,d)-oa.byteLength+65535>>>16);sa();var g=1;break a}catch(f){}g=void 0}if(g)return!0}return!1},t:function(){return 0},p:function(){},u:function(a,b,c,d){for(var g=0,f=0;f<c;f++){for(var l=I[b+8*f>>2],h=I[b+(8*f+4)>>2],k=0;k<h;k++){var m=E[l+k],n=eb[a];if(0===m||10===m){m=1===a?ca:A;var p;for(p=0;n[p]&&!(NaN<=p);)++p;p=ea.decode(n.subarray?n.subarray(0,p):new Uint8Array(n.slice(0,p)));m(p);n.length=0}else n.push(m)}g+=h}I[d>>2]=g;return 0},
|
||||
r:function(){}};
|
||||
(function(){function a(g){e.asm=g.exports;D=e.asm.w;sa();L=e.asm.C;ua.unshift(e.asm.x);M--;e.monitorRunDependencies&&e.monitorRunDependencies(M);0==M&&(null!==xa&&(clearInterval(xa),xa=null),N&&(g=N,N=null,g()))}function b(g){a(g.instance)}function c(g){return ya().then(function(f){return WebAssembly.instantiate(f,d)}).then(g,function(f){A("failed to asynchronously prepare wasm: "+f);z(f)})}var d={a:hb};M++;e.monitorRunDependencies&&e.monitorRunDependencies(M);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(g){return A("Module.instantiateWasm callback failed with error: "+
|
||||
g),!1}(function(){return C||"function"!==typeof WebAssembly.instantiateStreaming||O.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,d).then(b,function(f){A("wasm streaming compile failed: "+f);A("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(r);return{}})();e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.x).apply(null,arguments)};
|
||||
var gb=e._malloc=function(){return(gb=e._malloc=e.asm.y).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.z).apply(null,arguments)},Ya=e.___getTypeName=function(){return(Ya=e.___getTypeName=e.asm.A).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.B).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.D).apply(null,arguments)};var Z;N=function ib(){Z||jb();Z||(N=ib)};
|
||||
function jb(){function a(){if(!Z&&(Z=!0,e.calledRun=!0,!da)){za(ua);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();va.unshift(b)}za(va)}}if(!(0<M)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)wa();za(ta);0<M||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=jb;
|
||||
if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();jb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/imagequant/imagequant_node.wasm
Executable file
BIN
codecs/imagequant/imagequant_node.wasm
Executable file
Binary file not shown.
1145
codecs/imagequant/package-lock.json
generated
1145
codecs/imagequant/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,6 @@
|
||||
{
|
||||
"name": "imagequant",
|
||||
"scripts": {
|
||||
"install": "napa",
|
||||
"build": "docker run --rm -v $(pwd):/src trzeci/emscripten ./build.sh"
|
||||
},
|
||||
"napa": {
|
||||
"libimagequant": "ImageOptim/libimagequant#2.12.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"napa": "3.0.0"
|
||||
"build": "../build-cpp.sh"
|
||||
}
|
||||
}
|
||||
|
||||
90
codecs/jxl/Makefile
Normal file
90
codecs/jxl/Makefile
Normal file
@@ -0,0 +1,90 @@
|
||||
CODEC_URL = https://gitlab.com/wg1/jpeg-xl.git
|
||||
CODEC_VERSION = ab7c5e9b6795134377aa4846ceaae2c5bc504f76
|
||||
CODEC_DIR = node_modules/jxl
|
||||
CODEC_BUILD_ROOT := $(CODEC_DIR)/build
|
||||
CODEC_MT_BUILD_DIR := $(CODEC_BUILD_ROOT)/mt
|
||||
CODEC_MT_SIMD_BUILD_DIR := $(CODEC_BUILD_ROOT)/mt-simd
|
||||
ENVIRONMENT = worker
|
||||
|
||||
OUT_JS = enc/jxl_enc.js enc/jxl_enc_mt.js enc/jxl_enc_mt_simd.js dec/jxl_dec.js enc/jxl_node_enc.js dec/jxl_node_dec.js
|
||||
OUT_WASM = $(OUT_JS:.js=.wasm)
|
||||
OUT_WORKER = $(OUT_JS:.js=.worker.js)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(OUT_JS)
|
||||
|
||||
# Define dependencies for all variations of build artifacts.
|
||||
$(filter enc/%,$(OUT_JS)): enc/jxl_enc.cpp
|
||||
$(filter dec/%,$(OUT_JS)): dec/jxl_dec.cpp
|
||||
|
||||
enc/jxl_node_enc.js dec/jxl_node_dec.js: ENVIRONMENT = node
|
||||
|
||||
# For single-threaded build, we compile with threads enabled, but then just don't use them nor link them in.
|
||||
enc/jxl_enc.js enc/jxl_node_enc.js enc/jxl_enc_mt.js dec/jxl_dec.js dec/jxl_node_dec.js: CODEC_BUILD_DIR:=$(CODEC_MT_BUILD_DIR)
|
||||
enc/jxl_enc_mt_simd.js: CODEC_BUILD_DIR:=$(CODEC_MT_SIMD_BUILD_DIR)
|
||||
|
||||
enc/jxl_node_enc.js dec/jxl_node_dec.js enc/jxl_enc.js dec/jxl_dec.js: $(CODEC_MT_BUILD_DIR)/lib/libjxl.a
|
||||
enc/jxl_enc_mt.js: $(CODEC_MT_BUILD_DIR)/lib/libjxl.a $(CODEC_MT_BUILD_DIR)/lib/libjxl_threads.a
|
||||
enc/jxl_enc_mt_simd.js: $(CODEC_MT_SIMD_BUILD_DIR)/lib/libjxl.a $(CODEC_MT_SIMD_BUILD_DIR)/lib/libjxl_threads.a
|
||||
|
||||
# Disable errors on deprecated SIMD intrinsics.
|
||||
# JPEG-XL & Highway need to catch up, once they do, we can remove this suppression.
|
||||
export CXXFLAGS += -Wno-deprecated-declarations
|
||||
|
||||
# Compile multithreaded wrappers with -pthread.
|
||||
enc/jxl_enc_mt.js enc/jxl_enc_mt_simd.js: CXXFLAGS+=-pthread
|
||||
|
||||
$(OUT_JS):
|
||||
$(CXX) \
|
||||
$(CXXFLAGS) \
|
||||
$(LDFLAGS) \
|
||||
-I $(CODEC_DIR) \
|
||||
-I $(CODEC_DIR)/lib \
|
||||
-I $(CODEC_DIR)/lib/include \
|
||||
-I $(CODEC_BUILD_DIR)/lib/include \
|
||||
-I $(CODEC_DIR)/third_party/highway \
|
||||
-I $(CODEC_DIR)/third_party/skcms \
|
||||
--bind \
|
||||
-s ENVIRONMENT=$(ENVIRONMENT) \
|
||||
-s EXPORT_ES6=1 \
|
||||
-o $@ \
|
||||
$+ \
|
||||
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlidec-static.a \
|
||||
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlienc-static.a \
|
||||
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlicommon-static.a \
|
||||
$(CODEC_BUILD_DIR)/third_party/libskcms.a \
|
||||
$(CODEC_BUILD_DIR)/third_party/highway/libhwy.a
|
||||
|
||||
%/lib/libjxl.a: %/Makefile
|
||||
$(MAKE) -C $(<D) jxl-static
|
||||
|
||||
%/lib/libjxl_threads.a: %/Makefile
|
||||
$(MAKE) -C $(<D) jxl_threads-static
|
||||
|
||||
# Enable SIMD on a SIMD build.
|
||||
$(CODEC_MT_SIMD_BUILD_DIR)/Makefile: CXXFLAGS+=-msimd128
|
||||
|
||||
%/Makefile: $(CODEC_DIR)/CMakeLists.txt
|
||||
emcmake cmake \
|
||||
$(CMAKE_FLAGS) \
|
||||
-DBUILD_SHARED_LIBS=0 \
|
||||
-DJPEGXL_ENABLE_BENCHMARK=0 \
|
||||
-DJPEGXL_ENABLE_EXAMPLES=0 \
|
||||
-DBUILD_TESTING=0 \
|
||||
-DCMAKE_CROSSCOMPILING_EMULATOR=node \
|
||||
-B $(@D) \
|
||||
$(<D)
|
||||
|
||||
$(CODEC_DIR)/CMakeLists.txt:
|
||||
$(RM) -r $(@D)
|
||||
git init $(@D)
|
||||
git -C $(@D) fetch $(CODEC_URL) $(CODEC_VERSION) --depth 1
|
||||
git -C $(@D) checkout FETCH_HEAD
|
||||
git -C $(@D) submodule update --init --depth 1 --recursive --jobs `nproc`
|
||||
|
||||
clean:
|
||||
$(RM) $(OUT_JS) $(OUT_WASM) $(OUT_WORKER)
|
||||
$(MAKE) -C $(CODEC_BUILD_DIR) clean
|
||||
$(MAKE) -C $(CODEC_MT_BUILD_DIR) clean
|
||||
$(MAKE) -C $(CODEC_MT_SIMD_BUILD_DIR) clean
|
||||
99
codecs/jxl/dec/jxl_dec.cpp
Normal file
99
codecs/jxl/dec/jxl_dec.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
#include <emscripten/bind.h>
|
||||
#include <emscripten/val.h>
|
||||
|
||||
#include <jxl/decode.h>
|
||||
#include "lib/jxl/color_encoding_internal.h"
|
||||
|
||||
#include "skcms.h"
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
|
||||
thread_local const val ImageData = val::global("ImageData");
|
||||
|
||||
// R, G, B, A
|
||||
#define COMPONENTS_PER_PIXEL 4
|
||||
|
||||
#ifndef JXL_DEBUG_ON_ALL_ERROR
|
||||
#define JXL_DEBUG_ON_ALL_ERROR 0
|
||||
#endif
|
||||
|
||||
#if JXL_DEBUG_ON_ALL_ERROR
|
||||
#define EXPECT_TRUE(a) \
|
||||
if (!(a)) { \
|
||||
fprintf(stderr, "Assertion failure (%d): %s\n", __LINE__, #a); \
|
||||
return val::null(); \
|
||||
}
|
||||
#define EXPECT_EQ(a, b) \
|
||||
{ \
|
||||
int a_ = a; \
|
||||
int b_ = b; \
|
||||
if (a_ != b_) { \
|
||||
fprintf(stderr, "Assertion failure (%d): %s (%d) != %s (%d)\n", __LINE__, #a, a_, #b, b_); \
|
||||
return val::null(); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define EXPECT_TRUE(a) \
|
||||
if (!(a)) { \
|
||||
return val::null(); \
|
||||
}
|
||||
|
||||
#define EXPECT_EQ(a, b) EXPECT_TRUE((a) == (b));
|
||||
#endif
|
||||
|
||||
val decode(std::string data) {
|
||||
std::unique_ptr<JxlDecoder,
|
||||
std::integral_constant<decltype(&JxlDecoderDestroy), JxlDecoderDestroy>>
|
||||
dec(JxlDecoderCreate(nullptr));
|
||||
EXPECT_EQ(JXL_DEC_SUCCESS,
|
||||
JxlDecoderSubscribeEvents(
|
||||
dec.get(), JXL_DEC_BASIC_INFO | JXL_DEC_COLOR_ENCODING | JXL_DEC_FULL_IMAGE));
|
||||
|
||||
auto next_in = (const uint8_t*)data.c_str();
|
||||
auto avail_in = data.size();
|
||||
JxlDecoderSetInput(dec.get(), next_in, avail_in);
|
||||
EXPECT_EQ(JXL_DEC_BASIC_INFO, JxlDecoderProcessInput(dec.get()));
|
||||
JxlBasicInfo info;
|
||||
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderGetBasicInfo(dec.get(), &info));
|
||||
size_t pixel_count = info.xsize * info.ysize;
|
||||
size_t component_count = pixel_count * COMPONENTS_PER_PIXEL;
|
||||
|
||||
EXPECT_EQ(JXL_DEC_COLOR_ENCODING, JxlDecoderProcessInput(dec.get()));
|
||||
static const JxlPixelFormat format = {COMPONENTS_PER_PIXEL, JXL_TYPE_FLOAT, JXL_LITTLE_ENDIAN, 0};
|
||||
size_t icc_size;
|
||||
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderGetICCProfileSize(dec.get(), &format,
|
||||
JXL_COLOR_PROFILE_TARGET_DATA, &icc_size));
|
||||
std::vector<uint8_t> icc_profile(icc_size);
|
||||
EXPECT_EQ(JXL_DEC_SUCCESS,
|
||||
JxlDecoderGetColorAsICCProfile(dec.get(), &format, JXL_COLOR_PROFILE_TARGET_DATA,
|
||||
icc_profile.data(), icc_profile.size()));
|
||||
|
||||
EXPECT_EQ(JXL_DEC_NEED_IMAGE_OUT_BUFFER, JxlDecoderProcessInput(dec.get()));
|
||||
size_t buffer_size;
|
||||
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderImageOutBufferSize(dec.get(), &format, &buffer_size));
|
||||
EXPECT_EQ(buffer_size, component_count * sizeof(float));
|
||||
|
||||
auto float_pixels = std::make_unique<float[]>(component_count);
|
||||
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderSetImageOutBuffer(dec.get(), &format, float_pixels.get(),
|
||||
component_count * sizeof(float)));
|
||||
EXPECT_EQ(JXL_DEC_FULL_IMAGE, JxlDecoderProcessInput(dec.get()));
|
||||
|
||||
auto byte_pixels = std::make_unique<uint8_t[]>(component_count);
|
||||
// Convert to sRGB.
|
||||
skcms_ICCProfile jxl_profile;
|
||||
EXPECT_TRUE(skcms_Parse(icc_profile.data(), icc_profile.size(), &jxl_profile));
|
||||
EXPECT_TRUE(skcms_Transform(
|
||||
float_pixels.get(), skcms_PixelFormat_RGBA_ffff,
|
||||
info.alpha_premultiplied ? skcms_AlphaFormat_PremulAsEncoded : skcms_AlphaFormat_Unpremul,
|
||||
&jxl_profile, byte_pixels.get(), skcms_PixelFormat_RGBA_8888, skcms_AlphaFormat_Unpremul,
|
||||
skcms_sRGB_profile(), pixel_count));
|
||||
|
||||
return ImageData.new_(
|
||||
Uint8ClampedArray.new_(typed_memory_view(component_count, byte_pixels.get())), info.xsize,
|
||||
info.ysize);
|
||||
}
|
||||
|
||||
EMSCRIPTEN_BINDINGS(my_module) {
|
||||
function("decode", &decode);
|
||||
}
|
||||
7
codecs/jxl/dec/jxl_dec.d.ts
vendored
Normal file
7
codecs/jxl/dec/jxl_dec.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export interface JXLModule extends EmscriptenWasm.Module {
|
||||
decode(data: BufferSource): ImageData | null;
|
||||
}
|
||||
|
||||
declare var moduleFactory: EmscriptenWasm.ModuleFactory<JXLModule>;
|
||||
|
||||
export default moduleFactory;
|
||||
56
codecs/jxl/dec/jxl_dec.js
generated
Normal file
56
codecs/jxl/dec/jxl_dec.js
generated
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var e;e||(e=typeof Module !== 'undefined' ? Module : {});var aa,r;e.ready=new Promise(function(a,b){aa=a;r=b});var t={},u;for(u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);var ba="./this.program",v="",w;v=self.location.href;_scriptDir&&(v=_scriptDir);0!==v.indexOf("blob:")?v=v.substr(0,v.lastIndexOf("/")+1):v="";w=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};
|
||||
var ca=e.print||console.log.bind(console),y=e.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(e[u]=t[u]);t=null;e.thisProgram&&(ba=e.thisProgram);var z;e.wasmBinary&&(z=e.wasmBinary);var noExitRuntime=e.noExitRuntime||!0;"object"!==typeof WebAssembly&&A("no native wasm support detected");var C,da=!1,ea=new TextDecoder("utf8");
|
||||
function fa(a,b,c){var d=D;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var ha=new TextDecoder("utf-16le");
|
||||
function ia(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&E[c];)++c;return ha.decode(D.subarray(a,c<<1))}function ja(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)F[b>>1]=a.charCodeAt(f),b+=2;F[b>>1]=0;return b-d}function ka(a){return 2*a.length}function la(a,b){for(var c=0,d="";!(c>=b/4);){var f=G[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
|
||||
function ma(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}G[b>>2]=g;b+=4;if(b+4>c)break}G[b>>2]=0;return b-d}function na(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var oa,I,D,F,E,G,J,pa,qa;
|
||||
function ra(){var a=C.buffer;oa=a;e.HEAP8=I=new Int8Array(a);e.HEAP16=F=new Int16Array(a);e.HEAP32=G=new Int32Array(a);e.HEAPU8=D=new Uint8Array(a);e.HEAPU16=E=new Uint16Array(a);e.HEAPU32=J=new Uint32Array(a);e.HEAPF32=pa=new Float32Array(a);e.HEAPF64=qa=new Float64Array(a)}var L,sa=[],ta=[],ua=[];function va(){var a=e.preRun.shift();sa.unshift(a)}var M=0,wa=null,N=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function A(a){if(e.onAbort)e.onAbort(a);y(a);da=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");r(a);throw a;}var O=(new URL("jxl_dec.wasm",import.meta.url)).toString();function xa(){try{if(O==O&&z)return new Uint8Array(z);if(w)return w(O);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}
|
||||
function ya(){return z||"function"!==typeof fetch?Promise.resolve().then(function(){return xa()}):fetch(O,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+O+"'";return a.arrayBuffer()}).catch(function(){return xa()})}function za(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.N;"number"===typeof c?void 0===b.J?L.get(c)():L.get(c)(b.J):c(void 0===b.J?null:b.J)}}}
|
||||
function Aa(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ba=void 0;function P(a){for(var b="";D[a];)b+=Ba[D[a++]];return b}var Q={},R={},S={};function Ca(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}
|
||||
function Da(a,b){a=Ca(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ea(a){var b=Error,c=Da(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}
|
||||
var Fa=void 0;function T(a){throw new Fa(a);}var Ga=void 0;function Ha(a,b){function c(h){h=b(h);if(h.length!==d.length)throw new Ga("Mismatched type converter count");for(var p=0;p<d.length;++p)U(d[p],h[p])}var d=[];d.forEach(function(h){S[h]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(h,p){R.hasOwnProperty(h)?f[p]=R[h]:(g.push(h),Q.hasOwnProperty(h)||(Q[h]=[]),Q[h].push(function(){f[p]=R[h];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||T('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.M)return;T("Cannot register type '"+d+"' twice")}R[a]=b;delete S[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}var Ia=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Ja(a){4<a&&0===--V[a].K&&(V[a]=void 0,Ia.push(a))}function W(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ia.length?Ia.pop():V.length;V[b]={K:1,value:a};return b}}function Ka(a){return this.fromWireType(J[a>>2])}function Na(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Oa(a,b){switch(b){case 2:return function(c){return this.fromWireType(pa[c>>2])};case 3:return function(c){return this.fromWireType(qa[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Pa(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Da(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Qa(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ra(a,b){var c=e;if(void 0===c[a].H){var d=c[a];c[a]=function(){c[a].H.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].H+")!");return c[a].H[arguments.length].apply(this,arguments)};c[a].H=[];c[a].H[d.L]=d}}
|
||||
function Sa(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].H&&void 0!==e[a].H[c])&&T("Cannot register public name '"+a+"' twice"),Ra(a,a),e.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].H[c]=b):(e[a]=b,void 0!==c&&(e[a].P=c))}function Ta(a,b){for(var c=[],d=0;d<a;d++)c.push(G[(b>>2)+d]);return c}
|
||||
function Ua(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=e["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=L.get(b).apply(null,c);return d}}function Va(a,b){a=P(a);var c=a.includes("j")?Ua(a,b):L.get(b);"function"!==typeof c&&T("unknown function pointer with signature "+a+": "+b);return c}var Wa=void 0;function Xa(a){a=Ya(a);var b=P(a);X(a);return b}
|
||||
function Za(a,b){function c(g){f[g]||R[g]||(S[g]?S[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Wa(a+": "+d.map(Xa).join([", "]));}function $a(a,b,c){switch(b){case 0:return c?function(d){return I[d]}:function(d){return D[d]};case 1:return c?function(d){return F[d>>1]}:function(d){return E[d>>1]};case 2:return c?function(d){return G[d>>2]}:function(d){return J[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var ab={};
|
||||
function bb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function cb(a,b){var c=R[a];void 0===c&&T(b+" has unknown type "+Xa(a));return c}var db={},eb={};function fb(){if(!gb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ba||"./this.program"},b;for(b in eb)a[b]=eb[b];var c=[];for(b in a)c.push(b+"="+a[b]);gb=c}return gb}
|
||||
for(var gb,hb=[null,[],[]],ib=Array(256),Y=0;256>Y;++Y)ib[Y]=String.fromCharCode(Y);Ba=ib;Fa=e.BindingError=Ea("BindingError");Ga=e.InternalError=Ea("InternalError");e.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};Wa=e.UnboundTypeError=Ea("UnboundTypeError");
|
||||
var kb={l:function(){},q:function(){},m:function(a,b,c,d,f){var g=Aa(c);b=P(b);U(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var h=I;else if(2===c)h=F;else if(4===c)h=G;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[l>>g])},I:null})},x:function(a,b){b=P(b);U(a,{name:b,fromWireType:function(c){var d=V[c].value;Ja(c);return d},toWireType:function(c,d){return W(d)},
|
||||
argPackAdvance:8,readValueFromPointer:Ka,I:null})},j:function(a,b,c){c=Aa(c);b=P(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Na(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Oa(b,c),I:null})},o:function(a,b,c,d,f,g){var l=Ta(b,c);a=P(a);f=Va(d,f);Sa(a,function(){Za("Cannot call "+a+" due to unbound types",l)},b-1);Ha(l,function(h){var p=a,k=a;h=[h[0],null].concat(h.slice(1));
|
||||
var m=f,q=h.length;2>q&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==h[1]&&!1,B=!1,n=1;n<h.length;++n)if(null!==h[n]&&void 0===h[n].I){B=!0;break}var La="void"!==h[0].name,H="",K="";for(n=0;n<q-2;++n)H+=(0!==n?", ":"")+"arg"+n,K+=(0!==n?", ":"")+"arg"+n+"Wired";k="return function "+Ca(k)+"("+H+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+k+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";
|
||||
B&&(k+="var destructors = [];\n");var Ma=B?"destructors":"null";H="throwBindingError invoker fn runDestructors retType classParam".split(" ");m=[T,m,g,Qa,h[0],h[1]];x&&(k+="var thisWired = classParam.toWireType("+Ma+", this);\n");for(n=0;n<q-2;++n)k+="var arg"+n+"Wired = argType"+n+".toWireType("+Ma+", arg"+n+"); // "+h[n+2].name+"\n",H.push("argType"+n),m.push(h[n+2]);x&&(K="thisWired"+(0<K.length?", ":"")+K);k+=(La?"var rv = ":"")+"invoker(fn"+(0<K.length?", ":"")+K+");\n";if(B)k+="runDestructors(destructors);\n";
|
||||
else for(n=x?1:2;n<h.length;++n)q=1===n?"thisWired":"arg"+(n-2)+"Wired",null!==h[n].I&&(k+=q+"_dtor("+q+"); // "+h[n].name+"\n",H.push(q+"_dtor"),m.push(h[n].I));La&&(k+="var ret = retType.fromWireType(rv);\nreturn ret;\n");H.push(k+"}\n");h=Pa(H).apply(null,m);n=b-1;if(!e.hasOwnProperty(p))throw new Ga("Replacing nonexistant public symbol");void 0!==e[p].H&&void 0!==n?e[p].H[n]=h:(e[p]=h,e[p].L=n);return[]})},c:function(a,b,c,d,f){function g(k){return k}b=P(b);-1===f&&(f=4294967295);var l=Aa(c);
|
||||
if(0===d){var h=32-8*c;g=function(k){return k<<h>>>h}}var p=b.includes("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(k,m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+Na(m)+'" to '+this.name);if(m<d||m>f)throw new TypeError('Passing a number "'+Na(m)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return p?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:$a(b,l,0!==d),I:null})},b:function(a,
|
||||
b,c){function d(g){g>>=2;var l=J;return new f(oa,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=P(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{M:!0})},g:function(a,b){b=P(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=J[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var h=d+4+l;if(l==f||0==D[h]){if(g){for(var p=g+(h-g),k=g;!(k>=p)&&D[k];)++k;g=ea.decode(D.subarray(g,k))}else g="";if(void 0===
|
||||
m)var m=g;else m+=String.fromCharCode(0),m+=g;g=h+1}}else{m=Array(f);for(l=0;l<f;++l)m[l]=String.fromCharCode(D[d+4+l]);m=m.join("")}X(d);return m},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||T("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var k=0,m=0;m<f.length;++m){var q=f.charCodeAt(m);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++m)&
|
||||
1023);127>=q?++k:k=2047>=q?k+2:65535>=q?k+3:k+4}return k}:function(){return f.length})(),h=jb(4+l+1);J[h>>2]=l;if(c&&g)fa(f,h+4,l+1);else if(g)for(g=0;g<l;++g){var p=f.charCodeAt(g);255<p&&(X(h),T("String has UTF-16 code units that do not fit in 8 bits"));D[h+4+g]=p}else for(g=0;g<l;++g)D[h+4+g]=f[g];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:Ka,I:function(d){X(d)}})},f:function(a,b,c){c=P(c);if(2===b){var d=ia;var f=ja;var g=ka;var l=function(){return E};var h=1}else 4===
|
||||
b&&(d=la,f=ma,g=na,l=function(){return J},h=2);U(a,{name:c,fromWireType:function(p){for(var k=J[p>>2],m=l(),q,x=p+4,B=0;B<=k;++B){var n=p+4+B*b;if(B==k||0==m[n>>h])x=d(x,n-x),void 0===q?q=x:(q+=String.fromCharCode(0),q+=x),x=n+b}X(p);return q},toWireType:function(p,k){"string"!==typeof k&&T("Cannot pass non-string to C++ string type "+c);var m=g(k),q=jb(4+m+b);J[q>>2]=m>>h;f(k,q+4,m+b);null!==p&&p.push(X,q);return q},argPackAdvance:8,readValueFromPointer:Ka,I:function(p){X(p)}})},n:function(a,b){b=
|
||||
P(b);U(a,{O:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},d:Ja,k:function(a){if(0===a)return W(bb());var b=ab[a];a=void 0===b?P(a):b;return W(bb()[a])},h:function(a){4<a&&(V[a].K+=1)},i:function(a,b,c,d){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var f=db[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(cb,e,W);db[b]=f}return f(a,c,d)},a:function(){A()},s:function(a,b,c){D.copyWithin(a,b,b+c)},e:function(a){var b=D.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,
|
||||
d);0<d%65536&&(d+=65536-d%65536);a:{try{C.grow(Math.min(2147483648,d)-oa.byteLength+65535>>>16);ra();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},t:function(a,b){var c=0;fb().forEach(function(d,f){var g=b+c;f=G[a+4*f>>2]=g;for(g=0;g<d.length;++g)I[f++>>0]=d.charCodeAt(g);I[f>>0]=0;c+=d.length+1});return 0},u:function(a,b){var c=fb();G[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+1});G[b>>2]=d;return 0},v:function(){return 0},p:function(){},w:function(a,b,c,d){for(var f=0,
|
||||
g=0;g<c;g++){for(var l=G[b+8*g>>2],h=G[b+(8*g+4)>>2],p=0;p<h;p++){var k=D[l+p],m=hb[a];if(0===k||10===k){for(k=0;m[k]&&!(NaN<=k);)++k;k=ea.decode(m.subarray?m.subarray(0,k):new Uint8Array(m.slice(0,k)));(1===a?ca:y)(k);m.length=0}else m.push(k)}f+=h}G[d>>2]=f;return 0},r:function(){}};
|
||||
(function(){function a(f){e.asm=f.exports;C=e.asm.y;ra();L=e.asm.E;ta.unshift(e.asm.z);M--;e.monitorRunDependencies&&e.monitorRunDependencies(M);0==M&&(null!==wa&&(clearInterval(wa),wa=null),N&&(f=N,N=null,f()))}function b(f){a(f.instance)}function c(f){return ya().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){y("failed to asynchronously prepare wasm: "+g);A(g)})}var d={a:kb};M++;e.monitorRunDependencies&&e.monitorRunDependencies(M);if(e.instantiateWasm)try{return e.instantiateWasm(d,
|
||||
a)}catch(f){return y("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return z||"function"!==typeof WebAssembly.instantiateStreaming||O.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){y("wasm streaming compile failed: "+g);y("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(r);return{}})();
|
||||
e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.z).apply(null,arguments)};var jb=e._malloc=function(){return(jb=e._malloc=e.asm.A).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.B).apply(null,arguments)},Ya=e.___getTypeName=function(){return(Ya=e.___getTypeName=e.asm.C).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.D).apply(null,arguments)};
|
||||
e.dynCall_iiji=function(){return(e.dynCall_iiji=e.asm.F).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.G).apply(null,arguments)};var Z;N=function lb(){Z||mb();Z||(N=lb)};
|
||||
function mb(){function a(){if(!Z&&(Z=!0,e.calledRun=!0,!da)){za(ta);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();ua.unshift(b)}za(ua)}}if(!(0<M)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)va();za(sa);0<M||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=mb;
|
||||
if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();mb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/jxl/dec/jxl_dec.wasm
Executable file
BIN
codecs/jxl/dec/jxl_dec.wasm
Executable file
Binary file not shown.
56
codecs/jxl/dec/jxl_node_dec.js
generated
Normal file
56
codecs/jxl/dec/jxl_node_dec.js
generated
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var e;e||(e=typeof Module !== 'undefined' ? Module : {});var aa,r;e.ready=new Promise(function(a,b){aa=a;r=b});var t={},u;for(u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);var v="./this.program",ba,w,y,ca;ba=function(a){y||(y=require("fs"));ca||(ca=require("path"));a=ca.normalize(a);return y.readFileSync(a,null)};w=function(a){a=ba(a);a.buffer||(a=new Uint8Array(a));a.buffer||z("Assertion failed: undefined");return a};1<process.argv.length&&(v=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);
|
||||
process.on("uncaughtException",function(a){throw a;});process.on("unhandledRejection",z);e.inspect=function(){return"[Emscripten Module object]"};var da=e.print||console.log.bind(console),A=e.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(e[u]=t[u]);t=null;e.thisProgram&&(v=e.thisProgram);var C;e.wasmBinary&&(C=e.wasmBinary);var noExitRuntime=e.noExitRuntime||!0;"object"!==typeof WebAssembly&&z("no native wasm support detected");var ea,fa=!1,ha=new TextDecoder("utf8");
|
||||
function ia(a,b,c){var d=D;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var ja=new TextDecoder("utf-16le");
|
||||
function ka(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&E[c];)++c;return ja.decode(D.subarray(a,c<<1))}function la(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)G[b>>1]=a.charCodeAt(f),b+=2;G[b>>1]=0;return b-d}function ma(a){return 2*a.length}function na(a,b){for(var c=0,d="";!(c>=b/4);){var f=H[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
|
||||
function oa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}H[b>>2]=g;b+=4;if(b+4>c)break}H[b>>2]=0;return b-d}function pa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var qa,I,D,G,E,H,K,ra,sa;
|
||||
function ta(){var a=ea.buffer;qa=a;e.HEAP8=I=new Int8Array(a);e.HEAP16=G=new Int16Array(a);e.HEAP32=H=new Int32Array(a);e.HEAPU8=D=new Uint8Array(a);e.HEAPU16=E=new Uint16Array(a);e.HEAPU32=K=new Uint32Array(a);e.HEAPF32=ra=new Float32Array(a);e.HEAPF64=sa=new Float64Array(a)}var L,ua=[],va=[],wa=[];function xa(){var a=e.preRun.shift();ua.unshift(a)}var M=0,ya=null,N=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function z(a){if(e.onAbort)e.onAbort(a);A(a);fa=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");r(a);throw a;}var O=(new URL("jxl_node_dec.wasm",import.meta.url)).toString();function za(){return Promise.resolve().then(function(){a:{try{if(O==O&&C){var a=new Uint8Array(C);break a}if(w){a=w(O);break a}throw"both async and sync fetching of the wasm failed";}catch(b){z(b)}a=void 0}return a})}
|
||||
function Aa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.N;"number"===typeof c?void 0===b.J?L.get(c)():L.get(c)(b.J):c(void 0===b.J?null:b.J)}}}function Ba(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ca=void 0;function P(a){for(var b="";D[a];)b+=Ca[D[a++]];return b}var Q={},R={},S={};
|
||||
function Da(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ea(a,b){a=Da(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function Fa(a){var b=Error,c=Ea(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Ga=void 0;function T(a){throw new Ga(a);}var Ha=void 0;
|
||||
function Ia(a,b){function c(h){h=b(h);if(h.length!==d.length)throw new Ha("Mismatched type converter count");for(var k=0;k<d.length;++k)U(d[k],h[k])}var d=[];d.forEach(function(h){S[h]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(h,k){R.hasOwnProperty(h)?f[k]=R[h]:(g.push(h),Q.hasOwnProperty(h)||(Q[h]=[]),Q[h].push(function(){f[k]=R[h];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||T('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.M)return;T("Cannot register type '"+d+"' twice")}R[a]=b;delete S[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}var Ja=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Ka(a){4<a&&0===--V[a].K&&(V[a]=void 0,Ja.push(a))}function W(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ja.length?Ja.pop():V.length;V[b]={K:1,value:a};return b}}function La(a){return this.fromWireType(K[a>>2])}function Oa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Pa(a,b){switch(b){case 2:return function(c){return this.fromWireType(ra[c>>2])};case 3:return function(c){return this.fromWireType(sa[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Qa(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ea(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Ra(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Sa(a,b){var c=e;if(void 0===c[a].H){var d=c[a];c[a]=function(){c[a].H.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].H+")!");return c[a].H[arguments.length].apply(this,arguments)};c[a].H=[];c[a].H[d.L]=d}}
|
||||
function Ta(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].H&&void 0!==e[a].H[c])&&T("Cannot register public name '"+a+"' twice"),Sa(a,a),e.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].H[c]=b):(e[a]=b,void 0!==c&&(e[a].P=c))}function Ua(a,b){for(var c=[],d=0;d<a;d++)c.push(H[(b>>2)+d]);return c}
|
||||
function Va(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=e["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=L.get(b).apply(null,c);return d}}function Wa(a,b){a=P(a);var c=a.includes("j")?Va(a,b):L.get(b);"function"!==typeof c&&T("unknown function pointer with signature "+a+": "+b);return c}var Xa=void 0;function Ya(a){a=Za(a);var b=P(a);X(a);return b}
|
||||
function $a(a,b){function c(g){f[g]||R[g]||(S[g]?S[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Xa(a+": "+d.map(Ya).join([", "]));}function ab(a,b,c){switch(b){case 0:return c?function(d){return I[d]}:function(d){return D[d]};case 1:return c?function(d){return G[d>>1]}:function(d){return E[d>>1]};case 2:return c?function(d){return H[d>>2]}:function(d){return K[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var bb={};
|
||||
function cb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function db(a,b){var c=R[a];void 0===c&&T(b+" has unknown type "+Ya(a));return c}var eb={},fb={};function gb(){if(!hb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:v||"./this.program"},b;for(b in fb)a[b]=fb[b];var c=[];for(b in a)c.push(b+"="+a[b]);hb=c}return hb}
|
||||
for(var hb,ib=[null,[],[]],jb=Array(256),Y=0;256>Y;++Y)jb[Y]=String.fromCharCode(Y);Ca=jb;Ga=e.BindingError=Fa("BindingError");Ha=e.InternalError=Fa("InternalError");e.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};Xa=e.UnboundTypeError=Fa("UnboundTypeError");
|
||||
var lb={l:function(){},q:function(){},m:function(a,b,c,d,f){var g=Ba(c);b=P(b);U(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var h=I;else if(2===c)h=G;else if(4===c)h=H;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[l>>g])},I:null})},x:function(a,b){b=P(b);U(a,{name:b,fromWireType:function(c){var d=V[c].value;Ka(c);return d},toWireType:function(c,d){return W(d)},
|
||||
argPackAdvance:8,readValueFromPointer:La,I:null})},j:function(a,b,c){c=Ba(c);b=P(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Oa(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Pa(b,c),I:null})},o:function(a,b,c,d,f,g){var l=Ua(b,c);a=P(a);f=Wa(d,f);Ta(a,function(){$a("Cannot call "+a+" due to unbound types",l)},b-1);Ia(l,function(h){var k=[h[0],null].concat(h.slice(1)),
|
||||
m=h=a,n=f,p=k.length;2>p&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==k[1]&&!1,B=!1,q=1;q<k.length;++q)if(null!==k[q]&&void 0===k[q].I){B=!0;break}var Ma="void"!==k[0].name,F="",J="";for(q=0;q<p-2;++q)F+=(0!==q?", ":"")+"arg"+q,J+=(0!==q?", ":"")+"arg"+q+"Wired";m="return function "+Da(m)+"("+F+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";
|
||||
B&&(m+="var destructors = [];\n");var Na=B?"destructors":"null";F="throwBindingError invoker fn runDestructors retType classParam".split(" ");n=[T,n,g,Ra,k[0],k[1]];x&&(m+="var thisWired = classParam.toWireType("+Na+", this);\n");for(q=0;q<p-2;++q)m+="var arg"+q+"Wired = argType"+q+".toWireType("+Na+", arg"+q+"); // "+k[q+2].name+"\n",F.push("argType"+q),n.push(k[q+2]);x&&(J="thisWired"+(0<J.length?", ":"")+J);m+=(Ma?"var rv = ":"")+"invoker(fn"+(0<J.length?", ":"")+J+");\n";if(B)m+="runDestructors(destructors);\n";
|
||||
else for(q=x?1:2;q<k.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==k[q].I&&(m+=p+"_dtor("+p+"); // "+k[q].name+"\n",F.push(p+"_dtor"),n.push(k[q].I));Ma&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");F.push(m+"}\n");k=Qa(F).apply(null,n);q=b-1;if(!e.hasOwnProperty(h))throw new Ha("Replacing nonexistant public symbol");void 0!==e[h].H&&void 0!==q?e[h].H[q]=k:(e[h]=k,e[h].L=q);return[]})},c:function(a,b,c,d,f){function g(m){return m}b=P(b);-1===f&&(f=4294967295);var l=Ba(c);
|
||||
if(0===d){var h=32-8*c;g=function(m){return m<<h>>>h}}var k=b.includes("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(m,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+Oa(n)+'" to '+this.name);if(n<d||n>f)throw new TypeError('Passing a number "'+Oa(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return k?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:ab(b,l,0!==d),I:null})},b:function(a,
|
||||
b,c){function d(g){g>>=2;var l=K;return new f(qa,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=P(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{M:!0})},g:function(a,b){b=P(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=K[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var h=d+4+l;if(l==f||0==D[h]){if(g){for(var k=g+(h-g),m=g;!(m>=k)&&D[m];)++m;g=ha.decode(D.subarray(g,m))}else g="";if(void 0===
|
||||
n)var n=g;else n+=String.fromCharCode(0),n+=g;g=h+1}}else{n=Array(f);for(l=0;l<f;++l)n[l]=String.fromCharCode(D[d+4+l]);n=n.join("")}X(d);return n},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||T("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,n=0;n<f.length;++n){var p=f.charCodeAt(n);55296<=p&&57343>=p&&(p=65536+((p&1023)<<10)|f.charCodeAt(++n)&
|
||||
1023);127>=p?++m:m=2047>=p?m+2:65535>=p?m+3:m+4}return m}:function(){return f.length})(),h=kb(4+l+1);K[h>>2]=l;if(c&&g)ia(f,h+4,l+1);else if(g)for(g=0;g<l;++g){var k=f.charCodeAt(g);255<k&&(X(h),T("String has UTF-16 code units that do not fit in 8 bits"));D[h+4+g]=k}else for(g=0;g<l;++g)D[h+4+g]=f[g];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:La,I:function(d){X(d)}})},f:function(a,b,c){c=P(c);if(2===b){var d=ka;var f=la;var g=ma;var l=function(){return E};var h=1}else 4===
|
||||
b&&(d=na,f=oa,g=pa,l=function(){return K},h=2);U(a,{name:c,fromWireType:function(k){for(var m=K[k>>2],n=l(),p,x=k+4,B=0;B<=m;++B){var q=k+4+B*b;if(B==m||0==n[q>>h])x=d(x,q-x),void 0===p?p=x:(p+=String.fromCharCode(0),p+=x),x=q+b}X(k);return p},toWireType:function(k,m){"string"!==typeof m&&T("Cannot pass non-string to C++ string type "+c);var n=g(m),p=kb(4+n+b);K[p>>2]=n>>h;f(m,p+4,n+b);null!==k&&k.push(X,p);return p},argPackAdvance:8,readValueFromPointer:La,I:function(k){X(k)}})},n:function(a,b){b=
|
||||
P(b);U(a,{O:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},d:Ka,k:function(a){if(0===a)return W(cb());var b=bb[a];a=void 0===b?P(a):b;return W(cb()[a])},h:function(a){4<a&&(V[a].K+=1)},i:function(a,b,c,d){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var f=eb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(db,e,W);eb[b]=f}return f(a,c,d)},a:function(){z()},s:function(a,b,c){D.copyWithin(a,b,b+c)},e:function(a){var b=D.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,
|
||||
d);0<d%65536&&(d+=65536-d%65536);a:{try{ea.grow(Math.min(2147483648,d)-qa.byteLength+65535>>>16);ta();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},t:function(a,b){var c=0;gb().forEach(function(d,f){var g=b+c;f=H[a+4*f>>2]=g;for(g=0;g<d.length;++g)I[f++>>0]=d.charCodeAt(g);I[f>>0]=0;c+=d.length+1});return 0},u:function(a,b){var c=gb();H[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+1});H[b>>2]=d;return 0},v:function(){return 0},p:function(){},w:function(a,b,c,d){for(var f=
|
||||
0,g=0;g<c;g++){for(var l=H[b+8*g>>2],h=H[b+(8*g+4)>>2],k=0;k<h;k++){var m=D[l+k],n=ib[a];if(0===m||10===m){m=1===a?da:A;var p;for(p=0;n[p]&&!(NaN<=p);)++p;p=ha.decode(n.subarray?n.subarray(0,p):new Uint8Array(n.slice(0,p)));m(p);n.length=0}else n.push(m)}f+=h}H[d>>2]=f;return 0},r:function(){}};
|
||||
(function(){function a(f){e.asm=f.exports;ea=e.asm.y;ta();L=e.asm.E;va.unshift(e.asm.z);M--;e.monitorRunDependencies&&e.monitorRunDependencies(M);0==M&&(null!==ya&&(clearInterval(ya),ya=null),N&&(f=N,N=null,f()))}function b(f){a(f.instance)}function c(f){return za().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){A("failed to asynchronously prepare wasm: "+g);z(g)})}var d={a:lb};M++;e.monitorRunDependencies&&e.monitorRunDependencies(M);if(e.instantiateWasm)try{return e.instantiateWasm(d,
|
||||
a)}catch(f){return A("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return C||"function"!==typeof WebAssembly.instantiateStreaming||O.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){A("wasm streaming compile failed: "+g);A("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(r);return{}})();
|
||||
e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.z).apply(null,arguments)};var kb=e._malloc=function(){return(kb=e._malloc=e.asm.A).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.B).apply(null,arguments)},Za=e.___getTypeName=function(){return(Za=e.___getTypeName=e.asm.C).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.D).apply(null,arguments)};
|
||||
e.dynCall_iiji=function(){return(e.dynCall_iiji=e.asm.F).apply(null,arguments)};e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.G).apply(null,arguments)};var Z;N=function mb(){Z||nb();Z||(N=mb)};
|
||||
function nb(){function a(){if(!Z&&(Z=!0,e.calledRun=!0,!fa)){Aa(va);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();wa.unshift(b)}Aa(wa)}}if(!(0<M)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)xa();Aa(ua);0<M||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=nb;
|
||||
if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();nb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/jxl/dec/jxl_node_dec.wasm
Executable file
BIN
codecs/jxl/dec/jxl_node_dec.wasm
Executable file
Binary file not shown.
122
codecs/jxl/enc/jxl_enc.cpp
Normal file
122
codecs/jxl/enc/jxl_enc.cpp
Normal file
@@ -0,0 +1,122 @@
|
||||
#include <emscripten/bind.h>
|
||||
#include <emscripten/val.h>
|
||||
|
||||
#include "lib/jxl/base/thread_pool_internal.h"
|
||||
#include "lib/jxl/enc_external_image.h"
|
||||
#include "lib/jxl/enc_file.h"
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||
|
||||
struct JXLOptions {
|
||||
// 1 = slowest
|
||||
// 7 = fastest
|
||||
int speed;
|
||||
float quality;
|
||||
bool progressive;
|
||||
int epf;
|
||||
int nearLossless;
|
||||
bool lossyPalette;
|
||||
size_t decodingSpeedTier;
|
||||
};
|
||||
|
||||
val encode(std::string image, int width, int height, JXLOptions options) {
|
||||
jxl::CompressParams cparams;
|
||||
jxl::PassesEncoderState passes_enc_state;
|
||||
jxl::CodecInOut io;
|
||||
jxl::PaddedBytes bytes;
|
||||
jxl::ImageBundle* main = &io.Main();
|
||||
jxl::ThreadPoolInternal* pool_ptr = nullptr;
|
||||
#ifdef __EMSCRIPTEN_PTHREADS__
|
||||
jxl::ThreadPoolInternal pool;
|
||||
pool_ptr = &pool;
|
||||
#endif
|
||||
|
||||
cparams.epf = options.epf;
|
||||
cparams.speed_tier = static_cast<jxl::SpeedTier>(options.speed);
|
||||
cparams.near_lossless = options.nearLossless;
|
||||
cparams.decoding_speed_tier = options.decodingSpeedTier;
|
||||
|
||||
if (options.lossyPalette) {
|
||||
cparams.lossy_palette = true;
|
||||
cparams.palette_colors = 0;
|
||||
cparams.options.predictor = jxl::Predictor::Zero;
|
||||
}
|
||||
|
||||
float quality = options.quality;
|
||||
|
||||
// Quality settings roughly match libjpeg qualities.
|
||||
if (quality < 7 || quality == 100) {
|
||||
cparams.modular_mode = true;
|
||||
// Internal modular quality to roughly match VarDCT size.
|
||||
cparams.quality_pair.first = cparams.quality_pair.second =
|
||||
std::min(35 + (quality - 7) * 3.0f, 100.0f);
|
||||
} else {
|
||||
cparams.modular_mode = false;
|
||||
if (quality >= 30) {
|
||||
cparams.butteraugli_distance = 0.1 + (100 - quality) * 0.09;
|
||||
} else {
|
||||
cparams.butteraugli_distance = 6.4 + pow(2.5, (30 - quality) / 5.0f) / 6.25f;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.progressive) {
|
||||
cparams.qprogressive_mode = true;
|
||||
cparams.responsive = 1;
|
||||
if (!cparams.modular_mode) {
|
||||
cparams.progressive_dc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (cparams.modular_mode) {
|
||||
if (cparams.quality_pair.first != 100 || cparams.quality_pair.second != 100) {
|
||||
cparams.color_transform = jxl::ColorTransform::kXYB;
|
||||
} else {
|
||||
cparams.color_transform = jxl::ColorTransform::kNone;
|
||||
}
|
||||
}
|
||||
|
||||
if (cparams.near_lossless) {
|
||||
// Near-lossless assumes -R 0
|
||||
cparams.responsive = 0;
|
||||
cparams.modular_mode = true;
|
||||
}
|
||||
|
||||
io.metadata.m.SetAlphaBits(8);
|
||||
if (!io.metadata.size.Set(width, height)) {
|
||||
return val::null();
|
||||
}
|
||||
|
||||
uint8_t* inBuffer = (uint8_t*)image.c_str();
|
||||
|
||||
auto result = jxl::ConvertFromExternal(
|
||||
jxl::Span<const uint8_t>(reinterpret_cast<const uint8_t*>(image.data()), image.size()), width,
|
||||
height, jxl::ColorEncoding::SRGB(/*is_gray=*/false), /*has_alpha=*/true,
|
||||
/*alpha_is_premultiplied=*/false, /*bits_per_sample=*/8, /*endiannes=*/JXL_LITTLE_ENDIAN,
|
||||
/*flipped_y=*/false, pool_ptr, main);
|
||||
|
||||
if (!result) {
|
||||
return val::null();
|
||||
}
|
||||
|
||||
auto js_result = val::null();
|
||||
if (EncodeFile(cparams, &io, &passes_enc_state, &bytes, /*aux=*/nullptr, pool_ptr)) {
|
||||
js_result = Uint8Array.new_(typed_memory_view(bytes.size(), bytes.data()));
|
||||
}
|
||||
|
||||
return js_result;
|
||||
}
|
||||
|
||||
EMSCRIPTEN_BINDINGS(my_module) {
|
||||
value_object<JXLOptions>("JXLOptions")
|
||||
.field("speed", &JXLOptions::speed)
|
||||
.field("quality", &JXLOptions::quality)
|
||||
.field("progressive", &JXLOptions::progressive)
|
||||
.field("nearLossless", &JXLOptions::nearLossless)
|
||||
.field("lossyPalette", &JXLOptions::lossyPalette)
|
||||
.field("decodingSpeedTier", &JXLOptions::decodingSpeedTier)
|
||||
.field("epf", &JXLOptions::epf);
|
||||
|
||||
function("encode", &encode);
|
||||
}
|
||||
22
codecs/jxl/enc/jxl_enc.d.ts
vendored
Normal file
22
codecs/jxl/enc/jxl_enc.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export interface EncodeOptions {
|
||||
speed: number;
|
||||
quality: number;
|
||||
progressive: boolean;
|
||||
epf: number;
|
||||
nearLossless: number;
|
||||
lossyPalette: boolean;
|
||||
decodingSpeedTier: number;
|
||||
}
|
||||
|
||||
export interface JXLModule extends EmscriptenWasm.Module {
|
||||
encode(
|
||||
data: BufferSource,
|
||||
width: number,
|
||||
height: number,
|
||||
options: EncodeOptions,
|
||||
): Uint8Array | null;
|
||||
}
|
||||
|
||||
declare var moduleFactory: EmscriptenWasm.ModuleFactory<JXLModule>;
|
||||
|
||||
export default moduleFactory;
|
||||
69
codecs/jxl/enc/jxl_enc.js
generated
Normal file
69
codecs/jxl/enc/jxl_enc.js
generated
Normal file
@@ -0,0 +1,69 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var g;g||(g=typeof Module !== 'undefined' ? Module : {});var aa,ba;g.ready=new Promise(function(a,b){aa=a;ba=b});var t={},w;for(w in g)g.hasOwnProperty(w)&&(t[w]=g[w]);var ca="./this.program",y="",da;y=self.location.href;_scriptDir&&(y=_scriptDir);0!==y.indexOf("blob:")?y=y.substr(0,y.lastIndexOf("/")+1):y="";da=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};
|
||||
var ea=g.print||console.log.bind(console),z=g.printErr||console.warn.bind(console);for(w in t)t.hasOwnProperty(w)&&(g[w]=t[w]);t=null;g.thisProgram&&(ca=g.thisProgram);var A;g.wasmBinary&&(A=g.wasmBinary);var noExitRuntime=g.noExitRuntime||!0;"object"!==typeof WebAssembly&&C("no native wasm support detected");var fa,ha=!1,ia=new TextDecoder("utf8");function ja(a,b){if(!a)return"";b=a+b;for(var c=a;!(c>=b)&&D[c];)++c;return ia.decode(D.subarray(a,c))}
|
||||
function ka(a,b,c,d){if(0<d){d=c+d-1;for(var h=0;h<a.length;++h){var f=a.charCodeAt(h);if(55296<=f&&57343>=f){var m=a.charCodeAt(++h);f=65536+((f&1023)<<10)|m&1023}if(127>=f){if(c>=d)break;b[c++]=f}else{if(2047>=f){if(c+1>=d)break;b[c++]=192|f>>6}else{if(65535>=f){if(c+2>=d)break;b[c++]=224|f>>12}else{if(c+3>=d)break;b[c++]=240|f>>18;b[c++]=128|f>>12&63}b[c++]=128|f>>6&63}b[c++]=128|f&63}}b[c]=0}}
|
||||
function la(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var ma=new TextDecoder("utf-16le");function na(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&E[c];)++c;return ma.decode(D.subarray(a,c<<1))}function oa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var h=0;h<c;++h)F[b>>1]=a.charCodeAt(h),b+=2;F[b>>1]=0;return b-d}
|
||||
function pa(a){return 2*a.length}function qa(a,b){for(var c=0,d="";!(c>=b/4);){var h=G[a+4*c>>2];if(0==h)break;++c;65536<=h?(h-=65536,d+=String.fromCharCode(55296|h>>10,56320|h&1023)):d+=String.fromCharCode(h)}return d}function ra(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var h=0;h<a.length;++h){var f=a.charCodeAt(h);if(55296<=f&&57343>=f){var m=a.charCodeAt(++h);f=65536+((f&1023)<<10)|m&1023}G[b>>2]=f;b+=4;if(b+4>c)break}G[b>>2]=0;return b-d}
|
||||
function sa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var ta,H,D,F,E,G,I,ua,va;function wa(){var a=fa.buffer;ta=a;g.HEAP8=H=new Int8Array(a);g.HEAP16=F=new Int16Array(a);g.HEAP32=G=new Int32Array(a);g.HEAPU8=D=new Uint8Array(a);g.HEAPU16=E=new Uint16Array(a);g.HEAPU32=I=new Uint32Array(a);g.HEAPF32=ua=new Float32Array(a);g.HEAPF64=va=new Float64Array(a)}var J,xa=[],ya=[],za=[];function Aa(){var a=g.preRun.shift();xa.unshift(a)}
|
||||
var K=0,Ba=null,L=null;g.preloadedImages={};g.preloadedAudios={};function C(a){if(g.onAbort)g.onAbort(a);z(a);ha=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}var M=(new URL("jxl_enc.wasm",import.meta.url)).toString();function Ca(){try{if(M==M&&A)return new Uint8Array(A);if(da)return da(M);throw"both async and sync fetching of the wasm failed";}catch(a){C(a)}}
|
||||
function Da(){return A||"function"!==typeof fetch?Promise.resolve().then(function(){return Ca()}):fetch(M,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+M+"'";return a.arrayBuffer()}).catch(function(){return Ca()})}function Ea(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(g);else{var c=b.xa;"number"===typeof c?void 0===b.$?J.get(c)():J.get(c)(b.$):c(void 0===b.$?null:b.$)}}}
|
||||
function Fa(a){this.V=a-16;this.pa=function(b){G[this.V+8>>2]=b};this.ma=function(b){G[this.V+0>>2]=b};this.na=function(){G[this.V+4>>2]=0};this.la=function(){H[this.V+12>>0]=0};this.oa=function(){H[this.V+13>>0]=0};this.ia=function(b,c){this.pa(b);this.ma(c);this.na();this.la();this.oa()}}var Ga=0,N={};function Ha(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function O(a){return this.fromWireType(I[a>>2])}var P={},Q={},R={};
|
||||
function Ia(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ja(a,b){a=Ia(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function Ka(a){var b=Error,c=Ja(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var La=void 0;
|
||||
function Ma(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new La("Mismatched type converter count");for(var n=0;n<a.length;++n)S(a[n],k[n])}a.forEach(function(k){R[k]=b});var h=Array(b.length),f=[],m=0;b.forEach(function(k,n){Q.hasOwnProperty(k)?h[n]=Q[k]:(f.push(k),P.hasOwnProperty(k)||(P[k]=[]),P[k].push(function(){h[n]=Q[k];++m;m===f.length&&d(h)}))});0===f.length&&d(h)}
|
||||
function Na(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Oa=void 0;function U(a){for(var b="";D[a];)b+=Oa[D[a++]];return b}var Pa=void 0;function V(a){throw new Pa(a);}
|
||||
function S(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||V('type "'+d+'" must have a positive integer typeid pointer');if(Q.hasOwnProperty(a)){if(c.ha)return;V("Cannot register type '"+d+"' twice")}Q[a]=b;delete R[a];P.hasOwnProperty(a)&&(b=P[a],delete P[a],b.forEach(function(h){h()}))}var Qa=[],W=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Ra(a){4<a&&0===--W[a].aa&&(W[a]=void 0,Qa.push(a))}function X(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Qa.length?Qa.pop():W.length;W[b]={aa:1,value:a};return b}}function Sa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Ta(a,b){switch(b){case 2:return function(c){return this.fromWireType(ua[c>>2])};case 3:return function(c){return this.fromWireType(va[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Ua(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ja(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Va(a,b){var c=g;if(void 0===c[a].S){var d=c[a];c[a]=function(){c[a].S.hasOwnProperty(arguments.length)||V("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].S+")!");return c[a].S[arguments.length].apply(this,arguments)};c[a].S=[];c[a].S[d.ca]=d}}
|
||||
function Wa(a,b,c){g.hasOwnProperty(a)?((void 0===c||void 0!==g[a].S&&void 0!==g[a].S[c])&&V("Cannot register public name '"+a+"' twice"),Va(a,a),g.hasOwnProperty(c)&&V("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),g[a].S[c]=b):(g[a]=b,void 0!==c&&(g[a].za=c))}function Xa(a,b){for(var c=[],d=0;d<a;d++)c.push(G[(b>>2)+d]);return c}
|
||||
function Ya(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=g["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=J.get(b).apply(null,c);return d}}function Y(a,b){a=U(a);var c=a.includes("j")?Ya(a,b):J.get(b);"function"!==typeof c&&V("unknown function pointer with signature "+a+": "+b);return c}var Za=void 0;function $a(a){a=ab(a);var b=U(a);Z(a);return b}
|
||||
function bb(a,b){function c(f){h[f]||Q[f]||(R[f]?R[f].forEach(c):(d.push(f),h[f]=!0))}var d=[],h={};b.forEach(c);throw new Za(a+": "+d.map($a).join([", "]));}function cb(a,b,c){switch(b){case 0:return c?function(d){return H[d]}:function(d){return D[d]};case 1:return c?function(d){return F[d>>1]}:function(d){return E[d>>1]};case 2:return c?function(d){return G[d>>2]}:function(d){return I[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var db={};
|
||||
function eb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function fb(a,b){var c=Q[a];void 0===c&&V(b+" has unknown type "+$a(a));return c}var gb={},hb={};function ib(){if(!jb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in hb)a[b]=hb[b];var c=[];for(b in a)c.push(b+"="+a[b]);jb=c}return jb}
|
||||
var jb,kb=[null,[],[]];function lb(a){return 0===a%4&&(0!==a%100||0===a%400)}function mb(a,b){for(var c=0,d=0;d<=b;c+=a[d++]);return c}var nb=[31,29,31,30,31,30,31,31,30,31,30,31],ob=[31,28,31,30,31,30,31,31,30,31,30,31];function pb(a,b){for(a=new Date(a.getTime());0<b;){var c=a.getMonth(),d=(lb(a.getFullYear())?nb:ob)[c];if(b>d-a.getDate())b-=d-a.getDate()+1,a.setDate(1),11>c?a.setMonth(c+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
|
||||
function qb(a,b,c,d){function h(e,l,u){for(e="number"===typeof e?e.toString():e||"";e.length<l;)e=u[0]+e;return e}function f(e,l){return h(e,l,"0")}function m(e,l){function u(B){return 0>B?-1:0<B?1:0}var v;0===(v=u(e.getFullYear()-l.getFullYear()))&&0===(v=u(e.getMonth()-l.getMonth()))&&(v=u(e.getDate()-l.getDate()));return v}function k(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),
|
||||
0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function n(e){e=pb(new Date(e.R+1900,0,1),e.Z);var l=new Date(e.getFullYear()+1,0,4),u=k(new Date(e.getFullYear(),0,4));l=k(l);return 0>=m(u,e)?0>=m(l,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var p=G[d+40>>2];d={va:G[d>>2],ua:G[d+4>>2],X:G[d+8>>2],W:G[d+12>>2],U:G[d+16>>2],R:G[d+20>>2],Y:G[d+24>>2],Z:G[d+28>>2],Aa:G[d+32>>2],ta:G[d+36>>2],
|
||||
wa:p?ja(p):""};c=ja(c);p={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var q in p)c=c.replace(new RegExp(q,"g"),p[q]);var r="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
|
||||
x="January February March April May June July August September October November December".split(" ");p={"%a":function(e){return r[e.Y].substring(0,3)},"%A":function(e){return r[e.Y]},"%b":function(e){return x[e.U].substring(0,3)},"%B":function(e){return x[e.U]},"%C":function(e){return f((e.R+1900)/100|0,2)},"%d":function(e){return f(e.W,2)},"%e":function(e){return h(e.W,2," ")},"%g":function(e){return n(e).toString().substring(2)},"%G":function(e){return n(e)},"%H":function(e){return f(e.X,2)},"%I":function(e){e=
|
||||
e.X;0==e?e=12:12<e&&(e-=12);return f(e,2)},"%j":function(e){return f(e.W+mb(lb(e.R+1900)?nb:ob,e.U-1),3)},"%m":function(e){return f(e.U+1,2)},"%M":function(e){return f(e.ua,2)},"%n":function(){return"\n"},"%p":function(e){return 0<=e.X&&12>e.X?"AM":"PM"},"%S":function(e){return f(e.va,2)},"%t":function(){return"\t"},"%u":function(e){return e.Y||7},"%U":function(e){var l=new Date(e.R+1900,0,1),u=0===l.getDay()?l:pb(l,7-l.getDay());e=new Date(e.R+1900,e.U,e.W);return 0>m(u,e)?f(Math.ceil((31-u.getDate()+
|
||||
(mb(lb(e.getFullYear())?nb:ob,e.getMonth()-1)-31)+e.getDate())/7),2):0===m(u,l)?"01":"00"},"%V":function(e){var l=new Date(e.R+1901,0,4),u=k(new Date(e.R+1900,0,4));l=k(l);var v=pb(new Date(e.R+1900,0,1),e.Z);return 0>m(v,u)?"53":0>=m(l,v)?"01":f(Math.ceil((u.getFullYear()<e.R+1900?e.Z+32-u.getDate():e.Z+1-u.getDate())/7),2)},"%w":function(e){return e.Y},"%W":function(e){var l=new Date(e.R,0,1),u=1===l.getDay()?l:pb(l,0===l.getDay()?1:7-l.getDay()+1);e=new Date(e.R+1900,e.U,e.W);return 0>m(u,e)?f(Math.ceil((31-
|
||||
u.getDate()+(mb(lb(e.getFullYear())?nb:ob,e.getMonth()-1)-31)+e.getDate())/7),2):0===m(u,l)?"01":"00"},"%y":function(e){return(e.R+1900).toString().substring(2)},"%Y":function(e){return e.R+1900},"%z":function(e){e=e.ta;var l=0<=e;e=Math.abs(e)/60;return(l?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":function(e){return e.wa},"%%":function(){return"%"}};for(q in p)c.includes(q)&&(c=c.replace(new RegExp(q,"g"),p[q](d)));q=rb(c);if(q.length>b)return 0;H.set(q,a);return q.length-1}
|
||||
La=g.InternalError=Ka("InternalError");for(var sb=Array(256),tb=0;256>tb;++tb)sb[tb]=String.fromCharCode(tb);Oa=sb;Pa=g.BindingError=Ka("BindingError");g.count_emval_handles=function(){for(var a=0,b=5;b<W.length;++b)void 0!==W[b]&&++a;return a};g.get_first_emval=function(){for(var a=5;a<W.length;++a)if(void 0!==W[a])return W[a];return null};Za=g.UnboundTypeError=Ka("UnboundTypeError");function rb(a){var b=Array(la(a)+1);ka(a,b,0,b.length);return b}
|
||||
var vb={o:function(a){return ub(a+16)+16},D:function(){},n:function(a,b,c){(new Fa(a)).ia(b,c);Ga++;throw a;},k:function(a){var b=N[a];delete N[a];var c=b.ja,d=b.ka,h=b.ba,f=h.map(function(m){return m.ga}).concat(h.map(function(m){return m.ra}));Ma([a],f,function(m){var k={};h.forEach(function(n,p){var q=m[p],r=n.ea,x=n.fa,e=m[p+h.length],l=n.qa,u=n.sa;k[n.da]={read:function(v){return q.fromWireType(r(x,v))},write:function(v,B){var T=[];l(u,v,e.toWireType(T,B));Ha(T)}}});return[{name:b.name,fromWireType:function(n){var p=
|
||||
{},q;for(q in k)p[q]=k[q].read(n);d(n);return p},toWireType:function(n,p){for(var q in k)if(!(q in p))throw new TypeError('Missing field: "'+q+'"');var r=c();for(q in k)k[q].write(r,p[q]);null!==n&&n.push(d,r);return r},argPackAdvance:8,readValueFromPointer:O,T:d}]})},q:function(){},z:function(a,b,c,d,h){var f=Na(c);b=U(b);S(a,{name:b,fromWireType:function(m){return!!m},toWireType:function(m,k){return k?d:h},argPackAdvance:8,readValueFromPointer:function(m){if(1===c)var k=H;else if(2===c)k=F;else if(4===
|
||||
c)k=G;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[m>>f])},T:null})},y:function(a,b){b=U(b);S(a,{name:b,fromWireType:function(c){var d=W[c].value;Ra(c);return d},toWireType:function(c,d){return X(d)},argPackAdvance:8,readValueFromPointer:O,T:null})},h:function(a,b,c){c=Na(c);b=U(b);S(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,h){if("number"!==typeof h&&"boolean"!==typeof h)throw new TypeError('Cannot convert "'+Sa(h)+'" to '+this.name);
|
||||
return h},argPackAdvance:8,readValueFromPointer:Ta(b,c),T:null})},j:function(a,b,c,d,h,f){var m=Xa(b,c);a=U(a);h=Y(d,h);Wa(a,function(){bb("Cannot call "+a+" due to unbound types",m)},b-1);Ma([],m,function(k){var n=a,p=a;k=[k[0],null].concat(k.slice(1));var q=h,r=k.length;2>r&&V("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==k[1]&&!1,e=!1,l=1;l<k.length;++l)if(null!==k[l]&&void 0===k[l].T){e=!0;break}var u="void"!==k[0].name,v="",B="";for(l=0;l<
|
||||
r-2;++l)v+=(0!==l?", ":"")+"arg"+l,B+=(0!==l?", ":"")+"arg"+l+"Wired";p="return function "+Ia(p)+"("+v+") {\nif (arguments.length !== "+(r-2)+") {\nthrowBindingError('function "+p+" called with ' + arguments.length + ' arguments, expected "+(r-2)+" args!');\n}\n";e&&(p+="var destructors = [];\n");var T=e?"destructors":"null";v="throwBindingError invoker fn runDestructors retType classParam".split(" ");q=[V,q,f,Ha,k[0],k[1]];x&&(p+="var thisWired = classParam.toWireType("+T+", this);\n");for(l=0;l<
|
||||
r-2;++l)p+="var arg"+l+"Wired = argType"+l+".toWireType("+T+", arg"+l+"); // "+k[l+2].name+"\n",v.push("argType"+l),q.push(k[l+2]);x&&(B="thisWired"+(0<B.length?", ":"")+B);p+=(u?"var rv = ":"")+"invoker(fn"+(0<B.length?", ":"")+B+");\n";if(e)p+="runDestructors(destructors);\n";else for(l=x?1:2;l<k.length;++l)r=1===l?"thisWired":"arg"+(l-2)+"Wired",null!==k[l].T&&(p+=r+"_dtor("+r+"); // "+k[l].name+"\n",v.push(r+"_dtor"),q.push(k[l].T));u&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n");
|
||||
v.push(p+"}\n");k=Ua(v).apply(null,q);l=b-1;if(!g.hasOwnProperty(n))throw new La("Replacing nonexistant public symbol");void 0!==g[n].S&&void 0!==l?g[n].S[l]=k:(g[n]=k,g[n].ca=l);return[]})},c:function(a,b,c,d,h){function f(p){return p}b=U(b);-1===h&&(h=4294967295);var m=Na(c);if(0===d){var k=32-8*c;f=function(p){return p<<k>>>k}}var n=b.includes("unsigned");S(a,{name:b,fromWireType:f,toWireType:function(p,q){if("number"!==typeof q&&"boolean"!==typeof q)throw new TypeError('Cannot convert "'+Sa(q)+
|
||||
'" to '+this.name);if(q<d||q>h)throw new TypeError('Passing a number "'+Sa(q)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+h+"]!");return n?q>>>0:q|0},argPackAdvance:8,readValueFromPointer:cb(b,m,0!==d),T:null})},b:function(a,b,c){function d(f){f>>=2;var m=I;return new h(ta,m[f+1],m[f])}var h=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=U(c);S(a,{name:c,fromWireType:d,argPackAdvance:8,
|
||||
readValueFromPointer:d},{ha:!0})},i:function(a,b){b=U(b);var c="std::string"===b;S(a,{name:b,fromWireType:function(d){var h=I[d>>2];if(c)for(var f=d+4,m=0;m<=h;++m){var k=d+4+m;if(m==h||0==D[k]){f=ja(f,k-f);if(void 0===n)var n=f;else n+=String.fromCharCode(0),n+=f;f=k+1}}else{n=Array(h);for(m=0;m<h;++m)n[m]=String.fromCharCode(D[d+4+m]);n=n.join("")}Z(d);return n},toWireType:function(d,h){h instanceof ArrayBuffer&&(h=new Uint8Array(h));var f="string"===typeof h;f||h instanceof Uint8Array||h instanceof
|
||||
Uint8ClampedArray||h instanceof Int8Array||V("Cannot pass non-string to std::string");var m=(c&&f?function(){return la(h)}:function(){return h.length})(),k=ub(4+m+1);I[k>>2]=m;if(c&&f)ka(h,D,k+4,m+1);else if(f)for(f=0;f<m;++f){var n=h.charCodeAt(f);255<n&&(Z(k),V("String has UTF-16 code units that do not fit in 8 bits"));D[k+4+f]=n}else for(f=0;f<m;++f)D[k+4+f]=h[f];null!==d&&d.push(Z,k);return k},argPackAdvance:8,readValueFromPointer:O,T:function(d){Z(d)}})},g:function(a,b,c){c=U(c);if(2===b){var d=
|
||||
na;var h=oa;var f=pa;var m=function(){return E};var k=1}else 4===b&&(d=qa,h=ra,f=sa,m=function(){return I},k=2);S(a,{name:c,fromWireType:function(n){for(var p=I[n>>2],q=m(),r,x=n+4,e=0;e<=p;++e){var l=n+4+e*b;if(e==p||0==q[l>>k])x=d(x,l-x),void 0===r?r=x:(r+=String.fromCharCode(0),r+=x),x=l+b}Z(n);return r},toWireType:function(n,p){"string"!==typeof p&&V("Cannot pass non-string to C++ string type "+c);var q=f(p),r=ub(4+q+b);I[r>>2]=q>>k;h(p,r+4,q+b);null!==n&&n.push(Z,r);return r},argPackAdvance:8,
|
||||
readValueFromPointer:O,T:function(n){Z(n)}})},l:function(a,b,c,d,h,f){N[a]={name:U(b),ja:Y(c,d),ka:Y(h,f),ba:[]}},d:function(a,b,c,d,h,f,m,k,n,p){N[a].ba.push({da:U(b),ga:c,ea:Y(d,h),fa:f,ra:m,qa:Y(k,n),sa:p})},A:function(a,b){b=U(b);S(a,{ya:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},e:Ra,C:function(a){if(0===a)return X(eb());var b=db[a];a=void 0===b?U(a):b;return X(eb()[a])},B:function(a){4<a&&(W[a].aa+=1)},m:function(a,b,c,d){a||V("Cannot use deleted val. handle = "+
|
||||
a);a=W[a].value;var h=gb[b];if(!h){h="";for(var f=0;f<b;++f)h+=(0!==f?", ":"")+"arg"+f;var m="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(f=0;f<b;++f)m+="var argType"+f+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+f+'], "parameter '+f+'");\nvar arg'+f+" = argType"+f+".readValueFromPointer(args);\nargs += argType"+f+"['argPackAdvance'];\n";h=(new Function("requireRegisteredType","Module","__emval_register",m+("var obj = new constructor("+h+");\nreturn __emval_register(obj);\n}\n")))(fb,
|
||||
g,X);gb[b]=h}return h(a,c,d)},a:function(){C()},s:function(a,b,c){D.copyWithin(a,b,b+c)},f:function(a){var b=D.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{fa.grow(Math.min(2147483648,d)-ta.byteLength+65535>>>16);wa();var h=1;break a}catch(f){}h=void 0}if(h)return!0}return!1},u:function(a,b){var c=0;ib().forEach(function(d,h){var f=b+c;h=G[a+4*h>>2]=f;for(f=0;f<d.length;++f)H[h++>>0]=d.charCodeAt(f);
|
||||
H[h>>0]=0;c+=d.length+1});return 0},v:function(a,b){var c=ib();G[a>>2]=c.length;var d=0;c.forEach(function(h){d+=h.length+1});G[b>>2]=d;return 0},w:function(){return 0},p:function(){},x:function(a,b,c,d){for(var h=0,f=0;f<c;f++){for(var m=G[b+8*f>>2],k=G[b+(8*f+4)>>2],n=0;n<k;n++){var p=D[m+n],q=kb[a];if(0===p||10===p){for(p=0;q[p]&&!(NaN<=p);)++p;p=ia.decode(q.subarray?q.subarray(0,p):new Uint8Array(q.slice(0,p)));(1===a?ea:z)(p);q.length=0}else q.push(p)}h+=k}G[d>>2]=h;return 0},r:function(){},
|
||||
t:function(a,b,c,d){return qb(a,b,c,d)}};
|
||||
(function(){function a(h){g.asm=h.exports;fa=g.asm.E;wa();J=g.asm.K;ya.unshift(g.asm.F);K--;g.monitorRunDependencies&&g.monitorRunDependencies(K);0==K&&(null!==Ba&&(clearInterval(Ba),Ba=null),L&&(h=L,L=null,h()))}function b(h){a(h.instance)}function c(h){return Da().then(function(f){return WebAssembly.instantiate(f,d)}).then(h,function(f){z("failed to asynchronously prepare wasm: "+f);C(f)})}var d={a:vb};K++;g.monitorRunDependencies&&g.monitorRunDependencies(K);if(g.instantiateWasm)try{return g.instantiateWasm(d,
|
||||
a)}catch(h){return z("Module.instantiateWasm callback failed with error: "+h),!1}(function(){return A||"function"!==typeof WebAssembly.instantiateStreaming||M.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(M,{credentials:"same-origin"}).then(function(h){return WebAssembly.instantiateStreaming(h,d).then(b,function(f){z("wasm streaming compile failed: "+f);z("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();
|
||||
g.___wasm_call_ctors=function(){return(g.___wasm_call_ctors=g.asm.F).apply(null,arguments)};var ub=g._malloc=function(){return(ub=g._malloc=g.asm.G).apply(null,arguments)},Z=g._free=function(){return(Z=g._free=g.asm.H).apply(null,arguments)},ab=g.___getTypeName=function(){return(ab=g.___getTypeName=g.asm.I).apply(null,arguments)};g.___embind_register_native_and_builtin_types=function(){return(g.___embind_register_native_and_builtin_types=g.asm.J).apply(null,arguments)};
|
||||
g.dynCall_viijii=function(){return(g.dynCall_viijii=g.asm.L).apply(null,arguments)};g.dynCall_iiji=function(){return(g.dynCall_iiji=g.asm.M).apply(null,arguments)};g.dynCall_jiji=function(){return(g.dynCall_jiji=g.asm.N).apply(null,arguments)};g.dynCall_iiiiij=function(){return(g.dynCall_iiiiij=g.asm.O).apply(null,arguments)};g.dynCall_iiiiijj=function(){return(g.dynCall_iiiiijj=g.asm.P).apply(null,arguments)};g.dynCall_iiiiiijj=function(){return(g.dynCall_iiiiiijj=g.asm.Q).apply(null,arguments)};
|
||||
var wb;L=function xb(){wb||yb();wb||(L=xb)};
|
||||
function yb(){function a(){if(!wb&&(wb=!0,g.calledRun=!0,!ha)){Ea(ya);aa(g);if(g.onRuntimeInitialized)g.onRuntimeInitialized();if(g.postRun)for("function"==typeof g.postRun&&(g.postRun=[g.postRun]);g.postRun.length;){var b=g.postRun.shift();za.unshift(b)}Ea(za)}}if(!(0<K)){if(g.preRun)for("function"==typeof g.preRun&&(g.preRun=[g.preRun]);g.preRun.length;)Aa();Ea(xa);0<K||(g.setStatus?(g.setStatus("Running..."),setTimeout(function(){setTimeout(function(){g.setStatus("")},1);a()},1)):a())}}g.run=yb;
|
||||
if(g.preInit)for("function"==typeof g.preInit&&(g.preInit=[g.preInit]);0<g.preInit.length;)g.preInit.pop()();yb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/jxl/enc/jxl_enc.wasm
Executable file
BIN
codecs/jxl/enc/jxl_enc.wasm
Executable file
Binary file not shown.
1
codecs/jxl/enc/jxl_enc_mt.d.ts
vendored
Normal file
1
codecs/jxl/enc/jxl_enc_mt.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './jxl_enc';
|
||||
105
codecs/jxl/enc/jxl_enc_mt.js
generated
Normal file
105
codecs/jxl/enc/jxl_enc_mt.js
generated
Normal file
@@ -0,0 +1,105 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
function e(){m.buffer!=n&&u(m.buffer);return aa}function v(){m.buffer!=n&&u(m.buffer);return ba}function x(){m.buffer!=n&&u(m.buffer);return ca}function ea(){m.buffer!=n&&u(m.buffer);return fa}function A(){m.buffer!=n&&u(m.buffer);return ha}function B(){m.buffer!=n&&u(m.buffer);return ia}function ja(){m.buffer!=n&&u(m.buffer);return ka}var D;D||(D=typeof Module !== 'undefined' ? Module : {});var la,ma;D.ready=new Promise(function(a,b){la=a;ma=b});var E={},F;
|
||||
for(F in D)D.hasOwnProperty(F)&&(E[F]=D[F]);var na="./this.program";function oa(a,b){throw b;}var G=D.ENVIRONMENT_IS_PTHREAD||!1,H="",pa;H=self.location.href;_scriptDir&&(H=_scriptDir);0!==H.indexOf("blob:")?H=H.substr(0,H.lastIndexOf("/")+1):H="";pa=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};var qa=D.print||console.log.bind(console),J=D.printErr||console.warn.bind(console);
|
||||
for(F in E)E.hasOwnProperty(F)&&(D[F]=E[F]);E=null;D.thisProgram&&(na=D.thisProgram);D.quit&&(oa=D.quit);var ra;D.wasmBinary&&(ra=D.wasmBinary);var noExitRuntime=D.noExitRuntime||!0;"object"!==typeof WebAssembly&&K("no native wasm support detected");var m,sa,ta=!1;
|
||||
function ua(a,b,c){c=b+c;for(var d="";!(b>=c);){var f=a[b++];if(!f)break;if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function L(a,b){return a?ua(v(),a,b):""}
|
||||
function va(a,b,c,d){if(0<d){d=c+d-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(c>=d)break;b[c++]=g}else{if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6}else{if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63}b[c++]=128|g>>6&63}b[c++]=128|g&63}}b[c]=0}}function wa(a,b,c){va(a,v(),b,c)}
|
||||
function xa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function ya(a,b){for(var c="",d=0;!(d>=b/2);++d){var f=x()[a+2*d>>1];if(0==f)break;c+=String.fromCharCode(f)}return c}function za(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f){var g=a.charCodeAt(f);x()[b>>1]=g;b+=2}x()[b>>1]=0;return b-d}
|
||||
function Aa(a){return 2*a.length}function Ba(a,b){for(var c=0,d="";!(c>=b/4);){var f=A()[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}function Ca(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}A()[b>>2]=g;b+=4;if(b+4>c)break}A()[b>>2]=0;return b-d}
|
||||
function Da(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}function Ea(a,b){e().set(a,b)}var n,aa,ba,ca,fa,ha,ia,Fa,ka;G&&(n=D.buffer);function u(a){n=a;D.HEAP8=aa=new Int8Array(a);D.HEAP16=ca=new Int16Array(a);D.HEAP32=ha=new Int32Array(a);D.HEAPU8=ba=new Uint8Array(a);D.HEAPU16=fa=new Uint16Array(a);D.HEAPU32=ia=new Uint32Array(a);D.HEAPF32=Fa=new Float32Array(a);D.HEAPF64=ka=new Float64Array(a)}var Ga=D.INITIAL_MEMORY||16777216;
|
||||
if(G)m=D.wasmMemory,n=D.buffer;else if(D.wasmMemory)m=D.wasmMemory;else if(m=new WebAssembly.Memory({initial:Ga/65536,maximum:32768,shared:!0}),!(m.buffer instanceof SharedArrayBuffer))throw J("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),Error("bad memory");m&&(n=m.buffer);Ga=n.byteLength;u(n);var M,Ha=[],Ia=[],Ja=[];
|
||||
function Ka(){var a=D.preRun.shift();Ha.unshift(a)}var N=0,La=null,Ma=null;D.preloadedImages={};D.preloadedAudios={};function K(a){if(D.onAbort)D.onAbort(a);G&&console.error("Pthread aborting at "+Error().stack);J(a);ta=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ma(a);throw a;}var O=(new URL("jxl_enc_mt.wasm",import.meta.url)).toString();
|
||||
function Na(){try{if(O==O&&ra)return new Uint8Array(ra);if(pa)return pa(O);throw"both async and sync fetching of the wasm failed";}catch(a){K(a)}}function Oa(){return ra||"function"!==typeof fetch?Promise.resolve().then(function(){return Na()}):fetch(O,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+O+"'";return a.arrayBuffer()}).catch(function(){return Na()})}
|
||||
var Qa={60580:function(){throw"Canceled!";},60598:function(a,b){setTimeout(function(){Pa(a,b)},0)}};function Ra(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(D);else{var c=b.Yb;"number"===typeof c?void 0===b.Ia?M.get(c)():M.get(c)(b.Ia):c(void 0===b.Ia?null:b.Ia)}}}
|
||||
function Sa(a,b){if(0>=a||a>e().length||a&1||0>b)return-28;if(0==b)return 0;2147483647<=b&&(b=Infinity);var c=Atomics.load(A(),Ta>>2),d=0;if(c==a&&Atomics.compareExchange(A(),Ta>>2,c,0)==c&&(--b,d=1,0>=b))return 1;a=Atomics.notify(A(),a>>2,b);if(0<=a)return a+d;throw"Atomics.notify returned an unexpected value "+a;}D._emscripten_futex_wake=Sa;
|
||||
function Ua(a){if(G)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!a)throw"Internal Error! Null pthread_ptr in cleanupThread!";var b=P.Ba[a];b&&(A()[a+12>>2]=0,P.Qa(b.worker))}
|
||||
var P={za:[],Ea:[],Ya:[],sb:function(){for(var a=navigator.hardwareConcurrency,b=0;b<a;++b)P.Za()},tb:function(){for(var a=Q(228),b=0;57>b;++b)B()[a/4+b]=0;A()[a+12>>2]=a;b=a+152;A()[b>>2]=b;var c=Q(512);for(b=0;128>b;++b)B()[c/4+b]=0;Atomics.store(B(),a+100>>2,c);Atomics.store(B(),a+40>>2,a);Va(a,!1,1);Wa(a)},ub:function(){P.receiveObjectTransfer=P.yb;P.threadInit=P.Ob;P.threadCancel=P.Mb;P.threadExit=P.Nb;P.setExitStatus=P.Bb},Ba:{},Xa:[],zb:function(){for(;0<P.Xa.length;)P.Xa.pop()();G&&R()&&Xa()},
|
||||
gb:function(a,b){Atomics.store(B(),a+56>>2,1);Atomics.store(B(),a+60>>2,0);P.zb();Atomics.store(B(),a+4>>2,b);Atomics.store(B(),a+0>>2,1);Sa(a+0,2147483647);Va(0,0,0)},Bb:function(){},Nb:function(a){var b=R();b&&(P.gb(b,a),G&&postMessage({cmd:"exit"}))},Mb:function(){P.gb(R(),-1);postMessage({cmd:"cancelDone"})},Lb:function(){for(var a in P.Ba){var b=P.Ba[a];b&&b.worker&&P.Qa(b.worker)}P.Ba={};for(a=0;a<P.za.length;++a){var c=P.za[a];c.terminate()}P.za=[];for(a=0;a<P.Ea.length;++a)c=P.Ea[a],b=c.ya,
|
||||
P.Va(b),c.terminate();P.Ea=[]},Va:function(a){if(a){if(a.Ca){var b=A()[a.Ca+100>>2];A()[a.Ca+100>>2]=0;S(b);S(a.Ca)}a.Ca=0;a.Ua&&a.Fa&&S(a.Fa);a.Fa=0;a.worker&&(a.worker.ya=null)}},Qa:function(a){P.Ab(function(){delete P.Ba[a.ya.Ca];P.za.push(a);P.Ea.splice(P.Ea.indexOf(a),1);P.Va(a.ya);a.ya=void 0})},Ab:function(a){A()[Ya>>2]=0;try{a()}finally{A()[Ya>>2]=1}},yb:function(){},Ob:function(){for(var a in P.Ya)P.Ya[a]()},eb:function(a,b){a.onmessage=function(c){var d=c.data,f=d.cmd;a.ya&&(P.ib=a.ya.Ca);
|
||||
if(d.targetThread&&d.targetThread!=R()){var g=P.Ba[d.fc];g?g.worker.postMessage(c.data,d.transferList):console.error('Internal error! Worker sent a message "'+f+'" to target pthread '+d.targetThread+", but that thread no longer exists!")}else if("processQueuedMainThreadWork"===f)Za();else if("spawnThread"===f)$a(c.data);else if("cleanupThread"===f)Ua(d.thread);else if("killThread"===f){c=d.thread;if(G)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in killThread!";
|
||||
A()[c+12>>2]=0;c=P.Ba[c];c.worker.terminate();P.Va(c);P.Ea.splice(P.Ea.indexOf(c.worker),1);c.worker.ya=void 0}else if("cancelThread"===f){c=d.thread;if(G)throw"Internal Error! cancelThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in cancelThread!";P.Ba[c].worker.postMessage({cmd:"cancel"})}else if("loaded"===f)a.loaded=!0,b&&b(a),a.Ka&&(a.Ka(),delete a.Ka);else if("print"===f)qa("Thread "+d.threadId+": "+d.text);else if("printErr"===f)J("Thread "+
|
||||
d.threadId+": "+d.text);else if("alert"===f)alert("Thread "+d.threadId+": "+d.text);else if("exit"===f)a.ya&&Atomics.load(B(),a.ya.Ca+64>>2)&&P.Qa(a);else if("exitProcess"===f)try{g=d.returnCode;if(G)throw postMessage({cmd:"exitProcess",returnCode:g}),new ab(g);if(!bb()){P.Lb();if(D.onExit)D.onExit(g);ta=!0}oa(g,new ab(g))}catch(l){if(l instanceof ab)return;throw l;}else"cancelDone"===f?P.Qa(a):"objectTransfer"!==f&&("setimmediate"===c.data.target?a.postMessage(c.data):J("worker sent an unknown command "+
|
||||
f));P.ib=void 0};a.onerror=function(c){J("pthread sent an error! "+c.filename+":"+c.lineno+": "+c.message)};a.postMessage({cmd:"load",urlOrBlob:D.mainScriptUrlOrBlob,wasmMemory:m,wasmModule:sa})},Za:function(){if(D.locateFile){var a=D.locateFile?D.locateFile("jxl_enc_mt.worker.js",H):H+"jxl_enc_mt.worker.js";P.za.push(new Worker(a))}else P.za.push(new Worker(new URL("jxl_enc_mt.worker.js",import.meta.url)))},lb:function(){0==P.za.length&&(P.Za(),P.eb(P.za[0]));return P.za.pop()},Ub:function(a){for(a=
|
||||
performance.now()+a;performance.now()<a;);}};D.establishStackSpace=function(a,b){cb(a,b);db(a)};D.invokeEntryPoint=function(a,b){return M.get(a)(b)};var eb=0;function bb(){return noExitRuntime||0<eb}D.keepRuntimeAlive=bb;var fb;fb=G?function(){return performance.now()-D.__performance_now_clock_drift}:function(){return performance.now()};function gb(a,b){P.Xa.push(function(){M.get(a)(b)})}
|
||||
function hb(a){this.Ja=a-16;this.Gb=function(b){A()[this.Ja+8>>2]=b};this.Db=function(b){A()[this.Ja+0>>2]=b};this.Eb=function(){A()[this.Ja+4>>2]=0};this.Cb=function(){var b=0;e()[this.Ja+12>>0]=b};this.Fb=function(){var b=0;e()[this.Ja+13>>0]=b};this.qb=function(b,c){this.Gb(b);this.Db(c);this.Eb();this.Cb();this.Fb()}}var ib=0,jb={};function kb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function lb(a){return this.fromWireType(B()[a>>2])}var T={},U={},mb={};
|
||||
function nb(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function ob(a,b){a=nb(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function pb(a){var b=Error,c=ob(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var qb=void 0;
|
||||
function rb(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new qb("Mismatched type converter count");for(var q=0;q<a.length;++q)V(a[q],k[q])}a.forEach(function(k){mb[k]=b});var f=Array(b.length),g=[],l=0;b.forEach(function(k,q){U.hasOwnProperty(k)?f[q]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[q]=U[k];++l;l===g.length&&d(f)}))});0===g.length&&d(f)}
|
||||
function sb(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var tb=void 0;function W(a){for(var b="";v()[a];)b+=tb[v()[a++]];return b}var ub=void 0;function X(a){throw new ub(a);}
|
||||
function V(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||X('type "'+d+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.pb)return;X("Cannot register type '"+d+"' twice")}U[a]=b;delete mb[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var vb=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function wb(a){4<a&&0===--Y[a].Wa&&(Y[a]=void 0,vb.push(a))}function xb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=vb.length?vb.pop():Y.length;Y[b]={Wa:1,value:a};return b}}function yb(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function zb(a,b){switch(b){case 2:return function(c){var d=this.fromWireType;m.buffer!=n&&u(m.buffer);return d.call(this,Fa[c>>2])};case 3:return function(c){return this.fromWireType(ja()[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}
|
||||
function Ab(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=ob(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Bb(a,b){var c=D;if(void 0===c[a].Aa){var d=c[a];c[a]=function(){c[a].Aa.hasOwnProperty(arguments.length)||X("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Aa+")!");return c[a].Aa[arguments.length].apply(this,arguments)};c[a].Aa=[];c[a].Aa[d.hb]=d}}
|
||||
function Cb(a,b,c){D.hasOwnProperty(a)?((void 0===c||void 0!==D[a].Aa&&void 0!==D[a].Aa[c])&&X("Cannot register public name '"+a+"' twice"),Bb(a,a),D.hasOwnProperty(c)&&X("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),D[a].Aa[c]=b):(D[a]=b,void 0!==c&&(D[a].cc=c))}function Db(a,b){for(var c=[],d=0;d<a;d++)c.push(A()[(b>>2)+d]);return c}
|
||||
function Eb(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=D["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=M.get(b).apply(null,c);return d}}function Fb(a,b){a=W(a);var c=a.includes("j")?Eb(a,b):M.get(b);"function"!==typeof c&&X("unknown function pointer with signature "+a+": "+b);return c}var Gb=void 0;function Hb(a){a=Ib(a);var b=W(a);S(a);return b}
|
||||
function Jb(a,b){function c(g){f[g]||U[g]||(mb[g]?mb[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Gb(a+": "+d.map(Hb).join([", "]));}function Kb(a,b,c){switch(b){case 0:return c?function(d){return e()[d]}:function(d){return v()[d]};case 1:return c?function(d){return x()[d>>1]}:function(d){return ea()[d>>1]};case 2:return c?function(d){return A()[d>>2]}:function(d){return B()[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var Lb={};
|
||||
function Mb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function Nb(a,b){var c=U[a];void 0===c&&X(b+" has unknown type "+Hb(a));return c}var Ob={},Pb=[];function Qb(a,b,c){if(0>=a||a>e().length||a&1)return-28;a=Atomics.wait(A(),a>>2,b,c);if("timed-out"===a)return-73;if("not-equal"===a)return-6;if("ok"===a)return 0;throw"Atomics.wait returned an unexpected value "+a;}
|
||||
function Z(a,b){for(var c=arguments.length-2,d=Rb(),f=Sb(8*c),g=f>>3,l=0;l<c;l++){var k=arguments[2+l];ja()[g+l]=k}c=Tb(a,c,f,b);db(d);return c}var Ub=[],Vb=[0,"undefined"!==typeof document?document:0,"undefined"!==typeof window?window:0];function Wb(a){a=2<a?L(a):a;return Vb[a]||("undefined"!==typeof document?document.querySelector(a):void 0)}
|
||||
function Xb(a,b,c){var d=Wb(a);if(!d)return-4;d.Oa&&(A()[d.Oa>>2]=b,A()[d.Oa+4>>2]=c);if(d.fb||!d.Wb)d.fb&&(d=d.fb),a=!1,d.Na&&d.Na.Ma&&(a=d.Na.Ma.getParameter(2978),a=0===a[0]&&0===a[1]&&a[2]===d.width&&a[3]===d.height),d.width=b,d.height=c,a&&d.Na.Ma.viewport(0,0,b,c);else{if(d.Oa){d=A()[d.Oa+8>>2];a=a?L(a):"";var f=Rb(),g=Sb(12),l=0;if(a){l=xa(a)+1;var k=Q(l);wa(a,k,l);l=k}A()[g>>2]=l;A()[g+4>>2]=b;A()[g+8>>2]=c;Yb(0,d,657457152,0,l,g);db(f);return 1}return-4}return 0}
|
||||
function Zb(a,b,c){return G?Z(2,1,a,b,c):Xb(a,b,c)}function $b(a){var b=a.getExtension("ANGLE_instanced_arrays");b&&(a.vertexAttribDivisor=function(c,d){b.vertexAttribDivisorANGLE(c,d)},a.drawArraysInstanced=function(c,d,f,g){b.drawArraysInstancedANGLE(c,d,f,g)},a.drawElementsInstanced=function(c,d,f,g,l){b.drawElementsInstancedANGLE(c,d,f,g,l)})}
|
||||
function ac(a){var b=a.getExtension("OES_vertex_array_object");b&&(a.createVertexArray=function(){return b.createVertexArrayOES()},a.deleteVertexArray=function(c){b.deleteVertexArrayOES(c)},a.bindVertexArray=function(c){b.bindVertexArrayOES(c)},a.isVertexArray=function(c){return b.isVertexArrayOES(c)})}function bc(a){var b=a.getExtension("WEBGL_draw_buffers");b&&(a.drawBuffers=function(c,d){b.drawBuffersWEBGL(c,d)})}
|
||||
function cc(a,b){a.cb||(a.cb=a.getContext,a.getContext=function(d,f){f=a.cb(d,f);return"webgl"==d==f instanceof WebGLRenderingContext?f:null});var c=a.getContext("webgl",b);return c?dc(c,b):0}function dc(a,b){var c=Q(8);A()[c+4>>2]=R();var d={Zb:c,attributes:b,version:b.vb,Ma:a};a.canvas&&(a.canvas.Na=d);("undefined"===typeof b.ab||b.ab)&&ec(d);return c}
|
||||
function ec(a){a||(a=fc);if(!a.rb){a.rb=!0;var b=a.Ma;$b(b);ac(b);bc(b);b.Xb=b.getExtension("EXT_disjoint_timer_query");b.bc=b.getExtension("WEBGL_multi_draw");(b.getSupportedExtensions()||[]).forEach(function(c){c.includes("lose_context")||c.includes("debug")||b.getExtension(c)})}}var fc,gc=["default","low-power","high-performance"],hc={};
|
||||
function ic(){if(!jc){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:na||"./this.program"},b;for(b in hc)a[b]=hc[b];var c=[];for(b in a)c.push(b+"="+a[b]);jc=c}return jc}var jc,kc=[null,[],[]];
|
||||
function lc(a,b){if(G)return Z(3,1,a,b);var c=0;ic().forEach(function(d,f){var g=b+c;f=A()[a+4*f>>2]=g;for(g=0;g<d.length;++g)e()[f++>>0]=d.charCodeAt(g);e()[f>>0]=0;c+=d.length+1});return 0}function mc(a,b){if(G)return Z(4,1,a,b);var c=ic();A()[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+1});A()[b>>2]=d;return 0}function nc(a){return G?Z(5,1,a):0}function oc(a,b,c,d,f){if(G)return Z(6,1,a,b,c,d,f)}
|
||||
function pc(a,b,c,d){if(G)return Z(7,1,a,b,c,d);for(var f=0,g=0;g<c;g++){for(var l=A()[b+8*g>>2],k=A()[b+(8*g+4)>>2],q=0;q<k;q++){var r=v()[l+q],t=kc[a];0===r||10===r?((1===a?qa:J)(ua(t,0)),t.length=0):t.push(r)}f+=k}A()[d>>2]=f;return 0}
|
||||
function $a(a){if(G)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var b=P.lb();if(!b)return 6;if(void 0!==b.ya)throw"Internal error!";if(!a.Pa)throw"Internal error, no pthread ptr!";P.Ea.push(b);for(var c=Q(512),d=0;128>d;++d)A()[c+4*d>>2]=0;var f=a.Fa+a.Ga;d=P.Ba[a.Pa]={worker:b,Fa:a.Fa,Ga:a.Ga,Ua:a.Ua,Ca:a.Pa};var g=d.Ca>>2;Atomics.store(B(),g+16,a.$a);Atomics.store(B(),g+25,c);Atomics.store(B(),g+10,d.Ca);Atomics.store(B(),g+20,a.Ga);Atomics.store(B(),
|
||||
g+19,f);Atomics.store(B(),g+26,a.Ga);Atomics.store(B(),g+28,f);Atomics.store(B(),g+29,a.$a);c=qc()+40;Atomics.store(B(),g+43,c);b.ya=d;var l={cmd:"run",start_routine:a.Kb,arg:a.Ia,threadInfoStruct:a.Pa,stackBase:a.Fa,stackSize:a.Ga};b.Ka=function(){l.time=performance.now();b.postMessage(l,a.Tb)};b.loaded&&(b.Ka(),delete b.Ka);return 0}
|
||||
function rc(a,b){if(!a)return J("pthread_join attempted on a null thread pointer!"),71;if(G&&R()==a)return J("PThread "+a+" is attempting to join to itself!"),16;if(!G&&sc()==a)return J("Main thread "+a+" is attempting to join to itself!"),16;if(A()[a+12>>2]!==a)return J("pthread_join attempted on thread "+a+", which does not point to a valid thread, or does not exist anymore!"),71;if(Atomics.load(B(),a+64>>2))return J("Attempted to join thread "+a+", which was already detached!"),28;for(;;){var c=
|
||||
Atomics.load(B(),a+0>>2);if(1==c)return c=Atomics.load(B(),a+4>>2),b&&(A()[b>>2]=c),Atomics.store(B(),a+64>>2,1),G?postMessage({cmd:"cleanupThread",thread:a}):Ua(a),0;if(G){var d=R();if(d&&!Atomics.load(B(),d+56>>2)&&2==Atomics.load(B(),d+0>>2))throw"Canceled!";}G||Za();Qb(a+0,c,G?100:1)}}function tc(a){return 0===a%4&&(0!==a%100||0===a%400)}function uc(a,b){for(var c=0,d=0;d<=b;c+=a[d++]);return c}var vc=[31,29,31,30,31,30,31,31,30,31,30,31],wc=[31,28,31,30,31,30,31,31,30,31,30,31];
|
||||
function xc(a,b){for(a=new Date(a.getTime());0<b;){var c=a.getMonth(),d=(tc(a.getFullYear())?vc:wc)[c];if(b>d-a.getDate())b-=d-a.getDate()+1,a.setDate(1),11>c?a.setMonth(c+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
|
||||
function yc(a,b,c,d){function f(h,p,y){for(h="number"===typeof h?h.toString():h||"";h.length<p;)h=y[0]+h;return h}function g(h,p){return f(h,p,"0")}function l(h,p){function y(I){return 0>I?-1:0<I?1:0}var z;0===(z=y(h.getFullYear()-p.getFullYear()))&&0===(z=y(h.getMonth()-p.getMonth()))&&(z=y(h.getDate()-p.getDate()));return z}function k(h){switch(h.getDay()){case 0:return new Date(h.getFullYear()-1,11,29);case 1:return h;case 2:return new Date(h.getFullYear(),0,3);case 3:return new Date(h.getFullYear(),
|
||||
0,2);case 4:return new Date(h.getFullYear(),0,1);case 5:return new Date(h.getFullYear()-1,11,31);case 6:return new Date(h.getFullYear()-1,11,30)}}function q(h){h=xc(new Date(h.xa+1900,0,1),h.Ta);var p=new Date(h.getFullYear()+1,0,4),y=k(new Date(h.getFullYear(),0,4));p=k(p);return 0>=l(y,h)?0>=l(p,h)?h.getFullYear()+1:h.getFullYear():h.getFullYear()-1}var r=A()[d+40>>2];d={Rb:A()[d>>2],Qb:A()[d+4>>2],Ra:A()[d+8>>2],La:A()[d+12>>2],Ha:A()[d+16>>2],xa:A()[d+20>>2],Sa:A()[d+24>>2],Ta:A()[d+28>>2],hc:A()[d+
|
||||
32>>2],Pb:A()[d+36>>2],Sb:r?L(r):""};c=L(c);r={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var t in r)c=c.replace(new RegExp(t,"g"),r[t]);var w="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
|
||||
C="January February March April May June July August September October November December".split(" ");r={"%a":function(h){return w[h.Sa].substring(0,3)},"%A":function(h){return w[h.Sa]},"%b":function(h){return C[h.Ha].substring(0,3)},"%B":function(h){return C[h.Ha]},"%C":function(h){return g((h.xa+1900)/100|0,2)},"%d":function(h){return g(h.La,2)},"%e":function(h){return f(h.La,2," ")},"%g":function(h){return q(h).toString().substring(2)},"%G":function(h){return q(h)},"%H":function(h){return g(h.Ra,
|
||||
2)},"%I":function(h){h=h.Ra;0==h?h=12:12<h&&(h-=12);return g(h,2)},"%j":function(h){return g(h.La+uc(tc(h.xa+1900)?vc:wc,h.Ha-1),3)},"%m":function(h){return g(h.Ha+1,2)},"%M":function(h){return g(h.Qb,2)},"%n":function(){return"\n"},"%p":function(h){return 0<=h.Ra&&12>h.Ra?"AM":"PM"},"%S":function(h){return g(h.Rb,2)},"%t":function(){return"\t"},"%u":function(h){return h.Sa||7},"%U":function(h){var p=new Date(h.xa+1900,0,1),y=0===p.getDay()?p:xc(p,7-p.getDay());h=new Date(h.xa+1900,h.Ha,h.La);return 0>
|
||||
l(y,h)?g(Math.ceil((31-y.getDate()+(uc(tc(h.getFullYear())?vc:wc,h.getMonth()-1)-31)+h.getDate())/7),2):0===l(y,p)?"01":"00"},"%V":function(h){var p=new Date(h.xa+1901,0,4),y=k(new Date(h.xa+1900,0,4));p=k(p);var z=xc(new Date(h.xa+1900,0,1),h.Ta);return 0>l(z,y)?"53":0>=l(p,z)?"01":g(Math.ceil((y.getFullYear()<h.xa+1900?h.Ta+32-y.getDate():h.Ta+1-y.getDate())/7),2)},"%w":function(h){return h.Sa},"%W":function(h){var p=new Date(h.xa,0,1),y=1===p.getDay()?p:xc(p,0===p.getDay()?1:7-p.getDay()+1);h=
|
||||
new Date(h.xa+1900,h.Ha,h.La);return 0>l(y,h)?g(Math.ceil((31-y.getDate()+(uc(tc(h.getFullYear())?vc:wc,h.getMonth()-1)-31)+h.getDate())/7),2):0===l(y,p)?"01":"00"},"%y":function(h){return(h.xa+1900).toString().substring(2)},"%Y":function(h){return h.xa+1900},"%z":function(h){h=h.Pb;var p=0<=h;h=Math.abs(h)/60;return(p?"+":"-")+String("0000"+(h/60*100+h%60)).slice(-4)},"%Z":function(h){return h.Sb},"%%":function(){return"%"}};for(t in r)c.includes(t)&&(c=c.replace(new RegExp(t,"g"),r[t](d)));t=zc(c);
|
||||
if(t.length>b)return 0;Ea(t,a);return t.length-1}G||P.sb();qb=D.InternalError=pb("InternalError");for(var Ac=Array(256),Bc=0;256>Bc;++Bc)Ac[Bc]=String.fromCharCode(Bc);tb=Ac;ub=D.BindingError=pb("BindingError");D.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};D.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};Gb=D.UnboundTypeError=pb("UnboundTypeError");
|
||||
var Cc=[null,function(a,b){if(G)return Z(1,1,a,b)},Zb,lc,mc,nc,oc,pc];function zc(a){var b=Array(xa(a)+1);va(a,b,0,b.length);return b}
|
||||
var Fc={e:function(a,b,c,d){K("Assertion failed: "+L(a)+", at: "+[b?L(b):"unknown filename",c,d?L(d):"unknown function"])},J:function(a){return Q(a+16)+16},q:function(a,b){return gb(a,b)},B:function(a,b,c){(new hb(a)).qb(b,c);ib++;throw a;},s:function(a){var b=jb[a];delete jb[a];var c=b.wb,d=b.xb,f=b.bb,g=f.map(function(l){return l.ob}).concat(f.map(function(l){return l.Ib}));rb([a],g,function(l){var k={};f.forEach(function(q,r){var t=l[r],w=q.mb,C=q.nb,h=l[r+f.length],p=q.Hb,y=q.Jb;k[q.kb]={read:function(z){return t.fromWireType(w(C,
|
||||
z))},write:function(z,I){var da=[];p(y,z,h.toWireType(da,I));kb(da)}}});return[{name:b.name,fromWireType:function(q){var r={},t;for(t in k)r[t]=k[t].read(q);d(q);return r},toWireType:function(q,r){for(var t in k)if(!(t in r))throw new TypeError('Missing field: "'+t+'"');var w=c();for(t in k)k[t].write(w,r[t]);null!==q&&q.push(d,w);return w},argPackAdvance:8,readValueFromPointer:lb,Da:d}]})},w:function(){},Q:function(a,b,c,d,f){var g=sb(c);b=W(b);V(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,
|
||||
k){return k?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=e();else if(2===c)k=x();else if(4===c)k=A();else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},Da:null})},P:function(a,b){b=W(b);V(a,{name:b,fromWireType:function(c){var d=Y[c].value;wb(c);return d},toWireType:function(c,d){return xb(d)},argPackAdvance:8,readValueFromPointer:lb,Da:null})},o:function(a,b,c){c=sb(c);b=W(b);V(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,
|
||||
f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+yb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:zb(b,c),Da:null})},r:function(a,b,c,d,f,g){var l=Db(b,c);a=W(a);f=Fb(d,f);Cb(a,function(){Jb("Cannot call "+a+" due to unbound types",l)},b-1);rb([],l,function(k){var q=a,r=a;k=[k[0],null].concat(k.slice(1));var t=f,w=k.length;2>w&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var C=null!==k[1]&&!1,
|
||||
h=!1,p=1;p<k.length;++p)if(null!==k[p]&&void 0===k[p].Da){h=!0;break}var y="void"!==k[0].name,z="",I="";for(p=0;p<w-2;++p)z+=(0!==p?", ":"")+"arg"+p,I+=(0!==p?", ":"")+"arg"+p+"Wired";r="return function "+nb(r)+"("+z+") {\nif (arguments.length !== "+(w-2)+") {\nthrowBindingError('function "+r+" called with ' + arguments.length + ' arguments, expected "+(w-2)+" args!');\n}\n";h&&(r+="var destructors = [];\n");var da=h?"destructors":"null";z="throwBindingError invoker fn runDestructors retType classParam".split(" ");
|
||||
t=[X,t,g,kb,k[0],k[1]];C&&(r+="var thisWired = classParam.toWireType("+da+", this);\n");for(p=0;p<w-2;++p)r+="var arg"+p+"Wired = argType"+p+".toWireType("+da+", arg"+p+"); // "+k[p+2].name+"\n",z.push("argType"+p),t.push(k[p+2]);C&&(I="thisWired"+(0<I.length?", ":"")+I);r+=(y?"var rv = ":"")+"invoker(fn"+(0<I.length?", ":"")+I+");\n";if(h)r+="runDestructors(destructors);\n";else for(p=C?1:2;p<k.length;++p)w=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==k[p].Da&&(r+=w+"_dtor("+w+"); // "+k[p].name+
|
||||
"\n",z.push(w+"_dtor"),t.push(k[p].Da));y&&(r+="var ret = retType.fromWireType(rv);\nreturn ret;\n");z.push(r+"}\n");k=Ab(z).apply(null,t);p=b-1;if(!D.hasOwnProperty(q))throw new qb("Replacing nonexistant public symbol");void 0!==D[q].Aa&&void 0!==p?D[q].Aa[p]=k:(D[q]=k,D[q].hb=p);return[]})},d:function(a,b,c,d,f){function g(r){return r}b=W(b);-1===f&&(f=4294967295);var l=sb(c);if(0===d){var k=32-8*c;g=function(r){return r<<k>>>k}}var q=b.includes("unsigned");V(a,{name:b,fromWireType:g,toWireType:function(r,
|
||||
t){if("number"!==typeof t&&"boolean"!==typeof t)throw new TypeError('Cannot convert "'+yb(t)+'" to '+this.name);if(t<d||t>f)throw new TypeError('Passing a number "'+yb(t)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return q?t>>>0:t|0},argPackAdvance:8,readValueFromPointer:Kb(b,l,0!==d),Da:null})},c:function(a,b,c){function d(g){g>>=2;var l=B();return new f(n,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,
|
||||
Uint32Array,Float32Array,Float64Array][b];c=W(c);V(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{pb:!0})},p:function(a,b){b=W(b);var c="std::string"===b;V(a,{name:b,fromWireType:function(d){var f=B()[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var k=d+4+l;if(l==f||0==v()[k]){g=L(g,k-g);if(void 0===q)var q=g;else q+=String.fromCharCode(0),q+=g;g=k+1}}else{q=Array(f);for(l=0;l<f;++l)q[l]=String.fromCharCode(v()[d+4+l]);q=q.join("")}S(d);return q},toWireType:function(d,f){f instanceof
|
||||
ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||X("Cannot pass non-string to std::string");var l=(c&&g?function(){return xa(f)}:function(){return f.length})(),k=Q(4+l+1);B()[k>>2]=l;if(c&&g)wa(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var q=f.charCodeAt(g);255<q&&(S(k),X("String has UTF-16 code units that do not fit in 8 bits"));v()[k+4+g]=q}else for(g=0;g<l;++g)v()[k+4+g]=f[g];null!==d&&d.push(S,k);return k},
|
||||
argPackAdvance:8,readValueFromPointer:lb,Da:function(d){S(d)}})},k:function(a,b,c){c=W(c);if(2===b){var d=ya;var f=za;var g=Aa;var l=function(){return ea()};var k=1}else 4===b&&(d=Ba,f=Ca,g=Da,l=function(){return B()},k=2);V(a,{name:c,fromWireType:function(q){for(var r=B()[q>>2],t=l(),w,C=q+4,h=0;h<=r;++h){var p=q+4+h*b;if(h==r||0==t[p>>k])C=d(C,p-C),void 0===w?w=C:(w+=String.fromCharCode(0),w+=C),C=p+b}S(q);return w},toWireType:function(q,r){"string"!==typeof r&&X("Cannot pass non-string to C++ string type "+
|
||||
c);var t=g(r),w=Q(4+t+b);B()[w>>2]=t>>k;f(r,w+4,t+b);null!==q&&q.push(S,w);return w},argPackAdvance:8,readValueFromPointer:lb,Da:function(q){S(q)}})},t:function(a,b,c,d,f,g){jb[a]={name:W(b),wb:Fb(c,d),xb:Fb(f,g),bb:[]}},f:function(a,b,c,d,f,g,l,k,q,r){jb[a].bb.push({kb:W(b),ob:c,mb:Fb(d,f),nb:g,Ib:l,Hb:Fb(k,q),Jb:r})},R:function(a,b){b=W(b);V(a,{$b:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},I:function(a,b){if(a==b)postMessage({cmd:"processQueuedMainThreadWork"});
|
||||
else if(G)postMessage({targetThread:a,cmd:"processThreadQueue"});else{a=(a=P.Ba[a])&&a.worker;if(!a)return;a.postMessage({cmd:"processThreadQueue"})}return 1},i:wb,U:function(a){if(0===a)return xb(Mb());var b=Lb[a];a=void 0===b?W(a):b;return xb(Mb()[a])},T:function(a){4<a&&(Y[a].Wa+=1)},u:function(a,b,c,d){a||X("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=Ob[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";
|
||||
for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(Nb,D,xb);Ob[b]=f}return f(a,c,d)},b:function(){K()},n:function(a,b,c){Pb.length=0;var d;for(c>>=2;d=v()[b++];)(d=105>d)&&c&1&&c++,
|
||||
Pb.push(d?ja()[c++>>1]:A()[c]),++c;return Qa[a].apply(null,Pb)},E:function(){},m:function(){},h:Qb,g:Sa,j:fb,z:function(a,b,c){v().copyWithin(a,b,b+c)},D:function(){return navigator.hardwareConcurrency},F:function(a,b,c){Ub.length=b;c>>=3;for(var d=0;d<b;d++)Ub[d]=ja()[c+d];return(0>a?Qa[-a-1]:Cc[a]).apply(null,Ub)},A:function(a){var b=v().length;a>>>=0;if(a<=b||2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{m.grow(Math.min(2147483648,
|
||||
d)-n.byteLength+65535>>>16);u(m.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},G:function(a,b,c){return Wb(a)?Xb(a,b,c):Zb(a,b,c)},l:function(){},H:function(a,b){b>>=2;var c=A()[b+6];b={alpha:!!A()[b],depth:!!A()[b+1],stencil:!!A()[b+2],antialias:!!A()[b+3],premultipliedAlpha:!!A()[b+4],preserveDrawingBuffer:!!A()[b+5],powerPreference:gc[c],failIfMajorPerformanceCaveat:!!A()[b+7],vb:A()[b+8],ac:A()[b+9],ab:A()[b+10],jb:A()[b+11],dc:A()[b+12],ec:A()[b+13]};a=Wb(a);return!a||b.jb?
|
||||
0:cc(a,b)},L:lc,M:mc,N:nc,v:oc,O:pc,y:function(){P.tb()},a:m||D.wasmMemory,S:function(a,b,c,d){if("undefined"===typeof SharedArrayBuffer)return J("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!a)return J("pthread_create called with a null thread pointer!"),28;var f=[];if(G&&0===f.length)return Dc(687865856,a,b,c,d);var g=0,l=0;if(b&&-1!=b){var k=A()[b>>2];k+=81920;g=A()[b+8>>2];l=0!==A()[b+12>>2]}else k=2097152;(b=0==g)?g=Ec(16,k):(g-=k,0<g||K("Assertion failed: undefined"));
|
||||
for(var q=Q(228),r=0;57>r;++r)B()[(q>>2)+r]=0;A()[a>>2]=q;A()[q+12>>2]=q;a=q+152;A()[a>>2]=a;c={Fa:g,Ga:k,Ua:b,$a:l,Kb:c,Pa:q,Ia:d,Tb:f};return G?(c.Vb="spawnThread",postMessage(c,f),0):$a(c)},C:function(a,b){return rc(a,b)},x:function(){},K:function(a,b,c,d){return yc(a,b,c,d)}};
|
||||
(function(){function a(f,g){D.asm=f.exports;M=D.asm.Z;Ia.unshift(D.asm.V);P.Ya.push(D.asm.Y);sa=g;if(!G){var l=P.za.length;P.za.forEach(function(k){P.eb(k,function(){if(!--l&&(N--,D.monitorRunDependencies&&D.monitorRunDependencies(N),0==N&&(null!==La&&(clearInterval(La),La=null),Ma))){var q=Ma;Ma=null;q()}})})}}function b(f){a(f.instance,f.module)}function c(f){return Oa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){J("failed to asynchronously prepare wasm: "+g);K(g)})}
|
||||
var d={a:Fc};G||(!G||K("Assertion failed: addRunDependency cannot be used in a pthread worker"),N++,D.monitorRunDependencies&&D.monitorRunDependencies(N));if(D.instantiateWasm)try{return D.instantiateWasm(d,a)}catch(f){return J("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return ra||"function"!==typeof WebAssembly.instantiateStreaming||O.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,
|
||||
d).then(b,function(g){J("wasm streaming compile failed: "+g);J("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ma);return{}})();D.___wasm_call_ctors=function(){return(D.___wasm_call_ctors=D.asm.V).apply(null,arguments)};var Q=D._malloc=function(){return(Q=D._malloc=D.asm.W).apply(null,arguments)},S=D._free=function(){return(S=D._free=D.asm.X).apply(null,arguments)};D._emscripten_tls_init=function(){return(D._emscripten_tls_init=D.asm.Y).apply(null,arguments)};
|
||||
var Ib=D.___getTypeName=function(){return(Ib=D.___getTypeName=D.asm._).apply(null,arguments)};D.___embind_register_native_and_builtin_types=function(){return(D.___embind_register_native_and_builtin_types=D.asm.$).apply(null,arguments)};D._emscripten_current_thread_process_queued_calls=function(){return(D._emscripten_current_thread_process_queued_calls=D.asm.aa).apply(null,arguments)};
|
||||
var Wa=D._emscripten_register_main_browser_thread_id=function(){return(Wa=D._emscripten_register_main_browser_thread_id=D.asm.ba).apply(null,arguments)},sc=D._emscripten_main_browser_thread_id=function(){return(sc=D._emscripten_main_browser_thread_id=D.asm.ca).apply(null,arguments)},Pa=D.__emscripten_do_dispatch_to_thread=function(){return(Pa=D.__emscripten_do_dispatch_to_thread=D.asm.da).apply(null,arguments)},Dc=D._emscripten_sync_run_in_main_thread_4=function(){return(Dc=D._emscripten_sync_run_in_main_thread_4=
|
||||
D.asm.ea).apply(null,arguments)},Za=D._emscripten_main_thread_process_queued_calls=function(){return(Za=D._emscripten_main_thread_process_queued_calls=D.asm.fa).apply(null,arguments)},Tb=D._emscripten_run_in_main_runtime_thread_js=function(){return(Tb=D._emscripten_run_in_main_runtime_thread_js=D.asm.ga).apply(null,arguments)},Yb=D.__emscripten_call_on_thread=function(){return(Yb=D.__emscripten_call_on_thread=D.asm.ha).apply(null,arguments)},Va=D.__emscripten_thread_init=function(){return(Va=D.__emscripten_thread_init=
|
||||
D.asm.ia).apply(null,arguments)},R=D._pthread_self=function(){return(R=D._pthread_self=D.asm.ja).apply(null,arguments)},Xa=D.___pthread_tsd_run_dtors=function(){return(Xa=D.___pthread_tsd_run_dtors=D.asm.ka).apply(null,arguments)},qc=D._emscripten_get_global_libc=function(){return(qc=D._emscripten_get_global_libc=D.asm.la).apply(null,arguments)},Rb=D.stackSave=function(){return(Rb=D.stackSave=D.asm.ma).apply(null,arguments)},db=D.stackRestore=function(){return(db=D.stackRestore=D.asm.na).apply(null,
|
||||
arguments)},Sb=D.stackAlloc=function(){return(Sb=D.stackAlloc=D.asm.oa).apply(null,arguments)},cb=D._emscripten_stack_set_limits=function(){return(cb=D._emscripten_stack_set_limits=D.asm.pa).apply(null,arguments)},Ec=D._memalign=function(){return(Ec=D._memalign=D.asm.qa).apply(null,arguments)};D.dynCall_viijii=function(){return(D.dynCall_viijii=D.asm.ra).apply(null,arguments)};D.dynCall_iiji=function(){return(D.dynCall_iiji=D.asm.sa).apply(null,arguments)};
|
||||
D.dynCall_jiji=function(){return(D.dynCall_jiji=D.asm.ta).apply(null,arguments)};D.dynCall_iiiiij=function(){return(D.dynCall_iiiiij=D.asm.ua).apply(null,arguments)};D.dynCall_iiiiijj=function(){return(D.dynCall_iiiiijj=D.asm.va).apply(null,arguments)};D.dynCall_iiiiiijj=function(){return(D.dynCall_iiiiiijj=D.asm.wa).apply(null,arguments)};var Ya=D.__emscripten_allow_main_runtime_queued_calls=60568,Ta=D.__emscripten_main_thread_futex=73404;D.PThread=P;D.PThread=P;D.wasmMemory=m;D.ExitStatus=ab;var Gc;
|
||||
function ab(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}Ma=function Hc(){Gc||Ic();Gc||(Ma=Hc)};
|
||||
function Ic(){function a(){if(!Gc&&(Gc=!0,D.calledRun=!0,!ta)){G||Ra(Ia);la(D);if(D.onRuntimeInitialized)D.onRuntimeInitialized();if(!G){if(D.postRun)for("function"==typeof D.postRun&&(D.postRun=[D.postRun]);D.postRun.length;){var b=D.postRun.shift();Ja.unshift(b)}Ra(Ja)}}}if(!(0<N))if(G)la(D),G||Ra(Ia),postMessage({cmd:"loaded"});else{if(!G){if(D.preRun)for("function"==typeof D.preRun&&(D.preRun=[D.preRun]);D.preRun.length;)Ka();Ra(Ha)}0<N||(D.setStatus?(D.setStatus("Running..."),setTimeout(function(){setTimeout(function(){D.setStatus("")},
|
||||
1);a()},1)):a())}}D.run=Ic;if(D.preInit)for("function"==typeof D.preInit&&(D.preInit=[D.preInit]);0<D.preInit.length;)D.preInit.pop()();G&&(noExitRuntime=!1,P.ub());Ic();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/jxl/enc/jxl_enc_mt.wasm
Executable file
BIN
codecs/jxl/enc/jxl_enc_mt.wasm
Executable file
Binary file not shown.
1
codecs/jxl/enc/jxl_enc_mt.worker.js
generated
Normal file
1
codecs/jxl/enc/jxl_enc_mt.worker.js
generated
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};function moduleLoaded(){}self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;(e.data.urlOrBlob?import(e.data.urlOrBlob):import("./jxl_enc_mt.js")).then(function(exports){return exports.default(Module)}).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["PThread"].threadExit(result)}}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
||||
1
codecs/jxl/enc/jxl_enc_mt_simd.d.ts
vendored
Normal file
1
codecs/jxl/enc/jxl_enc_mt_simd.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './jxl_enc';
|
||||
105
codecs/jxl/enc/jxl_enc_mt_simd.js
generated
Normal file
105
codecs/jxl/enc/jxl_enc_mt_simd.js
generated
Normal file
@@ -0,0 +1,105 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
function e(){m.buffer!=n&&u(m.buffer);return aa}function v(){m.buffer!=n&&u(m.buffer);return ba}function x(){m.buffer!=n&&u(m.buffer);return ca}function ea(){m.buffer!=n&&u(m.buffer);return fa}function A(){m.buffer!=n&&u(m.buffer);return ha}function B(){m.buffer!=n&&u(m.buffer);return ia}function ja(){m.buffer!=n&&u(m.buffer);return ka}var D;D||(D=typeof Module !== 'undefined' ? Module : {});var la,ma;D.ready=new Promise(function(a,b){la=a;ma=b});var E={},F;
|
||||
for(F in D)D.hasOwnProperty(F)&&(E[F]=D[F]);var na="./this.program";function oa(a,b){throw b;}var G=D.ENVIRONMENT_IS_PTHREAD||!1,H="",pa;H=self.location.href;_scriptDir&&(H=_scriptDir);0!==H.indexOf("blob:")?H=H.substr(0,H.lastIndexOf("/")+1):H="";pa=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)};var qa=D.print||console.log.bind(console),J=D.printErr||console.warn.bind(console);
|
||||
for(F in E)E.hasOwnProperty(F)&&(D[F]=E[F]);E=null;D.thisProgram&&(na=D.thisProgram);D.quit&&(oa=D.quit);var ra;D.wasmBinary&&(ra=D.wasmBinary);var noExitRuntime=D.noExitRuntime||!0;"object"!==typeof WebAssembly&&K("no native wasm support detected");var m,sa,ta=!1;
|
||||
function ua(a,b,c){c=b+c;for(var d="";!(b>=c);){var f=a[b++];if(!f)break;if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var l=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|l:(f&7)<<18|g<<12|l<<6|a[b++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function L(a,b){return a?ua(v(),a,b):""}
|
||||
function va(a,b,c,d){if(0<d){d=c+d-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(c>=d)break;b[c++]=g}else{if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6}else{if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63}b[c++]=128|g>>6&63}b[c++]=128|g&63}}b[c]=0}}function wa(a,b,c){va(a,v(),b,c)}
|
||||
function xa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function ya(a,b){for(var c="",d=0;!(d>=b/2);++d){var f=x()[a+2*d>>1];if(0==f)break;c+=String.fromCharCode(f)}return c}function za(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f){var g=a.charCodeAt(f);x()[b>>1]=g;b+=2}x()[b>>1]=0;return b-d}
|
||||
function Aa(a){return 2*a.length}function Ba(a,b){for(var c=0,d="";!(c>=b/4);){var f=A()[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}function Ca(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}A()[b>>2]=g;b+=4;if(b+4>c)break}A()[b>>2]=0;return b-d}
|
||||
function Da(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}function Ea(a,b){e().set(a,b)}var n,aa,ba,ca,fa,ha,ia,Fa,ka;G&&(n=D.buffer);function u(a){n=a;D.HEAP8=aa=new Int8Array(a);D.HEAP16=ca=new Int16Array(a);D.HEAP32=ha=new Int32Array(a);D.HEAPU8=ba=new Uint8Array(a);D.HEAPU16=fa=new Uint16Array(a);D.HEAPU32=ia=new Uint32Array(a);D.HEAPF32=Fa=new Float32Array(a);D.HEAPF64=ka=new Float64Array(a)}var Ga=D.INITIAL_MEMORY||16777216;
|
||||
if(G)m=D.wasmMemory,n=D.buffer;else if(D.wasmMemory)m=D.wasmMemory;else if(m=new WebAssembly.Memory({initial:Ga/65536,maximum:32768,shared:!0}),!(m.buffer instanceof SharedArrayBuffer))throw J("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),Error("bad memory");m&&(n=m.buffer);Ga=n.byteLength;u(n);var M,Ha=[],Ia=[],Ja=[];
|
||||
function Ka(){var a=D.preRun.shift();Ha.unshift(a)}var N=0,La=null,Ma=null;D.preloadedImages={};D.preloadedAudios={};function K(a){if(D.onAbort)D.onAbort(a);G&&console.error("Pthread aborting at "+Error().stack);J(a);ta=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ma(a);throw a;}var O=(new URL("jxl_enc_mt_simd.wasm",import.meta.url)).toString();
|
||||
function Na(){try{if(O==O&&ra)return new Uint8Array(ra);if(pa)return pa(O);throw"both async and sync fetching of the wasm failed";}catch(a){K(a)}}function Oa(){return ra||"function"!==typeof fetch?Promise.resolve().then(function(){return Na()}):fetch(O,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+O+"'";return a.arrayBuffer()}).catch(function(){return Na()})}
|
||||
var Qa={59668:function(){throw"Canceled!";},59686:function(a,b){setTimeout(function(){Pa(a,b)},0)}};function Ra(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(D);else{var c=b.Yb;"number"===typeof c?void 0===b.Ia?M.get(c)():M.get(c)(b.Ia):c(void 0===b.Ia?null:b.Ia)}}}
|
||||
function Sa(a,b){if(0>=a||a>e().length||a&1||0>b)return-28;if(0==b)return 0;2147483647<=b&&(b=Infinity);var c=Atomics.load(A(),Ta>>2),d=0;if(c==a&&Atomics.compareExchange(A(),Ta>>2,c,0)==c&&(--b,d=1,0>=b))return 1;a=Atomics.notify(A(),a>>2,b);if(0<=a)return a+d;throw"Atomics.notify returned an unexpected value "+a;}D._emscripten_futex_wake=Sa;
|
||||
function Ua(a){if(G)throw"Internal Error! cleanupThread() can only ever be called from main application thread!";if(!a)throw"Internal Error! Null pthread_ptr in cleanupThread!";var b=P.Ba[a];b&&(A()[a+12>>2]=0,P.Qa(b.worker))}
|
||||
var P={za:[],Ea:[],Ya:[],sb:function(){for(var a=navigator.hardwareConcurrency,b=0;b<a;++b)P.Za()},tb:function(){for(var a=Q(228),b=0;57>b;++b)B()[a/4+b]=0;A()[a+12>>2]=a;b=a+152;A()[b>>2]=b;var c=Q(512);for(b=0;128>b;++b)B()[c/4+b]=0;Atomics.store(B(),a+100>>2,c);Atomics.store(B(),a+40>>2,a);Va(a,!1,1);Wa(a)},ub:function(){P.receiveObjectTransfer=P.yb;P.threadInit=P.Ob;P.threadCancel=P.Mb;P.threadExit=P.Nb;P.setExitStatus=P.Bb},Ba:{},Xa:[],zb:function(){for(;0<P.Xa.length;)P.Xa.pop()();G&&R()&&Xa()},
|
||||
gb:function(a,b){Atomics.store(B(),a+56>>2,1);Atomics.store(B(),a+60>>2,0);P.zb();Atomics.store(B(),a+4>>2,b);Atomics.store(B(),a+0>>2,1);Sa(a+0,2147483647);Va(0,0,0)},Bb:function(){},Nb:function(a){var b=R();b&&(P.gb(b,a),G&&postMessage({cmd:"exit"}))},Mb:function(){P.gb(R(),-1);postMessage({cmd:"cancelDone"})},Lb:function(){for(var a in P.Ba){var b=P.Ba[a];b&&b.worker&&P.Qa(b.worker)}P.Ba={};for(a=0;a<P.za.length;++a){var c=P.za[a];c.terminate()}P.za=[];for(a=0;a<P.Ea.length;++a)c=P.Ea[a],b=c.ya,
|
||||
P.Va(b),c.terminate();P.Ea=[]},Va:function(a){if(a){if(a.Ca){var b=A()[a.Ca+100>>2];A()[a.Ca+100>>2]=0;S(b);S(a.Ca)}a.Ca=0;a.Ua&&a.Fa&&S(a.Fa);a.Fa=0;a.worker&&(a.worker.ya=null)}},Qa:function(a){P.Ab(function(){delete P.Ba[a.ya.Ca];P.za.push(a);P.Ea.splice(P.Ea.indexOf(a),1);P.Va(a.ya);a.ya=void 0})},Ab:function(a){A()[Ya>>2]=0;try{a()}finally{A()[Ya>>2]=1}},yb:function(){},Ob:function(){for(var a in P.Ya)P.Ya[a]()},eb:function(a,b){a.onmessage=function(c){var d=c.data,f=d.cmd;a.ya&&(P.ib=a.ya.Ca);
|
||||
if(d.targetThread&&d.targetThread!=R()){var g=P.Ba[d.fc];g?g.worker.postMessage(c.data,d.transferList):console.error('Internal error! Worker sent a message "'+f+'" to target pthread '+d.targetThread+", but that thread no longer exists!")}else if("processQueuedMainThreadWork"===f)Za();else if("spawnThread"===f)$a(c.data);else if("cleanupThread"===f)Ua(d.thread);else if("killThread"===f){c=d.thread;if(G)throw"Internal Error! killThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in killThread!";
|
||||
A()[c+12>>2]=0;c=P.Ba[c];c.worker.terminate();P.Va(c);P.Ea.splice(P.Ea.indexOf(c.worker),1);c.worker.ya=void 0}else if("cancelThread"===f){c=d.thread;if(G)throw"Internal Error! cancelThread() can only ever be called from main application thread!";if(!c)throw"Internal Error! Null pthread_ptr in cancelThread!";P.Ba[c].worker.postMessage({cmd:"cancel"})}else if("loaded"===f)a.loaded=!0,b&&b(a),a.Ka&&(a.Ka(),delete a.Ka);else if("print"===f)qa("Thread "+d.threadId+": "+d.text);else if("printErr"===f)J("Thread "+
|
||||
d.threadId+": "+d.text);else if("alert"===f)alert("Thread "+d.threadId+": "+d.text);else if("exit"===f)a.ya&&Atomics.load(B(),a.ya.Ca+64>>2)&&P.Qa(a);else if("exitProcess"===f)try{g=d.returnCode;if(G)throw postMessage({cmd:"exitProcess",returnCode:g}),new ab(g);if(!bb()){P.Lb();if(D.onExit)D.onExit(g);ta=!0}oa(g,new ab(g))}catch(l){if(l instanceof ab)return;throw l;}else"cancelDone"===f?P.Qa(a):"objectTransfer"!==f&&("setimmediate"===c.data.target?a.postMessage(c.data):J("worker sent an unknown command "+
|
||||
f));P.ib=void 0};a.onerror=function(c){J("pthread sent an error! "+c.filename+":"+c.lineno+": "+c.message)};a.postMessage({cmd:"load",urlOrBlob:D.mainScriptUrlOrBlob,wasmMemory:m,wasmModule:sa})},Za:function(){if(D.locateFile){var a=D.locateFile?D.locateFile("jxl_enc_mt_simd.worker.js",H):H+"jxl_enc_mt_simd.worker.js";P.za.push(new Worker(a))}else P.za.push(new Worker(new URL("jxl_enc_mt_simd.worker.js",import.meta.url)))},lb:function(){0==P.za.length&&(P.Za(),P.eb(P.za[0]));return P.za.pop()},
|
||||
Ub:function(a){for(a=performance.now()+a;performance.now()<a;);}};D.establishStackSpace=function(a,b){cb(a,b);db(a)};D.invokeEntryPoint=function(a,b){return M.get(a)(b)};var eb=0;function bb(){return noExitRuntime||0<eb}D.keepRuntimeAlive=bb;var fb;fb=G?function(){return performance.now()-D.__performance_now_clock_drift}:function(){return performance.now()};function gb(a,b){P.Xa.push(function(){M.get(a)(b)})}
|
||||
function hb(a){this.Ja=a-16;this.Gb=function(b){A()[this.Ja+8>>2]=b};this.Db=function(b){A()[this.Ja+0>>2]=b};this.Eb=function(){A()[this.Ja+4>>2]=0};this.Cb=function(){var b=0;e()[this.Ja+12>>0]=b};this.Fb=function(){var b=0;e()[this.Ja+13>>0]=b};this.qb=function(b,c){this.Gb(b);this.Db(c);this.Eb();this.Cb();this.Fb()}}var ib=0,jb={};function kb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function lb(a){return this.fromWireType(B()[a>>2])}var T={},U={},mb={};
|
||||
function nb(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function ob(a,b){a=nb(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function pb(a){var b=Error,c=ob(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var qb=void 0;
|
||||
function rb(a,b,c){function d(k){k=c(k);if(k.length!==a.length)throw new qb("Mismatched type converter count");for(var q=0;q<a.length;++q)V(a[q],k[q])}a.forEach(function(k){mb[k]=b});var f=Array(b.length),g=[],l=0;b.forEach(function(k,q){U.hasOwnProperty(k)?f[q]=U[k]:(g.push(k),T.hasOwnProperty(k)||(T[k]=[]),T[k].push(function(){f[q]=U[k];++l;l===g.length&&d(f)}))});0===g.length&&d(f)}
|
||||
function sb(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var tb=void 0;function W(a){for(var b="";v()[a];)b+=tb[v()[a++]];return b}var ub=void 0;function X(a){throw new ub(a);}
|
||||
function V(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||X('type "'+d+'" must have a positive integer typeid pointer');if(U.hasOwnProperty(a)){if(c.pb)return;X("Cannot register type '"+d+"' twice")}U[a]=b;delete mb[a];T.hasOwnProperty(a)&&(b=T[a],delete T[a],b.forEach(function(f){f()}))}var vb=[],Y=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function wb(a){4<a&&0===--Y[a].Wa&&(Y[a]=void 0,vb.push(a))}function xb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=vb.length?vb.pop():Y.length;Y[b]={Wa:1,value:a};return b}}function yb(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function zb(a,b){switch(b){case 2:return function(c){var d=this.fromWireType;m.buffer!=n&&u(m.buffer);return d.call(this,Fa[c>>2])};case 3:return function(c){return this.fromWireType(ja()[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}
|
||||
function Ab(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=ob(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Bb(a,b){var c=D;if(void 0===c[a].Aa){var d=c[a];c[a]=function(){c[a].Aa.hasOwnProperty(arguments.length)||X("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Aa+")!");return c[a].Aa[arguments.length].apply(this,arguments)};c[a].Aa=[];c[a].Aa[d.hb]=d}}
|
||||
function Cb(a,b,c){D.hasOwnProperty(a)?((void 0===c||void 0!==D[a].Aa&&void 0!==D[a].Aa[c])&&X("Cannot register public name '"+a+"' twice"),Bb(a,a),D.hasOwnProperty(c)&&X("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),D[a].Aa[c]=b):(D[a]=b,void 0!==c&&(D[a].cc=c))}function Db(a,b){for(var c=[],d=0;d<a;d++)c.push(A()[(b>>2)+d]);return c}
|
||||
function Eb(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=D["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=M.get(b).apply(null,c);return d}}function Fb(a,b){a=W(a);var c=a.includes("j")?Eb(a,b):M.get(b);"function"!==typeof c&&X("unknown function pointer with signature "+a+": "+b);return c}var Gb=void 0;function Hb(a){a=Ib(a);var b=W(a);S(a);return b}
|
||||
function Jb(a,b){function c(g){f[g]||U[g]||(mb[g]?mb[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Gb(a+": "+d.map(Hb).join([", "]));}function Kb(a,b,c){switch(b){case 0:return c?function(d){return e()[d]}:function(d){return v()[d]};case 1:return c?function(d){return x()[d>>1]}:function(d){return ea()[d>>1]};case 2:return c?function(d){return A()[d>>2]}:function(d){return B()[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var Lb={};
|
||||
function Mb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function Nb(a,b){var c=U[a];void 0===c&&X(b+" has unknown type "+Hb(a));return c}var Ob={},Pb=[];function Qb(a,b,c){if(0>=a||a>e().length||a&1)return-28;a=Atomics.wait(A(),a>>2,b,c);if("timed-out"===a)return-73;if("not-equal"===a)return-6;if("ok"===a)return 0;throw"Atomics.wait returned an unexpected value "+a;}
|
||||
function Z(a,b){for(var c=arguments.length-2,d=Rb(),f=Sb(8*c),g=f>>3,l=0;l<c;l++){var k=arguments[2+l];ja()[g+l]=k}c=Tb(a,c,f,b);db(d);return c}var Ub=[],Vb=[0,"undefined"!==typeof document?document:0,"undefined"!==typeof window?window:0];function Wb(a){a=2<a?L(a):a;return Vb[a]||("undefined"!==typeof document?document.querySelector(a):void 0)}
|
||||
function Xb(a,b,c){var d=Wb(a);if(!d)return-4;d.Oa&&(A()[d.Oa>>2]=b,A()[d.Oa+4>>2]=c);if(d.fb||!d.Wb)d.fb&&(d=d.fb),a=!1,d.Na&&d.Na.Ma&&(a=d.Na.Ma.getParameter(2978),a=0===a[0]&&0===a[1]&&a[2]===d.width&&a[3]===d.height),d.width=b,d.height=c,a&&d.Na.Ma.viewport(0,0,b,c);else{if(d.Oa){d=A()[d.Oa+8>>2];a=a?L(a):"";var f=Rb(),g=Sb(12),l=0;if(a){l=xa(a)+1;var k=Q(l);wa(a,k,l);l=k}A()[g>>2]=l;A()[g+4>>2]=b;A()[g+8>>2]=c;Yb(0,d,657457152,0,l,g);db(f);return 1}return-4}return 0}
|
||||
function Zb(a,b,c){return G?Z(2,1,a,b,c):Xb(a,b,c)}function $b(a){var b=a.getExtension("ANGLE_instanced_arrays");b&&(a.vertexAttribDivisor=function(c,d){b.vertexAttribDivisorANGLE(c,d)},a.drawArraysInstanced=function(c,d,f,g){b.drawArraysInstancedANGLE(c,d,f,g)},a.drawElementsInstanced=function(c,d,f,g,l){b.drawElementsInstancedANGLE(c,d,f,g,l)})}
|
||||
function ac(a){var b=a.getExtension("OES_vertex_array_object");b&&(a.createVertexArray=function(){return b.createVertexArrayOES()},a.deleteVertexArray=function(c){b.deleteVertexArrayOES(c)},a.bindVertexArray=function(c){b.bindVertexArrayOES(c)},a.isVertexArray=function(c){return b.isVertexArrayOES(c)})}function bc(a){var b=a.getExtension("WEBGL_draw_buffers");b&&(a.drawBuffers=function(c,d){b.drawBuffersWEBGL(c,d)})}
|
||||
function cc(a,b){a.cb||(a.cb=a.getContext,a.getContext=function(d,f){f=a.cb(d,f);return"webgl"==d==f instanceof WebGLRenderingContext?f:null});var c=a.getContext("webgl",b);return c?dc(c,b):0}function dc(a,b){var c=Q(8);A()[c+4>>2]=R();var d={Zb:c,attributes:b,version:b.vb,Ma:a};a.canvas&&(a.canvas.Na=d);("undefined"===typeof b.ab||b.ab)&&ec(d);return c}
|
||||
function ec(a){a||(a=fc);if(!a.rb){a.rb=!0;var b=a.Ma;$b(b);ac(b);bc(b);b.Xb=b.getExtension("EXT_disjoint_timer_query");b.bc=b.getExtension("WEBGL_multi_draw");(b.getSupportedExtensions()||[]).forEach(function(c){c.includes("lose_context")||c.includes("debug")||b.getExtension(c)})}}var fc,gc=["default","low-power","high-performance"],hc={};
|
||||
function ic(){if(!jc){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:na||"./this.program"},b;for(b in hc)a[b]=hc[b];var c=[];for(b in a)c.push(b+"="+a[b]);jc=c}return jc}var jc,kc=[null,[],[]];
|
||||
function lc(a,b){if(G)return Z(3,1,a,b);var c=0;ic().forEach(function(d,f){var g=b+c;f=A()[a+4*f>>2]=g;for(g=0;g<d.length;++g)e()[f++>>0]=d.charCodeAt(g);e()[f>>0]=0;c+=d.length+1});return 0}function mc(a,b){if(G)return Z(4,1,a,b);var c=ic();A()[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+1});A()[b>>2]=d;return 0}function nc(a){return G?Z(5,1,a):0}function oc(a,b,c,d,f){if(G)return Z(6,1,a,b,c,d,f)}
|
||||
function pc(a,b,c,d){if(G)return Z(7,1,a,b,c,d);for(var f=0,g=0;g<c;g++){for(var l=A()[b+8*g>>2],k=A()[b+(8*g+4)>>2],q=0;q<k;q++){var r=v()[l+q],t=kc[a];0===r||10===r?((1===a?qa:J)(ua(t,0)),t.length=0):t.push(r)}f+=k}A()[d>>2]=f;return 0}
|
||||
function $a(a){if(G)throw"Internal Error! spawnThread() can only ever be called from main application thread!";var b=P.lb();if(!b)return 6;if(void 0!==b.ya)throw"Internal error!";if(!a.Pa)throw"Internal error, no pthread ptr!";P.Ea.push(b);for(var c=Q(512),d=0;128>d;++d)A()[c+4*d>>2]=0;var f=a.Fa+a.Ga;d=P.Ba[a.Pa]={worker:b,Fa:a.Fa,Ga:a.Ga,Ua:a.Ua,Ca:a.Pa};var g=d.Ca>>2;Atomics.store(B(),g+16,a.$a);Atomics.store(B(),g+25,c);Atomics.store(B(),g+10,d.Ca);Atomics.store(B(),g+20,a.Ga);Atomics.store(B(),
|
||||
g+19,f);Atomics.store(B(),g+26,a.Ga);Atomics.store(B(),g+28,f);Atomics.store(B(),g+29,a.$a);c=qc()+40;Atomics.store(B(),g+43,c);b.ya=d;var l={cmd:"run",start_routine:a.Kb,arg:a.Ia,threadInfoStruct:a.Pa,stackBase:a.Fa,stackSize:a.Ga};b.Ka=function(){l.time=performance.now();b.postMessage(l,a.Tb)};b.loaded&&(b.Ka(),delete b.Ka);return 0}
|
||||
function rc(a,b){if(!a)return J("pthread_join attempted on a null thread pointer!"),71;if(G&&R()==a)return J("PThread "+a+" is attempting to join to itself!"),16;if(!G&&sc()==a)return J("Main thread "+a+" is attempting to join to itself!"),16;if(A()[a+12>>2]!==a)return J("pthread_join attempted on thread "+a+", which does not point to a valid thread, or does not exist anymore!"),71;if(Atomics.load(B(),a+64>>2))return J("Attempted to join thread "+a+", which was already detached!"),28;for(;;){var c=
|
||||
Atomics.load(B(),a+0>>2);if(1==c)return c=Atomics.load(B(),a+4>>2),b&&(A()[b>>2]=c),Atomics.store(B(),a+64>>2,1),G?postMessage({cmd:"cleanupThread",thread:a}):Ua(a),0;if(G){var d=R();if(d&&!Atomics.load(B(),d+56>>2)&&2==Atomics.load(B(),d+0>>2))throw"Canceled!";}G||Za();Qb(a+0,c,G?100:1)}}function tc(a){return 0===a%4&&(0!==a%100||0===a%400)}function uc(a,b){for(var c=0,d=0;d<=b;c+=a[d++]);return c}var vc=[31,29,31,30,31,30,31,31,30,31,30,31],wc=[31,28,31,30,31,30,31,31,30,31,30,31];
|
||||
function xc(a,b){for(a=new Date(a.getTime());0<b;){var c=a.getMonth(),d=(tc(a.getFullYear())?vc:wc)[c];if(b>d-a.getDate())b-=d-a.getDate()+1,a.setDate(1),11>c?a.setMonth(c+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
|
||||
function yc(a,b,c,d){function f(h,p,y){for(h="number"===typeof h?h.toString():h||"";h.length<p;)h=y[0]+h;return h}function g(h,p){return f(h,p,"0")}function l(h,p){function y(I){return 0>I?-1:0<I?1:0}var z;0===(z=y(h.getFullYear()-p.getFullYear()))&&0===(z=y(h.getMonth()-p.getMonth()))&&(z=y(h.getDate()-p.getDate()));return z}function k(h){switch(h.getDay()){case 0:return new Date(h.getFullYear()-1,11,29);case 1:return h;case 2:return new Date(h.getFullYear(),0,3);case 3:return new Date(h.getFullYear(),
|
||||
0,2);case 4:return new Date(h.getFullYear(),0,1);case 5:return new Date(h.getFullYear()-1,11,31);case 6:return new Date(h.getFullYear()-1,11,30)}}function q(h){h=xc(new Date(h.xa+1900,0,1),h.Ta);var p=new Date(h.getFullYear()+1,0,4),y=k(new Date(h.getFullYear(),0,4));p=k(p);return 0>=l(y,h)?0>=l(p,h)?h.getFullYear()+1:h.getFullYear():h.getFullYear()-1}var r=A()[d+40>>2];d={Rb:A()[d>>2],Qb:A()[d+4>>2],Ra:A()[d+8>>2],La:A()[d+12>>2],Ha:A()[d+16>>2],xa:A()[d+20>>2],Sa:A()[d+24>>2],Ta:A()[d+28>>2],hc:A()[d+
|
||||
32>>2],Pb:A()[d+36>>2],Sb:r?L(r):""};c=L(c);r={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var t in r)c=c.replace(new RegExp(t,"g"),r[t]);var w="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
|
||||
C="January February March April May June July August September October November December".split(" ");r={"%a":function(h){return w[h.Sa].substring(0,3)},"%A":function(h){return w[h.Sa]},"%b":function(h){return C[h.Ha].substring(0,3)},"%B":function(h){return C[h.Ha]},"%C":function(h){return g((h.xa+1900)/100|0,2)},"%d":function(h){return g(h.La,2)},"%e":function(h){return f(h.La,2," ")},"%g":function(h){return q(h).toString().substring(2)},"%G":function(h){return q(h)},"%H":function(h){return g(h.Ra,
|
||||
2)},"%I":function(h){h=h.Ra;0==h?h=12:12<h&&(h-=12);return g(h,2)},"%j":function(h){return g(h.La+uc(tc(h.xa+1900)?vc:wc,h.Ha-1),3)},"%m":function(h){return g(h.Ha+1,2)},"%M":function(h){return g(h.Qb,2)},"%n":function(){return"\n"},"%p":function(h){return 0<=h.Ra&&12>h.Ra?"AM":"PM"},"%S":function(h){return g(h.Rb,2)},"%t":function(){return"\t"},"%u":function(h){return h.Sa||7},"%U":function(h){var p=new Date(h.xa+1900,0,1),y=0===p.getDay()?p:xc(p,7-p.getDay());h=new Date(h.xa+1900,h.Ha,h.La);return 0>
|
||||
l(y,h)?g(Math.ceil((31-y.getDate()+(uc(tc(h.getFullYear())?vc:wc,h.getMonth()-1)-31)+h.getDate())/7),2):0===l(y,p)?"01":"00"},"%V":function(h){var p=new Date(h.xa+1901,0,4),y=k(new Date(h.xa+1900,0,4));p=k(p);var z=xc(new Date(h.xa+1900,0,1),h.Ta);return 0>l(z,y)?"53":0>=l(p,z)?"01":g(Math.ceil((y.getFullYear()<h.xa+1900?h.Ta+32-y.getDate():h.Ta+1-y.getDate())/7),2)},"%w":function(h){return h.Sa},"%W":function(h){var p=new Date(h.xa,0,1),y=1===p.getDay()?p:xc(p,0===p.getDay()?1:7-p.getDay()+1);h=
|
||||
new Date(h.xa+1900,h.Ha,h.La);return 0>l(y,h)?g(Math.ceil((31-y.getDate()+(uc(tc(h.getFullYear())?vc:wc,h.getMonth()-1)-31)+h.getDate())/7),2):0===l(y,p)?"01":"00"},"%y":function(h){return(h.xa+1900).toString().substring(2)},"%Y":function(h){return h.xa+1900},"%z":function(h){h=h.Pb;var p=0<=h;h=Math.abs(h)/60;return(p?"+":"-")+String("0000"+(h/60*100+h%60)).slice(-4)},"%Z":function(h){return h.Sb},"%%":function(){return"%"}};for(t in r)c.includes(t)&&(c=c.replace(new RegExp(t,"g"),r[t](d)));t=zc(c);
|
||||
if(t.length>b)return 0;Ea(t,a);return t.length-1}G||P.sb();qb=D.InternalError=pb("InternalError");for(var Ac=Array(256),Bc=0;256>Bc;++Bc)Ac[Bc]=String.fromCharCode(Bc);tb=Ac;ub=D.BindingError=pb("BindingError");D.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};D.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};Gb=D.UnboundTypeError=pb("UnboundTypeError");
|
||||
var Cc=[null,function(a,b){if(G)return Z(1,1,a,b)},Zb,lc,mc,nc,oc,pc];function zc(a){var b=Array(xa(a)+1);va(a,b,0,b.length);return b}
|
||||
var Fc={e:function(a,b,c,d){K("Assertion failed: "+L(a)+", at: "+[b?L(b):"unknown filename",c,d?L(d):"unknown function"])},J:function(a){return Q(a+16)+16},q:function(a,b){return gb(a,b)},B:function(a,b,c){(new hb(a)).qb(b,c);ib++;throw a;},s:function(a){var b=jb[a];delete jb[a];var c=b.wb,d=b.xb,f=b.bb,g=f.map(function(l){return l.ob}).concat(f.map(function(l){return l.Ib}));rb([a],g,function(l){var k={};f.forEach(function(q,r){var t=l[r],w=q.mb,C=q.nb,h=l[r+f.length],p=q.Hb,y=q.Jb;k[q.kb]={read:function(z){return t.fromWireType(w(C,
|
||||
z))},write:function(z,I){var da=[];p(y,z,h.toWireType(da,I));kb(da)}}});return[{name:b.name,fromWireType:function(q){var r={},t;for(t in k)r[t]=k[t].read(q);d(q);return r},toWireType:function(q,r){for(var t in k)if(!(t in r))throw new TypeError('Missing field: "'+t+'"');var w=c();for(t in k)k[t].write(w,r[t]);null!==q&&q.push(d,w);return w},argPackAdvance:8,readValueFromPointer:lb,Da:d}]})},w:function(){},Q:function(a,b,c,d,f){var g=sb(c);b=W(b);V(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,
|
||||
k){return k?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var k=e();else if(2===c)k=x();else if(4===c)k=A();else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(k[l>>g])},Da:null})},P:function(a,b){b=W(b);V(a,{name:b,fromWireType:function(c){var d=Y[c].value;wb(c);return d},toWireType:function(c,d){return xb(d)},argPackAdvance:8,readValueFromPointer:lb,Da:null})},o:function(a,b,c){c=sb(c);b=W(b);V(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,
|
||||
f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+yb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:zb(b,c),Da:null})},r:function(a,b,c,d,f,g){var l=Db(b,c);a=W(a);f=Fb(d,f);Cb(a,function(){Jb("Cannot call "+a+" due to unbound types",l)},b-1);rb([],l,function(k){var q=a,r=a;k=[k[0],null].concat(k.slice(1));var t=f,w=k.length;2>w&&X("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var C=null!==k[1]&&!1,
|
||||
h=!1,p=1;p<k.length;++p)if(null!==k[p]&&void 0===k[p].Da){h=!0;break}var y="void"!==k[0].name,z="",I="";for(p=0;p<w-2;++p)z+=(0!==p?", ":"")+"arg"+p,I+=(0!==p?", ":"")+"arg"+p+"Wired";r="return function "+nb(r)+"("+z+") {\nif (arguments.length !== "+(w-2)+") {\nthrowBindingError('function "+r+" called with ' + arguments.length + ' arguments, expected "+(w-2)+" args!');\n}\n";h&&(r+="var destructors = [];\n");var da=h?"destructors":"null";z="throwBindingError invoker fn runDestructors retType classParam".split(" ");
|
||||
t=[X,t,g,kb,k[0],k[1]];C&&(r+="var thisWired = classParam.toWireType("+da+", this);\n");for(p=0;p<w-2;++p)r+="var arg"+p+"Wired = argType"+p+".toWireType("+da+", arg"+p+"); // "+k[p+2].name+"\n",z.push("argType"+p),t.push(k[p+2]);C&&(I="thisWired"+(0<I.length?", ":"")+I);r+=(y?"var rv = ":"")+"invoker(fn"+(0<I.length?", ":"")+I+");\n";if(h)r+="runDestructors(destructors);\n";else for(p=C?1:2;p<k.length;++p)w=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==k[p].Da&&(r+=w+"_dtor("+w+"); // "+k[p].name+
|
||||
"\n",z.push(w+"_dtor"),t.push(k[p].Da));y&&(r+="var ret = retType.fromWireType(rv);\nreturn ret;\n");z.push(r+"}\n");k=Ab(z).apply(null,t);p=b-1;if(!D.hasOwnProperty(q))throw new qb("Replacing nonexistant public symbol");void 0!==D[q].Aa&&void 0!==p?D[q].Aa[p]=k:(D[q]=k,D[q].hb=p);return[]})},d:function(a,b,c,d,f){function g(r){return r}b=W(b);-1===f&&(f=4294967295);var l=sb(c);if(0===d){var k=32-8*c;g=function(r){return r<<k>>>k}}var q=b.includes("unsigned");V(a,{name:b,fromWireType:g,toWireType:function(r,
|
||||
t){if("number"!==typeof t&&"boolean"!==typeof t)throw new TypeError('Cannot convert "'+yb(t)+'" to '+this.name);if(t<d||t>f)throw new TypeError('Passing a number "'+yb(t)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return q?t>>>0:t|0},argPackAdvance:8,readValueFromPointer:Kb(b,l,0!==d),Da:null})},c:function(a,b,c){function d(g){g>>=2;var l=B();return new f(n,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,
|
||||
Uint32Array,Float32Array,Float64Array][b];c=W(c);V(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{pb:!0})},p:function(a,b){b=W(b);var c="std::string"===b;V(a,{name:b,fromWireType:function(d){var f=B()[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var k=d+4+l;if(l==f||0==v()[k]){g=L(g,k-g);if(void 0===q)var q=g;else q+=String.fromCharCode(0),q+=g;g=k+1}}else{q=Array(f);for(l=0;l<f;++l)q[l]=String.fromCharCode(v()[d+4+l]);q=q.join("")}S(d);return q},toWireType:function(d,f){f instanceof
|
||||
ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||X("Cannot pass non-string to std::string");var l=(c&&g?function(){return xa(f)}:function(){return f.length})(),k=Q(4+l+1);B()[k>>2]=l;if(c&&g)wa(f,k+4,l+1);else if(g)for(g=0;g<l;++g){var q=f.charCodeAt(g);255<q&&(S(k),X("String has UTF-16 code units that do not fit in 8 bits"));v()[k+4+g]=q}else for(g=0;g<l;++g)v()[k+4+g]=f[g];null!==d&&d.push(S,k);return k},
|
||||
argPackAdvance:8,readValueFromPointer:lb,Da:function(d){S(d)}})},k:function(a,b,c){c=W(c);if(2===b){var d=ya;var f=za;var g=Aa;var l=function(){return ea()};var k=1}else 4===b&&(d=Ba,f=Ca,g=Da,l=function(){return B()},k=2);V(a,{name:c,fromWireType:function(q){for(var r=B()[q>>2],t=l(),w,C=q+4,h=0;h<=r;++h){var p=q+4+h*b;if(h==r||0==t[p>>k])C=d(C,p-C),void 0===w?w=C:(w+=String.fromCharCode(0),w+=C),C=p+b}S(q);return w},toWireType:function(q,r){"string"!==typeof r&&X("Cannot pass non-string to C++ string type "+
|
||||
c);var t=g(r),w=Q(4+t+b);B()[w>>2]=t>>k;f(r,w+4,t+b);null!==q&&q.push(S,w);return w},argPackAdvance:8,readValueFromPointer:lb,Da:function(q){S(q)}})},t:function(a,b,c,d,f,g){jb[a]={name:W(b),wb:Fb(c,d),xb:Fb(f,g),bb:[]}},f:function(a,b,c,d,f,g,l,k,q,r){jb[a].bb.push({kb:W(b),ob:c,mb:Fb(d,f),nb:g,Ib:l,Hb:Fb(k,q),Jb:r})},R:function(a,b){b=W(b);V(a,{$b:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},I:function(a,b){if(a==b)postMessage({cmd:"processQueuedMainThreadWork"});
|
||||
else if(G)postMessage({targetThread:a,cmd:"processThreadQueue"});else{a=(a=P.Ba[a])&&a.worker;if(!a)return;a.postMessage({cmd:"processThreadQueue"})}return 1},i:wb,U:function(a){if(0===a)return xb(Mb());var b=Lb[a];a=void 0===b?W(a):b;return xb(Mb()[a])},T:function(a){4<a&&(Y[a].Wa+=1)},u:function(a,b,c,d){a||X("Cannot use deleted val. handle = "+a);a=Y[a].value;var f=Ob[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";
|
||||
for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(Nb,D,xb);Ob[b]=f}return f(a,c,d)},b:function(){K()},n:function(a,b,c){Pb.length=0;var d;for(c>>=2;d=v()[b++];)(d=105>d)&&c&1&&c++,
|
||||
Pb.push(d?ja()[c++>>1]:A()[c]),++c;return Qa[a].apply(null,Pb)},E:function(){},m:function(){},h:Qb,g:Sa,j:fb,z:function(a,b,c){v().copyWithin(a,b,b+c)},D:function(){return navigator.hardwareConcurrency},F:function(a,b,c){Ub.length=b;c>>=3;for(var d=0;d<b;d++)Ub[d]=ja()[c+d];return(0>a?Qa[-a-1]:Cc[a]).apply(null,Ub)},A:function(a){var b=v().length;a>>>=0;if(a<=b||2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{m.grow(Math.min(2147483648,
|
||||
d)-n.byteLength+65535>>>16);u(m.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},G:function(a,b,c){return Wb(a)?Xb(a,b,c):Zb(a,b,c)},l:function(){},H:function(a,b){b>>=2;var c=A()[b+6];b={alpha:!!A()[b],depth:!!A()[b+1],stencil:!!A()[b+2],antialias:!!A()[b+3],premultipliedAlpha:!!A()[b+4],preserveDrawingBuffer:!!A()[b+5],powerPreference:gc[c],failIfMajorPerformanceCaveat:!!A()[b+7],vb:A()[b+8],ac:A()[b+9],ab:A()[b+10],jb:A()[b+11],dc:A()[b+12],ec:A()[b+13]};a=Wb(a);return!a||b.jb?
|
||||
0:cc(a,b)},L:lc,M:mc,N:nc,v:oc,O:pc,y:function(){P.tb()},a:m||D.wasmMemory,S:function(a,b,c,d){if("undefined"===typeof SharedArrayBuffer)return J("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;if(!a)return J("pthread_create called with a null thread pointer!"),28;var f=[];if(G&&0===f.length)return Dc(687865856,a,b,c,d);var g=0,l=0;if(b&&-1!=b){var k=A()[b>>2];k+=81920;g=A()[b+8>>2];l=0!==A()[b+12>>2]}else k=2097152;(b=0==g)?g=Ec(16,k):(g-=k,0<g||K("Assertion failed: undefined"));
|
||||
for(var q=Q(228),r=0;57>r;++r)B()[(q>>2)+r]=0;A()[a>>2]=q;A()[q+12>>2]=q;a=q+152;A()[a>>2]=a;c={Fa:g,Ga:k,Ua:b,$a:l,Kb:c,Pa:q,Ia:d,Tb:f};return G?(c.Vb="spawnThread",postMessage(c,f),0):$a(c)},C:function(a,b){return rc(a,b)},x:function(){},K:function(a,b,c,d){return yc(a,b,c,d)}};
|
||||
(function(){function a(f,g){D.asm=f.exports;M=D.asm.Z;Ia.unshift(D.asm.V);P.Ya.push(D.asm.Y);sa=g;if(!G){var l=P.za.length;P.za.forEach(function(k){P.eb(k,function(){if(!--l&&(N--,D.monitorRunDependencies&&D.monitorRunDependencies(N),0==N&&(null!==La&&(clearInterval(La),La=null),Ma))){var q=Ma;Ma=null;q()}})})}}function b(f){a(f.instance,f.module)}function c(f){return Oa().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){J("failed to asynchronously prepare wasm: "+g);K(g)})}
|
||||
var d={a:Fc};G||(!G||K("Assertion failed: addRunDependency cannot be used in a pthread worker"),N++,D.monitorRunDependencies&&D.monitorRunDependencies(N));if(D.instantiateWasm)try{return D.instantiateWasm(d,a)}catch(f){return J("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return ra||"function"!==typeof WebAssembly.instantiateStreaming||O.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,
|
||||
d).then(b,function(g){J("wasm streaming compile failed: "+g);J("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ma);return{}})();D.___wasm_call_ctors=function(){return(D.___wasm_call_ctors=D.asm.V).apply(null,arguments)};var Q=D._malloc=function(){return(Q=D._malloc=D.asm.W).apply(null,arguments)},S=D._free=function(){return(S=D._free=D.asm.X).apply(null,arguments)};D._emscripten_tls_init=function(){return(D._emscripten_tls_init=D.asm.Y).apply(null,arguments)};
|
||||
var Ib=D.___getTypeName=function(){return(Ib=D.___getTypeName=D.asm._).apply(null,arguments)};D.___embind_register_native_and_builtin_types=function(){return(D.___embind_register_native_and_builtin_types=D.asm.$).apply(null,arguments)};D._emscripten_current_thread_process_queued_calls=function(){return(D._emscripten_current_thread_process_queued_calls=D.asm.aa).apply(null,arguments)};
|
||||
var Wa=D._emscripten_register_main_browser_thread_id=function(){return(Wa=D._emscripten_register_main_browser_thread_id=D.asm.ba).apply(null,arguments)},sc=D._emscripten_main_browser_thread_id=function(){return(sc=D._emscripten_main_browser_thread_id=D.asm.ca).apply(null,arguments)},Pa=D.__emscripten_do_dispatch_to_thread=function(){return(Pa=D.__emscripten_do_dispatch_to_thread=D.asm.da).apply(null,arguments)},Dc=D._emscripten_sync_run_in_main_thread_4=function(){return(Dc=D._emscripten_sync_run_in_main_thread_4=
|
||||
D.asm.ea).apply(null,arguments)},Za=D._emscripten_main_thread_process_queued_calls=function(){return(Za=D._emscripten_main_thread_process_queued_calls=D.asm.fa).apply(null,arguments)},Tb=D._emscripten_run_in_main_runtime_thread_js=function(){return(Tb=D._emscripten_run_in_main_runtime_thread_js=D.asm.ga).apply(null,arguments)},Yb=D.__emscripten_call_on_thread=function(){return(Yb=D.__emscripten_call_on_thread=D.asm.ha).apply(null,arguments)},Va=D.__emscripten_thread_init=function(){return(Va=D.__emscripten_thread_init=
|
||||
D.asm.ia).apply(null,arguments)},R=D._pthread_self=function(){return(R=D._pthread_self=D.asm.ja).apply(null,arguments)},Xa=D.___pthread_tsd_run_dtors=function(){return(Xa=D.___pthread_tsd_run_dtors=D.asm.ka).apply(null,arguments)},qc=D._emscripten_get_global_libc=function(){return(qc=D._emscripten_get_global_libc=D.asm.la).apply(null,arguments)},Rb=D.stackSave=function(){return(Rb=D.stackSave=D.asm.ma).apply(null,arguments)},db=D.stackRestore=function(){return(db=D.stackRestore=D.asm.na).apply(null,
|
||||
arguments)},Sb=D.stackAlloc=function(){return(Sb=D.stackAlloc=D.asm.oa).apply(null,arguments)},cb=D._emscripten_stack_set_limits=function(){return(cb=D._emscripten_stack_set_limits=D.asm.pa).apply(null,arguments)},Ec=D._memalign=function(){return(Ec=D._memalign=D.asm.qa).apply(null,arguments)};D.dynCall_viijii=function(){return(D.dynCall_viijii=D.asm.ra).apply(null,arguments)};D.dynCall_iiji=function(){return(D.dynCall_iiji=D.asm.sa).apply(null,arguments)};
|
||||
D.dynCall_jiji=function(){return(D.dynCall_jiji=D.asm.ta).apply(null,arguments)};D.dynCall_iiiiij=function(){return(D.dynCall_iiiiij=D.asm.ua).apply(null,arguments)};D.dynCall_iiiiijj=function(){return(D.dynCall_iiiiijj=D.asm.va).apply(null,arguments)};D.dynCall_iiiiiijj=function(){return(D.dynCall_iiiiiijj=D.asm.wa).apply(null,arguments)};var Ya=D.__emscripten_allow_main_runtime_queued_calls=59656,Ta=D.__emscripten_main_thread_futex=72492;D.PThread=P;D.PThread=P;D.wasmMemory=m;D.ExitStatus=ab;var Gc;
|
||||
function ab(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}Ma=function Hc(){Gc||Ic();Gc||(Ma=Hc)};
|
||||
function Ic(){function a(){if(!Gc&&(Gc=!0,D.calledRun=!0,!ta)){G||Ra(Ia);la(D);if(D.onRuntimeInitialized)D.onRuntimeInitialized();if(!G){if(D.postRun)for("function"==typeof D.postRun&&(D.postRun=[D.postRun]);D.postRun.length;){var b=D.postRun.shift();Ja.unshift(b)}Ra(Ja)}}}if(!(0<N))if(G)la(D),G||Ra(Ia),postMessage({cmd:"loaded"});else{if(!G){if(D.preRun)for("function"==typeof D.preRun&&(D.preRun=[D.preRun]);D.preRun.length;)Ka();Ra(Ha)}0<N||(D.setStatus?(D.setStatus("Running..."),setTimeout(function(){setTimeout(function(){D.setStatus("")},
|
||||
1);a()},1)):a())}}D.run=Ic;if(D.preInit)for("function"==typeof D.preInit&&(D.preInit=[D.preInit]);0<D.preInit.length;)D.preInit.pop()();G&&(noExitRuntime=!1,P.ub());Ic();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/jxl/enc/jxl_enc_mt_simd.wasm
Executable file
BIN
codecs/jxl/enc/jxl_enc_mt_simd.wasm
Executable file
Binary file not shown.
1
codecs/jxl/enc/jxl_enc_mt_simd.worker.js
generated
Normal file
1
codecs/jxl/enc/jxl_enc_mt_simd.worker.js
generated
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};function moduleLoaded(){}self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;(e.data.urlOrBlob?import(e.data.urlOrBlob):import("./jxl_enc_mt_simd.js")).then(function(exports){return exports.default(Module)}).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["PThread"].threadExit(result)}}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
||||
70
codecs/jxl/enc/jxl_node_enc.js
generated
Normal file
70
codecs/jxl/enc/jxl_node_enc.js
generated
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var g;g||(g=typeof Module !== 'undefined' ? Module : {});var aa,ba;g.ready=new Promise(function(a,b){aa=a;ba=b});var t={},w;for(w in g)g.hasOwnProperty(w)&&(t[w]=g[w]);var ca="./this.program",da,ea,fa,ha;da=function(a){fa||(fa=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);return fa.readFileSync(a,null)};ea=function(a){a=da(a);a.buffer||(a=new Uint8Array(a));a.buffer||y("Assertion failed: undefined");return a};1<process.argv.length&&(ca=process.argv[1].replace(/\\/g,"/"));
|
||||
process.argv.slice(2);process.on("uncaughtException",function(a){throw a;});process.on("unhandledRejection",y);g.inspect=function(){return"[Emscripten Module object]"};var ia=g.print||console.log.bind(console),z=g.printErr||console.warn.bind(console);for(w in t)t.hasOwnProperty(w)&&(g[w]=t[w]);t=null;g.thisProgram&&(ca=g.thisProgram);var A;g.wasmBinary&&(A=g.wasmBinary);var noExitRuntime=g.noExitRuntime||!0;"object"!==typeof WebAssembly&&y("no native wasm support detected");var ja,ka=!1,la=new TextDecoder("utf8");
|
||||
function ma(a,b){if(!a)return"";b=a+b;for(var c=a;!(c>=b)&&C[c];)++c;return la.decode(C.subarray(a,c))}
|
||||
function na(a,b,c,d){if(0<d){d=c+d-1;for(var h=0;h<a.length;++h){var f=a.charCodeAt(h);if(55296<=f&&57343>=f){var n=a.charCodeAt(++h);f=65536+((f&1023)<<10)|n&1023}if(127>=f){if(c>=d)break;b[c++]=f}else{if(2047>=f){if(c+1>=d)break;b[c++]=192|f>>6}else{if(65535>=f){if(c+2>=d)break;b[c++]=224|f>>12}else{if(c+3>=d)break;b[c++]=240|f>>18;b[c++]=128|f>>12&63}b[c++]=128|f>>6&63}b[c++]=128|f&63}}b[c]=0}}
|
||||
function oa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}var pa=new TextDecoder("utf-16le");function qa(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&D[c];)++c;return pa.decode(C.subarray(a,c<<1))}function ra(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var h=0;h<c;++h)E[b>>1]=a.charCodeAt(h),b+=2;E[b>>1]=0;return b-d}
|
||||
function sa(a){return 2*a.length}function ta(a,b){for(var c=0,d="";!(c>=b/4);){var h=F[a+4*c>>2];if(0==h)break;++c;65536<=h?(h-=65536,d+=String.fromCharCode(55296|h>>10,56320|h&1023)):d+=String.fromCharCode(h)}return d}function ua(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var h=0;h<a.length;++h){var f=a.charCodeAt(h);if(55296<=f&&57343>=f){var n=a.charCodeAt(++h);f=65536+((f&1023)<<10)|n&1023}F[b>>2]=f;b+=4;if(b+4>c)break}F[b>>2]=0;return b-d}
|
||||
function va(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var wa,G,C,E,D,F,H,xa,ya;function za(){var a=ja.buffer;wa=a;g.HEAP8=G=new Int8Array(a);g.HEAP16=E=new Int16Array(a);g.HEAP32=F=new Int32Array(a);g.HEAPU8=C=new Uint8Array(a);g.HEAPU16=D=new Uint16Array(a);g.HEAPU32=H=new Uint32Array(a);g.HEAPF32=xa=new Float32Array(a);g.HEAPF64=ya=new Float64Array(a)}var I,Aa=[],Ba=[],Ca=[];function Da(){var a=g.preRun.shift();Aa.unshift(a)}
|
||||
var J=0,Ea=null,K=null;g.preloadedImages={};g.preloadedAudios={};function y(a){if(g.onAbort)g.onAbort(a);z(a);ka=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");ba(a);throw a;}var L=(new URL("jxl_node_enc.wasm",import.meta.url)).toString();
|
||||
function Fa(){return Promise.resolve().then(function(){a:{try{if(L==L&&A){var a=new Uint8Array(A);break a}if(ea){a=ea(L);break a}throw"both async and sync fetching of the wasm failed";}catch(b){y(b)}a=void 0}return a})}function Ga(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(g);else{var c=b.ya;"number"===typeof c?void 0===b.$?I.get(c)():I.get(c)(b.$):c(void 0===b.$?null:b.$)}}}
|
||||
function Ha(a){this.V=a-16;this.qa=function(b){F[this.V+8>>2]=b};this.na=function(b){F[this.V+0>>2]=b};this.oa=function(){F[this.V+4>>2]=0};this.ma=function(){G[this.V+12>>0]=0};this.pa=function(){G[this.V+13>>0]=0};this.ja=function(b,c){this.qa(b);this.na(c);this.oa();this.ma();this.pa()}}var Ia=0,M={};function Ja(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function N(a){return this.fromWireType(H[a>>2])}var O={},P={},Q={};
|
||||
function Ka(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function La(a,b){a=Ka(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function Ma(a){var b=Error,c=La(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Na=void 0;
|
||||
function Oa(a,b,c){function d(m){m=c(m);if(m.length!==a.length)throw new Na("Mismatched type converter count");for(var k=0;k<a.length;++k)R(a[k],m[k])}a.forEach(function(m){Q[m]=b});var h=Array(b.length),f=[],n=0;b.forEach(function(m,k){P.hasOwnProperty(m)?h[k]=P[m]:(f.push(m),O.hasOwnProperty(m)||(O[m]=[]),O[m].push(function(){h[k]=P[m];++n;n===f.length&&d(h)}))});0===f.length&&d(h)}
|
||||
function Pa(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Qa=void 0;function T(a){for(var b="";C[a];)b+=Qa[C[a++]];return b}var Ra=void 0;function U(a){throw new Ra(a);}
|
||||
function R(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||U('type "'+d+'" must have a positive integer typeid pointer');if(P.hasOwnProperty(a)){if(c.ia)return;U("Cannot register type '"+d+"' twice")}P[a]=b;delete Q[a];O.hasOwnProperty(a)&&(b=O[a],delete O[a],b.forEach(function(h){h()}))}var Sa=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Ta(a){4<a&&0===--V[a].aa&&(V[a]=void 0,Sa.push(a))}function W(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Sa.length?Sa.pop():V.length;V[b]={aa:1,value:a};return b}}function Ua(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Va(a,b){switch(b){case 2:return function(c){return this.fromWireType(xa[c>>2])};case 3:return function(c){return this.fromWireType(ya[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Wa(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=La(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Xa(a,b){var c=g;if(void 0===c[a].S){var d=c[a];c[a]=function(){c[a].S.hasOwnProperty(arguments.length)||U("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].S+")!");return c[a].S[arguments.length].apply(this,arguments)};c[a].S=[];c[a].S[d.da]=d}}
|
||||
function Ya(a,b,c){g.hasOwnProperty(a)?((void 0===c||void 0!==g[a].S&&void 0!==g[a].S[c])&&U("Cannot register public name '"+a+"' twice"),Xa(a,a),g.hasOwnProperty(c)&&U("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),g[a].S[c]=b):(g[a]=b,void 0!==c&&(g[a].Aa=c))}function Za(a,b){for(var c=[],d=0;d<a;d++)c.push(F[(b>>2)+d]);return c}
|
||||
function $a(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=g["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=I.get(b).apply(null,c);return d}}function X(a,b){a=T(a);var c=a.includes("j")?$a(a,b):I.get(b);"function"!==typeof c&&U("unknown function pointer with signature "+a+": "+b);return c}var ab=void 0;function bb(a){a=cb(a);var b=T(a);Y(a);return b}
|
||||
function db(a,b){function c(f){h[f]||P[f]||(Q[f]?Q[f].forEach(c):(d.push(f),h[f]=!0))}var d=[],h={};b.forEach(c);throw new ab(a+": "+d.map(bb).join([", "]));}function eb(a,b,c){switch(b){case 0:return c?function(d){return G[d]}:function(d){return C[d]};case 1:return c?function(d){return E[d>>1]}:function(d){return D[d>>1]};case 2:return c?function(d){return F[d>>2]}:function(d){return H[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var fb={};
|
||||
function gb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function hb(a,b){var c=P[a];void 0===c&&U(b+" has unknown type "+bb(a));return c}var ib={},jb={};function kb(){if(!lb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ca||"./this.program"},b;for(b in jb)a[b]=jb[b];var c=[];for(b in a)c.push(b+"="+a[b]);lb=c}return lb}
|
||||
var lb,mb=[null,[],[]];function Z(a){return 0===a%4&&(0!==a%100||0===a%400)}function nb(a,b){for(var c=0,d=0;d<=b;c+=a[d++]);return c}var ob=[31,29,31,30,31,30,31,31,30,31,30,31],pb=[31,28,31,30,31,30,31,31,30,31,30,31];function qb(a,b){for(a=new Date(a.getTime());0<b;){var c=a.getMonth(),d=(Z(a.getFullYear())?ob:pb)[c];if(b>d-a.getDate())b-=d-a.getDate()+1,a.setDate(1),11>c?a.setMonth(c+1):(a.setMonth(0),a.setFullYear(a.getFullYear()+1));else{a.setDate(a.getDate()+b);break}}return a}
|
||||
function rb(a,b,c,d){function h(e,l,u){for(e="number"===typeof e?e.toString():e||"";e.length<l;)e=u[0]+e;return e}function f(e,l){return h(e,l,"0")}function n(e,l){function u(B){return 0>B?-1:0<B?1:0}var v;0===(v=u(e.getFullYear()-l.getFullYear()))&&0===(v=u(e.getMonth()-l.getMonth()))&&(v=u(e.getDate()-l.getDate()));return v}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),
|
||||
0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function k(e){e=qb(new Date(e.R+1900,0,1),e.Z);var l=new Date(e.getFullYear()+1,0,4),u=m(new Date(e.getFullYear(),0,4));l=m(l);return 0>=n(u,e)?0>=n(l,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var q=F[d+40>>2];d={wa:F[d>>2],va:F[d+4>>2],X:F[d+8>>2],W:F[d+12>>2],U:F[d+16>>2],R:F[d+20>>2],Y:F[d+24>>2],Z:F[d+28>>2],Ba:F[d+32>>2],ua:F[d+36>>2],
|
||||
xa:q?ma(q):""};c=ma(c);q={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var p in q)c=c.replace(new RegExp(p,"g"),q[p]);var r="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
|
||||
x="January February March April May June July August September October November December".split(" ");q={"%a":function(e){return r[e.Y].substring(0,3)},"%A":function(e){return r[e.Y]},"%b":function(e){return x[e.U].substring(0,3)},"%B":function(e){return x[e.U]},"%C":function(e){return f((e.R+1900)/100|0,2)},"%d":function(e){return f(e.W,2)},"%e":function(e){return h(e.W,2," ")},"%g":function(e){return k(e).toString().substring(2)},"%G":function(e){return k(e)},"%H":function(e){return f(e.X,2)},"%I":function(e){e=
|
||||
e.X;0==e?e=12:12<e&&(e-=12);return f(e,2)},"%j":function(e){return f(e.W+nb(Z(e.R+1900)?ob:pb,e.U-1),3)},"%m":function(e){return f(e.U+1,2)},"%M":function(e){return f(e.va,2)},"%n":function(){return"\n"},"%p":function(e){return 0<=e.X&&12>e.X?"AM":"PM"},"%S":function(e){return f(e.wa,2)},"%t":function(){return"\t"},"%u":function(e){return e.Y||7},"%U":function(e){var l=new Date(e.R+1900,0,1),u=0===l.getDay()?l:qb(l,7-l.getDay());e=new Date(e.R+1900,e.U,e.W);return 0>n(u,e)?f(Math.ceil((31-u.getDate()+
|
||||
(nb(Z(e.getFullYear())?ob:pb,e.getMonth()-1)-31)+e.getDate())/7),2):0===n(u,l)?"01":"00"},"%V":function(e){var l=new Date(e.R+1901,0,4),u=m(new Date(e.R+1900,0,4));l=m(l);var v=qb(new Date(e.R+1900,0,1),e.Z);return 0>n(v,u)?"53":0>=n(l,v)?"01":f(Math.ceil((u.getFullYear()<e.R+1900?e.Z+32-u.getDate():e.Z+1-u.getDate())/7),2)},"%w":function(e){return e.Y},"%W":function(e){var l=new Date(e.R,0,1),u=1===l.getDay()?l:qb(l,0===l.getDay()?1:7-l.getDay()+1);e=new Date(e.R+1900,e.U,e.W);return 0>n(u,e)?f(Math.ceil((31-
|
||||
u.getDate()+(nb(Z(e.getFullYear())?ob:pb,e.getMonth()-1)-31)+e.getDate())/7),2):0===n(u,l)?"01":"00"},"%y":function(e){return(e.R+1900).toString().substring(2)},"%Y":function(e){return e.R+1900},"%z":function(e){e=e.ua;var l=0<=e;e=Math.abs(e)/60;return(l?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":function(e){return e.xa},"%%":function(){return"%"}};for(p in q)c.includes(p)&&(c=c.replace(new RegExp(p,"g"),q[p](d)));p=sb(c);if(p.length>b)return 0;G.set(p,a);return p.length-1}
|
||||
Na=g.InternalError=Ma("InternalError");for(var tb=Array(256),ub=0;256>ub;++ub)tb[ub]=String.fromCharCode(ub);Qa=tb;Ra=g.BindingError=Ma("BindingError");g.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};g.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};ab=g.UnboundTypeError=Ma("UnboundTypeError");function sb(a){var b=Array(oa(a)+1);na(a,b,0,b.length);return b}
|
||||
var wb={o:function(a){return vb(a+16)+16},D:function(){},n:function(a,b,c){(new Ha(a)).ja(b,c);Ia++;throw a;},k:function(a){var b=M[a];delete M[a];var c=b.ka,d=b.la,h=b.ba,f=h.map(function(n){return n.ha}).concat(h.map(function(n){return n.sa}));Oa([a],f,function(n){var m={};h.forEach(function(k,q){var p=n[q],r=k.fa,x=k.ga,e=n[q+h.length],l=k.ra,u=k.ta;m[k.ea]={read:function(v){return p.fromWireType(r(x,v))},write:function(v,B){var S=[];l(u,v,e.toWireType(S,B));Ja(S)}}});return[{name:b.name,fromWireType:function(k){var q=
|
||||
{},p;for(p in m)q[p]=m[p].read(k);d(k);return q},toWireType:function(k,q){for(var p in m)if(!(p in q))throw new TypeError('Missing field: "'+p+'"');var r=c();for(p in m)m[p].write(r,q[p]);null!==k&&k.push(d,r);return r},argPackAdvance:8,readValueFromPointer:N,T:d}]})},q:function(){},z:function(a,b,c,d,h){var f=Pa(c);b=T(b);R(a,{name:b,fromWireType:function(n){return!!n},toWireType:function(n,m){return m?d:h},argPackAdvance:8,readValueFromPointer:function(n){if(1===c)var m=G;else if(2===c)m=E;else if(4===
|
||||
c)m=F;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(m[n>>f])},T:null})},y:function(a,b){b=T(b);R(a,{name:b,fromWireType:function(c){var d=V[c].value;Ta(c);return d},toWireType:function(c,d){return W(d)},argPackAdvance:8,readValueFromPointer:N,T:null})},h:function(a,b,c){c=Pa(c);b=T(b);R(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,h){if("number"!==typeof h&&"boolean"!==typeof h)throw new TypeError('Cannot convert "'+Ua(h)+'" to '+this.name);
|
||||
return h},argPackAdvance:8,readValueFromPointer:Va(b,c),T:null})},j:function(a,b,c,d,h,f){var n=Za(b,c);a=T(a);h=X(d,h);Ya(a,function(){db("Cannot call "+a+" due to unbound types",n)},b-1);Oa([],n,function(m){var k=[m[0],null].concat(m.slice(1)),q=m=a,p=h,r=k.length;2>r&&U("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==k[1]&&!1,e=!1,l=1;l<k.length;++l)if(null!==k[l]&&void 0===k[l].T){e=!0;break}var u="void"!==k[0].name,v="",B="";for(l=0;l<r-2;++l)v+=
|
||||
(0!==l?", ":"")+"arg"+l,B+=(0!==l?", ":"")+"arg"+l+"Wired";q="return function "+Ka(q)+"("+v+") {\nif (arguments.length !== "+(r-2)+") {\nthrowBindingError('function "+q+" called with ' + arguments.length + ' arguments, expected "+(r-2)+" args!');\n}\n";e&&(q+="var destructors = [];\n");var S=e?"destructors":"null";v="throwBindingError invoker fn runDestructors retType classParam".split(" ");p=[U,p,f,Ja,k[0],k[1]];x&&(q+="var thisWired = classParam.toWireType("+S+", this);\n");for(l=0;l<r-2;++l)q+=
|
||||
"var arg"+l+"Wired = argType"+l+".toWireType("+S+", arg"+l+"); // "+k[l+2].name+"\n",v.push("argType"+l),p.push(k[l+2]);x&&(B="thisWired"+(0<B.length?", ":"")+B);q+=(u?"var rv = ":"")+"invoker(fn"+(0<B.length?", ":"")+B+");\n";if(e)q+="runDestructors(destructors);\n";else for(l=x?1:2;l<k.length;++l)r=1===l?"thisWired":"arg"+(l-2)+"Wired",null!==k[l].T&&(q+=r+"_dtor("+r+"); // "+k[l].name+"\n",v.push(r+"_dtor"),p.push(k[l].T));u&&(q+="var ret = retType.fromWireType(rv);\nreturn ret;\n");v.push(q+"}\n");
|
||||
k=Wa(v).apply(null,p);l=b-1;if(!g.hasOwnProperty(m))throw new Na("Replacing nonexistant public symbol");void 0!==g[m].S&&void 0!==l?g[m].S[l]=k:(g[m]=k,g[m].da=l);return[]})},c:function(a,b,c,d,h){function f(q){return q}b=T(b);-1===h&&(h=4294967295);var n=Pa(c);if(0===d){var m=32-8*c;f=function(q){return q<<m>>>m}}var k=b.includes("unsigned");R(a,{name:b,fromWireType:f,toWireType:function(q,p){if("number"!==typeof p&&"boolean"!==typeof p)throw new TypeError('Cannot convert "'+Ua(p)+'" to '+this.name);
|
||||
if(p<d||p>h)throw new TypeError('Passing a number "'+Ua(p)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+h+"]!");return k?p>>>0:p|0},argPackAdvance:8,readValueFromPointer:eb(b,n,0!==d),T:null})},b:function(a,b,c){function d(f){f>>=2;var n=H;return new h(wa,n[f+1],n[f])}var h=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=T(c);R(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},
|
||||
{ia:!0})},i:function(a,b){b=T(b);var c="std::string"===b;R(a,{name:b,fromWireType:function(d){var h=H[d>>2];if(c)for(var f=d+4,n=0;n<=h;++n){var m=d+4+n;if(n==h||0==C[m]){f=ma(f,m-f);if(void 0===k)var k=f;else k+=String.fromCharCode(0),k+=f;f=m+1}}else{k=Array(h);for(n=0;n<h;++n)k[n]=String.fromCharCode(C[d+4+n]);k=k.join("")}Y(d);return k},toWireType:function(d,h){h instanceof ArrayBuffer&&(h=new Uint8Array(h));var f="string"===typeof h;f||h instanceof Uint8Array||h instanceof Uint8ClampedArray||
|
||||
h instanceof Int8Array||U("Cannot pass non-string to std::string");var n=(c&&f?function(){return oa(h)}:function(){return h.length})(),m=vb(4+n+1);H[m>>2]=n;if(c&&f)na(h,C,m+4,n+1);else if(f)for(f=0;f<n;++f){var k=h.charCodeAt(f);255<k&&(Y(m),U("String has UTF-16 code units that do not fit in 8 bits"));C[m+4+f]=k}else for(f=0;f<n;++f)C[m+4+f]=h[f];null!==d&&d.push(Y,m);return m},argPackAdvance:8,readValueFromPointer:N,T:function(d){Y(d)}})},g:function(a,b,c){c=T(c);if(2===b){var d=qa;var h=ra;var f=
|
||||
sa;var n=function(){return D};var m=1}else 4===b&&(d=ta,h=ua,f=va,n=function(){return H},m=2);R(a,{name:c,fromWireType:function(k){for(var q=H[k>>2],p=n(),r,x=k+4,e=0;e<=q;++e){var l=k+4+e*b;if(e==q||0==p[l>>m])x=d(x,l-x),void 0===r?r=x:(r+=String.fromCharCode(0),r+=x),x=l+b}Y(k);return r},toWireType:function(k,q){"string"!==typeof q&&U("Cannot pass non-string to C++ string type "+c);var p=f(q),r=vb(4+p+b);H[r>>2]=p>>m;h(q,r+4,p+b);null!==k&&k.push(Y,r);return r},argPackAdvance:8,readValueFromPointer:N,
|
||||
T:function(k){Y(k)}})},l:function(a,b,c,d,h,f){M[a]={name:T(b),ka:X(c,d),la:X(h,f),ba:[]}},d:function(a,b,c,d,h,f,n,m,k,q){M[a].ba.push({ea:T(b),ha:c,fa:X(d,h),ga:f,sa:n,ra:X(m,k),ta:q})},A:function(a,b){b=T(b);R(a,{za:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},e:Ta,C:function(a){if(0===a)return W(gb());var b=fb[a];a=void 0===b?T(a):b;return W(gb()[a])},B:function(a){4<a&&(V[a].aa+=1)},m:function(a,b,c,d){a||U("Cannot use deleted val. handle = "+a);a=V[a].value;
|
||||
var h=ib[b];if(!h){h="";for(var f=0;f<b;++f)h+=(0!==f?", ":"")+"arg"+f;var n="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(f=0;f<b;++f)n+="var argType"+f+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+f+'], "parameter '+f+'");\nvar arg'+f+" = argType"+f+".readValueFromPointer(args);\nargs += argType"+f+"['argPackAdvance'];\n";h=(new Function("requireRegisteredType","Module","__emval_register",n+("var obj = new constructor("+h+");\nreturn __emval_register(obj);\n}\n")))(hb,
|
||||
g,W);ib[b]=h}return h(a,c,d)},a:function(){y()},s:function(a,b,c){C.copyWithin(a,b,b+c)},f:function(a){var b=C.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{ja.grow(Math.min(2147483648,d)-wa.byteLength+65535>>>16);za();var h=1;break a}catch(f){}h=void 0}if(h)return!0}return!1},u:function(a,b){var c=0;kb().forEach(function(d,h){var f=b+c;h=F[a+4*h>>2]=f;for(f=0;f<d.length;++f)G[h++>>0]=d.charCodeAt(f);
|
||||
G[h>>0]=0;c+=d.length+1});return 0},v:function(a,b){var c=kb();F[a>>2]=c.length;var d=0;c.forEach(function(h){d+=h.length+1});F[b>>2]=d;return 0},w:function(){return 0},p:function(){},x:function(a,b,c,d){for(var h=0,f=0;f<c;f++){for(var n=F[b+8*f>>2],m=F[b+(8*f+4)>>2],k=0;k<m;k++){var q=C[n+k],p=mb[a];if(0===q||10===q){q=1===a?ia:z;var r;for(r=0;p[r]&&!(NaN<=r);)++r;r=la.decode(p.subarray?p.subarray(0,r):new Uint8Array(p.slice(0,r)));q(r);p.length=0}else p.push(q)}h+=m}F[d>>2]=h;return 0},r:function(){},
|
||||
t:function(a,b,c,d){return rb(a,b,c,d)}};
|
||||
(function(){function a(h){g.asm=h.exports;ja=g.asm.E;za();I=g.asm.K;Ba.unshift(g.asm.F);J--;g.monitorRunDependencies&&g.monitorRunDependencies(J);0==J&&(null!==Ea&&(clearInterval(Ea),Ea=null),K&&(h=K,K=null,h()))}function b(h){a(h.instance)}function c(h){return Fa().then(function(f){return WebAssembly.instantiate(f,d)}).then(h,function(f){z("failed to asynchronously prepare wasm: "+f);y(f)})}var d={a:wb};J++;g.monitorRunDependencies&&g.monitorRunDependencies(J);if(g.instantiateWasm)try{return g.instantiateWasm(d,
|
||||
a)}catch(h){return z("Module.instantiateWasm callback failed with error: "+h),!1}(function(){return A||"function"!==typeof WebAssembly.instantiateStreaming||L.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(L,{credentials:"same-origin"}).then(function(h){return WebAssembly.instantiateStreaming(h,d).then(b,function(f){z("wasm streaming compile failed: "+f);z("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ba);return{}})();
|
||||
g.___wasm_call_ctors=function(){return(g.___wasm_call_ctors=g.asm.F).apply(null,arguments)};var vb=g._malloc=function(){return(vb=g._malloc=g.asm.G).apply(null,arguments)},Y=g._free=function(){return(Y=g._free=g.asm.H).apply(null,arguments)},cb=g.___getTypeName=function(){return(cb=g.___getTypeName=g.asm.I).apply(null,arguments)};g.___embind_register_native_and_builtin_types=function(){return(g.___embind_register_native_and_builtin_types=g.asm.J).apply(null,arguments)};
|
||||
g.dynCall_viijii=function(){return(g.dynCall_viijii=g.asm.L).apply(null,arguments)};g.dynCall_iiji=function(){return(g.dynCall_iiji=g.asm.M).apply(null,arguments)};g.dynCall_jiji=function(){return(g.dynCall_jiji=g.asm.N).apply(null,arguments)};g.dynCall_iiiiij=function(){return(g.dynCall_iiiiij=g.asm.O).apply(null,arguments)};g.dynCall_iiiiijj=function(){return(g.dynCall_iiiiijj=g.asm.P).apply(null,arguments)};g.dynCall_iiiiiijj=function(){return(g.dynCall_iiiiiijj=g.asm.Q).apply(null,arguments)};
|
||||
var xb;K=function yb(){xb||zb();xb||(K=yb)};
|
||||
function zb(){function a(){if(!xb&&(xb=!0,g.calledRun=!0,!ka)){Ga(Ba);aa(g);if(g.onRuntimeInitialized)g.onRuntimeInitialized();if(g.postRun)for("function"==typeof g.postRun&&(g.postRun=[g.postRun]);g.postRun.length;){var b=g.postRun.shift();Ca.unshift(b)}Ga(Ca)}}if(!(0<J)){if(g.preRun)for("function"==typeof g.preRun&&(g.preRun=[g.preRun]);g.preRun.length;)Da();Ga(Aa);0<J||(g.setStatus?(g.setStatus("Running..."),setTimeout(function(){setTimeout(function(){g.setStatus("")},1);a()},1)):a())}}g.run=zb;
|
||||
if(g.preInit)for("function"==typeof g.preInit&&(g.preInit=[g.preInit]);0<g.preInit.length;)g.preInit.pop()();zb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/jxl/enc/jxl_node_enc.wasm
Executable file
BIN
codecs/jxl/enc/jxl_node_enc.wasm
Executable file
Binary file not shown.
6
codecs/jxl/package.json
Normal file
6
codecs/jxl/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "jxl",
|
||||
"scripts": {
|
||||
"build": "../build-cpp.sh"
|
||||
}
|
||||
}
|
||||
132
codecs/mozjpeg/LICENSE.codec.md
Normal file
132
codecs/mozjpeg/LICENSE.codec.md
Normal file
@@ -0,0 +1,132 @@
|
||||
libjpeg-turbo Licenses
|
||||
======================
|
||||
|
||||
libjpeg-turbo is covered by three compatible BSD-style open source licenses:
|
||||
|
||||
- The IJG (Independent JPEG Group) License, which is listed in
|
||||
[README.ijg](README.ijg)
|
||||
|
||||
This license applies to the libjpeg API library and associated programs
|
||||
(any code inherited from libjpeg, and any modifications to that code.)
|
||||
|
||||
- The Modified (3-clause) BSD License, which is listed below
|
||||
|
||||
This license covers the TurboJPEG API library and associated programs, as
|
||||
well as the build system.
|
||||
|
||||
- The [zlib License](https://opensource.org/licenses/Zlib)
|
||||
|
||||
This license is a subset of the other two, and it covers the libjpeg-turbo
|
||||
SIMD extensions.
|
||||
|
||||
|
||||
Complying with the libjpeg-turbo Licenses
|
||||
=========================================
|
||||
|
||||
This section provides a roll-up of the libjpeg-turbo licensing terms, to the
|
||||
best of our understanding.
|
||||
|
||||
1. If you are distributing a modified version of the libjpeg-turbo source,
|
||||
then:
|
||||
|
||||
1. You cannot alter or remove any existing copyright or license notices
|
||||
from the source.
|
||||
|
||||
**Origin**
|
||||
- Clause 1 of the IJG License
|
||||
- Clause 1 of the Modified BSD License
|
||||
- Clauses 1 and 3 of the zlib License
|
||||
|
||||
2. You must add your own copyright notice to the header of each source
|
||||
file you modified, so others can tell that you modified that file (if
|
||||
there is not an existing copyright header in that file, then you can
|
||||
simply add a notice stating that you modified the file.)
|
||||
|
||||
**Origin**
|
||||
- Clause 1 of the IJG License
|
||||
- Clause 2 of the zlib License
|
||||
|
||||
3. You must include the IJG README file, and you must not alter any of the
|
||||
copyright or license text in that file.
|
||||
|
||||
**Origin**
|
||||
- Clause 1 of the IJG License
|
||||
|
||||
2. If you are distributing only libjpeg-turbo binaries without the source, or
|
||||
if you are distributing an application that statically links with
|
||||
libjpeg-turbo, then:
|
||||
|
||||
1. Your product documentation must include a message stating:
|
||||
|
||||
This software is based in part on the work of the Independent JPEG
|
||||
Group.
|
||||
|
||||
**Origin**
|
||||
- Clause 2 of the IJG license
|
||||
|
||||
2. If your binary distribution includes or uses the TurboJPEG API, then
|
||||
your product documentation must include the text of the Modified BSD
|
||||
License (see below.)
|
||||
|
||||
**Origin**
|
||||
- Clause 2 of the Modified BSD License
|
||||
|
||||
3. You cannot use the name of the IJG or The libjpeg-turbo Project or the
|
||||
contributors thereof in advertising, publicity, etc.
|
||||
|
||||
**Origin**
|
||||
- IJG License
|
||||
- Clause 3 of the Modified BSD License
|
||||
|
||||
4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be
|
||||
free of defects, nor do we accept any liability for undesirable
|
||||
consequences resulting from your use of the software.
|
||||
|
||||
**Origin**
|
||||
- IJG License
|
||||
- Modified BSD License
|
||||
- zlib License
|
||||
|
||||
|
||||
The Modified (3-clause) BSD License
|
||||
===================================
|
||||
|
||||
Copyright (C)2009-2020 D. R. Commander. All Rights Reserved.
|
||||
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
- Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Why Three Licenses?
|
||||
===================
|
||||
|
||||
The zlib License could have been used instead of the Modified (3-clause) BSD
|
||||
License, and since the IJG License effectively subsumes the distribution
|
||||
conditions of the zlib License, this would have effectively placed
|
||||
libjpeg-turbo binary distributions under the IJG License. However, the IJG
|
||||
License specifically refers to the Independent JPEG Group and does not extend
|
||||
attribution and endorsement protections to other entities. Thus, it was
|
||||
desirable to choose a license that granted us the same protections for new code
|
||||
that were granted to the IJG for code derived from their software.
|
||||
61
codecs/mozjpeg/Makefile
Normal file
61
codecs/mozjpeg/Makefile
Normal file
@@ -0,0 +1,61 @@
|
||||
CODEC_URL := https://github.com/mozilla/mozjpeg/archive/v3.3.1.tar.gz
|
||||
CODEC_DIR := node_modules/mozjpeg
|
||||
CODEC_OUT_RELATIVE := .libs/libjpeg.a rdswitch.o
|
||||
CODEC_OUT := $(addprefix $(CODEC_DIR)/, $(CODEC_OUT_RELATIVE))
|
||||
ENVIRONMENT = worker
|
||||
|
||||
OUT_JS := enc/mozjpeg_enc.js enc/mozjpeg_node_enc.js dec/mozjpeg_node_dec.js
|
||||
OUT_WASM := $(OUT_JS:.js=.wasm)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(OUT_JS)
|
||||
|
||||
# Define dependencies for all variations of build artifacts.
|
||||
$(filter enc/%,$(OUT_JS)): enc/mozjpeg_enc.cpp
|
||||
$(filter dec/%,$(OUT_JS)): dec/mozjpeg_dec.cpp
|
||||
|
||||
enc/mozjpeg_node_enc.js dec/mozjpeg_node_dec.js: ENVIRONMENT = node
|
||||
|
||||
%.js: $(CODEC_OUT)
|
||||
$(CXX) \
|
||||
-I $(CODEC_DIR) \
|
||||
${CXXFLAGS} \
|
||||
${LDFLAGS} \
|
||||
--bind \
|
||||
-s ENVIRONMENT=$(ENVIRONMENT) \
|
||||
-s EXPORT_ES6=1 \
|
||||
-o $@ \
|
||||
$+
|
||||
|
||||
# This one is a bit special: there is no rule for .libs/libjpeg.a
|
||||
# so we use libjpeg.la which implicitly builds that one instead.
|
||||
$(CODEC_DIR)/.libs/libjpeg.a: $(CODEC_DIR)/Makefile
|
||||
$(MAKE) -C $(CODEC_DIR) libjpeg.la
|
||||
|
||||
$(CODEC_DIR)/rdswitch.o: $(CODEC_DIR)/Makefile
|
||||
$(MAKE) -C $(CODEC_DIR) rdswitch.o
|
||||
|
||||
$(CODEC_DIR)/Makefile: $(CODEC_DIR)/configure
|
||||
cd $(CODEC_DIR) && ./configure \
|
||||
--disable-shared \
|
||||
--without-turbojpeg \
|
||||
--without-simd \
|
||||
--without-arith-enc \
|
||||
--without-arith-dec \
|
||||
--with-build-date=squoosh
|
||||
# ^ If not provided with a dummy value, MozJPEG includes a build date in the
|
||||
# binary as part of the version string, making binaries different each time.
|
||||
|
||||
$(CODEC_DIR)/configure: $(CODEC_DIR)/configure.ac
|
||||
cd $(CODEC_DIR) && autoreconf -iv
|
||||
|
||||
$(CODEC_DIR)/configure.ac: $(CODEC_DIR)
|
||||
|
||||
$(CODEC_DIR):
|
||||
mkdir -p $@
|
||||
curl -sL $(CODEC_URL) | tar xz --strip 1 -C $@
|
||||
|
||||
clean:
|
||||
$(RM) $(OUT_JS) $(OUT_WASM)
|
||||
$(MAKE) -C $(CODEC_DIR) clean
|
||||
57
codecs/mozjpeg/dec/mozjpeg_dec.cpp
Normal file
57
codecs/mozjpeg/dec/mozjpeg_dec.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include <emscripten/bind.h>
|
||||
#include <emscripten/val.h>
|
||||
#include "config.h"
|
||||
#include "jpeglib.h"
|
||||
|
||||
extern "C" {
|
||||
#include "cdjpeg.h"
|
||||
}
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
|
||||
thread_local const val ImageData = val::global("ImageData");
|
||||
|
||||
val decode(std::string image_in) {
|
||||
uint8_t* image_buffer = (uint8_t*)image_in.c_str();
|
||||
|
||||
jpeg_decompress_struct cinfo;
|
||||
jpeg_error_mgr jerr;
|
||||
// Initialize the JPEG decompression object with default error handling.
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_decompress(&cinfo);
|
||||
|
||||
jpeg_mem_src(&cinfo, image_buffer, image_in.length());
|
||||
// Read file header, set default decompression parameters
|
||||
jpeg_read_header(&cinfo, TRUE);
|
||||
// Force RGBA decoding, even for grayscale images
|
||||
cinfo.out_color_space = JCS_EXT_RGBA;
|
||||
jpeg_start_decompress(&cinfo);
|
||||
|
||||
// Prepare output buffer
|
||||
size_t output_size = cinfo.output_width * cinfo.output_height * 4;
|
||||
std::vector<uint8_t> output_buffer(output_size);
|
||||
auto stride = cinfo.output_width * 4;
|
||||
|
||||
// Process data
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
uint8_t* ptr = &output_buffer[stride * cinfo.output_scanline];
|
||||
jpeg_read_scanlines(&cinfo, &ptr, 1);
|
||||
}
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
|
||||
// Step 7: release JPEG compression object
|
||||
|
||||
auto data = Uint8ClampedArray.new_(typed_memory_view(output_size, &output_buffer[0]));
|
||||
auto js_result = ImageData.new_(data, cinfo.output_width, cinfo.output_height);
|
||||
|
||||
// This is an important step since it will release a good deal of memory.
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
// And we're done!
|
||||
return js_result;
|
||||
}
|
||||
|
||||
EMSCRIPTEN_BINDINGS(my_module) {
|
||||
function("decode", &decode);
|
||||
}
|
||||
57
codecs/mozjpeg/dec/mozjpeg_node_dec.js
generated
Normal file
57
codecs/mozjpeg/dec/mozjpeg_node_dec.js
generated
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
var Module = (function() {
|
||||
var _scriptDir = import.meta.url;
|
||||
|
||||
return (
|
||||
function(Module) {
|
||||
Module = Module || {};
|
||||
|
||||
|
||||
var e;e||(e=typeof Module !== 'undefined' ? Module : {});var aa,r;e.ready=new Promise(function(a,b){aa=a;r=b});var t={},u;for(u in e)e.hasOwnProperty(u)&&(t[u]=e[u]);var v="./this.program";function w(a,b){throw b;}var ba,y,ca,da;ba=function(a){ca||(ca=require("fs"));da||(da=require("path"));a=da.normalize(a);return ca.readFileSync(a,null)};y=function(a){a=ba(a);a.buffer||(a=new Uint8Array(a));a.buffer||z("Assertion failed: undefined");return a};
|
||||
1<process.argv.length&&(v=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);process.on("uncaughtException",function(a){if(!(a instanceof ea))throw a;});process.on("unhandledRejection",z);w=function(a){process.exit(a)};e.inspect=function(){return"[Emscripten Module object]"};var fa=e.print||console.log.bind(console),A=e.printErr||console.warn.bind(console);for(u in t)t.hasOwnProperty(u)&&(e[u]=t[u]);t=null;e.thisProgram&&(v=e.thisProgram);e.quit&&(w=e.quit);var C;e.wasmBinary&&(C=e.wasmBinary);
|
||||
var noExitRuntime=e.noExitRuntime||!0;"object"!==typeof WebAssembly&&z("no native wasm support detected");var ha,ia=!1,ja=new TextDecoder("utf8");
|
||||
function ka(a,b,c){var d=D;if(0<c){c=b+c-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var la=new TextDecoder("utf-16le");
|
||||
function ma(a,b){var c=a>>1;for(b=c+b/2;!(c>=b)&&E[c];)++c;return la.decode(D.subarray(a,c<<1))}function na(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f<c;++f)G[b>>1]=a.charCodeAt(f),b+=2;G[b>>1]=0;return b-d}function oa(a){return 2*a.length}function pa(a,b){for(var c=0,d="";!(c>=b/4);){var f=H[a+4*c>>2];if(0==f)break;++c;65536<=f?(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023)):d+=String.fromCharCode(f)}return d}
|
||||
function qa(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var l=a.charCodeAt(++f);g=65536+((g&1023)<<10)|l&1023}H[b>>2]=g;b+=4;if(b+4>c)break}H[b>>2]=0;return b-d}function ra(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b}var sa,I,D,G,E,H,K,ta,ua;
|
||||
function va(){var a=ha.buffer;sa=a;e.HEAP8=I=new Int8Array(a);e.HEAP16=G=new Int16Array(a);e.HEAP32=H=new Int32Array(a);e.HEAPU8=D=new Uint8Array(a);e.HEAPU16=E=new Uint16Array(a);e.HEAPU32=K=new Uint32Array(a);e.HEAPF32=ta=new Float32Array(a);e.HEAPF64=ua=new Float64Array(a)}var L,wa=[],xa=[],ya=[];function za(){var a=e.preRun.shift();wa.unshift(a)}var M=0,Aa=null,N=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function z(a){if(e.onAbort)e.onAbort(a);A(a);ia=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");r(a);throw a;}var O=(new URL("mozjpeg_node_dec.wasm",import.meta.url)).toString();function Ba(){return Promise.resolve().then(function(){a:{try{if(O==O&&C){var a=new Uint8Array(C);break a}if(y){a=y(O);break a}throw"both async and sync fetching of the wasm failed";}catch(b){z(b)}a=void 0}return a})}
|
||||
function Ca(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.N;"number"===typeof c?void 0===b.J?L.get(c)():L.get(c)(b.J):c(void 0===b.J?null:b.J)}}}function Da(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a);}}var Ea=void 0;function P(a){for(var b="";D[a];)b+=Ea[D[a++]];return b}var Q={},R={},S={};
|
||||
function Fa(a){if(void 0===a)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?"_"+a:a}function Ga(a,b){a=Fa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
|
||||
function Ha(a){var b=Error,c=Ga(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c}var Ia=void 0;function T(a){throw new Ia(a);}var Ja=void 0;
|
||||
function Ka(a,b){function c(h){h=b(h);if(h.length!==d.length)throw new Ja("Mismatched type converter count");for(var k=0;k<d.length;++k)U(d[k],h[k])}var d=[];d.forEach(function(h){S[h]=a});var f=Array(a.length),g=[],l=0;a.forEach(function(h,k){R.hasOwnProperty(h)?f[k]=R[h]:(g.push(h),Q.hasOwnProperty(h)||(Q[h]=[]),Q[h].push(function(){f[k]=R[h];++l;l===g.length&&c(f)}))});0===g.length&&c(f)}
|
||||
function U(a,b,c){c=c||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var d=b.name;a||T('type "'+d+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(c.M)return;T("Cannot register type '"+d+"' twice")}R[a]=b;delete S[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}var La=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
|
||||
function Ma(a){4<a&&0===--V[a].K&&(V[a]=void 0,La.push(a))}function W(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=La.length?La.pop():V.length;V[b]={K:1,value:a};return b}}function Na(a){return this.fromWireType(K[a>>2])}function Qa(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
|
||||
function Ra(a,b){switch(b){case 2:return function(c){return this.fromWireType(ta[c>>2])};case 3:return function(c){return this.fromWireType(ua[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Sa(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ga(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
|
||||
function Ta(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ua(a,b){var c=e;if(void 0===c[a].H){var d=c[a];c[a]=function(){c[a].H.hasOwnProperty(arguments.length)||T("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].H+")!");return c[a].H[arguments.length].apply(this,arguments)};c[a].H=[];c[a].H[d.L]=d}}
|
||||
function Va(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].H&&void 0!==e[a].H[c])&&T("Cannot register public name '"+a+"' twice"),Ua(a,a),e.hasOwnProperty(c)&&T("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].H[c]=b):(e[a]=b,void 0!==c&&(e[a].P=c))}function Wa(a,b){for(var c=[],d=0;d<a;d++)c.push(H[(b>>2)+d]);return c}
|
||||
function Xa(a,b){var c=[];return function(){c.length=arguments.length;for(var d=0;d<arguments.length;d++)c[d]=arguments[d];a.includes("j")?(d=e["dynCall_"+a],d=c&&c.length?d.apply(null,[b].concat(c)):d.call(null,b)):d=L.get(b).apply(null,c);return d}}function Ya(a,b){a=P(a);var c=a.includes("j")?Xa(a,b):L.get(b);"function"!==typeof c&&T("unknown function pointer with signature "+a+": "+b);return c}var Za=void 0;function $a(a){a=ab(a);var b=P(a);X(a);return b}
|
||||
function bb(a,b){function c(g){f[g]||R[g]||(S[g]?S[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new Za(a+": "+d.map($a).join([", "]));}function cb(a,b,c){switch(b){case 0:return c?function(d){return I[d]}:function(d){return D[d]};case 1:return c?function(d){return G[d>>1]}:function(d){return E[d>>1]};case 2:return c?function(d){return H[d>>2]}:function(d){return K[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var db={};
|
||||
function eb(){return"object"===typeof globalThis?globalThis:Function("return this")()}function fb(a,b){var c=R[a];void 0===c&&T(b+" has unknown type "+$a(a));return c}var gb={},hb={};function ib(){if(!jb){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:v||"./this.program"},b;for(b in hb)a[b]=hb[b];var c=[];for(b in a)c.push(b+"="+a[b]);jb=c}return jb}
|
||||
for(var jb,kb=[null,[],[]],lb=Array(256),Y=0;256>Y;++Y)lb[Y]=String.fromCharCode(Y);Ea=lb;Ia=e.BindingError=Ha("BindingError");Ja=e.InternalError=Ha("InternalError");e.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};Za=e.UnboundTypeError=Ha("UnboundTypeError");
|
||||
var nb={e:function(){},q:function(){},m:function(a,b,c,d,f){var g=Da(c);b=P(b);U(a,{name:b,fromWireType:function(l){return!!l},toWireType:function(l,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(l){if(1===c)var h=I;else if(2===c)h=G;else if(4===c)h=H;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[l>>g])},I:null})},x:function(a,b){b=P(b);U(a,{name:b,fromWireType:function(c){var d=V[c].value;Ma(c);return d},toWireType:function(c,d){return W(d)},
|
||||
argPackAdvance:8,readValueFromPointer:Na,I:null})},l:function(a,b,c){c=Da(c);b=P(b);U(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+Qa(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Ra(b,c),I:null})},o:function(a,b,c,d,f,g){var l=Wa(b,c);a=P(a);f=Ya(d,f);Va(a,function(){bb("Cannot call "+a+" due to unbound types",l)},b-1);Ka(l,function(h){var k=[h[0],null].concat(h.slice(1)),
|
||||
m=h=a,n=f,p=k.length;2>p&&T("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var x=null!==k[1]&&!1,B=!1,q=1;q<k.length;++q)if(null!==k[q]&&void 0===k[q].I){B=!0;break}var Oa="void"!==k[0].name,F="",J="";for(q=0;q<p-2;++q)F+=(0!==q?", ":"")+"arg"+q,J+=(0!==q?", ":"")+"arg"+q+"Wired";m="return function "+Fa(m)+"("+F+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";
|
||||
B&&(m+="var destructors = [];\n");var Pa=B?"destructors":"null";F="throwBindingError invoker fn runDestructors retType classParam".split(" ");n=[T,n,g,Ta,k[0],k[1]];x&&(m+="var thisWired = classParam.toWireType("+Pa+", this);\n");for(q=0;q<p-2;++q)m+="var arg"+q+"Wired = argType"+q+".toWireType("+Pa+", arg"+q+"); // "+k[q+2].name+"\n",F.push("argType"+q),n.push(k[q+2]);x&&(J="thisWired"+(0<J.length?", ":"")+J);m+=(Oa?"var rv = ":"")+"invoker(fn"+(0<J.length?", ":"")+J+");\n";if(B)m+="runDestructors(destructors);\n";
|
||||
else for(q=x?1:2;q<k.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==k[q].I&&(m+=p+"_dtor("+p+"); // "+k[q].name+"\n",F.push(p+"_dtor"),n.push(k[q].I));Oa&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");F.push(m+"}\n");k=Sa(F).apply(null,n);q=b-1;if(!e.hasOwnProperty(h))throw new Ja("Replacing nonexistant public symbol");void 0!==e[h].H&&void 0!==q?e[h].H[q]=k:(e[h]=k,e[h].L=q);return[]})},b:function(a,b,c,d,f){function g(m){return m}b=P(b);-1===f&&(f=4294967295);var l=Da(c);
|
||||
if(0===d){var h=32-8*c;g=function(m){return m<<h>>>h}}var k=b.includes("unsigned");U(a,{name:b,fromWireType:g,toWireType:function(m,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+Qa(n)+'" to '+this.name);if(n<d||n>f)throw new TypeError('Passing a number "'+Qa(n)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return k?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:cb(b,l,0!==d),I:null})},a:function(a,
|
||||
b,c){function d(g){g>>=2;var l=K;return new f(sa,l[g+1],l[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=P(c);U(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{M:!0})},h:function(a,b){b=P(b);var c="std::string"===b;U(a,{name:b,fromWireType:function(d){var f=K[d>>2];if(c)for(var g=d+4,l=0;l<=f;++l){var h=d+4+l;if(l==f||0==D[h]){if(g){for(var k=g+(h-g),m=g;!(m>=k)&&D[m];)++m;g=ja.decode(D.subarray(g,m))}else g="";if(void 0===
|
||||
n)var n=g;else n+=String.fromCharCode(0),n+=g;g=h+1}}else{n=Array(f);for(l=0;l<f;++l)n[l]=String.fromCharCode(D[d+4+l]);n=n.join("")}X(d);return n},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||T("Cannot pass non-string to std::string");var l=(c&&g?function(){for(var m=0,n=0;n<f.length;++n){var p=f.charCodeAt(n);55296<=p&&57343>=p&&(p=65536+((p&1023)<<10)|f.charCodeAt(++n)&
|
||||
1023);127>=p?++m:m=2047>=p?m+2:65535>=p?m+3:m+4}return m}:function(){return f.length})(),h=mb(4+l+1);K[h>>2]=l;if(c&&g)ka(f,h+4,l+1);else if(g)for(g=0;g<l;++g){var k=f.charCodeAt(g);255<k&&(X(h),T("String has UTF-16 code units that do not fit in 8 bits"));D[h+4+g]=k}else for(g=0;g<l;++g)D[h+4+g]=f[g];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:Na,I:function(d){X(d)}})},g:function(a,b,c){c=P(c);if(2===b){var d=ma;var f=na;var g=oa;var l=function(){return E};var h=1}else 4===
|
||||
b&&(d=pa,f=qa,g=ra,l=function(){return K},h=2);U(a,{name:c,fromWireType:function(k){for(var m=K[k>>2],n=l(),p,x=k+4,B=0;B<=m;++B){var q=k+4+B*b;if(B==m||0==n[q>>h])x=d(x,q-x),void 0===p?p=x:(p+=String.fromCharCode(0),p+=x),x=q+b}X(k);return p},toWireType:function(k,m){"string"!==typeof m&&T("Cannot pass non-string to C++ string type "+c);var n=g(m),p=mb(4+n+b);K[p>>2]=n>>h;f(m,p+4,n+b);null!==k&&k.push(X,p);return p},argPackAdvance:8,readValueFromPointer:Na,I:function(k){X(k)}})},n:function(a,b){b=
|
||||
P(b);U(a,{O:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},c:Ma,d:function(a){if(0===a)return W(eb());var b=db[a];a=void 0===b?P(a):b;return W(eb()[a])},i:function(a){4<a&&(V[a].K+=1)},j:function(a,b,c,d){a||T("Cannot use deleted val. handle = "+a);a=V[a].value;var f=gb[b];if(!f){f="";for(var g=0;g<b;++g)f+=(0!==g?", ":"")+"arg"+g;var l="return function emval_allocator_"+b+"(constructor, argTypes, args) {\n";for(g=0;g<b;++g)l+="var argType"+g+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+
|
||||
g+'], "parameter '+g+'");\nvar arg'+g+" = argType"+g+".readValueFromPointer(args);\nargs += argType"+g+"['argPackAdvance'];\n";f=(new Function("requireRegisteredType","Module","__emval_register",l+("var obj = new constructor("+f+");\nreturn __emval_register(obj);\n}\n")))(fb,e,W);gb[b]=f}return f(a,c,d)},k:function(){z()},s:function(a,b,c){D.copyWithin(a,b,b+c)},f:function(a){var b=D.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,
|
||||
d);0<d%65536&&(d+=65536-d%65536);a:{try{ha.grow(Math.min(2147483648,d)-sa.byteLength+65535>>>16);va();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},t:function(a,b){var c=0;ib().forEach(function(d,f){var g=b+c;f=H[a+4*f>>2]=g;for(g=0;g<d.length;++g)I[f++>>0]=d.charCodeAt(g);I[f>>0]=0;c+=d.length+1});return 0},u:function(a,b){var c=ib();H[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+1});H[b>>2]=d;return 0},y:function(a){if(!noExitRuntime){if(e.onExit)e.onExit(a);ia=!0}w(a,new ea(a))},
|
||||
v:function(){return 0},p:function(){},w:function(a,b,c,d){for(var f=0,g=0;g<c;g++){for(var l=H[b+8*g>>2],h=H[b+(8*g+4)>>2],k=0;k<h;k++){var m=D[l+k],n=kb[a];if(0===m||10===m){m=1===a?fa:A;var p;for(p=0;n[p]&&!(NaN<=p);)++p;p=ja.decode(n.subarray?n.subarray(0,p):new Uint8Array(n.slice(0,p)));m(p);n.length=0}else n.push(m)}f+=h}H[d>>2]=f;return 0},r:function(){}};
|
||||
(function(){function a(f){e.asm=f.exports;ha=e.asm.z;va();L=e.asm.F;xa.unshift(e.asm.A);M--;e.monitorRunDependencies&&e.monitorRunDependencies(M);0==M&&(null!==Aa&&(clearInterval(Aa),Aa=null),N&&(f=N,N=null,f()))}function b(f){a(f.instance)}function c(f){return Ba().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){A("failed to asynchronously prepare wasm: "+g);z(g)})}var d={a:nb};M++;e.monitorRunDependencies&&e.monitorRunDependencies(M);if(e.instantiateWasm)try{return e.instantiateWasm(d,
|
||||
a)}catch(f){return A("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return C||"function"!==typeof WebAssembly.instantiateStreaming||O.startsWith("data:application/octet-stream;base64,")||"function"!==typeof fetch?c(b):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){A("wasm streaming compile failed: "+g);A("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(r);return{}})();
|
||||
e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.A).apply(null,arguments)};var mb=e._malloc=function(){return(mb=e._malloc=e.asm.B).apply(null,arguments)},X=e._free=function(){return(X=e._free=e.asm.C).apply(null,arguments)},ab=e.___getTypeName=function(){return(ab=e.___getTypeName=e.asm.D).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.E).apply(null,arguments)};
|
||||
e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.G).apply(null,arguments)};var Z;function ea(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}N=function ob(){Z||pb();Z||(N=ob)};
|
||||
function pb(){function a(){if(!Z&&(Z=!0,e.calledRun=!0,!ia)){Ca(xa);aa(e);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();ya.unshift(b)}Ca(ya)}}if(!(0<M)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)za();Ca(wa);0<M||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=pb;
|
||||
if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();pb();
|
||||
|
||||
|
||||
return Module.ready
|
||||
}
|
||||
);
|
||||
})();
|
||||
export default Module;
|
||||
BIN
codecs/mozjpeg/dec/mozjpeg_node_dec.wasm
Executable file
BIN
codecs/mozjpeg/dec/mozjpeg_node_dec.wasm
Executable file
Binary file not shown.
@@ -1,18 +1,22 @@
|
||||
#include <emscripten/bind.h>
|
||||
#include <emscripten/val.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
#include "jpeglib.h"
|
||||
|
||||
extern "C" {
|
||||
#include "cdjpeg.h"
|
||||
}
|
||||
|
||||
using namespace emscripten;
|
||||
|
||||
// MozJPEG doesn’t expose a numeric version, so I have to do some fun C macro hackery to turn it
|
||||
// into a string. More details here: https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html
|
||||
// MozJPEG doesn’t expose a numeric version, so I have to do some fun C macro
|
||||
// hackery to turn it into a string. More details here:
|
||||
// https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html
|
||||
#define xstr(s) str(s)
|
||||
#define str(s) #s
|
||||
|
||||
@@ -39,8 +43,8 @@ int version() {
|
||||
char buffer[] = xstr(MOZJPEG_VERSION);
|
||||
int version = 0;
|
||||
int last_index = 0;
|
||||
for(int i = 0; i < strlen(buffer); i++) {
|
||||
if(buffer[i] == '.') {
|
||||
for (int i = 0; i < strlen(buffer); i++) {
|
||||
if (buffer[i] == '.') {
|
||||
buffer[i] = '\0';
|
||||
version = version << 8 | atoi(&buffer[last_index]);
|
||||
buffer[i] = '.';
|
||||
@@ -51,16 +55,16 @@ int version() {
|
||||
return version;
|
||||
}
|
||||
|
||||
uint8_t* last_result;
|
||||
struct jpeg_compress_struct cinfo;
|
||||
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||
|
||||
val encode(std::string image_in, int image_width, int image_height, MozJpegOptions opts) {
|
||||
uint8_t* image_buffer = (uint8_t*) image_in.c_str();
|
||||
uint8_t* image_buffer = (uint8_t*)image_in.c_str();
|
||||
|
||||
// The code below is basically the `write_JPEG_file` function from
|
||||
// https://github.com/mozilla/mozjpeg/blob/master/example.c
|
||||
// I just write to memory instead of a file.
|
||||
|
||||
/* Step 1: allocate and initialize JPEG compression object */
|
||||
|
||||
/* This struct contains the JPEG compression parameters and pointers to
|
||||
* working space (which is allocated as needed by the JPEG library).
|
||||
@@ -68,6 +72,7 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
|
||||
* compression/decompression processes, in existence at once. We refer
|
||||
* to any one struct (and its associated working data) as a "JPEG object".
|
||||
*/
|
||||
jpeg_compress_struct cinfo;
|
||||
/* This struct represents a JPEG error handler. It is declared separately
|
||||
* because applications often want to supply a specialized error handler
|
||||
* (see the second half of this file for an example). But here we just
|
||||
@@ -76,15 +81,7 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
|
||||
* Note that this struct must live as long as the main JPEG parameter
|
||||
* struct, to avoid dangling-pointer problems.
|
||||
*/
|
||||
struct jpeg_error_mgr jerr;
|
||||
/* More stuff */
|
||||
JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */
|
||||
int row_stride; /* physical row width in image buffer */
|
||||
uint8_t* output;
|
||||
unsigned long size;
|
||||
|
||||
/* Step 1: allocate and initialize JPEG compression object */
|
||||
|
||||
jpeg_error_mgr jerr;
|
||||
/* We have to set up the error handler first, in case the initialization
|
||||
* step fails. (Unlikely, but it could happen if you are out of memory.)
|
||||
* This routine fills in the contents of struct jerr, and returns jerr's
|
||||
@@ -106,6 +103,8 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
|
||||
// fprintf(stderr, "can't open %s\n", filename);
|
||||
// exit(1);
|
||||
// }
|
||||
uint8_t* output = nullptr;
|
||||
unsigned long size = 0;
|
||||
jpeg_mem_dest(&cinfo, &output, &size);
|
||||
|
||||
/* Step 3: set parameters for compression */
|
||||
@@ -113,17 +112,17 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
|
||||
/* First we supply a description of the input image.
|
||||
* Four fields of the cinfo struct must be filled in:
|
||||
*/
|
||||
cinfo.image_width = image_width; /* image width and height, in pixels */
|
||||
cinfo.image_width = image_width; /* image width and height, in pixels */
|
||||
cinfo.image_height = image_height;
|
||||
cinfo.input_components = 4; /* # of color components per pixel */
|
||||
cinfo.in_color_space = JCS_EXT_RGBA; /* colorspace of input image */
|
||||
cinfo.input_components = 4; /* # of color components per pixel */
|
||||
cinfo.in_color_space = JCS_EXT_RGBA; /* colorspace of input image */
|
||||
/* Now use the library's routine to set default compression parameters.
|
||||
* (You must set at least cinfo.in_color_space before calling this,
|
||||
* since the defaults depend on the source color space.)
|
||||
*/
|
||||
jpeg_set_defaults(&cinfo);
|
||||
|
||||
jpeg_set_colorspace(&cinfo, (J_COLOR_SPACE) opts.color_space);
|
||||
jpeg_set_colorspace(&cinfo, (J_COLOR_SPACE)opts.color_space);
|
||||
|
||||
if (opts.quant_table != -1) {
|
||||
jpeg_c_set_int_param(&cinfo, JINT_BASE_QUANT_TBL_IDX, opts.quant_table);
|
||||
@@ -142,18 +141,19 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
|
||||
jpeg_c_set_bool_param(&cinfo, JBOOLEAN_TRELLIS_EOB_OPT, opts.trellis_opt_zero);
|
||||
jpeg_c_set_bool_param(&cinfo, JBOOLEAN_TRELLIS_Q_OPT, opts.trellis_opt_table);
|
||||
jpeg_c_set_int_param(&cinfo, JINT_TRELLIS_NUM_LOOPS, opts.trellis_loops);
|
||||
jpeg_c_set_int_param(&cinfo, JINT_DC_SCAN_OPT_MODE, 0);
|
||||
|
||||
// A little hacky to build a string for this, but it means we can use set_quality_ratings which
|
||||
// does some useful heuristic stuff.
|
||||
// A little hacky to build a string for this, but it means we can use
|
||||
// set_quality_ratings which does some useful heuristic stuff.
|
||||
std::string quality_str = std::to_string(opts.quality);
|
||||
|
||||
if (opts.separate_chroma_quality && opts.color_space == JCS_YCbCr) {
|
||||
quality_str += "," + std::to_string(opts.chroma_quality);
|
||||
}
|
||||
|
||||
char const *pqual = quality_str.c_str();
|
||||
char const* pqual = quality_str.c_str();
|
||||
|
||||
set_quality_ratings(&cinfo, (char*) pqual, opts.baseline);
|
||||
set_quality_ratings(&cinfo, (char*)pqual, opts.baseline);
|
||||
|
||||
if (!opts.auto_subsample && opts.color_space == JCS_YCbCr) {
|
||||
cinfo.comp_info[0].h_samp_factor = opts.chroma_subsample;
|
||||
@@ -181,54 +181,54 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
|
||||
* To keep things simple, we pass one scanline per call; you can pass
|
||||
* more if you wish, though.
|
||||
*/
|
||||
row_stride = image_width * 4; /* JSAMPLEs per row in image_buffer */
|
||||
int row_stride = image_width * 4; /* JSAMPLEs per row in image_buffer */
|
||||
|
||||
while (cinfo.next_scanline < cinfo.image_height) {
|
||||
/* jpeg_write_scanlines expects an array of pointers to scanlines.
|
||||
* Here the array is only one element long, but you could pass
|
||||
* more than one scanline at a time if that's more convenient.
|
||||
*/
|
||||
row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride];
|
||||
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
|
||||
JSAMPROW row_pointer =
|
||||
&image_buffer[cinfo.next_scanline * row_stride]; /* pointer to JSAMPLE row[s] */
|
||||
(void)jpeg_write_scanlines(&cinfo, &row_pointer, 1);
|
||||
}
|
||||
|
||||
/* Step 6: Finish compression */
|
||||
|
||||
jpeg_finish_compress(&cinfo);
|
||||
|
||||
/* Step 7: release JPEG compression object */
|
||||
|
||||
last_result = output;
|
||||
auto js_result = Uint8Array.new_(typed_memory_view(size, output));
|
||||
|
||||
/* And we're done! */
|
||||
return val(typed_memory_view(size, output));
|
||||
}
|
||||
|
||||
void free_result() {
|
||||
/* This is an important step since it will release a good deal of memory. */
|
||||
jpeg_destroy_compress(&cinfo);
|
||||
free(output);
|
||||
|
||||
/* And we're done! */
|
||||
return js_result;
|
||||
}
|
||||
|
||||
EMSCRIPTEN_BINDINGS(my_module) {
|
||||
value_object<MozJpegOptions>("MozJpegOptions")
|
||||
.field("quality", &MozJpegOptions::quality)
|
||||
.field("baseline", &MozJpegOptions::baseline)
|
||||
.field("arithmetic", &MozJpegOptions::arithmetic)
|
||||
.field("progressive", &MozJpegOptions::progressive)
|
||||
.field("optimize_coding", &MozJpegOptions::optimize_coding)
|
||||
.field("smoothing", &MozJpegOptions::smoothing)
|
||||
.field("color_space", &MozJpegOptions::color_space)
|
||||
.field("quant_table", &MozJpegOptions::quant_table)
|
||||
.field("trellis_multipass", &MozJpegOptions::trellis_multipass)
|
||||
.field("trellis_opt_zero", &MozJpegOptions::trellis_opt_zero)
|
||||
.field("trellis_opt_table", &MozJpegOptions::trellis_opt_table)
|
||||
.field("trellis_loops", &MozJpegOptions::trellis_loops)
|
||||
.field("chroma_subsample", &MozJpegOptions::chroma_subsample)
|
||||
.field("auto_subsample", &MozJpegOptions::auto_subsample)
|
||||
.field("separate_chroma_quality", &MozJpegOptions::separate_chroma_quality)
|
||||
.field("chroma_quality", &MozJpegOptions::chroma_quality)
|
||||
;
|
||||
.field("quality", &MozJpegOptions::quality)
|
||||
.field("baseline", &MozJpegOptions::baseline)
|
||||
.field("arithmetic", &MozJpegOptions::arithmetic)
|
||||
.field("progressive", &MozJpegOptions::progressive)
|
||||
.field("optimize_coding", &MozJpegOptions::optimize_coding)
|
||||
.field("smoothing", &MozJpegOptions::smoothing)
|
||||
.field("color_space", &MozJpegOptions::color_space)
|
||||
.field("quant_table", &MozJpegOptions::quant_table)
|
||||
.field("trellis_multipass", &MozJpegOptions::trellis_multipass)
|
||||
.field("trellis_opt_zero", &MozJpegOptions::trellis_opt_zero)
|
||||
.field("trellis_opt_table", &MozJpegOptions::trellis_opt_table)
|
||||
.field("trellis_loops", &MozJpegOptions::trellis_loops)
|
||||
.field("chroma_subsample", &MozJpegOptions::chroma_subsample)
|
||||
.field("auto_subsample", &MozJpegOptions::auto_subsample)
|
||||
.field("separate_chroma_quality", &MozJpegOptions::separate_chroma_quality)
|
||||
.field("chroma_quality", &MozJpegOptions::chroma_quality);
|
||||
|
||||
function("version", &version);
|
||||
function("encode", &encode);
|
||||
function("free_result", &free_result);
|
||||
}
|
||||
37
codecs/mozjpeg/enc/mozjpeg_enc.d.ts
vendored
Normal file
37
codecs/mozjpeg/enc/mozjpeg_enc.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
export const enum MozJpegColorSpace {
|
||||
GRAYSCALE = 1,
|
||||
RGB,
|
||||
YCbCr,
|
||||
}
|
||||
|
||||
export interface EncodeOptions {
|
||||
quality: number;
|
||||
baseline: boolean;
|
||||
arithmetic: boolean;
|
||||
progressive: boolean;
|
||||
optimize_coding: boolean;
|
||||
smoothing: number;
|
||||
color_space: MozJpegColorSpace;
|
||||
quant_table: number;
|
||||
trellis_multipass: boolean;
|
||||
trellis_opt_zero: boolean;
|
||||
trellis_opt_table: boolean;
|
||||
trellis_loops: number;
|
||||
auto_subsample: boolean;
|
||||
chroma_subsample: number;
|
||||
separate_chroma_quality: boolean;
|
||||
chroma_quality: number;
|
||||
}
|
||||
|
||||
export interface MozJPEGModule extends EmscriptenWasm.Module {
|
||||
encode(
|
||||
data: BufferSource,
|
||||
width: number,
|
||||
height: number,
|
||||
options: EncodeOptions,
|
||||
): Uint8Array;
|
||||
}
|
||||
|
||||
declare var moduleFactory: EmscriptenWasm.ModuleFactory<MozJPEGModule>;
|
||||
|
||||
export default moduleFactory;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user