Compare commits

...

753 Commits

Author SHA1 Message Date
e91e90665e Update dependency css-loader to v3 2020-05-01 16:44:23 +00:00
476268fe19 Merge pull request #748 from GoogleChromeLabs/cleanup 2020-05-01 17:21:37 +01:00
74492af675 Merge branch 'master' into cleanup 2020-05-01 17:08:08 +01:00
bd4179aff2 Merge pull request #751 from GoogleChromeLabs/make-j 2020-05-01 16:48:45 +01:00
27ae47117e Leverage make -j to parallelise C++ builds
We've been running each Make command in a single thread, resulting in fairly slow builds for C++ codecs.

This change instead runs all `make` invocations with `-j` defaulting to number of cores (retrieved via `nproc`).

On my machine Docker uses a VM configured to 4 cores out of 8 available. This change brings total build time for C++ codecs down from 10m28s to 7m5s (~3.5 minutes difference).

Note (1): I've converted imagequant builds to use built-in `make` as well to leverage this parallelisation and future-proof build script.
Note (2): we don't need to do the same for Rust, since Cargo parallelises builds by default.
2020-05-01 16:42:41 +01:00
7da3f07333 Switch to Emscripten upstream
Looks like we've been stuck on Emscripten fastcomp backend, misssing out on all new optimisations between LLVM 6 and LLVM 11 and going via slow asm.js pipeline when building.

This changes Docker images for Emscripten projects to point to emscripten-upstream instead and commits the updated artifacts.
2020-05-01 15:00:10 +01:00
ed666dd381 Merge pull request #749 from GoogleChromeLabs/oxipng-update
Limit OxiPNG levels
2020-04-21 00:21:28 +01:00
6f18f08a8e Disable logging statically in OxiPNG
This was a no-op in Wasm anyway. Now that I've added ability to control logging upstream, let's use it to disable it from compiled unit altogether for a slight win in size and perf.
2020-04-20 13:54:21 +01:00
eae808cb6f Limit max level
With libdeflate, any OxiPNG level above 3 is equivalent to 3, so don't show them anymore.
2020-04-20 13:48:56 +01:00
0ae99c9228 Remove obsolete worker termination
I switched build process to proper ES modules back in #672, so, if the TODO is correct, this is no longer necessary.
2020-04-17 14:41:04 +01:00
ae7782031d Merge pull request #746 from GoogleChromeLabs/fix-oxipng-free
Fix and document allocation shim for OxiPNG
2020-04-16 20:06:46 +01:00
7cd6487a28 Fix and document allocation shim for OxiPNG 2020-04-16 19:34:28 +01:00
f3dfcae3f0 Merge pull request #730 from kripken/closure2
Closure all the things
2020-04-16 11:11:15 +01:00
3f7274a6ac update builds using docker 2020-04-15 13:38:09 -07:00
f5bc715bc0 Merge remote-tracking branch 'upstream/master' into closure2 2020-04-15 13:25:00 -07:00
22b04c159d Merge pull request #689 from GoogleChromeLabs/oxipng
Swap OptiPNG with OxiPNG
2020-04-14 12:45:18 +01:00
92249ac711 Whole new world
Updated to use new libdeflate integration that I implemented upstream in https://github.com/shssoichiro/oxipng/pull/203.
2020-04-09 14:11:04 +01:00
629d64326d Swap OptiPNG with OxiPNG
This makes building simpler and allows us to potentially use multithreading version in the future.

For now points to a custom fork of OxiPNG that enables WebAssembly support, as PR is still pending review.
2020-04-09 14:10:50 +01:00
4621cbcae9 Add encoding/decoding times to console
This intentionally excludes time of loading corresponding modules, and only measures actual processing.

While this is not perfect as it's not integrated in the UI (cc @jakearchibald), it gives at least some way to measure performance of different codecs and their integrations on particular files.
2020-04-09 14:09:27 +01:00
164191d746 Upgrade node-sass (#742)
4.13 is the minimum version that works with Node.js 13.
2020-04-09 08:45:09 +01:00
b22adc9957 Merge pull request #737 from GoogleChromeLabs/fix-process-syntaxerror
Fix SyntaxError for `{}.nextTick`
2020-04-01 17:14:46 +01:00
6b0a675469 Fix SyntaxError for {}.nextTick 2020-04-01 12:09:57 -04:00
d7fb0d9b40 Remove unneeded compile flags from imagequant 2020-02-28 13:03:51 -08:00
309947a08f Merge branch 'master' into closure2 2020-02-27 09:45:46 -08:00
6aeaae6160 Closure all the things 2020-02-27 09:44:28 -08:00
71b3c7dda2 Merge pull request #728 from kripken/closure
Use closure in optipng build, which shrinks the JS to less than half
2020-02-27 18:36:37 +01:00
48c06e86fa Use closure in optpng build, which shrinks the JS to less than half. 2020-02-27 09:16:43 -08:00
1b7d3fa394 1.9.1 2020-02-27 11:37:53 +00:00
650db99818 Package-json update 2020-02-27 11:37:32 +00:00
7638bb795e Merge pull request #727 from GoogleChromeLabs/optipng
optipng build improvements
2020-02-27 12:19:22 +01:00
570e604be0 optipng: switch to bundled zlib and libpng
Benefits:
 - newer versions of the libraries
    - zlib: 1.2.8 -> 1.2.11
	- libpng: 1.6.18beta04 -> 1.6.34
 - much fewer dependencies to install (as libs are already in optipng archive and we don't need napa)
 - much smaller build thanks to customised versions of zlib and libpng containing only APIs necessary for optipng itself: 238950 -> 177359 bytes
 - much faster build thanks to preconfigured libpng and stripped APIs: 2m15s -> 40s
 - much simpler build script: 77 -> 46 lines
2020-02-25 18:45:47 +00:00
a056d1c363 Switch to make to build optipng
Mostly a build config simplification for now, no noticeable changes in time or output size.
2020-02-25 18:20:05 +00:00
fce61c8c89 Switch to emscripten-upstream
Before: 255184 bytes, 2m15s
After: 238270 bytes, 2m6s
2020-02-25 17:14:16 +00:00
d60d0ae47d Update Emscripten (1.39.4) 2020-02-25 16:53:27 +00:00
8bf741ed4e 1.9.0 2019-10-30 13:20:33 +00:00
9f660e5178 add maskable icon (#709)
add maskable icon
2019-10-30 12:25:41 +00:00
ef2318bcc1 support maskable icon
add a new entry to the icons member referring the maskable icon file added in 364a5db
2019-10-30 19:47:45 +09:00
364a5db5d5 add maskable icon file 2019-10-30 19:44:49 +09:00
4a01d0d548 Update dependency sass-loader to v7.3.1 (#685)
Update dependency sass-loader to v7.3.1
2019-08-22 11:40:24 +01:00
4a9c28f89f Update dependency sass-loader to v7.3.1 2019-08-21 16:19:16 +00:00
3aed873467 Update dependency tslint to v5.19.0 (#686)
Update dependency tslint to v5.19.0
2019-08-21 17:15:47 +01:00
2b7f059b8f Update dependency tslint to v5.19.0 2019-08-20 19:54:25 +00:00
33726e9c68 Update dependency husky to v3.0.4 (#683)
Update dependency husky to v3.0.4
2019-08-17 22:35:54 +01:00
3d29f486e7 Update dependency husky to v3.0.4 2019-08-17 13:28:25 +00:00
79e8a26f06 Update dependency readdirp to v3.1.2 (#681)
Update dependency readdirp to v3.1.2
2019-08-14 15:12:06 +01:00
e8efd54766 Update dependency readdirp to v3.1.2 2019-08-14 14:06:24 +00:00
edcc774c16 Update dependency webpack-dev-server to v3.8.0 (#679)
Update dependency webpack-dev-server to v3.8.0
2019-08-10 00:42:52 +01:00
746b33a590 Update dependency webpack-dev-server to v3.8.0 2019-08-09 17:20:25 +00:00
8a264efc67 Update dependency sass-loader to v7.2.0 (#678)
Update dependency sass-loader to v7.2.0
2019-08-09 14:35:29 +01:00
f0af6e97a0 Update dependency sass-loader to v7.2.0 2019-08-09 10:31:33 +00:00
043107c101 Update dependency file-loader to v4.2.0 (#675)
Update dependency file-loader to v4.2.0
2019-08-09 10:22:19 +01:00
e9e3b923e0 Update dependency file-loader to v4.2.0 2019-08-08 12:48:13 +00:00
aea6e91b1d Update dependency husky to v3.0.3 (#677)
Update dependency husky to v3.0.3
2019-08-08 13:46:49 +01:00
9c4717a13d Update dependency husky to v3.0.3 2019-08-08 12:43:05 +00:00
559cabce9e Update dependency @types/node to v10.14.15 (#676)
Update dependency @types/node to v10.14.15
2019-08-08 09:59:35 +01:00
7f6a3de7ca Update dependency @types/node to v10.14.15 2019-08-07 21:33:12 +00:00
f3adc87f52 Update Node.js to v10.16.2 (#674)
Update Node.js to v10.16.2
2019-08-07 14:34:18 +01:00
6499e9f63d Update Node.js to v10.16.2 2019-08-06 22:41:02 +00:00
ac1f104e49 Update dependency style-loader to v1 (#673)
Update dependency style-loader to v1
2019-08-06 18:11:48 +01:00
87f89e6b2f Update dependency style-loader to v1 2019-08-06 10:41:31 +00:00
7f6404d5a8 Delete .gitignore in resize codec 2019-08-05 15:13:40 +01:00
8e857cd393 Use native Wasm+Webpack support for Rust codecs
This delegates loading of Wasm modules to Webpack itself, making wrapper code simpler.

Emscripten-generated modules are still using custom loading glue as they're not compatible with Webpack.
2019-08-05 15:13:40 +01:00
b8f801333d Switch to prebuilt WABT and wasm-pack
Significantly speeds up `npm run build:image` commands (as they don't need to compile anything anymore) and slightly reduces size of Docker images:
 - `squoosh-rotate`: 1.87GB -> 1.84GB
 - `squoosh-resize`: 2.02GB -> 1.85GB
 - `squoosh-hqx`: 2.06GB -> 1.9GB
2019-08-02 17:23:09 +01:00
499956e216 Switch to stable Rust
Nightly is no longer necessary for wee_alloc, so we don't need to rely on unstable versions of Rust anymore.

As a bonus, this reduces size of each Rust-related Docker image by >1 GB:
 - `squoosh-rotate`: 2.94GB -> 1.87GB
 - `squoosh-resize`: 3.09GB -> 2.02GB
 - `squoosh-hqx`: 3.13GB -> 2.06GB
2019-08-02 16:14:44 +01:00
3932ee2c00 Rename resize package (#668)
Rename `resize` package
2019-08-02 15:21:41 +01:00
68177b7590 Rename resize package
Without this, it was creating files in `pkg` prefixed with `squooshresize`, which were ignored by Git.
2019-08-02 14:53:39 +01:00
0a2a4122dc Update build.sh 2019-08-02 12:47:12 +01:00
e6299569d0 Update dependency tslint to v5.18.0 (#633)
Update dependency tslint to v5.18.0
2019-08-01 09:27:35 +01:00
578ad8c291 Update dependency tslint to v5.18.0 2019-07-31 20:16:43 +00:00
eaa294b689 Merge pull request #667 from GoogleChromeLabs/renovate/node-10.x
Update Node.js to v10.16.1
2019-07-31 21:14:35 +01:00
6e97cfb8d5 Update Node.js to v10.16.1 2019-07-31 19:49:00 +00:00
80a68c48b2 Update dependency webpack-dev-server to v3.7.2 (#628)
Update dependency webpack-dev-server to v3.7.2
2019-07-31 15:16:17 +01:00
98865f8141 Update dependency webpack-dev-server to v3.7.2 2019-07-31 13:59:11 +00:00
78da9fd144 Fix build on Windows (#666)
* Use `require` for reading JSON

JSON is natively supported by Node.js, so no point in using a custom helper here.

* Fix build on Windows

Fixes #465.
2019-07-31 14:32:26 +01:00
94c50a989b Update dependency terser-webpack-plugin to v1.4.0 (#665)
Update dependency terser-webpack-plugin to v1.4.0
2019-07-31 14:08:09 +01:00
3e525e767c Update dependency terser-webpack-plugin to v1.4.1 2019-07-31 12:18:23 +00:00
dfcc1e24e4 Update dependency url-loader to v2.1.0 (#656)
Update dependency url-loader to v2.1.0
2019-07-30 19:12:05 +01:00
f3aa8edfca Update dependency url-loader to v2.1.0 2019-07-30 11:00:32 +00:00
ffd7ee6013 Update dependency webpack-bundle-analyzer to v3.4.1 (#664)
Update dependency webpack-bundle-analyzer to v3.4.1
2019-07-30 11:57:30 +01:00
64bb09dbc5 Update dependency webpack-bundle-analyzer to v3.4.1 2019-07-30 06:57:22 +00:00
35fcbc40ed Update dependency husky to v3.0.2 (#663)
Update dependency husky to v3.0.2
2019-07-29 18:35:05 +01:00
1b55a48680 Update dependency husky to v3.0.2 2019-07-29 17:32:53 +00:00
88fbb19d29 Update dependency @types/node to v10.14.13 (#654)
Update dependency @types/node to v10.14.13
2019-07-29 15:35:38 +01:00
3dc1501ff7 Update dependency @types/node to v10.14.13 2019-07-27 13:47:47 +00:00
b7576c559a Update dependency pretty-bytes to v5.3.0 (#662)
Update dependency pretty-bytes to v5.3.0
2019-07-27 14:46:39 +01:00
69ed2e1d56 Update dependency pretty-bytes to v5.3.0 2019-07-26 20:28:22 +00:00
55f7f3d72a Update dependency copy-webpack-plugin to v5.0.4 (#661)
Update dependency copy-webpack-plugin to v5.0.4
2019-07-26 12:05:12 +01:00
055d0b4ea1 Update dependency copy-webpack-plugin to v5.0.4 2019-07-26 10:42:39 +00:00
7735346ed0 Update dependency critters-webpack-plugin to v2.4.0 (#660)
Update dependency critters-webpack-plugin to v2.4.0
2019-07-23 19:47:12 +01:00
2a06fdbbe0 Update dependency critters-webpack-plugin to v2.4.0 2019-07-23 14:37:32 +00:00
19169199e9 Update dependency raw-loader to v3.1.0 (#657)
Update dependency raw-loader to v3.1.0
2019-07-19 12:02:05 +01:00
76f3c39b78 Update dependency raw-loader to v3.1.0 2019-07-18 23:26:24 +00:00
8da52acc4c Update dependency husky to v3.0.1 (#658)
Update dependency husky to v3.0.1
2019-07-19 00:23:39 +01:00
9253522a3a Update dependency husky to v3.0.1 2019-07-18 21:54:45 +00:00
cf39a3e5a5 Update dependency file-loader to v4.1.0 (#655)
Update dependency file-loader to v4.1.0
2019-07-18 22:52:27 +01:00
a08877f0ac Update dependency file-loader to v4.1.0 2019-07-18 11:14:26 +00:00
2f0dc1c067 Update dependency mini-css-extract-plugin to v0.8.0 (#653)
Update dependency mini-css-extract-plugin to v0.8.0
2019-07-17 16:37:17 +01:00
535d8c9142 Update dependency mini-css-extract-plugin to v0.8.0 2019-07-16 20:52:34 +00:00
6dc2ba3bef Update dependency @types/node to v10.14.12 (#646)
Update dependency @types/node to v10.14.12
2019-07-15 15:56:29 +01:00
93cfdc8f98 Update dependency @types/node to v10.14.12 2019-07-14 18:48:32 +00:00
671544349e Merge pull request #652 from GoogleChromeLabs/renovate/script-ext-html-webpack-plugin-2.x
Update dependency script-ext-html-webpack-plugin to v2.1.4
2019-07-14 19:47:18 +01:00
d3c1939692 Update dependency script-ext-html-webpack-plugin to v2.1.4 2019-07-12 20:36:17 +00:00
99642aef96 Update dependency typescript to v3.5.3 (#650)
Update dependency typescript to v3.5.3
2019-07-09 17:56:25 +01:00
ac4942b640 Update dependency typescript to v3.5.3 2019-07-08 22:36:40 +00:00
23cb004a86 Update dependency chokidar to v3.0.2 (#649)
Update dependency chokidar to v3.0.2
2019-07-08 11:49:13 +01:00
4b6de60978 Update dependency chokidar to v3.0.2 2019-07-08 10:33:35 +00:00
de204aa56a Update dependency readdirp to v3.1.1 (#648)
Update dependency readdirp to v3.1.1
2019-07-08 11:31:31 +01:00
976f811b36 Update dependency readdirp to v3.1.1 2019-07-06 23:55:06 +00:00
855fc9e602 Update dependency @types/node to v10.14.10 (#634)
Update dependency @types/node to v10.14.10
2019-07-03 10:34:32 +01:00
a8848e717c Update dependency @types/node to v10.14.10 2019-07-02 15:57:11 +00:00
90b99faf8b Update dependency travis-size-report to v1.1.0 (#625)
Update dependency travis-size-report to v1.1.0
2019-07-02 16:55:37 +01:00
d3cfffbbcf Update dependency travis-size-report to v1.1.0 2019-07-02 14:27:10 +00:00
fade7f9be8 Update dependency url-loader to v2.0.1 (#638)
Update dependency url-loader to v2.0.1
2019-07-02 15:24:31 +01:00
b10dd055d3 Update dependency url-loader to v2.0.1 2019-07-02 09:19:05 +00:00
7532f01222 Update dependency husky to v3 (#645)
Update dependency husky to v3
2019-07-02 12:12:33 +03:00
2df09efdee Update dependency husky to v3 2019-07-01 21:30:38 +00:00
bed4f49a12 Merge pull request #640 from GoogleChromeLabs/renovate/husky-2.x
Update dependency husky to v2.7.0
2019-06-27 18:44:45 +03:00
2b7fefff8b Update dependency husky to v2.7.0 2019-06-27 15:40:39 +00:00
bdcf2519ce Merge pull request #630 from GoogleChromeLabs/the-nittest-of-nits
Fix nit
2019-06-19 14:04:34 +01:00
3f8afb72a6 Fix nit 2019-06-19 14:44:23 +02:00
2f834db224 Quick doc fix 2019-06-19 13:02:59 +01:00
3541ce7492 1.8.1 2019-06-19 12:25:18 +01:00
b6fae0eb4c Hqx fix (#629)
* Optimising wasm so it doesn't break Chrome

* Simpler dockerfile (thanks surma!)
2019-06-19 12:24:24 +01:00
fbaa282f07 Update dependency ts-loader to v6.0.3 (#627)
Update dependency ts-loader to v6.0.3
2019-06-18 12:56:24 +01:00
6136ae7411 Update dependency ts-loader to v6.0.3 2019-06-18 11:30:57 +00:00
f024747299 1.8.0 2019-06-18 12:24:41 +01:00
66feffcc49 Add Hq{2,3,4}x (#624)
* Scaling works on native

* It works in wasm

* Integrate with UI

* Remove benchmark

* Integrate Hqx into Resizer module

* Link against repo for hqx

* Remove unused defaultOpts

* Re-add test file

* Adding size dropdown

* Chrome: go and sit on the naughty step

* Better docs

* Review

* Add link to crbug

* Update src/codecs/processor-worker/index.ts

Co-Authored-By: Jake Archibald <jaffathecake@gmail.com>

* Terminate worker inbetween resize jobs
2019-06-18 12:23:22 +01:00
24254df7db 1.7.0 2019-06-17 09:43:02 +01:00
cae73f1f1b Add share target (#469)
* Quick test

* More testing

* More testing

* Removing transfer for now

* Changing name so it's easier to tell them apart when installed

* Disable minification to ease debugging

* Adding navigate lock

* lol oops

* Add minifying back

* Removing minification again, for debugging

* Removing broadcast channel bits, to simplify the code

* Revert "Removing broadcast channel bits, to simplify the code"

This reverts commit 0b2a3ecf2986aae0dd65fdd1ddda2bd9e4e1eac7.

* I think this fixes it

* Refactor

* Suppress flash of home screen during share target

* Almost ready, so switching to real name

* Removing log

* Ahh yes the trailing comma thing

* Removing use of BroadcastChannel

* Reducing ternary
2019-06-17 09:42:10 +01:00
073a52213e Update dependency ejs to v2.6.2 (#623)
Update dependency ejs to v2.6.2
2019-06-16 11:33:13 +01:00
0d34485a00 Update dependency ejs to v2.6.2 2019-06-15 15:29:04 +00:00
65519d539e Update dependency tslint-config-semistandard to v8.0.1 (#621)
Update dependency tslint-config-semistandard to v8.0.1
2019-06-14 16:37:05 +01:00
ec44a8e817 Update dependency tslint-config-semistandard to v8.0.1 2019-06-14 11:19:50 +00:00
920f225cb0 Update Node.js to v10.16.0 (#602)
Update Node.js to v10.16.0
2019-06-14 12:18:13 +01:00
d5d4bd61ff Update Node.js to v10.16.0 2019-06-13 22:32:04 +00:00
5656d10b67 Update dependency typescript to v3.5.2 (#620)
Update dependency typescript to v3.5.2
2019-06-13 23:30:52 +01:00
adb4b6468b Update dependency typescript to v3.5.2 2019-06-13 17:50:44 +00:00
0a293d7f63 Update dependency webpack-dev-server to v3.7.1 (#607)
Update dependency webpack-dev-server to v3.7.1
2019-06-13 16:23:36 +01:00
27cb5afd5b Update dependency webpack-dev-server to v3.7.1 2019-06-12 09:52:59 +00:00
5e58fc6b04 Update dependency webpack-cli to v3.3.4 (#616)
Update dependency webpack-cli to v3.3.4
2019-06-12 10:49:55 +01:00
e820adfc96 Update dependency webpack-cli to v3.3.4 2019-06-12 09:17:55 +00:00
5a8a114dcb Update dependency husky to v2.4.1 (#618)
Update dependency husky to v2.4.1
2019-06-12 10:15:05 +01:00
a1c685e820 Update dependency husky to v2.4.1 2019-06-12 09:03:46 +00:00
377dcfcc1b Update dependency @webpack-cli/serve to v0.1.8 (#615)
Update dependency @webpack-cli/serve to v0.1.8
2019-06-12 10:01:36 +01:00
913e67ca93 Update dependency @webpack-cli/serve to v0.1.8 2019-06-07 11:40:52 +00:00
fb1a97c7d4 Update dependency readdirp to v3.0.2 (#609)
Update dependency readdirp to v3.0.2
2019-06-06 17:43:12 +02:00
42eef6945d Update dependency readdirp to v3.0.2 2019-06-06 15:32:57 +00:00
d04b08d640 Update dependency chokidar to v3.0.1 (#610)
Update dependency chokidar to v3.0.1
2019-06-06 17:30:35 +02:00
c547dd10d3 Update dependency chokidar to v3.0.1 2019-06-06 15:08:02 +00:00
f4579da9c9 Update dependency husky to v2.4.0 (#614)
Update dependency husky to v2.4.0
2019-06-06 17:05:49 +02:00
37dc585d80 Update dependency husky to v2.4.0 2019-06-06 13:22:43 +00:00
bc0a425a0f Merge pull request #613 from GoogleChromeLabs/renovate/url-loader-2.x
Update dependency url-loader to v2
2019-06-06 15:19:57 +02:00
b696f246a1 Update dependency url-loader to v2 2019-06-06 12:54:19 +00:00
e6e197e140 Merge pull request #612 from GoogleChromeLabs/renovate/file-loader-4.x
Update dependency file-loader to v4
2019-06-06 14:48:13 +02:00
1c0e8a1fd3 Update dependency file-loader to v4 2019-06-06 11:51:55 +00:00
e3e154fa1a Update dependency raw-loader to v3 (#611)
Update dependency raw-loader to v3
2019-06-06 13:46:28 +02:00
73b7c437f9 Update dependency raw-loader to v3 2019-06-05 10:18:17 +00:00
719168be77 Merge pull request #606 from GoogleChromeLabs/renovate/ts-loader-6.x
Update dependency ts-loader to v6.0.2
2019-05-31 08:31:41 +01:00
a2021b175c Update dependency ts-loader to v6.0.2 2019-05-31 04:42:55 +00:00
9a388fbd13 Update dependency tslint to v5.17.0 (#605)
Update dependency tslint to v5.17.0
2019-05-30 22:58:11 +01:00
1ba0452540 Update dependency tslint to v5.17.0 2019-05-30 20:14:45 +00:00
73df9f18f0 Update dependency typescript to v3.5.1 (#603)
Update dependency typescript to v3.5.1
2019-05-29 17:40:23 +01:00
0e7521877b Update dependency typescript to v3.5.1 2019-05-29 16:35:42 +00:00
120b37c192 Merge pull request #601 from GoogleChromeLabs/renovate/mini-css-extract-plugin-0.x
Update dependency mini-css-extract-plugin to v0.7.0
2019-05-27 17:56:42 +01:00
5f3502b838 Update dependency mini-css-extract-plugin to v0.7.0 2019-05-27 16:17:10 +00:00
33f99432c5 Update dependency terser-webpack-plugin to v1.3.0 (#600)
Update dependency terser-webpack-plugin to v1.3.0
2019-05-24 17:00:36 +01:00
85756ff5df Update dependency terser-webpack-plugin to v1.3.0 2019-05-24 13:30:05 +00:00
84e567ad6a Update dependency gzip-size to v5.1.1 (#598)
Update dependency gzip-size to v5.1.1
2019-05-22 10:25:46 +01:00
39281331fa Update dependency gzip-size to v5.1.1 2019-05-21 04:42:37 +00:00
438ce2ce63 Pin dependency travis-size-report to 1.0.1 (#597)
Pin dependency travis-size-report to 1.0.1
2019-05-20 12:43:52 +01:00
a13e17e256 Pin dependency travis-size-report to 1.0.1 2019-05-20 10:31:09 +00:00
cd6db2d776 Using travis-size-report (#596)
* Using travis-size-report

* No maps in size report
2019-05-20 11:29:43 +01:00
a08662b617 Further optimize logo.svg (#584) 2019-05-20 10:57:24 +01:00
003ec9de35 Update dependency ts-loader to v6.0.1 (#595)
Update dependency ts-loader to v6.0.1
2019-05-19 16:45:55 +01:00
e7f76ca0b8 Update dependency ts-loader to v6.0.1 2019-05-19 02:21:11 +00:00
21111e2927 Update dependency @types/node to v10.14.7 (#592)
Update dependency @types/node to v10.14.7
2019-05-17 23:44:21 +01:00
445c3ef32c Update dependency @types/node to v10.14.7 2019-05-17 21:29:24 +00:00
9df5542ee1 Update dependency webpack-dev-server to v3.4.1 (#591)
Update dependency webpack-dev-server to v3.4.1
2019-05-17 18:05:38 +01:00
fffc4a0cd1 Update dependency webpack-dev-server to v3.4.1 2019-05-17 17:00:55 +00:00
50a8743be3 Update dependency node-fetch to v2.6.0 (#589)
Update dependency node-fetch to v2.6.0
2019-05-17 14:54:38 +01:00
8480bc7dbd Update dependency node-fetch to v2.6.0 2019-05-17 13:51:46 +00:00
72e4546922 Update dependency ts-loader to v6 (#582)
Update dependency ts-loader to v6
2019-05-17 14:50:49 +01:00
11be5babca Update dependency ts-loader to v6 2019-05-17 13:36:00 +00:00
17e5db2427 Update dependency webpack-dev-server to v3.4.0 (#590)
Update dependency webpack-dev-server to v3.4.0
2019-05-17 14:34:01 +01:00
465093eb07 Update dependency webpack-dev-server to v3.4.0 2019-05-17 12:46:02 +00:00
b430ac1041 Update dependency terser-webpack-plugin to v1.2.4 (#588)
Update dependency terser-webpack-plugin to v1.2.4
2019-05-15 13:45:55 +01:00
ea96847c1e Update dependency terser-webpack-plugin to v1.2.4 2019-05-15 08:20:25 +00:00
3b5106a61d Update dependency husky to v2.3.0 (#587)
Update dependency husky to v2.3.0
2019-05-14 17:55:04 +01:00
9f611b0b52 Update dependency husky to v2.3.0 2019-05-14 16:47:41 +00:00
18a6b3c3e5 Update dependency husky to v2 (#567)
Update dependency husky to v2
2019-05-05 13:09:06 -07:00
d9ed4e18ea Update dependency husky to v2 2019-05-05 19:59:35 +00:00
9e757aa896 Update dependency chokidar to v3 (#575)
Update dependency chokidar to v3
2019-05-05 12:57:03 -07:00
89b58bb446 Update dependency chokidar to v3 2019-05-05 19:50:09 +00:00
e80ca583cc Update dependency ts-loader to v5.4.5 (#570)
Update dependency ts-loader to v5.4.5
2019-05-05 12:48:15 -07:00
2ecc81b34f Update dependency ts-loader to v5.4.5 2019-05-05 19:37:22 +00:00
60e98ee34f Update dependency readdirp to v3.0.1 (#568)
Update dependency readdirp to v3.0.1
2019-05-05 12:36:14 -07:00
538ea89ea9 Update dependency readdirp to v3.0.1 2019-05-05 19:25:37 +00:00
3990e11e0a Update dependency node-fetch to v2.5.0 (#569)
Update dependency node-fetch to v2.5.0
2019-05-05 12:23:29 -07:00
0251f88fe5 Update dependency node-fetch to v2.5.0 2019-05-05 19:15:45 +00:00
bbcb959b11 Update dependency webpack-dev-server to v3.3.1 (#539)
Update dependency webpack-dev-server to v3.3.1
2019-05-05 12:14:34 -07:00
b5e928bac9 Update dependency webpack-dev-server to v3.3.1 2019-05-05 13:46:57 +00:00
6592dee4a9 Update dependency webpack-cli to v3.3.2 (#578)
Update dependency webpack-cli to v3.3.2
2019-05-05 06:43:42 -07:00
9b3d72191e Update dependency webpack-cli to v3.3.2 2019-05-04 20:21:13 +00:00
a92e5b48ff Update dependency node-sass to v4.12.0 (#572)
Update dependency node-sass to v4.12.0
2019-04-30 20:08:58 +01:00
e355764ab0 Update dependency node-sass to v4.12.0 2019-04-30 09:20:29 +00:00
c5efd5a8bf Update dependency @types/node to v10.14.6 (#571)
Update dependency @types/node to v10.14.6
2019-04-30 10:18:47 +01:00
385461944b Update dependency @types/node to v10.14.6 2019-04-26 19:48:01 +00:00
8385ba3274 Update dependency copy-webpack-plugin to v5.0.3 (#566)
Update dependency copy-webpack-plugin to v5.0.3
2019-04-24 16:24:54 +01:00
6ca6a77595 Update dependency copy-webpack-plugin to v5.0.3 2019-04-24 15:22:25 +00:00
14c837e894 Update dependency webpack-cli to v3.3.1 (#558)
Update dependency webpack-cli to v3.3.1
2019-04-24 15:32:24 +01:00
33346d7cb6 Update dependency webpack-cli to v3.3.1 2019-04-24 10:09:19 +00:00
05d4f531e2 Update dependency pretty-bytes to v5.2.0 (#565)
Update dependency pretty-bytes to v5.2.0
2019-04-24 11:07:25 +01:00
ede2c49b12 Update dependency pretty-bytes to v5.2.0 2019-04-24 03:30:07 +00:00
16acd32c68 Update dependency typescript to v3.4.5 (#562)
Update dependency typescript to v3.4.5
2019-04-23 23:29:37 +01:00
cc90192860 Update dependency typescript to v3.4.5 2019-04-23 22:22:19 +00:00
3607005fa8 Update dependency ts-loader to v5.4.3 (#561)
Update dependency ts-loader to v5.4.3
2019-04-23 23:21:05 +01:00
7646a64f94 Update dependency ts-loader to v5.4.3 2019-04-22 20:40:38 +00:00
c8ce6ce27b Merge pull request #556 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.14.5
2019-04-19 22:18:51 +01:00
1240474c4b Update dependency @types/node to v10.14.5 2019-04-19 20:50:39 +00:00
f5e84441c0 Merge pull request #555 from GoogleChromeLabs/renovate/typescript-3.x
Update dependency typescript to v3.4.4
2019-04-19 12:24:46 +01:00
6bc19d78bc Update dependency typescript to v3.4.4 2019-04-18 23:28:35 +00:00
a4437d2873 Merge pull request #554 from GoogleChromeLabs/renovate/webcomponents-custom-elements-1.x
Update dependency @webcomponents/custom-elements to v1.2.4
2019-04-19 00:26:44 +01:00
cd19650748 Update dependency @webcomponents/custom-elements to v1.2.4 2019-04-18 21:26:08 +00:00
253315b3b1 Merge pull request #552 from GoogleChromeLabs/renovate/readdirp-3.x
Update dependency readdirp to v3
2019-04-17 23:11:50 +01:00
4203ad9a13 Update dependency readdirp to v3 2019-04-17 17:52:20 +00:00
6958202f9d Merge pull request #551 from GoogleChromeLabs/renovate/escape-string-regexp-2.x
Update dependency escape-string-regexp to v2
2019-04-17 12:44:59 +01:00
386fef063f Update dependency escape-string-regexp to v2 2019-04-17 07:51:24 +00:00
d7246ca427 Merge pull request #549 from GoogleChromeLabs/renovate/tslint-5.x
Update dependency tslint to v5.16.0
2019-04-16 23:57:41 +01:00
fd024853b6 Update dependency tslint to v5.16.0 2019-04-16 22:24:34 +00:00
bd53d17876 Merge pull request #548 from GoogleChromeLabs/renovate/webcomponents-custom-elements-1.x
Update dependency @webcomponents/custom-elements to v1.2.3
2019-04-16 08:47:51 +01:00
3f87f571f4 Update dependency @webcomponents/custom-elements to v1.2.3 2019-04-16 04:18:42 +00:00
1c69a6f1b7 Merge pull request #547 from GoogleChromeLabs/renovate/gzip-size-5.x
Update dependency gzip-size to v5.1.0
2019-04-15 10:01:59 +01:00
82419cbb6e Update dependency gzip-size to v5.1.0 2019-04-15 03:27:15 +00:00
db65630c8d Merge pull request #546 from GoogleChromeLabs/renovate/webpack-bundle-analyzer-3.x
Update dependency webpack-bundle-analyzer to v3.3.2
2019-04-12 04:24:49 -04:00
b8e54b947f Update dependency webpack-bundle-analyzer to v3.3.2 2019-04-11 14:33:46 +00:00
f23897108d Merge pull request #545 from GoogleChromeLabs/renovate/webpack-bundle-analyzer-3.x
Update dependency webpack-bundle-analyzer to v3.3.0
2019-04-10 09:31:01 -04:00
1efe5b21f0 Update dependency webpack-bundle-analyzer to v3.3.0 2019-04-10 13:08:07 +00:00
fc71b4d249 Merge pull request #544 from GoogleChromeLabs/renovate/tslint-config-semistandard-8.x
Update dependency tslint-config-semistandard to v8
2019-04-10 09:06:26 -04:00
dc81d46556 Update dependency tslint-config-semistandard to v8 2019-04-10 12:47:55 +00:00
56c2080f43 Merge pull request #543 from GoogleChromeLabs/renovate/mini-css-extract-plugin-0.x
Update dependency mini-css-extract-plugin to v0.6.0
2019-04-10 08:44:19 -04:00
4cc50fcaa5 Update dependency mini-css-extract-plugin to v0.6.0 2019-04-10 10:41:06 +00:00
2d67562576 Merge pull request #542 from GoogleChromeLabs/renovate/typescript-3.x
Update dependency typescript to v3.4.3
2019-04-09 22:57:59 -04:00
76f2d7afa7 Update dependency typescript to v3.4.3 2019-04-09 23:34:01 +00:00
80fa9c4f21 Fixing quote type 2019-04-08 12:35:05 -04:00
8f215a5b4b fix select the same file bug (#538) 2019-04-08 12:33:07 -04:00
bffd9cb52a Merge pull request #536 from GoogleChromeLabs/renovate/webpack-bundle-analyzer-3.x
Update dependency webpack-bundle-analyzer to v3.2.0
2019-04-06 13:21:28 +01:00
74b1ff5b10 Update dependency webpack-bundle-analyzer to v3.2.0 2019-04-06 11:32:43 +00:00
3c0079fea0 Merge pull request #534 from GoogleChromeLabs/renovate/webassembly-js-api-0.x
Update dependency @types/webassembly-js-api to v0.0.3
2019-04-06 12:31:03 +01:00
c0a9723d20 Update dependency @types/webassembly-js-api to v0.0.3 2019-04-06 10:54:58 +00:00
a4f0a76200 Merge pull request #535 from GoogleChromeLabs/renovate/typescript-3.x
Update dependency typescript to v3.4.2
2019-04-06 11:54:14 +01:00
eb57b0130b Update dependency typescript to v3.4.2 2019-04-05 21:16:13 +00:00
f8c37c7abc Merge pull request #528 from GoogleChromeLabs/renovate/tslint-react-4.x
Update dependency tslint-react to v4
2019-04-02 11:06:56 +01:00
72373f8812 Update dependency tslint-react to v4 2019-04-02 09:53:36 +00:00
b285e99e7d Merge pull request #533 from GoogleChromeLabs/renovate/tslint-5.x
Update dependency tslint to v5.15.0
2019-04-02 10:51:06 +01:00
f9a6b88bb6 Update dependency tslint to v5.15.0 2019-04-01 23:03:59 +00:00
4a65d506f2 Merge pull request #529 from GoogleChromeLabs/renovate/webcomponents-custom-elements-1.x
Update dependency @webcomponents/custom-elements to v1.2.2
2019-04-01 16:11:35 +01:00
3bc03c90fd Update dependency @webcomponents/custom-elements to v1.2.2 2019-04-01 14:48:19 +00:00
c35dfa4ac5 Merge pull request #532 from GoogleChromeLabs/renovate/idb-keyval-3.x
Update dependency idb-keyval to v3.2.0
2019-04-01 15:47:14 +01:00
1d2a9a9dde Update dependency idb-keyval to v3.2.0 2019-04-01 13:41:10 +00:00
925220bb13 Merge pull request #531 from GoogleChromeLabs/renovate/typescript-3.x
Update dependency typescript to v3.4.1
2019-03-31 19:21:09 +01:00
16d088bfe3 Update dependency typescript to v3.4.1 2019-03-29 17:49:28 +00:00
b8e22ee435 Merge pull request #527 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.14.4
2019-03-25 23:05:18 +00:00
60dea4b932 Update dependency @types/node to v10.14.4 2019-03-25 20:47:44 +00:00
8ae1a42e4b Merge pull request #525 from GoogleChromeLabs/renovate/chokidar-2.x
Update dependency chokidar to v2.1.5
2019-03-23 10:21:50 +00:00
cfdc7a46e6 Update dependency chokidar to v2.1.5 2019-03-22 21:21:55 +00:00
afb23adcbf Merge pull request #524 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.14.3
2019-03-22 19:24:36 +00:00
3b84a474b8 Update dependency @types/node to v10.14.3 2019-03-22 19:20:48 +00:00
e96bb04e88 Merge pull request #523 from GoogleChromeLabs/renovate/copy-webpack-plugin-5.x
Update dependency copy-webpack-plugin to v5.0.2
2019-03-22 16:34:45 +00:00
2e3b8507b2 Update dependency copy-webpack-plugin to v5.0.2 2019-03-22 15:56:33 +00:00
e12c69f1a6 Merge pull request #522 from GoogleChromeLabs/renovate/chokidar-2.x
Update dependency chokidar to v2.1.4
2019-03-22 10:51:12 +00:00
d049a23469 Update dependency chokidar to v2.1.4 2019-03-22 10:15:07 +00:00
2633f427c8 Merge pull request #521 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.14.2
2019-03-22 00:08:32 +00:00
ff920f1d7b Update dependency @types/node to v10.14.2 2019-03-21 23:02:17 +00:00
fd69560025 Merge pull request #515 from GoogleChromeLabs/renovate/webpack-cli-serve-0.x
Update dependency @webpack-cli/serve to v0.1.5
2019-03-20 18:02:40 +00:00
ba51e47e05 Update dependency @webpack-cli/serve to v0.1.5 2019-03-20 17:56:47 +00:00
409f552274 Merge pull request #519 from GoogleChromeLabs/renovate/typescript-3.x
Update dependency typescript to v3.3.4000
2019-03-20 17:55:12 +00:00
69a7c184bd Update dependency typescript to v3.3.4000 2019-03-20 17:10:39 +00:00
3039c84738 Merge pull request #514 from GoogleChromeLabs/renovate/webpack-cli-3.x
Update dependency webpack-cli to v3.3.0
2019-03-20 17:08:22 +00:00
bfa5cd085d Update dependency webpack-cli to v3.3.0 2019-03-20 10:49:10 +00:00
7c282b30b1 Merge pull request #518 from GoogleChromeLabs/renovate/raw-loader-2.x
Update dependency raw-loader to v2
2019-03-18 15:11:32 +00:00
06fa3c541e Update dependency raw-loader to v2 2019-03-18 13:26:03 +00:00
c9e31ac1f7 Merge pull request #512 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.14.1
2019-03-13 11:38:42 +00:00
e248486d3d Update dependency @types/node to v10.14.1 2019-03-13 09:16:26 +00:00
b32a52d236 Merge pull request #513 from GoogleChromeLabs/renovate/tslint-5.x
Update dependency tslint to v5.14.0
2019-03-13 09:15:28 +00:00
a24b4d6d4d Update dependency tslint to v5.14.0 2019-03-13 04:24:01 +00:00
b831aa0075 1.6.0 2019-03-12 14:10:19 +00:00
bf4d4b78cb Implement sRGB color conversion (#510)
* Add sRGB -> RGB conversion before resize

* Add clamping for color space conversions

* Clip for demultiplication as well

* Fixing linear <-> srgb conversion

* Update benchmark

* Decouple srgb calculations

* Generate lookup tables

* Update src/codecs/resize/options.tsx

* Defaulting on, renaming, removing redundant state
2019-03-12 14:09:35 +00:00
496896e36e Merge pull request #511 from GoogleChromeLabs/renovate/copy-webpack-plugin-5.x
Update dependency copy-webpack-plugin to v5.0.1
2019-03-11 18:22:51 +00:00
6b88ec1f8a Update dependency copy-webpack-plugin to v5.0.1 2019-03-11 13:24:05 +00:00
3af5f3a96d Merge pull request #508 from GoogleChromeLabs/renovate/typed-css-modules-0.x
Update dependency typed-css-modules to v0.4.2
2019-03-09 18:21:29 +00:00
ddc5564515 Update dependency typed-css-modules to v0.4.2 2019-03-08 11:22:51 +00:00
bc5da7ef06 1.5.0 2019-03-08 11:19:34 +00:00
45221c0b03 Implement alpha premultiplication (#507)
* Implement alpha premultiplication

* Add benchmark to resize

* Only display "Premultiply alpha" if it's one of the rust resize types.

* Add comment about division by zero
2019-03-08 11:18:59 +00:00
d29cf2ffa7 Merge pull request #501 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.30
2019-03-06 22:02:52 +00:00
f6c0b89d1f Update dependency @types/node to v10.12.30 2019-03-06 20:14:19 +00:00
ecd9e06665 1.4.0 2019-03-06 17:20:54 +00:00
9e5b66d5f4 Better resize methods (#498)
* Port resize to wasm

* Expose resize algorithms

* Lanczos3 working!

* lol copy paste

* Adding support for other resizers

* Don’t track generated README

* Cache wasm instance
2019-03-06 17:20:25 +00:00
8c35c3cdaa Merge pull request #497 from GoogleChromeLabs/renovate/node-10.x
Update Node.js to v10.15.3
2019-03-05 23:26:23 +00:00
828a6240fe Update Node.js to v10.15.3 2019-03-05 20:51:40 +00:00
eaad0eaee0 1.3.4 2019-03-04 14:53:11 +00:00
db76d4417c Don’t use instantiateStreaming (#494) 2019-03-04 14:50:15 +00:00
7a6c6ec210 Merge pull request #492 from GoogleChromeLabs/renovate/typed-css-modules-0.x
Update dependency typed-css-modules to v0.4.1
2019-03-03 17:22:26 +00:00
8e034f183b Update dependency typed-css-modules to v0.4.1 2019-03-03 15:37:17 +00:00
5a01b34cce Merge pull request #491 from GoogleChromeLabs/renovate/webpack-bundle-analyzer-3.x
Update dependency webpack-bundle-analyzer to v3.1.0
2019-03-03 13:21:08 +00:00
1399a9bffe Update dependency webpack-bundle-analyzer to v3.1.0 2019-03-02 16:47:49 +00:00
653c6ed85a Merge pull request #490 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.29
2019-03-02 16:46:24 +00:00
ebbb7b58cb Update dependency @types/node to v10.12.29 2019-03-02 02:14:38 +00:00
7164e4e315 Merge pull request #489 from GoogleChromeLabs/renovate/tslint-5.x
Update dependency tslint to v5.13.1
2019-03-01 08:54:11 +00:00
23398d07f9 Update dependency tslint to v5.13.1 2019-03-01 03:07:29 +00:00
ec2bc3efa2 Merge pull request #488 from GoogleChromeLabs/renovate/assets-webpack-plugin-3.x
Update dependency assets-webpack-plugin to v3.9.10
2019-02-28 19:06:57 +00:00
86d78763c1 Update dependency assets-webpack-plugin to v3.9.10 2019-02-28 19:01:50 +00:00
fb5ae36d7e Merge pull request #487 from GoogleChromeLabs/renovate/assets-webpack-plugin-3.x
Update dependency assets-webpack-plugin to v3.9.9
2019-02-28 15:40:43 +00:00
51f812625b Update dependency assets-webpack-plugin to v3.9.9 2019-02-28 15:33:56 +00:00
479bfee647 Merge pull request #486 from GoogleChromeLabs/renovate/node-10.x
Update Node.js to v10.15.2
2019-02-28 14:03:11 +00:00
a3501a56cd Update Node.js to v10.15.2 2019-02-28 13:51:15 +00:00
c353e286b0 Merge pull request #485 from GoogleChromeLabs/renovate/assets-webpack-plugin-3.x
Update dependency assets-webpack-plugin to v3.9.8
2019-02-28 09:35:03 +00:00
8ed01e8a87 Update dependency assets-webpack-plugin to v3.9.8 2019-02-28 04:55:19 +00:00
36ed21b9f4 Merge pull request #484 from GoogleChromeLabs/renovate/webpack-dev-server-3.x
Update dependency webpack-dev-server to v3.2.1
2019-02-25 15:03:53 +00:00
cca41bb449 Update dependency webpack-dev-server to v3.2.1 2019-02-25 14:14:58 +00:00
8f787ad0e6 Merge pull request #483 from GoogleChromeLabs/renovate/terser-webpack-plugin-1.x
Update dependency terser-webpack-plugin to v1.2.3
2019-02-25 14:13:23 +00:00
9c1170f100 Update dependency terser-webpack-plugin to v1.2.3 2019-02-25 11:20:37 +00:00
5432be4a3f Merge pull request #482 from GoogleChromeLabs/renovate/tslint-5.x
Update dependency tslint to v5.13.0
2019-02-24 18:54:51 +00:00
7cae821db5 Update dependency tslint to v5.13.0 2019-02-23 22:21:29 +00:00
19ebb24f03 Merge pull request #481 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.27
2019-02-23 08:45:17 +00:00
d07512566e Update dependency @types/node to v10.12.27 2019-02-22 22:27:01 +00:00
61929666f3 Merge pull request #480 from GoogleChromeLabs/renovate/prerender-loader-1.x
Update dependency prerender-loader to v1.3.0
2019-02-22 15:59:25 +00:00
792ffbfcd7 Update dependency prerender-loader to v1.3.0 2019-02-22 15:54:09 +00:00
9685271bb4 Merge pull request #479 from GoogleChromeLabs/renovate/typescript-3.x
Update dependency typescript to v3.3.3333
2019-02-22 15:03:59 +00:00
5b1a6cc95e Update dependency typescript to v3.3.3333 2019-02-22 14:23:45 +00:00
bf34075e6a Update dependency typescript to v3.3.1 (#444)
* Update dependency typescript to v3.3.1

* Fix trailing commas for function calls

* Reverting trailing comma change

* Avoiding trailing comma rule for imports

* I never know what the right thing to do is

* lockfile
2019-02-22 14:22:57 +00:00
f1859eeef2 Only compare against the last 'push' to master (#468) 2019-02-22 11:15:50 +00:00
fa12b37e53 Merge pull request #470 from GoogleChromeLabs/renovate/file-drop-element-0.x
Update dependency file-drop-element to v0.2.0
2019-02-21 23:42:35 +00:00
520a5dc9f2 nggggg - file length === 0 2019-02-21 21:27:59 +00:00
7af949b5a5 Fixing a second whoopsie. 2019-02-21 20:53:14 +00:00
300612b09b Fixing a whoopsie 2019-02-21 20:38:08 +00:00
6f00e9825c Fixing the multifile dep update: file->files 2019-02-21 20:35:49 +00:00
6ca9c5300e Update dependency file-drop-element to v0.2.0 2019-02-21 15:24:22 +00:00
cdeb31051b Merge pull request #464 from GoogleChromeLabs/tiling-rust
Tiling for Rotate
2019-02-21 15:23:32 +00:00
ba90517ad7 Remove baseline benchmark and switch to tile size 16 2019-02-21 15:16:26 +00:00
7aff949f47 Merge pull request #476 from jviide/tiling-rust-02
Fix potential over-the-bounds slicing in rotate.rs introduced in #474
2019-02-21 15:16:26 +00:00
0e8c0da3dd Update the built rotate.wasm file 2019-02-21 15:16:26 +00:00
3132a207e1 Fix potential over-the-bounds slicing in rotate.rs 2019-02-21 15:16:26 +00:00
88dd0e06c5 Merge pull request #474 from jviide/tiling-rust
Remove timing difference between 90° and 270° rotations (in the tiling Rust code)
2019-02-21 15:16:25 +00:00
f507a2464f Update the built rotate.wasm file 2019-02-21 15:16:25 +00:00
14baa6ebf8 Reorganize rotate.rs, separate rotations into their own functions 2019-02-21 15:16:25 +00:00
5d32126565 Use iteration in rotate.rs whenever possible 2019-02-21 15:16:25 +00:00
484ff7ab4c Fix unwrap_hard when debug_assertions is set 2019-02-21 15:16:25 +00:00
36f86385a2 Update benchmark flags 2019-02-21 15:16:24 +00:00
436faa17af More conservative tiling size 2019-02-21 15:16:24 +00:00
d205ae206f Implement 180 and 270 2019-02-21 15:16:24 +00:00
6baa5900fc Implement tiling 2019-02-21 15:16:24 +00:00
fadb53f075 Readd rotation cases 2019-02-21 15:16:24 +00:00
1a63387408 Use a trait to make it nicer 2019-02-21 15:16:23 +00:00
a316120b69 Switch to 8 byte offset 2019-02-21 15:16:23 +00:00
0d1e5ef119 Simplify rotation code to 90deg only 2019-02-21 15:16:23 +00:00
b49cfca39d Scriptify benchmark running 2019-02-21 15:16:23 +00:00
ab58df4c2c Benchmark all rotations 2019-02-21 15:16:22 +00:00
db20f10bd2 Write d8 benchmark using the baseline compiler 2019-02-21 15:16:22 +00:00
444cc5a193 Merge pull request #475 from GoogleChromeLabs/renovate/critters-webpack-plugin-2.x
Update dependency critters-webpack-plugin to v2.3.0
2019-02-21 14:57:58 +00:00
6c253bc9b4 Update dependency critters-webpack-plugin to v2.3.0 2019-02-21 02:46:18 +00:00
2fd28e174e Merge pull request #473 from GoogleChromeLabs/renovate/webpack-dev-server-3.x
Update dependency webpack-dev-server to v3.2.0
2019-02-20 15:03:01 +00:00
a188692c88 Update dependency webpack-dev-server to v3.2.0 2019-02-20 14:41:25 +00:00
b263419e08 Merge pull request #472 from GoogleChromeLabs/renovate/copy-webpack-plugin-5.x
Update dependency copy-webpack-plugin to v5
2019-02-20 14:39:15 +00:00
826e06c727 Update dependency copy-webpack-plugin to v5 2019-02-20 13:22:09 +00:00
dfcdfb105f Merge pull request #471 from GoogleChromeLabs/renovate/worker-plugin-3.x
Update dependency worker-plugin to v3.1.0
2019-02-20 10:46:01 +00:00
0508bbb16f Update dependency worker-plugin to v3.1.0 2019-02-19 16:15:03 +00:00
dfbfa85fd3 Merge pull request #467 from GoogleChromeLabs/renovate/chokidar-2.x
Update dependency chokidar to v2.1.2
2019-02-18 21:03:44 +01:00
b99ad4bdc3 Update dependency chokidar to v2.1.2 2019-02-18 19:59:01 +00:00
e801170496 1.3.3 2019-02-15 09:49:34 +00:00
91e7c9c5ad Make Rust rotate code smaller (#462)
* Make Rust rotate code smaller

* Back on the rust happy path
2019-02-15 09:47:26 +00:00
ca5162ed32 Updating package lock to fix Netlify 2019-02-13 15:08:56 +00:00
0bf87d0c87 Merge pull request #461 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.26
2019-02-13 14:02:00 +00:00
ce91eb5bae Update dependency @types/node to v10.12.26 2019-02-13 00:00:41 +00:00
8d68056bca Merge pull request #457 from GoogleChromeLabs/renovate/chokidar-2.x
Update dependency chokidar to v2.1.1
2019-02-12 13:24:03 +00:00
d0de8e444a Update dependency chokidar to v2.1.1 2019-02-12 12:17:17 +00:00
dfef1f21cc Merge pull request #455 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.25
2019-02-12 12:16:17 +00:00
2440ac4e87 Update dependency @types/node to v10.12.25 2019-02-12 11:09:55 +00:00
e90db78697 Merge pull request #459 from GoogleChromeLabs/renovate/webpack-bundle-analyzer-3.x
Update dependency webpack-bundle-analyzer to v3.0.4
2019-02-12 11:09:08 +00:00
5ae15d429c Update dependency webpack-bundle-analyzer to v3.0.4 2019-02-12 10:54:25 +00:00
89d6b46f3e 1.3.2 2019-02-12 10:03:12 +00:00
e086f64779 Merge pull request #458 from jviide/rust-rotate
Fix buffer offset/size calculations in rotate/processor.ts
2019-02-11 22:42:07 +00:00
9ed3b4f11e Fix buffer size/offset calculations in rotate/processor.ts 2019-02-12 00:12:04 +02:00
ece3fa12b4 Merge pull request #438 from GoogleChromeLabs/rust-rotate
Rotate implementation in Rust
2019-02-11 16:26:01 +00:00
9a35224535 Update wasm build 2019-02-11 16:22:29 +00:00
ef3faa58bc Reuse rotate instance and calculate pages correctly 2019-02-11 16:22:28 +00:00
b6a8f7eeba Rotate implementation in Rust 2019-02-11 16:22:28 +00:00
d1203d9c42 Switching to 1.4x rather than 140% 2019-02-11 13:58:28 +00:00
a834b6ae38 Pin dependencies (#456) 2019-02-11 12:18:07 +00:00
e7982a73ad no one must know I did this, or that it got through review. 2019-02-11 11:34:40 +00:00
717342c80c Adding CI step to compare build size to previous master build. (#450) 2019-02-11 11:12:57 +00:00
075f0e62fd Merge pull request #453 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.23
2019-02-08 11:43:56 +00:00
bcca31fbed Update dependency @types/node to v10.12.23 2019-02-08 02:22:49 +00:00
007891fc11 Merge pull request #413 from GoogleChromeLabs/renovate/loader-utils-1.x
Update dependency loader-utils to v1.2.3
2019-02-06 15:59:07 +00:00
f8e41952d1 Update dependency loader-utils to v1.2.3 2019-02-06 15:53:15 +00:00
e4d64f8a79 Merge pull request #451 from GoogleChromeLabs/renovate/chokidar-2.x
Update dependency chokidar to v2.1.0
2019-02-06 15:52:09 +00:00
1654f69ec1 Update dependency chokidar to v2.1.0 2019-02-05 19:28:54 +00:00
cb16fb5437 Update libwebp to 1.0.2 (#439)
* Update package.json

* Update package.json

* Update README.md

* Update README.md

* Use cmake for libwebp

* Minimize libwebp
2019-02-05 15:45:03 +00:00
36f5fa2c47 Merge pull request #449 from GoogleChromeLabs/renovate/webpack-cli-3.x
Update dependency webpack-cli to v3.2.3
2019-02-05 10:20:37 +00:00
51ad22e72c Update dependency webpack-cli to v3.2.3 2019-02-05 03:22:41 +00:00
1a355c0c16 Merge pull request #448 from GoogleChromeLabs/renovate/terser-webpack-plugin-1.x
Update dependency terser-webpack-plugin to v1.2.2
2019-02-04 15:39:59 +00:00
fe5ba08963 Update dependency terser-webpack-plugin to v1.2.2 2019-02-04 14:46:39 +00:00
7fc994d4af This fixes #446 and sometimes it's best not to ask too many questions. (#447) 2019-02-04 13:34:56 +00:00
a0a8285e02 Merge pull request #445 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.21
2019-02-01 10:08:47 +00:00
da2e35f613 Update dependency @types/node to v10.12.21 2019-02-01 05:41:46 +00:00
09bdc25352 Merge pull request #443 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.20
2019-01-31 10:44:30 +00:00
ad263a9c36 Update dependency @types/node to v10.12.20 2019-01-30 23:41:51 +00:00
c8d8d4e43d Merge pull request #442 from GoogleChromeLabs/renovate/progress-bar-webpack-plugin-1.x
Update dependency progress-bar-webpack-plugin to v1.12.1
2019-01-29 18:11:12 +00:00
94249b8a93 Update dependency progress-bar-webpack-plugin to v1.12.1 2019-01-29 15:49:49 +00:00
edd2c51eb6 Merge pull request #441 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.19
2019-01-29 10:08:35 +00:00
1d24e9399f Update dependency @types/node to v10.12.19 2019-01-29 00:45:56 +00:00
3a0062276d Merge pull request #436 from GoogleChromeLabs/optimize-rotate
Optimize rotate
2019-01-23 22:45:10 -05:00
1993cf3f6c Remove unused bpp 2019-01-23 14:15:39 -05:00
c97aac31c6 Revert "Add rotate user timing"
This reverts commit 887db675c8.
2019-01-23 14:06:24 -05:00
507921cbe8 Use Uint32Array to copy an entire pixel per op 2019-01-23 10:17:52 -05:00
887db675c8 Add rotate user timing 2019-01-23 10:11:35 -05:00
3917618e4e Merge pull request #435 from GoogleChromeLabs/renovate/progress-bar-webpack-plugin-1.x
Update dependency progress-bar-webpack-plugin to v1.12.0
2019-01-22 13:36:30 -05:00
3c42d2e6a4 Update dependency progress-bar-webpack-plugin to v1.12.0 2019-01-22 18:01:07 +00:00
db8777b7f7 Merge pull request #434 from GoogleChromeLabs/renovate/clean-webpack-plugin-1.x
Update dependency clean-webpack-plugin to v1.0.1
2019-01-22 09:04:33 -05:00
18c2cddee2 Update dependency clean-webpack-plugin to v1.0.1 2019-01-22 05:14:58 +00:00
3ff9d3a1fa Merge pull request #432 from GoogleChromeLabs/renovate/critters-webpack-plugin-2.x
Update dependency critters-webpack-plugin to v2.2.0
2019-01-18 14:21:42 -05:00
6503667c78 Update dependency critters-webpack-plugin to v2.2.0 2019-01-18 16:46:25 +00:00
0fa95f84d4 Merge pull request #431 from GoogleChromeLabs/renovate/typescript-3.x
Update dependency typescript to v3.2.4
2019-01-17 19:45:53 -05:00
cf91a90270 Update dependency typescript to v3.2.4 2019-01-17 22:56:11 +00:00
690052f989 Merge pull request #427 from GoogleChromeLabs/renovate/tslint-5.x
Update dependency tslint to v5.12.1
2019-01-10 23:06:29 +00:00
b3e935f7e4 Update dependency tslint to v5.12.1 2019-01-10 22:41:01 +00:00
17314ebd29 Merge pull request #424 from GoogleChromeLabs/renovate/webpack-cli-3.x
Update dependency webpack-cli to v3.2.1
2019-01-10 17:10:54 +00:00
adc437cd51 Update dependency webpack-cli to v3.2.1 2019-01-07 10:23:37 +00:00
0e97b74510 Merge pull request #422 from GoogleChromeLabs/renovate/critters-webpack-plugin-2.x
Update dependency critters-webpack-plugin to v2.1.3
2019-01-07 11:21:36 +01:00
9ffb475cac Update dependency critters-webpack-plugin to v2.1.3 2019-01-05 20:00:02 +00:00
faa2b030c5 Merge pull request #423 from GoogleChromeLabs/renovate/ts-loader-5.x
Update dependency ts-loader to v5.3.3
2019-01-05 19:59:13 +00:00
e3b3b10e2a Update dependency ts-loader to v5.3.3 2019-01-05 19:19:18 +00:00
b569cf268c Merge pull request #415 from GoogleChromeLabs/renovate/critters-webpack-plugin-2.x
Update dependency critters-webpack-plugin to v2.1.2
2019-01-03 19:34:04 +00:00
b154b77556 Update dependency critters-webpack-plugin to v2.1.2 2019-01-03 19:24:19 +00:00
84c0f30a7c Merge pull request #420 from GoogleChromeLabs/renovate/webpack-cli-serve-0.x
Update dependency @webpack-cli/serve to v0.1.3
2019-01-03 19:23:19 +00:00
16463ff76d Update dependency @webpack-cli/serve to v0.1.3 2019-01-03 19:10:09 +00:00
8314e9e24b Merge pull request #421 from GoogleChromeLabs/renovate/webpack-cli-3.x
Update dependency webpack-cli to v3.2.0
2019-01-03 19:08:32 +00:00
a33c557818 Update dependency webpack-cli to v3.2.0 2019-01-03 05:49:28 +00:00
6fbdc65ad0 Merge pull request #418 from GoogleChromeLabs/renovate/husky-1.x
Update dependency husky to v1.3.1
2018-12-28 10:05:10 -05:00
9c9b6c4711 Update dependency husky to v1.3.1 2018-12-28 06:24:00 +00:00
46278d04c3 Merge pull request #414 from GoogleChromeLabs/renovate/terser-webpack-plugin-1.x
Update dependency terser-webpack-plugin to v1.2.1
2018-12-27 07:41:51 -05:00
c1c16508b5 Update dependency terser-webpack-plugin to v1.2.1 2018-12-27 12:35:42 +00:00
ed1b983711 Merge pull request #412 from GoogleChromeLabs/renovate/loader-utils-1.x
Update dependency loader-utils to v1.2.0
2018-12-24 22:04:29 +00:00
ec23e28eda Update dependency loader-utils to v1.2.0 2018-12-24 18:49:01 +00:00
d48b49e8e4 Merge pull request #411 from GoogleChromeLabs/renovate/webpack-dev-server-3.x
Update dependency webpack-dev-server to v3.1.14
2018-12-24 18:48:10 +00:00
14308970c6 Update dependency webpack-dev-server to v3.1.14 2018-12-24 10:09:10 +00:00
38e86e1012 Merge pull request #410 from GoogleChromeLabs/renovate/webpack-dev-server-3.x
Update dependency webpack-dev-server to v3.1.13
2018-12-22 19:52:50 +00:00
e9a33af831 Update dependency webpack-dev-server to v3.1.13 2018-12-22 19:29:27 +00:00
6a63e5dbb2 Merge pull request #409 from GoogleChromeLabs/renovate/terser-webpack-plugin-1.x
Update dependency terser-webpack-plugin to v1.2.0
2018-12-22 16:48:48 +00:00
1e1892a3d5 Update dependency terser-webpack-plugin to v1.2.0 2018-12-22 16:16:11 +00:00
8bff9a2973 Merge pull request #408 from GoogleChromeLabs/renovate/webpack-dev-server-3.x
Update dependency webpack-dev-server to v3.1.12
2018-12-22 16:15:31 +00:00
cbe753dd29 Update dependency webpack-dev-server to v3.1.12 2018-12-22 15:09:41 +00:00
b047845b43 Merge pull request #407 from GoogleChromeLabs/renovate/webpack-dev-server-3.x
Update dependency webpack-dev-server to v3.1.11
2018-12-21 19:17:48 +00:00
1bebc75381 Update dependency webpack-dev-server to v3.1.11 2018-12-21 18:11:16 +00:00
93c46bfc8d Merge pull request #406 from GoogleChromeLabs/renovate/ts-loader-5.x
Update dependency ts-loader to v5.3.2
2018-12-21 10:46:22 +00:00
a3d0f5963e Update dependency ts-loader to v5.3.2 2018-12-21 06:30:17 +00:00
006b82bf05 Merge pull request #404 from GoogleChromeLabs/renovate/file-loader-3.x
Update dependency file-loader to v3
2018-12-20 20:06:12 +00:00
c36e37ac6b Update dependency file-loader to v3 2018-12-20 17:42:21 +00:00
3cf6d7385a Merge pull request #403 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.18
2018-12-19 18:44:47 +00:00
9045b2fa97 Update dependency @types/node to v10.12.18 2018-12-19 18:26:21 +00:00
be6f3b9c6d Merge pull request #402 from GoogleChromeLabs/renovate/webpack-4.x
Update dependency webpack to v4.28.0
2018-12-19 13:00:37 +00:00
5a699b7ce9 Update dependency webpack to v4.28.0 2018-12-19 12:34:47 +00:00
f366a78e87 Merge pull request #400 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.17
2018-12-18 22:32:16 +00:00
c63c7ead51 Update dependency @types/node to v10.12.17 2018-12-18 22:02:40 +00:00
ecfa5902cd Merge pull request #399 from GoogleChromeLabs/renovate/husky-1.x
Update dependency husky to v1.3.0
2018-12-18 20:06:49 +00:00
444027b496 Update dependency husky to v1.3.0 2018-12-18 19:56:39 +00:00
9c5dcb93c7 Merge pull request #398 from GoogleChromeLabs/renovate/tslint-5.x
Update dependency tslint to v5.12.0
2018-12-18 13:12:06 +00:00
9594221271 Update dependency tslint to v5.12.0 2018-12-18 11:48:40 +00:00
01823d3b75 1.3.1 2018-12-18 09:39:59 +00:00
db07a90139 Merge pull request #396 from GoogleChromeLabs/kosamari-patch-2
Update README.md for OptiPNG
2018-12-17 19:15:55 +00:00
962d0928d3 Update README.md
closes #367
updating incorrect URL
2018-12-17 13:43:18 -05:00
e67d50c8e6 Preventing zoom in iOS Safari. (#395) 2018-12-17 17:05:41 +00:00
f9b2f17852 Merge pull request #385 from GoogleChromeLabs/renovate/typescript-3.x
Update dependency typescript to v3.2.2
2018-12-17 12:42:47 +00:00
9746a9f5ed Fix typings for TypeScript v3.2 2018-12-17 12:36:57 +00:00
be0877ecb0 Update dependency typescript to v3.2.2 2018-12-17 12:36:52 +00:00
d2fcdfae43 Debouncing input. Fixes #277 (#394)
* Debouncing input

* Clarifying comment

* More comments and clarifications
2018-12-17 11:54:30 +00:00
2c9eb46941 Merge pull request #393 from GoogleChromeLabs/webp-sharp-fix
Fixing sharp & preprocess settings. Fixes #392.
2018-12-17 10:59:29 +00:00
d30a85fd48 Using use_argb conditionally 2018-12-17 10:21:30 +00:00
9260bed1b1 Fixing sharp & preprocess settings 2018-12-17 10:01:47 +00:00
f6d12985a9 Merge pull request #390 from GoogleChromeLabs/renovate/worker-plugin-3.x
Update dependency worker-plugin to v3
2018-12-14 18:55:31 +00:00
10c9b1db7c Update dependency worker-plugin to v3 2018-12-14 18:10:49 +00:00
4fb17be8de Merge pull request #388 from GoogleChromeLabs/renovate/raw-loader-1.x
Update dependency raw-loader to v1
2018-12-14 18:08:27 +00:00
b592b1a088 Update dependency raw-loader to v1 2018-12-14 15:47:28 +00:00
0544a6507e Merge pull request #386 from GoogleChromeLabs/renovate/webpack-4.x
Update dependency webpack to v4.27.1
2018-12-14 15:45:24 +00:00
1e20ff15ed Update dependency webpack to v4.27.1 2018-12-14 15:28:46 +00:00
04a0ec0645 Merge pull request #383 from GoogleChromeLabs/renovate/tslint-config-airbnb-5.x
Update dependency tslint-config-airbnb to v5.11.1
2018-12-14 15:01:37 +00:00
f355292fe3 Update dependency tslint-config-airbnb to v5.11.1 2018-12-14 13:48:22 +00:00
32e4d813de Merge pull request #382 from GoogleChromeLabs/renovate/ts-loader-5.x
Update dependency ts-loader to v5.3.1
2018-12-14 13:47:40 +00:00
f960f5ea87 Update dependency ts-loader to v5.3.1 2018-12-14 10:18:46 +00:00
aa6f83e2fa Merge pull request #381 from GoogleChromeLabs/renovate/preact-8.x
Update dependency preact to v8.4.2
2018-12-14 10:18:06 +00:00
c09e1f1895 Update dependency preact to v8.4.2 2018-12-14 10:08:17 +00:00
7c311928dd Merge pull request #379 from GoogleChromeLabs/renovate/husky-1.x
Update dependency husky to v1.2.1
2018-12-14 10:07:31 +00:00
5f1c8bcb6b Update dependency husky to v1.2.1 2018-12-14 09:35:57 +00:00
93bc20f014 Merge pull request #378 from GoogleChromeLabs/renovate/critters-webpack-plugin-2.x
Update dependency critters-webpack-plugin to v2.1.1
2018-12-14 09:35:06 +00:00
d29d9571c6 Update dependency critters-webpack-plugin to v2.1.1 2018-12-14 09:28:18 +00:00
3d47dfc820 Merge pull request #375 from GoogleChromeLabs/renovate/webassembly-js-api-0.x
Update dependency @types/webassembly-js-api to v0.0.2
2018-12-14 09:27:04 +00:00
d7846c9add Update dependency @types/webassembly-js-api to v0.0.2 2018-12-14 08:29:39 +00:00
4d6fe9d641 Merge pull request #377 from GoogleChromeLabs/renovate/comlink-3.x
Update dependency comlink to v3.1.1
2018-12-14 08:28:41 +00:00
205feba75d Update dependency comlink to v3.1.1 2018-12-14 00:59:15 +00:00
ca7663b94a Merge pull request #384 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.15
2018-12-14 00:54:30 +00:00
83e45f054b Update dependency @types/node to v10.12.15 2018-12-13 22:44:08 +00:00
783e893a67 Merge pull request #376 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.14
2018-12-13 19:09:00 +00:00
0a941866a9 Update dependency @types/node to v10.12.14 2018-12-13 19:03:04 +00:00
04edfe0085 Merge pull request #380 from GoogleChromeLabs/renovate/mini-css-extract-plugin-0.x
Update dependency mini-css-extract-plugin to v0.5.0
2018-12-13 19:02:16 +00:00
6cae634eca Update dependency mini-css-extract-plugin to v0.5.0 2018-12-13 18:53:39 +00:00
8c7bf278dc Merge pull request #374 from GoogleChromeLabs/renovate/pin-dependencies
Pin dependencies
2018-12-13 13:30:08 +00:00
f6106650b5 Pin dependencies 2018-12-13 13:20:33 +00:00
166e606034 Merge pull request #373 from GoogleChromeLabs/renovate/configure
Configure Renovate
2018-12-13 13:19:16 +00:00
c997e6a3e4 Add renovate.json 2018-12-13 13:13:44 +00:00
2a1b6dc9da 1.3.0 2018-12-12 12:59:05 +00:00
129c33fa12 Add basic history handling (#288) (#309)
* Add basic history handling (#288)

* Move history management to Compress component

* Remove unused pathname property from history

* Rename history listener functions

* Use history.back instead of history.replace

* Support going forward in history. Persist last selected file in runtime

* Add netlify redirects file

* Use 301 status code for redirect

* Cleanup _redirects file

* Use 200 status code for redirects

* Simplify onPopState function

* Always redirect to 301 with url rewrite

* Remove redundant history function

* Remove file check on render. Call openEditor synchronously

* Use pushState only if user is on the initial screen. Mount history listener in constructor

* Simplify openEditor condition

* Update early return condition

* Rolling abstractions back into the main component
2018-12-12 12:58:03 +00:00
3245987113 Prevent both sides sharing a download URL. (#369) 2018-12-12 12:51:06 +00:00
593ad62cbb 1.2.3 2018-12-10 12:25:27 +00:00
a625a76e9e Fixed blank text-fields with dark browser theme (#365)
When using dark browser themes the text-fields' text-color becomes white, so the text in those white background text-fields is unreadable.

Patched text-color so that it now is readable.
2018-12-10 12:24:12 +00:00
c2a305304b Rotation optimise. Fixes #362 (#363)
* Move early exit for no-rotation.

* lol this was meant to be 10 seconds.
2018-12-09 07:11:11 +00:00
7389c507fb 1.2.2 2018-12-04 10:57:07 +00:00
68f0f23016 Prevent image becoming misshapen on resize. Fixes #359. (#360) 2018-12-04 10:55:32 +00:00
dc809dde30 1.2.1 2018-11-30 11:44:33 +00:00
80dfa03b94 Avoid wrapping a single button (#357)
* Avoid wrapping a single button

* Making the zoom controls appear on the bottom, when the controls are positioned on the bottom
2018-11-30 11:44:15 +00:00
fca7a5350d 1.2.0 2018-11-30 11:02:10 +00:00
1b693fb57a Rotate (#322)
* Basic rotate & flip

* Flipping resize when orientation changes

* Hack around critters issue.

* Removing generator. Huge perf boost.

* Stable positioning

* Creating input processors

* Allowing rotation to be changed

* Reverting old change

* Adding tooltips

* No more flip

* Removing need for wrapper element boxing

* Adding comment

* Addressing nits

* Bleh
2018-11-30 11:00:25 +00:00
7723bd3b5f Making processor-worker a real worker (to TypeScript) (#351) 2018-11-29 08:39:48 +00:00
723fc142ec 1.1.0 2018-11-29 08:01:46 +00:00
06d4d946d9 Display uploaded file name in the document title (#244) (#326)
* Add filename to the document.title

* minor fixes

* no-space-before-colon
2018-11-29 07:59:34 +00:00
428b7d976d Create CSS typings before build. Fixes #251. (#350)
* Create CSS typings before build

* Let's try this.

* Adding comment

* Remove hack from travis
2018-11-28 16:09:08 +00:00
32f2b4e573 Remove TypeScript-specific static Compress import (#338)
Previously, Compress had a static import only used by TypeScript, 
as the module was loaded dynamically. The type can be replaced with
`import().default`.

TypeScript 2.9 introduced the ability to use `import()` within type 
statements.
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html#import-types
2018-11-28 14:57:05 +00:00
b3ab983f02 Removing if-env (it used the dreaded event-stream). Fixes 339. (#340)
Also updating node-sass.
2018-11-27 11:53:23 +00:00
e011724af4 Merge pull request #331 from GoogleChromeLabs/fix-windows-build
Fix build on Windows
2018-11-22 11:21:24 +00:00
f11a6cb38a Fix build on Windows
Fixes #282.
2018-11-21 11:18:01 -05:00
adf6d3c60d Preventing form defaults. Fixes #294. (#329) 2018-11-21 07:14:40 +00:00
bb8f35ce09 Merge pull request #323 from GoogleChromeLabs/sass-downgrade
Downgrade node-sass (fixes #319)
2018-11-19 12:22:00 +00:00
ae9ae31ddc Downgrade node-sass (fixes #319) 2018-11-19 12:06:47 +00:00
67893817b5 Update issue templates to include feature request (#318) 2018-11-19 01:26:50 -08:00
f8da5b153d Merge pull request #304 : Create issue templates
Create issue templates
2018-11-19 11:55:40 +09:00
e2a956a088 ask to attach images 2018-11-19 11:51:08 +09:00
5c5b001fc7 Merge pull request #269 from DanielRuf/ci/test-nodejs-6-8-10-11
ci: test Node.js 8, 10 and 11
2018-11-18 13:24:37 +00:00
e4beafed97 ci: do not test on Node.js 6 2018-11-18 14:00:28 +01:00
553a504140 Merge pull request #306 from Jarrku/codec-readme-typo
Fix typo
2018-11-16 11:21:28 -08:00
44dd2ee808 Fix typo 2018-11-15 22:02:11 +01:00
b36c851b2a Create issue templates 2018-11-15 10:34:00 -08:00
0502d70cdf Preventing images from being dragged in Edge (#290) 2018-11-14 14:47:00 -08:00
86546574bb Further losslessly optimize logo.svg (#283) 2018-11-14 14:45:47 -08:00
f351712130 Building on #275 (#289)
* Upgrade devDependcies. Replace UglifyJS ⚰ with TerserJS 👶 Fix TypeScript compiler errors

* Remove babel and associated plugins

* Re-enable strictNullChecks and noImplicitAny

* Use surma's better ga type definition.
`ts-ignore` document.activeElement potential null warnings

* Avoiding ignores
2018-11-14 14:04:01 -08:00
c7f2ae2234 Merge pull request #279 from KraigWalker/bug/manifest-orientation
Fix #268 - change orientation to "any" from "portrait" in manifest.json
2018-11-14 08:25:09 -08:00
436f689115 fixes #268 - change orientation to "any" from "portrait" in manifest.json 2018-11-13 17:34:03 +00:00
951c7af724 Allow text fields next to range inputs be empty (yeah that's horrendous grammar but I'm very tired) (#273) 2018-11-13 07:48:25 -08:00
53b46f879f Avoid "update found" on initial load. 2018-11-13 07:37:07 -08:00
cbe82112ab ci: test Node.js 6, 8, 10 and 11 2018-11-13 11:21:51 +01:00
7f5562ccfe Update README.md 2018-11-12 10:35:58 -08:00
76ec946616 Merge pull request #264 from GoogleChromeLabs/readme-typos
Fix typos 🙈
2018-11-11 19:15:45 -08:00
68bb2edb39 Fix typos 🙈 2018-11-11 17:43:20 -08:00
9c85618aff Merge pull request #263 from GoogleChromeLabs/analytics-privacy
Adding readme, privacy section, reducing resolution of analytics data.
2018-11-11 06:07:52 -08:00
aebeff8b4c Adding readme, privacy section, reducing resolution of analytics data. 2018-11-11 05:11:28 -08:00
8d63125b13 Resetting pinch zoom (#261)
* Resetting pinch zoom

* Bumping version
2018-11-11 04:28:39 -08:00
2ca97ef586 Not entirely sure why this causes dev to fail, but this fixes it. 2018-11-10 16:10:25 -08:00
a1a00f0bfb Preload test (#262)
* Preload test

* Don't prerender analytics

* Version bump
2018-11-10 08:20:13 -08:00
6870b135b7 I'm calling this 1.0 2018-11-09 16:01:24 -08:00
a0f1379feb Adding manifest to headers 2018-11-09 12:08:55 -08:00
9b17322478 Removing old file from serviceworker 2018-11-09 11:11:34 -08:00
f562bad286 Add analytics script (fixes #174) (#245) 2018-11-09 10:53:10 -08:00
6994cc3d15 _headers & _redirects generation (#240)
* Generate `_headers` and `_redirects` by passing assets through ejs templates.

* PR feedback

* Excluding service worker stuff from prerender

* Build SW in dev

* Let's give this a try

* lol

* Is this how it works?
2018-11-09 10:49:01 -08:00
9b572f9541 Ta-da. Back button. (#254) 2018-11-09 09:13:32 -08:00
71f893cb44 Enhanced offline (#249)
* Notification of updates & reloading

* Using version in service worker & allowing version to appear elsewhere

* Stupid file

* Ditching changelog for now. Using package json.

* Ugh.
2018-11-09 09:13:14 -08:00
6b76ea0a6f Update file drop (#253) 2018-11-09 08:53:36 -08:00
7616d33883 Startup optimizations (#226)
* Startup optimisations

* I hate this file

* Inline main script

* Reverting change to do a fairer perf comparison

* Inlining again. Weeeeee!

* Lockfile
2018-11-09 16:01:02 +00:00
3c757bb2b2 Prevent browser pinch-zoom (#247) 2018-11-09 15:58:15 +00:00
a502df80ba Prevent logo taking over on smaller screens. (#250)
* Prevent logo taking over on smaller screens.

* I hate this file
2018-11-09 00:02:23 +00:00
921268ec58 Addressing nits from service worker PR. 2018-11-08 12:11:29 +00:00
7d42d4f973 Add a serviceworker (#234)
* Add a serviceworker

* rename + fix random extra character

* Fixing worker typings

* Fixing types properly this time.

* Once of those rare cases where this matters.

* Naming the things.

* Move registration to the app (so we can use snackbar later)

* Moving SW plugin later so it picks up things like HTML

* MVP service worker

* Two stage-service worker

* Fix prerendering by conditionally awaiting Custom Elements polyfill.

* Fix icon 404's

* add doc comment to autoswplugin

* Fix type
2018-11-08 12:02:05 +00:00
e4e130c5d6 Mark private function as private 2018-11-08 11:21:57 +00:00
bcf7a63118 Android tablet bugs (#246)
* Prevent two-up being lost under options. Fixes #241.

* Working around some glitching when page was scrolled.

* Prevent software keyboard popping up again in Android Chrome.
2018-11-07 08:59:11 +00:00
66aac12db7 Caught a bit of repetition in our utils (#242)
Caught a bit of repetition in our utils
2018-11-06 14:19:48 +00:00
59cd1f8930 Splitting PointerTracker into its own project (#238) 2018-11-06 14:19:24 +00:00
150e704d20 It's a dev package 2018-11-06 13:50:50 +00:00
b2d47f0fb8 fixing a deps issue. 2018-11-06 13:50:49 +00:00
bd3d33296d Updating based on changes to filedrop element. 2018-11-06 13:50:49 +00:00
f4c82ced97 #199 - Removes the file-drop custom element
+ Removes the custom element from the project
+ Replaces it with the externally maintined custom element
2018-11-06 13:50:48 +00:00
76188df0d3 Destructuring args. 2018-11-06 13:47:18 +00:00
9a58e4d339 Fixing lossless slider for webP. Previously you couldn't select "9" :D 2018-11-06 13:47:18 +00:00
f396a5b784 MozJPEG chroma subsampling and quality (#235)
* Adding chroma subsampling for mozjpeg

* Adding separate chroma quality.

* Preact sometimes removes the inline styles, this fixes it.

* Simplifying chroma subsample

* Adding comments
2018-11-06 13:46:52 +00:00
e572b853e2 Snackbar defaults & copy undo (#233)
* Fix snackbar defaults. Fixes #205.

* Undo copy settings across.

* Oops

* Fixing stupid minification bug

* Something weird happened with the last commit
2018-11-06 13:44:15 +00:00
726c2f195a Fixing graphics glitch. Fixes #166 (#232) 2018-11-06 13:41:08 +00:00
4599e51b1e Copy to side ui (#229)
* Copy settings to other side button

* Download button on the outside.

* Whoops
2018-11-06 13:39:03 +00:00
d93169cc5a Mobile ui (#227)
* Basic grid setup

* Fixing thumb on two-up

* Adding margin so you can still access the two-up

* Allow multi-panel to keep one open only

* Edge cases for one-open

* Abstracting results so it can be used as a heading.

* Ordering of items in mobile view. Changing scrolling element.

* Adding labels to collapsed view

* Adding height animation to multi-panel

* Fixing animation bugs

* Expand/collapse icon

* Allow two-up and pinch-zoom to work beneath controls

* Range bubble now behaves properly on mobile

* No longer need this.

* Prevent options overflow at larger widths
2018-11-06 13:37:52 +00:00
bdd3c11f1a Options ui (#222)
* wip

* Commenting stuff to keep the build happy

* Revealing sections

* Custom select elements & more form work

* Range input styles

* Text fields with inputs do the right thing

* Safari & Firefox fixes

* Large compress select

* oops

* MozJPEG options updated

* OptPNG options

* These asserts weren't true

* Generic options

* WebP options

* Hiding "edit" when "original image"

* Download icon

* Copy setting button - still not happy with this

* Progress indicator

* Loading icon enter/exit anim

* Preventing controls going under options

* Ahh so that's what was causing scrolling

* Ahh so that's what was causing outlines

* Simplifying range styles and fixing cross-browser

* Processing custom element styles

* Get precision from step by default

* I don't know how or when this happened.

* Don't need that many steps

* Avoid having an element that covers the pinch zoom

* Preventing overlap with zoom controls

* Prevent ts warning

* Fixing spinner position

* Simplifying FileSize
2018-11-06 13:36:23 +00:00
0cec90c7ca Main ui (#214)
* Class for file drop

* OCD

* We don't need the invalid state, as we'll accept all types.

* Flattening CSS

* Fixing zoom input in Firefox

* Fixing 'container' scaleTo

* two-up closer design match & smaller line

* Fixing edge bug
2018-11-06 13:31:58 +00:00
43def798e1 Two workers & worker termination (#198)
* Refactoring codecs

* Plugging in new processor

* Fixing decorator

* MozJPEG free issue

* Better worker aborting, and terminate workers that aren't used for 10 seconds

* Better comment

* Ooops, half-typed comment

* Uncommenting problematic line

* Surma fixed it!

* Abstracting WASM initialisation

* Better comment

* Don't need this.

* Adding ticket

* noInitalRun

* Reverting MozJPEG issue demo

* Making a const for worker timeout

* Inline docs

* Bail early rather than nesting

* Addressing nits
2018-10-28 09:17:43 +00:00
02b0c022ca Edge encode fix (#211)
* No canvas.toBlob in Edge.

* pffft
2018-10-20 14:50:37 +01:00
c82d0d1b88 Fix for loading SVG in Safari. (#212)
* Fix for loading SVG in Safari.

* Tidier code
2018-10-20 14:50:16 +01:00
e24d7865ce Lazy-loading the main part of the app (#197)
* Splitting main part of app out of the main bundle.

Also improving the transition from intro to compressor.

* Showing error if app fails to load.

* lol these aren't async

* Please don't tell anyone I did this

* Spinner if user selects a file before the app has loaded. (#208)
2018-10-20 12:53:36 +01:00
a79f95b305 Fix <range-input disabled> (#195)
* Fix .disabled property reflection for range-input (only attribute worked previously)

* Revert "Fix .disabled property reflection for range-input (only attribute worked previously)"

This reverts commit f5964635b2.

* Fix reflection

* Use hasAttribute()
2018-10-20 12:51:30 +01:00
49b40b1c3e Remove virtual files before running (fixes #217) (#220) 2018-10-19 12:07:01 +01:00
11ee74e224 Edge gets confused about custom properties in @supports. (#206) 2018-10-14 14:11:20 +01:00
f335246673 Use mozjpeg function to free result (#207) 2018-10-14 14:10:21 +01:00
ccb734aec6 Remove firebase travis deploy (for now) (#196)
* remove firebase (for now)

* Also rm .firebaserc
2018-10-14 09:35:07 +01:00
568b9e9459 Styling intro screen and adding demo images. 2018-10-12 14:12:32 +01:00
a43ea761f5 Missing bind 2018-10-12 14:04:18 +01:00
577c77cc30 Codecs cleanup (#189)
* Update imagequant processor

* Update mozjpeg encoder

* Update optipng encoder

* Update webp decoder

* Update webp encoder

* Remove old codec build tasks

* Add warning about docker image updates
2018-10-12 10:53:33 +01:00
d2f60baef9 Handle vectors (#187)
* Allow loading SVG. Fixes #138.

I also made the resizer vector-aware, so you can resize the image larger & stay sharp.

* Handling SVG without width/height set.

* Simplifying maths

* Doh, case sensitive
2018-10-11 14:15:01 +01:00
64acc08cd7 Improving image open time (#185)
* Moving intro into its own component

* Tidying JSX, and allowing image to render before first compression. Fixes #164.
2018-10-11 14:05:18 +01:00
a1f0b81dff Fixing resize again. Fixes #183. (#184) 2018-10-09 13:34:38 +01:00
48bb58dc89 Moving range input component 2018-10-09 12:19:24 +01:00
765cc213d2 Updating linting rules and fixing bug 2018-10-02 14:56:20 +01:00
37f5c0dd76 Design review fixes (#172)
* Design review fixes

* Adding styles for mozjpeg & fixing some merge errors
2018-10-02 14:53:21 +01:00
b25d1eaf86 <range-input> (#171) 2018-10-02 11:41:07 +01:00
248676aa31 Fixing webp sniffing. Fixes #178. (#179) 2018-10-02 11:30:38 +01:00
Ewa
059c80c05d Center the image canvas in PinchZoom (#170)
* Center the image canvas in PinchZoom

* Fixing pinch zoom
2018-10-01 13:57:26 +01:00
cfd42818b7 Edge file constructor fix (#180)
* Hacking around lack of `new File` in Edge.

* Less hacky solution - preserves types
2018-09-28 14:44:59 +01:00
5e66e0acc4 Adding custom element polyfill (#177) 2018-09-27 14:49:45 +01:00
c9fe5ffbcf Creating fallbacks for all ImageBitmap usage & refactoring. (#175)
Fixes #173
2018-09-27 14:44:54 +01:00
1b630a092f Dockerize mozjpeg (#169)
* Dockerize mozjpeg build process

* Update README
2018-09-26 12:31:26 +01:00
Ewa
09e60284cb Merge pull request #168 from GoogleChromeLabs/devnook-fix-105
Reposition the TwoUp handle on resize
2018-09-18 07:29:21 +02:00
76b34c62db Review code format fixes 2018-09-18 07:26:51 +02:00
9d7212bc1d Review code format fixes 2018-09-17 13:25:33 +02:00
1b69c9231d Keep relative screen division while resizing 2018-09-17 13:21:31 +02:00
bcd88f6356 Add fallback to window.onresize 2018-09-17 11:30:06 +02:00
2a47f67214 Reposition the TwoUp handle on resize 2018-09-17 11:08:54 +02:00
5e8dc1b26c Add multi-panel component (#95)
* add multi-panel component

* make _functions private

* fix spelling errors

* spacing fix

* spelling fix

* store result of _getClosestHeading and avoid calling twice.

* remove returns that are not needed

* move getClosestHeading as separate function

* re-thinking casting and logic

* reflect code review

* do not remove focus when hit spacebar

* add comments and fix type

* handle heading keyevents

* set expanded hight to auto
2018-09-12 14:57:01 +01:00
c591f1f37d Result cache LRU (#165)
* Give the result cache some LRU love

* Fixing LRU cache move-to-start, and simplifying
2018-09-11 17:31:08 +01:00
4db43ccd4e Button to copy settings to the other side 2018-09-06 13:05:17 +01:00
ea5d3c2d78 Adding resize preprocessor (#152)
* Adding resize preprocessor

* Using ! on form

* Haha oops

* Using createImageBitmapPolyfill

* Updating package.json

* Oops again

* Ooops again
2018-09-05 15:46:26 +01:00
700b1f15cd Pinch-zoom: scale around given origin. (#139)
Also setting a min scale.
2018-09-05 09:39:26 +01:00
485ba174e3 Adding result cache. Fixes #87. (#148) 2018-09-05 08:29:17 +01:00
32f6f8b941 Options UI (#135)
* Move gzipped size calculations into a worker and wrap it up in a `<GzipSize />` component that will also handle showing % of original size once that info is plumbed

* A couple tweaks for the app welcome (drop files) screen. We don't have mocks for this one, but this is at least a minor improvement.

* Prettier "pop" effect and styling for the drop zone/indicator.

* Styling for the quantization toggle to make it look like a disclosure triangle/button.

* Add controls bar (zoom in/out/to, background toggle). @todo: extract into its own component.

* When clicking/tapping the image area, give it focus.

* Utilities used by this PR

* Add a `two-up-handle` attribute to the handle for easier styling (classname gets mangled so it doesn't make for a good public API)

* Add a dummy comment to test netlify deploy

* Remove commented-out code.

* Fix styling of vertical split (which as it turns out is slightly different in the mocks anyway)

* Use a composited overlay for the dark background instead of animating background-color

* Move grayscale styling into `<two-up>` by default, then set colors via custom properties

* Remove commented-out svg fill

* Remove dummy comment

* Change `<GzipSize>` to be `<FileSize>`, add `compress` option that lets us show gzipped sizes later if we need. Defaults to `false`, and the gzip worker is only lazily instantiated the first time a compressed size calculation is requested.

* Dependency updates

* Remove color animations from dnd overlay

* Don't use a cyclical import for EncodedImage, instead just specify the types of the properties we Options actually uses.

* Pass source image through to FileSize component so it can compute delta

* Stylize size display with colors based on delta amount/direction

* Remove box-shadow animation.

* Simplify font stack

* Remove commented out code

* Remove gzip compression from size component

* Remove memoization bits

* Use specific flattend props instead of passing large context objects around.

* Remove unused packages.

* Remove unreachable String case in FileSize, and omit redundant File type

* Simplify calculateSize()

* Fix types for FileSize!

* Remove FileSize title

* Make delta variable consistent.

* Skip passing compareTo value for original image

* Remove manual focus

* Fix whitespace

* remove unused keyframes

* remove pointless flex-wrap property

* Remove unused resetZoom() method

* Remove pointless flex properties

* Use `on` prefix for event handling

* Remove pointless justify-self property

* Use an inline SVG for TwoUp's handle icon so it can be colored from outside the component..

* Move orientation state up from `<Output>` into `<App>` and share it with `<Options>`.

* Make the options panels responsive :)

* Show a plus sign for size increases `(+8%)`

* Use inline SVG for the zoom +/- icons, collect SVG icons into one file now that I've verified they get tree-shaken properly.

* Fix top/bottom options panels being reversed

* remove commented out code

* lockfile

* Revert quanitzation toggle styles so it's just a checkbox.

* Remove minimum delta for compare size

* Rename data prop to file.

* scale int -> float

* remove tabIndex

* Remove old icon files

* Add width to options panels

* Add vertical scrolling when options are taller than 80% of the screen height.
2018-09-05 08:21:54 +01:00
54ad30a7ed Optipng (#156)
* omg it’s compiling

* example actually works

* Expose compression level options

* Disable crypto and path module emulation in webpack

* Update README

* Remove small image

* Use -O3 on optipng

* Free memory after copy

* Handle unexpected file reader return types

* Rename level label to effort
2018-09-04 16:49:45 +01:00
170d75482e Merge pull request #155 from sendilkumarn/fix-name-replace
fix broken file renaming for file names with dot
2018-08-29 12:18:33 +01:00
a8db2b30f2 fix broken file renaming for file names with dot
remove grouping in regex
2018-08-29 13:12:33 +02:00
e3b1b08424 Make WebP decoder use memory views (#145)
* Make WebP decoder use memory views

* Update webp_dec README

* Port quantizer to memory views as well
2018-08-21 13:29:53 +01:00
8006a1a5e7 Memory view rather than pointers (#144). Part of #141.
* Returning an object seems to work well

* This doesn't work

* This does!

* Better cast?

* Updating usage in Squoosh
2018-08-21 09:27:04 +01:00
1ae65dd4a1 Mozjpeg opts (#140)
* Switching to embind

* Adding options to mozjpeg wasm

* Updating packages

* Ditching enum - causing more problems than it's worth

* Adding mozjpeg options UI

* Forgot about this enum

* Bools just work
2018-08-17 16:25:28 +01:00
bff515b63f Adding changed points and coalescing to pointer tracker. Fixes #133. (#134)
* Adding changed points and coalescing to pointer tracker. Fixes #133.

* Nits and exposing native pointer
2018-08-15 15:14:33 +01:00
65c3ea826f Avoid preprocessing images that have already been preprocessed. (#125)
* Avoid preprocessing images that have already been preprocessed.

* Using cleanMerge an cleanSet, and fixing bugs in our compression.
2018-08-10 12:59:29 +01:00
602d5140f9 Konami code fix. lol. Thanks @remy. 2018-08-08 14:47:58 +01:00
44f0700332 Adding clean-set (#124)
* Adding clean-set

* Moving to our own cleanSet and cleanMerge.

* Oops, this can be simpler

* Allow the path to be a number

* Better typing
2018-08-07 12:19:06 +01:00
c90db020b0 Snackbar (#99)
* Initial swing

* Finish up <snack-bar> implementation and integrate it

* Add missing types

* Use shift() since we dont care about referential equality

* Use `_` for private fields

* Remove rogue handler

* Remove impossible fallback value

* Make `<snack-bar>` actually contain its children

* will-change for the button ripple

* Guard against mutliple button action clicks

* `onhide()` -> `onremove()`

* remove transitionend

* Replace inline ref callback with linkRef

* showError only accepts strings

* Remove undefined initialization

* Throw on error

* Add missing error type.

* `SnackBar` ▶️ `Snack`

* Avoid child retaining a reference to parent, make show() return a Promise.

* async/await and avoid processing the stack if it is already being processed

* Add a meaningful return value to showSnackbar()
2018-08-06 14:32:48 +01:00
ef4094885e Easter egg (#123)
* lol zx quant

* Adding ZX option

* Improving colour selection so we don't end up with the same colour twice. Also fixing a bug with the colour conflict resolution.

* Putting it behind a konami code

* Better comments

* Adding comment

* Removing unnecessary malloc.
2018-08-06 12:42:23 +01:00
b52d9d9194 Merge pull request #122 from GoogleChromeLabs/quant-ui-fix
Quant fixes
2018-08-06 10:16:58 +01:00
d3f2836f48 Hide quantize options if original image. Fixes #120. 2018-08-02 16:59:13 +01:00
27722f77f9 Simplifying new object creation 2018-08-02 16:56:15 +01:00
3a0db14c40 Minor tweaks 2018-08-02 16:52:57 +01:00
e0dc1b48ec Creating new objects rather than mutating existing objects. Fixes #121. 2018-08-02 16:52:11 +01:00
009327c2c4 Merge pull request #115 from GoogleChromeLabs/imagequant
Implement image quantization via libimagequant
2018-08-01 12:50:08 +01:00
b16d60b52b No name on preprocessors 2018-08-01 12:36:31 +01:00
c550fe9283 Refactor preprocessors module 2018-08-01 12:32:45 +01:00
dce4fc70ac Clean up imagquant codec 2018-08-01 12:19:44 +01:00
b3f3ecbf28 Actually respect numColors lol 2018-07-31 12:46:32 +01:00
e8c0ddfc7f Remove lambda from JSX 2018-07-31 12:41:02 +01:00
a002b376af Hook up options UI to quantizer 2018-07-31 12:32:37 +01:00
2165383da4 Start integrating quantizer in the main data flow 2018-07-30 16:54:30 +01:00
5fbf6b297f Hardcode quantization pass 2018-07-30 16:28:37 +01:00
9d5ad83ff8 Transpile libimagequant 2018-07-30 15:51:57 +01:00
07f17dece2 Adding Travis Support (#113)
* Adds travis script that will build the project whenever the master branch is updated.

The key to upload is in travis env variable.

Note: This does not yet run the test suite, it will deploy if the build is successful.
Note: it has to build twice, because the first build will fail due to a loader issue.
2018-07-30 15:47:00 +01:00
f2f467ecb8 WebP encode options (#110)
* Flailing

* Holy shit struct binding

* Options in the encoder!

* Integrating webp options

* Addressing feedback

* This isn't needed anymore
2018-07-27 14:06:45 +01:00
2ea9e22b52 Merge pull request #91 from GoogleChromeLabs/webp-decoder
WASM WebpDecoder
2018-07-20 11:13:09 +01:00
4ee5572d2f Jake’s thoroughness is doing my head in :P 2018-07-20 11:12:42 +01:00
df7e112d22 Nits by Jake 2018-07-20 10:58:07 +01:00
13ac3ed5b2 Use createImageBitmap as hailmary 2018-07-20 10:56:40 +01:00
b7c223bc0d Remove baseline image decoders, refactor decodeFile 2018-07-20 10:56:40 +01:00
0f08121596 Implement mime type sniffing 2018-07-20 10:56:39 +01:00
b15545402a Adressing smaller review comments 2018-07-20 10:56:39 +01:00
b310c97044 Smaller inline webp image 2018-07-20 10:56:38 +01:00
307c6b05ae Write out logging command 2018-07-20 10:56:38 +01:00
77a6d21924 show decode errors reliably. 2018-07-20 10:56:37 +01:00
d22a343378 Actually move decoding to worker 2018-07-20 10:56:37 +01:00
790a5b580d Set up decoder infrastructure 2018-07-20 10:56:36 +01:00
6e8f8bbe41 Vertical two-up (#100)
* Fixing bad property name.

* Allowing two-up to work vertically at smaller widths.

* Switching to orientation attr

* Fixing type and getter/setter behaviour
2018-07-20 09:32:18 +01:00
cc9d01a9ab Basic webp integration (#103) 2018-07-17 10:37:42 +01:00
526520c399 Adds support for onpaste #97 (#98)
* Adds support for onpaste #97

+ file-drop listens for onpaste, if there is data and it matches the
   type it will use that and raise a custom event
+ Adds a new event on file drop 'onfiledrop'
+ App listens for this event and will map to onFileDrop

* Hoisting getFileData

* The linter seems to think Array.from is of type File, when it's not.

* Remove an entire type of event handler.
+ Removes onfilepaste, joins into 'onfiledrop'
+ Adds 'action' to let you distinguish between the paste or drop
+ Updates app so it just uses the one event.

* Fixing PR issues

+ null return types >>> undefiend.
+ FileDropAction type.
+ remove coercsion on the array types.
2018-07-16 14:00:47 +01:00
acbc31bc35 Merge pull request #96 from GoogleChromeLabs/fix-mjs-errors
Fix errors arising from strict .mjs handling
2018-07-10 10:59:06 -04:00
e8e151a926 Fix errors arising from strict .mjs handling. 2018-07-10 10:57:11 -04:00
835a537c55 Fix lint issues resulting from switching to airbnb (#94)
* Fix lint issues resulting from switching to airbnb.

* Case sensitivity change

* Fix lint script to actually lint tsx files
2018-07-10 14:01:09 +01:00
23ea9fad49 Merge pull request #89 from GoogleChromeLabs/mjs
Switch to .mjs for ES Modules.
2018-07-09 15:45:35 -04:00
491280935a Merge pull request #92 from GoogleChromeLabs/fix-workers
Rename encoding worker so it actually runs in a worker
2018-07-04 15:48:22 +01:00
900eda9a8e Rename encoding worker so it actually runs in a worker 2018-07-04 10:35:16 -04:00
38d0057833 Switch to .mjs for ES Modules. Fixes #88. 2018-07-04 10:02:20 -04:00
3867448aad All the encoders that Chrome/Safari/Firefox support out of the box. (#74)
* All the encoders that Chrome/Safari/Firefox support out of the box.

* Typo
2018-07-02 19:10:10 +01:00
807a76d443 Adding download support. Fixes #47. 2018-07-02 19:04:09 +01:00
3e26a0a3cc Fixing file drop for Safari & Edge (#73) 2018-07-02 18:55:46 +01:00
68729979e3 Adding browser's webp encoder (#72)
* Adding WebP (without feature detect in place)

* Adding WebP check

* Remove unused import
2018-07-02 15:49:52 +01:00
a09ec269b8 Adding native encoders (#71)
* Adding browser png

* Adding native JPEG & file size output

* Removing log

* Fixing blob typing

* Fix timing issue
2018-07-02 15:14:09 +01:00
3f18c927f1 Allow mouse wheel on two-up handle. Fixes #49 (#54) 2018-07-02 09:17:57 +01:00
9add650b75 Refactorings (#65)
* Refactorings

* Responding to feedback
2018-07-01 16:01:42 +01:00
cc3ed168d8 Merge pull request #70 from GoogleChromeLabs/lint-fix
Fixing issues raised by the linter. Fixes #68
2018-06-30 00:25:02 +01:00
3b9b1e9f2e Fixing issues raised by the linter. Fixes #68
+ just cleans up issues, and disables one test that can't be fixed.
+ biggest change is encoders not using multiple imports now.
2018-06-29 21:12:17 +00:00
7c220b1a92 Adding in Drag and Drop support to fix #45 (#56)
* Merging file drop

* Fixing double drop
2018-06-29 16:37:48 +01:00
3035a68b90 Options UI (#39)
* Initial work to add Options config

* Use a single encoder instance and retry up to 10 times on failure.

* Switch both sides to allow encoding from the source image, add options configuration for each.

* Styling for options (and a few tweaks for the app)

* Dep updates.

* Remove commented out code.

* Fix Encoder typing

* Fix lint issues

* Apparently I didnt have tslint autofix enabled on the chromebook

* Attempt to fix layout/panning issues

* Fix missing custom element import!

* Fix variable naming, remove dynamic encoder names, remove retry, allow encoders to return ImageData.

* Refactor state management to use an Array of objects and immutable updates instead of relying on explicit update notifications.

* Add Identity encoder, which is a passthrough encoder that handles the "original" view.

* Drop comlink-loader into the project and add ".worker" to the jpeg encoder filename so it runs in a worker (🦄)

* lint fixes.

* cleanup

* smaller PR feedback fixes

* rename "jpeg" codec to "MozJpeg"

* Formatting fixes for Options

* Colocate codecs and their options UIs in src/codecs, and standardize the namings

* Handle canvas errors

* Throw if quality is undefined, add default quality

* add note about temp styles

* add note about temp styles [2]

* Renaming updateOption

* Clarify option input bindings

* Move updateCanvas() to util and rename to drawBitmapToCanvas

* use generics to pass through encoder options

* Remove unused dependencies

* fix options type

* const

* Use `Array.prototype.some()` for image loading check

* Display encoding errors in the UI.

* I fought typescript and I think I won

* This doesn't need to be optional

* Quality isn't optional

* Simplifying comlink casting

* Splitting counters into loading and displaying

* Still loading if the loading counter isn't equal.
2018-06-29 16:29:18 +01:00
65847c0ed7 Merge pull request #62 from GoogleChromeLabs/linting
Switch to tslint and run it as commit hook
2018-06-26 15:16:42 +01:00
5303afe9ad Fix code lint complaints 2018-06-26 15:11:07 +01:00
579b8a494a Use better exclude option 2018-06-26 15:10:54 +01:00
56faf619d0 Allow leading underscores on variable names 2018-06-26 14:44:31 +01:00
85e3a12c84 Add lint fix script 2018-06-26 14:43:33 +01:00
cab8d3f13c Allow leading underscores in private methods 2018-06-26 14:40:28 +01:00
5c651a1716 Switch to tslint and run it as commit hook 2018-06-26 11:19:44 +01:00
ba0ad81646 Merge pull request #52 from GoogleChromeLabs/codec-fixes
Codec fixes
2018-06-14 13:39:22 +01:00
695bbed12b Update webp to v1.0.0 2018-06-14 13:32:05 +01:00
6a6d478f77 Commit webp decoder binaries 2018-06-14 13:29:11 +01:00
d75a3aca9b Merge pull request #50 from GoogleChromeLabs/webp-dec
Decoder for webp
2018-06-14 13:25:49 +01:00
91945da5ae Add documentation 2018-06-13 23:44:46 +01:00
00e73daabd Decoder for webp 2018-06-13 23:40:24 +01:00
60543dd0a5 Merge pull request #42 from GoogleChromeLabs/commit-binaries
Commit binaries
2018-05-29 16:21:51 +02:00
850a019212 Update README with dependencies 2018-05-29 15:39:46 +02:00
9c0e0b683e Add codec binaries 2018-05-29 15:37:27 +02:00
79dfe39978 Remove superfluous mozjpeg dep 2018-05-23 13:01:53 +00:00
96a61eb0b2 Merge pull request #38 from GoogleChromeLabs/build-fixes
Fix codec integration
2018-05-23 11:46:08 +02:00
e62fc26dfd Properly enforce ArrayBuffers for codec results 2018-05-23 11:09:35 +02:00
638c57b6fe Fix codec integration (builds and runs on chromebook!) 2018-05-23 01:00:48 +00:00
7ff18e6ae1 Merge pull request #35 from GoogleChromeLabs/load-codec
Load mozjpeg codec and encode image
2018-05-22 14:23:10 +02:00
9d8f885556 Remove SharedArrayBuffer as an option 2018-05-21 13:49:26 +01:00
5245c5ca6e Put bitmapToImageData into utils module 2018-05-21 13:46:29 +01:00
19342208d2 Add explanation on infinite loop bug 2018-05-21 13:38:13 +01:00
a9e1c38971 Style nitz 2018-05-21 13:36:05 +01:00
1533728f59 Add types to module initialize func 2018-05-21 13:34:42 +01:00
d4a616713a Simplify webpack config 2018-05-21 13:29:24 +01:00
a7598b6602 Integrating two-up (#34) 2018-05-18 14:52:00 +01:00
e38e7154a6 Disable auto-run just to be safe 2018-05-17 22:33:21 +01:00
7a5c8f5d6b Typings for cwrap API 2018-05-17 22:31:20 +01:00
49db0de05f Actually piping the data through the compressor 2018-05-17 22:27:24 +01:00
8daaea5768 Fixed the freeze bug thing 2018-05-17 16:19:16 +01:00
c2e2a1a0b6 Succesfully load wasm file via webpack 2018-05-17 16:04:56 +01:00
7edb7f0de8 Wrangling TypeScript and webpack to work with Emscripten wasm stuff 2018-05-17 11:24:40 +01:00
634dfe3717 Merge pull request #28 from GoogleChromeLabs/codecs
Basic codec setup
2018-05-15 17:18:29 +01:00
1b4526ca1e Deduplicate example image 2018-05-15 17:14:29 +01:00
5e2c4be0c6 Merge pull request #20 from GoogleChromeLabs/firebase
Add firebase hosting
2018-05-15 11:59:48 -04:00
e9eaf227bc Merge branch 'master' into firebase 2018-05-15 11:59:20 -04:00
6249ca8ac8 Add examples and codec-specific documentation 2018-05-15 16:22:23 +01:00
03a6716745 Generate proper version number for mozjpeg 2018-05-15 15:16:02 +01:00
ddf8409127 Properly split encoder and decoder 2018-05-15 13:23:41 +01:00
bcf71f4702 Using @bind (#29) 2018-05-15 05:06:04 -07:00
31db4b9719 Ignoring TS'd CSS 2018-05-15 11:49:08 +01:00
953a0c9124 Basic codec setup 2018-05-14 13:22:20 +01:00
444e59c69c Merging pinch-zoom (#27)
* Merging pinch-zoom

* Pixelated output
2018-05-04 20:03:57 +01:00
b619427237 Removing everything that isn't skeletonyy (#22)
* Simplifying

* Ignoring CSS defs
2018-05-04 09:20:34 -07:00
5f7f9e32a8 Merge pull request #23 from GoogleChromeLabs/dont-transpile-classes
Don't transpile ES Classes.
2018-05-03 12:04:25 -07:00
1196d4f54f Merge pull request #19 from GoogleChromeLabs/prerendering
Prerendering!
2018-05-03 12:01:30 -07:00
e84d2dc7ee remove redundant PRERENDER define 2018-05-03 12:01:13 -07:00
81aaadbabf Remove all prerendering & critical CSS stuff 2018-05-01 09:52:58 -04:00
311d0524db improve tests 2018-04-24 14:03:44 -04:00
da53b5fedc Add more long-term caching headers, fix missing hash in main.css, switch Workbox to use locally generated files instead of Fastly (improves TTI), delay SW install by 1s. 2018-04-22 00:36:58 -04:00
c5e3f9e737 Remove env preset and decorator plugin 2018-04-18 14:44:43 -04:00
540b3c8154 Merge branch 'master' into prerendering 2018-04-17 21:35:28 -04:00
06642fd047 Merge pull request #18 from GoogleChromeLabs/critters-async-await
Critters: async/await & font handling
2018-04-17 21:33:59 -04:00
3b47ee6fe5 Don't transpile ES Classes. 2018-04-17 21:26:28 -04:00
058cce1d49 Merge pull request #17 from GoogleChromeLabs/babel-fixes
Only use Babel to process .js files.
2018-04-17 17:11:03 -04:00
2078b57dae Merge pull request #12 from GoogleChromeLabs/css-inlining
CSS Inlining
2018-04-17 17:10:43 -04:00
aa02cf2157 Add firebase hosting 2018-04-17 15:34:17 -04:00
11bebfc836 A11y: add aria attribute to give the upload field a name 2018-04-17 14:08:49 -04:00
dec93a724f Fix for Workbox precaching way too many files 2018-04-17 14:08:23 -04:00
411614b731 Output minimal stats to the console during build 2018-04-17 14:07:57 -04:00
896d267de5 Add plugin to make script loading async 2018-04-17 14:07:42 -04:00
e0c59577a4 Lint webpack config, and only preload initial chunks 2018-04-17 14:07:22 -04:00
5936c57a82 Clean up app to remove old prerendering bits 2018-04-17 14:05:50 -04:00
3ba0a5a22a Adds single-pass prerendering via a new prerender-loader 2018-04-17 14:04:55 -04:00
b911e960a8 Merge pull request #1 from GoogleChromeLabs/app-skeleton
App skeleton
2018-04-17 13:46:16 -04:00
718443de30 Only use Babel to process .js files. 2018-04-17 13:42:25 -04:00
256 changed files with 27008 additions and 11346 deletions

View File

@ -1,33 +0,0 @@
{
"presets": [
[
"env",
{
"loose": true,
"uglify": true,
"modules": false,
"targets": {
"browsers": "last 2 versions"
},
"exclude": [
"transform-regenerator",
"transform-es2015-typeof-symbol"
]
}
]
],
"plugins": [
"syntax-dynamic-import",
"transform-decorators-legacy",
"transform-class-properties",
"transform-object-rest-spread",
"transform-react-constant-elements",
"transform-react-remove-prop-types",
[
"transform-react-jsx",
{
"pragma": "h"
}
]
]
}

36
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,36 @@
---
name: Bug report
about: Something is not working as expected
labels:
---
**Before you start**
Please take a look at the [FAQ](https://github.com/GoogleChromeLabs/squoosh/wiki/FAQ) as well as the already opened issues! If nothing fits your problem, go ahead and fill out the following template:
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Version:**
- OS w/ version: [e.g. iOS 12]
- Browser w/ version [e.g. Chrome 70]
- Node version: [e.g. 10.11.0]
- npm version: [e.g. 6.4.1]
**Is your issue related to the quality of image compression?**
Please attach original and output images (you can drag & drop to attach).
- Original image
- Output image from Squoosh
**Additional context, screenshots, screencasts**
Add any other context about the problem here.

View File

@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea for this project
labels:
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Does other service/app have this feature?**
Add any service you know/use that has this feature (We want to know for research)
**Additional context**
Add any other context or screenshots about the feature request here.

5
.gitignore vendored
View File

@ -1,3 +1,6 @@
node_modules
/build
/*.log
/*.log
*.scss.d.ts
*.css.d.ts
*.o

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
10.16.2

4
.travis.yml Normal file
View File

@ -0,0 +1,4 @@
language: node_js
cache: npm
script: npm run build
after_success: npm run sizereport

View File

@ -1,5 +1,31 @@
# Squoosh!
# [Squoosh]!
Squoosh will be an image compression web app that allows you to dive into the
advanced options provided by various image compressors.
[Squoosh] is an image compression web app that allows you to dive into the advanced options provided
by various image compressors.
# 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
kilobyte.
Image compression is handled locally; no additional data is sent to the server.
# Building locally
Clone the repo, and:
```sh
npm install
npm run build
```
You can run the development server with:
```sh
npm start
```
[Squoosh]: https://squoosh.app

18
_headers.ejs Normal file
View File

@ -0,0 +1,18 @@
# 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

2
_redirects.ejs Normal file
View File

@ -0,0 +1,2 @@
/index.html / 301
/* /index.html 301

16
codecs/README.md Normal file
View File

@ -0,0 +1,16 @@
# Codecs
This folder contains a self-contained sub-project for each encoder and decoder that squoosh supplies.
## Build
Each subproject can be built using [Docker](https://www.docker.com/) the following commands:
```
$ npm install
$ npm run build
```
This will build two files: `<codec name>_<enc or dec>.js` and `<codec name>_<enc or dec>.wasm`. It will most likely be necessary to set [`Module["locateFile"]`](https://kripken.github.io/emscripten-site/docs/api_reference/module.html#affecting-execution) to successfully load the `.wasm` file. When the `.js` file is loaded, a global `<codec name>_<enc or dec>` is created with the same API as an [Emscripten `Module`](https://kripken.github.io/emscripten-site/docs/api_reference/module.html).
Each codec will document its API in its README.

BIN
codecs/example.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

BIN
codecs/example.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
codecs/example_palette.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

5
codecs/hqx/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
**/*.rs.bk
target
Cargo.lock
bin/
pkg/README.md

37
codecs/hqx/Cargo.toml Normal file
View 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.2"}
# 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

12
codecs/hqx/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM rust
RUN rustup target add wasm32-unknown-unknown
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
RUN mkdir /opt/binaryen && \
curl -L https://github.com/WebAssembly/binaryen/releases/download/1.38.32/binaryen-1.38.32-x86-linux.tar.gz | tar -xzf - -C /opt/binaryen --strip 1
RUN mkdir /opt/wabt && \
curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.11/wabt-1.0.11-linux.tar.gz | tar -xzf - -C /opt/wabt --strip 1
ENV PATH="/opt/binaryen:/opt/wabt:${PATH}"
WORKDIR /src

25
codecs/hqx/build.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
set -e
echo "============================================="
echo "Compiling wasm"
echo "============================================="
(
wasm-pack build
wasm-strip pkg/squooshhqx_bg.wasm
echo "Optimising Wasm so it doesn't break Chrome (this takes like 10-15mins. get a cup of tea)"
echo "Once https://crbug.com/974804 is fixed, we can remove this step"
wasm-opt -Os --no-validation -o pkg/squooshhqx_bg.wasm pkg/squooshhqx_bg.wasm
rm pkg/.gitignore
)
echo "============================================="
echo "Compiling wasm done"
echo "============================================="
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Did you update your docker image?"
echo "Run \`docker pull ubuntu\`"
echo "Run \`docker pull rust\`"
echo "Run \`docker build -t squoosh-hqx .\`"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

4
codecs/hqx/package-lock.json generated Normal file
View File

@ -0,0 +1,4 @@
{
"name": "hqx",
"lockfileVersion": 1
}

7
codecs/hqx/package.json Normal file
View File

@ -0,0 +1,7 @@
{
"name": "hqx",
"scripts": {
"build:image": "docker build -t squoosh-hqx .",
"build": "docker run --rm -v $(pwd):/src squoosh-hqx ./build.sh"
}
}

View 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"
}

9
codecs/hqx/pkg/squooshhqx.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
/* tslint: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;

View File

@ -0,0 +1,46 @@
import * as wasm from './squooshhqx_bg.wasm';
let cachegetUint32Memory = null;
function getUint32Memory() {
if (cachegetUint32Memory === null || cachegetUint32Memory.buffer !== wasm.memory.buffer) {
cachegetUint32Memory = new Uint32Array(wasm.memory.buffer);
}
return cachegetUint32Memory;
}
let WASM_VECTOR_LEN = 0;
function passArray32ToWasm(arg) {
const ptr = wasm.__wbindgen_malloc(arg.length * 4);
getUint32Memory().set(arg, ptr / 4);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
let cachegetInt32Memory = null;
function getInt32Memory() {
if (cachegetInt32Memory === null || cachegetInt32Memory.buffer !== wasm.memory.buffer) {
cachegetInt32Memory = new Int32Array(wasm.memory.buffer);
}
return cachegetInt32Memory;
}
function getArrayU32FromWasm(ptr, len) {
return getUint32Memory().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) {
const retptr = 8;
const ret = wasm.resize(retptr, passArray32ToWasm(input_image), WASM_VECTOR_LEN, input_width, input_height, factor);
const memi32 = getInt32Memory();
const v0 = getArrayU32FromWasm(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1]).slice();
wasm.__wbindgen_free(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1] * 4);
return v0;
}

5
codecs/hqx/pkg/squooshhqx_bg.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/* tslint:disable */
export const memory: WebAssembly.Memory;
export function __wbindgen_malloc(a: number): number;
export function __wbindgen_free(a: number, b: number): void;
export function resize(a: number, b: number, c: number, d: number, e: number, f: number): void;

Binary file not shown.

55
codecs/hqx/src/lib.rs Normal file
View 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
View 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() {}
}
}

View File

@ -0,0 +1,30 @@
# ImageQuant
- Source: <https://github.com/ImageOptim/libimagequant>
- Version: v2.12.1
## Dependencies
- Docker
## Example
See `example.html`
## API
### `int version()`
Returns the version of libimagequant as a number. va.b.c is encoded as 0x0a0b0c
### `RawImage quantize(std::string buffer, int image_width, int image_height, int numColors, float dithering)`
Quantizes the given images, using at most `numColors`, a value between 2 and 256. `dithering` is a value between 0 and 1 controlling the amount of dithering. `RawImage` is a class with 3 fields: `buffer`, `width`, and `height`.
### `RawImage zx_quantize(std::string buffer, int image_width, int image_height, float dithering)`
???
### `void free_result()`
Frees the result created by `quantize()`.

43
codecs/imagequant/build.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
set -e
export OPTIMIZE="-Os"
export LDFLAGS="${OPTIMIZE}"
export CFLAGS="${OPTIMIZE}"
export CPPFLAGS="${OPTIMIZE}"
echo "============================================="
echo "Compiling libimagequant"
echo "============================================="
(
cd node_modules/libimagequant
emconfigure ./configure --disable-sse
emmake make static -j`nproc`
)
echo "============================================="
echo "Compiling wasm module"
echo "============================================="
(
emcc \
--bind \
${OPTIMIZE} \
--closure 1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s 'EXPORT_NAME="imagequant"' \
-I node_modules/libimagequant \
-o ./imagequant.js \
--std=c++11 \
-x c++ \
imagequant.cpp \
node_modules/libimagequant/libimagequant.a
)
echo "============================================="
echo "Compiling wasm module done"
echo "============================================="
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Did you update your docker image?"
echo "Run \`docker pull trzeci/emscripten-upstream\`"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

View File

@ -0,0 +1,41 @@
<!doctype html>
<style>
canvas {
image-rendering: pixelated;
}
</style>
<script src='imagequant.js'></script>
<script>
const Module = imagequant();
async function loadImage(src) {
// Load image
const img = document.createElement('img');
img.src = src;
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];
// Draw image onto canvas
const ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
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();
const imageData = new ImageData(new Uint8ClampedArray(rawImage.buffer), rawImage.width, rawImage.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);
};
</script>

View File

@ -0,0 +1,245 @@
#include "emscripten/bind.h"
#include "emscripten/val.h"
#include <stdlib.h>
#include <inttypes.h>
#include <limits.h>
#include <math.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);
}
class RawImage {
public:
val buffer;
int width;
int height;
RawImage(val b, int w, int h)
: buffer(b), width(w), height(h) {}
};
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_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);
// 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;
}
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
};
}
const liq_color zx_colors[] = {
{.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.
*/
RawImage zx_quantize(std::string rawimage, int image_width, int image_height, float dithering) {
const uint8_t* image_buffer = (uint8_t*) 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);
// For each 8x8 grid
for (int block_start_y = 0; block_start_y < image_height; block_start_y += 8) {
for (int block_start_x = 0; block_start_x < image_width; block_start_x += 8) {
int color_popularity[15] = {0};
int block_index = 0;
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 (block_start_y + block_height > image_height) {
block_height = image_height - block_start_y;
}
if (block_start_x + block_width > image_width) {
block_width = image_width - block_start_x;
}
// 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 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];
// 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);
if (distance < smallest_distance) {
winning_index = color_index;
smallest_distance = distance;
}
}
color_popularity[winning_index]++;
}
}
// Get the three most popular colours for the block.
int first_color_index = 0;
int second_color_index = 0;
int third_color_index = 0;
int highest_popularity = -1;
int second_highest_popularity = -1;
int third_highest_popularity = -1;
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:
third_color_index = second_color_index;
third_highest_popularity = second_highest_popularity;
second_color_index = first_color_index;
second_highest_popularity = highest_popularity;
first_color_index = color_index;
highest_popularity = color_popularity[color_index];
} else if (color_popularity[color_index] > second_highest_popularity) {
third_color_index = second_color_index;
third_highest_popularity = second_highest_popularity;
second_color_index = color_index;
second_highest_popularity = color_popularity[color_index];
} else if (color_popularity[color_index] > third_highest_popularity) {
third_color_index = color_index;
third_highest_popularity = color_popularity[color_index];
}
}
// 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) {
if (first_color_index >= 8 && second_color_index < 8) {
// Make the second color bright
second_color_index = second_color_index + 7;
} else if (first_color_index < 8 && second_color_index >= 8) {
// Make the second color regular
second_color_index = second_color_index - 7;
}
}
// 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;
}
// 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);
// 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;
}
}
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);
}
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);
}

15
codecs/imagequant/imagequant.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
interface RawImage {
buffer: Uint8Array;
width: number;
height: number;
}
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;

View File

@ -0,0 +1,81 @@
var imagequant = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(imagequant) {
imagequant = imagequant || {};
var e;e||(e=typeof imagequant !== 'undefined' ? imagequant : {});var r={},t;for(t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);var aa=!1,z=!1,ba=!1,ca=!1;aa="object"===typeof window;z="function"===typeof importScripts;ba="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ca=!aa&&!ba&&!z;var A="",da,B,ea,ha;
if(ba)A=z?require("path").dirname(A)+"/":__dirname+"/",da=function(a,b){ea||(ea=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);return ea.readFileSync(a,b?null:"utf8")},B=function(a){a=da(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||C("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",C),e.inspect=function(){return"[Emscripten Module object]"};
else if(ca)"undefined"!=typeof read&&(da=function(a){return read(a)}),B=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||C("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(aa||z)z?A=self.location.href:document.currentScript&&(A=document.currentScript.src),_scriptDir&&
(A=_scriptDir),0!==A.indexOf("blob:")?A=A.substr(0,A.lastIndexOf("/")+1):A="",da=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},z&&(B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ia=e.print||console.log.bind(console),E=e.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(e[t]=r[t]);r=null;var F;e.wasmBinary&&(F=e.wasmBinary);var noExitRuntime;
e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);"object"!==typeof WebAssembly&&E("no native wasm support detected");var G,ja=new WebAssembly.Table({initial:49,maximum:49,element:"anyfunc"}),ka=!1,la="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
function ma(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&la)return la.decode(a.subarray(b,c));for(d="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var n=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|n:(f&7)<<18|g<<12|n<<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 na(a,b,c){var d=H;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 n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&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="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
function pa(a){var b;for(b=a>>1;I[b];)++b;b<<=1;if(32<b-a&&oa)return oa.decode(H.subarray(a,b));b=0;for(var c="";;){var d=I[a+2*b>>1];if(0==d)return c;++b;c+=String.fromCharCode(d)}}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)I[b>>1]=a.charCodeAt(f),b+=2;I[b>>1]=0;return b-d}function ra(a){return 2*a.length}
function sa(a){for(var b=0,c="";;){var d=J[a+4*b>>2];if(0==d)return c;++b;65536<=d?(d-=65536,c+=String.fromCharCode(55296|d>>10,56320|d&1023)):c+=String.fromCharCode(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 n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}J[b>>2]=g;b+=4;if(b+4>c)break}J[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 K,va,H,I,wa,J,L,xa,ya;function za(a){K=a;e.HEAP8=va=new Int8Array(a);e.HEAP16=I=new Int16Array(a);e.HEAP32=J=new Int32Array(a);e.HEAPU8=H=new Uint8Array(a);e.HEAPU16=wa=new Uint16Array(a);e.HEAPU32=L=new Uint32Array(a);e.HEAPF32=xa=new Float32Array(a);e.HEAPF64=ya=new Float64Array(a)}var Aa=e.INITIAL_MEMORY||16777216;e.wasmMemory?G=e.wasmMemory:G=new WebAssembly.Memory({initial:Aa/65536});
G&&(K=G.buffer);Aa=K.byteLength;za(K);J[1660]=5249680;function Ba(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b();else{var c=b.ra;"number"===typeof c?void 0===b.ia?e.dynCall_v(c):e.dynCall_vi(c,b.ia):c(void 0===b.ia?null:b.ia)}}}var Ca=[],Da=[],Ea=[],Fa=[];function Ga(){var a=e.preRun.shift();Ca.unshift(a)}var M=0,Ha=null,N=null;e.preloadedImages={};e.preloadedAudios={};
function C(a){if(e.onAbort)e.onAbort(a);ia(a);E(a);ka=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ia(){var a=O;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var O="imagequant.wasm";if(!Ia()){var Ja=O;O=e.locateFile?e.locateFile(Ja,A):A+Ja}
function Ka(){try{if(F)return new Uint8Array(F);if(B)return B(O);throw"both async and sync fetching of the wasm failed";}catch(a){C(a)}}function La(){return F||!aa&&!z||"function"!==typeof fetch?new Promise(function(a){a(Ka())}):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 Ka()})}Da.push({ra:function(){Ma()}});
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 P(a){for(var b="";H[a];)b+=Oa[H[a++]];return b}var Q={},R={},Pa={};function Qa(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 Ra(a,b){a=Qa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Sa(a){var b=Error,c=Ra(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 Ta=void 0;function S(a){throw new Ta(a);}var Ua=void 0;function Va(a){throw new Ua(a);}function Wa(a,b,c){function d(h){h=c(h);h.length!==a.length&&Va("Mismatched type converter count");for(var k=0;k<a.length;++k)T(a[k],h[k])}a.forEach(function(h){Pa[h]=b});var f=Array(b.length),g=[],n=0;b.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];++n;n===g.length&&d(f)}))});0===g.length&&d(f)}
function T(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(R.hasOwnProperty(a)){if(c.ua)return;S("Cannot register type '"+d+"' twice")}R[a]=b;delete Pa[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}function Xa(a){return{count:a.count,da:a.da,ea:a.ea,T:a.T,V:a.V,W:a.W,X:a.X}}
function Ya(a){S(a.S.V.U.name+" instance already deleted")}var Za=!1;function $a(){}function ab(a){--a.count.value;0===a.count.value&&(a.W?a.X.ba(a.W):a.V.U.ba(a.T))}function bb(a){if("undefined"===typeof FinalizationGroup)return bb=function(b){return b},a;Za=new FinalizationGroup(function(b){for(var c=b.next();!c.done;c=b.next())c=c.value,c.T?ab(c):console.warn("object already deleted: "+c.T)});bb=function(b){Za.register(b,b.S,b.S);return b};$a=function(b){Za.unregister(b.S)};return bb(a)}
var cb=void 0,db=[];function eb(){for(;db.length;){var a=db.pop();a.S.da=!1;a["delete"]()}}function U(){}var fb={};function gb(a,b){var c=e;if(void 0===c[a].Z){var d=c[a];c[a]=function(){c[a].Z.hasOwnProperty(arguments.length)||S("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].Z+")!");return c[a].Z[arguments.length].apply(this,arguments)};c[a].Z=[];c[a].Z[d.oa]=d}}
function hb(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].Z&&void 0!==e[a].Z[c])&&S("Cannot register public name '"+a+"' twice"),gb(a,a),e.hasOwnProperty(c)&&S("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].Z[c]=b):(e[a]=b,void 0!==c&&(e[a].Aa=c))}function ib(a,b,c,d,f,g,n,h){this.name=a;this.constructor=b;this.aa=c;this.ba=d;this.Y=f;this.sa=g;this.fa=n;this.qa=h}
function jb(a,b,c){for(;b!==c;)b.fa||S("Expected null or instance of "+c.name+", got an instance of "+b.name),a=b.fa(a),b=b.Y;return a}function kb(a,b){if(null===b)return this.ja&&S("null is not a valid "+this.name),0;b.S||S('Cannot pass "'+V(b)+'" as a '+this.name);b.S.T||S("Cannot pass deleted object as a pointer of type "+this.name);return jb(b.S.T,b.S.V.U,this.U)}
function lb(a,b){if(null===b){this.ja&&S("null is not a valid "+this.name);if(this.ha){var c=this.wa();null!==a&&a.push(this.ba,c);return c}return 0}b.S||S('Cannot pass "'+V(b)+'" as a '+this.name);b.S.T||S("Cannot pass deleted object as a pointer of type "+this.name);!this.ga&&b.S.V.ga&&S("Cannot convert argument of type "+(b.S.X?b.S.X.name:b.S.V.name)+" to parameter type "+this.name);c=jb(b.S.T,b.S.V.U,this.U);if(this.ha)switch(void 0===b.S.W&&S("Passing raw pointer to smart pointer is illegal"),
this.ya){case 0:b.S.X===this?c=b.S.W:S("Cannot convert argument of type "+(b.S.X?b.S.X.name:b.S.V.name)+" to parameter type "+this.name);break;case 1:c=b.S.W;break;case 2:if(b.S.X===this)c=b.S.W;else{var d=b.clone();c=this.xa(c,mb(function(){d["delete"]()}));null!==a&&a.push(this.ba,c)}break;default:S("Unsupporting sharing policy")}return c}
function nb(a,b){if(null===b)return this.ja&&S("null is not a valid "+this.name),0;b.S||S('Cannot pass "'+V(b)+'" as a '+this.name);b.S.T||S("Cannot pass deleted object as a pointer of type "+this.name);b.S.V.ga&&S("Cannot convert argument of type "+b.S.V.name+" to parameter type "+this.name);return jb(b.S.T,b.S.V.U,this.U)}function ob(a){return this.fromWireType(L[a>>2])}function qb(a,b,c){if(b===c)return a;if(void 0===c.Y)return null;a=qb(a,b,c.Y);return null===a?null:c.qa(a)}var rb={};
function sb(a,b){for(void 0===b&&S("ptr should not be undefined");a.Y;)b=a.fa(b),a=a.Y;return rb[b]}function tb(a,b){b.V&&b.T||Va("makeClassHandle requires ptr and ptrType");!!b.X!==!!b.W&&Va("Both smartPtrType and smartPtr must be specified");b.count={value:1};return bb(Object.create(a,{S:{value:b}}))}
function W(a,b,c,d){this.name=a;this.U=b;this.ja=c;this.ga=d;this.ha=!1;this.ba=this.xa=this.wa=this.na=this.ya=this.va=void 0;void 0!==b.Y?this.toWireType=lb:(this.toWireType=d?kb:nb,this.$=null)}function ub(a,b,c){e.hasOwnProperty(a)||Va("Replacing nonexistant public symbol");void 0!==e[a].Z&&void 0!==c?e[a].Z[c]=b:(e[a]=b,e[a].oa=c)}
function X(a,b){a=P(a);var c=e["dynCall_"+a];for(var d=[],f=1;f<a.length;++f)d.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+d.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(d.length?", ":"")+d.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&S("unknown function pointer with signature "+a+": "+b);return c}var vb=void 0;function wb(a){a=xb(a);var b=P(a);Y(a);return b}
function yb(a,b){function c(g){f[g]||R[g]||(Pa[g]?Pa[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new vb(a+": "+d.map(wb).join([", "]));}function zb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ab(a,b,c){a instanceof Object||S(c+' with invalid "this": '+a);a instanceof b.U.constructor||S(c+' incompatible with "this" of type '+a.constructor.name);a.S.T||S("cannot call emscripten binding method "+c+" on deleted object");return jb(a.S.T,a.S.V.U,b.U)}
var Bb=[],Z=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Cb(a){4<a&&0===--Z[a].ka&&(Z[a]=void 0,Bb.push(a))}function mb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Bb.length?Bb.pop():Z.length;Z[b]={ka:1,value:a};return b}}function V(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}
function Db(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 Eb(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=Ra(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c}
function Fb(a,b){for(var c=[],d=0;d<a;d++)c.push(J[(b>>2)+d]);return c}function Gb(a,b,c){switch(b){case 0:return c?function(d){return va[d]}:function(d){return H[d]};case 1:return c?function(d){return I[d>>1]}:function(d){return wa[d>>1]};case 2:return c?function(d){return J[d>>2]}:function(d){return L[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}for(var Hb=[null,[],[]],Ib=Array(256),Jb=0;256>Jb;++Jb)Ib[Jb]=String.fromCharCode(Jb);Oa=Ib;Ta=e.BindingError=Sa("BindingError");
Ua=e.InternalError=Sa("InternalError");U.prototype.isAliasOf=function(a){if(!(this instanceof U&&a instanceof U))return!1;var b=this.S.V.U,c=this.S.T,d=a.S.V.U;for(a=a.S.T;b.Y;)c=b.fa(c),b=b.Y;for(;d.Y;)a=d.fa(a),d=d.Y;return b===d&&c===a};U.prototype.clone=function(){this.S.T||Ya(this);if(this.S.ea)return this.S.count.value+=1,this;var a=bb(Object.create(Object.getPrototypeOf(this),{S:{value:Xa(this.S)}}));a.S.count.value+=1;a.S.da=!1;return a};
U.prototype["delete"]=function(){this.S.T||Ya(this);this.S.da&&!this.S.ea&&S("Object already scheduled for deletion");$a(this);ab(this.S);this.S.ea||(this.S.W=void 0,this.S.T=void 0)};U.prototype.isDeleted=function(){return!this.S.T};U.prototype.deleteLater=function(){this.S.T||Ya(this);this.S.da&&!this.S.ea&&S("Object already scheduled for deletion");db.push(this);1===db.length&&cb&&cb(eb);this.S.da=!0;return this};W.prototype.ta=function(a){this.na&&(a=this.na(a));return a};
W.prototype.ma=function(a){this.ba&&this.ba(a)};W.prototype.argPackAdvance=8;W.prototype.readValueFromPointer=ob;W.prototype.deleteObject=function(a){if(null!==a)a["delete"]()};
W.prototype.fromWireType=function(a){function b(){return this.ha?tb(this.U.aa,{V:this.va,T:c,X:this,W:a}):tb(this.U.aa,{V:this,T:a})}var c=this.ta(a);if(!c)return this.ma(a),null;var d=sb(this.U,c);if(void 0!==d){if(0===d.S.count.value)return d.S.T=c,d.S.W=a,d.clone();d=d.clone();this.ma(a);return d}d=this.U.sa(c);d=fb[d];if(!d)return b.call(this);d=this.ga?d.pa:d.pointerType;var f=qb(c,this.U,d.U);return null===f?b.call(this):this.ha?tb(d.U.aa,{V:d,T:f,X:this,W:a}):tb(d.U.aa,{V:d,T:f})};
e.getInheritedInstanceCount=function(){return Object.keys(rb).length};e.getLiveInheritedInstances=function(){var a=[],b;for(b in rb)rb.hasOwnProperty(b)&&a.push(rb[b]);return a};e.flushPendingDeletes=eb;e.setDelayFunction=function(a){cb=a;db.length&&cb&&cb(eb)};vb=e.UnboundTypeError=Sa("UnboundTypeError");e.count_emval_handles=function(){for(var a=0,b=5;b<Z.length;++b)void 0!==Z[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<Z.length;++a)if(void 0!==Z[a])return Z[a];return null};
var Lb={u:function(a,b,c,d,f){var g=Na(c);b=P(b);T(a,{name:b,fromWireType:function(n){return!!n},toWireType:function(n,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(n){if(1===c)var h=va;else if(2===c)h=I;else if(4===c)h=J;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[n>>g])},$:null})},p:function(a,b,c,d,f,g,n,h,k,l,m,q,v){m=P(m);g=X(f,g);h&&(h=X(n,h));l&&(l=X(k,l));v=X(q,v);var u=Qa(m);hb(u,function(){yb("Cannot construct "+m+" due to unbound types",
[d])});Wa([a,b,c],d?[d]:[],function(p){p=p[0];if(d){var w=p.U;var x=w.aa}else x=U.prototype;p=Ra(u,function(){if(Object.getPrototypeOf(this)!==y)throw new Ta("Use 'new' to construct "+m);if(void 0===D.la)throw new Ta(m+" has no accessible constructor");var pb=D.la[arguments.length];if(void 0===pb)throw new Ta("Tried to invoke ctor of "+m+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(D.la).toString()+") parameters instead!");return pb.apply(this,arguments)});
var y=Object.create(x,{constructor:{value:p}});p.prototype=y;var D=new ib(m,p,y,v,w,g,h,l);w=new W(m,D,!0,!1);x=new W(m+"*",D,!1,!1);var fa=new W(m+" const*",D,!1,!0);fb[a]={pointerType:x,pa:fa};ub(u,p);return[w,x,fa]})},d:function(a,b,c,d,f,g,n,h,k,l){b=P(b);f=X(d,f);Wa([],[a],function(m){m=m[0];var q=m.name+"."+b,v={get:function(){yb("Cannot access "+q+" due to unbound types",[c,n])},enumerable:!0,configurable:!0};k?v.set=function(){yb("Cannot access "+q+" due to unbound types",[c,n])}:v.set=function(){S(q+
" is a read-only property")};Object.defineProperty(m.U.aa,b,v);Wa([],k?[c,n]:[c],function(u){var p=u[0],w={get:function(){var y=Ab(this,m,q+" getter");return p.fromWireType(f(g,y))},enumerable:!0};if(k){k=X(h,k);var x=u[1];w.set=function(y){var D=Ab(this,m,q+" setter"),fa=[];k(l,D,x.toWireType(fa,y));zb(fa)}}Object.defineProperty(m.U.aa,b,w);return[]});return[]})},t:function(a,b){b=P(b);T(a,{name:b,fromWireType:function(c){var d=Z[c].value;Cb(c);return d},toWireType:function(c,d){return mb(d)},argPackAdvance:8,
readValueFromPointer:ob,$:null})},h:function(a,b,c){c=Na(c);b=P(b);T(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+V(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Db(b,c),$:null})},c:function(a,b,c,d,f,g){var n=Fb(b,c);a=P(a);f=X(d,f);hb(a,function(){yb("Cannot call "+a+" due to unbound types",n)},b-1);Wa([],n,function(h){var k=[h[0],null].concat(h.slice(1)),l=h=a,m=
f,q=k.length;2>q&&S("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var v=null!==k[1]&&!1,u=!1,p=1;p<k.length;++p)if(null!==k[p]&&void 0===k[p].$){u=!0;break}var w="void"!==k[0].name,x="",y="";for(p=0;p<q-2;++p)x+=(0!==p?", ":"")+"arg"+p,y+=(0!==p?", ":"")+"arg"+p+"Wired";l="return function "+Qa(l)+"("+x+") {\nif (arguments.length !== "+(q-2)+") {\nthrowBindingError('function "+l+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";
u&&(l+="var destructors = [];\n");var D=u?"destructors":"null";x="throwBindingError invoker fn runDestructors retType classParam".split(" ");m=[S,m,g,zb,k[0],k[1]];v&&(l+="var thisWired = classParam.toWireType("+D+", this);\n");for(p=0;p<q-2;++p)l+="var arg"+p+"Wired = argType"+p+".toWireType("+D+", arg"+p+"); // "+k[p+2].name+"\n",x.push("argType"+p),m.push(k[p+2]);v&&(y="thisWired"+(0<y.length?", ":"")+y);l+=(w?"var rv = ":"")+"invoker(fn"+(0<y.length?", ":"")+y+");\n";if(u)l+="runDestructors(destructors);\n";
else for(p=v?1:2;p<k.length;++p)q=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==k[p].$&&(l+=q+"_dtor("+q+"); // "+k[p].name+"\n",x.push(q+"_dtor"),m.push(k[p].$));w&&(l+="var ret = retType.fromWireType(rv);\nreturn ret;\n");x.push(l+"}\n");k=Eb(x).apply(null,m);ub(h,k,b-1);return[]})},b:function(a,b,c,d,f){function g(l){return l}b=P(b);-1===f&&(f=4294967295);var n=Na(c);if(0===d){var h=32-8*c;g=function(l){return l<<h>>>h}}var k=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(l,
m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+V(m)+'" to '+this.name);if(m<d||m>f)throw new TypeError('Passing a number "'+V(m)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return k?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:Gb(b,n,0!==d),$:null})},a:function(a,b,c){function d(g){g>>=2;var n=L;return new f(K,n[g+1],n[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,
Float32Array,Float64Array][b];c=P(c);T(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{ua:!0})},i:function(a,b){b=P(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(d){var f=L[d>>2];if(c){var g=H[d+4+f],n=0;0!=g&&(n=g,H[d+4+f]=0);var h=d+4;for(g=0;g<=f;++g){var k=d+4+g;if(0==H[k]){h=h?ma(H,h,void 0):"";if(void 0===l)var l=h;else l+=String.fromCharCode(0),l+=h;h=k+1}}0!=n&&(H[d+4+f]=n)}else{l=Array(f);for(g=0;g<f;++g)l[g]=String.fromCharCode(H[d+4+g]);l=l.join("")}Y(d);
return l},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 n=(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=Kb(4+n+1);L[h>>2]=n;if(c&&g)na(f,h+
4,n+1);else if(g)for(g=0;g<n;++g){var k=f.charCodeAt(g);255<k&&(Y(h),S("String has UTF-16 code units that do not fit in 8 bits"));H[h+4+g]=k}else for(g=0;g<n;++g)H[h+4+g]=f[g];null!==d&&d.push(Y,h);return h},argPackAdvance:8,readValueFromPointer:ob,$:function(d){Y(d)}})},e:function(a,b,c){c=P(c);if(2===b){var d=pa;var f=qa;var g=ra;var n=function(){return wa};var h=1}else 4===b&&(d=sa,f=ta,g=ua,n=function(){return L},h=2);T(a,{name:c,fromWireType:function(k){var l=L[k>>2],m=n(),q=m[k+4+l*b>>h],v=
0;0!=q&&(v=q,m[k+4+l*b>>h]=0);var u=k+4;for(q=0;q<=l;++q){var p=k+4+q*b;if(0==m[p>>h]){u=d(u);if(void 0===w)var w=u;else w+=String.fromCharCode(0),w+=u;u=p+b}}0!=v&&(m[k+4+l*b>>h]=v);Y(k);return w},toWireType:function(k,l){"string"!==typeof l&&S("Cannot pass non-string to C++ string type "+c);var m=g(l),q=Kb(4+m+b);L[q>>2]=m>>h;f(l,q+4,m+b);null!==k&&k.push(Y,q);return q},argPackAdvance:8,readValueFromPointer:ob,$:function(k){Y(k)}})},l:function(a,b){b=P(b);T(a,{za:!0,name:b,argPackAdvance:0,fromWireType:function(){},
toWireType:function(){}})},j:Cb,n:function(a){4<a&&(Z[a].ka+=1)},k:function(a,b){var c=R[a];void 0===c&&S("_emval_take_value has unknown type "+wb(a));a=c.readValueFromPointer(b);return mb(a)},g:function(){C()},r:function(a,b,c){H.copyWithin(a,b,b+c)},s:function(a){var b=H.length;if(2147418112<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(16777216,a,d);0<d%65536&&(d+=65536-d%65536);a:{try{G.grow(Math.min(2147418112,d)-K.byteLength+65535>>16);za(G.buffer);
var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},m:function(){return 0},o:function(){},f:function(a,b,c,d){for(var f=0,g=0;g<c;g++){for(var n=J[b+8*g>>2],h=J[b+(8*g+4)>>2],k=0;k<h;k++){var l=H[n+k],m=Hb[a];0===l||10===l?((1===a?ia:E)(ma(m,0)),m.length=0):m.push(l)}f+=h}J[d>>2]=f;return 0},memory:G,q:function(){},table:ja},Mb=function(){function a(f){e.asm=f.exports;M--;e.monitorRunDependencies&&e.monitorRunDependencies(M);0==M&&(null!==Ha&&(clearInterval(Ha),Ha=null),N&&(f=N,N=null,f()))}
function b(f){a(f.instance)}function c(f){return La().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){E("failed to asynchronously prepare wasm: "+g);C(g)})}var d={a:Lb};M++;e.monitorRunDependencies&&e.monitorRunDependencies(M);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return E("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(F||"function"!==typeof WebAssembly.instantiateStreaming||Ia()||"function"!==typeof fetch)return c(b);
fetch(O,{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");c(b)})})})();return{}}();e.asm=Mb;
var Ma=e.___wasm_call_ctors=function(){return(Ma=e.___wasm_call_ctors=e.asm.v).apply(null,arguments)},Kb=e._malloc=function(){return(Kb=e._malloc=e.asm.w).apply(null,arguments)},Y=e._free=function(){return(Y=e._free=e.asm.x).apply(null,arguments)},xb=e.___getTypeName=function(){return(xb=e.___getTypeName=e.asm.y).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.z).apply(null,arguments)};
e.dynCall_ii=function(){return(e.dynCall_ii=e.asm.A).apply(null,arguments)};e.dynCall_vi=function(){return(e.dynCall_vi=e.asm.B).apply(null,arguments)};e.dynCall_iii=function(){return(e.dynCall_iii=e.asm.C).apply(null,arguments)};e.dynCall_viii=function(){return(e.dynCall_viii=e.asm.D).apply(null,arguments)};e.dynCall_viiiiif=function(){return(e.dynCall_viiiiif=e.asm.E).apply(null,arguments)};e.dynCall_viiiif=function(){return(e.dynCall_viiiif=e.asm.F).apply(null,arguments)};
e.dynCall_i=function(){return(e.dynCall_i=e.asm.G).apply(null,arguments)};e.dynCall_v=function(){return(e.dynCall_v=e.asm.H).apply(null,arguments)};e.dynCall_iiiiiif=function(){return(e.dynCall_iiiiiif=e.asm.I).apply(null,arguments)};e.dynCall_iiiiif=function(){return(e.dynCall_iiiiif=e.asm.J).apply(null,arguments)};e.dynCall_vif=function(){return(e.dynCall_vif=e.asm.K).apply(null,arguments)};e.dynCall_iiii=function(){return(e.dynCall_iiii=e.asm.L).apply(null,arguments)};
e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.M).apply(null,arguments)};e.dynCall_iidiiii=function(){return(e.dynCall_iidiiii=e.asm.N).apply(null,arguments)};e.dynCall_vii=function(){return(e.dynCall_vii=e.asm.O).apply(null,arguments)};e.dynCall_viiiiii=function(){return(e.dynCall_viiiiii=e.asm.P).apply(null,arguments)};e.dynCall_viiiii=function(){return(e.dynCall_viiiii=e.asm.Q).apply(null,arguments)};e.dynCall_viiii=function(){return(e.dynCall_viiii=e.asm.R).apply(null,arguments)};
e.asm=Mb;var Nb;e.then=function(a){if(Nb)a(e);else{var b=e.onRuntimeInitialized;e.onRuntimeInitialized=function(){b&&b();a(e)}}return e};N=function Ob(){Nb||Pb();Nb||(N=Ob)};
function Pb(){function a(){if(!Nb&&(Nb=!0,e.calledRun=!0,!ka)){Ba(Da);Ba(Ea);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();Fa.unshift(b)}Ba(Fa)}}if(!(0<M)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)Ga();Ba(Ca);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()();noExitRuntime=!0;Pb();
return imagequant
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = imagequant;
else if (typeof define === 'function' && define['amd'])
define([], function() { return imagequant; });
else if (typeof exports === 'object')
exports["imagequant"] = imagequant;

Binary file not shown.

1147
codecs/imagequant/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
{
"name": "imagequant",
"scripts": {
"install": "napa",
"build": "docker run --rm -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
},
"napa": {
"libimagequant": "ImageOptim/libimagequant#2.12.1"
},
"devDependencies": {
"napa": "3.0.0"
}
}

View File

@ -0,0 +1,47 @@
# MozJPEG encoder
- Source: <https://github.com/mozilla/mozjpeg>
- Version: v3.3.1
## Dependencies
- Docker
## Example
See `example.html`
## API
### `int version()`
Returns the version of MozJPEG as a number. va.b.c is encoded as 0x0a0b0c
### `void free_result()`
Frees the result created by `encode()`.
### `Uint8Array encode(std::string image_in, int image_width, int image_height, MozJpegOptions opts)`
Encodes the given image with given dimension to JPEG. Options looks like this:
```c++
struct MozJpegOptions {
int quality;
bool baseline;
bool arithmetic;
bool progressive;
bool optimize_coding;
int smoothing;
int color_space;
int quant_table;
bool trellis_multipass;
bool trellis_opt_zero;
bool trellis_opt_table;
int trellis_loops;
bool auto_subsample;
int chroma_subsample;
bool separate_chroma_quality;
int chroma_quality;
};
```

54
codecs/mozjpeg_enc/build.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
set -e
export OPTIMIZE="-Os"
export LDFLAGS="${OPTIMIZE}"
export CFLAGS="${OPTIMIZE}"
export CPPFLAGS="${OPTIMIZE}"
apt-get update
apt-get install -qqy autoconf libtool libpng-dev pkg-config
echo "============================================="
echo "Compiling mozjpeg"
echo "============================================="
(
cd node_modules/mozjpeg
autoreconf -fiv
emconfigure ./configure --without-simd
emmake make libjpeg.la -j`nproc`
)
echo "============================================="
echo "Compiling mozjpeg done"
echo "============================================="
echo "============================================="
echo "Compiling wasm bindings"
echo "============================================="
(
emcc \
--bind \
${OPTIMIZE} \
--closure 1 \
-s WASM=1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s 'EXPORT_NAME="mozjpeg_enc"' \
-I node_modules/mozjpeg \
-o ./mozjpeg_enc.js \
-Wno-deprecated-register \
-Wno-writable-strings \
node_modules/mozjpeg/rdswitch.c \
-x c++ -std=c++11 \
mozjpeg_enc.cpp \
node_modules/mozjpeg/.libs/libjpeg.a
)
echo "============================================="
echo "Compiling wasm bindings done"
echo "============================================="
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Did you update your docker image?"
echo "Run \`docker pull trzeci/emscripten-upstream\`"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

View File

@ -0,0 +1,48 @@
<!doctype html>
<script src='mozjpeg_enc.js'></script>
<script>
const module = mozjpeg_enc();
async function loadImage(src) {
// Load image
const img = document.createElement('img');
img.src = src;
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];
// Draw image onto canvas
const ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
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 result = module.encode(image.data, image.width, image.height, {
quality: 75,
baseline: false,
arithmetic: false,
progressive: true,
optimize_coding: true,
smoothing: 0,
color_space: 3,
quant_table: 3,
trellis_multipass: false,
trellis_opt_zero: false,
trellis_opt_table: false,
trellis_loops: 1,
auto_subsample: true,
chroma_subsample: 2,
separate_chroma_quality: false,
chroma_quality: 75,
});
const blob = new Blob([result], {type: 'image/jpeg'});
const blobURL = URL.createObjectURL(blob);
const img = document.createElement('img');
img.src = blobURL;
document.body.appendChild(img);
};
</script>

View File

@ -0,0 +1,234 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
#include "config.h"
#include "jpeglib.h"
#include "cdjpeg.h"
using namespace emscripten;
// MozJPEG doesnt 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
struct MozJpegOptions {
int quality;
bool baseline;
bool arithmetic;
bool progressive;
bool optimize_coding;
int smoothing;
int color_space;
int quant_table;
bool trellis_multipass;
bool trellis_opt_zero;
bool trellis_opt_table;
int trellis_loops;
bool auto_subsample;
int chroma_subsample;
bool separate_chroma_quality;
int chroma_quality;
};
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] == '.') {
buffer[i] = '\0';
version = version << 8 | atoi(&buffer[last_index]);
buffer[i] = '.';
last_index = i + 1;
}
}
version = version << 8 | atoi(&buffer[last_index]);
return version;
}
uint8_t* last_result;
struct jpeg_compress_struct cinfo;
val encode(std::string image_in, int image_width, int image_height, MozJpegOptions opts) {
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.
/* This struct contains the JPEG compression parameters and pointers to
* working space (which is allocated as needed by the JPEG library).
* It is possible to have several such structures, representing multiple
* compression/decompression processes, in existence at once. We refer
* to any one struct (and its associated working data) as a "JPEG object".
*/
/* 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
* take the easy way out and use the standard error handler, which will
* print a message on stderr and call exit() if compression fails.
* 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 */
/* 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
* address which we place into the link field in cinfo.
*/
cinfo.err = jpeg_std_error(&jerr);
/* Now we can initialize the JPEG compression object. */
jpeg_create_compress(&cinfo);
/* Step 2: specify data destination (eg, a file) */
/* Note: steps 2 and 3 can be done in either order. */
/* Here we use the library-supplied code to send compressed data to a
* stdio stream. You can also write your own code to do something else.
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
* requires it in order to write binary files.
*/
// if ((outfile = fopen(filename, "wb")) == NULL) {
// fprintf(stderr, "can't open %s\n", filename);
// exit(1);
// }
jpeg_mem_dest(&cinfo, &output, &size);
/* Step 3: set parameters for compression */
/* 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_height = image_height;
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);
if (opts.quant_table != -1) {
jpeg_c_set_int_param(&cinfo, JINT_BASE_QUANT_TBL_IDX, opts.quant_table);
}
cinfo.optimize_coding = opts.optimize_coding;
if (opts.arithmetic) {
cinfo.arith_code = TRUE;
cinfo.optimize_coding = FALSE;
}
cinfo.smoothing_factor = opts.smoothing;
jpeg_c_set_bool_param(&cinfo, JBOOLEAN_USE_SCANS_IN_TRELLIS, opts.trellis_multipass);
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);
// 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();
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;
cinfo.comp_info[0].v_samp_factor = opts.chroma_subsample;
}
if (!opts.baseline && opts.progressive) {
jpeg_simple_progression(&cinfo);
} else {
cinfo.num_scans = 0;
cinfo.scan_info = NULL;
}
/* Step 4: Start compressor */
/* TRUE ensures that we will write a complete interchange-JPEG file.
* Pass TRUE unless you are very sure of what you're doing.
*/
jpeg_start_compress(&cinfo, TRUE);
/* Step 5: while (scan lines remain to be written) */
/* jpeg_write_scanlines(...); */
/* Here we use the library's state variable cinfo.next_scanline as the
* loop counter, so that we don't have to keep track ourselves.
* 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 */
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);
}
/* Step 6: Finish compression */
jpeg_finish_compress(&cinfo);
/* Step 7: release JPEG compression object */
last_result = 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);
}
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)
;
function("version", &version);
function("encode", &encode);
function("free_result", &free_result);
}

8
codecs/mozjpeg_enc/mozjpeg_enc.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
import { EncodeOptions } from '../../src/codecs/mozjpeg/encoder-meta';
interface MozJPEGModule extends EmscriptenWasm.Module {
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array;
free_result(): void;
}
export default function(opts: EmscriptenWasm.ModuleOpts): MozJPEGModule;

View File

@ -0,0 +1,70 @@
var mozjpeg_enc = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(mozjpeg_enc) {
mozjpeg_enc = mozjpeg_enc || {};
var c;c||(c=typeof mozjpeg_enc !== 'undefined' ? mozjpeg_enc : {});var r={},t;for(t in c)c.hasOwnProperty(t)&&(r[t]=c[t]);var aa="./this.program";function u(a,b){throw b;}var ba=!1,v=!1,ca=!1,da=!1;ba="object"===typeof window;v="function"===typeof importScripts;ca="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;da=!ba&&!ca&&!v;var w="",ea,x,fa,ha;
if(ca)w=v?require("path").dirname(w)+"/":__dirname+"/",ea=function(a,b){fa||(fa=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);return fa.readFileSync(a,b?null:"utf8")},x=function(a){a=ea(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||A("Assertion failed: undefined");return a},1<process.argv.length&&(aa=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(a){if(!(a instanceof ia))throw a;}),process.on("unhandledRejection",A),u=function(a){process.exit(a)},
c.inspect=function(){return"[Emscripten Module object]"};else if(da)"undefined"!=typeof read&&(ea=function(a){return read(a)}),x=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||A("Assertion failed: undefined");return a},"function"===typeof quit&&(u=function(a){quit(a)}),"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:
print);else if(ba||v)v?w=self.location.href:document.currentScript&&(w=document.currentScript.src),_scriptDir&&(w=_scriptDir),0!==w.indexOf("blob:")?w=w.substr(0,w.lastIndexOf("/")+1):w="",ea=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},v&&(x=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ja=c.print||console.log.bind(console),B=c.printErr||console.warn.bind(console);
for(t in r)r.hasOwnProperty(t)&&(c[t]=r[t]);r=null;c.thisProgram&&(aa=c.thisProgram);c.quit&&(u=c.quit);var C;c.wasmBinary&&(C=c.wasmBinary);var noExitRuntime;c.noExitRuntime&&(noExitRuntime=c.noExitRuntime);"object"!==typeof WebAssembly&&B("no native wasm support detected");var F,ka=new WebAssembly.Table({initial:134,maximum:134,element:"anyfunc"}),la=!1,ma="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
function na(a,b,d){var e=b+d;for(d=b;a[d]&&!(d>=e);)++d;if(16<d-b&&a.subarray&&ma)return ma.decode(a.subarray(b,d));for(e="";b<d;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var m=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|m:(f&7)<<18|g<<12|m<<6|a[b++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else e+=String.fromCharCode(f)}return e}
function oa(a,b,d){var e=H;if(0<d){d=b+d-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var m=a.charCodeAt(++f);g=65536+((g&1023)<<10)|m&1023}if(127>=g){if(b>=d)break;e[b++]=g}else{if(2047>=g){if(b+1>=d)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=d)break;e[b++]=224|g>>12}else{if(b+3>=d)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var pa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
function qa(a){var b;for(b=a>>1;I[b];)++b;b<<=1;if(32<b-a&&pa)return pa.decode(H.subarray(a,b));b=0;for(var d="";;){var e=I[a+2*b>>1];if(0==e)return d;++b;d+=String.fromCharCode(e)}}function ra(a,b,d){void 0===d&&(d=2147483647);if(2>d)return 0;d-=2;var e=b;d=d<2*a.length?d/2:a.length;for(var f=0;f<d;++f)I[b>>1]=a.charCodeAt(f),b+=2;I[b>>1]=0;return b-e}function sa(a){return 2*a.length}
function ta(a){for(var b=0,d="";;){var e=J[a+4*b>>2];if(0==e)return d;++b;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}}function ua(a,b,d){void 0===d&&(d=2147483647);if(4>d)return 0;var e=b;d=e+d-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var m=a.charCodeAt(++f);g=65536+((g&1023)<<10)|m&1023}J[b>>2]=g;b+=4;if(b+4>d)break}J[b>>2]=0;return b-e}
function va(a){for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);55296<=e&&57343>=e&&++d;b+=4}return b}var K,L,H,I,wa,J,M,xa,ya;function za(a){K=a;c.HEAP8=L=new Int8Array(a);c.HEAP16=I=new Int16Array(a);c.HEAP32=J=new Int32Array(a);c.HEAPU8=H=new Uint8Array(a);c.HEAPU16=wa=new Uint16Array(a);c.HEAPU32=M=new Uint32Array(a);c.HEAPF32=xa=new Float32Array(a);c.HEAPF64=ya=new Float64Array(a)}var Aa=c.INITIAL_MEMORY||16777216;c.wasmMemory?F=c.wasmMemory:F=new WebAssembly.Memory({initial:Aa/65536});
F&&(K=F.buffer);Aa=K.byteLength;za(K);J[39524]=5401136;function Ba(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b();else{var d=b.ba;"number"===typeof d?void 0===b.X?c.dynCall_v(d):c.dynCall_vi(d,b.X):d(void 0===b.X?null:b.X)}}}var Ca=[],Da=[],Ea=[],Fa=[];function Ga(){var a=c.preRun.shift();Ca.unshift(a)}var N=0,Ha=null,O=null;c.preloadedImages={};c.preloadedAudios={};
function A(a){if(c.onAbort)c.onAbort(a);ja(a);B(a);la=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ia(){var a=P;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var P="mozjpeg_enc.wasm";if(!Ia()){var Ja=P;P=c.locateFile?c.locateFile(Ja,w):w+Ja}
function Ka(){try{if(C)return new Uint8Array(C);if(x)return x(P);throw"both async and sync fetching of the wasm failed";}catch(a){A(a)}}function La(){return C||!ba&&!v||"function"!==typeof fetch?new Promise(function(a){a(Ka())}):fetch(P,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+P+"'";return a.arrayBuffer()}).catch(function(){return Ka()})}Da.push({ba:function(){Ma()}});var Na={};function Oa(a){for(;a.length;){var b=a.pop();a.pop()(b)}}
function Pa(a){return this.fromWireType(M[a>>2])}var Q={},R={},Qa={};function Ra(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 Sa(a,b){a=Ra(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
function Ta(a){var b=Error,d=Sa(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});d.prototype=Object.create(b.prototype);d.prototype.constructor=d;d.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return d}var Ua=void 0;
function Va(a,b,d){function e(h){h=d(h);if(h.length!==a.length)throw new Ua("Mismatched type converter count");for(var k=0;k<a.length;++k)S(a[k],h[k])}a.forEach(function(h){Qa[h]=b});var f=Array(b.length),g=[],m=0;b.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];++m;m===g.length&&e(f)}))});0===g.length&&e(f)}
function Wa(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 Xa=void 0;function T(a){for(var b="";H[a];)b+=Xa[H[a++]];return b}var Ya=void 0;function U(a){throw new Ya(a);}
function S(a,b,d){d=d||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||U('type "'+e+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(d.ga)return;U("Cannot register type '"+e+"' twice")}R[a]=b;delete Qa[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}var Za=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function $a(a){4<a&&0===--V[a].Y&&(V[a]=void 0,Za.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=Za.length?Za.pop():V.length;V[b]={Y: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(d){return this.fromWireType(xa[d>>2])};case 3:return function(d){return this.fromWireType(ya[d>>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 d=Sa(b.name||"unknownFunctionName",function(){});d.prototype=b.prototype;d=new d;a=b.apply(d,a);return a instanceof Object?a:d}
function eb(a,b){var d=c;if(void 0===d[a].V){var e=d[a];d[a]=function(){d[a].V.hasOwnProperty(arguments.length)||U("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+d[a].V+")!");return d[a].V[arguments.length].apply(this,arguments)};d[a].V=[];d[a].V[e.$]=e}}
function fb(a,b,d){c.hasOwnProperty(a)?((void 0===d||void 0!==c[a].V&&void 0!==c[a].V[d])&&U("Cannot register public name '"+a+"' twice"),eb(a,a),c.hasOwnProperty(d)&&U("Cannot register multiple overloads of a function with the same number of arguments ("+d+")!"),c[a].V[d]=b):(c[a]=b,void 0!==d&&(c[a].na=d))}function gb(a,b){for(var d=[],e=0;e<a;e++)d.push(J[(b>>2)+e]);return d}
function W(a,b){a=T(a);var d=c["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";d=(new Function("dynCall","rawFunction",f+"};\n"))(d,b);"function"!==typeof d&&U("unknown function pointer with signature "+a+": "+b);return d}var hb=void 0;function ib(a){a=jb(a);var b=T(a);Y(a);return b}
function kb(a,b){function d(g){f[g]||R[g]||(Qa[g]?Qa[g].forEach(d):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(d);throw new hb(a+": "+e.map(ib).join([", "]));}function lb(a,b,d){switch(b){case 0:return d?function(e){return L[e]}:function(e){return H[e]};case 1:return d?function(e){return I[e>>1]}:function(e){return wa[e>>1]};case 2:return d?function(e){return J[e>>2]}:function(e){return M[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}var mb={};
function nb(){if(!ob){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",_:aa||"./this.program"},b;for(b in mb)a[b]=mb[b];var d=[];for(b in a)d.push(b+"="+a[b]);ob=d}return ob}var ob,pb=[null,[],[]];Ua=c.InternalError=Ta("InternalError");for(var qb=Array(256),rb=0;256>rb;++rb)qb[rb]=String.fromCharCode(rb);Xa=qb;Ya=c.BindingError=Ta("BindingError");
c.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};c.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};hb=c.UnboundTypeError=Ta("UnboundTypeError");
var tb={m:function(a){var b=Na[a];delete Na[a];var d=b.ha,e=b.ia,f=b.Z,g=f.map(function(m){return m.fa}).concat(f.map(function(m){return m.ka}));Va([a],g,function(m){var h={};f.forEach(function(k,l){var n=m[l],q=k.da,D=k.ea,y=m[l+f.length],p=k.ja,E=k.la;h[k.aa]={read:function(z){return n.fromWireType(q(D,z))},write:function(z,G){var X=[];p(E,z,y.toWireType(X,G));Oa(X)}}});return[{name:b.name,fromWireType:function(k){var l={},n;for(n in h)l[n]=h[n].read(k);e(k);return l},toWireType:function(k,l){for(var n in h)if(!(n in
l))throw new TypeError("Missing field");var q=d();for(n in h)h[n].write(q,l[n]);null!==k&&k.push(e,q);return q},argPackAdvance:8,readValueFromPointer:Pa,W:e}]})},s:function(a,b,d,e,f){var g=Wa(d);b=T(b);S(a,{name:b,fromWireType:function(m){return!!m},toWireType:function(m,h){return h?e:f},argPackAdvance:8,readValueFromPointer:function(m){if(1===d)var h=L;else if(2===d)h=I;else if(4===d)h=J;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[m>>g])},W:null})},r:function(a,
b){b=T(b);S(a,{name:b,fromWireType:function(d){var e=V[d].value;$a(d);return e},toWireType:function(d,e){return ab(e)},argPackAdvance:8,readValueFromPointer:Pa,W:null})},g:function(a,b,d){d=Wa(d);b=T(b);S(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,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,d),W:null})},c:function(a,b,d,e,f,g){var m=gb(b,d);a=T(a);f=W(e,
f);fb(a,function(){kb("Cannot call "+a+" due to unbound types",m)},b-1);Va([],m,function(h){var k=[h[0],null].concat(h.slice(1)),l=h=a,n=f,q=k.length;2>q&&U("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var D=null!==k[1]&&!1,y=!1,p=1;p<k.length;++p)if(null!==k[p]&&void 0===k[p].W){y=!0;break}var E="void"!==k[0].name,z="",G="";for(p=0;p<q-2;++p)z+=(0!==p?", ":"")+"arg"+p,G+=(0!==p?", ":"")+"arg"+p+"Wired";l="return function "+Ra(l)+"("+z+") {\nif (arguments.length !== "+
(q-2)+") {\nthrowBindingError('function "+l+" called with ' + arguments.length + ' arguments, expected "+(q-2)+" args!');\n}\n";y&&(l+="var destructors = [];\n");var X=y?"destructors":"null";z="throwBindingError invoker fn runDestructors retType classParam".split(" ");n=[U,n,g,Oa,k[0],k[1]];D&&(l+="var thisWired = classParam.toWireType("+X+", this);\n");for(p=0;p<q-2;++p)l+="var arg"+p+"Wired = argType"+p+".toWireType("+X+", arg"+p+"); // "+k[p+2].name+"\n",z.push("argType"+p),n.push(k[p+2]);D&&(G=
"thisWired"+(0<G.length?", ":"")+G);l+=(E?"var rv = ":"")+"invoker(fn"+(0<G.length?", ":"")+G+");\n";if(y)l+="runDestructors(destructors);\n";else for(p=D?1:2;p<k.length;++p)q=1===p?"thisWired":"arg"+(p-2)+"Wired",null!==k[p].W&&(l+=q+"_dtor("+q+"); // "+k[p].name+"\n",z.push(q+"_dtor"),n.push(k[p].W));E&&(l+="var ret = retType.fromWireType(rv);\nreturn ret;\n");z.push(l+"}\n");k=db(z).apply(null,n);p=b-1;if(!c.hasOwnProperty(h))throw new Ua("Replacing nonexistant public symbol");void 0!==c[h].V&&
void 0!==p?c[h].V[p]=k:(c[h]=k,c[h].$=p);return[]})},b:function(a,b,d,e,f){function g(l){return l}b=T(b);-1===f&&(f=4294967295);var m=Wa(d);if(0===e){var h=32-8*d;g=function(l){return l<<h>>>h}}var k=-1!=b.indexOf("unsigned");S(a,{name:b,fromWireType:g,toWireType:function(l,n){if("number"!==typeof n&&"boolean"!==typeof n)throw new TypeError('Cannot convert "'+bb(n)+'" to '+this.name);if(n<e||n>f)throw new TypeError('Passing a number "'+bb(n)+'" from JS side to C/C++ side to an argument of type "'+
b+'", which is outside the valid range ['+e+", "+f+"]!");return k?n>>>0:n|0},argPackAdvance:8,readValueFromPointer:lb(b,m,0!==e),W:null})},a:function(a,b,d){function e(g){g>>=2;var m=M;return new f(K,m[g+1],m[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];d=T(d);S(a,{name:d,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{ga:!0})},h:function(a,b){b=T(b);var d="std::string"===b;S(a,{name:b,fromWireType:function(e){var f=M[e>>2];if(d){var g=
H[e+4+f],m=0;0!=g&&(m=g,H[e+4+f]=0);var h=e+4;for(g=0;g<=f;++g){var k=e+4+g;if(0==H[k]){h=h?na(H,h,void 0):"";if(void 0===l)var l=h;else l+=String.fromCharCode(0),l+=h;h=k+1}}0!=m&&(H[e+4+f]=m)}else{l=Array(f);for(g=0;g<f;++g)l[g]=String.fromCharCode(H[e+4+g]);l=l.join("")}Y(e);return l},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||U("Cannot pass non-string to std::string");
var m=(d&&g?function(){for(var l=0,n=0;n<f.length;++n){var q=f.charCodeAt(n);55296<=q&&57343>=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++n)&1023);127>=q?++l:l=2047>=q?l+2:65535>=q?l+3:l+4}return l}:function(){return f.length})(),h=sb(4+m+1);M[h>>2]=m;if(d&&g)oa(f,h+4,m+1);else if(g)for(g=0;g<m;++g){var k=f.charCodeAt(g);255<k&&(Y(h),U("String has UTF-16 code units that do not fit in 8 bits"));H[h+4+g]=k}else for(g=0;g<m;++g)H[h+4+g]=f[g];null!==e&&e.push(Y,h);return h},argPackAdvance:8,readValueFromPointer:Pa,
W:function(e){Y(e)}})},d:function(a,b,d){d=T(d);if(2===b){var e=qa;var f=ra;var g=sa;var m=function(){return wa};var h=1}else 4===b&&(e=ta,f=ua,g=va,m=function(){return M},h=2);S(a,{name:d,fromWireType:function(k){var l=M[k>>2],n=m(),q=n[k+4+l*b>>h],D=0;0!=q&&(D=q,n[k+4+l*b>>h]=0);var y=k+4;for(q=0;q<=l;++q){var p=k+4+q*b;if(0==n[p>>h]){y=e(y);if(void 0===E)var E=y;else E+=String.fromCharCode(0),E+=y;y=p+b}}0!=D&&(n[k+4+l*b>>h]=D);Y(k);return E},toWireType:function(k,l){"string"!==typeof l&&U("Cannot pass non-string to C++ string type "+
d);var n=g(l),q=sb(4+n+b);M[q>>2]=n>>h;f(l,q+4,n+b);null!==k&&k.push(Y,q);return q},argPackAdvance:8,readValueFromPointer:Pa,W:function(k){Y(k)}})},x:function(a,b,d,e,f,g){Na[a]={name:T(b),ha:W(d,e),ia:W(f,g),Z:[]}},f:function(a,b,d,e,f,g,m,h,k,l){Na[a].Z.push({aa:T(b),fa:d,da:W(e,f),ea:g,ka:m,ja:W(h,k),la:l})},t:function(a,b){b=T(b);S(a,{ma:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},k:$a,l:function(a){4<a&&(V[a].Y+=1)},y:function(a,b){var d=R[a];void 0===d&&U("_emval_take_value has unknown type "+
ib(a));a=d.readValueFromPointer(b);return ab(a)},u:function(){A()},p:function(a,b,d){H.copyWithin(a,b,b+d)},q:function(a){var b=H.length;if(2147418112<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{F.grow(Math.min(2147418112,e)-K.byteLength+65535>>16);za(F.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},v:function(a,b){var d=0;nb().forEach(function(e,f){var g=b+d;f=J[a+4*f>>2]=g;for(g=0;g<
e.length;++g)L[f++>>0]=e.charCodeAt(g);L[f>>0]=0;d+=e.length+1});return 0},w:function(a,b){var d=nb();J[a>>2]=d.length;var e=0;d.forEach(function(f){e+=f.length+1});J[b>>2]=e;return 0},j:function(a){if(!noExitRuntime&&(la=!0,c.onExit))c.onExit(a);u(a,new ia(a))},i:function(){return 0},n:function(){},e:function(a,b,d,e){for(var f=0,g=0;g<d;g++){for(var m=J[b+8*g>>2],h=J[b+(8*g+4)>>2],k=0;k<h;k++){var l=H[m+k],n=pb[a];0===l||10===l?((1===a?ja:B)(na(n,0)),n.length=0):n.push(l)}f+=h}J[e>>2]=f;return 0},
memory:F,o:function(){},table:ka},ub=function(){function a(f){c.asm=f.exports;N--;c.monitorRunDependencies&&c.monitorRunDependencies(N);0==N&&(null!==Ha&&(clearInterval(Ha),Ha=null),O&&(f=O,O=null,f()))}function b(f){a(f.instance)}function d(f){return La().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){B("failed to asynchronously prepare wasm: "+g);A(g)})}var e={a:tb};N++;c.monitorRunDependencies&&c.monitorRunDependencies(N);if(c.instantiateWasm)try{return c.instantiateWasm(e,
a)}catch(f){return B("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(C||"function"!==typeof WebAssembly.instantiateStreaming||Ia()||"function"!==typeof fetch)return d(b);fetch(P,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");d(b)})})})();return{}}();c.asm=ub;
var Ma=c.___wasm_call_ctors=function(){return(Ma=c.___wasm_call_ctors=c.asm.z).apply(null,arguments)},sb=c._malloc=function(){return(sb=c._malloc=c.asm.A).apply(null,arguments)},Y=c._free=function(){return(Y=c._free=c.asm.B).apply(null,arguments)},jb=c.___getTypeName=function(){return(jb=c.___getTypeName=c.asm.C).apply(null,arguments)};c.___embind_register_native_and_builtin_types=function(){return(c.___embind_register_native_and_builtin_types=c.asm.D).apply(null,arguments)};
c.dynCall_i=function(){return(c.dynCall_i=c.asm.E).apply(null,arguments)};c.dynCall_viiiii=function(){return(c.dynCall_viiiii=c.asm.F).apply(null,arguments)};c.dynCall_v=function(){return(c.dynCall_v=c.asm.G).apply(null,arguments)};c.dynCall_vi=function(){return(c.dynCall_vi=c.asm.H).apply(null,arguments)};c.dynCall_iii=function(){return(c.dynCall_iii=c.asm.I).apply(null,arguments)};c.dynCall_viii=function(){return(c.dynCall_viii=c.asm.J).apply(null,arguments)};
c.dynCall_ii=function(){return(c.dynCall_ii=c.asm.K).apply(null,arguments)};c.dynCall_iiiiii=function(){return(c.dynCall_iiiiii=c.asm.L).apply(null,arguments)};c.dynCall_viiiiiiii=function(){return(c.dynCall_viiiiiiii=c.asm.M).apply(null,arguments)};c.dynCall_vii=function(){return(c.dynCall_vii=c.asm.N).apply(null,arguments)};c.dynCall_viiii=function(){return(c.dynCall_viiii=c.asm.O).apply(null,arguments)};c.dynCall_viiiiiii=function(){return(c.dynCall_viiiiiii=c.asm.P).apply(null,arguments)};
c.dynCall_iiiiiii=function(){return(c.dynCall_iiiiiii=c.asm.Q).apply(null,arguments)};c.dynCall_iiiii=function(){return(c.dynCall_iiiii=c.asm.R).apply(null,arguments)};c.dynCall_iiii=function(){return(c.dynCall_iiii=c.asm.S).apply(null,arguments)};c.dynCall_jiji=function(){return(c.dynCall_jiji=c.asm.T).apply(null,arguments)};c.dynCall_viiiiii=function(){return(c.dynCall_viiiiii=c.asm.U).apply(null,arguments)};c.asm=ub;var Z;
c.then=function(a){if(Z)a(c);else{var b=c.onRuntimeInitialized;c.onRuntimeInitialized=function(){b&&b();a(c)}}return c};function ia(a){this.name="ExitStatus";this.message="Program terminated with exit("+a+")";this.status=a}O=function vb(){Z||wb();Z||(O=vb)};
function wb(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!la)){Ba(Da);Ba(Ea);if(c.onRuntimeInitialized)c.onRuntimeInitialized();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();Fa.unshift(b)}Ba(Fa)}}if(!(0<N)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)Ga();Ba(Ca);0<N||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}c.run=wb;
if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();noExitRuntime=!0;wb();
return mozjpeg_enc
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = mozjpeg_enc;
else if (typeof define === 'function' && define['amd'])
define([], function() { return mozjpeg_enc; });
else if (typeof exports === 'object')
exports["mozjpeg_enc"] = mozjpeg_enc;

Binary file not shown.

1147
codecs/mozjpeg_enc/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
{
"name": "mozjpeg_enc",
"scripts": {
"install": "napa",
"build": "docker run --rm -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
},
"napa": {
"mozjpeg": "mozilla/mozjpeg#v3.3.1"
},
"devDependencies": {
"napa": "3.0.0"
}
}

1
codecs/oxipng/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

502
codecs/oxipng/Cargo.lock generated Normal file
View File

@ -0,0 +1,502 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "adler32"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "autocfg"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bit-vec"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "build_const"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bumpalo"
version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bytemuck"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cc"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cloudflare-zlib"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cloudflare-zlib-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cloudflare-zlib-sys"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crc"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crc32fast"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-deque"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-epoch"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memoffset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-queue"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-utils"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "deflate"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "either"
version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hermit-abi"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "image"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytemuck 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num-iter 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "indexmap"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "inflate"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itertools"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libdeflater"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "log"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "maybe-uninit"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memoffset"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "miniz_oxide"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-integer"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-iter"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-rational"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num_cpus"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hermit-abi 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "oxipng"
version = "0.1.0"
dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"oxipng 2.3.0 (git+https://github.com/shssoichiro/oxipng.git)",
"wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "oxipng"
version = "2.3.0"
source = "git+https://github.com/shssoichiro/oxipng.git#ec8ecf5a800dfb41359d9cf41eed8a730062b9a8"
dependencies = [
"bit-vec 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cloudflare-zlib 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libdeflater 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rgb 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)",
"zopfli 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "png"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"deflate 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rayon"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rayon-core"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rgb"
version = "0.8.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syn"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "typed-arena"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wasm-bindgen"
version = "0.2.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "zopfli"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"typed-arena 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata]
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
"checksum bit-vec 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a4523a10839ffae575fb08aa3423026c8cb4687eef43952afb956229d4f246f7"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39"
"checksum bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187"
"checksum bytemuck 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431"
"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum cloudflare-zlib 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f5ed63a019d55bacd15cadcbcb96bf41b16281417fff393bdb55fa84255fe4b9"
"checksum cloudflare-zlib-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e195cb274a0d6ee87e718838a09baecd7cbc9f6075dac256a84cb5842739c06"
"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
"checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
"checksum crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
"checksum deflate 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "050ef6de42a33903b30a7497b76b40d3d58691d4d3eec355348c122444a388f0"
"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
"checksum hermit-abi 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e"
"checksum image 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9062b90712d25bc6bb165d110aa59c6b47c849246e341e7b86a98daff9d49f60"
"checksum indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
"checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff"
"checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0"
"checksum libdeflater 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "66dca08b13369865b2f6dca1dd05f833985cbe6c12a676b04d55f78b85e80246"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
"checksum memoffset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8"
"checksum miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5"
"checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
"checksum num-iter 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "dfb0800a0291891dd9f4fe7bd9c19384f98f7fbe0cd0f39a2c6b88b9868bbc00"
"checksum num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
"checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
"checksum oxipng 2.3.0 (git+https://github.com/shssoichiro/oxipng.git)" = "<none>"
"checksum png 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "46060468187c21c00ffa2a920690b29997d7fd543f5a4d400461e4a7d4fccde8"
"checksum proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3"
"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
"checksum rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098"
"checksum rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9"
"checksum rgb 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)" = "a85b83fd629b0ce765f45316774fa6aaa95947fd74c8e4bbf3c6d1e349701d95"
"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
"checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
"checksum typed-arena 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f"
"checksum wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd"
"checksum wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4"
"checksum wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931"
"checksum wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639"
"checksum zopfli 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4079b79464426ade2a1b0177fb0ce8396ba6b4084267407e333573c666073964"

21
codecs/oxipng/Cargo.toml Normal file
View File

@ -0,0 +1,21 @@
[package]
name = "oxipng"
version = "0.1.0"
authors = ["Ingvar Stepanyan <me@rreverser.com>"]
edition = "2018"
publish = false
[lib]
crate-type = ["cdylib"]
[dependencies]
oxipng = { version = "2.3.0", default-features = false }
wasm-bindgen = "0.2.48"
log = { version = "0.4", features = ["release_max_level_off"] }
[profile.release]
lto = true
opt-level = "s"
[patch.crates-io]
oxipng = { git = "https://github.com/shssoichiro/oxipng.git", branch = "master" }

12
codecs/oxipng/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM rust
RUN rustup target add wasm32-unknown-unknown
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
RUN mkdir /opt/wabt && \
curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.11/wabt-1.0.11-linux.tar.gz | tar -xzf - -C /opt/wabt --strip 1
RUN mkdir /opt/wasi-sdk && \
curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-8/wasi-sdk-8.0-linux.tar.gz | tar -xzf - -C /opt/wasi-sdk --strip 1
ENV PATH="/opt/wabt:/opt/wasi-sdk/bin:${PATH}"
WORKDIR /src

22
codecs/oxipng/build.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
echo "============================================="
echo "Compiling wasm"
echo "============================================="
(
wasm-pack build
wasm-strip pkg/oxipng_bg.wasm
rm pkg/.gitignore
)
echo "============================================="
echo "Compiling wasm done"
echo "============================================="
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Did you update your docker image?"
echo "Run \`docker pull ubuntu\`"
echo "Run \`docker pull rust\`"
echo "Run \`docker build -t squoosh-oxipng .\`"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

4
codecs/oxipng/package-lock.json generated Normal file
View File

@ -0,0 +1,4 @@
{
"name": "oxipng",
"lockfileVersion": 1
}

View File

@ -0,0 +1,7 @@
{
"name": "oxipng",
"scripts": {
"build:image": "docker build -t squoosh-oxipng .",
"build": "docker run --rm -v $(pwd):/src squoosh-oxipng ./build.sh"
}
}

8
codecs/oxipng/pkg/oxipng.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
/* tslint:disable */
/* eslint-disable */
/**
* @param {Uint8Array} data
* @param {number} level
* @returns {Uint8Array}
*/
export function optimise(data: Uint8Array, level: number): Uint8Array;

View File

@ -0,0 +1,60 @@
import * as wasm from './oxipng_bg.wasm';
const lTextDecoder = typeof TextDecoder === 'undefined' ? require('util').TextDecoder : TextDecoder;
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
let cachegetUint8Memory0 = null;
function getUint8Memory0() {
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
}
return cachegetUint8Memory0;
}
function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}
let WASM_VECTOR_LEN = 0;
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
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 getArrayU8FromWasm0(ptr, len) {
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
/**
* @param {Uint8Array} data
* @param {number} level
* @returns {Uint8Array}
*/
export function optimise(data, level) {
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
var len0 = WASM_VECTOR_LEN;
wasm.optimise(8, ptr0, len0, level);
var r0 = getInt32Memory0()[8 / 4 + 0];
var r1 = getInt32Memory0()[8 / 4 + 1];
var v1 = getArrayU8FromWasm0(r0, r1).slice();
wasm.__wbindgen_free(r0, r1 * 1);
return v1;
}
export const __wbindgen_throw = function(arg0, arg1) {
throw new Error(getStringFromWasm0(arg0, arg1));
};

8
codecs/oxipng/pkg/oxipng_bg.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function optimise(a: number, b: number, c: number, d: number): void;
export function malloc(a: number): number;
export function free(a: number): void;
export function __wbindgen_malloc(a: number): number;
export function __wbindgen_free(a: number, b: number): void;

Binary file not shown.

View File

@ -0,0 +1,15 @@
{
"name": "oxipng",
"collaborators": [
"Ingvar Stepanyan <me@rreverser.com>"
],
"version": "0.1.0",
"files": [
"oxipng_bg.wasm",
"oxipng.js",
"oxipng.d.ts"
],
"module": "oxipng.js",
"types": "oxipng.d.ts",
"sideEffects": false
}

10
codecs/oxipng/src/lib.rs Normal file
View File

@ -0,0 +1,10 @@
mod malloc_shim;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(catch)]
pub fn optimise(data: &[u8], level: u8) -> Vec<u8> {
let mut options = oxipng::Options::from_preset(level);
options.deflate = oxipng::Deflaters::Libdeflater;
oxipng::optimize_from_memory(data, &options).unwrap_throw()
}

View File

@ -0,0 +1,47 @@
//! This is a module that provides `malloc` and `free` for `libdeflate`.
//! These implementations are compatible with the standard signatures
//! but use Rust allocator instead of including libc one as well.
//!
//! Rust allocator APIs requires passing size and alignment to the
//! `dealloc` function. This is different from C API, which only
//! expects a pointer in `free` and expects allocators to take care of
//! storing any necessary information elsewhere.
//!
//! In order to simulate C API, we allocate a `size_and_data_ptr`
//! of size `sizeof(usize) + size` where `size` is the requested number
//! of bytes. Then, we store `size` at the beginning of the allocated
//! chunk (within those `sizeof(usize)` bytes) and return
//! `data_ptr = size_and_data_ptr + sizeof(usize)` to the calleer:
//!
//! [`size`][...actual data]
//! -^------------------ `size_and_data_ptr`
//! ---------^---------- `data_ptr`
//!
//! Then, in `free`, the caller gives us `data_ptr`. We can subtract
//! `sizeof(usize)` back and get the original `size_and_data_ptr`.
//! At this point we can read `size` back and call the Rust `dealloc`
//! for the whole allocated chunk.
//!
//! I've raised an upstream issue to hopefully make this easier in
//! future: https://github.com/ebiggers/libdeflate/issues/62
use std::alloc::*;
use std::mem::{align_of, size_of};
unsafe fn layout_for(size: usize) -> Layout {
Layout::from_size_align_unchecked(size_of::<usize>() + size, align_of::<usize>())
}
#[no_mangle]
pub unsafe extern "C" fn malloc(size: usize) -> *mut u8 {
let size_and_data_ptr = alloc(layout_for(size));
*(size_and_data_ptr as *mut usize) = size;
size_and_data_ptr.add(size_of::<usize>())
}
#[no_mangle]
pub unsafe extern "C" fn free(data_ptr: *mut u8) {
let size_and_data_ptr = data_ptr.sub(size_of::<usize>());
let size = *(size_and_data_ptr as *const usize);
dealloc(size_and_data_ptr, layout_for(size))
}

6
codecs/resize/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
**/*.rs.bk
target
Cargo.lock
bin/
pkg/README.md
lut.inc

37
codecs/resize/Cargo.toml Normal file
View File

@ -0,0 +1,37 @@
[package]
name = "resize"
version = "0.1.0"
authors = ["Surma <surma@surma.link>"]
[lib]
#crate-type = ["cdylib", "rlib"]
crate-type = ["cdylib"]
[features]
default = ["console_error_panic_hook", "wee_alloc"]
[dependencies]
cfg-if = "0.1.2"
wasm-bindgen = "0.2.38"
resize = "0.3.0"
# 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

9
codecs/resize/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM rust
RUN rustup target add wasm32-unknown-unknown
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
RUN mkdir /opt/wabt && \
curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.11/wabt-1.0.11-linux.tar.gz | tar -xzf - -C /opt/wabt --strip 1
ENV PATH="/opt/wabt:${PATH}"
WORKDIR /src

23
codecs/resize/build.rs Normal file
View File

@ -0,0 +1,23 @@
include!("./src/srgb.rs");
use std::io::Write;
fn main() -> std::io::Result<()> {
let mut srgb_to_linear_lut = String::from("static SRGB_TO_LINEAR_LUT: [f32; 256] = [");
let mut linear_to_srgb_lut = String::from("static LINEAR_TO_SRGB_LUT: [f32; 256] = [");
for i in 0..256 {
srgb_to_linear_lut.push_str(&format!("{0:.7}", srgb_to_linear((i as f32) / 255.0)));
srgb_to_linear_lut.push_str(",");
linear_to_srgb_lut.push_str(&format!("{0:.7}", linear_to_srgb((i as f32) / 255.0)));
linear_to_srgb_lut.push_str(",");
}
srgb_to_linear_lut.pop().unwrap();
linear_to_srgb_lut.pop().unwrap();
srgb_to_linear_lut.push_str("];");
linear_to_srgb_lut.push_str("];");
let mut file = std::fs::File::create("src/lut.inc")?;
file.write_all(srgb_to_linear_lut.as_bytes())?;
file.write_all(linear_to_srgb_lut.as_bytes())?;
Ok(())
}

22
codecs/resize/build.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
echo "============================================="
echo "Compiling wasm"
echo "============================================="
(
wasm-pack build
wasm-strip pkg/resize_bg.wasm
rm pkg/.gitignore
)
echo "============================================="
echo "Compiling wasm done"
echo "============================================="
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Did you update your docker image?"
echo "Run \`docker pull ubuntu\`"
echo "Run \`docker pull rust\`"
echo "Run \`docker build -t squoosh-resize .\`"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

4
codecs/resize/package-lock.json generated Normal file
View File

@ -0,0 +1,4 @@
{
"name": "resize",
"lockfileVersion": 1
}

View File

@ -0,0 +1,7 @@
{
"name": "resize",
"scripts": {
"build:image": "docker build -t squoosh-resize .",
"build": "docker run --rm -v $(pwd):/src squoosh-resize ./build.sh"
}
}

View File

@ -0,0 +1,15 @@
{
"name": "resize",
"collaborators": [
"Surma <surma@surma.link>"
],
"version": "0.1.0",
"files": [
"resize_bg.wasm",
"resize.js",
"resize.d.ts"
],
"module": "resize.js",
"types": "resize.d.ts",
"sideEffects": "false"
}

13
codecs/resize/pkg/resize.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
/* tslint:disable */
/**
* @param {Uint8Array} input_image
* @param {number} input_width
* @param {number} input_height
* @param {number} output_width
* @param {number} output_height
* @param {number} typ_idx
* @param {boolean} premultiply
* @param {boolean} color_space_conversion
* @returns {Uint8Array}
*/
export function resize(input_image: Uint8Array, input_width: number, input_height: number, output_width: number, output_height: number, typ_idx: number, premultiply: boolean, color_space_conversion: boolean): Uint8Array;

View File

@ -0,0 +1,50 @@
import * as wasm from './resize_bg.wasm';
let cachegetUint8Memory = null;
function getUint8Memory() {
if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffer) {
cachegetUint8Memory = new Uint8Array(wasm.memory.buffer);
}
return cachegetUint8Memory;
}
let WASM_VECTOR_LEN = 0;
function passArray8ToWasm(arg) {
const ptr = wasm.__wbindgen_malloc(arg.length * 1);
getUint8Memory().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
let cachegetInt32Memory = null;
function getInt32Memory() {
if (cachegetInt32Memory === null || cachegetInt32Memory.buffer !== wasm.memory.buffer) {
cachegetInt32Memory = new Int32Array(wasm.memory.buffer);
}
return cachegetInt32Memory;
}
function getArrayU8FromWasm(ptr, len) {
return getUint8Memory().subarray(ptr / 1, ptr / 1 + len);
}
/**
* @param {Uint8Array} input_image
* @param {number} input_width
* @param {number} input_height
* @param {number} output_width
* @param {number} output_height
* @param {number} typ_idx
* @param {boolean} premultiply
* @param {boolean} color_space_conversion
* @returns {Uint8Array}
*/
export function resize(input_image, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion) {
const retptr = 8;
const ret = wasm.resize(retptr, passArray8ToWasm(input_image), WASM_VECTOR_LEN, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion);
const memi32 = getInt32Memory();
const v0 = getArrayU8FromWasm(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1]).slice();
wasm.__wbindgen_free(memi32[retptr / 4 + 0], memi32[retptr / 4 + 1] * 1);
return v0;
}

5
codecs/resize/pkg/resize_bg.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/* tslint:disable */
export const memory: WebAssembly.Memory;
export function __wbindgen_malloc(a: number): number;
export function __wbindgen_free(a: number, b: number): void;
export function resize(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number): void;

Binary file not shown.

121
codecs/resize/src/lib.rs Normal file
View File

@ -0,0 +1,121 @@
extern crate cfg_if;
extern crate resize;
extern crate wasm_bindgen;
mod utils;
use cfg_if::cfg_if;
use resize::Pixel::RGBA;
use resize::Type;
use wasm_bindgen::prelude::*;
mod srgb;
use srgb::Clamp;
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;
}
}
include!("./lut.inc");
// If `with_space_conversion` is true, this function returns 2 functions that
// convert from sRGB to linear RGB and vice versa. If `with_space_conversion` is
// false, the 2 functions returned do nothing.
fn converter_funcs(with_space_conversion: bool) -> ((fn(u8) -> f32), (fn(f32) -> u8)) {
if with_space_conversion {
(
|v| SRGB_TO_LINEAR_LUT[v as usize] * 255.0,
|v| (LINEAR_TO_SRGB_LUT[v as usize] * 255.0) as u8,
)
} else {
(|v| v as f32, |v| v as u8)
}
}
// If `with_alpha_premultiplication` is true, this function returns a function
// that premultiply the alpha channel with the given channel value and another
// function that reverses that process. If `with_alpha_premultiplication` is
// false, the functions just return the channel value.
fn alpha_multiplier_funcs(
with_alpha_premultiplication: bool,
) -> ((fn(f32, u8) -> u8), (fn(u8, u8) -> f32)) {
if with_alpha_premultiplication {
(
|v, a| (v * (a as f32) / 255.0) as u8,
|v, a| (v as f32) * 255.0 / (a as f32).clamp(0.0, 255.0),
)
} else {
(|v, _a| v as u8, |v, _a| v as f32)
}
}
#[wasm_bindgen]
#[no_mangle]
pub fn resize(
mut input_image: Vec<u8>,
input_width: usize,
input_height: usize,
output_width: usize,
output_height: usize,
typ_idx: usize,
premultiply: bool,
color_space_conversion: bool,
) -> Vec<u8> {
let typ = match typ_idx {
0 => Type::Triangle,
1 => Type::Catrom,
2 => Type::Mitchell,
3 => Type::Lanczos3,
_ => panic!("Nope"),
};
let num_input_pixels = input_width * input_height;
let num_output_pixels = output_width * output_height;
let (to_linear, to_color_space) = converter_funcs(color_space_conversion);
let (premultiplier, demultiplier) = alpha_multiplier_funcs(premultiply);
// If both options are false, there is no preprocessing on the pixel valus
// and we can skip the loop.
if premultiply || color_space_conversion {
for i in 0..num_input_pixels {
for j in 0..3 {
input_image[4 * i + j] =
premultiplier(to_linear(input_image[4 * i + j]), input_image[4 * i + 3]);
}
}
}
let mut resizer = resize::new(
input_width,
input_height,
output_width,
output_height,
RGBA,
typ,
);
let mut output_image = Vec::<u8>::with_capacity(num_output_pixels * 4);
output_image.resize(num_output_pixels * 4, 0);
resizer.resize(input_image.as_slice(), output_image.as_mut_slice());
if premultiply || color_space_conversion {
for i in 0..num_output_pixels {
for j in 0..3 {
// We dont need to worry about division by zero, as division by zero
// is well-defined on floats to return ±Inf. ±Inf is converted to 0
// when casting to integers.
output_image[4 * i + j] = to_color_space(demultiplier(
output_image[4 * i + j],
output_image[4 * i + 3],
));
}
}
}
return output_image;
}

29
codecs/resize/src/srgb.rs Normal file
View File

@ -0,0 +1,29 @@
pub trait Clamp: std::cmp::PartialOrd + Sized {
fn clamp(self, min: Self, max: Self) -> Self {
if self.lt(&min) {
min
} else if self.gt(&max) {
max
} else {
self
}
}
}
impl Clamp for f32 {}
pub fn srgb_to_linear(v: f32) -> f32 {
if v < 0.04045 {
v / 12.92
} else {
((v + 0.055) / 1.055).powf(2.4).clamp(0.0, 1.0)
}
}
pub fn linear_to_srgb(v: f32) -> f32 {
if v < 0.0031308 {
v * 12.92
} else {
(1.055 * v.powf(1.0 / 2.4) - 0.055).clamp(0.0, 1.0)
}
}

View 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() {}
}
}

2
codecs/rotate/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
target
Cargo.lock

14
codecs/rotate/Cargo.toml Normal file
View File

@ -0,0 +1,14 @@
[package]
name = "rotate"
version = "0.1.0"
authors = ["Surma <surma@google.com>"]
edition = "2018"
[lib]
name = "rotate"
path = "rotate.rs"
crate-type = ["cdylib", "rlib"]
[profile.release]
lto = true
opt-level = "s"

8
codecs/rotate/Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM rust
RUN rustup target add wasm32-unknown-unknown
RUN mkdir /opt/wabt && \
curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.11/wabt-1.0.11-linux.tar.gz | tar -xzf - -C /opt/wabt --strip 1
ENV PATH="/opt/wabt:${PATH}"
WORKDIR /src

View File

@ -0,0 +1,45 @@
// THIS IS NOT A NODE SCRIPT
// This is a d8 script. Please install jsvu[1] and install v8.
// Then run `npm run --silent benchmark`.
// [1]: https://github.com/GoogleChromeLabs/jsvu
async function init() {
// Adjustable constants.
const imageDimensions = 4096;
const iterations = new Array(100);
// Constants. Dont change.
const imageByteSize = imageDimensions * imageDimensions * 4;
const wasmPageSize = 64 * 1024;
const buffer = readbuffer("rotate.wasm");
const { instance } = await WebAssembly.instantiate(buffer);
const pagesAvailable = Math.floor(
instance.exports.memory.buffer.byteLength / wasmPageSize
);
const pagesNeeded = Math.floor((imageByteSize * 2 + 4) / wasmPageSize) + 1;
const additionalPagesNeeded = pagesNeeded - pagesAvailable;
if (additionalPagesNeeded > 0) {
instance.exports.memory.grow(additionalPagesNeeded);
}
[0, 90, 180, 270].forEach(rotation => {
print(`\n${rotation} degrees`);
print(`==============================`);
for (let i = 0; i < 100; i++) {
const start = Date.now();
instance.exports.rotate(imageDimensions, imageDimensions, rotation);
iterations[i] = Date.now() - start;
}
const average = iterations.reduce((sum, c) => sum + c) / iterations.length;
const stddev = Math.sqrt(
iterations
.map(i => Math.pow(i - average, 2))
.reduce((sum, c) => sum + c) / iterations.length
);
print(`n = ${iterations.length}`);
print(`Average: ${average}`);
print(`StdDev: ${stddev}`);
});
}
init().catch(e => console.error(e.stack));

24
codecs/rotate/build.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
echo "============================================="
echo "Compiling wasm"
echo "============================================="
(
cargo build \
--target wasm32-unknown-unknown \
--release
cp target/wasm32-unknown-unknown/release/rotate.wasm .
wasm-strip rotate.wasm
)
echo "============================================="
echo "Compiling wasm done"
echo "============================================="
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Did you update your docker image?"
echo "Run \`docker pull ubuntu\`"
echo "Run \`docker pull rust\`"
echo "Run \`docker build -t squoosh-rotate .\`"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

View File

@ -0,0 +1,11 @@
{
"name": "rotate",
"scripts": {
"build:image": "docker build -t squoosh-rotate .",
"build": "docker run --rm -v $(pwd):/src squoosh-rotate ./build.sh",
"benchmark": "echo File size after gzip && npm run benchmark:filesize && echo Optimizing && npm run -s benchmark:optimizing",
"benchmark:baseline": "v8 --liftoff --no-wasm-tier-up --no-opt ./benchmark.js",
"benchmark:optimizing": "v8 --no-liftoff --no-wasm-tier-up ./benchmark.js",
"benchmark:filesize": "cat rotate.wasm | gzip -c9n | wc -c"
}
}

113
codecs/rotate/rotate.rs Normal file
View File

@ -0,0 +1,113 @@
use std::slice::{from_raw_parts, from_raw_parts_mut};
// This function is taken from Zachary Dremann
// https://github.com/GoogleChromeLabs/squoosh/pull/462
trait HardUnwrap<T> {
fn unwrap_hard(self) -> T;
}
impl<T> HardUnwrap<T> for Option<T> {
#[cfg(not(debug_assertions))]
#[inline]
fn unwrap_hard(self) -> T {
match self {
Some(t) => t,
None => std::process::abort(),
}
}
#[cfg(debug_assertions)]
fn unwrap_hard(self) -> T {
self.unwrap()
}
}
const TILE_SIZE: usize = 16;
fn get_buffers<'a>(width: usize, height: usize) -> (&'a [u32], &'a mut [u32]) {
let num_pixels = width * height;
let in_b: &[u32];
let out_b: &mut [u32];
unsafe {
in_b = from_raw_parts::<u32>(8 as *const u32, num_pixels);
out_b = from_raw_parts_mut::<u32>((num_pixels * 4 + 8) as *mut u32, num_pixels);
}
return (in_b, out_b);
}
#[inline(never)]
fn rotate_0(width: usize, height: usize) {
let (in_b, out_b) = get_buffers(width, height);
for (in_p, out_p) in in_b.iter().zip(out_b.iter_mut()) {
*out_p = *in_p;
}
}
#[inline(never)]
fn rotate_90(width: usize, height: usize) {
let (in_b, out_b) = get_buffers(width, height);
let new_width = height;
let _new_height = width;
for y_start in (0..height).step_by(TILE_SIZE) {
for x_start in (0..width).step_by(TILE_SIZE) {
for y in y_start..(y_start + TILE_SIZE).min(height) {
let in_offset = y * width;
let in_bounds = if x_start + TILE_SIZE < width {
(in_offset + x_start)..(in_offset + x_start + TILE_SIZE)
} else {
(in_offset + x_start)..(in_offset + width)
};
let in_chunk = in_b.get(in_bounds).unwrap_hard();
for (x, in_p) in in_chunk.iter().enumerate() {
let new_x = (new_width - 1) - y;
let new_y = x + x_start;
*out_b.get_mut(new_y * new_width + new_x).unwrap_hard() = *in_p;
}
}
}
}
}
#[inline(never)]
fn rotate_180(width: usize, height: usize) {
let (in_b, out_b) = get_buffers(width, height);
for (in_p, out_p) in in_b.iter().zip(out_b.iter_mut().rev()) {
*out_p = *in_p;
}
}
#[inline(never)]
fn rotate_270(width: usize, height: usize) {
let (in_b, out_b) = get_buffers(width, height);
let new_width = height;
let new_height = width;
for y_start in (0..height).step_by(TILE_SIZE) {
for x_start in (0..width).step_by(TILE_SIZE) {
for y in y_start..(y_start + TILE_SIZE).min(height) {
let in_offset = y * width;
let in_bounds = if x_start + TILE_SIZE < width {
(in_offset + x_start)..(in_offset + x_start + TILE_SIZE)
} else {
(in_offset + x_start)..(in_offset + width)
};
let in_chunk = in_b.get(in_bounds).unwrap_hard();
for (x, in_p) in in_chunk.iter().enumerate() {
let new_x = y;
let new_y = new_height - 1 - (x_start + x);
*out_b.get_mut(new_y * new_width + new_x).unwrap_hard() = *in_p;
}
}
}
}
}
#[no_mangle]
fn rotate(width: usize, height: usize, rotate: usize) {
match rotate {
0 => rotate_0(width, height),
90 => rotate_90(width, height),
180 => rotate_180(width, height),
270 => rotate_270(width, height),
_ => std::process::abort(),
}
}

BIN
codecs/rotate/rotate.wasm Executable file

Binary file not shown.

22
codecs/webp_dec/README.md Normal file
View File

@ -0,0 +1,22 @@
# WebP decoder
- Source: <https://github.com/webmproject/libwebp>
- Version: v1.0.2
## Example
See `example.html`
## API
### `int version()`
Returns the version of libwebp as a number. va.b.c is encoded as 0x0a0b0c
### `RawImage decode(std::string buffer)`
Decodes the given webp buffer into raw RGBA. `RawImage` is a class with 3 fields: `buffer`, `width`, and `height`.
### `void free_result()`
Frees the result created by `decode()`.

61
codecs/webp_dec/build.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
set -e
export OPTIMIZE="-Os"
export LDFLAGS="${OPTIMIZE}"
export CFLAGS="${OPTIMIZE}"
export CPPFLAGS="${OPTIMIZE}"
apt-get update
apt-get install -qqy autoconf libtool libpng-dev pkg-config
echo "============================================="
echo "Compiling libwebp"
echo "============================================="
test -n "$SKIP_LIBWEBP" || (
cd node_modules/libwebp
autoreconf -fiv
rm -rf build || true
mkdir -p build && cd build
emconfigure ../configure \
--disable-libwebpdemux \
--disable-wic \
--disable-gif \
--disable-tiff \
--disable-jpeg \
--disable-png \
--disable-sdl \
--disable-gl \
--disable-threading \
--disable-neon-rtcd \
--disable-neon \
--disable-sse2 \
--disable-sse4.1
emmake make -j`nproc`
)
echo "============================================="
echo "Compiling wasm bindings"
echo "============================================="
(
emcc \
${OPTIMIZE} \
--closure 1 \
--bind \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s 'EXPORT_NAME="webp_dec"' \
--std=c++11 \
-I node_modules/libwebp \
-o ./webp_dec.js \
-x c++ \
webp_dec.cpp \
node_modules/libwebp/build/src/.libs/libwebp.a
)
echo "============================================="
echo "Compiling wasm bindings done"
echo "============================================="
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Did you update your docker image?"
echo "Run \`docker pull trzeci/emscripten-upstream\`"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

View File

@ -0,0 +1,24 @@
<!doctype html>
<script src='webp_dec.js'></script>
<script>
const Module = webp_dec();
async function loadFile(src) {
const resp = await fetch(src);
return await resp.arrayBuffer();
}
Module.onRuntimeInitialized = async _ => {
console.log('Version:', Module.version().toString(16));
const image = await loadFile('../example.webp');
const result = Module.decode(image);
const imageData = new ImageData(new Uint8ClampedArray(result.buffer), result.width, result.height);
Module.free_result();
const canvas = document.createElement('canvas');
canvas.width = result.width;
canvas.height = result.height;
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
ctx.putImageData(imageData, 0, 0);
};
</script>

1147
codecs/webp_dec/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
{
"name": "webp_dec",
"scripts": {
"install": "napa",
"build": "docker run --rm -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
},
"napa": {
"libwebp": "webmproject/libwebp#v1.0.2"
},
"devDependencies": {
"napa": "3.0.0"
}
}

View File

@ -0,0 +1,47 @@
#include "emscripten/bind.h"
#include "emscripten/val.h"
#include "src/webp/decode.h"
#include "src/webp/demux.h"
#include <string>
using namespace emscripten;
int version() {
return WebPGetDecoderVersion();
}
class RawImage {
public:
val buffer;
int width;
int height;
RawImage(val b, int w, int h)
: buffer(b), width(w), height(h) {}
};
uint8_t* last_result;
RawImage decode(std::string buffer) {
int width, height;
last_result = WebPDecodeRGBA((const uint8_t*)buffer.c_str(), buffer.size(), &width, &height);
return RawImage(
val(typed_memory_view(width*height*4, last_result)),
width,
height
);
}
void free_result() {
free(last_result);
}
EMSCRIPTEN_BINDINGS(my_module) {
class_<RawImage>("RawImage")
.property("buffer", &RawImage::buffer)
.property("width", &RawImage::width)
.property("height", &RawImage::height);
function("decode", &decode);
function("version", &version);
function("free_result", &free_result);
}

13
codecs/webp_dec/webp_dec.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
interface RawImage {
buffer: Uint8Array;
width: number;
height: number;
}
interface WebPModule extends EmscriptenWasm.Module {
decode(data: BufferSource): RawImage;
free_result(): void;
}
export default function(opts: EmscriptenWasm.ModuleOpts): WebPModule;

View File

@ -0,0 +1,79 @@
var webp_dec = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(webp_dec) {
webp_dec = webp_dec || {};
var e;e||(e=typeof webp_dec !== 'undefined' ? webp_dec : {});var r={},w;for(w in e)e.hasOwnProperty(w)&&(r[w]=e[w]);var aa=!1,z=!1,ba=!1,ca=!1;aa="object"===typeof window;z="function"===typeof importScripts;ba="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ca=!aa&&!ba&&!z;var A="",da,B,ea,ha;
if(ba)A=z?require("path").dirname(A)+"/":__dirname+"/",da=function(a,b){ea||(ea=require("fs"));ha||(ha=require("path"));a=ha.normalize(a);return ea.readFileSync(a,b?null:"utf8")},B=function(a){a=da(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||D("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",D),e.inspect=function(){return"[Emscripten Module object]"};
else if(ca)"undefined"!=typeof read&&(da=function(a){return read(a)}),B=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||D("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(aa||z)z?A=self.location.href:document.currentScript&&(A=document.currentScript.src),_scriptDir&&
(A=_scriptDir),0!==A.indexOf("blob:")?A=A.substr(0,A.lastIndexOf("/")+1):A="",da=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},z&&(B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ia=e.print||console.log.bind(console),E=e.printErr||console.warn.bind(console);for(w in r)r.hasOwnProperty(w)&&(e[w]=r[w]);r=null;var F;e.wasmBinary&&(F=e.wasmBinary);var noExitRuntime;
e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);"object"!==typeof WebAssembly&&E("no native wasm support detected");var G,ja=new WebAssembly.Table({initial:190,maximum:190,element:"anyfunc"}),ka=!1,la="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
function ma(a,b,c){var d=H;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 q=a.charCodeAt(++f);g=65536+((g&1023)<<10)|q&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 na="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
function oa(a){var b;for(b=a>>1;I[b];)++b;b<<=1;if(32<b-a&&na)return na.decode(H.subarray(a,b));b=0;for(var c="";;){var d=I[a+2*b>>1];if(0==d)return c;++b;c+=String.fromCharCode(d)}}function pa(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)I[b>>1]=a.charCodeAt(f),b+=2;I[b>>1]=0;return b-d}function qa(a){return 2*a.length}
function ra(a){for(var b=0,c="";;){var d=J[a+4*b>>2];if(0==d)return c;++b;65536<=d?(d-=65536,c+=String.fromCharCode(55296|d>>10,56320|d&1023)):c+=String.fromCharCode(d)}}function sa(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 q=a.charCodeAt(++f);g=65536+((g&1023)<<10)|q&1023}J[b>>2]=g;b+=4;if(b+4>c)break}J[b>>2]=0;return b-d}
function ta(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 K,ua,H,I,va,J,L,wa,xa;function ya(a){K=a;e.HEAP8=ua=new Int8Array(a);e.HEAP16=I=new Int16Array(a);e.HEAP32=J=new Int32Array(a);e.HEAPU8=H=new Uint8Array(a);e.HEAPU16=va=new Uint16Array(a);e.HEAPU32=L=new Uint32Array(a);e.HEAPF32=wa=new Float32Array(a);e.HEAPF64=xa=new Float64Array(a)}var za=e.INITIAL_MEMORY||16777216;e.wasmMemory?G=e.wasmMemory:G=new WebAssembly.Memory({initial:za/65536});
G&&(K=G.buffer);za=K.byteLength;ya(K);J[3452]=5256848;function Aa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b();else{var c=b.la;"number"===typeof c?void 0===b.ba?e.dynCall_v(c):e.dynCall_vi(c,b.ba):c(void 0===b.ba?null:b.ba)}}}var Ba=[],Ca=[],Da=[],Ea=[];function Fa(){var a=e.preRun.shift();Ba.unshift(a)}var M=0,Ga=null,N=null;e.preloadedImages={};e.preloadedAudios={};
function D(a){if(e.onAbort)e.onAbort(a);ia(a);E(a);ka=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ha(){var a=O;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var O="webp_dec.wasm";if(!Ha()){var Ia=O;O=e.locateFile?e.locateFile(Ia,A):A+Ia}
function Ja(){try{if(F)return new Uint8Array(F);if(B)return B(O);throw"both async and sync fetching of the wasm failed";}catch(a){D(a)}}function Ka(){return F||!aa&&!z||"function"!==typeof fetch?new Promise(function(a){a(Ja())}):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 Ja()})}Ca.push({la:function(){La()}});
function Ma(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 Na=void 0;function P(a){for(var b="";H[a];)b+=Na[H[a++]];return b}var Q={},R={},Oa={};function Pa(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 Qa(a,b){a=Pa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ra(a){var b=Error,c=Qa(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 Sa=void 0;function S(a){throw new Sa(a);}var Ta=void 0;function Ua(a){throw new Ta(a);}function Va(a,b,c){function d(h){h=c(h);h.length!==a.length&&Ua("Mismatched type converter count");for(var l=0;l<a.length;++l)T(a[l],h[l])}a.forEach(function(h){Oa[h]=b});var f=Array(b.length),g=[],q=0;b.forEach(function(h,l){R.hasOwnProperty(h)?f[l]=R[h]:(g.push(h),Q.hasOwnProperty(h)||(Q[h]=[]),Q[h].push(function(){f[l]=R[h];++q;q===g.length&&d(f)}))});0===g.length&&d(f)}
function T(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(R.hasOwnProperty(a)){if(c.oa)return;S("Cannot register type '"+d+"' twice")}R[a]=b;delete Oa[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}function Wa(a){return{count:a.count,X:a.X,Y:a.Y,M:a.M,O:a.O,P:a.P,R:a.R}}
function Xa(a){S(a.L.O.N.name+" instance already deleted")}var Ya=!1;function Za(){}function $a(a){--a.count.value;0===a.count.value&&(a.P?a.R.W(a.P):a.O.N.W(a.M))}function ab(a){if("undefined"===typeof FinalizationGroup)return ab=function(b){return b},a;Ya=new FinalizationGroup(function(b){for(var c=b.next();!c.done;c=b.next())c=c.value,c.M?$a(c):console.warn("object already deleted: "+c.M)});ab=function(b){Ya.register(b,b.L,b.L);return b};Za=function(b){Ya.unregister(b.L)};return ab(a)}
var bb=void 0,cb=[];function db(){for(;cb.length;){var a=cb.pop();a.L.X=!1;a["delete"]()}}function U(){}var eb={};function fb(a,b){var c=e;if(void 0===c[a].T){var d=c[a];c[a]=function(){c[a].T.hasOwnProperty(arguments.length)||S("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+c[a].T+")!");return c[a].T[arguments.length].apply(this,arguments)};c[a].T=[];c[a].T[d.ia]=d}}
function gb(a,b,c){e.hasOwnProperty(a)?((void 0===c||void 0!==e[a].T&&void 0!==e[a].T[c])&&S("Cannot register public name '"+a+"' twice"),fb(a,a),e.hasOwnProperty(c)&&S("Cannot register multiple overloads of a function with the same number of arguments ("+c+")!"),e[a].T[c]=b):(e[a]=b,void 0!==c&&(e[a].ua=c))}function hb(a,b,c,d,f,g,q,h){this.name=a;this.constructor=b;this.V=c;this.W=d;this.S=f;this.ma=g;this.Z=q;this.ka=h}
function ib(a,b,c){for(;b!==c;)b.Z||S("Expected null or instance of "+c.name+", got an instance of "+b.name),a=b.Z(a),b=b.S;return a}function jb(a,b){if(null===b)return this.da&&S("null is not a valid "+this.name),0;b.L||S('Cannot pass "'+V(b)+'" as a '+this.name);b.L.M||S("Cannot pass deleted object as a pointer of type "+this.name);return ib(b.L.M,b.L.O.N,this.N)}
function kb(a,b){if(null===b){this.da&&S("null is not a valid "+this.name);if(this.aa){var c=this.qa();null!==a&&a.push(this.W,c);return c}return 0}b.L||S('Cannot pass "'+V(b)+'" as a '+this.name);b.L.M||S("Cannot pass deleted object as a pointer of type "+this.name);!this.$&&b.L.O.$&&S("Cannot convert argument of type "+(b.L.R?b.L.R.name:b.L.O.name)+" to parameter type "+this.name);c=ib(b.L.M,b.L.O.N,this.N);if(this.aa)switch(void 0===b.L.P&&S("Passing raw pointer to smart pointer is illegal"),this.sa){case 0:b.L.R===
this?c=b.L.P:S("Cannot convert argument of type "+(b.L.R?b.L.R.name:b.L.O.name)+" to parameter type "+this.name);break;case 1:c=b.L.P;break;case 2:if(b.L.R===this)c=b.L.P;else{var d=b.clone();c=this.ra(c,lb(function(){d["delete"]()}));null!==a&&a.push(this.W,c)}break;default:S("Unsupporting sharing policy")}return c}
function mb(a,b){if(null===b)return this.da&&S("null is not a valid "+this.name),0;b.L||S('Cannot pass "'+V(b)+'" as a '+this.name);b.L.M||S("Cannot pass deleted object as a pointer of type "+this.name);b.L.O.$&&S("Cannot convert argument of type "+b.L.O.name+" to parameter type "+this.name);return ib(b.L.M,b.L.O.N,this.N)}function ob(a){return this.fromWireType(L[a>>2])}function pb(a,b,c){if(b===c)return a;if(void 0===c.S)return null;a=pb(a,b,c.S);return null===a?null:c.ka(a)}var qb={};
function rb(a,b){for(void 0===b&&S("ptr should not be undefined");a.S;)b=a.Z(b),a=a.S;return qb[b]}function sb(a,b){b.O&&b.M||Ua("makeClassHandle requires ptr and ptrType");!!b.R!==!!b.P&&Ua("Both smartPtrType and smartPtr must be specified");b.count={value:1};return ab(Object.create(a,{L:{value:b}}))}function W(a,b,c,d){this.name=a;this.N=b;this.da=c;this.$=d;this.aa=!1;this.W=this.ra=this.qa=this.ha=this.sa=this.pa=void 0;void 0!==b.S?this.toWireType=kb:(this.toWireType=d?jb:mb,this.U=null)}
function tb(a,b,c){e.hasOwnProperty(a)||Ua("Replacing nonexistant public symbol");void 0!==e[a].T&&void 0!==c?e[a].T[c]=b:(e[a]=b,e[a].ia=c)}
function X(a,b){a=P(a);var c=e["dynCall_"+a];for(var d=[],f=1;f<a.length;++f)d.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+d.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(d.length?", ":"")+d.join(", ")+");\n";c=(new Function("dynCall","rawFunction",f+"};\n"))(c,b);"function"!==typeof c&&S("unknown function pointer with signature "+a+": "+b);return c}var ub=void 0;function vb(a){a=wb(a);var b=P(a);Y(a);return b}
function xb(a,b){function c(g){f[g]||R[g]||(Oa[g]?Oa[g].forEach(c):(d.push(g),f[g]=!0))}var d=[],f={};b.forEach(c);throw new ub(a+": "+d.map(vb).join([", "]));}function yb(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function zb(a,b,c){a instanceof Object||S(c+' with invalid "this": '+a);a instanceof b.N.constructor||S(c+' incompatible with "this" of type '+a.constructor.name);a.L.M||S("cannot call emscripten binding method "+c+" on deleted object");return ib(a.L.M,a.L.O.N,b.N)}
var Ab=[],Z=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Bb(a){4<a&&0===--Z[a].ea&&(Z[a]=void 0,Ab.push(a))}function lb(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Ab.length?Ab.pop():Z.length;Z[b]={ea:1,value:a};return b}}function V(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){return this.fromWireType(wa[c>>2])};case 3:return function(c){return this.fromWireType(xa[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=Qa(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){for(var c=[],d=0;d<a;d++)c.push(J[(b>>2)+d]);return c}function Fb(a,b,c){switch(b){case 0:return c?function(d){return ua[d]}:function(d){return H[d]};case 1:return c?function(d){return I[d>>1]}:function(d){return va[d>>1]};case 2:return c?function(d){return J[d>>2]}:function(d){return L[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}for(var Gb=Array(256),Hb=0;256>Hb;++Hb)Gb[Hb]=String.fromCharCode(Hb);Na=Gb;Sa=e.BindingError=Ra("BindingError");
Ta=e.InternalError=Ra("InternalError");U.prototype.isAliasOf=function(a){if(!(this instanceof U&&a instanceof U))return!1;var b=this.L.O.N,c=this.L.M,d=a.L.O.N;for(a=a.L.M;b.S;)c=b.Z(c),b=b.S;for(;d.S;)a=d.Z(a),d=d.S;return b===d&&c===a};U.prototype.clone=function(){this.L.M||Xa(this);if(this.L.Y)return this.L.count.value+=1,this;var a=ab(Object.create(Object.getPrototypeOf(this),{L:{value:Wa(this.L)}}));a.L.count.value+=1;a.L.X=!1;return a};
U.prototype["delete"]=function(){this.L.M||Xa(this);this.L.X&&!this.L.Y&&S("Object already scheduled for deletion");Za(this);$a(this.L);this.L.Y||(this.L.P=void 0,this.L.M=void 0)};U.prototype.isDeleted=function(){return!this.L.M};U.prototype.deleteLater=function(){this.L.M||Xa(this);this.L.X&&!this.L.Y&&S("Object already scheduled for deletion");cb.push(this);1===cb.length&&bb&&bb(db);this.L.X=!0;return this};W.prototype.na=function(a){this.ha&&(a=this.ha(a));return a};
W.prototype.ga=function(a){this.W&&this.W(a)};W.prototype.argPackAdvance=8;W.prototype.readValueFromPointer=ob;W.prototype.deleteObject=function(a){if(null!==a)a["delete"]()};
W.prototype.fromWireType=function(a){function b(){return this.aa?sb(this.N.V,{O:this.pa,M:c,R:this,P:a}):sb(this.N.V,{O:this,M:a})}var c=this.na(a);if(!c)return this.ga(a),null;var d=rb(this.N,c);if(void 0!==d){if(0===d.L.count.value)return d.L.M=c,d.L.P=a,d.clone();d=d.clone();this.ga(a);return d}d=this.N.ma(c);d=eb[d];if(!d)return b.call(this);d=this.$?d.ja:d.pointerType;var f=pb(c,this.N,d.N);return null===f?b.call(this):this.aa?sb(d.N.V,{O:d,M:f,R:this,P:a}):sb(d.N.V,{O:d,M:f})};
e.getInheritedInstanceCount=function(){return Object.keys(qb).length};e.getLiveInheritedInstances=function(){var a=[],b;for(b in qb)qb.hasOwnProperty(b)&&a.push(qb[b]);return a};e.flushPendingDeletes=db;e.setDelayFunction=function(a){bb=a;cb.length&&bb&&bb(db)};ub=e.UnboundTypeError=Ra("UnboundTypeError");e.count_emval_handles=function(){for(var a=0,b=5;b<Z.length;++b)void 0!==Z[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<Z.length;++a)if(void 0!==Z[a])return Z[a];return null};
var Jb={j:function(a,b,c,d,f){var g=Ma(c);b=P(b);T(a,{name:b,fromWireType:function(q){return!!q},toWireType:function(q,h){return h?d:f},argPackAdvance:8,readValueFromPointer:function(q){if(1===c)var h=ua;else if(2===c)h=I;else if(4===c)h=J;else throw new TypeError("Unknown boolean type size: "+b);return this.fromWireType(h[q>>g])},U:null})},n:function(a,b,c,d,f,g,q,h,l,m,k,p,t){k=P(k);g=X(f,g);h&&(h=X(q,h));m&&(m=X(l,m));t=X(p,t);var v=Pa(k);gb(v,function(){xb("Cannot construct "+k+" due to unbound types",
[d])});Va([a,b,c],d?[d]:[],function(n){n=n[0];if(d){var u=n.N;var x=u.V}else x=U.prototype;n=Qa(v,function(){if(Object.getPrototypeOf(this)!==y)throw new Sa("Use 'new' to construct "+k);if(void 0===C.fa)throw new Sa(k+" has no accessible constructor");var nb=C.fa[arguments.length];if(void 0===nb)throw new Sa("Tried to invoke ctor of "+k+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(C.fa).toString()+") parameters instead!");return nb.apply(this,arguments)});var y=
Object.create(x,{constructor:{value:n}});n.prototype=y;var C=new hb(k,n,y,t,u,g,h,m);u=new W(k,C,!0,!1);x=new W(k+"*",C,!1,!1);var fa=new W(k+" const*",C,!1,!0);eb[a]={pointerType:x,ja:fa};tb(v,n);return[u,x,fa]})},d:function(a,b,c,d,f,g,q,h,l,m){b=P(b);f=X(d,f);Va([],[a],function(k){k=k[0];var p=k.name+"."+b,t={get:function(){xb("Cannot access "+p+" due to unbound types",[c,q])},enumerable:!0,configurable:!0};l?t.set=function(){xb("Cannot access "+p+" due to unbound types",[c,q])}:t.set=function(){S(p+
" is a read-only property")};Object.defineProperty(k.N.V,b,t);Va([],l?[c,q]:[c],function(v){var n=v[0],u={get:function(){var y=zb(this,k,p+" getter");return n.fromWireType(f(g,y))},enumerable:!0};if(l){l=X(h,l);var x=v[1];u.set=function(y){var C=zb(this,k,p+" setter"),fa=[];l(m,C,x.toWireType(fa,y));yb(fa)}}Object.defineProperty(k.N.V,b,u);return[]});return[]})},r:function(a,b){b=P(b);T(a,{name:b,fromWireType:function(c){var d=Z[c].value;Bb(c);return d},toWireType:function(c,d){return lb(d)},argPackAdvance:8,
readValueFromPointer:ob,U:null})},g:function(a,b,c){c=Ma(c);b=P(b);T(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+V(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Cb(b,c),U:null})},c:function(a,b,c,d,f,g){var q=Eb(b,c);a=P(a);f=X(d,f);gb(a,function(){xb("Cannot call "+a+" due to unbound types",q)},b-1);Va([],q,function(h){var l=[h[0],null].concat(h.slice(1)),m=h=a,k=
f,p=l.length;2>p&&S("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var t=null!==l[1]&&!1,v=!1,n=1;n<l.length;++n)if(null!==l[n]&&void 0===l[n].U){v=!0;break}var u="void"!==l[0].name,x="",y="";for(n=0;n<p-2;++n)x+=(0!==n?", ":"")+"arg"+n,y+=(0!==n?", ":"")+"arg"+n+"Wired";m="return function "+Pa(m)+"("+x+") {\nif (arguments.length !== "+(p-2)+") {\nthrowBindingError('function "+m+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";
v&&(m+="var destructors = [];\n");var C=v?"destructors":"null";x="throwBindingError invoker fn runDestructors retType classParam".split(" ");k=[S,k,g,yb,l[0],l[1]];t&&(m+="var thisWired = classParam.toWireType("+C+", this);\n");for(n=0;n<p-2;++n)m+="var arg"+n+"Wired = argType"+n+".toWireType("+C+", arg"+n+"); // "+l[n+2].name+"\n",x.push("argType"+n),k.push(l[n+2]);t&&(y="thisWired"+(0<y.length?", ":"")+y);m+=(u?"var rv = ":"")+"invoker(fn"+(0<y.length?", ":"")+y+");\n";if(v)m+="runDestructors(destructors);\n";
else for(n=t?1:2;n<l.length;++n)p=1===n?"thisWired":"arg"+(n-2)+"Wired",null!==l[n].U&&(m+=p+"_dtor("+p+"); // "+l[n].name+"\n",x.push(p+"_dtor"),k.push(l[n].U));u&&(m+="var ret = retType.fromWireType(rv);\nreturn ret;\n");x.push(m+"}\n");l=Db(x).apply(null,k);tb(h,l,b-1);return[]})},b:function(a,b,c,d,f){function g(m){return m}b=P(b);-1===f&&(f=4294967295);var q=Ma(c);if(0===d){var h=32-8*c;g=function(m){return m<<h>>>h}}var l=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(m,
k){if("number"!==typeof k&&"boolean"!==typeof k)throw new TypeError('Cannot convert "'+V(k)+'" to '+this.name);if(k<d||k>f)throw new TypeError('Passing a number "'+V(k)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return l?k>>>0:k|0},argPackAdvance:8,readValueFromPointer:Fb(b,q,0!==d),U:null})},a:function(a,b,c){function d(g){g>>=2;var q=L;return new f(K,q[g+1],q[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,
Float32Array,Float64Array][b];c=P(c);T(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{oa:!0})},f:function(a,b){b=P(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(d){var f=L[d>>2];if(c){var g=H[d+4+f],q=0;0!=g&&(q=g,H[d+4+f]=0);var h=d+4;for(g=0;g<=f;++g){var l=d+4+g;if(0==H[l]){if(h){for(var m=H,k=h+NaN,p=h;m[p]&&!(p>=k);)++p;if(16<p-h&&m.subarray&&la)h=la.decode(m.subarray(h,p));else{for(k="";h<p;){var t=m[h++];if(t&128){var v=m[h++]&63;if(192==(t&224))k+=String.fromCharCode((t&
31)<<6|v);else{var n=m[h++]&63;t=224==(t&240)?(t&15)<<12|v<<6|n:(t&7)<<18|v<<12|n<<6|m[h++]&63;65536>t?k+=String.fromCharCode(t):(t-=65536,k+=String.fromCharCode(55296|t>>10,56320|t&1023))}}else k+=String.fromCharCode(t)}h=k}}else h="";if(void 0===u)var u=h;else u+=String.fromCharCode(0),u+=h;h=l+1}}0!=q&&(H[d+4+f]=q)}else{u=Array(f);for(g=0;g<f;++g)u[g]=String.fromCharCode(H[d+4+g]);u=u.join("")}Y(d);return u},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 q=(c&&g?function(){for(var m=0,k=0;k<f.length;++k){var p=f.charCodeAt(k);55296<=p&&57343>=p&&(p=65536+((p&1023)<<10)|f.charCodeAt(++k)&1023);127>=p?++m:m=2047>=p?m+2:65535>=p?m+3:m+4}return m}:function(){return f.length})(),h=Ib(4+q+1);L[h>>2]=q;if(c&&g)ma(f,h+4,q+1);else if(g)for(g=0;g<q;++g){var l=f.charCodeAt(g);255<l&&(Y(h),S("String has UTF-16 code units that do not fit in 8 bits"));
H[h+4+g]=l}else for(g=0;g<q;++g)H[h+4+g]=f[g];null!==d&&d.push(Y,h);return h},argPackAdvance:8,readValueFromPointer:ob,U:function(d){Y(d)}})},e:function(a,b,c){c=P(c);if(2===b){var d=oa;var f=pa;var g=qa;var q=function(){return va};var h=1}else 4===b&&(d=ra,f=sa,g=ta,q=function(){return L},h=2);T(a,{name:c,fromWireType:function(l){var m=L[l>>2],k=q(),p=k[l+4+m*b>>h],t=0;0!=p&&(t=p,k[l+4+m*b>>h]=0);var v=l+4;for(p=0;p<=m;++p){var n=l+4+p*b;if(0==k[n>>h]){v=d(v);if(void 0===u)var u=v;else u+=String.fromCharCode(0),
u+=v;v=n+b}}0!=t&&(k[l+4+m*b>>h]=t);Y(l);return u},toWireType:function(l,m){"string"!==typeof m&&S("Cannot pass non-string to C++ string type "+c);var k=g(m),p=Ib(4+k+b);L[p>>2]=k>>h;f(m,p+4,k+b);null!==l&&l.push(Y,p);return p},argPackAdvance:8,readValueFromPointer:ob,U:function(l){Y(l)}})},k:function(a,b){b=P(b);T(a,{ta:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},h:Bb,m:function(a){4<a&&(Z[a].ea+=1)},i:function(a,b){var c=R[a];void 0===c&&S("_emval_take_value has unknown type "+
vb(a));a=c.readValueFromPointer(b);return lb(a)},l:function(){D()},p:function(a,b,c){H.copyWithin(a,b,b+c)},q:function(a){var b=H.length;if(2147418112<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(16777216,a,d);0<d%65536&&(d+=65536-d%65536);a:{try{G.grow(Math.min(2147418112,d)-K.byteLength+65535>>16);ya(G.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:G,o:function(){},table:ja},Kb=function(){function a(f){e.asm=f.exports;M--;e.monitorRunDependencies&&
e.monitorRunDependencies(M);0==M&&(null!==Ga&&(clearInterval(Ga),Ga=null),N&&(f=N,N=null,f()))}function b(f){a(f.instance)}function c(f){return Ka().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){E("failed to asynchronously prepare wasm: "+g);D(g)})}var d={a:Jb};M++;e.monitorRunDependencies&&e.monitorRunDependencies(M);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return E("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(F||"function"!==
typeof WebAssembly.instantiateStreaming||Ha()||"function"!==typeof fetch)return c(b);fetch(O,{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");c(b)})})})();return{}}();e.asm=Kb;
var La=e.___wasm_call_ctors=function(){return(La=e.___wasm_call_ctors=e.asm.s).apply(null,arguments)},Y=e._free=function(){return(Y=e._free=e.asm.t).apply(null,arguments)},Ib=e._malloc=function(){return(Ib=e._malloc=e.asm.u).apply(null,arguments)},wb=e.___getTypeName=function(){return(wb=e.___getTypeName=e.asm.v).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.w).apply(null,arguments)};
e.dynCall_ii=function(){return(e.dynCall_ii=e.asm.x).apply(null,arguments)};e.dynCall_vi=function(){return(e.dynCall_vi=e.asm.y).apply(null,arguments)};e.dynCall_iii=function(){return(e.dynCall_iii=e.asm.z).apply(null,arguments)};e.dynCall_viii=function(){return(e.dynCall_viii=e.asm.A).apply(null,arguments)};e.dynCall_vii=function(){return(e.dynCall_vii=e.asm.B).apply(null,arguments)};e.dynCall_i=function(){return(e.dynCall_i=e.asm.C).apply(null,arguments)};
e.dynCall_v=function(){return(e.dynCall_v=e.asm.D).apply(null,arguments)};e.dynCall_iiii=function(){return(e.dynCall_iiii=e.asm.E).apply(null,arguments)};e.dynCall_iiiiiii=function(){return(e.dynCall_iiiiiii=e.asm.F).apply(null,arguments)};e.dynCall_viiii=function(){return(e.dynCall_viiii=e.asm.G).apply(null,arguments)};e.dynCall_viiiiii=function(){return(e.dynCall_viiiiii=e.asm.H).apply(null,arguments)};e.dynCall_viiiii=function(){return(e.dynCall_viiiii=e.asm.I).apply(null,arguments)};
e.dynCall_viiiiiiiii=function(){return(e.dynCall_viiiiiiiii=e.asm.J).apply(null,arguments)};e.dynCall_jiiii=function(){return(e.dynCall_jiiii=e.asm.K).apply(null,arguments)};e.asm=Kb;var Lb;e.then=function(a){if(Lb)a(e);else{var b=e.onRuntimeInitialized;e.onRuntimeInitialized=function(){b&&b();a(e)}}return e};N=function Mb(){Lb||Nb();Lb||(N=Mb)};
function Nb(){function a(){if(!Lb&&(Lb=!0,e.calledRun=!0,!ka)){Aa(Ca);Aa(Da);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();Ea.unshift(b)}Aa(Ea)}}if(!(0<M)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)Fa();Aa(Ba);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()();noExitRuntime=!0;Nb();
return webp_dec
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = webp_dec;
else if (typeof define === 'function' && define['amd'])
define([], function() { return webp_dec; });
else if (typeof exports === 'object')
exports["webp_dec"] = webp_dec;

Binary file not shown.

26
codecs/webp_enc/README.md Normal file
View File

@ -0,0 +1,26 @@
# WebP encoder
- Source: <https://github.com/webmproject/libwebp>
- Version: v1.0.2
## Dependencies
- Docker
## Example
See `example.html`
## API
### `int version()`
Returns the version of libwebp as a number. va.b.c is encoded as 0x0a0b0c
### `UInt8Array encode(uint8_t* image_buffer, int image_width, int image_height, WebPConfig config)`
Encodes the given image with given dimension to WebP.
### `void free_result()`
Frees the last result created by `encode()`.

62
codecs/webp_enc/build.sh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/bash
set -e
export OPTIMIZE="-Os"
export LDFLAGS="${OPTIMIZE}"
export CFLAGS="${OPTIMIZE}"
export CPPFLAGS="${OPTIMIZE}"
apt-get update
apt-get install -qqy autoconf libtool libpng-dev pkg-config
echo "============================================="
echo "Compiling libwebp"
echo "============================================="
test -n "$SKIP_LIBWEBP" || (
cd node_modules/libwebp
autoreconf -fiv
rm -rf build || true
mkdir -p build && cd build
emconfigure ../configure \
--disable-libwebpdemux \
--disable-wic \
--disable-gif \
--disable-tiff \
--disable-jpeg \
--disable-png \
--disable-sdl \
--disable-gl \
--disable-threading \
--disable-neon-rtcd \
--disable-neon \
--disable-sse2 \
--disable-sse4.1
emmake make -j`nproc`
)
echo "============================================="
echo "Compiling wasm bindings"
echo "============================================="
(
emcc \
${OPTIMIZE} \
--closure 1 \
--bind \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s 'EXPORT_NAME="webp_enc"' \
--std=c++11 \
-I node_modules/libwebp \
-o ./webp_enc.js \
-x c++ \
webp_enc.cpp \
node_modules/libwebp/build/src/.libs/libwebp.a
)
echo "============================================="
echo "Compiling wasm bindings done"
echo "============================================="
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "Did you update your docker image?"
echo "Run \`docker pull trzeci/emscripten-upstream\`"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

View File

@ -0,0 +1,62 @@
<!doctype html>
<script src='webp_enc.js'></script>
<script>
const module = webp_enc();
async function loadImage(src) {
// Load image
const img = document.createElement('img');
img.src = src;
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];
// Draw image onto canvas
const ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
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 result = module.encode(image.data, image.width, image.height, {
quality: 75,
target_size: 0,
target_PSNR: 0,
method: 4,
sns_strength: 50,
filter_strength: 60,
filter_sharpness: 0,
filter_type: 1,
partitions: 0,
segments: 4,
pass: 1,
show_compressed: 0,
preprocessing: 0,
autofilter: 0,
partition_limit: 0,
alpha_compression: 1,
alpha_filtering: 1,
alpha_quality: 100,
lossless: 0,
exact: 0,
image_hint: 0,
emulate_jpeg_size: 0,
thread_level: 0,
low_memory: 0,
near_lossless: 100,
use_delta_palette: 0,
use_sharp_yuv: 0,
});
console.log('size', result.length);
const blob = new Blob([result], {type: 'image/webp'});
module.free_result();
const blobURL = URL.createObjectURL(blob);
const img = document.createElement('img');
img.src = blobURL;
document.body.appendChild(img);
};
</script>

1147
codecs/webp_enc/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
{
"name": "webp_enc",
"scripts": {
"install": "napa",
"build": "docker run --rm -v $(pwd):/src trzeci/emscripten-upstream ./build.sh"
},
"napa": {
"libwebp": "webmproject/libwebp#v1.0.2"
},
"devDependencies": {
"napa": "3.0.0"
}
}

View File

@ -0,0 +1,96 @@
#include <emscripten/bind.h>
#include <emscripten/val.h>
#include "src/webp/encode.h"
#include <stdlib.h>
#include <string.h>
#include <stdexcept>
using namespace emscripten;
int version() {
return WebPGetEncoderVersion();
}
uint8_t* last_result;
val encode(std::string img, int width, int height, WebPConfig config) {
uint8_t* img_in = (uint8_t*) img.c_str();
// A lot of this is duplicated from Encode in picture_enc.c
WebPPicture pic;
WebPMemoryWriter wrt;
int ok;
if (!WebPPictureInit(&pic)) {
// shouldn't happen, except if system installation is broken
throw std::runtime_error("Unexpected error");
}
// Only use use_argb if we really need it, as it's slower.
pic.use_argb = config.lossless || config.use_sharp_yuv || config.preprocessing > 0;
pic.width = width;
pic.height = height;
pic.writer = WebPMemoryWrite;
pic.custom_ptr = &wrt;
WebPMemoryWriterInit(&wrt);
ok = WebPPictureImportRGBA(&pic, (uint8_t*) img_in, width * 4) && WebPEncode(&config, &pic);
WebPPictureFree(&pic);
if (!ok) {
WebPMemoryWriterClear(&wrt);
throw std::runtime_error("Encode failed");
}
last_result = wrt.mem;
return val(typed_memory_view(wrt.size, wrt.mem));
}
void free_result() {
WebPFree(last_result);
}
EMSCRIPTEN_BINDINGS(my_module) {
enum_<WebPImageHint>("WebPImageHint")
.value("WEBP_HINT_DEFAULT", WebPImageHint::WEBP_HINT_DEFAULT)
.value("WEBP_HINT_PICTURE", WebPImageHint::WEBP_HINT_PICTURE)
.value("WEBP_HINT_PHOTO", WebPImageHint::WEBP_HINT_PHOTO)
.value("WEBP_HINT_GRAPH", WebPImageHint::WEBP_HINT_GRAPH)
;
value_object<WebPConfig>("WebPConfig")
.field("lossless", &WebPConfig::lossless)
.field("quality", &WebPConfig::quality)
.field("method", &WebPConfig::method)
.field("image_hint", &WebPConfig::image_hint)
.field("target_size", &WebPConfig::target_size)
.field("target_PSNR", &WebPConfig::target_PSNR)
.field("segments", &WebPConfig::segments)
.field("sns_strength", &WebPConfig::sns_strength)
.field("filter_strength", &WebPConfig::filter_strength)
.field("filter_sharpness", &WebPConfig::filter_sharpness)
.field("filter_type", &WebPConfig::filter_type)
.field("autofilter", &WebPConfig::autofilter)
.field("alpha_compression", &WebPConfig::alpha_compression)
.field("alpha_filtering", &WebPConfig::alpha_filtering)
.field("alpha_quality", &WebPConfig::alpha_quality)
.field("pass", &WebPConfig::pass)
.field("show_compressed", &WebPConfig::show_compressed)
.field("preprocessing", &WebPConfig::preprocessing)
.field("partitions", &WebPConfig::partitions)
.field("partition_limit", &WebPConfig::partition_limit)
.field("emulate_jpeg_size", &WebPConfig::emulate_jpeg_size)
.field("thread_level", &WebPConfig::thread_level)
.field("low_memory", &WebPConfig::low_memory)
.field("near_lossless", &WebPConfig::near_lossless)
.field("exact", &WebPConfig::exact)
.field("use_delta_palette", &WebPConfig::use_delta_palette)
.field("use_sharp_yuv", &WebPConfig::use_sharp_yuv)
;
function("version", &version);
function("encode", &encode);
function("free_result", &free_result);
}

9
codecs/webp_enc/webp_enc.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
import { EncodeOptions } from '../../src/codecs/webp/encoder-meta';
interface WebPModule extends EmscriptenWasm.Module {
encode(data: BufferSource, width: number, height: number, options: EncodeOptions): Uint8Array;
free_result(): void;
}
export default function(opts: EmscriptenWasm.ModuleOpts): WebPModule;

View File

@ -0,0 +1,72 @@
var webp_enc = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(webp_enc) {
webp_enc = webp_enc || {};
var c;c||(c=typeof webp_enc !== 'undefined' ? webp_enc : {});var u={},w;for(w in c)c.hasOwnProperty(w)&&(u[w]=c[w]);var x=!1,y=!1,aa=!1,ba=!1;x="object"===typeof window;y="function"===typeof importScripts;aa="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;ba=!x&&!aa&&!y;var z="",B,C,ca,da;
if(aa)z=y?require("path").dirname(z)+"/":__dirname+"/",B=function(a,b){ca||(ca=require("fs"));da||(da=require("path"));a=da.normalize(a);return ca.readFileSync(a,b?null:"utf8")},C=function(a){a=B(a,!0);a.buffer||(a=new Uint8Array(a));a.buffer||D("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",D),c.inspect=function(){return"[Emscripten Module object]"};
else if(ba)"undefined"!=typeof read&&(B=function(a){return read(a)}),C=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||D("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(x||y)y?z=self.location.href:document.currentScript&&(z=document.currentScript.src),_scriptDir&&
(z=_scriptDir),0!==z.indexOf("blob:")?z=z.substr(0,z.lastIndexOf("/")+1):z="",B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},y&&(C=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ea=c.print||console.log.bind(console),E=c.printErr||console.warn.bind(console);for(w in u)u.hasOwnProperty(w)&&(c[w]=u[w]);u=null;var F;c.wasmBinary&&(F=c.wasmBinary);var noExitRuntime;
c.noExitRuntime&&(noExitRuntime=c.noExitRuntime);"object"!==typeof WebAssembly&&E("no native wasm support detected");var G,fa=new WebAssembly.Table({initial:225,maximum:225,element:"anyfunc"}),ha=!1,ia="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
function ja(a,b,d){var e=I;if(0<d){d=b+d-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}if(127>=g){if(b>=d)break;e[b++]=g}else{if(2047>=g){if(b+1>=d)break;e[b++]=192|g>>6}else{if(65535>=g){if(b+2>=d)break;e[b++]=224|g>>12}else{if(b+3>=d)break;e[b++]=240|g>>18;e[b++]=128|g>>12&63}e[b++]=128|g>>6&63}e[b++]=128|g&63}}e[b]=0}}var ka="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0;
function la(a){var b;for(b=a>>1;J[b];)++b;b<<=1;if(32<b-a&&ka)return ka.decode(I.subarray(a,b));b=0;for(var d="";;){var e=J[a+2*b>>1];if(0==e)return d;++b;d+=String.fromCharCode(e)}}function ma(a,b,d){void 0===d&&(d=2147483647);if(2>d)return 0;d-=2;var e=b;d=d<2*a.length?d/2:a.length;for(var f=0;f<d;++f)J[b>>1]=a.charCodeAt(f),b+=2;J[b>>1]=0;return b-e}function na(a){return 2*a.length}
function oa(a){for(var b=0,d="";;){var e=K[a+4*b>>2];if(0==e)return d;++b;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}}function pa(a,b,d){void 0===d&&(d=2147483647);if(4>d)return 0;var e=b;d=e+d-4;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}K[b>>2]=g;b+=4;if(b+4>d)break}K[b>>2]=0;return b-e}
function qa(a){for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);55296<=e&&57343>=e&&++d;b+=4}return b}var L,ra,I,J,sa,K,M,ta,ua;function va(a){L=a;c.HEAP8=ra=new Int8Array(a);c.HEAP16=J=new Int16Array(a);c.HEAP32=K=new Int32Array(a);c.HEAPU8=I=new Uint8Array(a);c.HEAPU16=sa=new Uint16Array(a);c.HEAPU32=M=new Uint32Array(a);c.HEAPF32=ta=new Float32Array(a);c.HEAPF64=ua=new Float64Array(a)}var wa=c.INITIAL_MEMORY||16777216;c.wasmMemory?G=c.wasmMemory:G=new WebAssembly.Memory({initial:wa/65536});
G&&(L=G.buffer);wa=L.byteLength;va(L);K[8784]=5278176;function xa(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b();else{var d=b.ha;"number"===typeof d?void 0===b.aa?c.dynCall_v(d):c.dynCall_vi(d,b.aa):d(void 0===b.aa?null:b.aa)}}}var ya=[],za=[],Aa=[],Ba=[];function Ca(){var a=c.preRun.shift();ya.unshift(a)}var N=0,Da=null,O=null;c.preloadedImages={};c.preloadedAudios={};
function D(a){if(c.onAbort)c.onAbort(a);ea(a);E(a);ha=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function Ea(){var a=P;return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,")}var P="webp_enc.wasm";if(!Ea()){var Fa=P;P=c.locateFile?c.locateFile(Fa,z):z+Fa}
function Ga(){try{if(F)return new Uint8Array(F);if(C)return C(P);throw"both async and sync fetching of the wasm failed";}catch(a){D(a)}}function Ha(){return F||!x&&!y||"function"!==typeof fetch?new Promise(function(a){a(Ga())}):fetch(P,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+P+"'";return a.arrayBuffer()}).catch(function(){return Ga()})}za.push({ha:function(){Ia()}});function Ja(){return 0<Ja.da}var Ka={};
function La(a){for(;a.length;){var b=a.pop();a.pop()(b)}}function Ma(a){return this.fromWireType(M[a>>2])}var Q={},R={},Na={};function Oa(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 Pa(a,b){a=Oa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}
function Qa(a){var b=Error,d=Pa(a,function(e){this.name=a;this.message=e;e=Error(e).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))});d.prototype=Object.create(b.prototype);d.prototype.constructor=d;d.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return d}var Ra=void 0;
function Sa(a,b,d){function e(h){h=d(h);if(h.length!==a.length)throw new Ra("Mismatched type converter count");for(var k=0;k<a.length;++k)S(a[k],h[k])}a.forEach(function(h){Na[h]=b});var f=Array(b.length),g=[],n=0;b.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];++n;n===g.length&&e(f)}))});0===g.length&&e(f)}
function Ta(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 Ua=void 0;function T(a){for(var b="";I[a];)b+=Ua[I[a++]];return b}var Va=void 0;function U(a){throw new Va(a);}
function S(a,b,d){d=d||{};if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=b.name;a||U('type "'+e+'" must have a positive integer typeid pointer');if(R.hasOwnProperty(a)){if(d.la)return;U("Cannot register type '"+e+"' twice")}R[a]=b;delete Na[a];Q.hasOwnProperty(a)&&(b=Q[a],delete Q[a],b.forEach(function(f){f()}))}var Wa=[],V=[{},{value:void 0},{value:null},{value:!0},{value:!1}];
function Xa(a){4<a&&0===--V[a].ba&&(V[a]=void 0,Wa.push(a))}function Ya(a){switch(a){case void 0:return 1;case null:return 2;case !0:return 3;case !1:return 4;default:var b=Wa.length?Wa.pop():V.length;V[b]={ba:1,value:a};return b}}
function Za(a,b){var d=c;if(void 0===d[a].$){var e=d[a];d[a]=function(){d[a].$.hasOwnProperty(arguments.length)||U("Function '"+b+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+d[a].$+")!");return d[a].$[arguments.length].apply(this,arguments)};d[a].$=[];d[a].$[e.fa]=e}}
function $a(a,b,d){c.hasOwnProperty(a)?((void 0===d||void 0!==c[a].$&&void 0!==c[a].$[d])&&U("Cannot register public name '"+a+"' twice"),Za(a,a),c.hasOwnProperty(d)&&U("Cannot register multiple overloads of a function with the same number of arguments ("+d+")!"),c[a].$[d]=b):(c[a]=b,void 0!==d&&(c[a].sa=d))}
function ab(a,b,d){switch(b){case 0:return function(e){return this.fromWireType((d?ra:I)[e])};case 1:return function(e){return this.fromWireType((d?J:sa)[e>>1])};case 2:return function(e){return this.fromWireType((d?K:M)[e>>2])};default:throw new TypeError("Unknown integer type: "+a);}}function bb(a){a=cb(a);var b=T(a);X(a);return b}function db(a,b){var d=R[a];void 0===d&&U(b+" has unknown type "+bb(a));return d}
function eb(a){if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a}function fb(a,b){switch(b){case 2:return function(d){return this.fromWireType(ta[d>>2])};case 3:return function(d){return this.fromWireType(ua[d>>3])};default:throw new TypeError("Unknown float type: "+a);}}
function gb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var d=Pa(b.name||"unknownFunctionName",function(){});d.prototype=b.prototype;d=new d;a=b.apply(d,a);return a instanceof Object?a:d}function hb(a,b){for(var d=[],e=0;e<a;e++)d.push(K[(b>>2)+e]);return d}
function Y(a,b){a=T(a);var d=c["dynCall_"+a];for(var e=[],f=1;f<a.length;++f)e.push("a"+f);f="return function dynCall_"+(a+"_"+b)+"("+e.join(", ")+") {\n";f+=" return dynCall(rawFunction"+(e.length?", ":"")+e.join(", ")+");\n";d=(new Function("dynCall","rawFunction",f+"};\n"))(d,b);"function"!==typeof d&&U("unknown function pointer with signature "+a+": "+b);return d}var ib=void 0;
function jb(a,b){function d(g){f[g]||R[g]||(Na[g]?Na[g].forEach(d):(e.push(g),f[g]=!0))}var e=[],f={};b.forEach(d);throw new ib(a+": "+e.map(bb).join([", "]));}function kb(a,b,d){switch(b){case 0:return d?function(e){return ra[e]}:function(e){return I[e]};case 1:return d?function(e){return J[e>>1]}:function(e){return sa[e>>1]};case 2:return d?function(e){return K[e>>2]}:function(e){return M[e>>2]};default:throw new TypeError("Unknown integer type: "+a);}}Ra=c.InternalError=Qa("InternalError");
for(var lb=Array(256),mb=0;256>mb;++mb)lb[mb]=String.fromCharCode(mb);Ua=lb;Va=c.BindingError=Qa("BindingError");c.count_emval_handles=function(){for(var a=0,b=5;b<V.length;++b)void 0!==V[b]&&++a;return a};c.get_first_emval=function(){for(var a=5;a<V.length;++a)if(void 0!==V[a])return V[a];return null};ib=c.UnboundTypeError=Qa("UnboundTypeError");
var ob={i:function(a){return nb(a)},h:function(a){"uncaught_exception"in Ja?Ja.da++:Ja.da=1;throw a;},k:function(a){var b=Ka[a];delete Ka[a];var d=b.ma,e=b.na,f=b.ea,g=f.map(function(n){return n.ka}).concat(f.map(function(n){return n.pa}));Sa([a],g,function(n){var h={};f.forEach(function(k,l){var m=n[l],p=k.ia,r=k.ja,v=n[l+f.length],q=k.oa,t=k.qa;h[k.ga]={read:function(A){return m.fromWireType(p(r,A))},write:function(A,H){var W=[];q(t,A,v.toWireType(W,H));La(W)}}});return[{name:b.name,fromWireType:function(k){var l=
{},m;for(m in h)l[m]=h[m].read(k);e(k);return l},toWireType:function(k,l){for(var m in h)if(!(m in l))throw new TypeError("Missing field");var p=d();for(m in h)h[m].write(p,l[m]);null!==k&&k.push(e,p);return p},argPackAdvance:8,readValueFromPointer:Ma,Z:e}]})},t:function(a,b,d,e,f){var g=Ta(d);b=T(b);S(a,{name:b,fromWireType:function(n){return!!n},toWireType:function(n,h){return h?e:f},argPackAdvance:8,readValueFromPointer:function(n){if(1===d)var h=ra;else if(2===d)h=J;else if(4===d)h=K;else throw new TypeError("Unknown boolean type size: "+
b);return this.fromWireType(h[n>>g])},Z:null})},s:function(a,b){b=T(b);S(a,{name:b,fromWireType:function(d){var e=V[d].value;Xa(d);return e},toWireType:function(d,e){return Ya(e)},argPackAdvance:8,readValueFromPointer:Ma,Z:null})},n:function(a,b,d,e){function f(){}d=Ta(d);b=T(b);f.values={};S(a,{name:b,constructor:f,fromWireType:function(g){return this.constructor.values[g]},toWireType:function(g,n){return n.value},argPackAdvance:8,readValueFromPointer:ab(b,d,e),Z:null});$a(b,f)},m:function(a,b,d){var e=
db(a,"enum");b=T(b);a=e.constructor;e=Object.create(e.constructor.prototype,{value:{value:d},constructor:{value:Pa(e.name+"_"+b,function(){})}});a.values[d]=e;a[b]=e},f:function(a,b,d){d=Ta(d);b=T(b);S(a,{name:b,fromWireType:function(e){return e},toWireType:function(e,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+eb(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:fb(b,d),Z:null})},c:function(a,b,d,e,f,g){var n=hb(b,d);a=T(a);f=Y(e,f);
$a(a,function(){jb("Cannot call "+a+" due to unbound types",n)},b-1);Sa([],n,function(h){var k=[h[0],null].concat(h.slice(1)),l=h=a,m=f,p=k.length;2>p&&U("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var r=null!==k[1]&&!1,v=!1,q=1;q<k.length;++q)if(null!==k[q]&&void 0===k[q].Z){v=!0;break}var t="void"!==k[0].name,A="",H="";for(q=0;q<p-2;++q)A+=(0!==q?", ":"")+"arg"+q,H+=(0!==q?", ":"")+"arg"+q+"Wired";l="return function "+Oa(l)+"("+A+") {\nif (arguments.length !== "+
(p-2)+") {\nthrowBindingError('function "+l+" called with ' + arguments.length + ' arguments, expected "+(p-2)+" args!');\n}\n";v&&(l+="var destructors = [];\n");var W=v?"destructors":"null";A="throwBindingError invoker fn runDestructors retType classParam".split(" ");m=[U,m,g,La,k[0],k[1]];r&&(l+="var thisWired = classParam.toWireType("+W+", this);\n");for(q=0;q<p-2;++q)l+="var arg"+q+"Wired = argType"+q+".toWireType("+W+", arg"+q+"); // "+k[q+2].name+"\n",A.push("argType"+q),m.push(k[q+2]);r&&(H=
"thisWired"+(0<H.length?", ":"")+H);l+=(t?"var rv = ":"")+"invoker(fn"+(0<H.length?", ":"")+H+");\n";if(v)l+="runDestructors(destructors);\n";else for(q=r?1:2;q<k.length;++q)p=1===q?"thisWired":"arg"+(q-2)+"Wired",null!==k[q].Z&&(l+=p+"_dtor("+p+"); // "+k[q].name+"\n",A.push(p+"_dtor"),m.push(k[q].Z));t&&(l+="var ret = retType.fromWireType(rv);\nreturn ret;\n");A.push(l+"}\n");k=gb(A).apply(null,m);q=b-1;if(!c.hasOwnProperty(h))throw new Ra("Replacing nonexistant public symbol");void 0!==c[h].$&&
void 0!==q?c[h].$[q]=k:(c[h]=k,c[h].fa=q);return[]})},b:function(a,b,d,e,f){function g(l){return l}b=T(b);-1===f&&(f=4294967295);var n=Ta(d);if(0===e){var h=32-8*d;g=function(l){return l<<h>>>h}}var k=-1!=b.indexOf("unsigned");S(a,{name:b,fromWireType:g,toWireType:function(l,m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+eb(m)+'" to '+this.name);if(m<e||m>f)throw new TypeError('Passing a number "'+eb(m)+'" from JS side to C/C++ side to an argument of type "'+
b+'", which is outside the valid range ['+e+", "+f+"]!");return k?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:kb(b,n,0!==e),Z:null})},a:function(a,b,d){function e(g){g>>=2;var n=M;return new f(L,n[g+1],n[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];d=T(d);S(a,{name:d,fromWireType:e,argPackAdvance:8,readValueFromPointer:e},{la:!0})},g:function(a,b){b=T(b);var d="std::string"===b;S(a,{name:b,fromWireType:function(e){var f=M[e>>2];if(d){var g=
I[e+4+f],n=0;0!=g&&(n=g,I[e+4+f]=0);var h=e+4;for(g=0;g<=f;++g){var k=e+4+g;if(0==I[k]){if(h){for(var l=I,m=h+NaN,p=h;l[p]&&!(p>=m);)++p;if(16<p-h&&l.subarray&&ia)h=ia.decode(l.subarray(h,p));else{for(m="";h<p;){var r=l[h++];if(r&128){var v=l[h++]&63;if(192==(r&224))m+=String.fromCharCode((r&31)<<6|v);else{var q=l[h++]&63;r=224==(r&240)?(r&15)<<12|v<<6|q:(r&7)<<18|v<<12|q<<6|l[h++]&63;65536>r?m+=String.fromCharCode(r):(r-=65536,m+=String.fromCharCode(55296|r>>10,56320|r&1023))}}else m+=String.fromCharCode(r)}h=
m}}else h="";if(void 0===t)var t=h;else t+=String.fromCharCode(0),t+=h;h=k+1}}0!=n&&(I[e+4+f]=n)}else{t=Array(f);for(g=0;g<f;++g)t[g]=String.fromCharCode(I[e+4+g]);t=t.join("")}X(e);return t},toWireType:function(e,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"===typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||U("Cannot pass non-string to std::string");var n=(d&&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=nb(4+n+1);M[h>>2]=n;if(d&&g)ja(f,h+4,n+1);else if(g)for(g=0;g<n;++g){var k=f.charCodeAt(g);255<k&&(X(h),U("String has UTF-16 code units that do not fit in 8 bits"));I[h+4+g]=k}else for(g=0;g<n;++g)I[h+4+g]=f[g];null!==e&&e.push(X,h);return h},argPackAdvance:8,readValueFromPointer:Ma,Z:function(e){X(e)}})},e:function(a,b,d){d=T(d);if(2===b){var e=la;var f=
ma;var g=na;var n=function(){return sa};var h=1}else 4===b&&(e=oa,f=pa,g=qa,n=function(){return M},h=2);S(a,{name:d,fromWireType:function(k){var l=M[k>>2],m=n(),p=m[k+4+l*b>>h],r=0;0!=p&&(r=p,m[k+4+l*b>>h]=0);var v=k+4;for(p=0;p<=l;++p){var q=k+4+p*b;if(0==m[q>>h]){v=e(v);if(void 0===t)var t=v;else t+=String.fromCharCode(0),t+=v;v=q+b}}0!=r&&(m[k+4+l*b>>h]=r);X(k);return t},toWireType:function(k,l){"string"!==typeof l&&U("Cannot pass non-string to C++ string type "+d);var m=g(l),p=nb(4+m+b);M[p>>
2]=m>>h;f(l,p+4,m+b);null!==k&&k.push(X,p);return p},argPackAdvance:8,readValueFromPointer:Ma,Z:function(k){X(k)}})},l:function(a,b,d,e,f,g){Ka[a]={name:T(b),ma:Y(d,e),na:Y(f,g),ea:[]}},d:function(a,b,d,e,f,g,n,h,k,l){Ka[a].ea.push({ga:T(b),ka:d,ia:Y(e,f),ja:g,pa:n,oa:Y(h,k),qa:l})},u:function(a,b){b=T(b);S(a,{ra:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},w:Xa,j:function(a){4<a&&(V[a].ba+=1)},r:function(a,b){a=db(a,"_emval_take_value");a=a.readValueFromPointer(b);
return Ya(a)},v:function(){D()},p:function(a,b,d){I.copyWithin(a,b,b+d)},q:function(a){var b=I.length;if(2147418112<a)return!1;for(var d=1;4>=d;d*=2){var e=b*(1+.2/d);e=Math.min(e,a+100663296);e=Math.max(16777216,a,e);0<e%65536&&(e+=65536-e%65536);a:{try{G.grow(Math.min(2147418112,e)-L.byteLength+65535>>16);va(G.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},memory:G,o:function(){},table:fa},pb=function(){function a(f){c.asm=f.exports;N--;c.monitorRunDependencies&&c.monitorRunDependencies(N);
0==N&&(null!==Da&&(clearInterval(Da),Da=null),O&&(f=O,O=null,f()))}function b(f){a(f.instance)}function d(f){return Ha().then(function(g){return WebAssembly.instantiate(g,e)}).then(f,function(g){E("failed to asynchronously prepare wasm: "+g);D(g)})}var e={a:ob};N++;c.monitorRunDependencies&&c.monitorRunDependencies(N);if(c.instantiateWasm)try{return c.instantiateWasm(e,a)}catch(f){return E("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(F||"function"!==typeof WebAssembly.instantiateStreaming||
Ea()||"function"!==typeof fetch)return d(b);fetch(P,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(b,function(g){E("wasm streaming compile failed: "+g);E("falling back to ArrayBuffer instantiation");d(b)})})})();return{}}();c.asm=pb;
var Ia=c.___wasm_call_ctors=function(){return(Ia=c.___wasm_call_ctors=c.asm.x).apply(null,arguments)},nb=c._malloc=function(){return(nb=c._malloc=c.asm.y).apply(null,arguments)},X=c._free=function(){return(X=c._free=c.asm.z).apply(null,arguments)},cb=c.___getTypeName=function(){return(cb=c.___getTypeName=c.asm.A).apply(null,arguments)};c.___embind_register_native_and_builtin_types=function(){return(c.___embind_register_native_and_builtin_types=c.asm.B).apply(null,arguments)};
c.dynCall_iiii=function(){return(c.dynCall_iiii=c.asm.C).apply(null,arguments)};c.dynCall_ii=function(){return(c.dynCall_ii=c.asm.D).apply(null,arguments)};c.dynCall_i=function(){return(c.dynCall_i=c.asm.E).apply(null,arguments)};c.dynCall_viiiii=function(){return(c.dynCall_viiiii=c.asm.F).apply(null,arguments)};c.dynCall_v=function(){return(c.dynCall_v=c.asm.G).apply(null,arguments)};c.dynCall_vi=function(){return(c.dynCall_vi=c.asm.H).apply(null,arguments)};
c.dynCall_iii=function(){return(c.dynCall_iii=c.asm.I).apply(null,arguments)};c.dynCall_viii=function(){return(c.dynCall_viii=c.asm.J).apply(null,arguments)};c.dynCall_fii=function(){return(c.dynCall_fii=c.asm.K).apply(null,arguments)};c.dynCall_viif=function(){return(c.dynCall_viif=c.asm.L).apply(null,arguments)};c.dynCall_iiiiii=function(){return(c.dynCall_iiiiii=c.asm.M).apply(null,arguments)};c.dynCall_viiii=function(){return(c.dynCall_viiii=c.asm.N).apply(null,arguments)};
c.dynCall_viiiiii=function(){return(c.dynCall_viiiiii=c.asm.O).apply(null,arguments)};c.dynCall_iiiiiii=function(){return(c.dynCall_iiiiiii=c.asm.P).apply(null,arguments)};c.dynCall_viiiiiiiii=function(){return(c.dynCall_viiiiiiiii=c.asm.Q).apply(null,arguments)};c.dynCall_jiiii=function(){return(c.dynCall_jiiii=c.asm.R).apply(null,arguments)};c.dynCall_diiii=function(){return(c.dynCall_diiii=c.asm.S).apply(null,arguments)};
c.dynCall_diiiiiiii=function(){return(c.dynCall_diiiiiiii=c.asm.T).apply(null,arguments)};c.dynCall_vii=function(){return(c.dynCall_vii=c.asm.U).apply(null,arguments)};c.dynCall_viiiiiii=function(){return(c.dynCall_viiiiiii=c.asm.V).apply(null,arguments)};c.dynCall_fi=function(){return(c.dynCall_fi=c.asm.W).apply(null,arguments)};c.dynCall_dii=function(){return(c.dynCall_dii=c.asm.X).apply(null,arguments)};c.dynCall_diii=function(){return(c.dynCall_diii=c.asm.Y).apply(null,arguments)};c.asm=pb;var Z;
c.then=function(a){if(Z)a(c);else{var b=c.onRuntimeInitialized;c.onRuntimeInitialized=function(){b&&b();a(c)}}return c};O=function qb(){Z||rb();Z||(O=qb)};
function rb(){function a(){if(!Z&&(Z=!0,c.calledRun=!0,!ha)){xa(za);xa(Aa);if(c.onRuntimeInitialized)c.onRuntimeInitialized();if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;){var b=c.postRun.shift();Ba.unshift(b)}xa(Ba)}}if(!(0<N)){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)Ca();xa(ya);0<N||(c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1);a()},1)):a())}}c.run=rb;
if(c.preInit)for("function"==typeof c.preInit&&(c.preInit=[c.preInit]);0<c.preInit.length;)c.preInit.pop()();noExitRuntime=!0;rb();
return webp_enc
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = webp_enc;
else if (typeof define === 'function' && define['amd'])
define([], function() { return webp_enc; });
else if (typeof exports === 'object')
exports["webp_enc"] = webp_enc;

Binary file not shown.

74
config/add-css-types.js Normal file
View File

@ -0,0 +1,74 @@
const DtsCreator = require('typed-css-modules');
const chokidar = require('chokidar');
const util = require('util');
const sass = require('node-sass');
const sassRender = util.promisify(sass.render);
async function sassToCss(path) {
const result = await sassRender({ file: path });
return result.css;
}
/**
* @typedef {Object} Opts
* @property {boolean} watch Watch for changes
*/
/**
* Create typing files for CSS & SCSS.
*
* @param {string[]} rootPaths Paths to search within
* @param {Opts} [opts={}] Options.
*/
function addCssTypes(rootPaths, opts = {}) {
return new Promise((resolve) => {
const { watch = false } = opts;
const paths = [];
const preReadyPromises = [];
let ready = false;
for (const rootPath of rootPaths) {
// Look for scss & css in each path.
paths.push(rootPath + '/**/*.scss');
paths.push(rootPath + '/**/*.css');
}
// For simplicity, the watcher is used even if we're not watching.
// If we're not watching, we stop the watcher after the initial files are found.
const watcher = chokidar.watch(paths, {
// Avoid processing already-processed files.
ignored: '*.d.*',
// Without this, travis and netlify builds never complete. I'm not sure why, but it might be
// related to https://github.com/paulmillr/chokidar/pull/758
persistent: watch,
});
function change(path) {
const promise = (async function() {
const creator = new DtsCreator({ camelCase: true });
const result = path.endsWith('.scss') ?
await creator.create(path, await sassToCss(path)) :
await creator.create(path);
await result.writeFile();
})();
if (!ready) preReadyPromises.push(promise);
}
watcher.on('change', change);
watcher.on('add', change);
// 'ready' is when events have been fired for file discovery.
watcher.on('ready', () => {
ready = true;
// Wait for the current set of processing to finish.
Promise.all(preReadyPromises).then(resolve);
// And if we're not watching, close the watcher.
if (!watch) watcher.close();
});
})
}
module.exports = addCssTypes;

Some files were not shown because too many files have changed in this diff Show More