mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-12 08:47:31 +00:00
Compare commits
3 Commits
visdif-err
...
cli-invoc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8105633ca6 | ||
|
|
46764f3375 | ||
|
|
0371cfd292 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,7 +4,6 @@ node_modules
|
|||||||
*.css.d.ts
|
*.css.d.ts
|
||||||
build
|
build
|
||||||
*.o
|
*.o
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# Auto-generated by lib/feature-plugin.js
|
# Auto-generated by lib/feature-plugin.js
|
||||||
src/features-worker/index.ts
|
src/features-worker/index.ts
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -3,18 +3,14 @@
|
|||||||
[Squoosh] is an image compression web app that allows you to dive into the advanced options provided
|
[Squoosh] is an image compression web app that allows you to dive into the advanced options provided
|
||||||
by various image compressors.
|
by various image compressors.
|
||||||
|
|
||||||
# API & CLI
|
|
||||||
|
|
||||||
Squoosh now has [an API](https://github.com/GoogleChromeLabs/squoosh/tree/dev/libsquoosh) and [a CLI](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli) that allows you to compress many images at once.
|
|
||||||
|
|
||||||
# Privacy
|
# Privacy
|
||||||
|
|
||||||
Google Analytics is used to record the following:
|
Google Analytics is used to record the following:
|
||||||
|
|
||||||
- [Basic visit data](https://support.google.com/analytics/answer/6004245?ref_topic=2919631).
|
* [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
|
* Before and after image size once an image is downloaded. These values are rounded to the nearest
|
||||||
kilobyte.
|
kilobyte.
|
||||||
- If install is available, when Squoosh is installed, and what method was used to install Squoosh.
|
* If install is available, when Squoosh is installed, and what method was used to install Squoosh.
|
||||||
|
|
||||||
Image compression is handled locally; no additional data is sent to the server.
|
Image compression is handled locally; no additional data is sent to the server.
|
||||||
|
|
||||||
@@ -30,7 +26,7 @@ npm run build
|
|||||||
You can run the development server with:
|
You can run the development server with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm run dev
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
[squoosh]: https://squoosh.app
|
[Squoosh]: https://squoosh.app
|
||||||
|
|||||||
3
cli/.gitignore
vendored
3
cli/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
node_modules
|
|
||||||
build
|
|
||||||
.DS_Store
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
node_modules
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
# Squoosh CLI
|
|
||||||
|
|
||||||
Squoosh CLI is an _experimental_ way to run all the codecs you know from the [Squoosh] web app on your command line using WebAssembly. The Squoosh CLI uses a worker pool to parallelize processing images. This way you can apply the same codec to many images at once.
|
|
||||||
|
|
||||||
Squoosh CLI is currently not the fastest image compression tool in town and doesn’t aim to be. It is, however, fast enough to compress many images sufficiently quick at once.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
The Squoosh CLI can be used straight from the command line without installing using `npx`:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ npx @squoosh/cli <options...>
|
|
||||||
```
|
|
||||||
|
|
||||||
Of course, you can also install the Squoosh CLI:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ npm i -g @squoosh/cli
|
|
||||||
$ squoosh-cli <options...>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```
|
|
||||||
Usage: squoosh-cli [options] <files...>
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-V, --version output the version number
|
|
||||||
-d, --output-dir <dir> Output directory (default: ".")
|
|
||||||
-s, --suffix <suffix> Append suffix to output files (default: "")
|
|
||||||
--max-optimizer-rounds <rounds> Maximum number of compressions to use for auto optimizations (default: "6")
|
|
||||||
--optimizer-butteraugli-target <butteraugli distance> Target Butteraugli distance for auto optimizer (default: "1.4")
|
|
||||||
--resize [config] Resize the image before compressing
|
|
||||||
--quant [config] Reduce the number of colors used (aka. paletting)
|
|
||||||
--rotate [config] Rotate image
|
|
||||||
--mozjpeg [config] Use MozJPEG to generate a .jpg file with the given configuration
|
|
||||||
--webp [config] Use WebP to generate a .webp file with the given configuration
|
|
||||||
--avif [config] Use AVIF to generate a .avif file with the given configuration
|
|
||||||
--jxl [config] Use JPEG-XL to generate a .jxl file with the given configuration
|
|
||||||
--wp2 [config] Use WebP2 to generate a .wp2 file with the given configuration
|
|
||||||
--oxipng [config] Use OxiPNG to generate a .png file with the given configuration
|
|
||||||
-h, --help display help for command
|
|
||||||
```
|
|
||||||
|
|
||||||
The default values for each `config` option can be found in the [`codecs.js`][codecs.js] file under `defaultEncoderOptions`. Every unspecified value will use the default value specified here. _Better documentation is needed here._
|
|
||||||
|
|
||||||
## Auto optimizer
|
|
||||||
|
|
||||||
Squoosh CLI has an _experimental_ auto optimizer that compresses an image as much as possible, trying to hit a specific [Butteraugli] target value. The higher the Butteraugli target value, the more artifacts can be introduced.
|
|
||||||
|
|
||||||
You can make use of the auto optimizer by using “auto” as the config object.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ npx @squoosh/cli --wp2 auto test.png
|
|
||||||
```
|
|
||||||
|
|
||||||
[squoosh]: https://squoosh.app
|
|
||||||
[codecs.js]: https://github.com/GoogleChromeLabs/squoosh/blob/dev/libsquoosh/src/codecs.js
|
|
||||||
[butteraugli]: https://github.com/google/butteraugli
|
|
||||||
595
cli/package-lock.json
generated
595
cli/package-lock.json
generated
@@ -1,595 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@squoosh/cli",
|
|
||||||
"version": "0.7.0",
|
|
||||||
"lockfileVersion": 2,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"name": "@squoosh/cli",
|
|
||||||
"version": "0.7.0",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"@squoosh/lib": "^0.2.0",
|
|
||||||
"commander": "^7.2.0",
|
|
||||||
"json5": "^2.2.0",
|
|
||||||
"kleur": "^4.1.4",
|
|
||||||
"ora": "^5.4.0"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"cli": "src/index.js",
|
|
||||||
"squoosh-cli": "src/index.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@squoosh/lib": {
|
|
||||||
"version": "0.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@squoosh/lib/-/lib-0.2.0.tgz",
|
|
||||||
"integrity": "sha512-zKId9h/LzEnCdoOGnIgjzvqbk5g2aHgfEqgKQ+S+r5K3TasgD/DAsT6r7v6gXft1ao0f/00CTcwIp1KviWTQbw==",
|
|
||||||
"dependencies": {
|
|
||||||
"web-streams-polyfill": "^3.0.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ansi-regex": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ansi-styles": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
|
||||||
"dependencies": {
|
|
||||||
"color-convert": "^2.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/base64-js": {
|
|
||||||
"version": "1.5.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
|
||||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
|
||||||
},
|
|
||||||
"node_modules/bl": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
|
||||||
"dependencies": {
|
|
||||||
"buffer": "^5.5.0",
|
|
||||||
"inherits": "^2.0.4",
|
|
||||||
"readable-stream": "^3.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/buffer": {
|
|
||||||
"version": "5.7.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
|
||||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"base64-js": "^1.3.1",
|
|
||||||
"ieee754": "^1.1.13"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/chalk": {
|
|
||||||
"version": "4.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
|
|
||||||
"integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-styles": "^4.1.0",
|
|
||||||
"supports-color": "^7.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cli-cursor": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
|
|
||||||
"dependencies": {
|
|
||||||
"restore-cursor": "^3.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cli-spinners": {
|
|
||||||
"version": "2.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz",
|
|
||||||
"integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/clone": {
|
|
||||||
"version": "1.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
|
||||||
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/color-convert": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"color-name": "~1.1.4"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=7.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/color-name": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
|
||||||
},
|
|
||||||
"node_modules/commander": {
|
|
||||||
"version": "7.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
|
|
||||||
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/defaults": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
|
||||||
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
|
|
||||||
"dependencies": {
|
|
||||||
"clone": "^1.0.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/has-flag": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ieee754": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
|
||||||
},
|
|
||||||
"node_modules/inherits": {
|
|
||||||
"version": "2.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
|
||||||
},
|
|
||||||
"node_modules/is-interactive": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/is-unicode-supported": {
|
|
||||||
"version": "0.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
|
|
||||||
"integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/json5": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
|
|
||||||
"dependencies": {
|
|
||||||
"minimist": "^1.2.5"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"json5": "lib/cli.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/kleur": {
|
|
||||||
"version": "4.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz",
|
|
||||||
"integrity": "sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/log-symbols": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
|
|
||||||
"dependencies": {
|
|
||||||
"chalk": "^4.1.0",
|
|
||||||
"is-unicode-supported": "^0.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mimic-fn": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/minimist": {
|
|
||||||
"version": "1.2.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
|
||||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
|
||||||
},
|
|
||||||
"node_modules/onetime": {
|
|
||||||
"version": "5.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
|
||||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
|
||||||
"dependencies": {
|
|
||||||
"mimic-fn": "^2.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ora": {
|
|
||||||
"version": "5.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ora/-/ora-5.4.0.tgz",
|
|
||||||
"integrity": "sha512-1StwyXQGoU6gdjYkyVcqOLnVlbKj+6yPNNOxJVgpt9t4eksKjiriiHuxktLYkgllwk+D6MbC4ihH84L1udRXPg==",
|
|
||||||
"dependencies": {
|
|
||||||
"bl": "^4.1.0",
|
|
||||||
"chalk": "^4.1.0",
|
|
||||||
"cli-cursor": "^3.1.0",
|
|
||||||
"cli-spinners": "^2.5.0",
|
|
||||||
"is-interactive": "^1.0.0",
|
|
||||||
"is-unicode-supported": "^0.1.0",
|
|
||||||
"log-symbols": "^4.1.0",
|
|
||||||
"strip-ansi": "^6.0.0",
|
|
||||||
"wcwidth": "^1.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/readable-stream": {
|
|
||||||
"version": "3.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
|
||||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
|
||||||
"dependencies": {
|
|
||||||
"inherits": "^2.0.3",
|
|
||||||
"string_decoder": "^1.1.1",
|
|
||||||
"util-deprecate": "^1.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/restore-cursor": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
|
|
||||||
"dependencies": {
|
|
||||||
"onetime": "^5.1.0",
|
|
||||||
"signal-exit": "^3.0.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/safe-buffer": {
|
|
||||||
"version": "5.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
||||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
|
||||||
},
|
|
||||||
"node_modules/signal-exit": {
|
|
||||||
"version": "3.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
|
||||||
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
|
|
||||||
},
|
|
||||||
"node_modules/string_decoder": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
|
||||||
"dependencies": {
|
|
||||||
"safe-buffer": "~5.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/strip-ansi": {
|
|
||||||
"version": "6.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
|
|
||||||
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
|
|
||||||
"dependencies": {
|
|
||||||
"ansi-regex": "^5.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/supports-color": {
|
|
||||||
"version": "7.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
|
||||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
|
||||||
"dependencies": {
|
|
||||||
"has-flag": "^4.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/util-deprecate": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
|
||||||
},
|
|
||||||
"node_modules/wcwidth": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
|
||||||
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
|
|
||||||
"dependencies": {
|
|
||||||
"defaults": "^1.0.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/web-streams-polyfill": {
|
|
||||||
"version": "3.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.0.3.tgz",
|
|
||||||
"integrity": "sha512-d2H/t0eqRNM4w2WvmTdoeIvzAUSpK7JmATB8Nr2lb7nQ9BTIJVjbQ/TRFVEh2gUH1HwclPdoPtfMoFfetXaZnA==",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@squoosh/lib": {
|
|
||||||
"version": "0.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@squoosh/lib/-/lib-0.2.0.tgz",
|
|
||||||
"integrity": "sha512-zKId9h/LzEnCdoOGnIgjzvqbk5g2aHgfEqgKQ+S+r5K3TasgD/DAsT6r7v6gXft1ao0f/00CTcwIp1KviWTQbw==",
|
|
||||||
"requires": {
|
|
||||||
"web-streams-polyfill": "^3.0.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ansi-regex": {
|
|
||||||
"version": "5.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
|
|
||||||
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
|
|
||||||
},
|
|
||||||
"ansi-styles": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
|
||||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
|
||||||
"requires": {
|
|
||||||
"color-convert": "^2.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"base64-js": {
|
|
||||||
"version": "1.5.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
|
||||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
|
||||||
},
|
|
||||||
"bl": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
|
||||||
"requires": {
|
|
||||||
"buffer": "^5.5.0",
|
|
||||||
"inherits": "^2.0.4",
|
|
||||||
"readable-stream": "^3.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"buffer": {
|
|
||||||
"version": "5.7.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
|
||||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
|
||||||
"requires": {
|
|
||||||
"base64-js": "^1.3.1",
|
|
||||||
"ieee754": "^1.1.13"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"chalk": {
|
|
||||||
"version": "4.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
|
|
||||||
"integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-styles": "^4.1.0",
|
|
||||||
"supports-color": "^7.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cli-cursor": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
|
|
||||||
"requires": {
|
|
||||||
"restore-cursor": "^3.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cli-spinners": {
|
|
||||||
"version": "2.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz",
|
|
||||||
"integrity": "sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q=="
|
|
||||||
},
|
|
||||||
"clone": {
|
|
||||||
"version": "1.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
|
||||||
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4="
|
|
||||||
},
|
|
||||||
"color-convert": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
||||||
"requires": {
|
|
||||||
"color-name": "~1.1.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"color-name": {
|
|
||||||
"version": "1.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
|
||||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
|
||||||
},
|
|
||||||
"commander": {
|
|
||||||
"version": "7.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz",
|
|
||||||
"integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="
|
|
||||||
},
|
|
||||||
"defaults": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
|
||||||
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
|
|
||||||
"requires": {
|
|
||||||
"clone": "^1.0.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"has-flag": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
|
|
||||||
},
|
|
||||||
"ieee754": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
|
||||||
},
|
|
||||||
"inherits": {
|
|
||||||
"version": "2.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
|
||||||
},
|
|
||||||
"is-interactive": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w=="
|
|
||||||
},
|
|
||||||
"is-unicode-supported": {
|
|
||||||
"version": "0.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
|
|
||||||
"integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="
|
|
||||||
},
|
|
||||||
"json5": {
|
|
||||||
"version": "2.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz",
|
|
||||||
"integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==",
|
|
||||||
"requires": {
|
|
||||||
"minimist": "^1.2.5"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"kleur": {
|
|
||||||
"version": "4.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz",
|
|
||||||
"integrity": "sha512-8QADVssbrFjivHWQU7KkMgptGTl6WAcSdlbBPY4uNF+mWr6DGcKrvY2w4FQJoXch7+fKMjj0dRrL75vk3k23OA=="
|
|
||||||
},
|
|
||||||
"log-symbols": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
|
|
||||||
"requires": {
|
|
||||||
"chalk": "^4.1.0",
|
|
||||||
"is-unicode-supported": "^0.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mimic-fn": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="
|
|
||||||
},
|
|
||||||
"minimist": {
|
|
||||||
"version": "1.2.5",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
|
||||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
|
||||||
},
|
|
||||||
"onetime": {
|
|
||||||
"version": "5.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
|
|
||||||
"integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
|
|
||||||
"requires": {
|
|
||||||
"mimic-fn": "^2.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ora": {
|
|
||||||
"version": "5.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ora/-/ora-5.4.0.tgz",
|
|
||||||
"integrity": "sha512-1StwyXQGoU6gdjYkyVcqOLnVlbKj+6yPNNOxJVgpt9t4eksKjiriiHuxktLYkgllwk+D6MbC4ihH84L1udRXPg==",
|
|
||||||
"requires": {
|
|
||||||
"bl": "^4.1.0",
|
|
||||||
"chalk": "^4.1.0",
|
|
||||||
"cli-cursor": "^3.1.0",
|
|
||||||
"cli-spinners": "^2.5.0",
|
|
||||||
"is-interactive": "^1.0.0",
|
|
||||||
"is-unicode-supported": "^0.1.0",
|
|
||||||
"log-symbols": "^4.1.0",
|
|
||||||
"strip-ansi": "^6.0.0",
|
|
||||||
"wcwidth": "^1.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"readable-stream": {
|
|
||||||
"version": "3.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
|
|
||||||
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
|
|
||||||
"requires": {
|
|
||||||
"inherits": "^2.0.3",
|
|
||||||
"string_decoder": "^1.1.1",
|
|
||||||
"util-deprecate": "^1.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"restore-cursor": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
|
|
||||||
"integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
|
|
||||||
"requires": {
|
|
||||||
"onetime": "^5.1.0",
|
|
||||||
"signal-exit": "^3.0.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"safe-buffer": {
|
|
||||||
"version": "5.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
|
||||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
|
||||||
},
|
|
||||||
"signal-exit": {
|
|
||||||
"version": "3.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
|
|
||||||
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
|
|
||||||
},
|
|
||||||
"string_decoder": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
|
||||||
"requires": {
|
|
||||||
"safe-buffer": "~5.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"strip-ansi": {
|
|
||||||
"version": "6.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
|
|
||||||
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
|
|
||||||
"requires": {
|
|
||||||
"ansi-regex": "^5.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"supports-color": {
|
|
||||||
"version": "7.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
|
||||||
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
|
||||||
"requires": {
|
|
||||||
"has-flag": "^4.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"util-deprecate": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
|
||||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
|
||||||
},
|
|
||||||
"wcwidth": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
|
||||||
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
|
|
||||||
"requires": {
|
|
||||||
"defaults": "^1.0.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"web-streams-polyfill": {
|
|
||||||
"version": "3.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.0.3.tgz",
|
|
||||||
"integrity": "sha512-d2H/t0eqRNM4w2WvmTdoeIvzAUSpK7JmATB8Nr2lb7nQ9BTIJVjbQ/TRFVEh2gUH1HwclPdoPtfMoFfetXaZnA=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@squoosh/cli",
|
|
||||||
"version": "0.7.0",
|
|
||||||
"description": "A CLI for Squoosh",
|
|
||||||
"public": true,
|
|
||||||
"type": "module",
|
|
||||||
"bin": {
|
|
||||||
"squoosh-cli": "src/index.js",
|
|
||||||
"@squoosh/cli": "src/index.js"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"/src/index.js"
|
|
||||||
],
|
|
||||||
"keywords": [],
|
|
||||||
"author": "Google Chrome Developers <chromium-dev@google.com>",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"@squoosh/lib": "^0.2.0",
|
|
||||||
"commander": "^7.2.0",
|
|
||||||
"json5": "^2.2.0",
|
|
||||||
"kleur": "^4.1.4",
|
|
||||||
"ora": "^5.4.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
232
cli/src/index.js
232
cli/src/index.js
@@ -1,232 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
import { program } from 'commander/esm.mjs';
|
|
||||||
import JSON5 from 'json5';
|
|
||||||
import path from 'path';
|
|
||||||
import { promises as fsp } from 'fs';
|
|
||||||
import ora from 'ora';
|
|
||||||
import kleur from 'kleur';
|
|
||||||
|
|
||||||
import { ImagePool, preprocessors, encoders } from '@squoosh/lib';
|
|
||||||
|
|
||||||
function clamp(v, min, max) {
|
|
||||||
if (v < min) return min;
|
|
||||||
if (v > max) return max;
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
const suffix = ['B', 'KB', 'MB'];
|
|
||||||
function prettyPrintSize(size) {
|
|
||||||
const base = Math.floor(Math.log2(size) / 10);
|
|
||||||
const index = clamp(base, 0, 2);
|
|
||||||
return (size / 2 ** (10 * index)).toFixed(2) + suffix[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
function progressTracker(results) {
|
|
||||||
const spinner = ora();
|
|
||||||
const tracker = {};
|
|
||||||
tracker.spinner = spinner;
|
|
||||||
tracker.progressOffset = 0;
|
|
||||||
tracker.totalOffset = 0;
|
|
||||||
let status = '';
|
|
||||||
tracker.setStatus = (text) => {
|
|
||||||
status = text || '';
|
|
||||||
update();
|
|
||||||
};
|
|
||||||
let progress = '';
|
|
||||||
tracker.setProgress = (done, total) => {
|
|
||||||
spinner.prefixText = kleur.dim(`${done}/${total}`);
|
|
||||||
const completeness =
|
|
||||||
(tracker.progressOffset + done) / (tracker.totalOffset + total);
|
|
||||||
progress = kleur.cyan(
|
|
||||||
`▐${'▨'.repeat((completeness * 10) | 0).padEnd(10, '╌')}▌ `,
|
|
||||||
);
|
|
||||||
update();
|
|
||||||
};
|
|
||||||
function update() {
|
|
||||||
spinner.text = progress + kleur.bold(status) + getResultsText();
|
|
||||||
}
|
|
||||||
tracker.finish = (text) => {
|
|
||||||
spinner.succeed(kleur.bold(text) + getResultsText());
|
|
||||||
};
|
|
||||||
function getResultsText() {
|
|
||||||
let out = '';
|
|
||||||
for (const result of results.values()) {
|
|
||||||
out += `\n ${kleur.cyan(result.file)}: ${prettyPrintSize(result.size)}`;
|
|
||||||
for (const { outputFile, size: outputSize, infoText } of result.outputs) {
|
|
||||||
out += `\n ${kleur.dim('└')} ${kleur.cyan(
|
|
||||||
outputFile.padEnd(5),
|
|
||||||
)} → ${prettyPrintSize(outputSize)}`;
|
|
||||||
const percent = ((outputSize / result.size) * 100).toPrecision(3);
|
|
||||||
out += ` (${kleur[outputSize > result.size ? 'red' : 'green'](
|
|
||||||
percent + '%',
|
|
||||||
)})`;
|
|
||||||
if (infoText) out += kleur.yellow(infoText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out || '\n';
|
|
||||||
}
|
|
||||||
spinner.start();
|
|
||||||
return tracker;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getInputFiles(paths) {
|
|
||||||
const validFiles = [];
|
|
||||||
|
|
||||||
for (const inputPath of paths) {
|
|
||||||
const files = (await fsp.lstat(inputPath)).isDirectory()
|
|
||||||
? (await fsp.readdir(inputPath, {withFileTypes: true})).filter(dirent => dirent.isFile()).map(dirent => path.join(inputPath, dirent.name))
|
|
||||||
: [inputPath];
|
|
||||||
for (const file of files) {
|
|
||||||
try {
|
|
||||||
await fsp.stat(file);
|
|
||||||
} catch (err) {
|
|
||||||
if (err.code === 'ENOENT') {
|
|
||||||
console.warn(
|
|
||||||
`Warning: Input file does not exist: ${path.resolve(file)}`,
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
validFiles.push(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return validFiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function processFiles(files) {
|
|
||||||
files = await getInputFiles(files);
|
|
||||||
|
|
||||||
const imagePool = new ImagePool();
|
|
||||||
|
|
||||||
const results = new Map();
|
|
||||||
const progress = progressTracker(results);
|
|
||||||
|
|
||||||
progress.setStatus('Decoding...');
|
|
||||||
progress.totalOffset = files.length;
|
|
||||||
progress.setProgress(0, files.length);
|
|
||||||
|
|
||||||
// Create output directory
|
|
||||||
await fsp.mkdir(program.opts().outputDir, { recursive: true });
|
|
||||||
|
|
||||||
let decoded = 0;
|
|
||||||
let decodedFiles = await Promise.all(
|
|
||||||
files.map(async (file) => {
|
|
||||||
const image = imagePool.ingestImage(file);
|
|
||||||
await image.decoded;
|
|
||||||
results.set(image, {
|
|
||||||
file,
|
|
||||||
size: (await image.decoded).size,
|
|
||||||
outputs: [],
|
|
||||||
});
|
|
||||||
progress.setProgress(++decoded, files.length);
|
|
||||||
return image;
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const preprocessOptions = {};
|
|
||||||
|
|
||||||
for (const preprocessorName of Object.keys(preprocessors)) {
|
|
||||||
if (!program.opts()[preprocessorName]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
preprocessOptions[preprocessorName] = JSON5.parse(
|
|
||||||
program.opts()[preprocessorName],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const image of decodedFiles) {
|
|
||||||
image.preprocess(preprocessOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
await Promise.all(decodedFiles.map((image) => image.decoded));
|
|
||||||
|
|
||||||
progress.progressOffset = decoded;
|
|
||||||
progress.setStatus(
|
|
||||||
'Encoding ' + kleur.dim(`(${imagePool.workerPool.numWorkers} threads)`),
|
|
||||||
);
|
|
||||||
progress.setProgress(0, files.length);
|
|
||||||
|
|
||||||
const jobs = [];
|
|
||||||
let jobsStarted = 0;
|
|
||||||
let jobsFinished = 0;
|
|
||||||
for (const image of decodedFiles) {
|
|
||||||
const originalFile = results.get(image).file;
|
|
||||||
|
|
||||||
const encodeOptions = {
|
|
||||||
optimizerButteraugliTarget: Number(
|
|
||||||
program.opts().optimizerButteraugliTarget,
|
|
||||||
),
|
|
||||||
maxOptimizerRounds: Number(program.opts().maxOptimizerRounds),
|
|
||||||
};
|
|
||||||
for (const encName of Object.keys(encoders)) {
|
|
||||||
if (!program.opts()[encName]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const encParam = program.opts()[encName];
|
|
||||||
const encConfig =
|
|
||||||
encParam.toLowerCase() === 'auto' ? 'auto' : JSON5.parse(encParam);
|
|
||||||
encodeOptions[encName] = encConfig;
|
|
||||||
}
|
|
||||||
jobsStarted++;
|
|
||||||
const job = image.encode(encodeOptions).then(async () => {
|
|
||||||
jobsFinished++;
|
|
||||||
const outputPath = path.join(
|
|
||||||
program.opts().outputDir,
|
|
||||||
program.opts().suffix +
|
|
||||||
path.basename(originalFile, path.extname(originalFile)),
|
|
||||||
);
|
|
||||||
for (const output of Object.values(image.encodedWith)) {
|
|
||||||
const outputFile = `${outputPath}.${(await output).extension}`;
|
|
||||||
await fsp.writeFile(outputFile, (await output).binary);
|
|
||||||
results
|
|
||||||
.get(image)
|
|
||||||
.outputs.push(Object.assign(await output, { outputFile }));
|
|
||||||
}
|
|
||||||
progress.setProgress(jobsFinished, jobsStarted);
|
|
||||||
});
|
|
||||||
jobs.push(job);
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the progress to account for multi-format
|
|
||||||
progress.setProgress(jobsFinished, jobsStarted);
|
|
||||||
// Wait for all jobs to finish
|
|
||||||
await Promise.all(jobs);
|
|
||||||
await imagePool.close();
|
|
||||||
progress.finish('Squoosh results:');
|
|
||||||
}
|
|
||||||
|
|
||||||
program
|
|
||||||
.name('squoosh-cli')
|
|
||||||
.arguments('<files...>')
|
|
||||||
.option('-d, --output-dir <dir>', 'Output directory', '.')
|
|
||||||
.option('-s, --suffix <suffix>', 'Append suffix to output files', '')
|
|
||||||
.option(
|
|
||||||
'--max-optimizer-rounds <rounds>',
|
|
||||||
'Maximum number of compressions to use for auto optimizations',
|
|
||||||
'6',
|
|
||||||
)
|
|
||||||
.option(
|
|
||||||
'--optimizer-butteraugli-target <butteraugli distance>',
|
|
||||||
'Target Butteraugli distance for auto optimizer',
|
|
||||||
'1.4',
|
|
||||||
)
|
|
||||||
.action(processFiles);
|
|
||||||
|
|
||||||
// Create a CLI option for each supported preprocessor
|
|
||||||
for (const [key, value] of Object.entries(preprocessors)) {
|
|
||||||
program.option(`--${key} [config]`, value.description);
|
|
||||||
}
|
|
||||||
// Create a CLI option for each supported encoder
|
|
||||||
for (const [key, value] of Object.entries(encoders)) {
|
|
||||||
program.option(
|
|
||||||
`--${key} [config]`,
|
|
||||||
`Use ${value.name} to generate a .${value.extension} file with the given configuration`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
program.parse(process.argv);
|
|
||||||
@@ -1,39 +1,33 @@
|
|||||||
# libavif and libaom versions are from
|
CODEC_URL = https://github.com/AOMediaCodec/libavif/archive/31d7c6d1e32cf467ac24fb8c7a76c4902a4c00db.tar.gz
|
||||||
# https://docs.google.com/document/d/1wEEA5rRU7wT54k41u3qyZIZHDCJArIMzLuzsrLAwaK8/edit
|
|
||||||
CODEC_URL = https://github.com/AOMediaCodec/libavif/archive/1c39e772c2c0d687691dd4b589a12c323f5f767d.tar.gz
|
|
||||||
CODEC_PACKAGE = node_modules/libavif.tar.gz
|
CODEC_PACKAGE = node_modules/libavif.tar.gz
|
||||||
|
|
||||||
LIBAOM_URL = https://aomedia.googlesource.com/aom/+archive/v3.1.0.tar.gz
|
LIBAOM_URL = https://aomedia.googlesource.com/aom/+archive/v2.0.0.tar.gz
|
||||||
LIBAOM_PACKAGE = node_modules/libaom.tar.gz
|
LIBAOM_PACKAGE = node_modules/libaom.tar.gz
|
||||||
|
|
||||||
export CODEC_DIR = node_modules/libavif
|
export CODEC_DIR = node_modules/libavif
|
||||||
export BUILD_DIR = node_modules/build
|
BUILD_DIR := node_modules/build
|
||||||
|
ENC_BUILD_DIR := $(BUILD_DIR)/enc
|
||||||
|
ENC_MT_BUILD_DIR := $(BUILD_DIR)/enc-mt
|
||||||
|
DEC_BUILD_DIR := $(BUILD_DIR)/dec
|
||||||
export LIBAOM_DIR = node_modules/libaom
|
export LIBAOM_DIR = node_modules/libaom
|
||||||
|
|
||||||
override CFLAGS += "-Wno-unused-macros"
|
|
||||||
export
|
|
||||||
|
|
||||||
OUT_ENC_JS = enc/avif_enc.js
|
OUT_ENC_JS = enc/avif_enc.js
|
||||||
OUT_NODE_ENC_JS = enc/avif_node_enc.js
|
|
||||||
OUT_ENC_MT_JS = enc/avif_enc_mt.js
|
OUT_ENC_MT_JS = enc/avif_enc_mt.js
|
||||||
OUT_DEC_JS = dec/avif_dec.js
|
OUT_DEC_JS = dec/avif_dec.js
|
||||||
OUT_NODE_DEC_JS = dec/avif_node_dec.js
|
|
||||||
|
|
||||||
OUT_ENC_CPP = enc/avif_enc.cpp
|
|
||||||
OUT_ENC_CPP = enc/avif_enc.cpp
|
OUT_ENC_CPP = enc/avif_enc.cpp
|
||||||
OUT_DEC_CPP = dec/avif_dec.cpp
|
OUT_DEC_CPP = dec/avif_dec.cpp
|
||||||
ENVIRONMENT = worker
|
|
||||||
|
|
||||||
HELPER_MAKEFLAGS := -f helper.Makefile
|
HELPER_MAKEFLAGS := -f helper.Makefile
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
all: $(OUT_ENC_JS) $(OUT_DEC_JS) $(OUT_ENC_MT_JS) $(OUT_NODE_ENC_JS) $(OUT_NODE_DEC_JS)
|
all: $(OUT_ENC_JS) $(OUT_DEC_JS) $(OUT_ENC_MT_JS)
|
||||||
|
|
||||||
$(OUT_NODE_ENC_JS): ENVIRONMENT=node
|
$(OUT_ENC_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
$(OUT_NODE_ENC_JS) $(OUT_ENC_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
$(HELPER_MAKEFLAGS) \
|
$(HELPER_MAKEFLAGS) \
|
||||||
|
BUILD_DIR=$(ENC_BUILD_DIR) \
|
||||||
OUT_JS=$@ \
|
OUT_JS=$@ \
|
||||||
OUT_CPP=$< \
|
OUT_CPP=$< \
|
||||||
LIBAOM_FLAGS="\
|
LIBAOM_FLAGS="\
|
||||||
@@ -41,33 +35,31 @@ $(OUT_NODE_ENC_JS) $(OUT_ENC_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(L
|
|||||||
-DCONFIG_MULTITHREAD=0 \
|
-DCONFIG_MULTITHREAD=0 \
|
||||||
-DCONFIG_AV1_HIGHBITDEPTH=0 \
|
-DCONFIG_AV1_HIGHBITDEPTH=0 \
|
||||||
" \
|
" \
|
||||||
ENVIRONMENT=$(ENVIRONMENT) \
|
|
||||||
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0"
|
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0"
|
||||||
|
|
||||||
$(OUT_ENC_MT_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
$(OUT_ENC_MT_JS): $(OUT_ENC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
$(HELPER_MAKEFLAGS) \
|
$(HELPER_MAKEFLAGS) \
|
||||||
|
BUILD_DIR=$(ENC_MT_BUILD_DIR) \
|
||||||
OUT_JS=$@ \
|
OUT_JS=$@ \
|
||||||
OUT_CPP=$< \
|
OUT_CPP=$< \
|
||||||
LIBAOM_FLAGS="\
|
LIBAOM_FLAGS="\
|
||||||
-DCONFIG_AV1_DECODER=0 \
|
-DCONFIG_AV1_DECODER=0 \
|
||||||
-DCONFIG_AV1_HIGHBITDEPTH=0 \
|
-DCONFIG_AV1_HIGHBITDEPTH=0 \
|
||||||
" \
|
" \
|
||||||
ENVIRONMENT=$(ENVIRONMENT) \
|
|
||||||
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0" \
|
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_DECODE=0" \
|
||||||
OUT_FLAGS="-pthread"
|
OUT_FLAGS="-pthread"
|
||||||
|
|
||||||
$(OUT_NODE_DEC_JS): ENVIRONMENT=node
|
$(OUT_DEC_JS): $(OUT_DEC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
||||||
$(OUT_NODE_DEC_JS) $(OUT_DEC_JS): $(OUT_DEC_CPP) $(CODEC_DIR)/CMakeLists.txt $(LIBAOM_DIR)/CMakeLists.txt
|
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
$(HELPER_MAKEFLAGS) \
|
$(HELPER_MAKEFLAGS) \
|
||||||
|
BUILD_DIR=$(DEC_BUILD_DIR) \
|
||||||
OUT_JS=$@ \
|
OUT_JS=$@ \
|
||||||
OUT_CPP=$< \
|
OUT_CPP=$< \
|
||||||
LIBAOM_FLAGS="\
|
LIBAOM_FLAGS="\
|
||||||
-DCONFIG_AV1_ENCODER=0 \
|
-DCONFIG_AV1_ENCODER=0 \
|
||||||
-DCONFIG_MULTITHREAD=0 \
|
-DCONFIG_MULTITHREAD=0 \
|
||||||
" \
|
" \
|
||||||
ENVIRONMENT=$(ENVIRONMENT) \
|
|
||||||
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_ENCODE=0"
|
LIBAVIF_FLAGS="-DAVIF_CODEC_AOM_ENCODE=0"
|
||||||
|
|
||||||
$(CODEC_PACKAGE):
|
$(CODEC_PACKAGE):
|
||||||
@@ -87,6 +79,6 @@ $(LIBAOM_DIR)/CMakeLists.txt: $(LIBAOM_PACKAGE)
|
|||||||
tar xzm -C $(@D) -f $(LIBAOM_PACKAGE)
|
tar xzm -C $(@D) -f $(LIBAOM_PACKAGE)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) $(HELPER_MAKEFLAGS) OUT_JS=$(OUT_ENC_JS) clean
|
$(MAKE) $(HELPER_MAKEFLAGS) BUILD_DIR=$(ENC_BUILD_DIR) OUT_JS=$(OUT_ENC_JS) clean
|
||||||
$(MAKE) $(HELPER_MAKEFLAGS) OUT_JS=$(OUT_ENC_MT_JS) clean
|
$(MAKE) $(HELPER_MAKEFLAGS) BUILD_DIR=$(ENC_MT_BUILD_DIR) OUT_JS=$(OUT_ENC_MT_JS) clean
|
||||||
$(MAKE) $(HELPER_MAKEFLAGS) OUT_JS=$(OUT_DEC_JS) clean
|
$(MAKE) $(HELPER_MAKEFLAGS) BUILD_DIR=$(DEC_BUILD_DIR) OUT_JS=$(OUT_DEC_JS) clean
|
||||||
|
|||||||
1281
codecs/avif/dec/avif_dec.js
generated
1281
codecs/avif/dec/avif_dec.js
generated
File diff suppressed because one or more lines are too long
BIN
codecs/avif/dec/avif_dec.wasm
Executable file → Normal file
BIN
codecs/avif/dec/avif_dec.wasm
Executable file → Normal file
Binary file not shown.
16
codecs/avif/dec/avif_node_dec.js
generated
16
codecs/avif/dec/avif_node_dec.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -9,9 +9,10 @@ struct AvifOptions {
|
|||||||
// [0 - 63]
|
// [0 - 63]
|
||||||
// 0 = lossless
|
// 0 = lossless
|
||||||
// 63 = worst quality
|
// 63 = worst quality
|
||||||
int cqLevel;
|
int minQuantizer;
|
||||||
// As above, but -1 means 'use cqLevel'
|
int maxQuantizer;
|
||||||
int cqAlphaLevel;
|
int minQuantizerAlpha;
|
||||||
|
int maxQuantizerAlpha;
|
||||||
// [0 - 6]
|
// [0 - 6]
|
||||||
// Creates 2^n tiles in that dimension
|
// Creates 2^n tiles in that dimension
|
||||||
int tileRowsLog2;
|
int tileRowsLog2;
|
||||||
@@ -25,16 +26,6 @@ struct AvifOptions {
|
|||||||
// 2 = 4:2:2
|
// 2 = 4:2:2
|
||||||
// 3 = 4:4:4
|
// 3 = 4:4:4
|
||||||
int subsample;
|
int subsample;
|
||||||
// Extra chroma compression
|
|
||||||
bool chromaDeltaQ;
|
|
||||||
// 0-7
|
|
||||||
int sharpness;
|
|
||||||
// 0 = auto
|
|
||||||
// 1 = PSNR
|
|
||||||
// 2 = SSIM
|
|
||||||
int tune;
|
|
||||||
// 0-50
|
|
||||||
int denoiseLevel;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
thread_local const val Uint8Array = val::global("Uint8Array");
|
thread_local const val Uint8Array = val::global("Uint8Array");
|
||||||
@@ -58,19 +49,18 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lossless = options.cqLevel == AVIF_QUANTIZER_LOSSLESS &&
|
|
||||||
options.cqAlphaLevel <= AVIF_QUANTIZER_LOSSLESS &&
|
|
||||||
format == AVIF_PIXEL_FORMAT_YUV444;
|
|
||||||
|
|
||||||
avifImage* image = avifImageCreate(width, height, depth, format);
|
avifImage* image = avifImageCreate(width, height, depth, format);
|
||||||
|
|
||||||
if (lossless) {
|
if (options.maxQuantizer == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
options.minQuantizer == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
options.minQuantizerAlpha == AVIF_QUANTIZER_LOSSLESS &&
|
||||||
|
options.maxQuantizerAlpha == AVIF_QUANTIZER_LOSSLESS && format == AVIF_PIXEL_FORMAT_YUV444) {
|
||||||
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_IDENTITY;
|
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_IDENTITY;
|
||||||
} else {
|
} else {
|
||||||
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_BT601;
|
image->matrixCoefficients = AVIF_MATRIX_COEFFICIENTS_BT709;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t* rgba = reinterpret_cast<uint8_t*>(const_cast<char*>(buffer.data()));
|
uint8_t* rgba = (uint8_t*)buffer.c_str();
|
||||||
|
|
||||||
avifRGBImage srcRGB;
|
avifRGBImage srcRGB;
|
||||||
avifRGBImageSetDefaults(&srcRGB, image);
|
avifRGBImageSetDefaults(&srcRGB, image);
|
||||||
@@ -79,44 +69,14 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
|
|||||||
avifImageRGBToYUV(image, &srcRGB);
|
avifImageRGBToYUV(image, &srcRGB);
|
||||||
|
|
||||||
avifEncoder* encoder = avifEncoderCreate();
|
avifEncoder* encoder = avifEncoderCreate();
|
||||||
|
|
||||||
if (lossless) {
|
|
||||||
encoder->minQuantizer = AVIF_QUANTIZER_LOSSLESS;
|
|
||||||
encoder->maxQuantizer = AVIF_QUANTIZER_LOSSLESS;
|
|
||||||
encoder->minQuantizerAlpha = AVIF_QUANTIZER_LOSSLESS;
|
|
||||||
encoder->maxQuantizerAlpha = AVIF_QUANTIZER_LOSSLESS;
|
|
||||||
} else {
|
|
||||||
encoder->minQuantizer = AVIF_QUANTIZER_BEST_QUALITY;
|
|
||||||
encoder->maxQuantizer = AVIF_QUANTIZER_WORST_QUALITY;
|
|
||||||
encoder->minQuantizerAlpha = AVIF_QUANTIZER_BEST_QUALITY;
|
|
||||||
encoder->maxQuantizerAlpha = AVIF_QUANTIZER_WORST_QUALITY;
|
|
||||||
avifEncoderSetCodecSpecificOption(encoder, "end-usage", "q");
|
|
||||||
avifEncoderSetCodecSpecificOption(encoder, "cq-level", std::to_string(options.cqLevel).c_str());
|
|
||||||
avifEncoderSetCodecSpecificOption(encoder, "sharpness",
|
|
||||||
std::to_string(options.sharpness).c_str());
|
|
||||||
|
|
||||||
if (options.cqAlphaLevel != -1) {
|
|
||||||
avifEncoderSetCodecSpecificOption(encoder, "alpha:cq-level",
|
|
||||||
std::to_string(options.cqAlphaLevel).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.tune == 2 || (options.tune == 0 && options.cqLevel <= 32)) {
|
|
||||||
avifEncoderSetCodecSpecificOption(encoder, "tune", "ssim");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.chromaDeltaQ) {
|
|
||||||
avifEncoderSetCodecSpecificOption(encoder, "enable-chroma-deltaq", "1");
|
|
||||||
}
|
|
||||||
|
|
||||||
avifEncoderSetCodecSpecificOption(encoder, "color:denoise-noise-level",
|
|
||||||
std::to_string(options.denoiseLevel).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
encoder->maxThreads = emscripten_num_logical_cores();
|
encoder->maxThreads = emscripten_num_logical_cores();
|
||||||
|
encoder->minQuantizer = options.minQuantizer;
|
||||||
|
encoder->maxQuantizer = options.maxQuantizer;
|
||||||
|
encoder->minQuantizerAlpha = options.minQuantizerAlpha;
|
||||||
|
encoder->maxQuantizerAlpha = options.maxQuantizerAlpha;
|
||||||
encoder->tileRowsLog2 = options.tileRowsLog2;
|
encoder->tileRowsLog2 = options.tileRowsLog2;
|
||||||
encoder->tileColsLog2 = options.tileColsLog2;
|
encoder->tileColsLog2 = options.tileColsLog2;
|
||||||
encoder->speed = options.speed;
|
encoder->speed = options.speed;
|
||||||
|
|
||||||
avifResult encodeResult = avifEncoderWrite(encoder, image, &output);
|
avifResult encodeResult = avifEncoderWrite(encoder, image, &output);
|
||||||
auto js_result = val::null();
|
auto js_result = val::null();
|
||||||
if (encodeResult == AVIF_RESULT_OK) {
|
if (encodeResult == AVIF_RESULT_OK) {
|
||||||
@@ -131,15 +91,13 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
|
|||||||
|
|
||||||
EMSCRIPTEN_BINDINGS(my_module) {
|
EMSCRIPTEN_BINDINGS(my_module) {
|
||||||
value_object<AvifOptions>("AvifOptions")
|
value_object<AvifOptions>("AvifOptions")
|
||||||
.field("cqLevel", &AvifOptions::cqLevel)
|
.field("minQuantizer", &AvifOptions::minQuantizer)
|
||||||
.field("cqAlphaLevel", &AvifOptions::cqAlphaLevel)
|
.field("maxQuantizer", &AvifOptions::maxQuantizer)
|
||||||
|
.field("minQuantizerAlpha", &AvifOptions::minQuantizerAlpha)
|
||||||
|
.field("maxQuantizerAlpha", &AvifOptions::maxQuantizerAlpha)
|
||||||
.field("tileRowsLog2", &AvifOptions::tileRowsLog2)
|
.field("tileRowsLog2", &AvifOptions::tileRowsLog2)
|
||||||
.field("tileColsLog2", &AvifOptions::tileColsLog2)
|
.field("tileColsLog2", &AvifOptions::tileColsLog2)
|
||||||
.field("speed", &AvifOptions::speed)
|
.field("speed", &AvifOptions::speed)
|
||||||
.field("chromaDeltaQ", &AvifOptions::chromaDeltaQ)
|
|
||||||
.field("sharpness", &AvifOptions::sharpness)
|
|
||||||
.field("tune", &AvifOptions::tune)
|
|
||||||
.field("denoiseLevel", &AvifOptions::denoiseLevel)
|
|
||||||
.field("subsample", &AvifOptions::subsample);
|
.field("subsample", &AvifOptions::subsample);
|
||||||
|
|
||||||
function("encode", &encode);
|
function("encode", &encode);
|
||||||
|
|||||||
16
codecs/avif/enc/avif_enc.d.ts
vendored
16
codecs/avif/enc/avif_enc.d.ts
vendored
@@ -1,20 +1,12 @@
|
|||||||
export const enum AVIFTune {
|
|
||||||
auto,
|
|
||||||
psnr,
|
|
||||||
ssim,
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EncodeOptions {
|
export interface EncodeOptions {
|
||||||
cqLevel: number;
|
minQuantizer: number;
|
||||||
denoiseLevel: number;
|
maxQuantizer: number;
|
||||||
cqAlphaLevel: number;
|
minQuantizerAlpha: number;
|
||||||
|
maxQuantizerAlpha: number;
|
||||||
tileRowsLog2: number;
|
tileRowsLog2: number;
|
||||||
tileColsLog2: number;
|
tileColsLog2: number;
|
||||||
speed: number;
|
speed: number;
|
||||||
subsample: number;
|
subsample: number;
|
||||||
chromaDeltaQ: boolean;
|
|
||||||
sharpness: number;
|
|
||||||
tune: AVIFTune;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AVIFModule extends EmscriptenWasm.Module {
|
export interface AVIFModule extends EmscriptenWasm.Module {
|
||||||
|
|||||||
2454
codecs/avif/enc/avif_enc.js
generated
2454
codecs/avif/enc/avif_enc.js
generated
File diff suppressed because one or more lines are too long
BIN
codecs/avif/enc/avif_enc.wasm
Executable file → Normal file
BIN
codecs/avif/enc/avif_enc.wasm
Executable file → Normal file
Binary file not shown.
1
codecs/avif/enc/avif_enc_mt.d.ts
vendored
1
codecs/avif/enc/avif_enc_mt.d.ts
vendored
@@ -1 +1,2 @@
|
|||||||
|
export * from './avif_enc';
|
||||||
export { default } from './avif_enc';
|
export { default } from './avif_enc';
|
||||||
|
|||||||
3274
codecs/avif/enc/avif_enc_mt.js
generated
3274
codecs/avif/enc/avif_enc_mt.js
generated
File diff suppressed because one or more lines are too long
BIN
codecs/avif/enc/avif_enc_mt.wasm
Executable file → Normal file
BIN
codecs/avif/enc/avif_enc_mt.wasm
Executable file → Normal file
Binary file not shown.
104
codecs/avif/enc/avif_enc_mt.worker.js
generated
104
codecs/avif/enc/avif_enc_mt.worker.js
generated
@@ -1 +1,103 @@
|
|||||||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};function moduleLoaded(){}self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;(e.data.urlOrBlob?import(e.data.urlOrBlob):import("./avif_enc_mt.js")).then(function(exports){return exports.default(Module)}).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["PThread"].threadExit(result)}}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
var threadInfoStruct = 0;
|
||||||
|
var selfThreadId = 0;
|
||||||
|
var parentThreadId = 0;
|
||||||
|
var initializedJS = false;
|
||||||
|
var Module = {};
|
||||||
|
function threadPrintErr() {
|
||||||
|
var text = Array.prototype.slice.call(arguments).join(' ');
|
||||||
|
console.error(text);
|
||||||
|
}
|
||||||
|
function threadAlert() {
|
||||||
|
var text = Array.prototype.slice.call(arguments).join(' ');
|
||||||
|
postMessage({ cmd: 'alert', text: text, threadId: selfThreadId });
|
||||||
|
}
|
||||||
|
var err = threadPrintErr;
|
||||||
|
this.alert = threadAlert;
|
||||||
|
Module['instantiateWasm'] = function (info, receiveInstance) {
|
||||||
|
var instance = new WebAssembly.Instance(Module['wasmModule'], info);
|
||||||
|
Module['wasmModule'] = null;
|
||||||
|
receiveInstance(instance);
|
||||||
|
return instance.exports;
|
||||||
|
};
|
||||||
|
this.onmessage = function (e) {
|
||||||
|
try {
|
||||||
|
if (e.data.cmd === 'load') {
|
||||||
|
Module['wasmModule'] = e.data.wasmModule;
|
||||||
|
Module['wasmMemory'] = e.data.wasmMemory;
|
||||||
|
Module['buffer'] = Module['wasmMemory'].buffer;
|
||||||
|
Module['ENVIRONMENT_IS_PTHREAD'] = true;
|
||||||
|
import(e.data.urlOrBlob)
|
||||||
|
.then(function (avif_enc_mt) {
|
||||||
|
return avif_enc_mt.default(Module);
|
||||||
|
})
|
||||||
|
.then(function (instance) {
|
||||||
|
Module = instance;
|
||||||
|
postMessage({ cmd: 'loaded' });
|
||||||
|
});
|
||||||
|
} else if (e.data.cmd === 'objectTransfer') {
|
||||||
|
Module['PThread'].receiveObjectTransfer(e.data);
|
||||||
|
} else if (e.data.cmd === 'run') {
|
||||||
|
Module['__performance_now_clock_drift'] = performance.now() - e.data.time;
|
||||||
|
threadInfoStruct = e.data.threadInfoStruct;
|
||||||
|
Module['registerPthreadPtr'](
|
||||||
|
threadInfoStruct,
|
||||||
|
/*isMainBrowserThread=*/ 0,
|
||||||
|
/*isMainRuntimeThread=*/ 0,
|
||||||
|
);
|
||||||
|
selfThreadId = e.data.selfThreadId;
|
||||||
|
parentThreadId = e.data.parentThreadId;
|
||||||
|
var max = e.data.stackBase;
|
||||||
|
var top = e.data.stackBase + e.data.stackSize;
|
||||||
|
Module['establishStackSpace'](top, max);
|
||||||
|
Module['_emscripten_tls_init']();
|
||||||
|
Module['PThread'].receiveObjectTransfer(e.data);
|
||||||
|
Module['PThread'].setThreadStatus(Module['_pthread_self'](), 1);
|
||||||
|
if (!initializedJS) {
|
||||||
|
Module['___embind_register_native_and_builtin_types']();
|
||||||
|
initializedJS = true;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
var result = Module['dynCall']('ii', e.data.start_routine, [
|
||||||
|
e.data.arg,
|
||||||
|
]);
|
||||||
|
if (!Module['getNoExitRuntime']()) Module['PThread'].threadExit(result);
|
||||||
|
} catch (ex) {
|
||||||
|
if (ex === 'Canceled!') {
|
||||||
|
Module['PThread'].threadCancel();
|
||||||
|
} else if (ex != 'unwind') {
|
||||||
|
Atomics.store(
|
||||||
|
Module['HEAPU32'],
|
||||||
|
(threadInfoStruct + 4) >> /*C_STRUCTS.pthread.threadExitCode*/ 2,
|
||||||
|
ex instanceof Module['ExitStatus'] ? ex.status : -2,
|
||||||
|
);
|
||||||
|
/*A custom entry specific to Emscripten denoting that the thread crashed.*/ Atomics.store(
|
||||||
|
Module['HEAPU32'],
|
||||||
|
(threadInfoStruct + 0) >> /*C_STRUCTS.pthread.threadStatus*/ 2,
|
||||||
|
1,
|
||||||
|
);
|
||||||
|
Module['_emscripten_futex_wake'](
|
||||||
|
threadInfoStruct + 0,
|
||||||
|
/*C_STRUCTS.pthread.threadStatus*/ 2147483647,
|
||||||
|
);
|
||||||
|
if (!(ex instanceof Module['ExitStatus'])) throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (e.data.cmd === 'cancel') {
|
||||||
|
if (threadInfoStruct) {
|
||||||
|
Module['PThread'].threadCancel();
|
||||||
|
}
|
||||||
|
} else if (e.data.target === 'setimmediate') {
|
||||||
|
} else if (e.data.cmd === 'processThreadQueue') {
|
||||||
|
if (threadInfoStruct) {
|
||||||
|
Module['_emscripten_current_thread_process_queued_calls']();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err('worker.js received unknown command ' + e.data.cmd);
|
||||||
|
err(e.data);
|
||||||
|
}
|
||||||
|
} catch (ex) {
|
||||||
|
err('worker.js onmessage() captured an uncaught exception: ' + ex);
|
||||||
|
if (ex && ex.stack) err(ex.stack);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
16
codecs/avif/enc/avif_node_enc.js
generated
16
codecs/avif/enc/avif_node_enc.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -8,14 +8,11 @@
|
|||||||
# $(OUT_CPP)
|
# $(OUT_CPP)
|
||||||
# $(LIBAOM_FLAGS)
|
# $(LIBAOM_FLAGS)
|
||||||
# $(LIBAVIF_FLAGS)
|
# $(LIBAVIF_FLAGS)
|
||||||
# $(ENVIRONMENT)
|
|
||||||
|
|
||||||
OUT_BUILD_DIR := $(BUILD_DIR)/$(basename $(OUT_JS))
|
CODEC_BUILD_DIR := $(BUILD_DIR)/libavif
|
||||||
|
|
||||||
CODEC_BUILD_DIR := $(OUT_BUILD_DIR)/libavif
|
|
||||||
CODEC_OUT := $(CODEC_BUILD_DIR)/libavif.a
|
CODEC_OUT := $(CODEC_BUILD_DIR)/libavif.a
|
||||||
|
|
||||||
LIBAOM_BUILD_DIR := $(OUT_BUILD_DIR)/libaom
|
LIBAOM_BUILD_DIR := $(BUILD_DIR)/libaom
|
||||||
LIBAOM_OUT := $(LIBAOM_BUILD_DIR)/libaom.a
|
LIBAOM_OUT := $(LIBAOM_BUILD_DIR)/libaom.a
|
||||||
|
|
||||||
OUT_WASM = $(OUT_JS:.js=.wasm)
|
OUT_WASM = $(OUT_JS:.js=.wasm)
|
||||||
@@ -32,8 +29,13 @@ $(OUT_JS): $(OUT_CPP) $(LIBAOM_OUT) $(CODEC_OUT)
|
|||||||
$(LDFLAGS) \
|
$(LDFLAGS) \
|
||||||
$(OUT_FLAGS) \
|
$(OUT_FLAGS) \
|
||||||
--bind \
|
--bind \
|
||||||
-s ENVIRONMENT=$(ENVIRONMENT) \
|
--closure 1 \
|
||||||
|
-s ALLOW_MEMORY_GROWTH=1 \
|
||||||
|
-s MODULARIZE=1 \
|
||||||
|
-s TEXTDECODER=2 \
|
||||||
|
-s ENVIRONMENT='worker' \
|
||||||
-s EXPORT_ES6=1 \
|
-s EXPORT_ES6=1 \
|
||||||
|
-s EXPORT_NAME="$(basename $(@F))" \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
$+
|
$+
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
docker build -t squoosh-cpp - < ../cpp.Dockerfile
|
docker build -t squoosh-cpp - < ../cpp.Dockerfile
|
||||||
docker run -it --rm -v $PWD:/src squoosh-cpp "$@"
|
docker run --rm -v $PWD:/src squoosh-cpp
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ then
|
|||||||
fi
|
fi
|
||||||
IMG_NAME=squoosh-rust$IMG_SUFFIX
|
IMG_NAME=squoosh-rust$IMG_SUFFIX
|
||||||
docker build -t $IMG_NAME --build-arg RUST_IMG - < ../rust.Dockerfile
|
docker build -t $IMG_NAME --build-arg RUST_IMG - < ../rust.Dockerfile
|
||||||
docker run -it --rm -v $PWD:/src $IMG_NAME "$@"
|
docker run --rm -v $PWD:/src $IMG_NAME "$@"
|
||||||
|
|||||||
@@ -1,17 +1,9 @@
|
|||||||
FROM emscripten/emsdk:2.0.23
|
FROM emscripten/emsdk:2.0.8
|
||||||
RUN apt-get update && apt-get install -qqy autoconf libtool pkg-config
|
RUN apt-get update && apt-get install -qqy autoconf libtool pkg-config
|
||||||
ENV CFLAGS "-O3 -flto"
|
ENV CFLAGS "-O3 -flto"
|
||||||
ENV CXXFLAGS "${CFLAGS} -std=c++17"
|
ENV CXXFLAGS "${CFLAGS} -std=c++17"
|
||||||
ENV LDFLAGS "${CFLAGS} \
|
ENV LDFLAGS "${CFLAGS} -s PTHREAD_POOL_SIZE=navigator.hardwareConcurrency"
|
||||||
-s FILESYSTEM=0 \
|
# Build and cache standard libraries with these flags
|
||||||
-s PTHREAD_POOL_SIZE=navigator.hardwareConcurrency \
|
RUN emcc ${CXXFLAGS} --bind -xc++ /dev/null -o /dev/null
|
||||||
-s ALLOW_MEMORY_GROWTH=1 \
|
|
||||||
-s TEXTDECODER=2 \
|
|
||||||
-s NODEJS_CATCH_EXIT=0 -s NODEJS_CATCH_REJECTION=0 \
|
|
||||||
"
|
|
||||||
# Build and cache standard libraries with these flags + Embind.
|
|
||||||
RUN emcc ${CXXFLAGS} ${LDFLAGS} --bind -xc++ /dev/null -o /dev/null
|
|
||||||
# And another set for the pthread variant.
|
|
||||||
RUN emcc ${CXXFLAGS} ${LDFLAGS} --bind -pthread -xc++ /dev/null -o /dev/null
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
CMD ["sh", "-c", "emmake make -j`nproc`"]
|
CMD ["sh", "-c", "emmake make -j`nproc`"]
|
||||||
|
|||||||
197
codecs/hqx/Cargo.lock
generated
197
codecs/hqx/Cargo.lock
generated
@@ -4,289 +4,286 @@
|
|||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.4.0"
|
version = "3.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-if"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console_error_panic_hook"
|
name = "console_error_panic_hook"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.10",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures"
|
name = "futures"
|
||||||
version = "0.1.29"
|
version = "0.1.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hqx"
|
name = "hqx"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/CryZe/wasmboy-rs?tag=v0.1.3#d7cbae67906796928c8e451b186f3c653924beb8"
|
source = "git+https://github.com/CryZe/wasmboy-rs?tag=v0.1.2#5f19cda24191ccc7c0c4920b6b246b4e242f377c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "js-sys"
|
name = "js-sys"
|
||||||
version = "0.3.42"
|
version = "0.3.42"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.73"
|
version = "0.2.73"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.11"
|
version = "0.4.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.10",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memory_units"
|
name = "memory_units"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "0.4.30"
|
version = "0.4.30"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid 0.1.0",
|
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.27"
|
version = "1.0.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid 0.2.1",
|
"unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "0.6.13"
|
version = "0.6.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 0.4.30",
|
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.7"
|
version = "1.0.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.27",
|
"proc-macro2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scoped-tls"
|
name = "scoped-tls"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "squooshhqx"
|
name = "squooshhqx"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.10",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hqx",
|
"hqx 0.1.0 (git+https://github.com/CryZe/wasmboy-rs?tag=v0.1.2)",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen-test",
|
"wasm-bindgen-test 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wee_alloc",
|
"wee_alloc 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.72"
|
version = "1.0.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.27",
|
"proc-macro2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-xid 0.2.1",
|
"unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.74"
|
version = "0.2.65"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen-macro",
|
"wasm-bindgen-macro 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "wasm-bindgen-backend"
|
||||||
version = "0.2.74"
|
version = "0.2.65"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log",
|
"log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"proc-macro2 1.0.27",
|
"proc-macro2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn",
|
"syn 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-futures"
|
name = "wasm-bindgen-futures"
|
||||||
version = "0.3.27"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.10",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"futures",
|
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"js-sys",
|
"js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"web-sys",
|
"web-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.74"
|
version = "0.2.65"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote 1.0.7",
|
"quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.74"
|
version = "0.2.65"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.27",
|
"proc-macro2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 1.0.7",
|
"quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn",
|
"syn 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.74"
|
version = "0.2.65"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-test"
|
name = "wasm-bindgen-test"
|
||||||
version = "0.2.50"
|
version = "0.2.50"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2d9693b63a742d481c7f80587e057920e568317b2806988c59cd71618bc26c1"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"futures",
|
"futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"js-sys",
|
"js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"scoped-tls",
|
"scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen-test-macro",
|
"wasm-bindgen-test-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-test-macro"
|
name = "wasm-bindgen-test-macro"
|
||||||
version = "0.2.50"
|
version = "0.2.50"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0789dac148a8840bbcf9efe13905463b733fa96543bfbf263790535c11af7ba5"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 0.4.30",
|
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 0.6.13",
|
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.42"
|
version = "0.3.42"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js-sys",
|
"js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wee_alloc"
|
name = "wee_alloc"
|
||||||
version = "0.4.5"
|
version = "0.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.10",
|
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc",
|
"libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"memory_units",
|
"memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi",
|
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi-i686-pc-windows-gnu",
|
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi-x86_64-pc-windows-gnu",
|
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-i686-pc-windows-gnu"
|
name = "winapi-i686-pc-windows-gnu"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-x86_64-pc-windows-gnu"
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
||||||
|
[metadata]
|
||||||
|
"checksum bumpalo 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
||||||
|
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
|
"checksum console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
|
||||||
|
"checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
|
||||||
|
"checksum hqx 0.1.0 (git+https://github.com/CryZe/wasmboy-rs?tag=v0.1.2)" = "<none>"
|
||||||
|
"checksum js-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)" = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2"
|
||||||
|
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
"checksum libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)" = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
|
||||||
|
"checksum log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||||
|
"checksum memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3"
|
||||||
|
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||||
|
"checksum proc-macro2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
|
||||||
|
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||||
|
"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||||
|
"checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
||||||
|
"checksum syn 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0"
|
||||||
|
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||||
|
"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||||
|
"checksum wasm-bindgen 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "f3edbcc9536ab7eababcc6d2374a0b7bfe13a2b6d562c5e07f370456b1a8f33d"
|
||||||
|
"checksum wasm-bindgen-backend 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "89ed2fb8c84bfad20ea66b26a3743f3e7ba8735a69fe7d95118c33ec8fc1244d"
|
||||||
|
"checksum wasm-bindgen-futures 0.3.27 (registry+https://github.com/rust-lang/crates.io-index)" = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c"
|
||||||
|
"checksum wasm-bindgen-macro 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "eb071268b031a64d92fc6cf691715ca5a40950694d8f683c5bb43db7c730929e"
|
||||||
|
"checksum wasm-bindgen-macro-support 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6"
|
||||||
|
"checksum wasm-bindgen-shared 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "72b6c0220ded549d63860c78c38f3bcc558d1ca3f4efa74942c536ddbbb55e87"
|
||||||
|
"checksum wasm-bindgen-test 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "a2d9693b63a742d481c7f80587e057920e568317b2806988c59cd71618bc26c1"
|
||||||
|
"checksum wasm-bindgen-test-macro 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "0789dac148a8840bbcf9efe13905463b733fa96543bfbf263790535c11af7ba5"
|
||||||
|
"checksum web-sys 0.3.42 (registry+https://github.com/rust-lang/crates.io-index)" = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2"
|
||||||
|
"checksum wee_alloc 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e"
|
||||||
|
"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||||
|
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ default = ["console_error_panic_hook", "wee_alloc"]
|
|||||||
cfg-if = "0.1.2"
|
cfg-if = "0.1.2"
|
||||||
wasm-bindgen = "0.2.38"
|
wasm-bindgen = "0.2.38"
|
||||||
# lazy_static = "1.0.0"
|
# lazy_static = "1.0.0"
|
||||||
hqx = {git = "https://github.com/CryZe/wasmboy-rs", tag="v0.1.3"}
|
hqx = {git = "https://github.com/CryZe/wasmboy-rs", tag="v0.1.2"}
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
# The `console_error_panic_hook` crate provides better debugging of panics by
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
# logging them with `console.error`. This is great for development, but requires
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hqx",
|
"name": "hqx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "../build-rust.sh"
|
"build": "RUST_IMG=rust:1.40 ../build-rust.sh"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
54
codecs/hqx/pkg/squooshhqx.d.ts
generated
vendored
54
codecs/hqx/pkg/squooshhqx.d.ts
generated
vendored
@@ -1,30 +1,48 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
/**
|
/**
|
||||||
* @param {Uint32Array} input_image
|
* @param {Uint32Array} input_image
|
||||||
* @param {number} input_width
|
* @param {number} input_width
|
||||||
* @param {number} input_height
|
* @param {number} input_height
|
||||||
* @param {number} factor
|
* @param {number} factor
|
||||||
* @returns {Uint32Array}
|
* @returns {Uint32Array}
|
||||||
*/
|
*/
|
||||||
export function resize(input_image: Uint32Array, input_width: number, input_height: number, factor: number): Uint32Array;
|
export function resize(
|
||||||
|
input_image: Uint32Array,
|
||||||
|
input_width: number,
|
||||||
|
input_height: number,
|
||||||
|
factor: number,
|
||||||
|
): Uint32Array;
|
||||||
|
|
||||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
export type InitInput =
|
||||||
|
| RequestInfo
|
||||||
|
| URL
|
||||||
|
| Response
|
||||||
|
| BufferSource
|
||||||
|
| WebAssembly.Module;
|
||||||
|
|
||||||
export interface InitOutput {
|
export interface InitOutput {
|
||||||
readonly memory: WebAssembly.Memory;
|
readonly memory: WebAssembly.Memory;
|
||||||
readonly resize: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
readonly resize: (
|
||||||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
a: number,
|
||||||
|
b: number,
|
||||||
|
c: number,
|
||||||
|
d: number,
|
||||||
|
e: number,
|
||||||
|
f: number,
|
||||||
|
) => void;
|
||||||
readonly __wbindgen_malloc: (a: number) => number;
|
readonly __wbindgen_malloc: (a: number) => number;
|
||||||
readonly __wbindgen_free: (a: number, b: number) => void;
|
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
||||||
* for everything else, calls `WebAssembly.instantiate` directly.
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
||||||
*
|
*
|
||||||
* @param {InitInput | Promise<InitInput>} module_or_path
|
* @param {InitInput | Promise<InitInput>} module_or_path
|
||||||
*
|
*
|
||||||
* @returns {Promise<InitOutput>}
|
* @returns {Promise<InitOutput>}
|
||||||
*/
|
*/
|
||||||
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
export default function init(
|
||||||
|
module_or_path?: InitInput | Promise<InitInput>,
|
||||||
|
): Promise<InitOutput>;
|
||||||
|
|||||||
145
codecs/hqx/pkg/squooshhqx.js
generated
145
codecs/hqx/pkg/squooshhqx.js
generated
@@ -1,108 +1,107 @@
|
|||||||
|
|
||||||
let wasm;
|
let wasm;
|
||||||
|
|
||||||
let cachegetUint32Memory0 = null;
|
let cachegetUint32Memory0 = null;
|
||||||
function getUint32Memory0() {
|
function getUint32Memory0() {
|
||||||
if (cachegetUint32Memory0 === null || cachegetUint32Memory0.buffer !== wasm.memory.buffer) {
|
if (
|
||||||
cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
cachegetUint32Memory0 === null ||
|
||||||
}
|
cachegetUint32Memory0.buffer !== wasm.memory.buffer
|
||||||
return cachegetUint32Memory0;
|
) {
|
||||||
|
cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
||||||
|
}
|
||||||
|
return cachegetUint32Memory0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let WASM_VECTOR_LEN = 0;
|
let WASM_VECTOR_LEN = 0;
|
||||||
|
|
||||||
function passArray32ToWasm0(arg, malloc) {
|
function passArray32ToWasm0(arg, malloc) {
|
||||||
const ptr = malloc(arg.length * 4);
|
const ptr = malloc(arg.length * 4);
|
||||||
getUint32Memory0().set(arg, ptr / 4);
|
getUint32Memory0().set(arg, ptr / 4);
|
||||||
WASM_VECTOR_LEN = arg.length;
|
WASM_VECTOR_LEN = arg.length;
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
let cachegetInt32Memory0 = null;
|
let cachegetInt32Memory0 = null;
|
||||||
function getInt32Memory0() {
|
function getInt32Memory0() {
|
||||||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
if (
|
||||||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
cachegetInt32Memory0 === null ||
|
||||||
}
|
cachegetInt32Memory0.buffer !== wasm.memory.buffer
|
||||||
return cachegetInt32Memory0;
|
) {
|
||||||
|
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||||
|
}
|
||||||
|
return cachegetInt32Memory0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArrayU32FromWasm0(ptr, len) {
|
function getArrayU32FromWasm0(ptr, len) {
|
||||||
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {Uint32Array} input_image
|
* @param {Uint32Array} input_image
|
||||||
* @param {number} input_width
|
* @param {number} input_width
|
||||||
* @param {number} input_height
|
* @param {number} input_height
|
||||||
* @param {number} factor
|
* @param {number} factor
|
||||||
* @returns {Uint32Array}
|
* @returns {Uint32Array}
|
||||||
*/
|
*/
|
||||||
export function resize(input_image, input_width, input_height, factor) {
|
export function resize(input_image, input_width, input_height, factor) {
|
||||||
try {
|
var ptr0 = passArray32ToWasm0(input_image, wasm.__wbindgen_malloc);
|
||||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
var len0 = WASM_VECTOR_LEN;
|
||||||
var ptr0 = passArray32ToWasm0(input_image, wasm.__wbindgen_malloc);
|
wasm.resize(8, ptr0, len0, input_width, input_height, factor);
|
||||||
var len0 = WASM_VECTOR_LEN;
|
var r0 = getInt32Memory0()[8 / 4 + 0];
|
||||||
wasm.resize(retptr, ptr0, len0, input_width, input_height, factor);
|
var r1 = getInt32Memory0()[8 / 4 + 1];
|
||||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
||||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
wasm.__wbindgen_free(r0, r1 * 4);
|
||||||
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
return v1;
|
||||||
wasm.__wbindgen_free(r0, r1 * 4);
|
|
||||||
return v1;
|
|
||||||
} finally {
|
|
||||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function load(module, imports) {
|
async function load(module, imports) {
|
||||||
if (typeof Response === 'function' && module instanceof Response) {
|
if (typeof Response === 'function' && module instanceof Response) {
|
||||||
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||||
try {
|
try {
|
||||||
return await WebAssembly.instantiateStreaming(module, imports);
|
return await WebAssembly.instantiateStreaming(module, imports);
|
||||||
|
} catch (e) {
|
||||||
} catch (e) {
|
if (module.headers.get('Content-Type') != 'application/wasm') {
|
||||||
if (module.headers.get('Content-Type') != 'application/wasm') {
|
console.warn(
|
||||||
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
'`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n',
|
||||||
|
e,
|
||||||
} else {
|
);
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const bytes = await module.arrayBuffer();
|
|
||||||
return await WebAssembly.instantiate(bytes, imports);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
const instance = await WebAssembly.instantiate(module, imports);
|
|
||||||
|
|
||||||
if (instance instanceof WebAssembly.Instance) {
|
|
||||||
return { instance, module };
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return instance;
|
throw e;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bytes = await module.arrayBuffer();
|
||||||
|
return await WebAssembly.instantiate(bytes, imports);
|
||||||
|
} else {
|
||||||
|
const instance = await WebAssembly.instantiate(module, imports);
|
||||||
|
|
||||||
|
if (instance instanceof WebAssembly.Instance) {
|
||||||
|
return { instance, module };
|
||||||
|
} else {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init(input) {
|
async function init(input) {
|
||||||
if (typeof input === 'undefined') {
|
if (typeof input === 'undefined') {
|
||||||
input = new URL('squooshhqx_bg.wasm', import.meta.url);
|
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||||
}
|
}
|
||||||
const imports = {};
|
const imports = {};
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof input === 'string' ||
|
||||||
|
(typeof Request === 'function' && input instanceof Request) ||
|
||||||
|
(typeof URL === 'function' && input instanceof URL)
|
||||||
|
) {
|
||||||
|
input = fetch(input);
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
const { instance, module } = await load(await input, imports);
|
||||||
input = fetch(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
wasm = instance.exports;
|
||||||
|
init.__wbindgen_wasm_module = module;
|
||||||
|
|
||||||
|
return wasm;
|
||||||
const { instance, module } = await load(await input, imports);
|
|
||||||
|
|
||||||
wasm = instance.exports;
|
|
||||||
init.__wbindgen_wasm_module = module;
|
|
||||||
|
|
||||||
return wasm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default init;
|
export default init;
|
||||||
|
|
||||||
|
|||||||
6
codecs/hqx/pkg/squooshhqx_bg.d.ts
generated
vendored
Normal file
6
codecs/hqx/pkg/squooshhqx_bg.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
export const memory: WebAssembly.Memory;
|
||||||
|
export function resize(a: number, b: number, c: number, d: number, e: number, f: number): void;
|
||||||
|
export function __wbindgen_malloc(a: number): number;
|
||||||
|
export function __wbindgen_free(a: number, b: number): void;
|
||||||
Binary file not shown.
@@ -2,26 +2,27 @@ CODEC_URL := https://github.com/ImageOptim/libimagequant/archive/2.12.1.tar.gz
|
|||||||
CODEC_DIR := node_modules/libimagequant
|
CODEC_DIR := node_modules/libimagequant
|
||||||
CODEC_OUT_RELATIVE := libimagequant.a
|
CODEC_OUT_RELATIVE := libimagequant.a
|
||||||
CODEC_OUT := $(addprefix $(CODEC_DIR)/, $(CODEC_OUT_RELATIVE))
|
CODEC_OUT := $(addprefix $(CODEC_DIR)/, $(CODEC_OUT_RELATIVE))
|
||||||
OUT_JS := imagequant.js imagequant_node.js
|
OUT_JS := imagequant.js
|
||||||
OUT_WASM := $(OUT_JS:.js=.wasm)
|
OUT_WASM := $(OUT_JS:.js=.wasm)
|
||||||
ENVIRONMENT = worker
|
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
all: $(OUT_JS)
|
all: $(OUT_JS)
|
||||||
|
|
||||||
imagequant_node.js: ENVIRONMENT=node
|
%.js: %.cpp $(CODEC_OUT)
|
||||||
$(OUT_JS): $(CODEC_OUT)
|
|
||||||
$(CXX) \
|
$(CXX) \
|
||||||
-I $(CODEC_DIR) \
|
-I $(CODEC_DIR) \
|
||||||
${CXXFLAGS} \
|
${CXXFLAGS} \
|
||||||
${LDFLAGS} \
|
${LDFLAGS} \
|
||||||
--bind \
|
--bind \
|
||||||
-s ENVIRONMENT=$(ENVIRONMENT) \
|
--closure 1 \
|
||||||
|
-s ALLOW_MEMORY_GROWTH=1 \
|
||||||
|
-s MODULARIZE=1 \
|
||||||
|
-s TEXTDECODER=2 \
|
||||||
|
-s ENVIRONMENT='worker' \
|
||||||
-s EXPORT_ES6=1 \
|
-s EXPORT_ES6=1 \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
$+ \
|
$+
|
||||||
imagequant.cpp
|
|
||||||
|
|
||||||
$(CODEC_OUT): $(CODEC_DIR)/config.mk
|
$(CODEC_OUT): $(CODEC_DIR)/config.mk
|
||||||
$(MAKE) -C $(CODEC_DIR) $(CODEC_OUT_RELATIVE)
|
$(MAKE) -C $(CODEC_DIR) $(CODEC_OUT_RELATIVE)
|
||||||
|
|||||||
1148
codecs/imagequant/imagequant.js
generated
1148
codecs/imagequant/imagequant.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
16
codecs/imagequant/imagequant_node.js
generated
16
codecs/imagequant/imagequant_node.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,90 +1,59 @@
|
|||||||
CODEC_URL = https://gitlab.com/wg1/jpeg-xl.git
|
CODEC_URL = https://gitlab.com/wg1/jpeg-xl.git
|
||||||
CODEC_VERSION = ab7c5e9b6795134377aa4846ceaae2c5bc504f76
|
CODEC_VERSION = v0.1
|
||||||
CODEC_DIR = node_modules/jxl
|
CODEC_DIR = node_modules/jxl
|
||||||
CODEC_BUILD_ROOT := $(CODEC_DIR)/build
|
CODEC_BUILD_DIR := $(CODEC_DIR)/build
|
||||||
CODEC_MT_BUILD_DIR := $(CODEC_BUILD_ROOT)/mt
|
CODEC_OUT := $(CODEC_BUILD_DIR)/lib/libjxl.a
|
||||||
CODEC_MT_SIMD_BUILD_DIR := $(CODEC_BUILD_ROOT)/mt-simd
|
|
||||||
ENVIRONMENT = worker
|
|
||||||
|
|
||||||
OUT_JS = enc/jxl_enc.js enc/jxl_enc_mt.js enc/jxl_enc_mt_simd.js dec/jxl_dec.js enc/jxl_node_enc.js dec/jxl_node_dec.js
|
OUT_JS = enc/jxl_enc.js dec/jxl_dec.js
|
||||||
OUT_WASM = $(OUT_JS:.js=.wasm)
|
OUT_WASM = $(OUT_JS:.js=.wasm)
|
||||||
OUT_WORKER = $(OUT_JS:.js=.worker.js)
|
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
all: $(OUT_JS)
|
all: $(OUT_JS)
|
||||||
|
|
||||||
# Define dependencies for all variations of build artifacts.
|
%.js: %.cpp $(LIBAOM_OUT) $(CODEC_OUT)
|
||||||
$(filter enc/%,$(OUT_JS)): enc/jxl_enc.cpp
|
|
||||||
$(filter dec/%,$(OUT_JS)): dec/jxl_dec.cpp
|
|
||||||
|
|
||||||
enc/jxl_node_enc.js dec/jxl_node_dec.js: ENVIRONMENT = node
|
|
||||||
|
|
||||||
# For single-threaded build, we compile with threads enabled, but then just don't use them nor link them in.
|
|
||||||
enc/jxl_enc.js enc/jxl_node_enc.js enc/jxl_enc_mt.js dec/jxl_dec.js dec/jxl_node_dec.js: CODEC_BUILD_DIR:=$(CODEC_MT_BUILD_DIR)
|
|
||||||
enc/jxl_enc_mt_simd.js: CODEC_BUILD_DIR:=$(CODEC_MT_SIMD_BUILD_DIR)
|
|
||||||
|
|
||||||
enc/jxl_node_enc.js dec/jxl_node_dec.js enc/jxl_enc.js dec/jxl_dec.js: $(CODEC_MT_BUILD_DIR)/lib/libjxl.a
|
|
||||||
enc/jxl_enc_mt.js: $(CODEC_MT_BUILD_DIR)/lib/libjxl.a $(CODEC_MT_BUILD_DIR)/lib/libjxl_threads.a
|
|
||||||
enc/jxl_enc_mt_simd.js: $(CODEC_MT_SIMD_BUILD_DIR)/lib/libjxl.a $(CODEC_MT_SIMD_BUILD_DIR)/lib/libjxl_threads.a
|
|
||||||
|
|
||||||
# Disable errors on deprecated SIMD intrinsics.
|
|
||||||
# JPEG-XL & Highway need to catch up, once they do, we can remove this suppression.
|
|
||||||
export CXXFLAGS += -Wno-deprecated-declarations
|
|
||||||
|
|
||||||
# Compile multithreaded wrappers with -pthread.
|
|
||||||
enc/jxl_enc_mt.js enc/jxl_enc_mt_simd.js: CXXFLAGS+=-pthread
|
|
||||||
|
|
||||||
$(OUT_JS):
|
|
||||||
$(CXX) \
|
$(CXX) \
|
||||||
$(CXXFLAGS) \
|
|
||||||
$(LDFLAGS) \
|
|
||||||
-I $(CODEC_DIR) \
|
-I $(CODEC_DIR) \
|
||||||
-I $(CODEC_DIR)/lib \
|
-I $(CODEC_DIR)/lib \
|
||||||
-I $(CODEC_DIR)/lib/include \
|
-I $(CODEC_DIR)/lib/include \
|
||||||
-I $(CODEC_BUILD_DIR)/lib/include \
|
-I $(CODEC_BUILD_DIR)/lib/include \
|
||||||
-I $(CODEC_DIR)/third_party/highway \
|
-I $(CODEC_DIR)/third_party/highway \
|
||||||
-I $(CODEC_DIR)/third_party/skcms \
|
-I $(CODEC_DIR)/third_party/skcms \
|
||||||
|
-I $(CODEC_DIR)/third_party/brunsli \
|
||||||
|
-I $(CODEC_DIR)/third_party/brunsli/c/include \
|
||||||
|
${CXXFLAGS} \
|
||||||
|
${LDFLAGS} \
|
||||||
--bind \
|
--bind \
|
||||||
-s ENVIRONMENT=$(ENVIRONMENT) \
|
--closure 1 \
|
||||||
|
-s ALLOW_MEMORY_GROWTH=1 \
|
||||||
|
-s MODULARIZE=1 \
|
||||||
|
-s TEXTDECODER=2 \
|
||||||
|
-s ENVIRONMENT='worker' \
|
||||||
-s EXPORT_ES6=1 \
|
-s EXPORT_ES6=1 \
|
||||||
|
-s EXPORT_NAME="$(basename $(@F))" \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
$+ \
|
$+ \
|
||||||
|
$(CODEC_BUILD_DIR)/artifacts/libbrunslienc-static.bc \
|
||||||
|
$(CODEC_BUILD_DIR)/artifacts/libbrunslicommon-static.bc \
|
||||||
|
$(CODEC_BUILD_DIR)/artifacts/libbrunslidec-static.bc \
|
||||||
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlidec-static.a \
|
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlidec-static.a \
|
||||||
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlienc-static.a \
|
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlienc-static.a \
|
||||||
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlicommon-static.a \
|
$(CODEC_BUILD_DIR)/third_party/brotli/libbrotlicommon-static.a \
|
||||||
$(CODEC_BUILD_DIR)/third_party/libskcms.a \
|
$(CODEC_BUILD_DIR)/third_party/libskcms.a \
|
||||||
$(CODEC_BUILD_DIR)/third_party/highway/libhwy.a
|
$(CODEC_BUILD_DIR)/third_party/highway/libhwy.a
|
||||||
|
|
||||||
%/lib/libjxl.a: %/Makefile
|
$(CODEC_OUT): $(CODEC_DIR)/CMakeLists.txt
|
||||||
$(MAKE) -C $(<D) jxl-static
|
mkdir -p $(CODEC_BUILD_DIR)
|
||||||
|
cd $(CODEC_BUILD_DIR) && \
|
||||||
|
emcmake cmake ../ && \
|
||||||
|
$(MAKE) jxl-static
|
||||||
|
|
||||||
%/lib/libjxl_threads.a: %/Makefile
|
$(CODEC_DIR)/CMakeLists.txt: $(CODEC_DIR)
|
||||||
$(MAKE) -C $(<D) jxl_threads-static
|
|
||||||
|
|
||||||
# Enable SIMD on a SIMD build.
|
$(CODEC_DIR):
|
||||||
$(CODEC_MT_SIMD_BUILD_DIR)/Makefile: CXXFLAGS+=-msimd128
|
mkdir -p $@
|
||||||
|
git clone $(CODEC_URL) --recursive -j`nproc` --depth 1 --branch $(CODEC_VERSION) $@
|
||||||
%/Makefile: $(CODEC_DIR)/CMakeLists.txt
|
|
||||||
emcmake cmake \
|
|
||||||
$(CMAKE_FLAGS) \
|
|
||||||
-DBUILD_SHARED_LIBS=0 \
|
|
||||||
-DJPEGXL_ENABLE_BENCHMARK=0 \
|
|
||||||
-DJPEGXL_ENABLE_EXAMPLES=0 \
|
|
||||||
-DBUILD_TESTING=0 \
|
|
||||||
-DCMAKE_CROSSCOMPILING_EMULATOR=node \
|
|
||||||
-B $(@D) \
|
|
||||||
$(<D)
|
|
||||||
|
|
||||||
$(CODEC_DIR)/CMakeLists.txt:
|
|
||||||
$(RM) -r $(@D)
|
|
||||||
git init $(@D)
|
|
||||||
git -C $(@D) fetch $(CODEC_URL) $(CODEC_VERSION) --depth 1
|
|
||||||
git -C $(@D) checkout FETCH_HEAD
|
|
||||||
git -C $(@D) submodule update --init --depth 1 --recursive --jobs `nproc`
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(OUT_JS) $(OUT_WASM) $(OUT_WORKER)
|
$(RM) $(OUT_JS) $(OUT_WASM)
|
||||||
$(MAKE) -C $(CODEC_BUILD_DIR) clean
|
$(MAKE) -C $(CODEC_BUILD_DIR) clean
|
||||||
$(MAKE) -C $(CODEC_MT_BUILD_DIR) clean
|
|
||||||
$(MAKE) -C $(CODEC_MT_SIMD_BUILD_DIR) clean
|
|
||||||
|
|||||||
@@ -52,14 +52,13 @@ val decode(std::string data) {
|
|||||||
|
|
||||||
auto next_in = (const uint8_t*)data.c_str();
|
auto next_in = (const uint8_t*)data.c_str();
|
||||||
auto avail_in = data.size();
|
auto avail_in = data.size();
|
||||||
JxlDecoderSetInput(dec.get(), next_in, avail_in);
|
EXPECT_EQ(JXL_DEC_BASIC_INFO, JxlDecoderProcessInput(dec.get(), &next_in, &avail_in));
|
||||||
EXPECT_EQ(JXL_DEC_BASIC_INFO, JxlDecoderProcessInput(dec.get()));
|
|
||||||
JxlBasicInfo info;
|
JxlBasicInfo info;
|
||||||
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderGetBasicInfo(dec.get(), &info));
|
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderGetBasicInfo(dec.get(), &info));
|
||||||
size_t pixel_count = info.xsize * info.ysize;
|
size_t pixel_count = info.xsize * info.ysize;
|
||||||
size_t component_count = pixel_count * COMPONENTS_PER_PIXEL;
|
size_t component_count = pixel_count * COMPONENTS_PER_PIXEL;
|
||||||
|
|
||||||
EXPECT_EQ(JXL_DEC_COLOR_ENCODING, JxlDecoderProcessInput(dec.get()));
|
EXPECT_EQ(JXL_DEC_COLOR_ENCODING, JxlDecoderProcessInput(dec.get(), &next_in, &avail_in));
|
||||||
static const JxlPixelFormat format = {COMPONENTS_PER_PIXEL, JXL_TYPE_FLOAT, JXL_LITTLE_ENDIAN, 0};
|
static const JxlPixelFormat format = {COMPONENTS_PER_PIXEL, JXL_TYPE_FLOAT, JXL_LITTLE_ENDIAN, 0};
|
||||||
size_t icc_size;
|
size_t icc_size;
|
||||||
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderGetICCProfileSize(dec.get(), &format,
|
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderGetICCProfileSize(dec.get(), &format,
|
||||||
@@ -69,15 +68,10 @@ val decode(std::string data) {
|
|||||||
JxlDecoderGetColorAsICCProfile(dec.get(), &format, JXL_COLOR_PROFILE_TARGET_DATA,
|
JxlDecoderGetColorAsICCProfile(dec.get(), &format, JXL_COLOR_PROFILE_TARGET_DATA,
|
||||||
icc_profile.data(), icc_profile.size()));
|
icc_profile.data(), icc_profile.size()));
|
||||||
|
|
||||||
EXPECT_EQ(JXL_DEC_NEED_IMAGE_OUT_BUFFER, JxlDecoderProcessInput(dec.get()));
|
|
||||||
size_t buffer_size;
|
|
||||||
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderImageOutBufferSize(dec.get(), &format, &buffer_size));
|
|
||||||
EXPECT_EQ(buffer_size, component_count * sizeof(float));
|
|
||||||
|
|
||||||
auto float_pixels = std::make_unique<float[]>(component_count);
|
auto float_pixels = std::make_unique<float[]>(component_count);
|
||||||
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderSetImageOutBuffer(dec.get(), &format, float_pixels.get(),
|
EXPECT_EQ(JXL_DEC_SUCCESS, JxlDecoderSetImageOutBuffer(dec.get(), &format, float_pixels.get(),
|
||||||
component_count * sizeof(float)));
|
component_count * sizeof(float)));
|
||||||
EXPECT_EQ(JXL_DEC_FULL_IMAGE, JxlDecoderProcessInput(dec.get()));
|
EXPECT_EQ(JXL_DEC_FULL_IMAGE, JxlDecoderProcessInput(dec.get(), &next_in, &avail_in));
|
||||||
|
|
||||||
auto byte_pixels = std::make_unique<uint8_t[]>(component_count);
|
auto byte_pixels = std::make_unique<uint8_t[]>(component_count);
|
||||||
// Convert to sRGB.
|
// Convert to sRGB.
|
||||||
|
|||||||
1201
codecs/jxl/dec/jxl_dec.js
generated
1201
codecs/jxl/dec/jxl_dec.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
16
codecs/jxl/dec/jxl_node_dec.js
generated
16
codecs/jxl/dec/jxl_node_dec.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,9 +1,8 @@
|
|||||||
#include <emscripten/bind.h>
|
#include <emscripten/bind.h>
|
||||||
#include <emscripten/val.h>
|
#include <emscripten/val.h>
|
||||||
|
|
||||||
#include "lib/jxl/base/thread_pool_internal.h"
|
|
||||||
#include "lib/jxl/enc_external_image.h"
|
|
||||||
#include "lib/jxl/enc_file.h"
|
#include "lib/jxl/enc_file.h"
|
||||||
|
#include "lib/jxl/external_image.h"
|
||||||
|
|
||||||
using namespace emscripten;
|
using namespace emscripten;
|
||||||
|
|
||||||
@@ -18,7 +17,6 @@ struct JXLOptions {
|
|||||||
int epf;
|
int epf;
|
||||||
int nearLossless;
|
int nearLossless;
|
||||||
bool lossyPalette;
|
bool lossyPalette;
|
||||||
size_t decodingSpeedTier;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
val encode(std::string image, int width, int height, JXLOptions options) {
|
val encode(std::string image, int width, int height, JXLOptions options) {
|
||||||
@@ -27,16 +25,10 @@ val encode(std::string image, int width, int height, JXLOptions options) {
|
|||||||
jxl::CodecInOut io;
|
jxl::CodecInOut io;
|
||||||
jxl::PaddedBytes bytes;
|
jxl::PaddedBytes bytes;
|
||||||
jxl::ImageBundle* main = &io.Main();
|
jxl::ImageBundle* main = &io.Main();
|
||||||
jxl::ThreadPoolInternal* pool_ptr = nullptr;
|
|
||||||
#ifdef __EMSCRIPTEN_PTHREADS__
|
|
||||||
jxl::ThreadPoolInternal pool;
|
|
||||||
pool_ptr = &pool;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
cparams.epf = options.epf;
|
cparams.epf = options.epf;
|
||||||
cparams.speed_tier = static_cast<jxl::SpeedTier>(options.speed);
|
cparams.speed_tier = static_cast<jxl::SpeedTier>(options.speed);
|
||||||
cparams.near_lossless = options.nearLossless;
|
cparams.near_lossless = options.nearLossless;
|
||||||
cparams.decoding_speed_tier = options.decodingSpeedTier;
|
|
||||||
|
|
||||||
if (options.lossyPalette) {
|
if (options.lossyPalette) {
|
||||||
cparams.lossy_palette = true;
|
cparams.lossy_palette = true;
|
||||||
@@ -44,6 +36,17 @@ val encode(std::string image, int width, int height, JXLOptions options) {
|
|||||||
cparams.options.predictor = jxl::Predictor::Zero;
|
cparams.options.predictor = jxl::Predictor::Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reduce memory usage of tree learning for lossless data.
|
||||||
|
// TODO(veluca93): this is a mitigation for excessive memory usage in the JXL encoder.
|
||||||
|
float megapixels = width * height * 0.000001;
|
||||||
|
if (megapixels > 8) {
|
||||||
|
cparams.options.nb_repeats = 0.1;
|
||||||
|
} else if (megapixels > 4) {
|
||||||
|
cparams.options.nb_repeats = 0.3;
|
||||||
|
} else {
|
||||||
|
// default is OK.
|
||||||
|
}
|
||||||
|
|
||||||
float quality = options.quality;
|
float quality = options.quality;
|
||||||
|
|
||||||
// Quality settings roughly match libjpeg qualities.
|
// Quality settings roughly match libjpeg qualities.
|
||||||
@@ -90,18 +93,18 @@ val encode(std::string image, int width, int height, JXLOptions options) {
|
|||||||
|
|
||||||
uint8_t* inBuffer = (uint8_t*)image.c_str();
|
uint8_t* inBuffer = (uint8_t*)image.c_str();
|
||||||
|
|
||||||
auto result = jxl::ConvertFromExternal(
|
auto result = jxl::ConvertImage(
|
||||||
jxl::Span<const uint8_t>(reinterpret_cast<const uint8_t*>(image.data()), image.size()), width,
|
jxl::Span<const uint8_t>(reinterpret_cast<const uint8_t*>(image.data()), image.size()), width,
|
||||||
height, jxl::ColorEncoding::SRGB(/*is_gray=*/false), /*has_alpha=*/true,
|
height, jxl::ColorEncoding::SRGB(/*is_gray=*/false), /*has_alpha=*/true,
|
||||||
/*alpha_is_premultiplied=*/false, /*bits_per_sample=*/8, /*endiannes=*/JXL_LITTLE_ENDIAN,
|
/*alpha_is_premultiplied=*/false, /*bits_per_alpha=*/8, /*bits_per_sample=*/8,
|
||||||
/*flipped_y=*/false, pool_ptr, main);
|
/*big_endian=*/false, /*flipped_y=*/false, /*pool=*/nullptr, main);
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return val::null();
|
return val::null();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto js_result = val::null();
|
auto js_result = val::null();
|
||||||
if (EncodeFile(cparams, &io, &passes_enc_state, &bytes, /*aux=*/nullptr, pool_ptr)) {
|
if (EncodeFile(cparams, &io, &passes_enc_state, &bytes)) {
|
||||||
js_result = Uint8Array.new_(typed_memory_view(bytes.size(), bytes.data()));
|
js_result = Uint8Array.new_(typed_memory_view(bytes.size(), bytes.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +118,6 @@ EMSCRIPTEN_BINDINGS(my_module) {
|
|||||||
.field("progressive", &JXLOptions::progressive)
|
.field("progressive", &JXLOptions::progressive)
|
||||||
.field("nearLossless", &JXLOptions::nearLossless)
|
.field("nearLossless", &JXLOptions::nearLossless)
|
||||||
.field("lossyPalette", &JXLOptions::lossyPalette)
|
.field("lossyPalette", &JXLOptions::lossyPalette)
|
||||||
.field("decodingSpeedTier", &JXLOptions::decodingSpeedTier)
|
|
||||||
.field("epf", &JXLOptions::epf);
|
.field("epf", &JXLOptions::epf);
|
||||||
|
|
||||||
function("encode", &encode);
|
function("encode", &encode);
|
||||||
|
|||||||
1
codecs/jxl/enc/jxl_enc.d.ts
vendored
1
codecs/jxl/enc/jxl_enc.d.ts
vendored
@@ -5,7 +5,6 @@ export interface EncodeOptions {
|
|||||||
epf: number;
|
epf: number;
|
||||||
nearLossless: number;
|
nearLossless: number;
|
||||||
lossyPalette: boolean;
|
lossyPalette: boolean;
|
||||||
decodingSpeedTier: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface JXLModule extends EmscriptenWasm.Module {
|
export interface JXLModule extends EmscriptenWasm.Module {
|
||||||
|
|||||||
1612
codecs/jxl/enc/jxl_enc.js
generated
1612
codecs/jxl/enc/jxl_enc.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
1
codecs/jxl/enc/jxl_enc_mt.d.ts
vendored
1
codecs/jxl/enc/jxl_enc_mt.d.ts
vendored
@@ -1 +0,0 @@
|
|||||||
export { default } from './jxl_enc';
|
|
||||||
16
codecs/jxl/enc/jxl_enc_mt.js
generated
16
codecs/jxl/enc/jxl_enc_mt.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
1
codecs/jxl/enc/jxl_enc_mt.worker.js
generated
1
codecs/jxl/enc/jxl_enc_mt.worker.js
generated
@@ -1 +0,0 @@
|
|||||||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};function moduleLoaded(){}self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;(e.data.urlOrBlob?import(e.data.urlOrBlob):import("./jxl_enc_mt.js")).then(function(exports){return exports.default(Module)}).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["PThread"].threadExit(result)}}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
|
||||||
1
codecs/jxl/enc/jxl_enc_mt_simd.d.ts
vendored
1
codecs/jxl/enc/jxl_enc_mt_simd.d.ts
vendored
@@ -1 +0,0 @@
|
|||||||
export { default } from './jxl_enc';
|
|
||||||
16
codecs/jxl/enc/jxl_enc_mt_simd.js
generated
16
codecs/jxl/enc/jxl_enc_mt_simd.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
1
codecs/jxl/enc/jxl_enc_mt_simd.worker.js
generated
1
codecs/jxl/enc/jxl_enc_mt_simd.worker.js
generated
@@ -1 +0,0 @@
|
|||||||
"use strict";var Module={};var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=function(info,receiveInstance){var instance=new WebAssembly.Instance(Module["wasmModule"],info);receiveInstance(instance);Module["wasmModule"]=null;return instance.exports};function moduleLoaded(){}self.onmessage=function(e){try{if(e.data.cmd==="load"){Module["wasmModule"]=e.data.wasmModule;Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;(e.data.urlOrBlob?import(e.data.urlOrBlob):import("./jxl_enc_mt_simd.js")).then(function(exports){return exports.default(Module)}).then(function(instance){Module=instance;moduleLoaded()})}else if(e.data.cmd==="objectTransfer"){Module["PThread"].receiveObjectTransfer(e.data)}else if(e.data.cmd==="run"){Module["__performance_now_clock_drift"]=performance.now()-e.data.time;Module["__emscripten_thread_init"](e.data.threadInfoStruct,0,0);var max=e.data.stackBase;var top=e.data.stackBase+e.data.stackSize;Module["establishStackSpace"](top,max);Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInit();if(!initializedJS){Module["___embind_register_native_and_builtin_types"]();initializedJS=true}try{var result=Module["invokeEntryPoint"](e.data.start_routine,e.data.arg);if(Module["keepRuntimeAlive"]()){Module["PThread"].setExitStatus(result)}else{Module["PThread"].threadExit(result)}}catch(ex){if(ex==="Canceled!"){Module["PThread"].threadCancel()}else if(ex!="unwind"){if(ex instanceof Module["ExitStatus"]){if(Module["keepRuntimeAlive"]()){}else{Module["PThread"].threadExit(ex.status)}}else{Module["PThread"].threadExit(-2);throw ex}}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["PThread"].threadCancel()}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processThreadQueue"){if(Module["_pthread_self"]()){Module["_emscripten_current_thread_process_queued_calls"]()}}else{err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){err("worker.js onmessage() captured an uncaught exception: "+ex);if(ex&&ex.stack)err(ex.stack);throw ex}};
|
|
||||||
16
codecs/jxl/enc/jxl_node_enc.js
generated
16
codecs/jxl/enc/jxl_node_enc.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -1,57 +0,0 @@
|
|||||||
#include <emscripten/bind.h>
|
|
||||||
#include <emscripten/val.h>
|
|
||||||
#include "config.h"
|
|
||||||
#include "jpeglib.h"
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "cdjpeg.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace emscripten;
|
|
||||||
|
|
||||||
thread_local const val Uint8ClampedArray = val::global("Uint8ClampedArray");
|
|
||||||
thread_local const val ImageData = val::global("ImageData");
|
|
||||||
|
|
||||||
val decode(std::string image_in) {
|
|
||||||
uint8_t* image_buffer = (uint8_t*)image_in.c_str();
|
|
||||||
|
|
||||||
jpeg_decompress_struct cinfo;
|
|
||||||
jpeg_error_mgr jerr;
|
|
||||||
// Initialize the JPEG decompression object with default error handling.
|
|
||||||
cinfo.err = jpeg_std_error(&jerr);
|
|
||||||
jpeg_create_decompress(&cinfo);
|
|
||||||
|
|
||||||
jpeg_mem_src(&cinfo, image_buffer, image_in.length());
|
|
||||||
// Read file header, set default decompression parameters
|
|
||||||
jpeg_read_header(&cinfo, TRUE);
|
|
||||||
// Force RGBA decoding, even for grayscale images
|
|
||||||
cinfo.out_color_space = JCS_EXT_RGBA;
|
|
||||||
jpeg_start_decompress(&cinfo);
|
|
||||||
|
|
||||||
// Prepare output buffer
|
|
||||||
size_t output_size = cinfo.output_width * cinfo.output_height * 4;
|
|
||||||
std::vector<uint8_t> output_buffer(output_size);
|
|
||||||
auto stride = cinfo.output_width * 4;
|
|
||||||
|
|
||||||
// Process data
|
|
||||||
while (cinfo.output_scanline < cinfo.output_height) {
|
|
||||||
uint8_t* ptr = &output_buffer[stride * cinfo.output_scanline];
|
|
||||||
jpeg_read_scanlines(&cinfo, &ptr, 1);
|
|
||||||
}
|
|
||||||
jpeg_finish_decompress(&cinfo);
|
|
||||||
|
|
||||||
// Step 7: release JPEG compression object
|
|
||||||
|
|
||||||
auto data = Uint8ClampedArray.new_(typed_memory_view(output_size, &output_buffer[0]));
|
|
||||||
auto js_result = ImageData.new_(data, cinfo.output_width, cinfo.output_height);
|
|
||||||
|
|
||||||
// This is an important step since it will release a good deal of memory.
|
|
||||||
jpeg_destroy_decompress(&cinfo);
|
|
||||||
|
|
||||||
// And we're done!
|
|
||||||
return js_result;
|
|
||||||
}
|
|
||||||
|
|
||||||
EMSCRIPTEN_BINDINGS(my_module) {
|
|
||||||
function("decode", &decode);
|
|
||||||
}
|
|
||||||
16
codecs/mozjpeg/dec/mozjpeg_node_dec.js
generated
16
codecs/mozjpeg/dec/mozjpeg_node_dec.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
16
codecs/mozjpeg/enc/mozjpeg_enc.js
generated
16
codecs/mozjpeg/enc/mozjpeg_enc.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
16
codecs/mozjpeg/enc/mozjpeg_node_enc.js
generated
16
codecs/mozjpeg/enc/mozjpeg_node_enc.js
generated
File diff suppressed because one or more lines are too long
Binary file not shown.
@@ -2,28 +2,24 @@ CODEC_URL := https://github.com/mozilla/mozjpeg/archive/v3.3.1.tar.gz
|
|||||||
CODEC_DIR := node_modules/mozjpeg
|
CODEC_DIR := node_modules/mozjpeg
|
||||||
CODEC_OUT_RELATIVE := .libs/libjpeg.a rdswitch.o
|
CODEC_OUT_RELATIVE := .libs/libjpeg.a rdswitch.o
|
||||||
CODEC_OUT := $(addprefix $(CODEC_DIR)/, $(CODEC_OUT_RELATIVE))
|
CODEC_OUT := $(addprefix $(CODEC_DIR)/, $(CODEC_OUT_RELATIVE))
|
||||||
ENVIRONMENT = worker
|
OUT_JS := mozjpeg_enc.js
|
||||||
|
|
||||||
OUT_JS := enc/mozjpeg_enc.js enc/mozjpeg_node_enc.js dec/mozjpeg_node_dec.js
|
|
||||||
OUT_WASM := $(OUT_JS:.js=.wasm)
|
OUT_WASM := $(OUT_JS:.js=.wasm)
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
all: $(OUT_JS)
|
all: $(OUT_JS)
|
||||||
|
|
||||||
# Define dependencies for all variations of build artifacts.
|
%.js: %.cpp $(CODEC_OUT)
|
||||||
$(filter enc/%,$(OUT_JS)): enc/mozjpeg_enc.cpp
|
|
||||||
$(filter dec/%,$(OUT_JS)): dec/mozjpeg_dec.cpp
|
|
||||||
|
|
||||||
enc/mozjpeg_node_enc.js dec/mozjpeg_node_dec.js: ENVIRONMENT = node
|
|
||||||
|
|
||||||
%.js: $(CODEC_OUT)
|
|
||||||
$(CXX) \
|
$(CXX) \
|
||||||
-I $(CODEC_DIR) \
|
-I $(CODEC_DIR) \
|
||||||
${CXXFLAGS} \
|
${CXXFLAGS} \
|
||||||
${LDFLAGS} \
|
${LDFLAGS} \
|
||||||
|
--closure 1 \
|
||||||
--bind \
|
--bind \
|
||||||
-s ENVIRONMENT=$(ENVIRONMENT) \
|
-s ALLOW_MEMORY_GROWTH=1 \
|
||||||
|
-s MODULARIZE=1 \
|
||||||
|
-s TEXTDECODER=2 \
|
||||||
|
-s ENVIRONMENT='worker' \
|
||||||
-s EXPORT_ES6=1 \
|
-s EXPORT_ES6=1 \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
$+
|
$+
|
||||||
@@ -42,10 +38,7 @@ $(CODEC_DIR)/Makefile: $(CODEC_DIR)/configure
|
|||||||
--without-turbojpeg \
|
--without-turbojpeg \
|
||||||
--without-simd \
|
--without-simd \
|
||||||
--without-arith-enc \
|
--without-arith-enc \
|
||||||
--without-arith-dec \
|
--without-arith-dec
|
||||||
--with-build-date=squoosh
|
|
||||||
# ^ If not provided with a dummy value, MozJPEG includes a build date in the
|
|
||||||
# binary as part of the version string, making binaries different each time.
|
|
||||||
|
|
||||||
$(CODEC_DIR)/configure: $(CODEC_DIR)/configure.ac
|
$(CODEC_DIR)/configure: $(CODEC_DIR)/configure.ac
|
||||||
cd $(CODEC_DIR) && autoreconf -iv
|
cd $(CODEC_DIR) && autoreconf -iv
|
||||||
44
codecs/mozjpeg_enc/README.md
Normal file
44
codecs/mozjpeg_enc/README.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# MozJPEG encoder
|
||||||
|
|
||||||
|
- Source: <https://github.com/mozilla/mozjpeg>
|
||||||
|
- Version: v3.3.1
|
||||||
|
- License: BSD
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- Docker
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
See `example.html`
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### `int version()`
|
||||||
|
|
||||||
|
Returns the version of MozJPEG as a number. va.b.c is encoded as 0x0a0b0c
|
||||||
|
|
||||||
|
### `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;
|
||||||
|
};
|
||||||
|
```
|
||||||
51
codecs/mozjpeg_enc/example.html
Normal file
51
codecs/mozjpeg_enc/example.html
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<script type="module">
|
||||||
|
import mozjpeg_enc from './mozjpeg_enc.js';
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const module = await mozjpeg_enc();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
|
</script>
|
||||||
@@ -141,7 +141,6 @@ val encode(std::string image_in, int image_width, int image_height, MozJpegOptio
|
|||||||
jpeg_c_set_bool_param(&cinfo, JBOOLEAN_TRELLIS_EOB_OPT, opts.trellis_opt_zero);
|
jpeg_c_set_bool_param(&cinfo, JBOOLEAN_TRELLIS_EOB_OPT, opts.trellis_opt_zero);
|
||||||
jpeg_c_set_bool_param(&cinfo, JBOOLEAN_TRELLIS_Q_OPT, opts.trellis_opt_table);
|
jpeg_c_set_bool_param(&cinfo, JBOOLEAN_TRELLIS_Q_OPT, opts.trellis_opt_table);
|
||||||
jpeg_c_set_int_param(&cinfo, JINT_TRELLIS_NUM_LOOPS, opts.trellis_loops);
|
jpeg_c_set_int_param(&cinfo, JINT_TRELLIS_NUM_LOOPS, opts.trellis_loops);
|
||||||
jpeg_c_set_int_param(&cinfo, JINT_DC_SCAN_OPT_MODE, 0);
|
|
||||||
|
|
||||||
// A little hacky to build a string for this, but it means we can use
|
// A little hacky to build a string for this, but it means we can use
|
||||||
// set_quality_ratings which does some useful heuristic stuff.
|
// set_quality_ratings which does some useful heuristic stuff.
|
||||||
1285
codecs/mozjpeg_enc/mozjpeg_enc.js
generated
Normal file
1285
codecs/mozjpeg_enc/mozjpeg_enc.js
generated
Normal file
File diff suppressed because it is too large
Load Diff
BIN
codecs/mozjpeg_enc/mozjpeg_enc.wasm
Executable file
BIN
codecs/mozjpeg_enc/mozjpeg_enc.wasm
Executable file
Binary file not shown.
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"name": "mozjpeg_enc",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "../build-cpp.sh"
|
"build": "../build-cpp.sh"
|
||||||
}
|
}
|
||||||
137
codecs/oxipng/Cargo.lock
generated
137
codecs/oxipng/Cargo.lock
generated
@@ -1,7 +1,5 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler"
|
name = "adler"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
@@ -22,9 +20,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bit-vec"
|
name = "bit-vec"
|
||||||
version = "0.6.3"
|
version = "0.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
checksum = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
@@ -58,9 +56,9 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.66"
|
version = "1.0.62"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
|
checksum = "f1770ced377336a88a67c473594ccc14eca6f4559217c34f64aac8f83d641b40"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@@ -100,9 +98,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "const_fn"
|
name = "const_fn"
|
||||||
version = "0.4.5"
|
version = "0.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6"
|
checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc"
|
name = "crc"
|
||||||
@@ -145,9 +143,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-epoch"
|
name = "crossbeam-epoch"
|
||||||
version = "0.9.1"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
|
checksum = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"const_fn",
|
"const_fn",
|
||||||
@@ -159,12 +157,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.1"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
|
checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
|
"const_fn",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -201,9 +200,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image"
|
name = "image"
|
||||||
version = "0.23.12"
|
version = "0.23.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ce04077ead78e39ae8610ad26216aed811996b043d47beed5090db674f9e9b5"
|
checksum = "b4f0a8345b33b082aedec2f4d7d4a926b845cee184cbe78b703413066564431b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
@@ -216,9 +215,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.6.1"
|
version = "1.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b"
|
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
@@ -227,22 +226,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.10.0"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319"
|
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"either",
|
"either",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "js-sys"
|
|
||||||
version = "0.3.48"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78"
|
|
||||||
dependencies = [
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
@@ -251,24 +241,24 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.81"
|
version = "0.2.80"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
|
checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libdeflate-sys"
|
name = "libdeflate-sys"
|
||||||
version = "0.7.1"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4a95fa4be7085dd06a8296dcc3f399f12ab8b0309c157dcaa90669130b175b97"
|
checksum = "2f5b1582a0ebf8c55a46166c04d7c66f6bb17add3a6cbf69a082ac2219f31671"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libdeflater"
|
name = "libdeflater"
|
||||||
version = "0.7.1"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ccc147465654929bf7b56518cc46d11701ba290f4ff94398ae3f89f1663cf60f"
|
checksum = "93edd93a53970951da84ef733a8b6e30189a8f8a9e19610f69e4cc5bb1f4d654"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libdeflate-sys",
|
"libdeflate-sys",
|
||||||
]
|
]
|
||||||
@@ -284,9 +274,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.6.1"
|
version = "0.5.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
|
checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
@@ -362,10 +352,16 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "oxipng"
|
name = "once_cell"
|
||||||
version = "4.0.3"
|
version = "1.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "50d0b53912a666fe2970f8ab254e283531c816aed16551ab66c52485eadb44e6"
|
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "oxipng"
|
||||||
|
version = "4.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9fefb26bde273c3db896a313151301a69e698a7495ee577fe2168ed7065c29c4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bit-vec",
|
"bit-vec",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
@@ -394,9 +390,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "png"
|
name = "png"
|
||||||
version = "0.16.8"
|
version = "0.16.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
|
checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
@@ -406,18 +402,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.26"
|
version = "1.0.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
|
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.8"
|
version = "1.0.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df"
|
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@@ -482,35 +478,30 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver-parser"
|
name = "semver-parser"
|
||||||
version = "0.10.2"
|
version = "0.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
|
checksum = "42ef146c2ad5e5f4b037cd6ce2ebb775401729b19a82040c1beac9d36c7d1428"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pest",
|
"pest",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "spmc"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "squoosh-oxipng"
|
name = "squoosh-oxipng"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libdeflater",
|
"crossbeam-channel",
|
||||||
"log",
|
"log",
|
||||||
|
"once_cell",
|
||||||
"oxipng",
|
"oxipng",
|
||||||
|
"rayon",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-rayon",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.72"
|
version = "1.0.48"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
|
checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -531,19 +522,19 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen"
|
name = "wasm-bindgen"
|
||||||
version = "0.2.74"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
|
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 0.1.10",
|
||||||
"wasm-bindgen-macro",
|
"wasm-bindgen-macro",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-backend"
|
name = "wasm-bindgen-backend"
|
||||||
version = "0.2.74"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
|
checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@@ -556,9 +547,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.74"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
|
checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"wasm-bindgen-macro-support",
|
"wasm-bindgen-macro-support",
|
||||||
@@ -566,9 +557,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro-support"
|
name = "wasm-bindgen-macro-support"
|
||||||
version = "0.2.74"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
|
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -577,20 +568,8 @@ dependencies = [
|
|||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-rayon"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3069d2a42e7a7e3bfde668f84adb5fbc35701ca2b39b27a064cbd5ede4e78194"
|
|
||||||
dependencies = [
|
|
||||||
"js-sys",
|
|
||||||
"rayon",
|
|
||||||
"spmc",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-shared"
|
name = "wasm-bindgen-shared"
|
||||||
version = "0.2.74"
|
version = "0.2.68"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
|
checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
|
||||||
|
|||||||
@@ -12,15 +12,16 @@ wasm-opt = ["-O", "--no-validation"]
|
|||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
oxipng = { version = "4.0.3", default-features = false, features = ["libdeflater"] }
|
oxipng = { version = "4.0.0", default-features = false, features = ["libdeflater"] }
|
||||||
libdeflater = { version = "0.7.1", features = ["freestanding"] }
|
wasm-bindgen = "0.2.68"
|
||||||
wasm-bindgen = "0.2.73"
|
|
||||||
log = { version = "0.4.11", features = ["release_max_level_off"] }
|
log = { version = "0.4.11", features = ["release_max_level_off"] }
|
||||||
wasm-bindgen-rayon = { version = "1.0", optional = true }
|
rayon = { version = "1.5.0", optional = true }
|
||||||
|
once_cell = { version = "1.5.2", optional = true }
|
||||||
|
crossbeam-channel = { version = "0.5.0", optional = true }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
opt-level = "s"
|
opt-level = "s"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
parallel = ["oxipng/parallel", "wasm-bindgen-rayon"]
|
parallel = ["oxipng/parallel", "rayon", "crossbeam-channel", "once_cell"]
|
||||||
|
|||||||
3
codecs/oxipng/build.sh
Executable file → Normal file
3
codecs/oxipng/build.sh
Executable file → Normal file
@@ -3,7 +3,8 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
rm -rf pkg,{-parallel}
|
rm -rf pkg,{-parallel}
|
||||||
export CFLAGS="${CFLAGS} -DUNALIGNED_ACCESS_IS_FAST=1"
|
|
||||||
wasm-pack build -t web
|
wasm-pack build -t web
|
||||||
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' wasm-pack build -t web -d pkg-parallel -- -Z build-std=panic_abort,std --features=parallel
|
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' wasm-pack build -t web -d pkg-parallel -- -Z build-std=panic_abort,std --features=parallel
|
||||||
|
# Workaround https://github.com/rustwasm/wasm-bindgen/issues/2133:
|
||||||
|
sed -i "s|maybe_memory:|maybe_memory?:|" pkg-parallel/squoosh_oxipng.d.ts
|
||||||
rm pkg{,-parallel}/.gitignore
|
rm pkg{,-parallel}/.gitignore
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright 2021 Google Inc. All Rights Reserved.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Note: we use `wasm_bindgen_worker_`-prefixed message types to make sure
|
|
||||||
// we can handle bundling into other files, which might happen to have their
|
|
||||||
// own `postMessage`/`onmessage` communication channels.
|
|
||||||
//
|
|
||||||
// If we didn't take that into the account, we could send much simpler signals
|
|
||||||
// like just `0` or whatever, but the code would be less resilient.
|
|
||||||
|
|
||||||
function waitForMsgType(target, type) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
target.addEventListener('message', function onMsg({ data }) {
|
|
||||||
if (data == null || data.type !== type) return;
|
|
||||||
target.removeEventListener('message', onMsg);
|
|
||||||
resolve(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
waitForMsgType(self, 'wasm_bindgen_worker_init').then(async data => {
|
|
||||||
// # Note 1
|
|
||||||
// Our JS should have been generated in
|
|
||||||
// `[out-dir]/snippets/wasm-bindgen-rayon-[hash]/workerHelpers.js`,
|
|
||||||
// resolve the main module via `../../..`.
|
|
||||||
//
|
|
||||||
// This might need updating if the generated structure changes on wasm-bindgen
|
|
||||||
// side ever in the future, but works well with bundlers today. The whole
|
|
||||||
// point of this crate, after all, is to abstract away unstable features
|
|
||||||
// and temporary bugs so that you don't need to deal with them in your code.
|
|
||||||
//
|
|
||||||
// # Note 2
|
|
||||||
// This could be a regular import, but then some bundlers complain about
|
|
||||||
// circular deps.
|
|
||||||
//
|
|
||||||
// Dynamic import could be cheap if this file was inlined into the parent,
|
|
||||||
// which would require us just using `../../..` in `new Worker` below,
|
|
||||||
// but that doesn't work because wasm-pack unconditionally adds
|
|
||||||
// "sideEffects":false (see below).
|
|
||||||
//
|
|
||||||
// OTOH, even though it can't be inlined, it should be still reasonably
|
|
||||||
// cheap since the requested file is already in cache (it was loaded by
|
|
||||||
// the main thread).
|
|
||||||
const pkg = await import('../../..');
|
|
||||||
await pkg.default(data.module, data.memory);
|
|
||||||
postMessage({ type: 'wasm_bindgen_worker_ready' });
|
|
||||||
pkg.wbg_rayon_start_worker(data.receiver);
|
|
||||||
});
|
|
||||||
|
|
||||||
export async function startWorkers(module, memory, builder) {
|
|
||||||
const workerInit = {
|
|
||||||
type: 'wasm_bindgen_worker_init',
|
|
||||||
module,
|
|
||||||
memory,
|
|
||||||
receiver: builder.receiver()
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
await Promise.all(
|
|
||||||
Array.from({ length: builder.numThreads() }, () => {
|
|
||||||
// Self-spawn into a new Worker.
|
|
||||||
//
|
|
||||||
// TODO: while `new URL('...', import.meta.url) becomes a semi-standard
|
|
||||||
// way to get asset URLs relative to the module across various bundlers
|
|
||||||
// and browser, ideally we should switch to `import.meta.resolve`
|
|
||||||
// once it becomes a standard.
|
|
||||||
//
|
|
||||||
// Note: we could use `../../..` as the URL here to inline workerHelpers.js
|
|
||||||
// into the parent entry instead of creating another split point -
|
|
||||||
// this would be preferable from optimization perspective -
|
|
||||||
// however, Webpack then eliminates all message handler code
|
|
||||||
// because wasm-pack produces "sideEffects":false in package.json
|
|
||||||
// unconditionally.
|
|
||||||
//
|
|
||||||
// The only way to work around that is to have side effect code
|
|
||||||
// in an entry point such as Worker file itself.
|
|
||||||
const worker = new Worker(new URL('./workerHelpers.js', import.meta.url), {
|
|
||||||
type: 'module'
|
|
||||||
});
|
|
||||||
worker.postMessage(workerInit);
|
|
||||||
return waitForMsgType(worker, 'wasm_bindgen_worker_ready');
|
|
||||||
})
|
|
||||||
);
|
|
||||||
builder.build();
|
|
||||||
} finally {
|
|
||||||
builder.free();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
43
codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts
generated
vendored
43
codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts
generated
vendored
@@ -3,49 +3,31 @@
|
|||||||
/**
|
/**
|
||||||
* @param {Uint8Array} data
|
* @param {Uint8Array} data
|
||||||
* @param {number} level
|
* @param {number} level
|
||||||
* @param {boolean} interlace
|
|
||||||
* @returns {Uint8Array}
|
* @returns {Uint8Array}
|
||||||
*/
|
*/
|
||||||
export function optimise(data: Uint8Array, level: number, interlace: boolean): Uint8Array;
|
export function optimise(data: Uint8Array, level: number): Uint8Array;
|
||||||
/**
|
/**
|
||||||
* @param {number} num_threads
|
* @param {number} num
|
||||||
* @returns {Promise<any>}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export function initThreadPool(num_threads: number): Promise<any>;
|
export function worker_initializer(num: number): any;
|
||||||
/**
|
|
||||||
* @param {number} receiver
|
|
||||||
*/
|
|
||||||
export function wbg_rayon_start_worker(receiver: number): void;
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export class wbg_rayon_PoolBuilder {
|
export function start_main_thread(): void;
|
||||||
free(): void;
|
|
||||||
/**
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
numThreads(): number;
|
|
||||||
/**
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
receiver(): number;
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
build(): void;
|
export function start_worker_thread(): void;
|
||||||
}
|
|
||||||
|
|
||||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||||
|
|
||||||
export interface InitOutput {
|
export interface InitOutput {
|
||||||
readonly __wasm_init_memory: () => void;
|
readonly optimise: (a: number, b: number, c: number, d: number) => void;
|
||||||
readonly optimise: (a: number, b: number, c: number, d: number, e: number) => void;
|
readonly malloc: (a: number) => number;
|
||||||
readonly __wbg_wbg_rayon_poolbuilder_free: (a: number) => void;
|
readonly free: (a: number) => void;
|
||||||
readonly wbg_rayon_poolbuilder_numThreads: (a: number) => number;
|
readonly worker_initializer: (a: number) => number;
|
||||||
readonly wbg_rayon_poolbuilder_receiver: (a: number) => number;
|
readonly start_main_thread: () => void;
|
||||||
readonly wbg_rayon_poolbuilder_build: (a: number) => void;
|
readonly start_worker_thread: () => void;
|
||||||
readonly initThreadPool: (a: number) => number;
|
|
||||||
readonly wbg_rayon_start_worker: (a: number) => void;
|
|
||||||
readonly __wbindgen_export_0: WebAssembly.Memory;
|
readonly __wbindgen_export_0: WebAssembly.Memory;
|
||||||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
||||||
readonly __wbindgen_malloc: (a: number) => number;
|
readonly __wbindgen_malloc: (a: number) => number;
|
||||||
readonly __wbindgen_free: (a: number, b: number) => void;
|
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||||
readonly __wbindgen_start: () => void;
|
readonly __wbindgen_start: () => void;
|
||||||
@@ -61,3 +43,4 @@ export interface InitOutput {
|
|||||||
* @returns {Promise<InitOutput>}
|
* @returns {Promise<InitOutput>}
|
||||||
*/
|
*/
|
||||||
export default function init (module_or_path?: InitInput | Promise<InitInput>, maybe_memory?: WebAssembly.Memory): Promise<InitOutput>;
|
export default function init (module_or_path?: InitInput | Promise<InitInput>, maybe_memory?: WebAssembly.Memory): Promise<InitOutput>;
|
||||||
|
|
||||||
116
codecs/oxipng/pkg-parallel/squoosh_oxipng.js
generated
116
codecs/oxipng/pkg-parallel/squoosh_oxipng.js
generated
@@ -1,6 +1,21 @@
|
|||||||
import { startWorkers } from './snippets/wasm-bindgen-rayon-3d2df09ebec17a22/src/workerHelpers.js';
|
|
||||||
|
|
||||||
let wasm;
|
let wasm;
|
||||||
|
let memory;
|
||||||
|
|
||||||
|
const heap = new Array(32).fill(undefined);
|
||||||
|
|
||||||
|
heap.push(undefined, null, true, false);
|
||||||
|
|
||||||
|
let heap_next = heap.length;
|
||||||
|
|
||||||
|
function addHeapObject(obj) {
|
||||||
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||||
|
const idx = heap_next;
|
||||||
|
heap_next = heap[idx];
|
||||||
|
|
||||||
|
heap[idx] = obj;
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
||||||
|
|
||||||
@@ -18,21 +33,6 @@ function getStringFromWasm0(ptr, len) {
|
|||||||
return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
|
return cachedTextDecoder.decode(getUint8Memory0().slice(ptr, ptr + len));
|
||||||
}
|
}
|
||||||
|
|
||||||
const heap = new Array(32).fill(undefined);
|
|
||||||
|
|
||||||
heap.push(undefined, null, true, false);
|
|
||||||
|
|
||||||
let heap_next = heap.length;
|
|
||||||
|
|
||||||
function addHeapObject(obj) {
|
|
||||||
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
||||||
const idx = heap_next;
|
|
||||||
heap_next = heap[idx];
|
|
||||||
|
|
||||||
heap[idx] = obj;
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
let WASM_VECTOR_LEN = 0;
|
let WASM_VECTOR_LEN = 0;
|
||||||
|
|
||||||
function passArray8ToWasm0(arg, malloc) {
|
function passArray8ToWasm0(arg, malloc) {
|
||||||
@@ -56,22 +56,22 @@ function getArrayU8FromWasm0(ptr, len) {
|
|||||||
/**
|
/**
|
||||||
* @param {Uint8Array} data
|
* @param {Uint8Array} data
|
||||||
* @param {number} level
|
* @param {number} level
|
||||||
* @param {boolean} interlace
|
|
||||||
* @returns {Uint8Array}
|
* @returns {Uint8Array}
|
||||||
*/
|
*/
|
||||||
export function optimise(data, level, interlace) {
|
export function optimise(data, level) {
|
||||||
try {
|
try {
|
||||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
const retptr = wasm.__wbindgen_export_1.value - 16;
|
||||||
|
wasm.__wbindgen_export_1.value = retptr;
|
||||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||||
var len0 = WASM_VECTOR_LEN;
|
var len0 = WASM_VECTOR_LEN;
|
||||||
wasm.optimise(retptr, ptr0, len0, level, interlace);
|
wasm.optimise(retptr, ptr0, len0, level);
|
||||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||||
wasm.__wbindgen_free(r0, r1 * 1);
|
wasm.__wbindgen_free(r0, r1 * 1);
|
||||||
return v1;
|
return v1;
|
||||||
} finally {
|
} finally {
|
||||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
wasm.__wbindgen_export_1.value += 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,66 +89,29 @@ function takeObject(idx) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {number} num_threads
|
* @param {number} num
|
||||||
* @returns {Promise<any>}
|
* @returns {any}
|
||||||
*/
|
*/
|
||||||
export function initThreadPool(num_threads) {
|
export function worker_initializer(num) {
|
||||||
var ret = wasm.initThreadPool(num_threads);
|
var ret = wasm.worker_initializer(num);
|
||||||
return takeObject(ret);
|
return takeObject(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} receiver
|
|
||||||
*/
|
*/
|
||||||
export function wbg_rayon_start_worker(receiver) {
|
export function start_main_thread() {
|
||||||
wasm.wbg_rayon_start_worker(receiver);
|
wasm.start_main_thread();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
export class wbg_rayon_PoolBuilder {
|
export function start_worker_thread() {
|
||||||
|
wasm.start_worker_thread();
|
||||||
static __wrap(ptr) {
|
|
||||||
const obj = Object.create(wbg_rayon_PoolBuilder.prototype);
|
|
||||||
obj.ptr = ptr;
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
__destroy_into_raw() {
|
|
||||||
const ptr = this.ptr;
|
|
||||||
this.ptr = 0;
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
free() {
|
|
||||||
const ptr = this.__destroy_into_raw();
|
|
||||||
wasm.__wbg_wbg_rayon_poolbuilder_free(ptr);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
numThreads() {
|
|
||||||
var ret = wasm.wbg_rayon_poolbuilder_numThreads(this.ptr);
|
|
||||||
return ret >>> 0;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @returns {number}
|
|
||||||
*/
|
|
||||||
receiver() {
|
|
||||||
var ret = wasm.wbg_rayon_poolbuilder_receiver(this.ptr);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
build() {
|
|
||||||
wasm.wbg_rayon_poolbuilder_build(this.ptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function load(module, imports) {
|
async function load(module, imports, maybe_memory) {
|
||||||
if (typeof Response === 'function' && module instanceof Response) {
|
if (typeof Response === 'function' && module instanceof Response) {
|
||||||
|
memory = imports.wbg.memory = new WebAssembly.Memory({initial:17,maximum:16384,shared:true});
|
||||||
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||||
try {
|
try {
|
||||||
return await WebAssembly.instantiateStreaming(module, imports);
|
return await WebAssembly.instantiateStreaming(module, imports);
|
||||||
@@ -167,6 +130,7 @@ async function load(module, imports) {
|
|||||||
return await WebAssembly.instantiate(bytes, imports);
|
return await WebAssembly.instantiate(bytes, imports);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
memory = imports.wbg.memory = maybe_memory;
|
||||||
const instance = await WebAssembly.instantiate(module, imports);
|
const instance = await WebAssembly.instantiate(module, imports);
|
||||||
|
|
||||||
if (instance instanceof WebAssembly.Instance) {
|
if (instance instanceof WebAssembly.Instance) {
|
||||||
@@ -180,13 +144,10 @@ async function load(module, imports) {
|
|||||||
|
|
||||||
async function init(input, maybe_memory) {
|
async function init(input, maybe_memory) {
|
||||||
if (typeof input === 'undefined') {
|
if (typeof input === 'undefined') {
|
||||||
input = new URL('squoosh_oxipng_bg.wasm', import.meta.url);
|
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||||
}
|
}
|
||||||
const imports = {};
|
const imports = {};
|
||||||
imports.wbg = {};
|
imports.wbg = {};
|
||||||
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
||||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
||||||
};
|
|
||||||
imports.wbg.__wbindgen_module = function() {
|
imports.wbg.__wbindgen_module = function() {
|
||||||
var ret = init.__wbindgen_wasm_module;
|
var ret = init.__wbindgen_wasm_module;
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
@@ -195,18 +156,19 @@ async function init(input, maybe_memory) {
|
|||||||
var ret = wasm.__wbindgen_export_0;
|
var ret = wasm.__wbindgen_export_0;
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
imports.wbg.__wbg_startWorkers_914655bb4d5bb5e1 = function(arg0, arg1, arg2) {
|
imports.wbg.__wbg_of_6510501edc06d65e = function(arg0, arg1) {
|
||||||
var ret = startWorkers(takeObject(arg0), takeObject(arg1), wbg_rayon_PoolBuilder.__wrap(arg2));
|
var ret = Array.of(takeObject(arg0), takeObject(arg1));
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||||
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||||
|
};
|
||||||
|
|
||||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
||||||
input = fetch(input);
|
input = fetch(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
imports.wbg.memory = maybe_memory || new WebAssembly.Memory({initial:17,maximum:16384,shared:true});
|
const { instance, module } = await load(await input, imports, maybe_memory);
|
||||||
|
|
||||||
const { instance, module } = await load(await input, imports);
|
|
||||||
|
|
||||||
wasm = instance.exports;
|
wasm = instance.exports;
|
||||||
init.__wbindgen_wasm_module = module;
|
init.__wbindgen_wasm_module = module;
|
||||||
|
|||||||
Binary file not shown.
15
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts
generated
vendored
15
codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts
generated
vendored
@@ -1,15 +1,12 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export function __wasm_init_memory(): void;
|
export function optimise(a: number, b: number, c: number, d: number): void;
|
||||||
export function optimise(a: number, b: number, c: number, d: number, e: number): void;
|
export function malloc(a: number): number;
|
||||||
export function __wbg_wbg_rayon_poolbuilder_free(a: number): void;
|
export function free(a: number): void;
|
||||||
export function wbg_rayon_poolbuilder_numThreads(a: number): number;
|
export function worker_initializer(a: number): number;
|
||||||
export function wbg_rayon_poolbuilder_receiver(a: number): number;
|
export function start_main_thread(): void;
|
||||||
export function wbg_rayon_poolbuilder_build(a: number): void;
|
export function start_worker_thread(): void;
|
||||||
export function initThreadPool(a: number): number;
|
|
||||||
export function wbg_rayon_start_worker(a: number): void;
|
|
||||||
export const __wbindgen_export_0: WebAssembly.Memory;
|
export const __wbindgen_export_0: WebAssembly.Memory;
|
||||||
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
||||||
export function __wbindgen_malloc(a: number): number;
|
export function __wbindgen_malloc(a: number): number;
|
||||||
export function __wbindgen_free(a: number, b: number): void;
|
export function __wbindgen_free(a: number, b: number): void;
|
||||||
export function __wbindgen_start(): void;
|
export function __wbindgen_start(): void;
|
||||||
|
|||||||
9
codecs/oxipng/pkg/squoosh_oxipng.d.ts
generated
vendored
9
codecs/oxipng/pkg/squoosh_oxipng.d.ts
generated
vendored
@@ -3,17 +3,17 @@
|
|||||||
/**
|
/**
|
||||||
* @param {Uint8Array} data
|
* @param {Uint8Array} data
|
||||||
* @param {number} level
|
* @param {number} level
|
||||||
* @param {boolean} interlace
|
|
||||||
* @returns {Uint8Array}
|
* @returns {Uint8Array}
|
||||||
*/
|
*/
|
||||||
export function optimise(data: Uint8Array, level: number, interlace: boolean): Uint8Array;
|
export function optimise(data: Uint8Array, level: number): Uint8Array;
|
||||||
|
|
||||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
||||||
|
|
||||||
export interface InitOutput {
|
export interface InitOutput {
|
||||||
readonly memory: WebAssembly.Memory;
|
readonly memory: WebAssembly.Memory;
|
||||||
readonly optimise: (a: number, b: number, c: number, d: number, e: number) => void;
|
readonly optimise: (a: number, b: number, c: number, d: number) => void;
|
||||||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
readonly malloc: (a: number) => number;
|
||||||
|
readonly free: (a: number) => void;
|
||||||
readonly __wbindgen_malloc: (a: number) => number;
|
readonly __wbindgen_malloc: (a: number) => number;
|
||||||
readonly __wbindgen_free: (a: number, b: number) => void;
|
readonly __wbindgen_free: (a: number, b: number) => void;
|
||||||
}
|
}
|
||||||
@@ -27,3 +27,4 @@ export interface InitOutput {
|
|||||||
* @returns {Promise<InitOutput>}
|
* @returns {Promise<InitOutput>}
|
||||||
*/
|
*/
|
||||||
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
||||||
|
|
||||||
16
codecs/oxipng/pkg/squoosh_oxipng.js
generated
16
codecs/oxipng/pkg/squoosh_oxipng.js
generated
@@ -40,27 +40,28 @@ function getArrayU8FromWasm0(ptr, len) {
|
|||||||
/**
|
/**
|
||||||
* @param {Uint8Array} data
|
* @param {Uint8Array} data
|
||||||
* @param {number} level
|
* @param {number} level
|
||||||
* @param {boolean} interlace
|
|
||||||
* @returns {Uint8Array}
|
* @returns {Uint8Array}
|
||||||
*/
|
*/
|
||||||
export function optimise(data, level, interlace) {
|
export function optimise(data, level) {
|
||||||
try {
|
try {
|
||||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
const retptr = wasm.__wbindgen_export_0.value - 16;
|
||||||
|
wasm.__wbindgen_export_0.value = retptr;
|
||||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||||
var len0 = WASM_VECTOR_LEN;
|
var len0 = WASM_VECTOR_LEN;
|
||||||
wasm.optimise(retptr, ptr0, len0, level, interlace);
|
wasm.optimise(retptr, ptr0, len0, level);
|
||||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||||
wasm.__wbindgen_free(r0, r1 * 1);
|
wasm.__wbindgen_free(r0, r1 * 1);
|
||||||
return v1;
|
return v1;
|
||||||
} finally {
|
} finally {
|
||||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
wasm.__wbindgen_export_0.value += 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function load(module, imports) {
|
async function load(module, imports) {
|
||||||
if (typeof Response === 'function' && module instanceof Response) {
|
if (typeof Response === 'function' && module instanceof Response) {
|
||||||
|
|
||||||
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
||||||
try {
|
try {
|
||||||
return await WebAssembly.instantiateStreaming(module, imports);
|
return await WebAssembly.instantiateStreaming(module, imports);
|
||||||
@@ -79,6 +80,7 @@ async function load(module, imports) {
|
|||||||
return await WebAssembly.instantiate(bytes, imports);
|
return await WebAssembly.instantiate(bytes, imports);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
const instance = await WebAssembly.instantiate(module, imports);
|
const instance = await WebAssembly.instantiate(module, imports);
|
||||||
|
|
||||||
if (instance instanceof WebAssembly.Instance) {
|
if (instance instanceof WebAssembly.Instance) {
|
||||||
@@ -92,7 +94,7 @@ async function load(module, imports) {
|
|||||||
|
|
||||||
async function init(input) {
|
async function init(input) {
|
||||||
if (typeof input === 'undefined') {
|
if (typeof input === 'undefined') {
|
||||||
input = new URL('squoosh_oxipng_bg.wasm', import.meta.url);
|
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||||
}
|
}
|
||||||
const imports = {};
|
const imports = {};
|
||||||
imports.wbg = {};
|
imports.wbg = {};
|
||||||
@@ -104,8 +106,6 @@ async function init(input) {
|
|||||||
input = fetch(input);
|
input = fetch(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const { instance, module } = await load(await input, imports);
|
const { instance, module } = await load(await input, imports);
|
||||||
|
|
||||||
wasm = instance.exports;
|
wasm = instance.exports;
|
||||||
|
|||||||
Binary file not shown.
5
codecs/oxipng/pkg/squoosh_oxipng_bg.wasm.d.ts
generated
vendored
5
codecs/oxipng/pkg/squoosh_oxipng_bg.wasm.d.ts
generated
vendored
@@ -1,7 +1,8 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export const memory: WebAssembly.Memory;
|
export const memory: WebAssembly.Memory;
|
||||||
export function optimise(a: number, b: number, c: number, d: number, e: number): void;
|
export function optimise(a: number, b: number, c: number, d: number): void;
|
||||||
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
export function malloc(a: number): number;
|
||||||
|
export function free(a: number): void;
|
||||||
export function __wbindgen_malloc(a: number): number;
|
export function __wbindgen_malloc(a: number): number;
|
||||||
export function __wbindgen_free(a: number, b: number): void;
|
export function __wbindgen_free(a: number, b: number): void;
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
#[cfg(feature = "parallel")]
|
|
||||||
pub use wasm_bindgen_rayon::init_thread_pool;
|
|
||||||
|
|
||||||
use oxipng::AlphaOptim;
|
use oxipng::AlphaOptim;
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
|
mod malloc_shim;
|
||||||
|
|
||||||
|
#[cfg(feature = "parallel")]
|
||||||
|
pub mod parallel;
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn optimise(data: &[u8], level: u8, interlace: bool) -> Vec<u8> {
|
pub fn optimise(data: &[u8], level: u8) -> Vec<u8> {
|
||||||
let mut options = oxipng::Options::from_preset(level);
|
let mut options = oxipng::Options::from_preset(level);
|
||||||
options.alphas.insert(AlphaOptim::Black);
|
options.alphas.insert(AlphaOptim::Black);
|
||||||
options.alphas.insert(AlphaOptim::White);
|
options.alphas.insert(AlphaOptim::White);
|
||||||
@@ -13,7 +15,6 @@ pub fn optimise(data: &[u8], level: u8, interlace: bool) -> Vec<u8> {
|
|||||||
options.alphas.insert(AlphaOptim::Down);
|
options.alphas.insert(AlphaOptim::Down);
|
||||||
options.alphas.insert(AlphaOptim::Left);
|
options.alphas.insert(AlphaOptim::Left);
|
||||||
options.alphas.insert(AlphaOptim::Right);
|
options.alphas.insert(AlphaOptim::Right);
|
||||||
options.interlace = Some(if interlace { 1 } else { 0 });
|
|
||||||
|
|
||||||
options.deflate = oxipng::Deflaters::Libdeflater;
|
options.deflate = oxipng::Deflaters::Libdeflater;
|
||||||
oxipng::optimize_from_memory(data, &options).unwrap_throw()
|
oxipng::optimize_from_memory(data, &options).unwrap_throw()
|
||||||
|
|||||||
47
codecs/oxipng/src/malloc_shim.rs
Normal file
47
codecs/oxipng/src/malloc_shim.rs
Normal 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))
|
||||||
|
}
|
||||||
62
codecs/oxipng/src/parallel.rs
Normal file
62
codecs/oxipng/src/parallel.rs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
use crossbeam_channel::{bounded, Receiver, Sender};
|
||||||
|
use once_cell::sync::OnceCell;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
use wasm_bindgen::JsValue;
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
extern "C" {
|
||||||
|
#[wasm_bindgen(js_namespace = Array, js_name = of)]
|
||||||
|
fn array_of_2(a: JsValue, b: JsValue) -> JsValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is one of the parts that work around Chromium incorrectly implementing postMessage:
|
||||||
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=1075645
|
||||||
|
//
|
||||||
|
// rayon::ThreadPoolBuilder (used below) executes spawn handler to populate the worker pool,
|
||||||
|
// and then blocks the current thread until each worker unblocks its (opaque) lock.
|
||||||
|
//
|
||||||
|
// Normally, we could use postMessage directly inside the spawn handler to
|
||||||
|
// post module + memory + threadPtr to each worker, and the block the current thread.
|
||||||
|
//
|
||||||
|
// However, that bug means that postMessage is currently delayed until the next event loop,
|
||||||
|
// which will never spin since we block the current thread, and so the other workers will
|
||||||
|
// never be able to unblock us.
|
||||||
|
//
|
||||||
|
// To work around this problem, we:
|
||||||
|
// 1) Expose `worker_initializer` that returns module + memory pair (without threadPtr)
|
||||||
|
// that workers can be initialised with to become native threads.
|
||||||
|
// JavaScript can postMessage this pair in advance, and asynchronously wait for workers
|
||||||
|
// to acknowledge the receipt.
|
||||||
|
// 2) Create a global communication channel on the Rust side using crossbeam.
|
||||||
|
// It will be used to send threadPtr to the pre-initialised workers
|
||||||
|
// instead of postMessage.
|
||||||
|
// 3) Provide a separate `start_main_thread` that expects all workers to be ready,
|
||||||
|
// and just uses the provided channel to send `threadPtr`s using the
|
||||||
|
// shared memory and blocks the current thread until they're all grabbed.
|
||||||
|
// 4) Provide a `worker_initializer` that is expected to be invoked from various workers,
|
||||||
|
// reads one `threadPtr` from the shared channel and starts running it.
|
||||||
|
static CHANNEL: OnceCell<(Sender<rayon::ThreadBuilder>, Receiver<rayon::ThreadBuilder>)> =
|
||||||
|
OnceCell::new();
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn worker_initializer(num: usize) -> JsValue {
|
||||||
|
CHANNEL.get_or_init(|| bounded(num));
|
||||||
|
array_of_2(wasm_bindgen::module(), wasm_bindgen::memory())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn start_main_thread() {
|
||||||
|
let (sender, _) = CHANNEL.get().unwrap();
|
||||||
|
|
||||||
|
rayon::ThreadPoolBuilder::new()
|
||||||
|
.num_threads(sender.capacity().unwrap())
|
||||||
|
.spawn_handler(|thread| Ok(sender.send(thread).unwrap_throw()))
|
||||||
|
.build_global()
|
||||||
|
.unwrap_throw()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn start_worker_thread() {
|
||||||
|
let (_, receiver) = CHANNEL.get().unwrap();
|
||||||
|
receiver.recv().unwrap_throw().run()
|
||||||
|
}
|
||||||
1
codecs/png/.gitignore
vendored
1
codecs/png/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/target
|
|
||||||
225
codecs/png/Cargo.lock
generated
225
codecs/png/Cargo.lock
generated
@@ -1,225 +0,0 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
[[package]]
|
|
||||||
name = "adler32"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitflags"
|
|
||||||
version = "1.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bumpalo"
|
|
||||||
version = "3.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bytemuck"
|
|
||||||
version = "1.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bed57e2090563b83ba8f83366628ce535a7584c9afa4c9fc0612a03925c6df58"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "byteorder"
|
|
||||||
version = "1.3.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-if"
|
|
||||||
version = "0.1.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-if"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crc32fast"
|
|
||||||
version = "1.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 0.1.10",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "deflate"
|
|
||||||
version = "0.8.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174"
|
|
||||||
dependencies = [
|
|
||||||
"adler32",
|
|
||||||
"byteorder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "js-sys"
|
|
||||||
version = "0.3.45"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8"
|
|
||||||
dependencies = [
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lazy_static"
|
|
||||||
version = "1.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "log"
|
|
||||||
version = "0.4.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 0.1.10",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "miniz_oxide"
|
|
||||||
version = "0.3.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435"
|
|
||||||
dependencies = [
|
|
||||||
"adler32",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "png"
|
|
||||||
version = "0.16.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"crc32fast",
|
|
||||||
"deflate",
|
|
||||||
"miniz_oxide",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "proc-macro2"
|
|
||||||
version = "1.0.27"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
|
|
||||||
dependencies = [
|
|
||||||
"unicode-xid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "quote"
|
|
||||||
version = "1.0.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rgb"
|
|
||||||
version = "0.8.25"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "287f3c3f8236abb92d8b7e36797f19159df4b58f0a658cc3fb6dd3004b1f3bd3"
|
|
||||||
dependencies = [
|
|
||||||
"bytemuck",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "squoosh-png"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"png",
|
|
||||||
"rgb",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn"
|
|
||||||
version = "1.0.72"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"unicode-xid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-xid"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen"
|
|
||||||
version = "0.2.74"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 1.0.0",
|
|
||||||
"wasm-bindgen-macro",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-backend"
|
|
||||||
version = "0.2.74"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
|
|
||||||
dependencies = [
|
|
||||||
"bumpalo",
|
|
||||||
"lazy_static",
|
|
||||||
"log",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-macro"
|
|
||||||
version = "0.2.74"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
|
|
||||||
dependencies = [
|
|
||||||
"quote",
|
|
||||||
"wasm-bindgen-macro-support",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-macro-support"
|
|
||||||
version = "0.2.74"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"wasm-bindgen-backend",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-shared"
|
|
||||||
version = "0.2.74"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "web-sys"
|
|
||||||
version = "0.3.45"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d"
|
|
||||||
dependencies = [
|
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "squoosh-png"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Surma <surma@surma.dev>"]
|
|
||||||
edition = "2018"
|
|
||||||
publish = false
|
|
||||||
|
|
||||||
[package.metadata.wasm-pack.profile.release]
|
|
||||||
wasm-opt = ["-O", "--no-validation"]
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
crate-type = ["cdylib"]
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
png = "0.16.7"
|
|
||||||
wasm-bindgen = "0.2.68"
|
|
||||||
web-sys = { version = "0.3.45", features = ["ImageData"] }
|
|
||||||
rgb = "0.8.25"
|
|
||||||
|
|
||||||
[profile.release]
|
|
||||||
lto = true
|
|
||||||
opt-level = "s"
|
|
||||||
4
codecs/png/package-lock.json
generated
4
codecs/png/package-lock.json
generated
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "oxipng",
|
|
||||||
"lockfileVersion": 1
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "oxipng",
|
|
||||||
"scripts": {
|
|
||||||
"build": "../build-rust.sh"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "squoosh-png",
|
|
||||||
"collaborators": [
|
|
||||||
"Surma <surma@surma.dev>"
|
|
||||||
],
|
|
||||||
"version": "0.1.0",
|
|
||||||
"files": [
|
|
||||||
"squoosh_png_bg.wasm",
|
|
||||||
"squoosh_png.js",
|
|
||||||
"squoosh_png.d.ts"
|
|
||||||
],
|
|
||||||
"module": "squoosh_png.js",
|
|
||||||
"types": "squoosh_png.d.ts",
|
|
||||||
"sideEffects": false
|
|
||||||
}
|
|
||||||
35
codecs/png/pkg/squoosh_png.d.ts
generated
vendored
35
codecs/png/pkg/squoosh_png.d.ts
generated
vendored
@@ -1,35 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* @param {Uint8Array} data
|
|
||||||
* @param {number} width
|
|
||||||
* @param {number} height
|
|
||||||
* @returns {Uint8Array}
|
|
||||||
*/
|
|
||||||
export function encode(data: Uint8Array, width: number, height: number): Uint8Array;
|
|
||||||
/**
|
|
||||||
* @param {Uint8Array} data
|
|
||||||
* @returns {ImageData}
|
|
||||||
*/
|
|
||||||
export function decode(data: Uint8Array): ImageData;
|
|
||||||
|
|
||||||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
||||||
|
|
||||||
export interface InitOutput {
|
|
||||||
readonly memory: WebAssembly.Memory;
|
|
||||||
readonly encode: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
||||||
readonly decode: (a: number, b: number) => number;
|
|
||||||
readonly __wbindgen_free: (a: number, b: number) => void;
|
|
||||||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
||||||
readonly __wbindgen_malloc: (a: number) => number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
||||||
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
||||||
*
|
|
||||||
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
||||||
*
|
|
||||||
* @returns {Promise<InitOutput>}
|
|
||||||
*/
|
|
||||||
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
||||||
175
codecs/png/pkg/squoosh_png.js
generated
175
codecs/png/pkg/squoosh_png.js
generated
@@ -1,175 +0,0 @@
|
|||||||
|
|
||||||
let wasm;
|
|
||||||
|
|
||||||
let cachedTextDecoder = new TextDecoder('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 cachegetUint8ClampedMemory0 = null;
|
|
||||||
function getUint8ClampedMemory0() {
|
|
||||||
if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {
|
|
||||||
cachegetUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);
|
|
||||||
}
|
|
||||||
return cachegetUint8ClampedMemory0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getClampedArrayU8FromWasm0(ptr, len) {
|
|
||||||
return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
||||||
}
|
|
||||||
|
|
||||||
const heap = new Array(32).fill(undefined);
|
|
||||||
|
|
||||||
heap.push(undefined, null, true, false);
|
|
||||||
|
|
||||||
let heap_next = heap.length;
|
|
||||||
|
|
||||||
function addHeapObject(obj) {
|
|
||||||
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
||||||
const idx = heap_next;
|
|
||||||
heap_next = heap[idx];
|
|
||||||
|
|
||||||
heap[idx] = obj;
|
|
||||||
return idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
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} width
|
|
||||||
* @param {number} height
|
|
||||||
* @returns {Uint8Array}
|
|
||||||
*/
|
|
||||||
export function encode(data, width, height) {
|
|
||||||
try {
|
|
||||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
||||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
||||||
var len0 = WASM_VECTOR_LEN;
|
|
||||||
wasm.encode(retptr, ptr0, len0, width, height);
|
|
||||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
||||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
||||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
||||||
wasm.__wbindgen_free(r0, r1 * 1);
|
|
||||||
return v1;
|
|
||||||
} finally {
|
|
||||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getObject(idx) { return heap[idx]; }
|
|
||||||
|
|
||||||
function dropObject(idx) {
|
|
||||||
if (idx < 36) return;
|
|
||||||
heap[idx] = heap_next;
|
|
||||||
heap_next = idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
function takeObject(idx) {
|
|
||||||
const ret = getObject(idx);
|
|
||||||
dropObject(idx);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param {Uint8Array} data
|
|
||||||
* @returns {ImageData}
|
|
||||||
*/
|
|
||||||
export function decode(data) {
|
|
||||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
||||||
var len0 = WASM_VECTOR_LEN;
|
|
||||||
var ret = wasm.decode(ptr0, len0);
|
|
||||||
return takeObject(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function load(module, imports) {
|
|
||||||
if (typeof Response === 'function' && module instanceof Response) {
|
|
||||||
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
||||||
try {
|
|
||||||
return await WebAssembly.instantiateStreaming(module, imports);
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
||||||
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const bytes = await module.arrayBuffer();
|
|
||||||
return await WebAssembly.instantiate(bytes, imports);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
const instance = await WebAssembly.instantiate(module, imports);
|
|
||||||
|
|
||||||
if (instance instanceof WebAssembly.Instance) {
|
|
||||||
return { instance, module };
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function init(input) {
|
|
||||||
if (typeof input === 'undefined') {
|
|
||||||
input = new URL('squoosh_png_bg.wasm', import.meta.url);
|
|
||||||
}
|
|
||||||
const imports = {};
|
|
||||||
imports.wbg = {};
|
|
||||||
imports.wbg.__wbg_newwithownedu8clampedarrayandsh_787b2db8ea6bfd62 = function(arg0, arg1, arg2, arg3) {
|
|
||||||
var v0 = getClampedArrayU8FromWasm0(arg0, arg1).slice();
|
|
||||||
wasm.__wbindgen_free(arg0, arg1 * 1);
|
|
||||||
var ret = new ImageData(v0, arg2 >>> 0, arg3 >>> 0);
|
|
||||||
return addHeapObject(ret);
|
|
||||||
};
|
|
||||||
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
||||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
||||||
};
|
|
||||||
|
|
||||||
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
||||||
input = fetch(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const { instance, module } = await load(await input, imports);
|
|
||||||
|
|
||||||
wasm = instance.exports;
|
|
||||||
init.__wbindgen_wasm_module = module;
|
|
||||||
|
|
||||||
return wasm;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default init;
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user